summaryrefslogtreecommitdiff
path: root/plugins/Minify/MinifyPlugin.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-12-04 23:17:46 -0500
committerCraig Andrews <candrews@integralblue.com>2009-12-04 23:17:46 -0500
commit88e50003ae7840358c2a520c6cb808231b958769 (patch)
tree2f9b4032f42593cf44b2e7b8ac4c6c3b68d30569 /plugins/Minify/MinifyPlugin.php
parentf4fc8481e24ce4bd7714022109d75b2a22198fdf (diff)
If a theme server is being used, do not minify theme CSS (as doing so could cause 404s)
Diffstat (limited to 'plugins/Minify/MinifyPlugin.php')
-rw-r--r--plugins/Minify/MinifyPlugin.php26
1 files changed, 18 insertions, 8 deletions
diff --git a/plugins/Minify/MinifyPlugin.php b/plugins/Minify/MinifyPlugin.php
index 4d37fbc70..77fd76a84 100644
--- a/plugins/Minify/MinifyPlugin.php
+++ b/plugins/Minify/MinifyPlugin.php
@@ -79,23 +79,33 @@ class MinifyPlugin extends Plugin
$url = parse_url($src);
if( empty($url->scheme) && empty($url->host) && empty($url->query) && empty($url->fragment))
{
- $src = common_path('main/min?f='.$src.'&v=' . STATUSNET_VERSION);
+ $src = $this->minifyUrl($src);
}
}
function onStartCssLinkElement($action,&$src,&$theme,&$media) {
+ $allowThemeMinification =
+ is_null(common_config('theme', 'dir'))
+ && 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(file_exists(Theme::file($src,$theme))){
- //src is a relative path, so we can do minification
- if(isset($theme)) {
- $src = common_path('main/min?f=theme/'.$theme.'/'.$src.'&v=' . STATUSNET_VERSION);
- } else {
- $src = common_path('main/min?f=theme/default/'.$src.'&v=' . STATUSNET_VERSION);
- }
+ if(!isset($theme)) {
+ $theme = common_config('site', 'theme');
+ }
+ if($allowThemeMinification && file_exists(INSTALLDIR.'/local/theme/'.$theme.'/'.$src)) {
+ $src = $this->minifyUrl('local/theme/'.$theme.'/'.$src);
+ } else if($allowThemeMinification && file_exists(INSTALLDIR.'/theme/'.$theme.'/'.$src)) {
+ $src = $this->minifyUrl('theme/'.$theme.'/'.$src);
+ }else if(file_exists(INSTALLDIR.'/'.$src)){
+ $src = $this->minifyUrl($src);
}
}
}
+
+ function minifyUrl($src) {
+ return common_local_url('minify',null,array('f' => $src ,v => STATUSNET_VERSION));
+ }
}