@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function setNestedCommentsHandling($allow = true) |
296 | 296 | { |
297 | - $this->allowNestedComments = (bool)$allow; |
|
297 | + $this->allowNestedComments = (bool) $allow; |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | /** |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | public function setLooseOpeningHandling($allow = false) |
321 | 321 | { |
322 | - $this->allowLooseOpenings = (bool)$allow; |
|
322 | + $this->allowLooseOpenings = (bool) $allow; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | /** |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | */ |
345 | 345 | public function setAutoEscape($enabled) |
346 | 346 | { |
347 | - $this->autoEscape = (bool)$enabled; |
|
347 | + $this->autoEscape = (bool) $enabled; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | /** |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | |
760 | 760 | // show template source if debug |
761 | 761 | if ($this->debug) { |
762 | - echo '<pre>'.print_r(htmlentities($tpl), true).'</pre>'."\n"; |
|
762 | + echo '<pre>' . print_r(htmlentities($tpl), true) . '</pre>' . "\n"; |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | // strips php tags if required by the security policy |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | |
871 | 871 | // build plugin preloader |
872 | 872 | foreach ($this->getUsedPlugins() as $plugin => $type) { |
873 | - if ($type & Core::CUSTOM_PLUGIN) { |
|
873 | + if ($type&Core::CUSTOM_PLUGIN) { |
|
874 | 874 | continue; |
875 | 875 | } |
876 | 876 | |
@@ -878,41 +878,41 @@ discard block |
||
878 | 878 | case Core::CLASS_PLUGIN: |
879 | 879 | case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN: |
880 | 880 | if (class_exists('Plugin' . $plugin) !== false) { |
881 | - $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". |
|
881 | + $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)" . |
|
882 | 882 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
883 | 883 | } else { |
884 | - $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)". |
|
884 | + $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)" . |
|
885 | 885 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
886 | 886 | } |
887 | 887 | break; |
888 | 888 | case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN: |
889 | 889 | if (class_exists('Plugin' . $plugin) !== false) { |
890 | - $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". |
|
890 | + $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)" . |
|
891 | 891 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
892 | 892 | } else { |
893 | - $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". |
|
893 | + $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)" . |
|
894 | 894 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
895 | 895 | } |
896 | 896 | break; |
897 | 897 | case Core::FUNC_PLUGIN: |
898 | 898 | if (function_exists('Plugin' . $plugin) !== false) { |
899 | - $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)". |
|
899 | + $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)" . |
|
900 | 900 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
901 | 901 | } else { |
902 | - $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". |
|
902 | + $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)" . |
|
903 | 903 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
904 | 904 | } |
905 | 905 | break; |
906 | 906 | case Core::SMARTY_MODIFIER: |
907 | - $output .= "if (function_exists('smarty_modifier_$plugin')===false)". |
|
907 | + $output .= "if (function_exists('smarty_modifier_$plugin')===false)" . |
|
908 | 908 | "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
909 | 909 | break; |
910 | 910 | case Core::SMARTY_FUNCTION: |
911 | - $output .= "if (function_exists('smarty_function_$plugin')===false)". |
|
911 | + $output .= "if (function_exists('smarty_function_$plugin')===false)" . |
|
912 | 912 | "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
913 | 913 | break; |
914 | 914 | case Core::SMARTY_BLOCK: |
915 | - $output .= "if (function_exists('smarty_block_$plugin')===false)". |
|
915 | + $output .= "if (function_exists('smarty_block_$plugin')===false)" . |
|
916 | 916 | "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
917 | 917 | break; |
918 | 918 | case Core::PROXY_PLUGIN: |
@@ -1000,14 +1000,14 @@ discard block |
||
1000 | 1000 | |
1001 | 1001 | if ($this->curBlock['buffer'] === null && count($this->stack) > 1) { |
1002 | 1002 | // buffer is not initialized yet (the block has just been created) |
1003 | - $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content; |
|
1003 | + $this->stack[count($this->stack) - 2]['buffer'] .= (string) $content; |
|
1004 | 1004 | $this->curBlock['buffer'] = ''; |
1005 | 1005 | } else { |
1006 | 1006 | if (!isset($this->curBlock['buffer'])) { |
1007 | 1007 | throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere'); |
1008 | 1008 | } |
1009 | 1009 | // append current content to current block's buffer |
1010 | - $this->curBlock['buffer'] .= (string)$content; |
|
1010 | + $this->curBlock['buffer'] .= (string) $content; |
|
1011 | 1011 | } |
1012 | 1012 | $this->line += $lineCount; |
1013 | 1013 | } |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | } |
1087 | 1087 | $params = $this->mapParams($params, array($class, 'init'), $paramtype); |
1088 | 1088 | |
1089 | - $this->stack[] = array( |
|
1089 | + $this->stack[] = array( |
|
1090 | 1090 | 'type' => $type, |
1091 | 1091 | 'params' => $params, |
1092 | 1092 | 'custom' => false, |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | |
1119 | 1119 | $params = $this->mapParams($params, array($class, 'init'), $paramtype); |
1120 | 1120 | |
1121 | - $this->stack[] = array( |
|
1121 | + $this->stack[] = array( |
|
1122 | 1122 | 'type' => $type, |
1123 | 1123 | 'params' => $params, |
1124 | 1124 | 'custom' => true, |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | if (class_exists($class) === false) { |
1148 | 1148 | $this->getCore()->getLoader()->loadPlugin($type); |
1149 | 1149 | } |
1150 | - $this->stack[] = array( |
|
1150 | + $this->stack[] = array( |
|
1151 | 1151 | 'type' => $type, |
1152 | 1152 | 'params' => $params, |
1153 | 1153 | 'custom' => false, |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | $output = ''; |
1176 | 1176 | |
1177 | 1177 | $pluginType = $this->getPluginType($type); |
1178 | - if ($pluginType & Core::SMARTY_BLOCK) { |
|
1178 | + if ($pluginType&Core::SMARTY_BLOCK) { |
|
1179 | 1179 | $type = 'Smartyinterface'; |
1180 | 1180 | } |
1181 | 1181 | while (true) { |
@@ -1382,9 +1382,9 @@ discard block |
||
1382 | 1382 | |
1383 | 1383 | return false; |
1384 | 1384 | } |
1385 | - ++ $from; |
|
1385 | + ++$from; |
|
1386 | 1386 | if ($pointer !== null) { |
1387 | - ++ $pointer; |
|
1387 | + ++$pointer; |
|
1388 | 1388 | } |
1389 | 1389 | if ($from >= $to) { |
1390 | 1390 | if (is_array($parsingParams)) { |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | do { |
1412 | 1412 | $char = substr($src, -- $startpos, 1); |
1413 | 1413 | if ($char == "\n") { |
1414 | - ++ $startpos; |
|
1414 | + ++$startpos; |
|
1415 | 1415 | $whitespaceStart = true; |
1416 | 1416 | break; |
1417 | 1417 | } |
@@ -1438,17 +1438,17 @@ discard block |
||
1438 | 1438 | if ($open !== false && $close !== false) { |
1439 | 1439 | if ($open < $close) { |
1440 | 1440 | $ptr = $open + strlen($comOpen); |
1441 | - ++ $level; |
|
1441 | + ++$level; |
|
1442 | 1442 | } else { |
1443 | 1443 | $ptr = $close + strlen($comClose); |
1444 | - -- $level; |
|
1444 | + --$level; |
|
1445 | 1445 | } |
1446 | 1446 | } elseif ($open !== false) { |
1447 | 1447 | $ptr = $open + strlen($comOpen); |
1448 | - ++ $level; |
|
1448 | + ++$level; |
|
1449 | 1449 | } elseif ($close !== false) { |
1450 | 1450 | $ptr = $close + strlen($comClose); |
1451 | - -- $level; |
|
1451 | + --$level; |
|
1452 | 1452 | } else { |
1453 | 1453 | $ptr = strlen($src); |
1454 | 1454 | } |
@@ -1490,7 +1490,7 @@ discard block |
||
1490 | 1490 | echo 'END OF INSTRUCTION' . "\n"; |
1491 | 1491 | } |
1492 | 1492 | if ($pointer !== null) { |
1493 | - ++ $pointer; |
|
1493 | + ++$pointer; |
|
1494 | 1494 | } |
1495 | 1495 | |
1496 | 1496 | return $this->parse($in, $from + 1, $to, false, 'root', $pointer); |
@@ -1536,7 +1536,7 @@ discard block |
||
1536 | 1536 | } |
1537 | 1537 | $len = strlen($match[1]); |
1538 | 1538 | while (substr($in, $from + $len, 1) === ' ') { |
1539 | - ++ $len; |
|
1539 | + ++$len; |
|
1540 | 1540 | } |
1541 | 1541 | if ($pointer !== null) { |
1542 | 1542 | $pointer += $len; |
@@ -1673,7 +1673,7 @@ discard block |
||
1673 | 1673 | // parse modifier on funcs or vars |
1674 | 1674 | $srcPointer = $pointer; |
1675 | 1675 | if (is_array($parsingParams)) { |
1676 | - $tmp = $this->replaceModifiers( |
|
1676 | + $tmp = $this->replaceModifiers( |
|
1677 | 1677 | array( |
1678 | 1678 | null, |
1679 | 1679 | null, |
@@ -1762,7 +1762,7 @@ discard block |
||
1762 | 1762 | if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') { |
1763 | 1763 | $paramsep = ''; |
1764 | 1764 | if (strlen($match[1][0][0]) > 1) { |
1765 | - -- $paramspos; |
|
1765 | + --$paramspos; |
|
1766 | 1766 | } |
1767 | 1767 | } |
1768 | 1768 | } |
@@ -1814,7 +1814,7 @@ discard block |
||
1814 | 1814 | } |
1815 | 1815 | break 2; |
1816 | 1816 | } elseif ($paramstr[$ptr] === ';') { |
1817 | - ++ $ptr; |
|
1817 | + ++$ptr; |
|
1818 | 1818 | if ($this->debug) { |
1819 | 1819 | echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT ' . $ptr . "\n"; |
1820 | 1820 | } |
@@ -1832,7 +1832,7 @@ discard block |
||
1832 | 1832 | } |
1833 | 1833 | |
1834 | 1834 | if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === ',' || $paramstr[$ptr] === "\r" || $paramstr[$ptr] === "\n" || $paramstr[$ptr] === "\t") { |
1835 | - ++ $ptr; |
|
1835 | + ++$ptr; |
|
1836 | 1836 | } else { |
1837 | 1837 | break; |
1838 | 1838 | } |
@@ -1861,10 +1861,10 @@ discard block |
||
1861 | 1861 | if (is_array($p) && is_array($p[1])) { |
1862 | 1862 | $state |= 2; |
1863 | 1863 | } else { |
1864 | - if (($state & 2) && preg_match('#^(["\'])(.+?)\1$#', $p[0], $m) && $func !== 'array') { |
|
1864 | + if (($state&2) && preg_match('#^(["\'])(.+?)\1$#', $p[0], $m) && $func !== 'array') { |
|
1865 | 1865 | $params[$k] = array($m[2], array('true', 'true')); |
1866 | 1866 | } else { |
1867 | - if ($state & 2 && $func !== 'array') { |
|
1867 | + if ($state&2 && $func !== 'array') { |
|
1868 | 1868 | throw new CompilationException($this, 'You can not use an unnamed parameter after a named one'); |
1869 | 1869 | } |
1870 | 1870 | $state |= 1; |
@@ -1892,21 +1892,21 @@ discard block |
||
1892 | 1892 | } |
1893 | 1893 | |
1894 | 1894 | // Blocks plugin |
1895 | - if ($pluginType & Core::BLOCK_PLUGIN) { |
|
1895 | + if ($pluginType&Core::BLOCK_PLUGIN) { |
|
1896 | 1896 | if ($curBlock !== 'root' || is_array($parsingParams)) { |
1897 | 1897 | throw new CompilationException($this, 'Block plugins can not be used as other plugin\'s arguments'); |
1898 | 1898 | } |
1899 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
1899 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
1900 | 1900 | return $this->addCustomBlock($func, $params, $state); |
1901 | 1901 | } else { |
1902 | 1902 | return $this->addBlock($func, $params, $state); |
1903 | 1903 | } |
1904 | - } elseif ($pluginType & Core::SMARTY_BLOCK) { |
|
1904 | + } elseif ($pluginType&Core::SMARTY_BLOCK) { |
|
1905 | 1905 | if ($curBlock !== 'root' || is_array($parsingParams)) { |
1906 | 1906 | throw new CompilationException($this, 'Block plugins can not be used as other plugin\'s arguments'); |
1907 | 1907 | } |
1908 | 1908 | |
1909 | - if ($state & 2) { |
|
1909 | + if ($state&2) { |
|
1910 | 1910 | array_unshift($params, array('__functype', array($pluginType, $pluginType))); |
1911 | 1911 | array_unshift($params, array('__funcname', array($func, $func))); |
1912 | 1912 | } else { |
@@ -1918,11 +1918,11 @@ discard block |
||
1918 | 1918 | } |
1919 | 1919 | |
1920 | 1920 | // Native & Smarty plugins |
1921 | - if ($pluginType & Core::NATIVE_PLUGIN || $pluginType & Core::SMARTY_FUNCTION || $pluginType & Core::SMARTY_BLOCK) { |
|
1921 | + if ($pluginType&Core::NATIVE_PLUGIN || $pluginType&Core::SMARTY_FUNCTION || $pluginType&Core::SMARTY_BLOCK) { |
|
1922 | 1922 | $params = $this->mapParams($params, null, $state); |
1923 | 1923 | } // PHP class plugin |
1924 | - elseif ($pluginType & Core::CLASS_PLUGIN) { |
|
1925 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
1924 | + elseif ($pluginType&Core::CLASS_PLUGIN) { |
|
1925 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
1926 | 1926 | $params = $this->mapParams( |
1927 | 1927 | $params, array( |
1928 | 1928 | $this->customPlugins[$func]['class'], |
@@ -1932,49 +1932,47 @@ discard block |
||
1932 | 1932 | if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) { |
1933 | 1933 | $params = $this->mapParams($params, array( |
1934 | 1934 | 'Plugin' . Core::toCamelCase($func), |
1935 | - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' |
|
1935 | + ($pluginType&Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' |
|
1936 | 1936 | ), $state); |
1937 | 1937 | } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) { |
1938 | 1938 | $params = $this->mapParams($params, array( |
1939 | 1939 | Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func), |
1940 | - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' |
|
1940 | + ($pluginType&Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' |
|
1941 | 1941 | ), $state); |
1942 | 1942 | } else { |
1943 | 1943 | $params = $this->mapParams($params, array( |
1944 | 1944 | Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func), |
1945 | - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' |
|
1945 | + ($pluginType&Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' |
|
1946 | 1946 | ), $state); |
1947 | 1947 | } |
1948 | 1948 | } |
1949 | 1949 | } // PHP function plugin |
1950 | - elseif ($pluginType & Core::FUNC_PLUGIN) { |
|
1951 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
1950 | + elseif ($pluginType&Core::FUNC_PLUGIN) { |
|
1951 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
1952 | 1952 | $params = $this->mapParams($params, $this->customPlugins[$func]['callback'], $state); |
1953 | 1953 | } else { |
1954 | 1954 | // Custom plugin |
1955 | - if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? |
|
1955 | + if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType&Core::COMPILABLE_PLUGIN) ? |
|
1956 | 1956 | 'Compile' : '')) !== false) { |
1957 | - $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType & |
|
1957 | + $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType& |
|
1958 | 1958 | Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); |
1959 | 1959 | } // Builtin helper plugin |
1960 | 1960 | elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . ( |
1961 | - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) { |
|
1962 | - $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase |
|
1963 | - ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); |
|
1961 | + ($pluginType&Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) { |
|
1962 | + $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . (($pluginType&Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); |
|
1964 | 1963 | } // Builtin function plugin |
1965 | 1964 | else { |
1966 | - $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase |
|
1967 | - ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); |
|
1965 | + $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . (($pluginType&Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); |
|
1968 | 1966 | } |
1969 | 1967 | } |
1970 | 1968 | } // Smarty modifier |
1971 | - elseif ($pluginType & Core::SMARTY_MODIFIER) { |
|
1969 | + elseif ($pluginType&Core::SMARTY_MODIFIER) { |
|
1972 | 1970 | $output = 'smarty_modifier_' . $func . '(' . implode(', ', $params) . ')'; |
1973 | 1971 | } // Proxy plugin |
1974 | - elseif ($pluginType & Core::PROXY_PLUGIN) { |
|
1972 | + elseif ($pluginType&Core::PROXY_PLUGIN) { |
|
1975 | 1973 | $params = $this->mapParams($params, $this->getCore()->getPluginProxy()->getCallback($func), $state); |
1976 | 1974 | } // Template plugin |
1977 | - elseif ($pluginType & Core::TEMPLATE_PLUGIN) { |
|
1975 | + elseif ($pluginType&Core::TEMPLATE_PLUGIN) { |
|
1978 | 1976 | // transforms the parameter array from (x=>array('paramname'=>array(values))) to (paramname=>array(values)) |
1979 | 1977 | $map = array(); |
1980 | 1978 | foreach ($this->templatePlugins[$func]['params'] as $param => $defValue) { |
@@ -2005,7 +2003,7 @@ discard block |
||
2005 | 2003 | } |
2006 | 2004 | |
2007 | 2005 | // Native plugin |
2008 | - if ($pluginType & Core::NATIVE_PLUGIN) { |
|
2006 | + if ($pluginType&Core::NATIVE_PLUGIN) { |
|
2009 | 2007 | if ($func === 'do') { |
2010 | 2008 | $output = ''; |
2011 | 2009 | if (isset($params['*'])) { |
@@ -2025,9 +2023,9 @@ discard block |
||
2025 | 2023 | } |
2026 | 2024 | } |
2027 | 2025 | } // Block class OR Function class |
2028 | - elseif ($pluginType & Core::CLASS_PLUGIN || ($pluginType & Core::FUNC_PLUGIN && $pluginType & Core::CLASS_PLUGIN)) { |
|
2029 | - if ($pluginType & Core::COMPILABLE_PLUGIN) { |
|
2030 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
2026 | + elseif ($pluginType&Core::CLASS_PLUGIN || ($pluginType&Core::FUNC_PLUGIN && $pluginType&Core::CLASS_PLUGIN)) { |
|
2027 | + if ($pluginType&Core::COMPILABLE_PLUGIN) { |
|
2028 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
2031 | 2029 | $callback = $this->customPlugins[$func]['callback']; |
2032 | 2030 | if (!is_array($callback)) { |
2033 | 2031 | if (!method_exists($callback, 'compile')) { |
@@ -2061,7 +2059,7 @@ discard block |
||
2061 | 2059 | $output = call_user_func_array($funcCompiler, $params); |
2062 | 2060 | } else { |
2063 | 2061 | $params = self::implode_r($params); |
2064 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
2062 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
2065 | 2063 | $callback = $this->customPlugins[$func]['callback']; |
2066 | 2064 | if (!is_array($callback)) { |
2067 | 2065 | if (!method_exists($callback, 'process')) { |
@@ -2097,9 +2095,9 @@ discard block |
||
2097 | 2095 | } |
2098 | 2096 | } |
2099 | 2097 | } // Function plugin only (cannot be a class) |
2100 | - elseif ($pluginType & Core::FUNC_PLUGIN) { |
|
2101 | - if ($pluginType & Core::COMPILABLE_PLUGIN) { |
|
2102 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
2098 | + elseif ($pluginType&Core::FUNC_PLUGIN) { |
|
2099 | + if ($pluginType&Core::COMPILABLE_PLUGIN) { |
|
2100 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
2103 | 2101 | $funcCompiler = $this->customPlugins[$func]['callback']; |
2104 | 2102 | } else { |
2105 | 2103 | // Custom plugin |
@@ -2124,7 +2122,7 @@ discard block |
||
2124 | 2122 | } else { |
2125 | 2123 | array_unshift($params, '$this'); |
2126 | 2124 | $params = self::implode_r($params); |
2127 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
2125 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
2128 | 2126 | $callback = $this->customPlugins[$func]['callback']; |
2129 | 2127 | if ($callback instanceof Closure) { |
2130 | 2128 | $output = 'call_user_func($this->getCustomPlugin(\'' . $func . '\'), ' . $params . ')'; |
@@ -2137,7 +2135,7 @@ discard block |
||
2137 | 2135 | $output = 'Plugin' . Core::toCamelCase($func) . '(' . $params . |
2138 | 2136 | ')'; |
2139 | 2137 | } // Builtin helper plugin |
2140 | - elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== |
|
2138 | + elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== |
|
2141 | 2139 | false) { |
2142 | 2140 | $output = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . '(' . |
2143 | 2141 | $params . ')'; |
@@ -2149,16 +2147,16 @@ discard block |
||
2149 | 2147 | } |
2150 | 2148 | } |
2151 | 2149 | } // Proxy plugin |
2152 | - elseif ($pluginType & Core::PROXY_PLUGIN) { |
|
2150 | + elseif ($pluginType&Core::PROXY_PLUGIN) { |
|
2153 | 2151 | $output = call_user_func(array($this->getCore()->getPluginProxy(), 'getCode'), $func, $params); |
2154 | 2152 | } // Smarty function (@deprecated) |
2155 | - elseif ($pluginType & Core::SMARTY_FUNCTION) { |
|
2153 | + elseif ($pluginType&Core::SMARTY_FUNCTION) { |
|
2156 | 2154 | $params = ''; |
2157 | 2155 | if (isset($params['*'])) { |
2158 | 2156 | $params = self::implode_r($params['*'], true); |
2159 | 2157 | } |
2160 | 2158 | |
2161 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
2159 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
2162 | 2160 | $callback = $this->customPlugins[$func]['callback']; |
2163 | 2161 | if (is_array($callback)) { |
2164 | 2162 | if (is_object($callback[0])) { |
@@ -2173,7 +2171,7 @@ discard block |
||
2173 | 2171 | $output = 'smarty_function_' . $func . '(array(' . $params . '), $this)'; |
2174 | 2172 | } |
2175 | 2173 | } // Template plugin |
2176 | - elseif ($pluginType & Core::TEMPLATE_PLUGIN) { |
|
2174 | + elseif ($pluginType&Core::TEMPLATE_PLUGIN) { |
|
2177 | 2175 | array_unshift($params, '$this'); |
2178 | 2176 | $params = self::implode_r($params); |
2179 | 2177 | $output = 'Plugin' . Core::toCamelCase($func) . |
@@ -2380,7 +2378,7 @@ discard block |
||
2380 | 2378 | |
2381 | 2379 | if (substr($key, - 1) == '.') { |
2382 | 2380 | $key = substr($key, 0, - 1); |
2383 | - -- $matchedLength; |
|
2381 | + --$matchedLength; |
|
2384 | 2382 | } |
2385 | 2383 | |
2386 | 2384 | if ($hasMethodCall) { |
@@ -2415,7 +2413,7 @@ discard block |
||
2415 | 2413 | $uid = 0; |
2416 | 2414 | $parsed = array($uid => ''); |
2417 | 2415 | $current = &$parsed; |
2418 | - $curTxt = &$parsed[$uid ++]; |
|
2416 | + $curTxt = &$parsed[$uid++]; |
|
2419 | 2417 | $tree = array(); |
2420 | 2418 | $chars = str_split($key, 1); |
2421 | 2419 | $inSplittedVar = false; |
@@ -2424,33 +2422,33 @@ discard block |
||
2424 | 2422 | while (($char = array_shift($chars)) !== null) { |
2425 | 2423 | if ($char === '[') { |
2426 | 2424 | if (count($tree) > 0) { |
2427 | - ++ $bracketCount; |
|
2425 | + ++$bracketCount; |
|
2428 | 2426 | } else { |
2429 | 2427 | $tree[] = &$current; |
2430 | 2428 | $current[$uid] = array($uid + 1 => ''); |
2431 | - $current = &$current[$uid ++]; |
|
2432 | - $curTxt = &$current[$uid ++]; |
|
2429 | + $current = &$current[$uid++]; |
|
2430 | + $curTxt = &$current[$uid++]; |
|
2433 | 2431 | continue; |
2434 | 2432 | } |
2435 | 2433 | } elseif ($char === ']') { |
2436 | 2434 | if ($bracketCount > 0) { |
2437 | - -- $bracketCount; |
|
2435 | + --$bracketCount; |
|
2438 | 2436 | } else { |
2439 | 2437 | $current = &$tree[count($tree) - 1]; |
2440 | 2438 | array_pop($tree); |
2441 | 2439 | if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') { |
2442 | 2440 | $current[$uid] = ''; |
2443 | - $curTxt = &$current[$uid ++]; |
|
2441 | + $curTxt = &$current[$uid++]; |
|
2444 | 2442 | } |
2445 | 2443 | continue; |
2446 | 2444 | } |
2447 | 2445 | } elseif ($char === '$') { |
2448 | 2446 | if (count($tree) == 0) { |
2449 | - $curTxt = &$current[$uid ++]; |
|
2447 | + $curTxt = &$current[$uid++]; |
|
2450 | 2448 | $inSplittedVar = true; |
2451 | 2449 | } |
2452 | 2450 | } elseif (($char === '.' || $char === '-') && count($tree) == 0 && $inSplittedVar) { |
2453 | - $curTxt = &$current[$uid ++]; |
|
2451 | + $curTxt = &$current[$uid++]; |
|
2454 | 2452 | $inSplittedVar = false; |
2455 | 2453 | } |
2456 | 2454 | |
@@ -2703,7 +2701,7 @@ discard block |
||
2703 | 2701 | $parentCnt = 0; |
2704 | 2702 | |
2705 | 2703 | while (true) { |
2706 | - ++ $parentCnt; |
|
2704 | + ++$parentCnt; |
|
2707 | 2705 | array_shift($m[2]); |
2708 | 2706 | array_shift($m[1]); |
2709 | 2707 | if (current($m[2]) === '_parent') { |
@@ -2785,7 +2783,7 @@ discard block |
||
2785 | 2783 | echo 'PARSING SUBVARS IN : ' . $key . "\n"; |
2786 | 2784 | } |
2787 | 2785 | if ($cnt > 0) { |
2788 | - while (-- $cnt >= 0) { |
|
2786 | + while (--$cnt >= 0) { |
|
2789 | 2787 | if (isset($last)) { |
2790 | 2788 | $last = strrpos($key, '$', - (strlen($key) - $last + 1)); |
2791 | 2789 | } else { |
@@ -2940,9 +2938,9 @@ discard block |
||
2940 | 2938 | $substr = 'null'; |
2941 | 2939 | $type = self::T_NULL; |
2942 | 2940 | } elseif (is_numeric($substr)) { |
2943 | - $substr = (float)$substr; |
|
2944 | - if ((int)$substr == $substr) { |
|
2945 | - $substr = (int)$substr; |
|
2941 | + $substr = (float) $substr; |
|
2942 | + if ((int) $substr == $substr) { |
|
2943 | + $substr = (int) $substr; |
|
2946 | 2944 | } |
2947 | 2945 | $type = self::T_NUMERIC; |
2948 | 2946 | if ($this->debug) { |
@@ -3000,7 +2998,7 @@ discard block |
||
3000 | 2998 | while (($pos = strpos($string, '$', $pos)) !== false) { |
3001 | 2999 | $prev = substr($string, $pos - 1, 1); |
3002 | 3000 | if ($prev === '\\') { |
3003 | - ++ $pos; |
|
3001 | + ++$pos; |
|
3004 | 3002 | continue; |
3005 | 3003 | } |
3006 | 3004 | |
@@ -3135,11 +3133,11 @@ discard block |
||
3135 | 3133 | $pointer -= strlen($paramstr) - $ptr; |
3136 | 3134 | } |
3137 | 3135 | } |
3138 | - ++ $ptr; |
|
3136 | + ++$ptr; |
|
3139 | 3137 | break; |
3140 | 3138 | } |
3141 | 3139 | if ($ptr < strlen($paramstr) && $paramstr[$ptr] === ':') { |
3142 | - ++ $ptr; |
|
3140 | + ++$ptr; |
|
3143 | 3141 | } |
3144 | 3142 | } |
3145 | 3143 | $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr); |
@@ -3147,10 +3145,10 @@ discard block |
||
3147 | 3145 | if (is_array($p) && is_array($p[1])) { |
3148 | 3146 | $state |= 2; |
3149 | 3147 | } else { |
3150 | - if (($state & 2) && preg_match('#^(["\'])(.+?)\1$#', $p[0], $m)) { |
|
3148 | + if (($state&2) && preg_match('#^(["\'])(.+?)\1$#', $p[0], $m)) { |
|
3151 | 3149 | $params[$k] = array($m[2], array('true', 'true')); |
3152 | 3150 | } else { |
3153 | - if ($state & 2) { |
|
3151 | + if ($state&2) { |
|
3154 | 3152 | throw new CompilationException($this, 'You can not use an unnamed parameter after a named one'); |
3155 | 3153 | } |
3156 | 3154 | $state |= 1; |
@@ -3168,13 +3166,13 @@ discard block |
||
3168 | 3166 | |
3169 | 3167 | $pluginType = $this->getPluginType($func); |
3170 | 3168 | |
3171 | - if ($state & 2) { |
|
3169 | + if ($state&2) { |
|
3172 | 3170 | array_unshift($params, array('value', is_array($output) ? $output : array($output, $output))); |
3173 | 3171 | } else { |
3174 | 3172 | array_unshift($params, is_array($output) ? $output : array($output, $output)); |
3175 | 3173 | } |
3176 | 3174 | |
3177 | - if ($pluginType & Core::NATIVE_PLUGIN) { |
|
3175 | + if ($pluginType&Core::NATIVE_PLUGIN) { |
|
3178 | 3176 | $params = $this->mapParams($params, null, $state); |
3179 | 3177 | |
3180 | 3178 | $params = $params['*'][0]; |
@@ -3186,19 +3184,19 @@ discard block |
||
3186 | 3184 | } else { |
3187 | 3185 | $output = $func . '(' . $params . ')'; |
3188 | 3186 | } |
3189 | - } elseif ($pluginType & Core::PROXY_PLUGIN) { |
|
3187 | + } elseif ($pluginType&Core::PROXY_PLUGIN) { |
|
3190 | 3188 | $params = $this->mapParams($params, $this->getCore()->getPluginProxy()->getCallback($func), $state); |
3191 | 3189 | foreach ($params as &$p) { |
3192 | 3190 | $p = $p[0]; |
3193 | 3191 | } |
3194 | 3192 | $output = call_user_func(array($this->getCore()->getPluginProxy(), 'getCode'), $func, $params); |
3195 | - } elseif ($pluginType & Core::SMARTY_MODIFIER) { |
|
3193 | + } elseif ($pluginType&Core::SMARTY_MODIFIER) { |
|
3196 | 3194 | $params = $this->mapParams($params, null, $state); |
3197 | 3195 | $params = $params['*'][0]; |
3198 | 3196 | |
3199 | 3197 | $params = self::implode_r($params); |
3200 | 3198 | |
3201 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
3199 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
3202 | 3200 | $callback = $this->customPlugins[$func]['callback']; |
3203 | 3201 | if (is_array($callback)) { |
3204 | 3202 | if (is_object($callback[0])) { |
@@ -3217,24 +3215,24 @@ discard block |
||
3217 | 3215 | $output = 'smarty_modifier_' . $func . '(' . $params . ')'; |
3218 | 3216 | } |
3219 | 3217 | } else { |
3220 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
3218 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
3221 | 3219 | $pluginName = $callback = $this->customPlugins[$func]['callback']; |
3222 | - if (($pluginType & Core::CLASS_PLUGIN) && !is_array($callback)) { |
|
3220 | + if (($pluginType&Core::CLASS_PLUGIN) && !is_array($callback)) { |
|
3223 | 3221 | $pluginName = $this->customPlugins[$func]['callback']; |
3224 | - $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'); |
|
3222 | + $callback = array($pluginName, ($pluginType&Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'); |
|
3225 | 3223 | } |
3226 | 3224 | } else { |
3227 | 3225 | if (class_exists('Plugin' . Core::toCamelCase($func)) !== false || function_exists('Plugin' . |
3228 | - Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) |
|
3226 | + Core::toCamelCase($func) . (($pluginType&Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) |
|
3229 | 3227 | !== false) { |
3230 | 3228 | $pluginName = 'Plugin' . Core::toCamelCase($func); |
3231 | 3229 | } else { |
3232 | 3230 | $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func); |
3233 | 3231 | } |
3234 | - if ($pluginType & Core::CLASS_PLUGIN) { |
|
3235 | - $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'); |
|
3232 | + if ($pluginType&Core::CLASS_PLUGIN) { |
|
3233 | + $callback = array($pluginName, ($pluginType&Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'); |
|
3236 | 3234 | } else { |
3237 | - $callback = $pluginName . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''); |
|
3235 | + $callback = $pluginName . (($pluginType&Core::COMPILABLE_PLUGIN) ? 'Compile' : ''); |
|
3238 | 3236 | } |
3239 | 3237 | } |
3240 | 3238 | $params = $this->mapParams($params, $callback, $state); |
@@ -3244,12 +3242,12 @@ discard block |
||
3244 | 3242 | } |
3245 | 3243 | |
3246 | 3244 | // Only for PHP function, who is not a PHP class |
3247 | - if ($pluginType & Core::FUNC_PLUGIN && !($pluginType & Core::CLASS_PLUGIN)) { |
|
3248 | - if ($pluginType & Core::COMPILABLE_PLUGIN) { |
|
3245 | + if ($pluginType&Core::FUNC_PLUGIN && !($pluginType&Core::CLASS_PLUGIN)) { |
|
3246 | + if ($pluginType&Core::COMPILABLE_PLUGIN) { |
|
3249 | 3247 | if ($mapped) { |
3250 | 3248 | throw new CompilationException($this, 'The @ operator can not be used on compiled plugins.'); |
3251 | 3249 | } |
3252 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
3250 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
3253 | 3251 | $funcCompiler = $this->customPlugins[$func]['callback']; |
3254 | 3252 | } else { |
3255 | 3253 | if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) { |
@@ -3272,11 +3270,11 @@ discard block |
||
3272 | 3270 | } |
3273 | 3271 | } |
3274 | 3272 | } else { |
3275 | - if ($pluginType & Core::COMPILABLE_PLUGIN) { |
|
3273 | + if ($pluginType&Core::COMPILABLE_PLUGIN) { |
|
3276 | 3274 | if ($mapped) { |
3277 | 3275 | throw new CompilationException($this, 'The @ operator can not be used on compiled plugins.'); |
3278 | 3276 | } |
3279 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
3277 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
3280 | 3278 | $callback = $this->customPlugins[$func]['callback']; |
3281 | 3279 | if (!is_array($callback)) { |
3282 | 3280 | if (!method_exists($callback, 'compile')) { |
@@ -3302,7 +3300,7 @@ discard block |
||
3302 | 3300 | } else { |
3303 | 3301 | $params = self::implode_r($params); |
3304 | 3302 | |
3305 | - if ($pluginType & Core::CUSTOM_PLUGIN) { |
|
3303 | + if ($pluginType&Core::CUSTOM_PLUGIN) { |
|
3306 | 3304 | if (is_object($callback[0])) { |
3307 | 3305 | if (is_array($this->getCore()->getCustomPlugin($func))) { |
3308 | 3306 | $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))'; |
@@ -3313,7 +3311,7 @@ discard block |
||
3313 | 3311 | $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))'; |
3314 | 3312 | } |
3315 | 3313 | } elseif ($mapped) { |
3316 | - $output = '$this->arrayMap(array($this->getObjectPlugin(\''. |
|
3314 | + $output = '$this->arrayMap(array($this->getObjectPlugin(\'' . |
|
3317 | 3315 | Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '\'), |
3318 | 3316 | \'process\'), array(' . $params . '))'; |
3319 | 3317 | } else { |
@@ -3397,10 +3395,10 @@ discard block |
||
3397 | 3395 | while ($pluginType <= 0) { |
3398 | 3396 | // Template plugin compilable |
3399 | 3397 | if (isset($this->templatePlugins[$name])) { |
3400 | - $pluginType = Core::TEMPLATE_PLUGIN | Core::COMPILABLE_PLUGIN; |
|
3398 | + $pluginType = Core::TEMPLATE_PLUGIN|Core::COMPILABLE_PLUGIN; |
|
3401 | 3399 | } // Custom plugin |
3402 | 3400 | elseif (isset($this->customPlugins[$name])) { |
3403 | - $pluginType = $this->customPlugins[$name]['type'] | Core::CUSTOM_PLUGIN; |
|
3401 | + $pluginType = $this->customPlugins[$name]['type']|Core::CUSTOM_PLUGIN; |
|
3404 | 3402 | } // Class blocks plugin |
3405 | 3403 | elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name)) !== false) { |
3406 | 3404 | $pluginType = Core::CLASS_PLUGIN; |
@@ -3426,20 +3424,20 @@ discard block |
||
3426 | 3424 | $pluginType |= Core::COMPILABLE_PLUGIN; |
3427 | 3425 | } |
3428 | 3426 | } // Function plugin (with/without namespaces) |
3429 | - elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase ($name)) !== |
|
3427 | + elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name)) !== |
|
3430 | 3428 | false || function_exists('Plugin' . Core::toCamelCase($name)) !== false) { |
3431 | 3429 | $pluginType = Core::FUNC_PLUGIN; |
3432 | 3430 | } // Function plugin compile (with/without namespaces) |
3433 | 3431 | elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name) . |
3434 | 3432 | 'Compile') !== false || function_exists('Plugin' . Core::toCamelCase($name) . 'Compile') !== |
3435 | 3433 | false) { |
3436 | - $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN; |
|
3434 | + $pluginType = Core::FUNC_PLUGIN|Core::COMPILABLE_PLUGIN; |
|
3437 | 3435 | } // Helper plugin class compile |
3438 | 3436 | elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name)) !== false) { |
3439 | - $pluginType = Core::CLASS_PLUGIN | Core::COMPILABLE_PLUGIN; |
|
3437 | + $pluginType = Core::CLASS_PLUGIN|Core::COMPILABLE_PLUGIN; |
|
3440 | 3438 | } // Helper plugin function compile |
3441 | 3439 | elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name) . 'Compile') !== false) { |
3442 | - $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN; |
|
3440 | + $pluginType = Core::FUNC_PLUGIN|Core::COMPILABLE_PLUGIN; |
|
3443 | 3441 | } // Smarty modifier |
3444 | 3442 | elseif (function_exists('smarty_modifier_' . $name) !== false) { |
3445 | 3443 | $pluginType = Core::SMARTY_MODIFIER; |
@@ -3468,11 +3466,11 @@ discard block |
||
3468 | 3466 | } else { |
3469 | 3467 | throw new Exception('Plugin "' . $name . '" could not be found, type:' . $pluginType); |
3470 | 3468 | } |
3471 | - ++ $pluginType; |
|
3469 | + ++$pluginType; |
|
3472 | 3470 | } |
3473 | 3471 | } |
3474 | 3472 | |
3475 | - if (($pluginType & Core::COMPILABLE_PLUGIN) === 0 && ($pluginType & Core::NATIVE_PLUGIN) === 0 && ($pluginType & Core::PROXY_PLUGIN) === 0) { |
|
3473 | + if (($pluginType&Core::COMPILABLE_PLUGIN) === 0 && ($pluginType&Core::NATIVE_PLUGIN) === 0 && ($pluginType&Core::PROXY_PLUGIN) === 0) { |
|
3476 | 3474 | $this->addUsedPlugin(Core::toCamelCase($name), $pluginType); |
3477 | 3475 | } |
3478 | 3476 | |
@@ -3537,7 +3535,7 @@ discard block |
||
3537 | 3535 | } |
3538 | 3536 | |
3539 | 3537 | // loops over the param map and assigns values from the template or default value for unset optional params |
3540 | - foreach ($map as $k => $v){ |
|
3538 | + foreach ($map as $k => $v) { |
|
3541 | 3539 | if ($v[0] === '*') { |
3542 | 3540 | // "rest" array parameter, fill every remaining params in it and then break |
3543 | 3541 | if (count($ps) === 0) { |
@@ -478,8 +478,7 @@ discard block |
||
478 | 478 | if (!class_exists($class) && !function_exists($class)) { |
479 | 479 | try { |
480 | 480 | $this->getCore()->getLoader()->loadPlugin($name); |
481 | - } |
|
482 | - catch (Exception $e) { |
|
481 | + } catch (Exception $e) { |
|
483 | 482 | throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory'); |
484 | 483 | } |
485 | 484 | } |
@@ -1632,8 +1631,7 @@ discard block |
||
1632 | 1631 | // load if plugin |
1633 | 1632 | try { |
1634 | 1633 | $this->getPluginType('if'); |
1635 | - } |
|
1636 | - catch (Exception $e) { |
|
1634 | + } catch (Exception $e) { |
|
1637 | 1635 | throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible'); |
1638 | 1636 | } |
1639 | 1637 | |
@@ -3454,8 +3452,7 @@ discard block |
||
3454 | 3452 | if ($pluginType === - 1) { |
3455 | 3453 | try { |
3456 | 3454 | $this->getCore()->getLoader()->loadPlugin('Plugin' . Core::toCamelCase($name)); |
3457 | - } |
|
3458 | - catch (Exception $e) { |
|
3455 | + } catch (Exception $e) { |
|
3459 | 3456 | if (isset($phpFunc)) { |
3460 | 3457 | $pluginType = Core::NATIVE_PLUGIN; |
3461 | 3458 | } elseif (is_object($this->getCore()->getPluginProxy()) && $this->getCore()->getPluginProxy()->handles($name)) { |
@@ -97,7 +97,7 @@ |
||
97 | 97 | { |
98 | 98 | if (is_array($name)) { |
99 | 99 | reset($name); |
100 | - foreach ($name as $k => $v){ |
|
100 | + foreach ($name as $k => $v) { |
|
101 | 101 | $this->data[$k] = $v; |
102 | 102 | } |
103 | 103 | } else { |
@@ -431,7 +431,7 @@ |
||
431 | 431 | * @return $this |
432 | 432 | */ |
433 | 433 | public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, |
434 | - $compileId = null, ITemplate $parentTemplate = null) |
|
434 | + $compileId = null, ITemplate $parentTemplate = null) |
|
435 | 435 | { |
436 | 436 | return new self($resourceId, $cacheTime, $cacheId, $compileId); |
437 | 437 | } |
@@ -512,7 +512,7 @@ |
||
512 | 512 | } |
513 | 513 | |
514 | 514 | $retries = 3; |
515 | - while ($retries --) { |
|
515 | + while ($retries--) { |
|
516 | 516 | @mkdir($path, $chmod, true); |
517 | 517 | if (is_dir($path)) { |
518 | 518 | break; |
@@ -199,7 +199,7 @@ |
||
199 | 199 | * @throws SecurityException |
200 | 200 | */ |
201 | 201 | public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, |
202 | - $compileId = null, ITemplate $parentTemplate = null) |
|
202 | + $compileId = null, ITemplate $parentTemplate = null) |
|
203 | 203 | { |
204 | 204 | if (DIRECTORY_SEPARATOR === '\\') { |
205 | 205 | $resourceId = str_replace(array("\t", "\n", "\r", "\f", "\v"), array( |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | protected function isValidCompiledFile($file) |
113 | 113 | { |
114 | - return parent::isValidCompiledFile($file) && (int)$this->getUid() <= filemtime($file); |
|
114 | + return parent::isValidCompiledFile($file) && (int) $this->getUid() <= filemtime($file); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | */ |
167 | 167 | public function getUid() |
168 | 168 | { |
169 | - return (string)filemtime($this->getResourceIdentifier()); |
|
169 | + return (string) filemtime($this->getResourceIdentifier()); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
@@ -157,5 +157,5 @@ |
||
157 | 157 | * @return ITemplate|false|null |
158 | 158 | */ |
159 | 159 | public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, |
160 | - $compileId = null, ITemplate $parentTemplate = null); |
|
160 | + $compileId = null, ITemplate $parentTemplate = null); |
|
161 | 161 | } |
@@ -169,7 +169,7 @@ |
||
169 | 169 | throw new Exception('Plugin directory does not exist or can not be read : ' . $pluginDirectory); |
170 | 170 | } |
171 | 171 | $cacheFile = $this->cacheDir . 'classpath-' . substr(strtr($pluginDir, '/\\:' . PATH_SEPARATOR, '----'), |
172 | - strlen($pluginDir) > 80 ? - 80 : 0) . '.d' . Core::RELEASE_TAG . '.php'; |
|
172 | + strlen($pluginDir) > 80 ? -80 : 0) . '.d' . Core::RELEASE_TAG . '.php'; |
|
173 | 173 | $this->paths[$pluginDir] = $cacheFile; |
174 | 174 | if (file_exists($cacheFile)) { |
175 | 175 | $classpath = file_get_contents($cacheFile); |
@@ -1523,35 +1523,35 @@ |
||
1523 | 1523 | array_shift($m[2]); |
1524 | 1524 | array_shift($m[1]); |
1525 | 1525 | switch ($m[2][0]) { |
1526 | - case 'get': |
|
1527 | - $cur = $_GET; |
|
1528 | - break; |
|
1529 | - case 'post': |
|
1530 | - $cur = $_POST; |
|
1531 | - break; |
|
1532 | - case 'session': |
|
1533 | - $cur = $_SESSION; |
|
1534 | - break; |
|
1535 | - case 'cookies': |
|
1536 | - case 'cookie': |
|
1537 | - $cur = $_COOKIE; |
|
1538 | - break; |
|
1539 | - case 'server': |
|
1540 | - $cur = $_SERVER; |
|
1541 | - break; |
|
1542 | - case 'env': |
|
1543 | - $cur = $_ENV; |
|
1544 | - break; |
|
1545 | - case 'request': |
|
1546 | - $cur = $_REQUEST; |
|
1547 | - break; |
|
1548 | - case 'const': |
|
1549 | - array_shift($m[2]); |
|
1550 | - if (defined($m[2][0])) { |
|
1551 | - return constant($m[2][0]); |
|
1552 | - } else { |
|
1553 | - return null; |
|
1554 | - } |
|
1526 | + case 'get': |
|
1527 | + $cur = $_GET; |
|
1528 | + break; |
|
1529 | + case 'post': |
|
1530 | + $cur = $_POST; |
|
1531 | + break; |
|
1532 | + case 'session': |
|
1533 | + $cur = $_SESSION; |
|
1534 | + break; |
|
1535 | + case 'cookies': |
|
1536 | + case 'cookie': |
|
1537 | + $cur = $_COOKIE; |
|
1538 | + break; |
|
1539 | + case 'server': |
|
1540 | + $cur = $_SERVER; |
|
1541 | + break; |
|
1542 | + case 'env': |
|
1543 | + $cur = $_ENV; |
|
1544 | + break; |
|
1545 | + case 'request': |
|
1546 | + $cur = $_REQUEST; |
|
1547 | + break; |
|
1548 | + case 'const': |
|
1549 | + array_shift($m[2]); |
|
1550 | + if (defined($m[2][0])) { |
|
1551 | + return constant($m[2][0]); |
|
1552 | + } else { |
|
1553 | + return null; |
|
1554 | + } |
|
1555 | 1555 | } |
1556 | 1556 | if ($cur !== $this->getGlobals()) { |
1557 | 1557 | array_shift($m[2]); |
@@ -500,13 +500,13 @@ discard block |
||
500 | 500 | if (is_array($callback)) { |
501 | 501 | if (is_subclass_of(is_object($callback[0]) ? get_class($callback[0]) : $callback[0], 'Dwoo\Block\Plugin')) { |
502 | 502 | $this->plugins[$name] = array( |
503 | - 'type' => self::BLOCK_PLUGIN | $compilable, |
|
503 | + 'type' => self::BLOCK_PLUGIN|$compilable, |
|
504 | 504 | 'callback' => $callback, |
505 | 505 | 'class' => (is_object($callback[0]) ? get_class($callback[0]) : $callback[0]) |
506 | 506 | ); |
507 | 507 | } else { |
508 | 508 | $this->plugins[$name] = array( |
509 | - 'type' => self::CLASS_PLUGIN | $compilable, |
|
509 | + 'type' => self::CLASS_PLUGIN|$compilable, |
|
510 | 510 | 'callback' => $callback, |
511 | 511 | 'class' => (is_object($callback[0]) ? get_class($callback[0]) : $callback[0]), |
512 | 512 | 'function' => $callback[1] |
@@ -516,13 +516,13 @@ discard block |
||
516 | 516 | if (class_exists($callback)) { |
517 | 517 | if (is_subclass_of($callback, 'Dwoo\Block\Plugin')) { |
518 | 518 | $this->plugins[$name] = array( |
519 | - 'type' => self::BLOCK_PLUGIN | $compilable, |
|
519 | + 'type' => self::BLOCK_PLUGIN|$compilable, |
|
520 | 520 | 'callback' => $callback, |
521 | 521 | 'class' => $callback |
522 | 522 | ); |
523 | 523 | } else { |
524 | 524 | $this->plugins[$name] = array( |
525 | - 'type' => self::CLASS_PLUGIN | $compilable, |
|
525 | + 'type' => self::CLASS_PLUGIN|$compilable, |
|
526 | 526 | 'callback' => $callback, |
527 | 527 | 'class' => $callback, |
528 | 528 | 'function' => ($compilable ? 'compile' : 'process') |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | } |
531 | 531 | } elseif (function_exists($callback)) { |
532 | 532 | $this->plugins[$name] = array( |
533 | - 'type' => self::FUNC_PLUGIN | $compilable, |
|
533 | + 'type' => self::FUNC_PLUGIN|$compilable, |
|
534 | 534 | 'callback' => $callback |
535 | 535 | ); |
536 | 536 | } else { |
@@ -538,19 +538,19 @@ discard block |
||
538 | 538 | } |
539 | 539 | } elseif ($callback instanceof Closure) { |
540 | 540 | $this->plugins[$name] = array( |
541 | - 'type' => self::FUNC_PLUGIN | $compilable, |
|
541 | + 'type' => self::FUNC_PLUGIN|$compilable, |
|
542 | 542 | 'callback' => $callback |
543 | 543 | ); |
544 | 544 | } elseif (is_object($callback)) { |
545 | 545 | if (is_subclass_of($callback, 'Dwoo\Block\Plugin')) { |
546 | 546 | $this->plugins[$name] = array( |
547 | - 'type' => self::BLOCK_PLUGIN | $compilable, |
|
547 | + 'type' => self::BLOCK_PLUGIN|$compilable, |
|
548 | 548 | 'callback' => get_class($callback), |
549 | 549 | 'class' => $callback |
550 | 550 | ); |
551 | 551 | } else { |
552 | 552 | $this->plugins[$name] = array( |
553 | - 'type' => self::CLASS_PLUGIN | $compilable, |
|
553 | + 'type' => self::CLASS_PLUGIN|$compilable, |
|
554 | 554 | 'callback' => $callback, |
555 | 555 | 'class' => $callback, |
556 | 556 | 'function' => ($compilable ? 'compile' : 'process') |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | public function removeFilter($callback) |
627 | 627 | { |
628 | - if (($index = array_search(self::NAMESPACE_PLUGINS_FILTERS. 'Filter' . self::toCamelCase($callback), $this->filters, |
|
628 | + if (($index = array_search(self::NAMESPACE_PLUGINS_FILTERS . 'Filter' . self::toCamelCase($callback), $this->filters, |
|
629 | 629 | true)) !== |
630 | 630 | false) { |
631 | 631 | unset($this->filters[$index]); |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | */ |
860 | 860 | public function setCacheTime($seconds) |
861 | 861 | { |
862 | - $this->cacheTime = (int)$seconds; |
|
862 | + $this->cacheTime = (int) $seconds; |
|
863 | 863 | } |
864 | 864 | |
865 | 865 | /** |
@@ -883,7 +883,7 @@ discard block |
||
883 | 883 | */ |
884 | 884 | public function setCharset($charset) |
885 | 885 | { |
886 | - $this->charset = strtolower((string)$charset); |
|
886 | + $this->charset = strtolower((string) $charset); |
|
887 | 887 | } |
888 | 888 | |
889 | 889 | /** |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | $count = 0; |
1025 | 1025 | foreach ($iterator as $file) { |
1026 | 1026 | if ($file->isFile() && $file->getCTime() < $expired) { |
1027 | - $count += unlink((string)$file) ? 1 : 0; |
|
1027 | + $count += unlink((string) $file) ? 1 : 0; |
|
1028 | 1028 | } |
1029 | 1029 | } |
1030 | 1030 | |
@@ -1254,7 +1254,7 @@ discard block |
||
1254 | 1254 | if (isset($this->plugins[$type])) { |
1255 | 1255 | $type = $this->plugins[$type]['class']; |
1256 | 1256 | } else { |
1257 | - $type = self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin_' . str_replace(self::NAMESPACE_PLUGINS_BLOCKS.'Plugin', |
|
1257 | + $type = self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin_' . str_replace(self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin', |
|
1258 | 1258 | '', $type); |
1259 | 1259 | } |
1260 | 1260 | |
@@ -1447,7 +1447,7 @@ discard block |
||
1447 | 1447 | $tree = $this->scopeTree; |
1448 | 1448 | $cur = $this->data; |
1449 | 1449 | |
1450 | - while ($parentLevels -- !== 0) { |
|
1450 | + while ($parentLevels-- !== 0) { |
|
1451 | 1451 | array_pop($tree); |
1452 | 1452 | } |
1453 | 1453 |
@@ -592,8 +592,7 @@ |
||
592 | 592 | if (!class_exists($class) && !function_exists($class)) { |
593 | 593 | try { |
594 | 594 | $this->getLoader()->loadPlugin($callback); |
595 | - } |
|
596 | - catch (Exception $e) { |
|
595 | + } catch (Exception $e) { |
|
597 | 596 | if (strstr($callback, self::NAMESPACE_PLUGINS_FILTERS)) { |
598 | 597 | throw new Exception('Wrong filter name : ' . $callback . ', the "Filter" prefix should not be used, please only use "' . str_replace('Filter', '', $callback) . '"'); |
599 | 598 | } else { |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | // gets foreach id |
105 | - $cnt = self::$cnt ++; |
|
105 | + $cnt = self::$cnt++; |
|
106 | 106 | |
107 | 107 | // builds pre processing output for |
108 | 108 | $out = Compiler::PHP_OPEN . "\n" . '$_for' . $cnt . '_from = ' . $from . ';' . "\n" . '$_for' . $cnt . '_to = ' . $to . ';' . "\n" . '$_for' . $cnt . '_step = abs(' . $step . ');' . "\n" . 'if (is_numeric($_for' . $cnt . '_from) && !is_numeric($_for' . $cnt . '_to)) { $this->triggerError(\'For requires the <em>to</em> parameter when using a numerical <em>from</em>\'); }' . "\n" . '$tmp_shows = $this->isArray($_for' . $cnt . '_from, true) || (is_numeric($_for' . $cnt . '_from) && (abs(($_for' . $cnt . '_from - $_for' . $cnt . '_to)/$_for' . $cnt . '_step) !== 0 || $_for' . $cnt . '_from == $_for' . $cnt . '_to));'; |
@@ -143,8 +143,8 @@ discard block |
||
143 | 143 | $incrementer = '+'; |
144 | 144 | |
145 | 145 | if (preg_match('{^(["\']?)([0-9]+)\1$}', $from, $mN1) && preg_match('{^(["\']?)([0-9]+)\1$}', $to, $mN2)) { |
146 | - $from = (int)$mN1[2]; |
|
147 | - $to = (int)$mN2[2]; |
|
146 | + $from = (int) $mN1[2]; |
|
147 | + $to = (int) $mN2[2]; |
|
148 | 148 | if ($from > $to) { |
149 | 149 | $reverse = true; |
150 | 150 | $condition = '>='; |
@@ -54,7 +54,7 @@ |
||
54 | 54 | public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) |
55 | 55 | { |
56 | 56 | $params = $compiler->getCompiledParams($params); |
57 | - switch (strtolower(trim((string)$params['enabled'], '"\''))) { |
|
57 | + switch (strtolower(trim((string) $params['enabled'], '"\''))) { |
|
58 | 58 | |
59 | 59 | case 'on': |
60 | 60 | case 'true': |