X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FMinify%2FMinifyPlugin.php;h=cfed0779baf37f94a1fcb932967e47b2f2e7c333;hb=59119482ca34540bd7f0a2a1aa994de1d5328ea2;hp=718bfd163530d92db7ed03c16acd14de55d04cb2;hpb=e53512cd2c2180f81fc7317de9df09a140099aa3;p=quix0rs-gnu-social.git diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php index 718bfd1635..cfed0779ba 100644 --- a/plugins/Minify/MinifyPlugin.php +++ b/plugins/Minify/MinifyPlugin.php @@ -29,6 +29,7 @@ Author URI: http://candrews.integralblue.com/ /** * @package MinifyPlugin * @maintainer Craig Andrews + * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org */ if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -50,7 +51,6 @@ class MinifyPlugin extends Plugin * * @return boolean hook return */ - function onStartInitializeRouter($m) { $m->connect('main/min', @@ -86,7 +86,11 @@ class MinifyPlugin extends Plugin $url = parse_url($src); if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) { - $src = $this->minifyUrl($src); + if (strpos($src, 'plugins/') === 0 || strpos($src, 'local/') === 0) { + $src = $this->minifyUrl($src); + } else { + $src = $this->minifyUrl('js/'.$src); + } } } @@ -96,7 +100,7 @@ class MinifyPlugin extends Plugin && is_null(common_config('theme', 'path')) && is_null(common_config('theme', 'server')); $url = parse_url($src); - if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment)) + if( empty($url['scheme']) && empty($url['host']) && empty($url['query']) && empty($url['fragment'])) { if(!isset($theme)) { $theme = common_config('site', 'theme'); @@ -114,9 +118,9 @@ class MinifyPlugin extends Plugin function onStartInlineScriptElement($action,&$code,&$type) { if($this->minifyInlineJs && $type=='text/javascript'){ - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { - $cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code)); + $cacheKey = Cache::key(self::cacheKey . ':' . crc32($code)); $out = $c->get($cacheKey); } if(empty($out)) { @@ -134,9 +138,9 @@ class MinifyPlugin extends Plugin function onStartStyleElement($action,&$code,&$type,&$media) { if($this->minifyInlineCss && $type=='text/css'){ - $c = common_memcache(); + $c = Cache::instance(); if (!empty($c)) { - $cacheKey = common_cache_key(self::cacheKey . ':' . crc32($code)); + $cacheKey = Cache::key(self::cacheKey . ':' . crc32($code)); $out = $c->get($cacheKey); } if(empty($out)) { @@ -164,5 +168,15 @@ class MinifyPlugin extends Plugin require_once('Minify/CSS.php'); return Minify_CSS::minify($code,$options); } -} + function onPluginVersion(&$versions) + { + $versions[] = array('name' => 'Minify', + 'version' => STATUSNET_VERSION, + 'author' => 'Craig Andrews', + 'homepage' => 'http://status.net/wiki/Plugin:Minify', + 'rawdescription' => + _m('The Minify plugin minifies StatusNet\'s CSS and JavaScript, removing whitespace and comments.')); + return true; + } +}