Plugin uses file_exists to check if a directory exists, but it should use is_dir. Additionally, plugin does not cover all scenarios. Here is the fixed code:
function create_tmp_dir() {
$this->tmp_dir = $this->get_plugin_path() . ‘/tmp/’;
if ( ! is_writable( dirname( $this->tmp_dir ) ) ) {
$this->tmp_dir = sys_get_temp_dir() . ‘/’;
if ( ! is_dir( $this->tmp_dir ) ) wp_mkdir_p( $this->tmp_dir );
$this->tmp_dir .= self::nspace . ‘/’;
}
if ( ! is_dir( $this->tmp_dir ) ) wp_mkdir_p( $this->tmp_dir );
}
// this file is the interface to the combined CSS file that is written in the WP upload directories
$tmp_dir = ‘tmp/’;
if ( ! is_writable( dirname( $tmp_dir ) ) ) $tmp_dir = sys_get_temp_dir() . ‘/’;
$filename = $_SERVER[‘HTTP_HOST’] . ‘-settings.dat’;
$settings_path = $tmp_dir . $filename;
if ( ! file_exists( $settings_path ) ) {
$settings_path = $tmp_dir . ‘combine-css/’ . $filename;
}
if ( file_exists( $settings_path ) && strlen( $_GET[‘token’] ) == 32 ) {
$settings = file_get_contents( $settings_path );
$settings = unserialize( $settings );
$css_file = $settings[‘upload_path’] . $_GET[‘token’] . ‘.css’;
if ( file_exists( $css_file ) ) {
if ( $settings[‘compress’] == ‘Yes’ && extension_loaded( ‘zlib’ ) ) ob_start( ‘ob_gzhandler’ );
header( “Content-type: text/css” );
readfile( $css_file );
if ( $settings[‘compress’] == ‘Yes’ && extension_loaded( ‘zlib’ ) ) ob_end_flush();
}
}
hello,
i use the customizr theme and even i put a few CSS Files to Ignore,there is a problem with some images(at the header and footer the social icons and the back to top image).
How can resolve it?
My site is https://www.equality.gr
Are pull requests for this plugin accepted at GitHub?
]]>Hello,
I installed the plugin, some elements of my website appear broken. I used the inspect element function of my browser to find the style sheets, so I located one css file that I suspect is the problematic one. Now I want to include it in the “ignore” list but how do I type it?
The name that I see is <inline style sheet #12>
Do I type it as I see it? do I insert a .css at the end? With the brackets or without?
thank you
After activating the plugin, shortcodes for plugins stopped working, my responsive header stopped working (also not showing menu) and there are a few other general css problems.
Is there a way to revert what the plugin did!
wwww.bluemarlinhotel.co.za
]]>Hello,
Just wanna ask if there is a theme mode options for this plugin. If there is any how?
Thanks
]]>Hi,
i am using combine css since two weeks.
ATM i have 1.3GB of css files.
are they not autodeleted somehow ?
Best wishes
Niels
]]>I’m getting these warnings for a site hosted in WPEngine.
Warning: Missing argument 3 for flock(), called in /nas/wp/www/staging/mysite/wp-content/plugins/combine-css/classes/combine-css-class.php on line 478 and defined in /nas/wp/www/common/production/php_prevent_flock.php(5) : runkit created function on line 1
The 3rd argument is entirely optional, per the PHP docs.
So there’s no reason for this Warning to be thrown.
I’ve asked WPEngine to please fix their “php_prevent_flock” patch in a way that doesn’t needlessly breaks compatibility with the default flock usage.
But also thought it would be useful to let you know, as simply doing flock( $fp, LOCK_EX, $wouldblock )
would fix the issue for anyone under this situation, with no side effects.
A couple of feature requests:
– add option for 30 day Cache Expiration (and in Combine JS)
– add option to place CSS link tag in footer (to prevent CSS render blocking)
If you have CombineJS:
$settings_path = $tmp_dir . $_SERVER[‘HTTP_HOST’] . ‘-settings.dat’;
Then you get cross conflicts with the CombineJS plugin. It needs a unique name, but I think ideally the settings should be stored elsewhere other than the file system. Maybe that can be changed in the future too.
]]>Hello,
Just thought I’d try this out today.
I’m getting this:
Warning: explode() expects parameter 2 to be string, array given in /var/www/wp-content/plugins/combine-css/classes/combine-css-class.php on line 435
thorstone137
]]>0.8
CSS without query strings don’t get included. Need to put an option param for the regex that detects the css. Like so:
preg_match( “/<link.*href\=(‘|\”)(http.*(\/wp\-(content|includes|admin).*))(\?.*)?(‘|\”) type.*$/”, $src, $matches );
]]>Previously my 20 style sheets all loaded at the top of my <head> before the js files.
Now.. sure… its one file… but right before the </head>
The effect? Its actually slows the page, as the 5 js file in my headers that have to load before the <body> now load before the style sheets so there is a delay in appearance before the website is drawn correctly.
Anyway to make this work, with css files at the TOP.
]]>Hi,
Great plugin!!
Is there any chance you’d be willing to check why does the plugin messes up the css of the two plugins I mentioned?
Thanks a lot,
Eran.
Installed plug in and my side loads 2 seconds faster. However, PageSpeed still shows CSS files that need to be optimized. I used the default setting when installing this plug in. I am also using WP Super Cache. Any suggestions?
https://developers.google.com/speed/pagespeed/insights/?url=www.kucerainternational.com
Optimize CSS Delivery of the following:
https://www.kucerainternational.com/wp-content/themes/libra1_3_1/css/reset.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1/core/assets/css/bootstrap.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1-child/style.css
https://www.kucerainternational.com/wp-includes/js/thickbox/thickbox.css
https://www.kucerainternational.com/wp-content/plugins/the-events-calendar/resources/events.css
https://fonts.googleapis.com/css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1/theme/templates/sliders/revolution-slider/rs-plugin/css/settings.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1/theme/templates/sliders/revolution-slider/rs-plugin/css/captions.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1-child/cache/style.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1-child/cache/custom.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1/custom.css
https://www.kucerainternational.com/wp-content/themes/libra1_3_1/style.css
Tim,
I was wondering if I could join up with you to help support this plugin? That way if you become unavailable for some reason, I can continue supporting it. The userbase is very small, but I think those of us who are using it are in love with it. You did a great job on the code and I wouldn’t want to see it incidentally end up in a graveyard like other plugins where their developer just vanishes.
]]>Just trying out your plugin and I have a couple of questions
1) There seems to be problems with font related css. How do you specify in the ignore css field files used within a child theme, in this case a css used within a font subfolder (/wp-content/themes/childtheme/fonts/fontname/stylesheet.css)?
2) I use the Autoptimize and WP Super Cache plugins – do you see any potential conflicts with this?
Thanks.
]]>Hi,
thanks for your plugin.
How can I wp_enqueue_style files?
Thanks.
]]>Wow — loving this so far. The simplicity is great without relying on something as large/complicated as w3tc.
I’m curious if there is a way to enable/disable the combining “on-the-fly” so to speak. For both testing and final deployment purposes, I’d like to be able to turn off the combine in certain templates or based upon a query string. Such as:
if ( something ) {
remove_action(combinejs);
}
Did a quick look around but it wasn’t obvious to me….
Thanks again for a great plugin
]]>Have you witnessed any problems with the plugin causing text to be invisible when a page loads in firefox? I’ve had that happen twice now. Both times, I could tell the text was there (and it was highlightable) but it was invisible. I hit F12 to open firebug and then text magically became visible!
I have w3 total cache on as well. I’m going to disable that and see if I can take steps to narrow down the problem. But my gut is that the problem has to do with the combined CSS somehow not getting interpreted right by Firefox. I just don’t understand why it’s hit-and-miss.
]]>since the css url() using related path, the combined css within different path will result in error 404 in many cases, otherwise it’s a really good way to reduce sever req.
]]>Tim,
Everything seems to be fixed in v0.7. I’ve tested it with W3 Total Cache and it seems to be compatible.
I’m curious though, if I make a change to one of my CSS files, how does the plugin know to regenerate a new combined file? In the past, I was deactivating and reactivating the plugin through the plugin page during development — but this is extremely cumbersome. I’m wondering, could you add a button to the WP Admin Bar at the top labeled “Re-combine CSS” so clicking it would dump the .dat file and force a new generation? And also what about just having an “Enabled” option that you can change from the admin bar to tell combine CSS whether to deliver the combined file or all the individual files as normal WP behavior? That would be killer!
– Jim
]]>New bug seems to have been introduced. All image links in the stylesheets have an extra leading slash.
background: url(“//wp-content/themes/mythemechild/stylesheets/images/header-bg.png”);
– Jim
]]>Where is the error log?
– Jim
]]>It’s nice to be able to turn on error display on a server while developing or to check stuff if something breaks. But Combine CSS is generating numerous NOTICEs. Here are some examples:
Notice: Undefined index: ignore_files in /var/www/armstrong/wp-content/plugins/combine-css/classes/combine-css-class.php on line 66
Notice: Undefined index: add_gf_css in /var/www/armstrong/wp-content/plugins/combine-css/classes/combine-css-class.php on line 266
Notice: Undefined offset: 2 in /var/www/armstrong/wp-content/plugins/combine-css/classes/combine-css-class.php on line 235
Notice: Undefined index: in /var/www/armstrong/wp-content/plugins/combine-css/classes/combine-css-class.php on line 280
I complimented you on your exceptional code before. The architecture is very good, but you should be handling undefined variables instead of letting them throw notices and go on.
]]>I use cloudflare to minify Yeah Cloudflare & am very happy, However, I experience issues with IE & skysa social bar showing on some pages & not others, skysa support says to use autoptimize plugin, pha3z (here on the forum) advises to use combine css plugin what I am wondering is how do I use it in the absolute simplest way possibile? autoptimize does work although I don’t like the fact that it’s 2 years out of date, all I need is to keep my comments working correctly (comment luv along with seo comments plugins)& to get rid of the social bar issues with IE & skysa; all I have checked in autoptimize on one of my sites is “keep html comments”, & “optimize css code” . . . how would combine css be used this simply?
I don’t understand what would be proper setting for cache expiration?
What is username/password for?
What is “add gravity forms”
Why would I want to ignore files?
What would be advantage of GZip output & do I need it?
Thank you for your patience & kind reply, everyday with wordpress is a new learning curve ??
Peace & Blessings
Linda Lou
Negative side-effect of combine:
URL() references in the stylesheet break if they are relative to the stylesheet. Example: Revolution Slider plugin comes with its own PNG shadows and a dynamically generated stylesheet that displays a shadow user-chosen shadow below the slider. Combine did a perfect job of including the stylesheet in the Combined file, but the URL reference to the shadow PNG is invalidated so the browser look in the wrong place for the shadow.
Proposed Solution A:
Parse URL() references and copy the assets to folder where combined CSS file is saved.
Proposed Solution B:
Intelligently, modify URL() references in combined sheet to correctly reference the location of the assets relative to the combined sheet location.
Thoughts?
]]>What would you recommend for combining JS as a compliment to this plugin?
I tried this plugin out and it works fantastic, and the code is clean and concise. We need a JS compliment!
]]>How does this plugin serve the files it generates? Are they served through PHP so that everything can be handled in PHP? Or does it depend on URL Rewriting on the HTTP Server?
I’m looking for something that does everything strictly through PHP so that it will work seamlessly with hosts that handle the file caching on their own.
]]>