Quantcast
Channel: WordPress.org Forums » [Autoptimize] Support
Viewing all articles
Browse latest Browse all 14094

futtta on "[Plugin: Autoptimize] Up to 30gb of optimized files ?"

$
0
0

well, random (unique) vars in javascript have to be set by php, so the javascript to exclude should either be in the php-code of the plugin or in a JS-file which is generated on the fly by php. I then scanned the PHP-code for commentluv for "javascript" and found this:

$data = "var cl_settings = {";
            $arr = array();
            $vars = $this->localize;
            if(is_array($vars)){
                foreach ($vars as $key => $value) {
                    $arr[count($arr)] = $key . " : '" . esc_js($value) . "'";
                }
                $data .= implode(",",$arr); $data .= "};";
                echo "<script type='text/javascript'>\n";
                echo "/* <![CDATA[ */\n";
                echo $data;
                echo "\n/* ]]> */\n";
                echo "</script>\n";
            }

This block of php-code seems to write out vars from a PHP-array into a javascript-block. The javascript-block starts with "var cl_settings", meaning we should be able to exclude it from aggregation by adding "cl_settings" as exclusion-string.

Hope this makes sense & helps you out!

kind regards,
frank


Viewing all articles
Browse latest Browse all 14094

Trending Articles