@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | if (array_key_exists($p, $this->compat['properties']) !== false) { |
| 65 | 65 | if ($this->show_compat_errors) { |
| 66 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 66 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 67 | 67 | } |
| 68 | 68 | $this->compat['properties'][$p] = $v; |
| 69 | 69 | } else { |
| 70 | 70 | if ($this->show_compat_errors) { |
| 71 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 71 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | if (array_key_exists($p, $this->compat['properties']) !== false) { |
| 84 | 84 | if ($this->show_compat_errors) { |
| 85 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 85 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | return $this->compat['properties'][$p]; |
| 89 | 89 | } else { |
| 90 | 90 | if ($this->show_compat_errors) { |
| 91 | - $this->triggerError('Property ' . $p . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 91 | + $this->triggerError('Property '.$p.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | ); |
| 111 | 111 | } elseif ($this->show_compat_errors) { |
| 112 | 112 | if (array_search($m, $this->compat['methods']) !== false) { |
| 113 | - $this->triggerError('Method ' . $m . ' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 113 | + $this->triggerError('Method '.$m.' is not available in the Dwoo\Smarty\Adapter, however it might be implemented in the future, check out http://wiki.dwoo.org/index.php/SmartySupport for more details.', E_USER_NOTICE); |
|
| 114 | 114 | } else { |
| 115 | - $this->triggerError('Method ' . $m . ' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 115 | + $this->triggerError('Method '.$m.' is not available in the Dwoo\Smarty\Adapter, but it is not listed as such, so you might want to tell me about it at [email protected]', E_USER_NOTICE); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | } |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | if (isset($data[$name]) && is_object($data[$name])) { |
| 526 | 526 | return $data[$name]; |
| 527 | 527 | } else { |
| 528 | - trigger_error('Dwoo_Compiler: object "' . $name . '" was not registered or is not an object', E_USER_ERROR); |
|
| 528 | + trigger_error('Dwoo_Compiler: object "'.$name.'" was not registered or is not an object', E_USER_ERROR); |
|
| 529 | 529 | } |
| 530 | 530 | } |
| 531 | 531 | |
@@ -537,10 +537,10 @@ discard block |
||
| 537 | 537 | public function template_exists($filename) |
| 538 | 538 | { |
| 539 | 539 | if (!is_array($this->template_dir)) { |
| 540 | - return file_exists($this->template_dir . DIRECTORY_SEPARATOR . $filename); |
|
| 540 | + return file_exists($this->template_dir.DIRECTORY_SEPARATOR.$filename); |
|
| 541 | 541 | } else { |
| 542 | 542 | foreach ($this->template_dir as $tpl_dir) { |
| 543 | - if (file_exists($tpl_dir . DIRECTORY_SEPARATOR . $filename)) { |
|
| 543 | + if (file_exists($tpl_dir.DIRECTORY_SEPARATOR.$filename)) { |
|
| 544 | 544 | return true; |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $compileId = $this->compile_id; |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | - $hash = bin2hex(md5($file . $cacheId . $compileId, true)); |
|
| 672 | + $hash = bin2hex(md5($file.$cacheId.$compileId, true)); |
|
| 673 | 673 | if (!isset(self::$tplCache[$hash])) { |
| 674 | 674 | // abs path |
| 675 | 675 | if (substr($file, 0, 1) === '/' || substr($file, 1, 1) === ':') { |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | } elseif (is_string($this->template_dir) || is_array($this->template_dir)) { |
| 678 | 678 | self::$tplCache[$hash] = new TemplateFile($file, null, $cacheId, $compileId, $this->template_dir); |
| 679 | 679 | } else { |
| 680 | - throw new Exception('Unable to load "' . $file . '", check the template_dir'); |
|
| 680 | + throw new Exception('Unable to load "'.$file.'", check the template_dir'); |
|
| 681 | 681 | } |
| 682 | 682 | } |
| 683 | 683 | |
@@ -693,6 +693,6 @@ discard block |
||
| 693 | 693 | if (is_object($this->template)) { |
| 694 | 694 | parent::triggerError($message, $level); |
| 695 | 695 | } |
| 696 | - trigger_error('Dwoo error : ' . $message, $level); |
|
| 696 | + trigger_error('Dwoo error : '.$message, $level); |
|
| 697 | 697 | } |
| 698 | 698 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | $this->compiler = $compiler; |
| 41 | 41 | $this->template = $compiler->getDwoo()->getTemplate(); |
| 42 | - parent::__construct('Compilation error at line ' . $compiler->getLine() . ' in "' . $this->template->getResourceName() . ':' . $this->template->getResourceIdentifier() . '" : ' . $message); |
|
| 42 | + parent::__construct('Compilation error at line '.$compiler->getLine().' in "'.$this->template->getResourceName().':'.$this->template->getResourceIdentifier().'" : '.$message); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | if ($merge === true && is_array($val)) { |
| 149 | - $this->data[$key] = $val + $this->data[$key]; |
|
| 149 | + $this->data[$key] = $val+$this->data[$key]; |
|
| 150 | 150 | } else { |
| 151 | 151 | $this->data[$key][] = $val; |
| 152 | 152 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | if ($merge === true && is_array($val)) { |
| 162 | - $this->data[$name] = $val + $this->data[$name]; |
|
| 162 | + $this->data[$name] = $val+$this->data[$name]; |
|
| 163 | 163 | } else { |
| 164 | 164 | $this->data[$name][] = $val; |
| 165 | 165 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | if (isset($this->data[$name])) { |
| 259 | 259 | return $this->data[$name]; |
| 260 | 260 | } else { |
| 261 | - throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"'); |
|
| 261 | + throw new Exception('Tried to read a value that was not assigned yet : "'.$name.'"'); |
|
| 262 | 262 | } |
| 263 | 263 | } |
| 264 | 264 | } |
@@ -79,24 +79,24 @@ |
||
| 79 | 79 | |
| 80 | 80 | $out = ''; |
| 81 | 81 | foreach ($params as $attr => $val) { |
| 82 | - $out .= ' ' . $attr . '='; |
|
| 82 | + $out .= ' '.$attr.'='; |
|
| 83 | 83 | if (trim($val, '"\'') == '' || $val == 'null') { |
| 84 | - $out .= str_replace($delim, '\\' . $delim, '""'); |
|
| 84 | + $out .= str_replace($delim, '\\'.$delim, '""'); |
|
| 85 | 85 | } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) { |
| 86 | - $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"'); |
|
| 86 | + $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"'); |
|
| 87 | 87 | } else { |
| 88 | 88 | if (!$compiler) { |
| 89 | 89 | // disable double encoding since it can not be determined if it was encoded |
| 90 | - $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).'; |
|
| 90 | + $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).'; |
|
| 91 | 91 | } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) { |
| 92 | 92 | // escape if auto escaping is disabled, or there was no variable in the string |
| 93 | - $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).'; |
|
| 93 | + $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).'; |
|
| 94 | 94 | } else { |
| 95 | 95 | // print as is |
| 96 | - $escapedVal = '.' . $val . '.'; |
|
| 96 | + $escapedVal = '.'.$val.'.'; |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"'); |
|
| 99 | + $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"'); |
|
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type) |
| 90 | 90 | { |
| 91 | - return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE; |
|
| 91 | + return DwooCompiler::PHP_OPEN.$prepend.'$this->addStack("'.$type.'", array('.DwooCompiler::implode_r($compiler->getCompiledParams($params)).'));'.$append.DwooCompiler::PHP_CLOSE; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | /** |
@@ -114,6 +114,6 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content) |
| 116 | 116 | { |
| 117 | - return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE; |
|
| 117 | + return $content.DwooCompiler::PHP_OPEN.$prepend.'$this->delStack();'.$append.DwooCompiler::PHP_CLOSE; |
|
| 118 | 118 | } |
| 119 | 119 | } |
@@ -38,38 +38,38 @@ discard block |
||
| 38 | 38 | $rl = preg_quote($l, '/'); |
| 39 | 39 | $rr = preg_quote($r, '/'); |
| 40 | 40 | $sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*'; |
| 41 | - $input = preg_replace_callback('/' . $rl . '\s*section ' . str_repeat($sectionParam, 6) . '\s*' . $rr . '(.+?)(?:' . $rl . '\s*sectionelse\s*' . $rr . '(.+?))?' . $rl . '\s*\/section\s*' . $rr . '/is', array( |
|
| 41 | + $input = preg_replace_callback('/'.$rl.'\s*section '.str_repeat($sectionParam, 6).'\s*'.$rr.'(.+?)(?:'.$rl.'\s*sectionelse\s*'.$rr.'(.+?))?'.$rl.'\s*\/section\s*'.$rr.'/is', array( |
|
| 42 | 42 | $this, |
| 43 | 43 | 'convertSection' |
| 44 | 44 | ), $input); |
| 45 | - $input = str_replace('$smarty.section.', '$smarty.for.', $input); |
|
| 45 | + $input = str_replace('$smarty.section.', '$smarty.for.', $input); |
|
| 46 | 46 | |
| 47 | 47 | $smarty = array( |
| 48 | - '/' . $rl . '\s*ldelim\s*' . $rr . '/', |
|
| 49 | - '/' . $rl . '\s*rdelim\s*' . $rr . '/', |
|
| 50 | - '/' . $rl . '\s*\$smarty\.ldelim\s*' . $rr . '/', |
|
| 51 | - '/' . $rl . '\s*\$smarty\.rdelim\s*' . $rr . '/', |
|
| 48 | + '/'.$rl.'\s*ldelim\s*'.$rr.'/', |
|
| 49 | + '/'.$rl.'\s*rdelim\s*'.$rr.'/', |
|
| 50 | + '/'.$rl.'\s*\$smarty\.ldelim\s*'.$rr.'/', |
|
| 51 | + '/'.$rl.'\s*\$smarty\.rdelim\s*'.$rr.'/', |
|
| 52 | 52 | '/\$smarty\./', |
| 53 | - '/' . $rl . '\s*php\s*' . $rr . '/', |
|
| 54 | - '/' . $rl . '\s*\/php\s*' . $rr . '/', |
|
| 55 | - '/\|(@?)strip(\||' . $rr . ')/', |
|
| 56 | - '/' . $rl . '\s*sectionelse\s*' . $rr . '/', |
|
| 53 | + '/'.$rl.'\s*php\s*'.$rr.'/', |
|
| 54 | + '/'.$rl.'\s*\/php\s*'.$rr.'/', |
|
| 55 | + '/\|(@?)strip(\||'.$rr.')/', |
|
| 56 | + '/'.$rl.'\s*sectionelse\s*'.$rr.'/', |
|
| 57 | 57 | ); |
| 58 | 58 | |
| 59 | 59 | $dwoo = array( |
| 60 | - '\\' . $l, |
|
| 60 | + '\\'.$l, |
|
| 61 | 61 | $r, |
| 62 | - '\\' . $l, |
|
| 62 | + '\\'.$l, |
|
| 63 | 63 | $r, |
| 64 | 64 | '$dwoo.', |
| 65 | 65 | '<?php ', |
| 66 | 66 | ' ?>', |
| 67 | 67 | '|$1whitespace$2', |
| 68 | - $l . 'else' . $r, |
|
| 68 | + $l.'else'.$r, |
|
| 69 | 69 | ); |
| 70 | 70 | |
| 71 | 71 | if (preg_match('{\|@([a-z][a-z0-9_]*)}i', $input, $matches)) { |
| 72 | - trigger_error('The Smarty Compatibility Module has detected that you use |@' . $matches[1] . ' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE); |
|
| 72 | + trigger_error('The Smarty Compatibility Module has detected that you use |@'.$matches[1].' in your template, this might lead to problems as Dwoo interprets the @ operator differently than Smarty, see http://wiki.dwoo.org/index.php/Syntax#The_.40_Operator', E_USER_NOTICE); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return preg_replace($smarty, $dwoo, $input); |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | $params = array(); |
| 86 | 86 | $index = 1; |
| 87 | 87 | while (!empty($matches[$index]) && $index < 13) { |
| 88 | - $params[$matches[$index]] = $matches[$index + 1]; |
|
| 88 | + $params[$matches[$index]] = $matches[$index+1]; |
|
| 89 | 89 | $index += 2; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - return str_replace('[' . trim($params['name'], '"\'') . ']', '[$' . trim($params['name'], '"\'') . ']', $matches[0]); |
|
| 92 | + return str_replace('['.trim($params['name'], '"\'').']', '[$'.trim($params['name'], '"\'').']', $matches[0]); |
|
| 93 | 93 | } |
| 94 | 94 | } |
@@ -30,15 +30,15 @@ |
||
| 30 | 30 | function PluginCapitalize(Core $dwoo, $value, $numwords = false) |
| 31 | 31 | { |
| 32 | 32 | if ($numwords || preg_match('#^[^0-9]+$#', $value)) { |
| 33 | - return mb_convert_case((string)$value, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 33 | + return mb_convert_case((string) $value, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 34 | 34 | } else { |
| 35 | - $bits = explode(' ', (string)$value); |
|
| 35 | + $bits = explode(' ', (string) $value); |
|
| 36 | 36 | $out = ''; |
| 37 | 37 | while (list(, $v) = each($bits)) { |
| 38 | 38 | if (preg_match('#^[^0-9]+$#', $v)) { |
| 39 | - $out .= ' ' . mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 39 | + $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 40 | 40 | } else { |
| 41 | - $out .= ' ' . $v; |
|
| 41 | + $out .= ' '.$v; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | |
@@ -54,16 +54,16 @@ discard block |
||
| 54 | 54 | $include = $dwoo->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id); |
| 55 | 55 | } |
| 56 | 56 | catch (SecurityException $e) { |
| 57 | - $dwoo->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING); |
|
| 57 | + $dwoo->triggerError('Include : Security restriction : '.$e->getMessage(), E_USER_WARNING); |
|
| 58 | 58 | } |
| 59 | 59 | catch (Exception $e) { |
| 60 | - $dwoo->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING); |
|
| 60 | + $dwoo->triggerError('Include : '.$e->getMessage(), E_USER_WARNING); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if ($include === null) { |
| 64 | - $dwoo->triggerError('Include : Resource "' . $resource . ':' . $identifier . '" not found.', E_USER_WARNING); |
|
| 64 | + $dwoo->triggerError('Include : Resource "'.$resource.':'.$identifier.'" not found.', E_USER_WARNING); |
|
| 65 | 65 | } elseif ($include === false) { |
| 66 | - $dwoo->triggerError('Include : Resource "' . $resource . '" does not support includes.', E_USER_WARNING); |
|
| 66 | + $dwoo->triggerError('Include : Resource "'.$resource.'" does not support includes.', E_USER_WARNING); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (is_string($data)) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (count($rest)) { |
| 76 | - $vars = $rest + $vars; |
|
| 76 | + $vars = $rest+$vars; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $clone = clone $dwoo; |
@@ -28,5 +28,5 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | function PluginCountWordsCompile(Compiler $compiler, $value) |
| 30 | 30 | { |
| 31 | - return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', ' . $value . ', $tmp)'; |
|
| 31 | + return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', '.$value.', $tmp)'; |
|
| 32 | 32 | } |