Completed
Push — developer ( 7f46f3...3f66fa )
by Błażej
134:52 queued 72:56
created
libraries/Smarty/libs/sysplugins/smarty_internal_method_mustcompile.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -11,41 +11,41 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_MustCompile
13 13
 {
14
-    /**
15
-     * Valid for template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 2;
14
+	/**
15
+	 * Valid for template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 2;
20 20
 
21
-    /**
22
-     * Returns if the current template must be compiled by the Smarty compiler
23
-     * It does compare the timestamps of template source and the compiled templates and checks the force compile
24
-     * configuration
25
-     *
26
-     * @param \Smarty_Internal_Template $_template
27
-     *
28
-     * @return bool
29
-     * @throws \SmartyException
30
-     */
31
-    public function mustCompile(Smarty_Internal_Template $_template)
32
-    {
33
-        if (!$_template->source->exists) {
34
-            if (isset($_template->parent) && $_template->parent->_objType == 2) {
35
-                $parent_resource = " in '$_template->parent->template_resource}'";
36
-            } else {
37
-                $parent_resource = '';
38
-            }
39
-            throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
40
-        }
41
-        if ($_template->mustCompile === null) {
42
-            $_template->mustCompile = (!$_template->source->handler->uncompiled &&
43
-                                       ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
44
-                                        !$_template->compiled->exists || ($_template->smarty->compile_check &&
45
-                                                                          $_template->compiled->getTimeStamp() <
46
-                                                                          $_template->source->getTimeStamp())));
47
-        }
21
+	/**
22
+	 * Returns if the current template must be compiled by the Smarty compiler
23
+	 * It does compare the timestamps of template source and the compiled templates and checks the force compile
24
+	 * configuration
25
+	 *
26
+	 * @param \Smarty_Internal_Template $_template
27
+	 *
28
+	 * @return bool
29
+	 * @throws \SmartyException
30
+	 */
31
+	public function mustCompile(Smarty_Internal_Template $_template)
32
+	{
33
+		if (!$_template->source->exists) {
34
+			if (isset($_template->parent) && $_template->parent->_objType == 2) {
35
+				$parent_resource = " in '$_template->parent->template_resource}'";
36
+			} else {
37
+				$parent_resource = '';
38
+			}
39
+			throw new SmartyException("Unable to load template {$_template->source->type} '{$_template->source->name}'{$parent_resource}");
40
+		}
41
+		if ($_template->mustCompile === null) {
42
+			$_template->mustCompile = (!$_template->source->handler->uncompiled &&
43
+									   ($_template->smarty->force_compile || $_template->source->handler->recompiled ||
44
+										!$_template->compiled->exists || ($_template->smarty->compile_check &&
45
+																		  $_template->compiled->getTimeStamp() <
46
+																		  $_template->source->getTimeStamp())));
47
+		}
48 48
 
49
-        return $_template->mustCompile;
50
-    }
49
+		return $_template->mustCompile;
50
+	}
51 51
 }
52 52
\ No newline at end of file
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_compile_private_modifier.php 2 patches
Indentation   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -17,141 +17,141 @@
 block discarded – undo
17 17
  */
18 18
 class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
19 19
 {
20
-    /**
21
-     * Compiles code for modifier execution
22
-     *
23
-     * @param  array                                $args      array with attributes from parser
24
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
25
-     * @param  array                                $parameter array with compilation parameter
26
-     *
27
-     * @return string compiled code
28
-     * @throws \SmartyCompilerException
29
-     */
30
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
31
-    {
32
-        // check and get attributes
33
-        $_attr = $this->getAttributes($compiler, $args);
34
-        $output = $parameter[ 'value' ];
35
-        // loop over list of modifiers
36
-        foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
37
-            $modifier = $single_modifier[ 0 ];
38
-            $single_modifier[ 0 ] = $output;
39
-            $params = implode(',', $single_modifier);
40
-            // check if we know already the type of modifier
41
-            if (isset($compiler->known_modifier_type[ $modifier ])) {
42
-                $modifier_types = array($compiler->known_modifier_type[ $modifier ]);
43
-            } else {
44
-                $modifier_types = array(1, 2, 3, 4, 5, 6);
45
-            }
46
-            foreach ($modifier_types as $type) {
47
-                switch ($type) {
48
-                    case 1:
49
-                        // registered modifier
50
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
51
-                            $function =
52
-                                $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
53
-                            if (!is_array($function)) {
54
-                                $output = "{$function}({$params})";
55
-                            } else {
56
-                                if (is_object($function[ 0 ])) {
57
-                                    $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
58
-                                              $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
59
-                                } else {
60
-                                    $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
61
-                                }
62
-                            }
63
-                            $compiler->known_modifier_type[ $modifier ] = $type;
64
-                            break 2;
65
-                        }
66
-                        break;
67
-                    case 2:
68
-                        // registered modifier compiler
69
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
70
-                            $output =
71
-                                call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
72
-                                               $single_modifier, $compiler->smarty);
73
-                            $compiler->known_modifier_type[ $modifier ] = $type;
74
-                            break 2;
75
-                        }
76
-                        break;
77
-                    case 3:
78
-                        // modifiercompiler plugin
79
-                        if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
80
-                            // check if modifier allowed
81
-                            if (!is_object($compiler->smarty->security_policy) ||
82
-                                $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
83
-                            ) {
84
-                                $plugin = 'smarty_modifiercompiler_' . $modifier;
85
-                                $output = $plugin($single_modifier, $compiler);
86
-                            }
87
-                            $compiler->known_modifier_type[ $modifier ] = $type;
88
-                            break 2;
89
-                        }
90
-                        break;
91
-                    case 4:
92
-                        // modifier plugin
93
-                        if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
94
-                            // check if modifier allowed
95
-                            if (!is_object($compiler->smarty->security_policy) ||
96
-                                $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
97
-                            ) {
98
-                                $output = "{$function}({$params})";
99
-                            }
100
-                            $compiler->known_modifier_type[ $modifier ] = $type;
101
-                            break 2;
102
-                        }
103
-                        break;
104
-                    case 5:
105
-                        // PHP function
106
-                        if (is_callable($modifier)) {
107
-                            // check if modifier allowed
108
-                            if (!is_object($compiler->smarty->security_policy) ||
109
-                                $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
110
-                            ) {
111
-                                $output = "{$modifier}({$params})";
112
-                            }
113
-                            $compiler->known_modifier_type[ $modifier ] = $type;
114
-                            break 2;
115
-                        }
116
-                        break;
117
-                    case 6:
118
-                        // default plugin handler
119
-                        if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
120
-                            (is_callable($compiler->smarty->default_plugin_handler_func) &&
121
-                             $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
122
-                        ) {
123
-                            $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
124
-                            // check if modifier allowed
125
-                            if (!is_object($compiler->smarty->security_policy) ||
126
-                                $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
127
-                            ) {
128
-                                if (!is_array($function)) {
129
-                                    $output = "{$function}({$params})";
130
-                                } else {
131
-                                    if (is_object($function[ 0 ])) {
132
-                                        $output =  $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')';
133
-                                    } else {
134
-                                        $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
135
-                                    }
136
-                                }
137
-                            }
138
-                            if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
139
-                                isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
140
-                            ) {
141
-                                // was a plugin
142
-                                $compiler->known_modifier_type[ $modifier ] = 4;
143
-                            } else {
144
-                                $compiler->known_modifier_type[ $modifier ] = $type;
145
-                            }
146
-                            break 2;
147
-                        }
148
-                }
149
-            }
150
-            if (!isset($compiler->known_modifier_type[ $modifier ])) {
151
-                $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
152
-            }
153
-        }
20
+	/**
21
+	 * Compiles code for modifier execution
22
+	 *
23
+	 * @param  array                                $args      array with attributes from parser
24
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
25
+	 * @param  array                                $parameter array with compilation parameter
26
+	 *
27
+	 * @return string compiled code
28
+	 * @throws \SmartyCompilerException
29
+	 */
30
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
31
+	{
32
+		// check and get attributes
33
+		$_attr = $this->getAttributes($compiler, $args);
34
+		$output = $parameter[ 'value' ];
35
+		// loop over list of modifiers
36
+		foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
37
+			$modifier = $single_modifier[ 0 ];
38
+			$single_modifier[ 0 ] = $output;
39
+			$params = implode(',', $single_modifier);
40
+			// check if we know already the type of modifier
41
+			if (isset($compiler->known_modifier_type[ $modifier ])) {
42
+				$modifier_types = array($compiler->known_modifier_type[ $modifier ]);
43
+			} else {
44
+				$modifier_types = array(1, 2, 3, 4, 5, 6);
45
+			}
46
+			foreach ($modifier_types as $type) {
47
+				switch ($type) {
48
+					case 1:
49
+						// registered modifier
50
+						if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
51
+							$function =
52
+								$compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
53
+							if (!is_array($function)) {
54
+								$output = "{$function}({$params})";
55
+							} else {
56
+								if (is_object($function[ 0 ])) {
57
+									$output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
58
+											  $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
59
+								} else {
60
+									$output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
61
+								}
62
+							}
63
+							$compiler->known_modifier_type[ $modifier ] = $type;
64
+							break 2;
65
+						}
66
+						break;
67
+					case 2:
68
+						// registered modifier compiler
69
+						if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
70
+							$output =
71
+								call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
72
+											   $single_modifier, $compiler->smarty);
73
+							$compiler->known_modifier_type[ $modifier ] = $type;
74
+							break 2;
75
+						}
76
+						break;
77
+					case 3:
78
+						// modifiercompiler plugin
79
+						if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
80
+							// check if modifier allowed
81
+							if (!is_object($compiler->smarty->security_policy) ||
82
+								$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
83
+							) {
84
+								$plugin = 'smarty_modifiercompiler_' . $modifier;
85
+								$output = $plugin($single_modifier, $compiler);
86
+							}
87
+							$compiler->known_modifier_type[ $modifier ] = $type;
88
+							break 2;
89
+						}
90
+						break;
91
+					case 4:
92
+						// modifier plugin
93
+						if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
94
+							// check if modifier allowed
95
+							if (!is_object($compiler->smarty->security_policy) ||
96
+								$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
97
+							) {
98
+								$output = "{$function}({$params})";
99
+							}
100
+							$compiler->known_modifier_type[ $modifier ] = $type;
101
+							break 2;
102
+						}
103
+						break;
104
+					case 5:
105
+						// PHP function
106
+						if (is_callable($modifier)) {
107
+							// check if modifier allowed
108
+							if (!is_object($compiler->smarty->security_policy) ||
109
+								$compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)
110
+							) {
111
+								$output = "{$modifier}({$params})";
112
+							}
113
+							$compiler->known_modifier_type[ $modifier ] = $type;
114
+							break 2;
115
+						}
116
+						break;
117
+					case 6:
118
+						// default plugin handler
119
+						if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
120
+							(is_callable($compiler->smarty->default_plugin_handler_func) &&
121
+							 $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
122
+						) {
123
+							$function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
124
+							// check if modifier allowed
125
+							if (!is_object($compiler->smarty->security_policy) ||
126
+								$compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
127
+							) {
128
+								if (!is_array($function)) {
129
+									$output = "{$function}({$params})";
130
+								} else {
131
+									if (is_object($function[ 0 ])) {
132
+										$output =  $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')';
133
+									} else {
134
+										$output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
135
+									}
136
+								}
137
+							}
138
+							if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
139
+								isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
140
+							) {
141
+								// was a plugin
142
+								$compiler->known_modifier_type[ $modifier ] = 4;
143
+							} else {
144
+								$compiler->known_modifier_type[ $modifier ] = $type;
145
+							}
146
+							break 2;
147
+						}
148
+				}
149
+			}
150
+			if (!isset($compiler->known_modifier_type[ $modifier ])) {
151
+				$compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
152
+			}
153
+		}
154 154
 
155
-        return $output;
156
-    }
155
+		return $output;
156
+	}
157 157
 }
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
     {
32 32
         // check and get attributes
33 33
         $_attr = $this->getAttributes($compiler, $args);
34
-        $output = $parameter[ 'value' ];
34
+        $output = $parameter['value'];
35 35
         // loop over list of modifiers
36
-        foreach ($parameter[ 'modifierlist' ] as $single_modifier) {
37
-            $modifier = $single_modifier[ 0 ];
38
-            $single_modifier[ 0 ] = $output;
36
+        foreach ($parameter['modifierlist'] as $single_modifier) {
37
+            $modifier = $single_modifier[0];
38
+            $single_modifier[0] = $output;
39 39
             $params = implode(',', $single_modifier);
40 40
             // check if we know already the type of modifier
41
-            if (isset($compiler->known_modifier_type[ $modifier ])) {
42
-                $modifier_types = array($compiler->known_modifier_type[ $modifier ]);
41
+            if (isset($compiler->known_modifier_type[$modifier])) {
42
+                $modifier_types = array($compiler->known_modifier_type[$modifier]);
43 43
             } else {
44 44
                 $modifier_types = array(1, 2, 3, 4, 5, 6);
45 45
             }
@@ -47,30 +47,30 @@  discard block
 block discarded – undo
47 47
                 switch ($type) {
48 48
                     case 1:
49 49
                         // registered modifier
50
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ])) {
50
+                        if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {
51 51
                             $function =
52
-                                $compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
52
+                                $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
53 53
                             if (!is_array($function)) {
54 54
                                 $output = "{$function}({$params})";
55 55
                             } else {
56
-                                if (is_object($function[ 0 ])) {
56
+                                if (is_object($function[0])) {
57 57
                                     $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' .
58
-                                              $modifier . '\'][0][0]->' . $function[ 1 ] . '(' . $params . ')';
58
+                                              $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
59 59
                                 } else {
60
-                                    $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
60
+                                    $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
61 61
                                 }
62 62
                             }
63
-                            $compiler->known_modifier_type[ $modifier ] = $type;
63
+                            $compiler->known_modifier_type[$modifier] = $type;
64 64
                             break 2;
65 65
                         }
66 66
                         break;
67 67
                     case 2:
68 68
                         // registered modifier compiler
69
-                        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ])) {
69
+                        if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {
70 70
                             $output =
71
-                                call_user_func($compiler->smarty->registered_plugins[ Smarty::PLUGIN_MODIFIERCOMPILER ][ $modifier ][ 0 ],
71
+                                call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0],
72 72
                                                $single_modifier, $compiler->smarty);
73
-                            $compiler->known_modifier_type[ $modifier ] = $type;
73
+                            $compiler->known_modifier_type[$modifier] = $type;
74 74
                             break 2;
75 75
                         }
76 76
                         break;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                                 $plugin = 'smarty_modifiercompiler_' . $modifier;
85 85
                                 $output = $plugin($single_modifier, $compiler);
86 86
                             }
87
-                            $compiler->known_modifier_type[ $modifier ] = $type;
87
+                            $compiler->known_modifier_type[$modifier] = $type;
88 88
                             break 2;
89 89
                         }
90 90
                         break;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                             ) {
98 98
                                 $output = "{$function}({$params})";
99 99
                             }
100
-                            $compiler->known_modifier_type[ $modifier ] = $type;
100
+                            $compiler->known_modifier_type[$modifier] = $type;
101 101
                             break 2;
102 102
                         }
103 103
                         break;
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
                             ) {
111 111
                                 $output = "{$modifier}({$params})";
112 112
                             }
113
-                            $compiler->known_modifier_type[ $modifier ] = $type;
113
+                            $compiler->known_modifier_type[$modifier] = $type;
114 114
                             break 2;
115 115
                         }
116 116
                         break;
117 117
                     case 6:
118 118
                         // default plugin handler
119
-                        if (isset($compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ]) ||
119
+                        if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) ||
120 120
                             (is_callable($compiler->smarty->default_plugin_handler_func) &&
121 121
                              $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))
122 122
                         ) {
123
-                            $function = $compiler->default_handler_plugins[ Smarty::PLUGIN_MODIFIER ][ $modifier ][ 0 ];
123
+                            $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
124 124
                             // check if modifier allowed
125 125
                             if (!is_object($compiler->smarty->security_policy) ||
126 126
                                 $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)
@@ -128,26 +128,26 @@  discard block
 block discarded – undo
128 128
                                 if (!is_array($function)) {
129 129
                                     $output = "{$function}({$params})";
130 130
                                 } else {
131
-                                    if (is_object($function[ 0 ])) {
132
-                                        $output =  $function[ 0 ] . '->'. $function[ 1 ] . '(' . $params . ')';
131
+                                    if (is_object($function[0])) {
132
+                                        $output = $function[0] . '->' . $function[1] . '(' . $params . ')';
133 133
                                     } else {
134
-                                        $output = $function[ 0 ] . '::' . $function[ 1 ] . '(' . $params . ')';
134
+                                        $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
135 135
                                     }
136 136
                                 }
137 137
                             }
138
-                            if (isset($compiler->parent_compiler->template->compiled->required_plugins[ 'nocache' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ]) ||
139
-                                isset($compiler->parent_compiler->template->compiled->required_plugins[ 'compiled' ][ $modifier ][ Smarty::PLUGIN_MODIFIER ][ 'file' ])
138
+                            if (isset($compiler->parent_compiler->template->compiled->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) ||
139
+                                isset($compiler->parent_compiler->template->compiled->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])
140 140
                             ) {
141 141
                                 // was a plugin
142
-                                $compiler->known_modifier_type[ $modifier ] = 4;
142
+                                $compiler->known_modifier_type[$modifier] = 4;
143 143
                             } else {
144
-                                $compiler->known_modifier_type[ $modifier ] = $type;
144
+                                $compiler->known_modifier_type[$modifier] = $type;
145 145
                             }
146 146
                             break 2;
147 147
                         }
148 148
                 }
149 149
             }
150
-            if (!isset($compiler->known_modifier_type[ $modifier ])) {
150
+            if (!isset($compiler->known_modifier_type[$modifier])) {
151 151
                 $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", null, true);
152 152
             }
153 153
         }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_resource_registered.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -18,82 +18,82 @@
 block discarded – undo
18 18
  */
19 19
 class Smarty_Internal_Resource_Registered extends Smarty_Resource
20 20
 {
21
-    /**
22
-     * populate Source Object with meta data from Resource
23
-     *
24
-     * @param  Smarty_Template_Source   $source    source object
25
-     * @param  Smarty_Internal_Template $_template template object
26
-     *
27
-     * @return void
28
-     */
29
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
30
-    {
31
-        $source->filepath = $source->type . ':' . $source->name;
32
-        $source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);
33
-        $source->timestamp = $this->getTemplateTimestamp($source);
34
-        $source->exists = !!$source->timestamp;
35
-    }
21
+	/**
22
+	 * populate Source Object with meta data from Resource
23
+	 *
24
+	 * @param  Smarty_Template_Source   $source    source object
25
+	 * @param  Smarty_Internal_Template $_template template object
26
+	 *
27
+	 * @return void
28
+	 */
29
+	public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
30
+	{
31
+		$source->filepath = $source->type . ':' . $source->name;
32
+		$source->uid = sha1($source->filepath . $source->smarty->_joined_template_dir);
33
+		$source->timestamp = $this->getTemplateTimestamp($source);
34
+		$source->exists = !!$source->timestamp;
35
+	}
36 36
 
37
-    /**
38
-     * populate Source Object with timestamp and exists from Resource
39
-     *
40
-     * @param  Smarty_Template_Source $source source object
41
-     *
42
-     * @return void
43
-     */
44
-    public function populateTimestamp(Smarty_Template_Source $source)
45
-    {
46
-        $source->timestamp = $this->getTemplateTimestamp($source);
47
-        $source->exists = !!$source->timestamp;
48
-    }
37
+	/**
38
+	 * populate Source Object with timestamp and exists from Resource
39
+	 *
40
+	 * @param  Smarty_Template_Source $source source object
41
+	 *
42
+	 * @return void
43
+	 */
44
+	public function populateTimestamp(Smarty_Template_Source $source)
45
+	{
46
+		$source->timestamp = $this->getTemplateTimestamp($source);
47
+		$source->exists = !!$source->timestamp;
48
+	}
49 49
 
50
-    /**
51
-     * Get timestamp (epoch) the template source was modified
52
-     *
53
-     * @param  Smarty_Template_Source $source source object
54
-     *
55
-     * @return integer|boolean        timestamp (epoch) the template was modified, false if resources has no timestamp
56
-     */
57
-    public function getTemplateTimestamp(Smarty_Template_Source $source)
58
-    {
59
-        // return timestamp
60
-        $time_stamp = false;
61
-        call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ],
62
-                             array($source->name, &$time_stamp, $source->smarty));
50
+	/**
51
+	 * Get timestamp (epoch) the template source was modified
52
+	 *
53
+	 * @param  Smarty_Template_Source $source source object
54
+	 *
55
+	 * @return integer|boolean        timestamp (epoch) the template was modified, false if resources has no timestamp
56
+	 */
57
+	public function getTemplateTimestamp(Smarty_Template_Source $source)
58
+	{
59
+		// return timestamp
60
+		$time_stamp = false;
61
+		call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ],
62
+							 array($source->name, &$time_stamp, $source->smarty));
63 63
 
64
-        return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;
65
-    }
64
+		return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;
65
+	}
66 66
 
67
-    /**
68
-     * Load template's source by invoking the registered callback into current template object
69
-     *
70
-     * @param  Smarty_Template_Source $source source object
71
-     *
72
-     * @return string                 template source
73
-     * @throws SmartyException        if source cannot be loaded
74
-     */
75
-    public function getContent(Smarty_Template_Source $source)
76
-    {
77
-        // return template string
78
-        $content = null;
79
-        $t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
80
-                                  array($source->name, &$content, $source->smarty));
81
-        if (is_bool($t) && !$t) {
82
-            throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
83
-        }
67
+	/**
68
+	 * Load template's source by invoking the registered callback into current template object
69
+	 *
70
+	 * @param  Smarty_Template_Source $source source object
71
+	 *
72
+	 * @return string                 template source
73
+	 * @throws SmartyException        if source cannot be loaded
74
+	 */
75
+	public function getContent(Smarty_Template_Source $source)
76
+	{
77
+		// return template string
78
+		$content = null;
79
+		$t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
80
+								  array($source->name, &$content, $source->smarty));
81
+		if (is_bool($t) && !$t) {
82
+			throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
83
+		}
84 84
 
85
-        return $content;
86
-    }
85
+		return $content;
86
+	}
87 87
 
88
-    /**
89
-     * Determine basename for compiled filename
90
-     *
91
-     * @param  Smarty_Template_Source $source source object
92
-     *
93
-     * @return string                 resource's basename
94
-     */
95
-    public function getBasename(Smarty_Template_Source $source)
96
-    {
97
-        return basename($source->name);
98
-    }
88
+	/**
89
+	 * Determine basename for compiled filename
90
+	 *
91
+	 * @param  Smarty_Template_Source $source source object
92
+	 *
93
+	 * @return string                 resource's basename
94
+	 */
95
+	public function getBasename(Smarty_Template_Source $source)
96
+	{
97
+		return basename($source->name);
98
+	}
99 99
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         // return timestamp
60 60
         $time_stamp = false;
61
-        call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 1 ],
61
+        call_user_func_array($source->smarty->registered_resources[$source->type][0][1],
62 62
                              array($source->name, &$time_stamp, $source->smarty));
63 63
 
64 64
         return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     {
77 77
         // return template string
78 78
         $content = null;
79
-        $t = call_user_func_array($source->smarty->registered_resources[ $source->type ][ 0 ][ 0 ],
79
+        $t = call_user_func_array($source->smarty->registered_resources[$source->type][0][0],
80 80
                                   array($source->name, &$content, $source->smarty));
81 81
         if (is_bool($t) && !$t) {
82 82
             throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_resource_file.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -17,160 +17,160 @@
 block discarded – undo
17 17
  */
18 18
 class Smarty_Internal_Resource_File extends Smarty_Resource
19 19
 {
20
-    /**
21
-     * build template filepath by traversing the template_dir array
22
-     *
23
-     * @param Smarty_Template_Source    $source    source object
24
-     * @param  Smarty_Internal_Template $_template template object
25
-     *
26
-     * @return string fully qualified filepath
27
-     * @throws SmartyException
28
-     */
29
-    protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
30
-    {
31
-        $file = $source->name;
32
-        // absolute file ?
33
-        if ($file[ 0 ] == '/' || $file[ 1 ] == ':') {
34
-            $file = $source->smarty->_realpath($file, true);
35
-            return is_file($file) ? $file : false;
36
-        }
37
-        // go relative to a given template?
38
-        if ($file[ 0 ] == '.' && $_template && isset($_template->parent) && $_template->parent->_objType == 2 &&
39
-            preg_match('#^[.]{1,2}[\\\/]#', $file)
40
-        ) {
41
-            if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' &&
42
-                !isset($_template->parent->_cache[ 'allow_relative_path' ])
43
-            ) {
44
-                throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
45
-            }
46
-            // normalize path
47
-            $path = $source->smarty->_realpath(dirname($_template->parent->source->filepath) . DS . $file);
48
-            // files relative to a template only get one shot
49
-            return is_file($path) ? $path : false;
50
-        }
51
-        // normalize DS
52
-        if (strpos($file, DS == '/' ? '\\' : '/') !== false) {
53
-            $file = str_replace(DS == '/' ? '\\' : '/', DS, $file);
54
-        }
20
+	/**
21
+	 * build template filepath by traversing the template_dir array
22
+	 *
23
+	 * @param Smarty_Template_Source    $source    source object
24
+	 * @param  Smarty_Internal_Template $_template template object
25
+	 *
26
+	 * @return string fully qualified filepath
27
+	 * @throws SmartyException
28
+	 */
29
+	protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
30
+	{
31
+		$file = $source->name;
32
+		// absolute file ?
33
+		if ($file[ 0 ] == '/' || $file[ 1 ] == ':') {
34
+			$file = $source->smarty->_realpath($file, true);
35
+			return is_file($file) ? $file : false;
36
+		}
37
+		// go relative to a given template?
38
+		if ($file[ 0 ] == '.' && $_template && isset($_template->parent) && $_template->parent->_objType == 2 &&
39
+			preg_match('#^[.]{1,2}[\\\/]#', $file)
40
+		) {
41
+			if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' &&
42
+				!isset($_template->parent->_cache[ 'allow_relative_path' ])
43
+			) {
44
+				throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
45
+			}
46
+			// normalize path
47
+			$path = $source->smarty->_realpath(dirname($_template->parent->source->filepath) . DS . $file);
48
+			// files relative to a template only get one shot
49
+			return is_file($path) ? $path : false;
50
+		}
51
+		// normalize DS
52
+		if (strpos($file, DS == '/' ? '\\' : '/') !== false) {
53
+			$file = str_replace(DS == '/' ? '\\' : '/', DS, $file);
54
+		}
55 55
 
56
-        $_directories = $source->smarty->getTemplateDir(null, $source->isConfig);
57
-        // template_dir index?
58
-        if ($file[ 0 ] == '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) {
59
-            $file = $fileMatch[ 2 ];
60
-            $_indices = explode(',', $fileMatch[ 1 ]);
61
-            $_index_dirs = array();
62
-            foreach ($_indices as $index) {
63
-                $index = trim($index);
64
-                // try string indexes
65
-                if (isset($_directories[ $index ])) {
66
-                    $_index_dirs[] = $_directories[ $index ];
67
-                } elseif (is_numeric($index)) {
68
-                    // try numeric index
69
-                    $index = (int) $index;
70
-                    if (isset($_directories[ $index ])) {
71
-                        $_index_dirs[] = $_directories[ $index ];
72
-                    } else {
73
-                        // try at location index
74
-                        $keys = array_keys($_directories);
75
-                        if (isset($_directories[ $keys[ $index ] ])) {
76
-                            $_index_dirs[] = $_directories[ $keys[ $index ] ];
77
-                        }
78
-                    }
79
-                }
80
-            }
81
-            if (empty($_index_dirs)) {
82
-                // index not found
83
-                return false;
84
-            } else {
85
-                $_directories = $_index_dirs;
86
-            }
87
-        }
56
+		$_directories = $source->smarty->getTemplateDir(null, $source->isConfig);
57
+		// template_dir index?
58
+		if ($file[ 0 ] == '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) {
59
+			$file = $fileMatch[ 2 ];
60
+			$_indices = explode(',', $fileMatch[ 1 ]);
61
+			$_index_dirs = array();
62
+			foreach ($_indices as $index) {
63
+				$index = trim($index);
64
+				// try string indexes
65
+				if (isset($_directories[ $index ])) {
66
+					$_index_dirs[] = $_directories[ $index ];
67
+				} elseif (is_numeric($index)) {
68
+					// try numeric index
69
+					$index = (int) $index;
70
+					if (isset($_directories[ $index ])) {
71
+						$_index_dirs[] = $_directories[ $index ];
72
+					} else {
73
+						// try at location index
74
+						$keys = array_keys($_directories);
75
+						if (isset($_directories[ $keys[ $index ] ])) {
76
+							$_index_dirs[] = $_directories[ $keys[ $index ] ];
77
+						}
78
+					}
79
+				}
80
+			}
81
+			if (empty($_index_dirs)) {
82
+				// index not found
83
+				return false;
84
+			} else {
85
+				$_directories = $_index_dirs;
86
+			}
87
+		}
88 88
 
89
-        // relative file name?
90
-        foreach ($_directories as $_directory) {
91
-            $path = $_directory . $file;
92
-            if (is_file($path)) {
93
-                return (strpos($path, '.' . DS) !== false) ? $source->smarty->_realpath($path) : $path;
94
-            }
95
-        }
96
-        if (!isset($_index_dirs)) {
97
-            // Could be relative to cwd
98
-            $path = $source->smarty->_realpath($file, true);
99
-            if (is_file($path)) {
100
-                return $path;
101
-            }
102
-        }
103
-        // Use include path ?
104
-        if ($source->smarty->use_include_path) {
105
-            return $source->smarty->ext->_getIncludePath->getIncludePath($_directories, $file, $source->smarty);
106
-        }
107
-        return false;
108
-    }
89
+		// relative file name?
90
+		foreach ($_directories as $_directory) {
91
+			$path = $_directory . $file;
92
+			if (is_file($path)) {
93
+				return (strpos($path, '.' . DS) !== false) ? $source->smarty->_realpath($path) : $path;
94
+			}
95
+		}
96
+		if (!isset($_index_dirs)) {
97
+			// Could be relative to cwd
98
+			$path = $source->smarty->_realpath($file, true);
99
+			if (is_file($path)) {
100
+				return $path;
101
+			}
102
+		}
103
+		// Use include path ?
104
+		if ($source->smarty->use_include_path) {
105
+			return $source->smarty->ext->_getIncludePath->getIncludePath($_directories, $file, $source->smarty);
106
+		}
107
+		return false;
108
+	}
109 109
 
110
-    /**
111
-     * populate Source Object with meta data from Resource
112
-     *
113
-     * @param Smarty_Template_Source   $source    source object
114
-     * @param Smarty_Internal_Template $_template template object
115
-     */
116
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
117
-    {
118
-        $source->filepath = $this->buildFilepath($source, $_template);
110
+	/**
111
+	 * populate Source Object with meta data from Resource
112
+	 *
113
+	 * @param Smarty_Template_Source   $source    source object
114
+	 * @param Smarty_Internal_Template $_template template object
115
+	 */
116
+	public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
117
+	{
118
+		$source->filepath = $this->buildFilepath($source, $_template);
119 119
 
120
-        if ($source->filepath !== false) {
121
-            if (isset($source->smarty->security_policy) && is_object($source->smarty->security_policy)) {
122
-                $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
123
-            }
124
-            $source->exists = true;
125
-            $source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
126
-                                    $source->smarty->_joined_template_dir));
127
-            $source->timestamp = filemtime($source->filepath);
128
-        } else {
129
-            $source->timestamp = $source->exists = false;
130
-        }
131
-    }
120
+		if ($source->filepath !== false) {
121
+			if (isset($source->smarty->security_policy) && is_object($source->smarty->security_policy)) {
122
+				$source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
123
+			}
124
+			$source->exists = true;
125
+			$source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
126
+									$source->smarty->_joined_template_dir));
127
+			$source->timestamp = filemtime($source->filepath);
128
+		} else {
129
+			$source->timestamp = $source->exists = false;
130
+		}
131
+	}
132 132
 
133
-    /**
134
-     * populate Source Object with timestamp and exists from Resource
135
-     *
136
-     * @param Smarty_Template_Source $source source object
137
-     */
138
-    public function populateTimestamp(Smarty_Template_Source $source)
139
-    {
140
-        if (!$source->exists) {
141
-            $source->timestamp = $source->exists = is_file($source->filepath);
142
-        }
143
-        if ($source->exists) {
144
-            $source->timestamp = filemtime($source->filepath);
145
-        }
146
-    }
133
+	/**
134
+	 * populate Source Object with timestamp and exists from Resource
135
+	 *
136
+	 * @param Smarty_Template_Source $source source object
137
+	 */
138
+	public function populateTimestamp(Smarty_Template_Source $source)
139
+	{
140
+		if (!$source->exists) {
141
+			$source->timestamp = $source->exists = is_file($source->filepath);
142
+		}
143
+		if ($source->exists) {
144
+			$source->timestamp = filemtime($source->filepath);
145
+		}
146
+	}
147 147
 
148
-    /**
149
-     * Load template's source from file into current template object
150
-     *
151
-     * @param  Smarty_Template_Source $source source object
152
-     *
153
-     * @return string                 template source
154
-     * @throws SmartyException        if source cannot be loaded
155
-     */
156
-    public function getContent(Smarty_Template_Source $source)
157
-    {
158
-        if ($source->exists) {
159
-            return file_get_contents($source->filepath);
160
-        }
161
-        throw new SmartyException('Unable to read ' . ($source->isConfig ? 'config' : 'template') .
162
-                                  " {$source->type} '{$source->name}'");
163
-    }
148
+	/**
149
+	 * Load template's source from file into current template object
150
+	 *
151
+	 * @param  Smarty_Template_Source $source source object
152
+	 *
153
+	 * @return string                 template source
154
+	 * @throws SmartyException        if source cannot be loaded
155
+	 */
156
+	public function getContent(Smarty_Template_Source $source)
157
+	{
158
+		if ($source->exists) {
159
+			return file_get_contents($source->filepath);
160
+		}
161
+		throw new SmartyException('Unable to read ' . ($source->isConfig ? 'config' : 'template') .
162
+								  " {$source->type} '{$source->name}'");
163
+	}
164 164
 
165
-    /**
166
-     * Determine basename for compiled filename
167
-     *
168
-     * @param  Smarty_Template_Source $source source object
169
-     *
170
-     * @return string                 resource's basename
171
-     */
172
-    public function getBasename(Smarty_Template_Source $source)
173
-    {
174
-        return basename($source->filepath);
175
-    }
165
+	/**
166
+	 * Determine basename for compiled filename
167
+	 *
168
+	 * @param  Smarty_Template_Source $source source object
169
+	 *
170
+	 * @return string                 resource's basename
171
+	 */
172
+	public function getBasename(Smarty_Template_Source $source)
173
+	{
174
+		return basename($source->filepath);
175
+	}
176 176
 }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -14 removed lines patch added patch discarded remove patch
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
     {
31 31
         $file = $source->name;
32 32
         // absolute file ?
33
-        if ($file[ 0 ] == '/' || $file[ 1 ] == ':') {
33
+        if ($file[0] == '/' || $file[1] == ':') {
34 34
             $file = $source->smarty->_realpath($file, true);
35 35
             return is_file($file) ? $file : false;
36 36
         }
37 37
         // go relative to a given template?
38
-        if ($file[ 0 ] == '.' && $_template && isset($_template->parent) && $_template->parent->_objType == 2 &&
38
+        if ($file[0] == '.' && $_template && isset($_template->parent) && $_template->parent->_objType == 2 &&
39 39
             preg_match('#^[.]{1,2}[\\\/]#', $file)
40 40
         ) {
41 41
             if ($_template->parent->source->type != 'file' && $_template->parent->source->type != 'extends' &&
42
-                !isset($_template->parent->_cache[ 'allow_relative_path' ])
42
+                !isset($_template->parent->_cache['allow_relative_path'])
43 43
             ) {
44 44
                 throw new SmartyException("Template '{$file}' cannot be relative to template of resource type '{$_template->parent->source->type}'");
45 45
             }
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 
56 56
         $_directories = $source->smarty->getTemplateDir(null, $source->isConfig);
57 57
         // template_dir index?
58
-        if ($file[ 0 ] == '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) {
59
-            $file = $fileMatch[ 2 ];
60
-            $_indices = explode(',', $fileMatch[ 1 ]);
58
+        if ($file[0] == '[' && preg_match('#^\[([^\]]+)\](.+)$#', $file, $fileMatch)) {
59
+            $file = $fileMatch[2];
60
+            $_indices = explode(',', $fileMatch[1]);
61 61
             $_index_dirs = array();
62 62
             foreach ($_indices as $index) {
63 63
                 $index = trim($index);
64 64
                 // try string indexes
65
-                if (isset($_directories[ $index ])) {
66
-                    $_index_dirs[] = $_directories[ $index ];
65
+                if (isset($_directories[$index])) {
66
+                    $_index_dirs[] = $_directories[$index];
67 67
                 } elseif (is_numeric($index)) {
68 68
                     // try numeric index
69 69
                     $index = (int) $index;
70
-                    if (isset($_directories[ $index ])) {
71
-                        $_index_dirs[] = $_directories[ $index ];
70
+                    if (isset($_directories[$index])) {
71
+                        $_index_dirs[] = $_directories[$index];
72 72
                     } else {
73 73
                         // try at location index
74 74
                         $keys = array_keys($_directories);
75
-                        if (isset($_directories[ $keys[ $index ] ])) {
76
-                            $_index_dirs[] = $_directories[ $keys[ $index ] ];
75
+                        if (isset($_directories[$keys[$index]])) {
76
+                            $_index_dirs[] = $_directories[$keys[$index]];
77 77
                         }
78 78
                     }
79 79
                 }
@@ -122,8 +122,7 @@  discard block
 block discarded – undo
122 122
                 $source->smarty->security_policy->isTrustedResourceDir($source->filepath, $source->isConfig);
123 123
             }
124 124
             $source->exists = true;
125
-            $source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir :
126
-                                    $source->smarty->_joined_template_dir));
125
+            $source->uid = sha1($source->filepath . ($source->isConfig ? $source->smarty->_joined_config_dir : $source->smarty->_joined_template_dir));
127 126
             $source->timestamp = filemtime($source->filepath);
128 127
         } else {
129 128
             $source->timestamp = $source->exists = false;
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_compileallconfig.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -12,22 +12,22 @@
 block discarded – undo
12 12
 class Smarty_Internal_Method_CompileAllConfig extends Smarty_Internal_Method_CompileAllTemplates
13 13
 {
14 14
 
15
-    /**
16
-     * Compile all config files
17
-     *
18
-     * @api  Smarty::compileAllConfig()
19
-     *
20
-     * @param \Smarty $smarty        passed smarty object
21
-     * @param  string $extension     file extension
22
-     * @param  bool   $force_compile force all to recompile
23
-     * @param  int    $time_limit
24
-     * @param  int    $max_errors
25
-     *
26
-     * @return int number of template files recompiled
27
-     */
28
-    public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0,
29
-                                     $max_errors = null)
30
-    {
31
-        return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
32
-    }
15
+	/**
16
+	 * Compile all config files
17
+	 *
18
+	 * @api  Smarty::compileAllConfig()
19
+	 *
20
+	 * @param \Smarty $smarty        passed smarty object
21
+	 * @param  string $extension     file extension
22
+	 * @param  bool   $force_compile force all to recompile
23
+	 * @param  int    $time_limit
24
+	 * @param  int    $max_errors
25
+	 *
26
+	 * @return int number of template files recompiled
27
+	 */
28
+	public function compileAllConfig(Smarty $smarty, $extension = '.conf', $force_compile = false, $time_limit = 0,
29
+									 $max_errors = null)
30
+	{
31
+		return $this->compileAll($smarty, $extension, $force_compile, $time_limit, $max_errors, true);
32
+	}
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_extension_clear.php 2 patches
Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -11,116 +11,116 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Extension_Clear
13 13
 {
14
-    /**
15
-     * Empty cache for a specific template
16
-     *
17
-     * @param Smarty  $smarty
18
-     * @param string  $resource_name template name
19
-     * @param string  $cache_id      cache id
20
-     * @param string  $compile_id    compile id
21
-     * @param integer $exp_time      expiration time (number of seconds, not timestamp)
22
-     *
23
-     * @return integer number of cache files deleted
24
-     */
25
-    public static function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
26
-    {
27
-        $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
28
-        $_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
29
-        $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
30
-        $_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
31
-        $_dir = $smarty->getCacheDir();
32
-        if ($_dir == '/') { //We should never want to delete this!
33
-            return 0;
34
-        }
35
-        $_dir_length = strlen($_dir);
36
-        if (isset($_cache_id)) {
37
-            $_cache_id_parts = explode('|', $_cache_id);
38
-            $_cache_id_parts_count = count($_cache_id_parts);
39
-            if ($smarty->use_sub_dirs) {
40
-                foreach ($_cache_id_parts as $id_part) {
41
-                    $_dir .= $id_part . DS;
42
-                }
43
-            }
44
-        }
45
-        if (isset($resource_name)) {
46
-            $_save_stat = $smarty->caching;
47
-            $smarty->caching = true;
48
-            $tpl = new $smarty->template_class($resource_name, $smarty);
49
-            $smarty->caching = $_save_stat;
14
+	/**
15
+	 * Empty cache for a specific template
16
+	 *
17
+	 * @param Smarty  $smarty
18
+	 * @param string  $resource_name template name
19
+	 * @param string  $cache_id      cache id
20
+	 * @param string  $compile_id    compile id
21
+	 * @param integer $exp_time      expiration time (number of seconds, not timestamp)
22
+	 *
23
+	 * @return integer number of cache files deleted
24
+	 */
25
+	public static function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
26
+	{
27
+		$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
28
+		$_compile_id = isset($compile_id) ? preg_replace('![^\w]+!', '_', $compile_id) : null;
29
+		$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
30
+		$_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
31
+		$_dir = $smarty->getCacheDir();
32
+		if ($_dir == '/') { //We should never want to delete this!
33
+			return 0;
34
+		}
35
+		$_dir_length = strlen($_dir);
36
+		if (isset($_cache_id)) {
37
+			$_cache_id_parts = explode('|', $_cache_id);
38
+			$_cache_id_parts_count = count($_cache_id_parts);
39
+			if ($smarty->use_sub_dirs) {
40
+				foreach ($_cache_id_parts as $id_part) {
41
+					$_dir .= $id_part . DS;
42
+				}
43
+			}
44
+		}
45
+		if (isset($resource_name)) {
46
+			$_save_stat = $smarty->caching;
47
+			$smarty->caching = true;
48
+			$tpl = new $smarty->template_class($resource_name, $smarty);
49
+			$smarty->caching = $_save_stat;
50 50
 
51
-            // remove from template cache
52
-            $tpl->source; // have the template registered before unset()
51
+			// remove from template cache
52
+			$tpl->source; // have the template registered before unset()
53 53
 
54
-            if ($tpl->source->exists) {
55
-                $_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));
56
-            } else {
57
-                return 0;
58
-            }
59
-        }
60
-        $_count = 0;
61
-        $_time = time();
62
-        if (file_exists($_dir)) {
63
-            $_cacheDirs = new RecursiveDirectoryIterator($_dir);
64
-            $_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
65
-            foreach ($_cache as $_file) {
66
-                if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
67
-                    continue;
68
-                }
69
-                // directory ?
70
-                if ($_file->isDir()) {
71
-                    if (!$_cache->isDot()) {
72
-                        // delete folder if empty
73
-                        @rmdir($_file->getPathname());
74
-                    }
75
-                } else {
76
-                    $_parts = explode($_dir_sep, str_replace('\\', '/', substr((string) $_file, $_dir_length)));
77
-                    $_parts_count = count($_parts);
78
-                    // check name
79
-                    if (isset($resource_name)) {
80
-                        if ($_parts[ $_parts_count - 1 ] != $_resourcename_parts) {
81
-                            continue;
82
-                        }
83
-                    }
84
-                    // check compile id
85
-                    if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) ||
86
-                                                $_parts[ $_parts_count - 2 - $_compile_id_offset ] != $_compile_id)
87
-                    ) {
88
-                        continue;
89
-                    }
90
-                    // check cache id
91
-                    if (isset($_cache_id)) {
92
-                        // count of cache id parts
93
-                        $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset :
94
-                            $_parts_count - 1 - $_compile_id_offset;
95
-                        if ($_parts_count < $_cache_id_parts_count) {
96
-                            continue;
97
-                        }
98
-                        for ($i = 0; $i < $_cache_id_parts_count; $i ++) {
99
-                            if ($_parts[ $i ] != $_cache_id_parts[ $i ]) {
100
-                                continue 2;
101
-                            }
102
-                        }
103
-                    }
104
-                    // expired ?
105
-                    if (isset($exp_time)) {
106
-                        if ($exp_time < 0) {
107
-                            preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
108
-                            if ($_time < (@filemtime($_file) + $match[ 1 ])) {
109
-                                continue;
110
-                            }
111
-                        } else {
112
-                            if ($_time - @filemtime($_file) < $exp_time) {
113
-                                continue;
114
-                            }
115
-                        }
116
-                    }
117
-                    $_count += @unlink((string) $_file) ? 1 : 0;
118
-                    if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) {
119
-                        opcache_invalidate((string) $_file, true);
120
-                    }
121
-                }
122
-            }
123
-        }
124
-        return $_count;
125
-    }
54
+			if ($tpl->source->exists) {
55
+				$_resourcename_parts = basename(str_replace('^', '/', $tpl->cached->filepath));
56
+			} else {
57
+				return 0;
58
+			}
59
+		}
60
+		$_count = 0;
61
+		$_time = time();
62
+		if (file_exists($_dir)) {
63
+			$_cacheDirs = new RecursiveDirectoryIterator($_dir);
64
+			$_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
65
+			foreach ($_cache as $_file) {
66
+				if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
67
+					continue;
68
+				}
69
+				// directory ?
70
+				if ($_file->isDir()) {
71
+					if (!$_cache->isDot()) {
72
+						// delete folder if empty
73
+						@rmdir($_file->getPathname());
74
+					}
75
+				} else {
76
+					$_parts = explode($_dir_sep, str_replace('\\', '/', substr((string) $_file, $_dir_length)));
77
+					$_parts_count = count($_parts);
78
+					// check name
79
+					if (isset($resource_name)) {
80
+						if ($_parts[ $_parts_count - 1 ] != $_resourcename_parts) {
81
+							continue;
82
+						}
83
+					}
84
+					// check compile id
85
+					if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) ||
86
+												$_parts[ $_parts_count - 2 - $_compile_id_offset ] != $_compile_id)
87
+					) {
88
+						continue;
89
+					}
90
+					// check cache id
91
+					if (isset($_cache_id)) {
92
+						// count of cache id parts
93
+						$_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset :
94
+							$_parts_count - 1 - $_compile_id_offset;
95
+						if ($_parts_count < $_cache_id_parts_count) {
96
+							continue;
97
+						}
98
+						for ($i = 0; $i < $_cache_id_parts_count; $i ++) {
99
+							if ($_parts[ $i ] != $_cache_id_parts[ $i ]) {
100
+								continue 2;
101
+							}
102
+						}
103
+					}
104
+					// expired ?
105
+					if (isset($exp_time)) {
106
+						if ($exp_time < 0) {
107
+							preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
108
+							if ($_time < (@filemtime($_file) + $match[ 1 ])) {
109
+								continue;
110
+							}
111
+						} else {
112
+							if ($_time - @filemtime($_file) < $exp_time) {
113
+								continue;
114
+							}
115
+						}
116
+					}
117
+					$_count += @unlink((string) $_file) ? 1 : 0;
118
+					if (function_exists('opcache_invalidate') && strlen(ini_get("opcache.restrict_api")) < 1) {
119
+						opcache_invalidate((string) $_file, true);
120
+					}
121
+				}
122
+			}
123
+		}
124
+		return $_count;
125
+	}
126 126
 }
127 127
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -77,26 +77,25 @@  discard block
 block discarded – undo
77 77
                     $_parts_count = count($_parts);
78 78
                     // check name
79 79
                     if (isset($resource_name)) {
80
-                        if ($_parts[ $_parts_count - 1 ] != $_resourcename_parts) {
80
+                        if ($_parts[$_parts_count - 1] != $_resourcename_parts) {
81 81
                             continue;
82 82
                         }
83 83
                     }
84 84
                     // check compile id
85
-                    if (isset($_compile_id) && (!isset($_parts[ $_parts_count - 2 - $_compile_id_offset ]) ||
86
-                                                $_parts[ $_parts_count - 2 - $_compile_id_offset ] != $_compile_id)
85
+                    if (isset($_compile_id) && (!isset($_parts[$_parts_count - 2 - $_compile_id_offset]) ||
86
+                                                $_parts[$_parts_count - 2 - $_compile_id_offset] != $_compile_id)
87 87
                     ) {
88 88
                         continue;
89 89
                     }
90 90
                     // check cache id
91 91
                     if (isset($_cache_id)) {
92 92
                         // count of cache id parts
93
-                        $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset :
94
-                            $_parts_count - 1 - $_compile_id_offset;
93
+                        $_parts_count = (isset($_compile_id)) ? $_parts_count - 2 - $_compile_id_offset : $_parts_count - 1 - $_compile_id_offset;
95 94
                         if ($_parts_count < $_cache_id_parts_count) {
96 95
                             continue;
97 96
                         }
98
-                        for ($i = 0; $i < $_cache_id_parts_count; $i ++) {
99
-                            if ($_parts[ $i ] != $_cache_id_parts[ $i ]) {
97
+                        for ($i = 0; $i < $_cache_id_parts_count; $i++) {
98
+                            if ($_parts[$i] != $_cache_id_parts[$i]) {
100 99
                                 continue 2;
101 100
                             }
102 101
                         }
@@ -105,7 +104,7 @@  discard block
 block discarded – undo
105 104
                     if (isset($exp_time)) {
106 105
                         if ($exp_time < 0) {
107 106
                             preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
108
-                            if ($_time < (@filemtime($_file) + $match[ 1 ])) {
107
+                            if ($_time < (@filemtime($_file) + $match[1])) {
109 108
                                 continue;
110 109
                             }
111 110
                         } else {
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_undefined.php 2 patches
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -12,38 +12,38 @@
 block discarded – undo
12 12
 class Smarty_Internal_Undefined
13 13
 {
14 14
 
15
-    /**
16
-     * This function is executed automatically when a compiled or cached template file is included
17
-     * - Decode saved properties from compiled template and cache files
18
-     * - Check if compiled or cache file is valid
19
-     *
20
-     * @param  \Smarty_Internal_Template $tpl
21
-     * @param  array                     $properties special template properties
22
-     * @param  bool                      $cache      flag if called from cache file
23
-     *
24
-     * @return bool flag if compiled or cache file is valid
25
-     */
26
-    public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
27
-    {
28
-        if ($cache) {
29
-            $tpl->cached->valid = false;
30
-        } else {
31
-            $tpl->mustCompile = true;
32
-        }
33
-        return false;
34
-    }
15
+	/**
16
+	 * This function is executed automatically when a compiled or cached template file is included
17
+	 * - Decode saved properties from compiled template and cache files
18
+	 * - Check if compiled or cache file is valid
19
+	 *
20
+	 * @param  \Smarty_Internal_Template $tpl
21
+	 * @param  array                     $properties special template properties
22
+	 * @param  bool                      $cache      flag if called from cache file
23
+	 *
24
+	 * @return bool flag if compiled or cache file is valid
25
+	 */
26
+	public function decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
27
+	{
28
+		if ($cache) {
29
+			$tpl->cached->valid = false;
30
+		} else {
31
+			$tpl->mustCompile = true;
32
+		}
33
+		return false;
34
+	}
35 35
 
36
-    /**
37
-     * Call error handler for undefined method
38
-     *
39
-     * @param string $name unknown method-name
40
-     * @param array  $args argument array
41
-     *
42
-     * @return mixed
43
-     * @throws SmartyException
44
-     */
45
-    public function __call($name, $args)
46
-    {
47
-        throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
48
-    }
36
+	/**
37
+	 * Call error handler for undefined method
38
+	 *
39
+	 * @param string $name unknown method-name
40
+	 * @param array  $args argument array
41
+	 *
42
+	 * @return mixed
43
+	 * @throws SmartyException
44
+	 */
45
+	public function __call($name, $args)
46
+	{
47
+		throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
48
+	}
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,6 +44,6 @@
 block discarded – undo
44 44
      */
45 45
     public function __call($name, $args)
46 46
     {
47
-        throw new SmartyException(get_class($args[ 0 ]) . "->{$name}() undefined method");
47
+        throw new SmartyException(get_class($args[0]) . "->{$name}() undefined method");
48 48
     }
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_compile_assign.php 2 patches
Indentation   +72 added lines, -72 removed lines patch added patch discarded remove patch
@@ -16,79 +16,79 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
18 18
 {
19
-    /**
20
-     * Attribute definition: Overwrites base class.
21
-     *
22
-     * @var array
23
-     * @see Smarty_Internal_CompileBase
24
-     */
25
-    public $option_flags = array('nocache', 'noscope');
19
+	/**
20
+	 * Attribute definition: Overwrites base class.
21
+	 *
22
+	 * @var array
23
+	 * @see Smarty_Internal_CompileBase
24
+	 */
25
+	public $option_flags = array('nocache', 'noscope');
26 26
 
27 27
    /**
28
-     * Valid scope names
29
-     *
30
-     * @var array
31
-     */
32
-    public $valid_scopes = array('local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
33
-                                 'root' => Smarty::SCOPE_ROOT, 'global' => Smarty::SCOPE_GLOBAL,
34
-                                 'tpl_root' => Smarty::SCOPE_TPL_ROOT, 'smarty' => Smarty::SCOPE_SMARTY);
28
+    * Valid scope names
29
+    *
30
+    * @var array
31
+    */
32
+	public $valid_scopes = array('local' => Smarty::SCOPE_LOCAL, 'parent' => Smarty::SCOPE_PARENT,
33
+								 'root' => Smarty::SCOPE_ROOT, 'global' => Smarty::SCOPE_GLOBAL,
34
+								 'tpl_root' => Smarty::SCOPE_TPL_ROOT, 'smarty' => Smarty::SCOPE_SMARTY);
35 35
 
36
-    /**
37
-     * Compiles code for the {assign} tag
38
-     *
39
-     * @param  array                                $args      array with attributes from parser
40
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
41
-     * @param  array                                $parameter array with compilation parameter
42
-     *
43
-     * @return string compiled code
44
-     * @throws \SmartyCompilerException
45
-     */
46
-    public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
47
-    {
48
-        // the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
49
-        $this->required_attributes = array('var', 'value');
50
-        $this->shorttag_order = array('var', 'value');
51
-        $this->optional_attributes = array('scope');
52
-        $this->mapCache = array();
53
-        $_nocache = false;
54
-        // check and get attributes
55
-        $_attr = $this->getAttributes($compiler, $args);
56
-        // nocache ?
57
-        if ($_var = $compiler->getId($_attr[ 'var' ])) {
58
-            $_var = "'{$_var}'";
59
-        } else {
60
-            $_var = $_attr[ 'var' ];
61
-        }
62
-        if ($compiler->tag_nocache || $compiler->nocache) {
63
-            $_nocache = true;
64
-            // create nocache var to make it know for further compiling
65
-            $compiler->setNocacheInVariable($_attr[ 'var' ]);
66
-        }
67
-        // scope setup
68
-        if ($_attr[ 'noscope' ]) {
69
-            $_scope = - 1;
70
-        } else {
71
-            $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
72
-        }
73
-        // optional parameter
74
-        $_params = "";
75
-        if ($_nocache || $_scope) {
76
-            $_params .= ' ,' . var_export($_nocache, true);
77
-        }
78
-        if ($_scope) {
79
-            $_params .= ' ,' . $_scope;
80
-        }
81
-        if (isset($parameter[ 'smarty_internal_index' ])) {
82
-            $output =
83
-                "<?php \$_tmp_array = isset(\$_smarty_tpl->tpl_vars[{$_var}]) ? \$_smarty_tpl->tpl_vars[{$_var}]->value : array();\n";
84
-            $output .= "if (!is_array(\$_tmp_array) || \$_tmp_array instanceof ArrayAccess) {\n";
85
-            $output .= "settype(\$_tmp_array, 'array');\n";
86
-            $output .= "}\n";
87
-            $output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n";
88
-            $output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});\n?>";
89
-        } else {
90
-            $output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});\n?>";
91
-        }
92
-        return $output;
93
-    }
36
+	/**
37
+	 * Compiles code for the {assign} tag
38
+	 *
39
+	 * @param  array                                $args      array with attributes from parser
40
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler  compiler object
41
+	 * @param  array                                $parameter array with compilation parameter
42
+	 *
43
+	 * @return string compiled code
44
+	 * @throws \SmartyCompilerException
45
+	 */
46
+	public function compile($args, Smarty_Internal_TemplateCompilerBase $compiler, $parameter)
47
+	{
48
+		// the following must be assigned at runtime because it will be overwritten in Smarty_Internal_Compile_Append
49
+		$this->required_attributes = array('var', 'value');
50
+		$this->shorttag_order = array('var', 'value');
51
+		$this->optional_attributes = array('scope');
52
+		$this->mapCache = array();
53
+		$_nocache = false;
54
+		// check and get attributes
55
+		$_attr = $this->getAttributes($compiler, $args);
56
+		// nocache ?
57
+		if ($_var = $compiler->getId($_attr[ 'var' ])) {
58
+			$_var = "'{$_var}'";
59
+		} else {
60
+			$_var = $_attr[ 'var' ];
61
+		}
62
+		if ($compiler->tag_nocache || $compiler->nocache) {
63
+			$_nocache = true;
64
+			// create nocache var to make it know for further compiling
65
+			$compiler->setNocacheInVariable($_attr[ 'var' ]);
66
+		}
67
+		// scope setup
68
+		if ($_attr[ 'noscope' ]) {
69
+			$_scope = - 1;
70
+		} else {
71
+			$_scope = $compiler->convertScope($_attr, $this->valid_scopes);
72
+		}
73
+		// optional parameter
74
+		$_params = "";
75
+		if ($_nocache || $_scope) {
76
+			$_params .= ' ,' . var_export($_nocache, true);
77
+		}
78
+		if ($_scope) {
79
+			$_params .= ' ,' . $_scope;
80
+		}
81
+		if (isset($parameter[ 'smarty_internal_index' ])) {
82
+			$output =
83
+				"<?php \$_tmp_array = isset(\$_smarty_tpl->tpl_vars[{$_var}]) ? \$_smarty_tpl->tpl_vars[{$_var}]->value : array();\n";
84
+			$output .= "if (!is_array(\$_tmp_array) || \$_tmp_array instanceof ArrayAccess) {\n";
85
+			$output .= "settype(\$_tmp_array, 'array');\n";
86
+			$output .= "}\n";
87
+			$output .= "\$_tmp_array{$parameter['smarty_internal_index']} = {$_attr['value']};\n";
88
+			$output .= "\$_smarty_tpl->_assignInScope({$_var}, \$_tmp_array{$_params});\n?>";
89
+		} else {
90
+			$output = "<?php \$_smarty_tpl->_assignInScope({$_var}, {$_attr['value']}{$_params});\n?>";
91
+		}
92
+		return $output;
93
+	}
94 94
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
         // check and get attributes
55 55
         $_attr = $this->getAttributes($compiler, $args);
56 56
         // nocache ?
57
-        if ($_var = $compiler->getId($_attr[ 'var' ])) {
57
+        if ($_var = $compiler->getId($_attr['var'])) {
58 58
             $_var = "'{$_var}'";
59 59
         } else {
60
-            $_var = $_attr[ 'var' ];
60
+            $_var = $_attr['var'];
61 61
         }
62 62
         if ($compiler->tag_nocache || $compiler->nocache) {
63 63
             $_nocache = true;
64 64
             // create nocache var to make it know for further compiling
65
-            $compiler->setNocacheInVariable($_attr[ 'var' ]);
65
+            $compiler->setNocacheInVariable($_attr['var']);
66 66
         }
67 67
         // scope setup
68
-        if ($_attr[ 'noscope' ]) {
68
+        if ($_attr['noscope']) {
69 69
             $_scope = - 1;
70 70
         } else {
71 71
             $_scope = $compiler->convertScope($_attr, $this->valid_scopes);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
         if ($_scope) {
79 79
             $_params .= ' ,' . $_scope;
80 80
         }
81
-        if (isset($parameter[ 'smarty_internal_index' ])) {
81
+        if (isset($parameter['smarty_internal_index'])) {
82 82
             $output =
83 83
                 "<?php \$_tmp_array = isset(\$_smarty_tpl->tpl_vars[{$_var}]) ? \$_smarty_tpl->tpl_vars[{$_var}]->value : array();\n";
84 84
             $output .= "if (!is_array(\$_tmp_array) || \$_tmp_array instanceof ArrayAccess) {\n";
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_compile_private_registered_block.php 2 patches
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -16,57 +16,57 @@
 block discarded – undo
16 16
  */
17 17
 class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_Compile_Private_Block_Plugin
18 18
 {
19
-    /**
20
-     * Setup callback, parameter array and nocache mode
21
-     *
22
-     * @param \Smarty_Internal_TemplateCompilerBase $compiler
23
-     * @param  array                                $_attr attributes
24
-     * @param  string                               $tag
25
-     * @param  null                                 $function
26
-     *
27
-     * @return array
28
-     */
29
-    public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $function)
30
-    {
31
-        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
32
-            $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
33
-            $callback = $tag_info[ 0 ];
34
-            if (is_array($callback)) {
35
-                if (is_object($callback[ 0 ])) {
36
-                    $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
37
-                    $callback =
38
-                        array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
39
-                } else {
40
-                    $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
41
-                    $callback =
42
-                        array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
43
-                }
44
-            } else {
45
-                $callable = "\$_block_plugin{$this->nesting}";
46
-                $callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
47
-            }
48
-        } else {
49
-            $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
50
-            $callback = $tag_info[ 0 ];
51
-            if (is_array($callback)) {
52
-                $callable = "array('{$callback[0]}', '{$callback[1]}')";
53
-                $callback = "{$callback[1]}::{$callback[1]}";
54
-            } else {
55
-                $callable = null;
56
-            }
57
-        }
58
-        $compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
59
-        $_paramsArray = array();
60
-        foreach ($_attr as $_key => $_value) {
61
-            if (is_int($_key)) {
62
-                $_paramsArray[] = "$_key=>$_value";
63
-            } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
64
-                $_value = str_replace("'", "^#^", $_value);
65
-                $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
66
-            } else {
67
-                $_paramsArray[] = "'$_key'=>$_value";
68
-            }
69
-        }
70
-        return array($callback, $_paramsArray, $callable);
71
-    }
19
+	/**
20
+	 * Setup callback, parameter array and nocache mode
21
+	 *
22
+	 * @param \Smarty_Internal_TemplateCompilerBase $compiler
23
+	 * @param  array                                $_attr attributes
24
+	 * @param  string                               $tag
25
+	 * @param  null                                 $function
26
+	 *
27
+	 * @return array
28
+	 */
29
+	public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $function)
30
+	{
31
+		if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
32
+			$tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
33
+			$callback = $tag_info[ 0 ];
34
+			if (is_array($callback)) {
35
+				if (is_object($callback[ 0 ])) {
36
+					$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
37
+					$callback =
38
+						array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
39
+				} else {
40
+					$callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
41
+					$callback =
42
+						array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "::{$callback[1]}");
43
+				}
44
+			} else {
45
+				$callable = "\$_block_plugin{$this->nesting}";
46
+				$callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
47
+			}
48
+		} else {
49
+			$tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
50
+			$callback = $tag_info[ 0 ];
51
+			if (is_array($callback)) {
52
+				$callable = "array('{$callback[0]}', '{$callback[1]}')";
53
+				$callback = "{$callback[1]}::{$callback[1]}";
54
+			} else {
55
+				$callable = null;
56
+			}
57
+		}
58
+		$compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
59
+		$_paramsArray = array();
60
+		foreach ($_attr as $_key => $_value) {
61
+			if (is_int($_key)) {
62
+				$_paramsArray[] = "$_key=>$_value";
63
+			} elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
64
+				$_value = str_replace("'", "^#^", $_value);
65
+				$_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
66
+			} else {
67
+				$_paramsArray[] = "'$_key'=>$_value";
68
+			}
69
+		}
70
+		return array($callback, $_paramsArray, $callable);
71
+	}
72 72
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function setup(Smarty_Internal_TemplateCompilerBase $compiler, $_attr, $tag, $function)
30 30
     {
31
-        if (isset($compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ])) {
32
-            $tag_info = $compiler->smarty->registered_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
33
-            $callback = $tag_info[ 0 ];
31
+        if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag])) {
32
+            $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag];
33
+            $callback = $tag_info[0];
34 34
             if (is_array($callback)) {
35
-                if (is_object($callback[ 0 ])) {
35
+                if (is_object($callback[0])) {
36 36
                     $callable = "array(\$_block_plugin{$this->nesting}, '{$callback[1]}')";
37 37
                     $callback =
38 38
                         array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]", "->{$callback[1]}");
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
                 $callback = array("\$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0]", '');
47 47
             }
48 48
         } else {
49
-            $tag_info = $compiler->default_handler_plugins[ Smarty::PLUGIN_BLOCK ][ $tag ];
50
-            $callback = $tag_info[ 0 ];
49
+            $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$tag];
50
+            $callback = $tag_info[0];
51 51
             if (is_array($callback)) {
52 52
                 $callable = "array('{$callback[0]}', '{$callback[1]}')";
53 53
                 $callback = "{$callback[1]}::{$callback[1]}";
@@ -55,12 +55,12 @@  discard block
 block discarded – undo
55 55
                 $callable = null;
56 56
             }
57 57
         }
58
-        $compiler->tag_nocache = !$tag_info[ 1 ] | $compiler->tag_nocache;
58
+        $compiler->tag_nocache = !$tag_info[1] | $compiler->tag_nocache;
59 59
         $_paramsArray = array();
60 60
         foreach ($_attr as $_key => $_value) {
61 61
             if (is_int($_key)) {
62 62
                 $_paramsArray[] = "$_key=>$_value";
63
-            } elseif ($compiler->template->caching && in_array($_key, $tag_info[ 2 ])) {
63
+            } elseif ($compiler->template->caching && in_array($_key, $tag_info[2])) {
64 64
                 $_value = str_replace("'", "^#^", $_value);
65 65
                 $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
66 66
             } else {
Please login to merge, or discard this patch.