@@ -99,10 +99,11 @@ |
||
| 99 | 99 | $objects = scandir($dir); |
| 100 | 100 | foreach ($objects as $object) { |
| 101 | 101 | if ($object != "." && $object != "..") { |
| 102 | - if (is_dir($dir."/".$object)) |
|
| 103 | - $this->rrmdir($dir."/".$object, $cache_dir); |
|
| 104 | - else |
|
| 105 | - unlink($dir."/".$object); |
|
| 102 | + if (is_dir($dir."/".$object)) { |
|
| 103 | + $this->rrmdir($dir."/".$object, $cache_dir); |
|
| 104 | + } else { |
|
| 105 | + unlink($dir."/".$object); |
|
| 106 | + } |
|
| 106 | 107 | } |
| 107 | 108 | } |
| 108 | 109 | |
@@ -154,7 +154,9 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // if $http_accept_language was left out, read it from the HTTP-Header |
| 157 | - if ($http_accept_language == "auto") $http_accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
|
| 157 | + if ($http_accept_language == "auto") { |
|
| 158 | + $http_accept_language = $_SERVER['HTTP_ACCEPT_LANGUAGE']; |
|
| 159 | + } |
|
| 158 | 160 | |
| 159 | 161 | // standard for HTTP_ACCEPT_LANGUAGE is defined under |
| 160 | 162 | // http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 |
@@ -178,10 +180,13 @@ discard block |
||
| 178 | 180 | if (!empty($arr[3])) { |
| 179 | 181 | $langrange = strtolower ($arr[3]); |
| 180 | 182 | $language = $langprefix . "-" . $langrange; |
| 183 | + } else { |
|
| 184 | + $language = $langprefix; |
|
| 181 | 185 | } |
| 182 | - else $language = $langprefix; |
|
| 183 | 186 | $qvalue = 1.0; |
| 184 | - if (!empty($arr[5])) $qvalue = floatval($arr[5]); |
|
| 187 | + if (!empty($arr[5])) { |
|
| 188 | + $qvalue = floatval($arr[5]); |
|
| 189 | + } |
|
| 185 | 190 | |
| 186 | 191 | // find q-maximal language |
| 187 | 192 | if (in_array($language,$available_languages) && ($qvalue > $bestqval)) { |
@@ -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)) { |
@@ -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 { |
@@ -64,8 +64,7 @@ |
||
| 64 | 64 | $compiler->findBlock('dynamic'); |
| 65 | 65 | |
| 66 | 66 | return $content; |
| 67 | - } |
|
| 68 | - catch (CompilationException $e) { |
|
| 67 | + } catch (CompilationException $e) { |
|
| 69 | 68 | } |
| 70 | 69 | $output = Compiler::PHP_OPEN . 'if($doCache) {' . "\n\t" . 'echo \'<dwoo:dynamic_\'.$dynamicId.\'>' . str_replace('\'', '\\\'', $content) . '</dwoo:dynamic_\'.$dynamicId.\'>\';' . "\n} else {\n\t"; |
| 71 | 70 | if (substr($content, 0, strlen(Compiler::PHP_OPEN)) == Compiler::PHP_OPEN) { |
@@ -66,11 +66,9 @@ |
||
| 66 | 66 | |
| 67 | 67 | try { |
| 68 | 68 | $include = $this->core->templateFactory($resource, $identifier, $cache_time, $cache_id, $compile_id); |
| 69 | - } |
|
| 70 | - catch (SecurityException $e) { |
|
| 69 | + } catch (SecurityException $e) { |
|
| 71 | 70 | $this->core->triggerError('Include : Security restriction : ' . $e->getMessage(), E_USER_WARNING); |
| 72 | - } |
|
| 73 | - catch (Exception $e) { |
|
| 71 | + } catch (Exception $e) { |
|
| 74 | 72 | $this->core->triggerError('Include : ' . $e->getMessage(), E_USER_WARNING); |
| 75 | 73 | } |
| 76 | 74 | |
@@ -95,11 +95,9 @@ |
||
| 95 | 95 | |
| 96 | 96 | try { |
| 97 | 97 | $parent = $compiler->getCore()->templateFactory($resource, $identifier, null, null, null, $curTpl); |
| 98 | - } |
|
| 99 | - catch (SecurityException $e) { |
|
| 98 | + } catch (SecurityException $e) { |
|
| 100 | 99 | throw new CompilationException($compiler, 'Extends : Security restriction : ' . $e->getMessage()); |
| 101 | - } |
|
| 102 | - catch (Exception $e) { |
|
| 100 | + } catch (Exception $e) { |
|
| 103 | 101 | throw new CompilationException($compiler, 'Extends : ' . $e->getMessage()); |
| 104 | 102 | } |
| 105 | 103 | |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | if (!class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf')) { |
| 51 | 51 | try { |
| 52 | 52 | $compiler->getCore()->getLoader()->loadPlugin('if'); |
| 53 | - } |
|
| 54 | - catch (Exception $e) { |
|
| 53 | + } catch (Exception $e) { |
|
| 55 | 54 | throw new CompilationException($compiler, 'Tif: the if plugin is required to use Tif'); |
| 56 | 55 | } |
| 57 | 56 | } |
@@ -213,8 +213,7 @@ discard block |
||
| 213 | 213 | $CurrentBlock = $Block; |
| 214 | 214 | |
| 215 | 215 | continue; |
| 216 | - } |
|
| 217 | - else |
|
| 216 | + } else |
|
| 218 | 217 | { |
| 219 | 218 | if ($this->isBlockCompletable($CurrentBlock['type'])) |
| 220 | 219 | { |
@@ -273,8 +272,7 @@ discard block |
||
| 273 | 272 | if (isset($CurrentBlock) and ! isset($CurrentBlock['type']) and ! isset($CurrentBlock['interrupted'])) |
| 274 | 273 | { |
| 275 | 274 | $CurrentBlock['element']['text'] .= "\n".$text; |
| 276 | - } |
|
| 277 | - else |
|
| 275 | + } else |
|
| 278 | 276 | { |
| 279 | 277 | $Blocks []= $CurrentBlock; |
| 280 | 278 | |
@@ -765,8 +763,7 @@ discard block |
||
| 765 | 763 | |
| 766 | 764 | $Block['void'] = true; |
| 767 | 765 | } |
| 768 | - } |
|
| 769 | - else |
|
| 766 | + } else |
|
| 770 | 767 | { |
| 771 | 768 | if (isset($matches[2]) or in_array($matches[1], $this->voidElements)) |
| 772 | 769 | { |
@@ -790,18 +787,21 @@ discard block |
||
| 790 | 787 | return; |
| 791 | 788 | } |
| 792 | 789 | |
| 793 | - if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) # open |
|
| 790 | + if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { |
|
| 791 | + # open |
|
| 794 | 792 | { |
| 795 | 793 | $Block['depth'] ++; |
| 796 | 794 | } |
| 795 | + } |
|
| 797 | 796 | |
| 798 | - if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) # close |
|
| 797 | + if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { |
|
| 798 | + # close |
|
| 799 | 799 | { |
| 800 | 800 | if ($Block['depth'] > 0) |
| 801 | 801 | { |
| 802 | 802 | $Block['depth'] --; |
| 803 | - } |
|
| 804 | - else |
|
| 803 | + } |
|
| 804 | + } else |
|
| 805 | 805 | { |
| 806 | 806 | $Block['closed'] = true; |
| 807 | 807 | } |
@@ -1191,12 +1191,10 @@ discard block |
||
| 1191 | 1191 | if ($Excerpt['text'][1] === $marker and preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) |
| 1192 | 1192 | { |
| 1193 | 1193 | $emphasis = 'strong'; |
| 1194 | - } |
|
| 1195 | - elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1194 | + } elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) |
|
| 1196 | 1195 | { |
| 1197 | 1196 | $emphasis = 'em'; |
| 1198 | - } |
|
| 1199 | - else |
|
| 1197 | + } else |
|
| 1200 | 1198 | { |
| 1201 | 1199 | return; |
| 1202 | 1200 | } |
@@ -1280,8 +1278,7 @@ discard block |
||
| 1280 | 1278 | $extent += strlen($matches[0]); |
| 1281 | 1279 | |
| 1282 | 1280 | $remainder = substr($remainder, $extent); |
| 1283 | - } |
|
| 1284 | - else |
|
| 1281 | + } else |
|
| 1285 | 1282 | { |
| 1286 | 1283 | return; |
| 1287 | 1284 | } |
@@ -1296,8 +1293,7 @@ discard block |
||
| 1296 | 1293 | } |
| 1297 | 1294 | |
| 1298 | 1295 | $extent += strlen($matches[0]); |
| 1299 | - } |
|
| 1300 | - else |
|
| 1296 | + } else |
|
| 1301 | 1297 | { |
| 1302 | 1298 | if (preg_match('/^\s*\[(.*?)\]/', $remainder, $matches)) |
| 1303 | 1299 | { |
@@ -1305,8 +1301,7 @@ discard block |
||
| 1305 | 1301 | $definition = strtolower($definition); |
| 1306 | 1302 | |
| 1307 | 1303 | $extent += strlen($matches[0]); |
| 1308 | - } |
|
| 1309 | - else |
|
| 1304 | + } else |
|
| 1310 | 1305 | { |
| 1311 | 1306 | $definition = strtolower($Element['text']); |
| 1312 | 1307 | } |
@@ -1454,8 +1449,7 @@ discard block |
||
| 1454 | 1449 | if ($this->breaksEnabled) |
| 1455 | 1450 | { |
| 1456 | 1451 | $text = preg_replace('/[ ]*\n/', "<br />\n", $text); |
| 1457 | - } |
|
| 1458 | - else |
|
| 1452 | + } else |
|
| 1459 | 1453 | { |
| 1460 | 1454 | $text = preg_replace('/(?:[ ][ ]+|[ ]*\\\\)\n/', "<br />\n", $text); |
| 1461 | 1455 | $text = str_replace(" \n", "\n", $text); |
@@ -1502,15 +1496,13 @@ discard block |
||
| 1502 | 1496 | if (isset($Element['handler'])) |
| 1503 | 1497 | { |
| 1504 | 1498 | $markup .= $this->{$Element['handler']}($Element['text'], $Element['nonNestables']); |
| 1505 | - } |
|
| 1506 | - else |
|
| 1499 | + } else |
|
| 1507 | 1500 | { |
| 1508 | 1501 | $markup .= self::escape($Element['text'], true); |
| 1509 | 1502 | } |
| 1510 | 1503 | |
| 1511 | 1504 | $markup .= '</'.$Element['name'].'>'; |
| 1512 | - } |
|
| 1513 | - else |
|
| 1505 | + } else |
|
| 1514 | 1506 | { |
| 1515 | 1507 | $markup .= ' />'; |
| 1516 | 1508 | } |
@@ -1628,8 +1620,7 @@ discard block |
||
| 1628 | 1620 | if ($len > strlen($string)) |
| 1629 | 1621 | { |
| 1630 | 1622 | return false; |
| 1631 | - } |
|
| 1632 | - else |
|
| 1623 | + } else |
|
| 1633 | 1624 | { |
| 1634 | 1625 | return strtolower(substr($string, 0, $len)) === strtolower($needle); |
| 1635 | 1626 | } |