• Mar
  • 07

PHP Speedy Wordpress Plugin - Preview Release

Please see here for the latest version of this plugin: http://aciddrop.com/2008/03/22/php-speedy-wordpress-plugin-version-04/

All comments should be added on this new page. Thanks!


Related posts

Posted by admin in php, wordpress
trackback
 

  • Mar
  • 7
DazzlinDonna

Hmm, tried it, but then my style sheet disappeared (meaning that when viewing my blog, it was like viewing it without a style sheet). Have uninstalled it for now.

  • Mar
  • 7
Jeromy
Jeromy

Great work man! Having more trouble now with the exclude list, it’s not picking up any files after the comma

scriptaculous.js, prototype.js

Entering that, speedy correctly ignore scriptaculous, but not prototype. This is what was causing the AJAX comments plugin to choke (which is lame). Anyway, just wanted to pass it on, this is pretty sweet man

  • Mar
  • 7
admin
Leon

Donna - thanks for the feedback. What does it say on the test configuration screen of PHP Speedy? Does it list the CSS files correctly?

Jeromy - thanks for the feedback, that bug should be fixed in the latest version (0.2). By the way, if scriptaculous is causing problems, try including the files individually: E.g
<script src="../libs/js/builder.js" type="text/javascript"></script>
<script src="../libs/js/effects.js" type="text/javascript"></script>
<script src="../libs/js/dragdrop.js" type="text/javascript"></script>
etc.

  • Mar
  • 7
Jeromy
Jeromy

Hey man, just grabbed the latest version, activated, but now nothing is happening. It’s not compressing anything and there’s no trace of it php-speedy in the source code. I’ve cleared my cache, deactivate and reactivated it and still nothing. No files are being compressed. Very strange. Thanks for all the hard work on this man, this will become the defacto standard for WP compression

  • Mar
  • 7
admin
Leon

Jeromy - that’s interesting. Is everything OK on the Test Configuration screen? Also, what is the URL of your blog if you don’t mind saying?

  • Mar
  • 7
Jeromy
Jeromy

Yup, everything checks out just like normal, nothing out of the ordinary. I’m working on a private site right now, otherwise I’d send it over. Sucks for you, I’ll keep trying on my end and let you know what I find out!

  • Mar
  • 7
Luciano Passuello

This plug-in is just amazing! A new ‘must have’ for all Wordpress bloggers.
Very, very good job! My site just went from an average of 11sec load time to just 4! Wow.

I just downloaded 0.1 and, like, 5 min later, there’s a 0.2. I think it’s a good idea to maintain a changelog.

Thanks again for this great plug-in!

  • Mar
  • 7
admin
Leon

Thanks Luciano, and good idea on the changelog, I will do that.

Please let me know if any problems come up.

  • Mar
  • 7
Luciano Passuello

Leon,

I have a small suggestion and some questions.

1. Suggestion: Instead of ‘Yes’/'No’ radio buttons in the options page, I think checkboxes would be better

2. in Gzip options, you mention: “For larger sites, you should Gzip via the web server. “. WHat do you mean by that? Is is setting ” “SetOutputFilter DEFLATE” on .htaccess? Or via the web server means only on httpd.conf?

3. Also, you mention for “small scale sites”. I know there are no hard lines here, but what order of magnitude are we talking about here?

4. Couldn’t the minify options also remove comments from the source code (maybe as an option)?
Many themes and wordpress plug-in add A LOT of useless comments in the HTML.

Thanks again for this great release!!

  • Mar
  • 8
steve
steve

Leon,

It’s definitely coming along very well!

I’m currently switching hosts so I’ve only been able to test it locally but it should work the same…I hope (another plugin I had didn’t when I got it online)

Anyways, two things.

1. Having the same problem as Donna with the style sheet not working. Everything on the test config page looks right. I found turning the minify css option on was the culprit. I did find this error when I viewed the css via the web developer add-on:

Parse error: syntax error, unexpected $end in C:\wamp\www\wordpress\wp-content\plugins\php_speedy_wp\cache\_cmp_cssstylesheet_22954efd8c5db973754a8de9d56c96e2.php on line 34

I tried finding what was causing the parse error in the cmp file it listed, but couldn’t figure anything out.
I went back and tried version 0.1 thinking maybe cause I am doing this locally it was breaking, but it worked fine. I tried copying the code in compressor.php form 0.1 to 0.2 pertaining to minifying the css. No luck there. (I obviously don’t know what i’m doing)

2. Nothing big but if you are ignoring multiple files, there cannot be a space after commas (probably Jeromy’s issue). May want to clarify that in the instructions on the config page.
Also, on the test config page, it says one of my files was ignored from the ignore list but didn’t list the second one, although it is actually ignored. Also, I found it didn’t matter what the order I listed them as. For example, if I listed ec3.js,tags.js it would only say it skipped ecs.js. If I put tags.js,ec3.js, iit still said it only skipped ec3.js. Weird but not a big deal cause it did ignore them both.

  • Mar
  • 9
Jeromy
Jeromy

Thanks Steve, thanks that was the problem, I removed the space and all is well. It’s too bad that prototype and scriptaculous get hosed in the process - I actually tried minifying them myself self to no avail. it’d be nice to at least wrap them all up in a separate serving or something. But I got it running now and I’m pretty happy with that ;)

  • Mar
  • 9
Jeromy
Jeromy

Hey Leon, just did some more testing, and it turns out that this plugin completely disables 301 redirects (whether from a plugin or added manually in your .htaccess). They work fine when you disable the plugin. Very strange, just wanted to give you a heads up.

  • Mar
  • 9
admin
Leon

steve - many thanks for the excellent feedback. I’m puzzled by the first one. I did make a small change to the CSS minification function in 0.2 and have switched back. re: 2, great bug spot there. Should be fixed now. (0.2.1)

Jeromy - nice spot on the 301s. Should be ok now (0.2.1).

  • Mar
  • 10
Jeromy
Jeromy

Awesome man, thanks for being so responsive. I’ll keep putting this through the ringer. My next request would be to combine prototype/scriptaculous somehow (I realize they’re notoriously hard to minify)

  • Mar
  • 10
Jeromy
Jeromy

Hmm, just added the newest version and I’m having the same problem before, I test it, activate it and view the site, but nothing is being minified.

  • Mar
  • 10
steve
steve

No problem, Leon. This is the single greatest wordpress plugin and I’m more than happy to contribute somehow cause I certainly can’t write one.

With 0.2.1, the minify css is working again. However, the spaces in the ignore list still keeping the second and so on files from being ignored.

Let me know if I can be of anymore help.

  • Mar
  • 10
admin
Leon

Luciano - thanks for your suggestions. To answer:

1. Radio buttons are for when the user can only select one option out of many. Checkboxes are for when they can select multiple. As the option here is either yes or no (no both), it has to be radio buttons I'm afraid.

2. Via httpd.conf or .htaccess. Webserver means the compression is handled by whichever webserver you are using (be it Apache or something else).

3. There are no hard and fast rules, and it depends on the power of your server. Under 1000 visitors a day? The key here is to turn it on - see what happens - and get ready to turn it off again!

4. It could. I actually commented out the line that removes comments, but I now can't remember why. Probably because it broke something! I can add it back in as an option.

Jeromy
- Prototype and scriptaculous do minify. Have a look at the original PHP Speedy test page:
http://aciddrop.com/aciddrop/php_speedy/test_page/compress_me.php?no_images=true&compress=no

That's without compression. Look at the source, and Protaculous is there. The catch is you have to include each scriptaculous file individually, because it uses document.write loading otherwise.

Now, as to your problem that the latest version does nothing, I'm puzzled. You're not serving up a cached version by any chance? If not, try finding the do_compression function in php_speedy_wp.php. Try replacing it with:

CODE:
//Do compression for a page or post
    function do_compression($content) {
       
        die();
   
        if((is_home() || is_singular()) && count($_POST) == 0) {
        $speedy_controller = new php_speedy_wp_controller(array('admin'=>$this));
        $speedy_controller->run()
        }   
   
    }

and

CODE:
//Do compression for a page or post
    function do_compression($content) {
       
   
        if((is_home() || is_singular()) && count($_POST) == 0) {
        die();
        $speedy_controller = new php_speedy_wp_controller(array('admin'=>$this));
        $speedy_controller->run()
        }   
   
    }

Do both of those cause a blank page to show? (warning: only try on a test site, as they will hopefully cause a blank page).

Otherwise, I'm happy to come on your server and debug it, if you could provide access?

Steve - you're right. The spaces thing should finally work now (0.2.2)

  • Mar
  • 10
Jeromy
Jeromy

First one caused the screen to go blank, 2nd one didn't do anything - I've cleared my cache (and I'm not running an cache-type plugins) - not sure what the deal is... Thanks for the tip on scriptaculous!

  • Mar
  • 10
admin
Leon

Jeromy - first one works eh? Interesting. What version of Wordpress are you running?

  • Mar
  • 11
Jeromy
Jeromy

Yeah, the first cause everything to go blank. I'm running 2.3.3

  • Mar
  • 11
Anish

I have added lightbox.js and lightbox.css to the ignore list since the lightbox.css file is loaded via document.write. The html source reflects this as well, but clicking on an image does not initiate the lightbox script as expected. Rather, the image is opened on a page of its own.

Any suggestions on what I need to change?

  • Mar
  • 11
Luciano Passuello

Hi Leon, thanks for your response.
What I meant by using checkboxes is doing like this:
Instead of "minify Js? ( ) Yes ( ) No" (with radio buttons), simply:
"[ ] Minify JS" (with one checkbox -- checked meaning yes, and unchecked meaning no).

Regarding turning off comments, the problem probably was on off comments in CSS. There are some hacks that rely on comments to make pages work on IE, as far as I know.

Keep up the great work!

  • Mar
  • 11
Amos

Hey Leon, Appreciate all the hard work you put into this. Just a couple of quick questions. One, according to YSlow I'm getting a grade of F with the adding Expires header, even though the options are turned on in PHP Seedy. Was wondering if maybe it's a hosting issue. I'm not really all that educated about what's going on under the hood here.

And two, maybe a silly question, but how would this plugin play with WP-Super Cache? I know Super Cache has a gzip option as well, but it would seem they are doing two different things here. Anyway, wondering about compatibility, or the need to run both.

Again, I appreciate the work you're putting into this. You have my appreciation Sir.

  • Mar
  • 11
admin
Leon

Jeromy - well, for some reason it seems your is_home() and is_singular() functions aren't working. I'm puzzled. Could you perhaps email me a zip of your wordpress files so I can test?

Luciano - I see what you mean about the checkboxes. I suppose that would be clearer. I'll consider it!

  • Mar
  • 11
admin
Leon

Anish - what's the url where this is happening?

Amos - If you click to the right of "Add an expires heading" it will tell you the files at fault. Remeber, PHP Speedy will only add an expires header to your CSS and JS. It won't touch your images (yet), or external JS.

  • Mar
  • 11
Anish

you can see an example of the issue with this post:
http://opindian.com/blog/2008/02/27/book-a-long-way-gone-by-ishmael-beah/

The image should popup using lightbox, but instead it opens on a new page. Thanks for the assistance.

  • Mar
  • 12
Gordie

Seems that I have the same problem as Jeromy : I setup PHP SPEEDY, everything work fine, I activated......
but nothing changes.
The websites took 11sec before php speedy and takes 11sec now too...
Nothing seems to change in the source file (sames files than before are called) nor firebug... ?
http://snipurl.com/21krt

  • Mar
  • 12
Luciano Passuello

Hi Leon,
I think I just found a plug-in incompatibility. I am currently using the (very popular) Permalink Redirect plugin. It works by 301-redirecting urls without a trailing backslash to the one with trailing backslash.

When I have both plug-ins activated, I get a 500 Internal Server Error when I access the URL without the trailing backslash.

I am using 0.2.2 (which works fine for other "manual" 301 redirects I have).

I am currently disabling PHP Speedy for the time being, as I really need to have those redirects. Please let me know any way I can help troubleshoot this. Thanks!

  • Mar
  • 12
steve
steve

Anish - I'm using a lightbox plugin on my site and it's working fine with Speedy. I looked at your page source and it appears its the same one as mine, but in case its not, you can find the one I use here. Try that one if it's different.

  • Mar
  • 12
Praditya
Praditya

WP-Ajax Edit Comments didn't work when using PHP Speedy...

http://www.raproject.com/wordpress/wp-ajax-edit-comments/

  • Mar
  • 12
steve
steve

Leon - I found a pretty significant bug. It has to do with the IE conditional tags you can use in the header to override the normal css. Here's what I found:

1. It seems to be caused by any and/or any combination of the css options turned on.

2. If you write the css code straight into the header, the code will appear at the top of the page in IE only. The code is also ineffective.

3. If you link to a separate stylesheet containing the css for IE, it appears to ignore it (not compress it), but the code also does not work. I did try putting the css files in the ignore list but I guess that is just for js...?

You can see this if you look at my test blog in IE. I left the conditional for IE6 as a link to separate file and IE & IE7 is css written straight in the header file.

Let me know if you need anymore info.

  • Mar
  • 12
Anish

Yup, that's the same lightbox version I'm using. :-/ I'm gonna try "ignoring" all my scripts and removing one at a time from the list to see if I can find the culprit.

  • Mar
  • 12
Anish

hmm... I had to ignore prototype.js and scriptaculous.js for lightbox to work properly. Strange since I'm using the same version of the lightbox plugin as you.

  • Mar
  • 12
steve
steve

Yeah, that doesn't make much sense. I'm not ignoring those in mine. Wish I could help.

  • Mar
  • 12
admin
Leon

Everyone - I'm afraid I'm away for a few days holiday from tomorrow. Please keep sending in any problems you may have and I'll have a look at everything when I get back. Thanks to everyone for the feedback so far. Cheers, Leon.

  • Mar
  • 13
steve
steve

Leon - Unfortunately found two more.

First one has to do with the All in One Seo Pack plugin. It's a pretty popular plugin from what I can tell, so this is probably one you want to make it compatible with.

The issue is that is Speedy prevents AIOS from adding the home, page, or post title format you designate in the options into the respective pages. I narrowed it down to GZIP Page On being the culprit.

Second issue is it atleast on mine, Speedy isn't doing anything on any Archive or Category pages. Can someone confirm that with theirs so we'll know if it's just me or not?

Have a good couple days away Leon.

  • Mar
  • 13
Anish

Steve - I confirmed that my Archive and Tag pages do not get optimized by Speedy either.

  • Mar
  • 13
steve
steve

Thanks Anish

  • Mar
  • 17
admin
Leon

Luciano - thanks for the info. I tried the plugin. A couple of points: my version of Wordpress seems to do this redirection without a plugin. I had to comment out the link add_action('template_redirect', 'redirect_canonical'); in /wp-includes/canonical.php to stop the redirect. Once I had commented out this line, the plugin did the job instead. However, it seemed to work fine with PHP Speedy plugin. What version of Wordpress are you using?

Steve - Looking at your source code, this bit:

<!--[if IE]>
body{margin-left: 1px;} /* IE7 hack to fix left 1px offset in body bg image*/
#searchform{ margin: 5px 0;}
#footer-credits-bg{height: 80px;}
ul#footer-credits{height: 70px;}
<![endif]-->

is missing the style declaration. It should be:

<!--[if IE]>
<style type="text/css">
body{margin-left: 1px;} /* IE7 hack to fix left 1px offset in body bg image*/
#searchform{ margin: 5px 0;}
#footer-credits-bg{height: 80px;}
ul#footer-credits{height: 70px;}
</style>
<![endif]-->

So, are you saying PHP Speedy stripped the style tags?

Also, are you saying there's a problem with this line:
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="http://www.mmaconvert.com/testblog/wp-content/themes/mmaconvert/ie6_override.css" /><![endif]-->

If so, what does it look like with PHP Speedy off?

Thanks for the heads-up with AIOSP. I'll have to have a think about it. For the moment, decativate page gzipping. You can achieve the same via Wordpress itself in Options | Reading.

Anish - I think this is probably due to the order of the scripts. Because you are ignoring Lightbox, it appears in the source code before the block that Speedy creates. But the block that Speedy creates contains code that Lightbox needs - hence lightbox fails. I'm trying to think of a solution to this.

  • Mar
  • 17
Luciano Passuello

Hi Leon,
I just realized that Permalink Redirect has become obsolete with WP 2.3 (which has canonical URL via canonical.php).
The blog I am having problems is on WP 2.2.3. I will be upgrading to 2.5 as soon as it gets out the door - so if you tried and it worked, this might be something specific about the plug-in setup here / and maybe not worth investigating... (if other users don't stump into the same problem, of course). Thanks!

BTW, is PHP Speedy WP 2.5 compliant?

  • Mar
  • 18
steve
steve

Leon,

Oops, i forgot to put the style tags back in there. It doesn't work with them anyways.

Basically, those style sheets have the css to override the styles that need to be adjusted for IE. With PHP speedy css options on, it acts as if the override styles are recognized, thus the layout isn't correct.

Any ideas on why speedy doesn't work on category or archive pages, or was that by design?

  • Mar
  • 19
admin
Leon

Dear all - I have just updated to version 0.3. This should fix the problem of Speedy not displaying on certain pages. I also added a debugging info text file which is created if PHP Speedy isn't called at all. If you can't get Speedy to work in any way, please see the "Having Problems?" paragraph above.

Steve - I can't see any problem caused by PHP Speedy and conditional comments. PHP Speedy leaves the source code untouched for the conditional commenting. I think it's more likely that minifying the CSS could cause a problem. What happens if you turn that off?

Praditya - thanks.

  • Mar
  • 19
admin
Leon

Luciano - I haven't tried it with 2.5 yet. Fingers crossed.

  • Mar
  • 19
Manne
Manne

The version info in php_speedy_wp.php in the php_speedy_wp-preview-release-0.3 package states 0.2.1.

  • Mar
  • 19
admin
Leon

Thanks Manne. Corrected.

  • Mar
  • 19
Manne
Manne

On testing the configuration, I get the a messege saying that speedy can't find any scripts/css. If i go ahead and activate I get blank pages. (wp-mu-1.2.5)

  • Mar
  • 19
admin
Leon

Manne - try turning off gziping. Also, what is in the HEAD part of your site?

  • Mar
  • 20
Manne
Manne

Thanks Leon, I'm struggeling to find the gzip option in MU - it's not under Settings > Reading as in regular wp.

  • Mar
  • 20
admin
Leon

Sorry I meant turn it off in PHP Speedy (if it's not already off).

  • Mar
  • 20
Manne
Manne

Oh, OK. Well that was off already. This is in my HEAD:

Test Blog

@import url(/wp-content/plugins/eventcalendar3/ec3.css);
.ec3_ec {
background-image:url(/wp-content/plugins/eventcalendar3/ec.png) !IMPORTANT;
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/wp-content/plugins/eventcalendar3/ec.png');
}
#ec3_shadow0 {
background-image:url(/wp-content/plugins/eventcalendar3/shadow0.png) !IMPORTANT;
background-image:none;
}
#ec3_shadow0 div {
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/wp-content/plugins/eventcalendar3/shadow0.png',sizingMethod='scale');
}
#ec3_shadow1 {
background-image:url(/wp-content/plugins/eventcalendar3/shadow1.png) !IMPORTANT;
background-image:none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/wp-content/plugins/eventcalendar3/shadow1.png',sizingMethod='crop');
}
#ec3_shadow2 {
background-image:url(/wp-content/plugins/eventcalendar3/shadow2.png) !IMPORTANT;
background-image:none;
}
#ec3_shadow2 div {
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/wp-content/plugins/eventcalendar3/shadow2.png',sizingMethod='scale');
}

  • Mar
  • 20
Manne
Manne

Sorry, that didn't come out right, how do I post cource code?

  • Mar
  • 20
admin
Leon

Enclose it with [ code ] code here [ /code ] (but without the spaces before and after code - I put those in so it wouldn't think I was posting code)

  • Mar
  • 20
steve
steve

Leon,

It doesn't work if any of the css options is turned on by themselves or in combination with eachother. Not just limited to minifying the css.

What is strange is the code does appear as it normally would in the head of the page.

  • Mar
  • 20
admin
Leon

Steve - that is strange. Is it on your test blog at the moment? What should I be looking for in IE6 and IE7 that is 'broken' ?

Comments are closed