diff options
author | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-12-09 17:26:28 +0100 |
---|---|---|
committer | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-12-09 17:26:28 +0100 |
commit | 8702de7f7e170bddfdb622c393c3cac3446fd1c5 (patch) | |
tree | c7269ea61f5d4230a6f916dbabee4ce412e0a9fb /lib/exe | |
parent | 1cc82e5c76ae7fcd646e448404afdc0fd458bf55 (diff) | |
parent | 9a0ca2cfd8ac42895af3be2efbd2cab7e6d33578 (diff) | |
download | rpg-8702de7f7e170bddfdb622c393c3cac3446fd1c5.tar.gz rpg-8702de7f7e170bddfdb622c393c3cac3446fd1c5.tar.bz2 |
Merge remote-tracking branch 'origin/master' into scrutinizerissues
Conflicts:
inc/media.php
inc/plugin.php
inc/template.php
lib/plugins/authplain/_test/escaping.test.php
lib/plugins/syntax.php
Diffstat (limited to 'lib/exe')
-rw-r--r-- | lib/exe/css.php | 7 | ||||
-rw-r--r-- | lib/exe/detail.php | 3 | ||||
-rw-r--r-- | lib/exe/js.php | 36 |
3 files changed, 31 insertions, 15 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php index 2212656d2..77674d251 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -166,8 +166,11 @@ function css_out(){ * @return string */ function css_parseless($css) { + global $conf; + $less = new lessc(); $less->importDir[] = DOKU_INC; + $less->setPreserveComments(!$conf['compress']); if (defined('DOKU_UNITTEST')){ $less->importDir[] = TMP_DIR; @@ -431,7 +434,7 @@ class DokuCssFile { protected $filepath; // file system path to the CSS/Less file protected $location; // base url location of the CSS/Less file - private $relative_path = null; + protected $relative_path = null; public function __construct($file) { $this->filepath = $file; @@ -464,7 +467,7 @@ class DokuCssFile { * * @return string relative file system path */ - private function getRelativePath(){ + protected function getRelativePath(){ if (is_null($this->relative_path)) { $basedir = array(DOKU_INC); diff --git a/lib/exe/detail.php b/lib/exe/detail.php index cd3f362ad..cc29d5b87 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -5,6 +5,7 @@ require_once(DOKU_INC.'inc/init.php'); $IMG = getID('media'); $ID = cleanID($INPUT->str('id')); +$REV = $INPUT->int('rev'); // this makes some general info available as well as the info about the // "parent" page @@ -35,7 +36,7 @@ $ERROR = false; $AUTH = auth_quickaclcheck($IMG); if($AUTH >= AUTH_READ){ // check if image exists - $SRC = mediaFN($IMG); + $SRC = mediaFN($IMG,$REV); if(!@file_exists($SRC)){ //doesn't exist! http_status(404); diff --git a/lib/exe/js.php b/lib/exe/js.php index 97f2b52c3..ec236e98f 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -305,7 +305,11 @@ function js_compress($s){ // items that don't need spaces next to them $chars = "^&|!+\-*\/%=\?:;,{}()<>% \t\n\r'\"[]"; - $regex_starters = array("(", "=", "[", "," , ":", "!"); + // items which need a space if the sign before and after whitespace is equal. + // E.g. '+ ++' may not be compressed to '+++' --> syntax error. + $ops = "+-"; + + $regex_starters = array("(", "=", "[", "," , ":", "!", "&", "|"); $whitespaces_chars = array(" ", "\t", "\n", "\r", "\0", "\x0B"); @@ -405,19 +409,27 @@ function js_compress($s){ // whitespaces if( $ch == ' ' || $ch == "\r" || $ch == "\n" || $ch == "\t" ){ - // leading spaces - if($i+1 < $slen && (strpos($chars,$s[$i+1]) !== false)){ - $i = $i + 1; - continue; - } - // trailing spaces - // if this ch is space AND the last char processed - // is special, then skip the space $lch = substr($result,-1); - if($lch && (strpos($chars,$lch) !== false)){ - $i = $i + 1; - continue; + + // Only consider deleting whitespace if the signs before and after + // are not equal and are not an operator which may not follow itself. + if ((!$lch || $s[$i+1] == ' ') + || $lch != $s[$i+1] + || strpos($ops,$s[$i+1]) === false) { + // leading spaces + if($i+1 < $slen && (strpos($chars,$s[$i+1]) !== false)){ + $i = $i + 1; + continue; + } + // trailing spaces + // if this ch is space AND the last char processed + // is special, then skip the space + if($lch && (strpos($chars,$lch) !== false)){ + $i = $i + 1; + continue; + } } + // else after all of this convert the "whitespace" to // a single space. It will get appended below $ch = ' '; |