phpHtmlLib is now a WordPress plugin

The overhaul of phpHtmlLib is largely complete, I just need to validate a few more things before I call it done.  One of the things I did during the overhaul was to add some things to the library so it will load as a WordPress plugin.  This will make installation and configutation much easier.  The changes to phpHtmlLib made the migration from PEAR to the WordPress database abstraction class much easier.

Demo Site is running … sort of

The nice folks at WinSwim are interested in what I am doing with this plugin and have offered to host a demo site.  You can find it at:  http://wp.winswim.com  The demo site is running for the most part, if you are interested in trying it out, go ahead and register with the demo site then drop me an e-mail so I can change your permissions so you can actually do something other than register sample swimmers.

I say the demo site is running “sort of” because just about everything is working although there are a few bugs I know of (e.g. defining age groups).  The one thing which isn’t working and it is driving me nuts is the ability to display a Google Map.  This is a really nice feature that my own team used quite a bit this year.

I have encapsulated a class called Phoogle within wp-SwimTeam and it worked just fine in my development area and on the MacDolphins site.  Phoogle relies on a PHP configuration option known as allow_url_fopen which basically allows PHP to open a web page on an external site and read the content like it would a local file.  It’s a nice feature but one that a lot of web hosting providers turn off.  In fact, the host for the demo site has it turned off.

There is another technology called cURL which for all practical purposes, accomplishes what allow_url_fopen does although it is a little more involved.  I enhanced Phoogle to use cURL if allow_url_fopen is disabled and it worked just fine in my development area.  Great!  The change was pretty simple too.  Uploaded to the production server and nothing.  It doesn’t work there.  It turns out that GoDaddy (the web hosting provider) has a goofy cURL implementation which requires the use of a proxy.

After a much trial and error and a couple e-mails with GoDaddy support, all I have accomplished is a partial cURL request.  I am unable to get a complete response which prevents the map from being displayed.  I then got another e-mail from GoDaddy telling me that cURL is only supported on their Linux hosting environments not under Windows (even though it is enabled in PHP.ini).  Bleh.  ;-(

I think for now when I find a short code, I will check the allow_url_fopen setting and if it is off, will issue a warning during the short code processing.  There is probably a way to interact with the Google Maps API via Javascript, I guess I will need to look into that.  It is really too bad, the Phoogle solution was really simple to use.

Significant change to the Database Class

Getting a demo up and running on a new host has been very enlightening.  I have used the PEAR DB class for years because it works well and is usually available.  The host which is being used for the demo site doesn’t appear to have the PEAR DB class installed so this has motivated me to migrate the SwimTeamDBI class to make use of the builtin WordPress database access class instead of depending on PEAR.  I have considered doing this for a while but have put it off but it looks like it is time to deal with it.

My intial impression is it should not be to much of a change as my current database class abstracts the PEAR aspect away from the rest of wp-SwimTeam.  The bigger concern is the phpHtmlLib widgets which also depend on PEAR.   Those will need attention and I suspect I will end up implementing a new database abstraction class for WordPress as part of phpHtmlLib.

I have been doing a lot of work on phpHtmlLib over the last week and for the most part, it appears to be done.  All of the changes allow phpHtmlLib to now be loaded as a WordPress plugin which is much easier to support.

How far is it from 91 to 89?

How far is from 91 to 89?  Turns out a 4-putt ultimately kept me from breaking 90.  There were other shots which didn’t help either but a 4 putt on a par 3 after hitting the green from the tee really, really hurts.

I teed it up Ronnie, a co-worker and one of our customers this morning.  I played my best round in a long time – shot 91 and really hit the ball well.  Ahhg, so close to breaking 90!  I hit the ball well off the tee all day which makes a huge difference.  I had a few other shots which were poorly executed which also could have gotten me under 90 but that 4 putt is what sticks in my brain.

phpHtmlLib

I have been putting some cycles into phpHtmlLib as part of getting my wp-SwimTeam WordPress plugin in shape for other people to use it.  I found that PHP5 and GoDaddy’s PHP configuration, phpHtmlLib wasn’t very happy.  After a couple days work I have it put back together so it will work with both PHP4 and PHP5 and can deal with GoDaddy’s PHP configuration.  Now I need to commit all the changes and get back to work on wp-SwimTeam.

Stinkin' up the joint

Last Friday Ronnie and I played 18 and were paired up another member and his old neighbor who happens to be a player on the local high school team and a scratch golfer.  Nice kid and he can hit the ball a mile!  I have played with a couple people who can really hit it but none were in the same league as this kid.  Not sure what he shot but it was around par.  After his drive on #18 he teed up another and tried to drive the green which is about 350 yards away.  He was about 20 yards short!

Of course, I played like crap.  Started out okay but then I started pulling the ball left which I never do.  I have struggled with a slice and if I get careless, it creeps back in.  But a pull hook?  Every once in a while but Friday I must have hit a dozen.  Needless to say I was hitting from all sorts of odd places.  My short game was ok and I putted well, no 3 putts at all.  The highlight of my round was on #18 where once again I pulled my drive into the lake.  From the drop area I hit a 3 hybrid to the fringe of the green and then hit a wedge in the hole for par!  It may have been the best wedge shot I ever hit.  It was a nice way to finish what was otherwise a terrible (101) round.

Saturday I was hoping to get out and see if I could hit the ball a little better.  I concluded that on Friday in an effort to hit the ball farther, I was swinging much too quickly (bad tempo) and hitting the ball poorly.  My daughter (who is 8) and I played 9 holes late Saturday evening and although I didn’t score very well (50), I hit the ball much better and was much happier than I was on Friday.  I didn’t putt well at all and some of that I attribute to making sure we weren’t holding up the group behind us.

The trickle down effect

While trying to get a demo site up and running I ran into an issue that has taken me down a path I didn’t expect to head down at this time.  But now that I have run into it, I have decided to fix it correctly.

The wp-SwimTeam plugin depends on phpHtmlLib and the 2.x version of the library requires that it be installed in the web site’s root directory.  This typically isn’t a big deal but in some cases can be inconvenient.  It also requires the library be named phphtmllib as the path is (was) encoded into quite a few of the widgets.

When I uploaded the library to the new demo site, it didn’t run correctly.  The demo site is running PHP5 which I immediately suspected as the problem.  So I loaded PHP5 and phpHtmlLib into a new virtual machine (I love VMware, it is wonderful for configuring different environments) and all the examples ran just fine.  Odd, very odd.  Digging into it further, it looks like the hosting provider’s PHP virtual directory support setting is different than what I had locally and affects how include files are handled.

A couple of tests confirmed my suspicions.  Since this hosting provider is large, I suspect this PHP configuration is pretty typical and it provided sufficient motivation to go back and fix phpHtmlLib 2.x so it can be loaded with appropriate configured PHP define() statements.  If you look through the phpHtmlLib forums you’ll find this is a fairly regularly requested item (including by me) and phpHtmlLib 3 (which requires PHP5) is configured this way.

Over the last couple days I have been updating the phpHtmlLib 2.x branch to support this configuration method and now have it all running correctly in my development area.  Before I commit all the changes, and there are a lot of them, I need to verify it all works in the suspect hosting environment.

The trickle down of setting up a demo site resulted in an overhaul to phpHtmlLib.  It needed to be done anyway and doing it will allow phpHtmlLib to be loaded as a WordPress plugin eventually.