@@ -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 | } |
@@ -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 { |
@@ -769,13 +769,13 @@ discard block |
||
769 | 769 | $search = array('{<\?.*?\?>}', '{<%.*?%>}'); |
770 | 770 | } |
771 | 771 | switch ($this->securityPolicy->getPhpHandling()) { |
772 | - case SecurityPolicy::PHP_ALLOW: |
|
773 | - break; |
|
774 | - case SecurityPolicy::PHP_ENCODE: |
|
775 | - $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl); |
|
776 | - break; |
|
777 | - case SecurityPolicy::PHP_REMOVE: |
|
778 | - $tpl = preg_replace($search, '', $tpl); |
|
772 | + case SecurityPolicy::PHP_ALLOW: |
|
773 | + break; |
|
774 | + case SecurityPolicy::PHP_ENCODE: |
|
775 | + $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl); |
|
776 | + break; |
|
777 | + case SecurityPolicy::PHP_REMOVE: |
|
778 | + $tpl = preg_replace($search, '', $tpl); |
|
779 | 779 | } |
780 | 780 | } |
781 | 781 | } |
@@ -875,51 +875,51 @@ discard block |
||
875 | 875 | } |
876 | 876 | |
877 | 877 | switch ($type) { |
878 | - case Core::CLASS_PLUGIN: |
|
879 | - case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN: |
|
880 | - if (class_exists('Plugin' . $plugin) !== false) { |
|
881 | - $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". |
|
882 | - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
883 | - } else { |
|
884 | - $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)". |
|
885 | - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
886 | - } |
|
887 | - break; |
|
888 | - case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN: |
|
889 | - if (class_exists('Plugin' . $plugin) !== false) { |
|
890 | - $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". |
|
891 | - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
892 | - } else { |
|
893 | - $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". |
|
894 | - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
895 | - } |
|
896 | - break; |
|
897 | - case Core::FUNC_PLUGIN: |
|
898 | - if (function_exists('Plugin' . $plugin) !== false) { |
|
899 | - $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)". |
|
878 | + case Core::CLASS_PLUGIN: |
|
879 | + case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN: |
|
880 | + if (class_exists('Plugin' . $plugin) !== false) { |
|
881 | + $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". |
|
882 | + "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
883 | + } else { |
|
884 | + $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)". |
|
885 | + "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
886 | + } |
|
887 | + break; |
|
888 | + case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN: |
|
889 | + if (class_exists('Plugin' . $plugin) !== false) { |
|
890 | + $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". |
|
900 | 891 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
901 | - } else { |
|
902 | - $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". |
|
892 | + } else { |
|
893 | + $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". |
|
903 | 894 | "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
904 | - } |
|
905 | - break; |
|
906 | - case Core::SMARTY_MODIFIER: |
|
907 | - $output .= "if (function_exists('smarty_modifier_$plugin')===false)". |
|
908 | - "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
|
909 | - break; |
|
910 | - case Core::SMARTY_FUNCTION: |
|
911 | - $output .= "if (function_exists('smarty_function_$plugin')===false)". |
|
912 | - "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
|
913 | - break; |
|
914 | - case Core::SMARTY_BLOCK: |
|
915 | - $output .= "if (function_exists('smarty_block_$plugin')===false)". |
|
916 | - "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
|
917 | - break; |
|
918 | - case Core::PROXY_PLUGIN: |
|
919 | - $output .= $this->getCore()->getPluginProxy()->getLoader($plugin); |
|
920 | - break; |
|
921 | - default: |
|
922 | - throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type); |
|
895 | + } |
|
896 | + break; |
|
897 | + case Core::FUNC_PLUGIN: |
|
898 | + if (function_exists('Plugin' . $plugin) !== false) { |
|
899 | + $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)". |
|
900 | + "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
901 | + } else { |
|
902 | + $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". |
|
903 | + "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; |
|
904 | + } |
|
905 | + break; |
|
906 | + case Core::SMARTY_MODIFIER: |
|
907 | + $output .= "if (function_exists('smarty_modifier_$plugin')===false)". |
|
908 | + "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
|
909 | + break; |
|
910 | + case Core::SMARTY_FUNCTION: |
|
911 | + $output .= "if (function_exists('smarty_function_$plugin')===false)". |
|
912 | + "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
|
913 | + break; |
|
914 | + case Core::SMARTY_BLOCK: |
|
915 | + $output .= "if (function_exists('smarty_block_$plugin')===false)". |
|
916 | + "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; |
|
917 | + break; |
|
918 | + case Core::PROXY_PLUGIN: |
|
919 | + $output .= $this->getCore()->getPluginProxy()->getLoader($plugin); |
|
920 | + break; |
|
921 | + default: |
|
922 | + throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 |
@@ -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)) { |