summaryrefslogtreecommitdiffstats
path: root/lib/minimizer
diff options
context:
space:
mode:
authorBrice Maron <brice@bmaron.net>2012-06-21 17:15:35 +0000
committerBrice Maron <brice@bmaron.net>2012-06-21 17:15:35 +0000
commite5c56b2433b1987e4b6b8020e01f4da03623c4b8 (patch)
treea650870f7bbc497833b8ea00051f9046e1779f5e /lib/minimizer
parentdf83df5263db57056d0bd70edfa3b28e7b5e6b6b (diff)
parent6707e4187e4c1186eff8dfe06999c4539ab80de7 (diff)
downloadnextcloud-server-e5c56b2433b1987e4b6b8020e01f4da03623c4b8.tar.gz
nextcloud-server-e5c56b2433b1987e4b6b8020e01f4da03623c4b8.zip
Merge branch 'master' into multi_app_dir
Conflicts: lib/app.php lib/base.php lib/minimizer/css.php lib/minimizer/js.php lib/template.php lib/util.php
Diffstat (limited to 'lib/minimizer')
-rw-r--r--lib/minimizer/css.php52
-rw-r--r--lib/minimizer/js.php52
2 files changed, 6 insertions, 98 deletions
diff --git a/lib/minimizer/css.php b/lib/minimizer/css.php
index c7e5d96e06b..97099adbdf6 100644
--- a/lib/minimizer/css.php
+++ b/lib/minimizer/css.php
@@ -6,54 +6,6 @@ class OC_Minimizer_CSS extends OC_Minimizer
{
protected $contentType = 'text/css';
- public function findFiles($styles) {
- // Read the selected theme from the config file
- $theme=OC_Config::getValue( "theme" );
-
- // Read the detected formfactor and use the right file name.
- $fext = OC_Template::getFormFactorExtension();
- foreach($styles as $style){
- // is it in 3rdparty?
- if($this->appendIfExist(OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $style.'.css')) {
-
- // or in the owncloud root?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$style$fext.css" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$style.css" )) {
-
- // or in core ?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$style$fext.css" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$style.css" )) {
-
- }else{
- $append = false;
- foreach( OC::$APPSROOTS as $apps_dir)
- {
- if($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$style$fext.css", true)) { $append =true; break; }
- elseif($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$style.css", true )) { $append =true; break; }
- }
- if(! $append) {
- echo('css file not found: style:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
- die();
- }
- }
- }
- // Add the theme css files. you can override the default values here
- if(!empty($theme)) {
- foreach($styles as $style){
- if($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style$fext.css" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$style.css" )) {
-
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style$fext.css" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$style.css" )) {
-
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style$fext.css" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$style.css" )) {
- }
- }
- }
- return $this->files;
- }
-
public function minimizeFiles($files) {
$css_out = '';
$webroot = (string) OC::$WEBROOT;
@@ -78,7 +30,9 @@ class OC_Minimizer_CSS extends OC_Minimizer
$remote .= dirname($file_info[2]);
$css_out .= CSSMin::remap($css, dirname($file), $remote, true);
}
- $css_out = CSSMin::minify($css_out);
+ if (!defined('DEBUG') || !DEBUG){
+ $css_out = CSSMin::minify($css_out);
+ }
return $css_out;
}
}
diff --git a/lib/minimizer/js.php b/lib/minimizer/js.php
index dd7d15de061..0f5cb7e5577 100644
--- a/lib/minimizer/js.php
+++ b/lib/minimizer/js.php
@@ -6,54 +6,6 @@ class OC_Minimizer_JS extends OC_Minimizer
{
protected $contentType = 'application/javascript';
- public function findFiles($scripts) {
- // Read the selected theme from the config file
- $theme=OC_Config::getValue( "theme" );
-
- // Read the detected formfactor and use the right file name.
- $fext = OC_Template::getFormFactorExtension();
- // Add the core js files or the js files provided by the selected theme
- foreach($scripts as $script){
- // Is it in 3rd party?
- if($this->appendIfExist(OC::$THIRDPARTYROOT, OC::$THIRDPARTYWEBROOT, $script.'.js')) {
-
- // Is it in apps and overwritten by the theme?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script$fext.js" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/apps/$script.js" )) {
-
- // Is it in the owncloud root but overwritten by the theme?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script$fext.js" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/$script.js" )) {
-
- // Is it in the owncloud root ?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$script$fext.js" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "$script.js" )) {
-
- // Is in core but overwritten by a theme?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script$fext.js" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "themes/$theme/core/$script.js" )) {
-
- // Is it in core?
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$script$fext.js" )) {
- }elseif($this->appendIfExist(OC::$SERVERROOT, OC::$WEBROOT, "core/$script.js" )) {
-
- }else{
- // Is it part of an app?
- $append = false;
- foreach( OC::$APPSROOTS as $apps_dir)
- {
- if($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$script$fext.js" , true)) { $append =true; break; }
- elseif($this->appendIfExist($apps_dir['path'], $apps_dir['url'], "$script.js", true )) { $append =true; break; }
- }
- if(! $append) {
- echo('js file not found: script:'.$script.' formfactor:'.$fext.' webroot:'.OC::$WEBROOT.' serverroot:'.OC::$SERVERROOT);
- die();
- }
- }
- }
- return $this->files;
- }
-
public function minimizeFiles($files) {
$js_out = '';
foreach($files as $file_info) {
@@ -61,7 +13,9 @@ class OC_Minimizer_JS extends OC_Minimizer
$js_out .= '/* ' . $file . ' */' . "\n";
$js_out .= file_get_contents($file);
}
- $js_out = JavaScriptMinifier::minify($js_out);
+ if (!defined('DEBUG') || !DEBUG){
+ $js_out = JavaScriptMinifier::minify($js_out);
+ }
return $js_out;
}
}