Completed
Push — developer ( 67fdb5...f9e515 )
by Błażej
469:22 queued 431:37
created
libraries/Smarty/libs/sysplugins/smarty_internal_parsetree_code.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -18,25 +18,25 @@
 block discarded – undo
18 18
  */
19 19
 class Smarty_Internal_ParseTree_Code extends Smarty_Internal_ParseTree
20 20
 {
21
-    /**
22
-     * Create parse tree buffer for code fragment
23
-     *
24
-     * @param string $data content
25
-     */
26
-    public function __construct($data)
27
-    {
28
-        $this->data = $data;
29
-    }
21
+	/**
22
+	 * Create parse tree buffer for code fragment
23
+	 *
24
+	 * @param string $data content
25
+	 */
26
+	public function __construct($data)
27
+	{
28
+		$this->data = $data;
29
+	}
30 30
 
31
-    /**
32
-     * Return buffer content in parentheses
33
-     *
34
-     * @param \Smarty_Internal_Templateparser $parser
35
-     *
36
-     * @return string content
37
-     */
38
-    public function to_smarty_php(Smarty_Internal_Templateparser $parser)
39
-    {
40
-        return sprintf("(%s)", $this->data);
41
-    }
31
+	/**
32
+	 * Return buffer content in parentheses
33
+	 *
34
+	 * @param \Smarty_Internal_Templateparser $parser
35
+	 *
36
+	 * @return string content
37
+	 */
38
+	public function to_smarty_php(Smarty_Internal_Templateparser $parser)
39
+	{
40
+		return sprintf("(%s)", $this->data);
41
+	}
42 42
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_loadplugin.php 2 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -11,101 +11,101 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_LoadPlugin
13 13
 {
14
-    /**
15
-     * Cache of searched plugin files
16
-     *
17
-     * @var array
18
-     */
19
-    public $plugin_files = array();
14
+	/**
15
+	 * Cache of searched plugin files
16
+	 *
17
+	 * @var array
18
+	 */
19
+	public $plugin_files = array();
20 20
 
21
-    /**
22
-     * Takes unknown classes and loads plugin files for them
23
-     * class name format: Smarty_PluginType_PluginName
24
-     * plugin filename format: plugintype.pluginname.php
25
-     *
26
-     * @param \Smarty $smarty
27
-     * @param  string $plugin_name class plugin name to load
28
-     * @param  bool   $check       check if already loaded
29
-     *
30
-     * @return bool|string
31
-     * @throws \SmartyException
32
-     */
33
-    public function loadPlugin(Smarty $smarty, $plugin_name, $check)
34
-    {
35
-        // if function or class exists, exit silently (already loaded)
36
-        if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
37
-            return true;
38
-        }
39
-        if (!preg_match('#^smarty_((internal)|([^_]+))_(.+)$#i', $plugin_name, $match)) {
40
-            throw new SmartyException("plugin {$plugin_name} is not a valid name format");
41
-        }
42
-        if (!empty($match[ 2 ])) {
43
-            $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
44
-            if (isset($this->plugin_files[ $file ])) {
45
-                if ($this->plugin_files[ $file ] !== false) {
46
-                    return $this->plugin_files[ $file ];
47
-                } else {
48
-                    return false;
49
-                }
50
-            } else {
51
-                if (is_file($file)) {
52
-                    $this->plugin_files[ $file ] = $file;
53
-                    require_once($file);
54
-                    return $file;
55
-                } else {
56
-                    $this->plugin_files[ $file ] = false;
57
-                    return false;
58
-                }
59
-            }
60
-        }
61
-        // plugin filename is expected to be: [type].[name].php
62
-        $_plugin_filename = "{$match[1]}.{$match[4]}.php";
63
-        $_lower_filename = strtolower($_plugin_filename);
64
-        if (isset($this->plugin_files)) {
65
-            if (isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
66
-                if (!$smarty->use_include_path || $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] !== false) {
67
-                    return $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ];
68
-                }
69
-            }
70
-            if (!$smarty->use_include_path || $smarty->ext->_getIncludePath->isNewIncludePath($smarty)) {
71
-                unset($this->plugin_files[ 'include_path' ]);
72
-            } else {
73
-                if (isset($this->plugin_files[ 'include_path' ][ $_lower_filename ])) {
74
-                    return $this->plugin_files[ 'include_path' ][ $_lower_filename ];
75
-                }
76
-            }
77
-        }
78
-        $_file_names = array($_plugin_filename);
79
-        if ($_lower_filename != $_plugin_filename) {
80
-            $_file_names[] = $_lower_filename;
81
-        }
82
-        $_p_dirs = $smarty->getPluginsDir();
83
-        if (!isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
84
-            // loop through plugin dirs and find the plugin
85
-            foreach ($_p_dirs as $_plugin_dir) {
86
-                foreach ($_file_names as $name) {
87
-                    $file = $_plugin_dir . $name;
88
-                    if (is_file($file)) {
89
-                        $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file;
90
-                        require_once($file);
91
-                        return $file;
92
-                    }
93
-                    $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false;
94
-                }
95
-            }
96
-        }
97
-        if ($smarty->use_include_path) {
98
-            foreach ($_file_names as $_file_name) {
99
-                // try PHP include_path
100
-                $file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
101
-                $this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file;
102
-                if ($file !== false) {
103
-                    require_once($file);
104
-                    return $file;
105
-                }
106
-            }
107
-        }
108
-        // no plugin loaded
109
-        return false;
110
-    }
21
+	/**
22
+	 * Takes unknown classes and loads plugin files for them
23
+	 * class name format: Smarty_PluginType_PluginName
24
+	 * plugin filename format: plugintype.pluginname.php
25
+	 *
26
+	 * @param \Smarty $smarty
27
+	 * @param  string $plugin_name class plugin name to load
28
+	 * @param  bool   $check       check if already loaded
29
+	 *
30
+	 * @return bool|string
31
+	 * @throws \SmartyException
32
+	 */
33
+	public function loadPlugin(Smarty $smarty, $plugin_name, $check)
34
+	{
35
+		// if function or class exists, exit silently (already loaded)
36
+		if ($check && (is_callable($plugin_name) || class_exists($plugin_name, false))) {
37
+			return true;
38
+		}
39
+		if (!preg_match('#^smarty_((internal)|([^_]+))_(.+)$#i', $plugin_name, $match)) {
40
+			throw new SmartyException("plugin {$plugin_name} is not a valid name format");
41
+		}
42
+		if (!empty($match[ 2 ])) {
43
+			$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
44
+			if (isset($this->plugin_files[ $file ])) {
45
+				if ($this->plugin_files[ $file ] !== false) {
46
+					return $this->plugin_files[ $file ];
47
+				} else {
48
+					return false;
49
+				}
50
+			} else {
51
+				if (is_file($file)) {
52
+					$this->plugin_files[ $file ] = $file;
53
+					require_once($file);
54
+					return $file;
55
+				} else {
56
+					$this->plugin_files[ $file ] = false;
57
+					return false;
58
+				}
59
+			}
60
+		}
61
+		// plugin filename is expected to be: [type].[name].php
62
+		$_plugin_filename = "{$match[1]}.{$match[4]}.php";
63
+		$_lower_filename = strtolower($_plugin_filename);
64
+		if (isset($this->plugin_files)) {
65
+			if (isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
66
+				if (!$smarty->use_include_path || $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] !== false) {
67
+					return $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ];
68
+				}
69
+			}
70
+			if (!$smarty->use_include_path || $smarty->ext->_getIncludePath->isNewIncludePath($smarty)) {
71
+				unset($this->plugin_files[ 'include_path' ]);
72
+			} else {
73
+				if (isset($this->plugin_files[ 'include_path' ][ $_lower_filename ])) {
74
+					return $this->plugin_files[ 'include_path' ][ $_lower_filename ];
75
+				}
76
+			}
77
+		}
78
+		$_file_names = array($_plugin_filename);
79
+		if ($_lower_filename != $_plugin_filename) {
80
+			$_file_names[] = $_lower_filename;
81
+		}
82
+		$_p_dirs = $smarty->getPluginsDir();
83
+		if (!isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
84
+			// loop through plugin dirs and find the plugin
85
+			foreach ($_p_dirs as $_plugin_dir) {
86
+				foreach ($_file_names as $name) {
87
+					$file = $_plugin_dir . $name;
88
+					if (is_file($file)) {
89
+						$this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file;
90
+						require_once($file);
91
+						return $file;
92
+					}
93
+					$this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false;
94
+				}
95
+			}
96
+		}
97
+		if ($smarty->use_include_path) {
98
+			foreach ($_file_names as $_file_name) {
99
+				// try PHP include_path
100
+				$file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
101
+				$this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file;
102
+				if ($file !== false) {
103
+					require_once($file);
104
+					return $file;
105
+				}
106
+			}
107
+		}
108
+		// no plugin loaded
109
+		return false;
110
+	}
111 111
 }
112 112
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -39,21 +39,21 @@  discard block
 block discarded – undo
39 39
         if (!preg_match('#^smarty_((internal)|([^_]+))_(.+)$#i', $plugin_name, $match)) {
40 40
             throw new SmartyException("plugin {$plugin_name} is not a valid name format");
41 41
         }
42
-        if (!empty($match[ 2 ])) {
42
+        if (!empty($match[2])) {
43 43
             $file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
44
-            if (isset($this->plugin_files[ $file ])) {
45
-                if ($this->plugin_files[ $file ] !== false) {
46
-                    return $this->plugin_files[ $file ];
44
+            if (isset($this->plugin_files[$file])) {
45
+                if ($this->plugin_files[$file] !== false) {
46
+                    return $this->plugin_files[$file];
47 47
                 } else {
48 48
                     return false;
49 49
                 }
50 50
             } else {
51 51
                 if (is_file($file)) {
52
-                    $this->plugin_files[ $file ] = $file;
52
+                    $this->plugin_files[$file] = $file;
53 53
                     require_once($file);
54 54
                     return $file;
55 55
                 } else {
56
-                    $this->plugin_files[ $file ] = false;
56
+                    $this->plugin_files[$file] = false;
57 57
                     return false;
58 58
                 }
59 59
             }
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
         $_plugin_filename = "{$match[1]}.{$match[4]}.php";
63 63
         $_lower_filename = strtolower($_plugin_filename);
64 64
         if (isset($this->plugin_files)) {
65
-            if (isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
66
-                if (!$smarty->use_include_path || $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] !== false) {
67
-                    return $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ];
65
+            if (isset($this->plugin_files['plugins_dir'][$_lower_filename])) {
66
+                if (!$smarty->use_include_path || $this->plugin_files['plugins_dir'][$_lower_filename] !== false) {
67
+                    return $this->plugin_files['plugins_dir'][$_lower_filename];
68 68
                 }
69 69
             }
70 70
             if (!$smarty->use_include_path || $smarty->ext->_getIncludePath->isNewIncludePath($smarty)) {
71
-                unset($this->plugin_files[ 'include_path' ]);
71
+                unset($this->plugin_files['include_path']);
72 72
             } else {
73
-                if (isset($this->plugin_files[ 'include_path' ][ $_lower_filename ])) {
74
-                    return $this->plugin_files[ 'include_path' ][ $_lower_filename ];
73
+                if (isset($this->plugin_files['include_path'][$_lower_filename])) {
74
+                    return $this->plugin_files['include_path'][$_lower_filename];
75 75
                 }
76 76
             }
77 77
         }
@@ -80,17 +80,17 @@  discard block
 block discarded – undo
80 80
             $_file_names[] = $_lower_filename;
81 81
         }
82 82
         $_p_dirs = $smarty->getPluginsDir();
83
-        if (!isset($this->plugin_files[ 'plugins_dir' ][ $_lower_filename ])) {
83
+        if (!isset($this->plugin_files['plugins_dir'][$_lower_filename])) {
84 84
             // loop through plugin dirs and find the plugin
85 85
             foreach ($_p_dirs as $_plugin_dir) {
86 86
                 foreach ($_file_names as $name) {
87 87
                     $file = $_plugin_dir . $name;
88 88
                     if (is_file($file)) {
89
-                        $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = $file;
89
+                        $this->plugin_files['plugins_dir'][$_lower_filename] = $file;
90 90
                         require_once($file);
91 91
                         return $file;
92 92
                     }
93
-                    $this->plugin_files[ 'plugins_dir' ][ $_lower_filename ] = false;
93
+                    $this->plugin_files['plugins_dir'][$_lower_filename] = false;
94 94
                 }
95 95
             }
96 96
         }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             foreach ($_file_names as $_file_name) {
99 99
                 // try PHP include_path
100 100
                 $file = $smarty->ext->_getIncludePath->getIncludePath($_p_dirs, $_file_name, $smarty);
101
-                $this->plugin_files[ 'include_path' ][ $_lower_filename ] = $file;
101
+                $this->plugin_files['include_path'][$_lower_filename] = $file;
102 102
                 if ($file !== false) {
103 103
                     require_once($file);
104 104
                     return $file;
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_registerfilter.php 2 patches
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -11,78 +11,78 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_RegisterFilter
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Valid filter types
23
-     *
24
-     * @var array
25
-     */
26
-    private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
21
+	/**
22
+	 * Valid filter types
23
+	 *
24
+	 * @var array
25
+	 */
26
+	private $filterTypes = array('pre' => true, 'post' => true, 'output' => true, 'variable' => true);
27 27
 
28
-    /**
29
-     * Registers a filter function
30
-     *
31
-     * @api  Smarty::registerFilter()
32
-     *
33
-     * @link http://www.smarty.net/docs/en/api.register.filter.tpl
34
-     *
35
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
36
-     * @param  string                                                         $type filter type
37
-     * @param  callback                                                       $callback
38
-     * @param  string|null                                                    $name optional filter name
39
-     *
40
-     * @return \Smarty|\Smarty_Internal_Template
41
-     * @throws \SmartyException
42
-     */
43
-    public function registerFilter(Smarty_Internal_TemplateBase $obj, $type, $callback, $name = null)
44
-    {
45
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
46
-        $this->_checkFilterType($type);
47
-        $name = isset($name) ? $name : $this->_getFilterName($callback);
48
-        if (!is_callable($callback)) {
49
-            throw new SmartyException("{$type}filter \"{$name}\" not callable");
50
-        }
51
-        $smarty->registered_filters[ $type ][ $name ] = $callback;
52
-        return $obj;
53
-    }
28
+	/**
29
+	 * Registers a filter function
30
+	 *
31
+	 * @api  Smarty::registerFilter()
32
+	 *
33
+	 * @link http://www.smarty.net/docs/en/api.register.filter.tpl
34
+	 *
35
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
36
+	 * @param  string                                                         $type filter type
37
+	 * @param  callback                                                       $callback
38
+	 * @param  string|null                                                    $name optional filter name
39
+	 *
40
+	 * @return \Smarty|\Smarty_Internal_Template
41
+	 * @throws \SmartyException
42
+	 */
43
+	public function registerFilter(Smarty_Internal_TemplateBase $obj, $type, $callback, $name = null)
44
+	{
45
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
46
+		$this->_checkFilterType($type);
47
+		$name = isset($name) ? $name : $this->_getFilterName($callback);
48
+		if (!is_callable($callback)) {
49
+			throw new SmartyException("{$type}filter \"{$name}\" not callable");
50
+		}
51
+		$smarty->registered_filters[ $type ][ $name ] = $callback;
52
+		return $obj;
53
+	}
54 54
 
55
-    /**
56
-     * Return internal filter name
57
-     *
58
-     * @param  callback $function_name
59
-     *
60
-     * @return string   internal filter name
61
-     */
62
-    public function _getFilterName($function_name)
63
-    {
64
-        if (is_array($function_name)) {
65
-            $_class_name = (is_object($function_name[ 0 ]) ? get_class($function_name[ 0 ]) : $function_name[ 0 ]);
55
+	/**
56
+	 * Return internal filter name
57
+	 *
58
+	 * @param  callback $function_name
59
+	 *
60
+	 * @return string   internal filter name
61
+	 */
62
+	public function _getFilterName($function_name)
63
+	{
64
+		if (is_array($function_name)) {
65
+			$_class_name = (is_object($function_name[ 0 ]) ? get_class($function_name[ 0 ]) : $function_name[ 0 ]);
66 66
 
67
-            return $_class_name . '_' . $function_name[ 1 ];
68
-        } elseif (is_string($function_name)) {
69
-            return $function_name;
70
-        } else {
71
-            return 'closure';
72
-        }
73
-    }
67
+			return $_class_name . '_' . $function_name[ 1 ];
68
+		} elseif (is_string($function_name)) {
69
+			return $function_name;
70
+		} else {
71
+			return 'closure';
72
+		}
73
+	}
74 74
 
75
-    /**
76
-     * Check if filter type is valid
77
-     *
78
-     * @param string $type
79
-     *
80
-     * @throws \SmartyException
81
-     */
82
-    public function _checkFilterType($type)
83
-    {
84
-        if (!isset($this->filterTypes[ $type ])) {
85
-            throw new SmartyException("Illegal filter type \"{$type}\"");
86
-        }
87
-    }
75
+	/**
76
+	 * Check if filter type is valid
77
+	 *
78
+	 * @param string $type
79
+	 *
80
+	 * @throws \SmartyException
81
+	 */
82
+	public function _checkFilterType($type)
83
+	{
84
+		if (!isset($this->filterTypes[ $type ])) {
85
+			throw new SmartyException("Illegal filter type \"{$type}\"");
86
+		}
87
+	}
88 88
 }
89 89
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         if (!is_callable($callback)) {
49 49
             throw new SmartyException("{$type}filter \"{$name}\" not callable");
50 50
         }
51
-        $smarty->registered_filters[ $type ][ $name ] = $callback;
51
+        $smarty->registered_filters[$type][$name] = $callback;
52 52
         return $obj;
53 53
     }
54 54
 
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
     public function _getFilterName($function_name)
63 63
     {
64 64
         if (is_array($function_name)) {
65
-            $_class_name = (is_object($function_name[ 0 ]) ? get_class($function_name[ 0 ]) : $function_name[ 0 ]);
65
+            $_class_name = (is_object($function_name[0]) ? get_class($function_name[0]) : $function_name[0]);
66 66
 
67
-            return $_class_name . '_' . $function_name[ 1 ];
67
+            return $_class_name . '_' . $function_name[1];
68 68
         } elseif (is_string($function_name)) {
69 69
             return $function_name;
70 70
         } else {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function _checkFilterType($type)
83 83
     {
84
-        if (!isset($this->filterTypes[ $type ])) {
84
+        if (!isset($this->filterTypes[$type])) {
85 85
             throw new SmartyException("Illegal filter type \"{$type}\"");
86 86
         }
87 87
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_writefile.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -15,77 +15,77 @@
 block discarded – undo
15 15
  */
16 16
 class Smarty_Internal_Runtime_WriteFile
17 17
 {
18
-    /**
19
-     * Writes file in a safe way to disk
20
-     *
21
-     * @param  string $_filepath complete filepath
22
-     * @param  string $_contents file content
23
-     * @param  Smarty $smarty    smarty instance
24
-     *
25
-     * @throws SmartyException
26
-     * @return boolean true
27
-     */
28
-    public function writeFile($_filepath, $_contents, Smarty $smarty)
29
-    {
30
-        $_error_reporting = error_reporting();
31
-        error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
32
-        $_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644;
33
-        $_dir_perms =
34
-            property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771;
35
-        if ($_file_perms !== null) {
36
-            $old_umask = umask(0);
37
-        }
18
+	/**
19
+	 * Writes file in a safe way to disk
20
+	 *
21
+	 * @param  string $_filepath complete filepath
22
+	 * @param  string $_contents file content
23
+	 * @param  Smarty $smarty    smarty instance
24
+	 *
25
+	 * @throws SmartyException
26
+	 * @return boolean true
27
+	 */
28
+	public function writeFile($_filepath, $_contents, Smarty $smarty)
29
+	{
30
+		$_error_reporting = error_reporting();
31
+		error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING);
32
+		$_file_perms = property_exists($smarty, '_file_perms') ? $smarty->_file_perms : 0644;
33
+		$_dir_perms =
34
+			property_exists($smarty, '_dir_perms') ? (isset($smarty->_dir_perms) ? $smarty->_dir_perms : 0777) : 0771;
35
+		if ($_file_perms !== null) {
36
+			$old_umask = umask(0);
37
+		}
38 38
 
39
-        $_dirpath = dirname($_filepath);
40
-        // if subdirs, create dir structure
41
-        if ($_dirpath !== '.' && !file_exists($_dirpath)) {
42
-            mkdir($_dirpath, $_dir_perms, true);
43
-        }
39
+		$_dirpath = dirname($_filepath);
40
+		// if subdirs, create dir structure
41
+		if ($_dirpath !== '.' && !file_exists($_dirpath)) {
42
+			mkdir($_dirpath, $_dir_perms, true);
43
+		}
44 44
 
45
-        // write to tmp file, then move to overt file lock race condition
46
-        $_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
47
-        if (!file_put_contents($_tmp_file, $_contents)) {
48
-            error_reporting($_error_reporting);
49
-            throw new SmartyException("unable to write file {$_tmp_file}");
50
-        }
45
+		// write to tmp file, then move to overt file lock race condition
46
+		$_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
47
+		if (!file_put_contents($_tmp_file, $_contents)) {
48
+			error_reporting($_error_reporting);
49
+			throw new SmartyException("unable to write file {$_tmp_file}");
50
+		}
51 51
 
52
-        /*
52
+		/*
53 53
          * Windows' rename() fails if the destination exists,
54 54
          * Linux' rename() properly handles the overwrite.
55 55
          * Simply unlink()ing a file might cause other processes
56 56
          * currently reading that file to fail, but linux' rename()
57 57
          * seems to be smart enough to handle that for us.
58 58
          */
59
-        if (Smarty::$_IS_WINDOWS) {
60
-            // remove original file
61
-            if (is_file($_filepath)) {
62
-                @unlink($_filepath);
63
-            }
64
-            // rename tmp file
65
-            $success = @rename($_tmp_file, $_filepath);
66
-        } else {
67
-            // rename tmp file
68
-            $success = @rename($_tmp_file, $_filepath);
69
-            if (!$success) {
70
-                // remove original file
71
-                if (is_file($_filepath)) {
72
-                    @unlink($_filepath);
73
-                }
74
-                // rename tmp file
75
-                $success = @rename($_tmp_file, $_filepath);
76
-            }
77
-        }
78
-        if (!$success) {
79
-            error_reporting($_error_reporting);
80
-            throw new SmartyException("unable to write file {$_filepath}");
81
-        }
82
-        if ($_file_perms !== null) {
83
-            // set file permissions
84
-            chmod($_filepath, $_file_perms);
85
-            umask($old_umask);
86
-        }
87
-        error_reporting($_error_reporting);
59
+		if (Smarty::$_IS_WINDOWS) {
60
+			// remove original file
61
+			if (is_file($_filepath)) {
62
+				@unlink($_filepath);
63
+			}
64
+			// rename tmp file
65
+			$success = @rename($_tmp_file, $_filepath);
66
+		} else {
67
+			// rename tmp file
68
+			$success = @rename($_tmp_file, $_filepath);
69
+			if (!$success) {
70
+				// remove original file
71
+				if (is_file($_filepath)) {
72
+					@unlink($_filepath);
73
+				}
74
+				// rename tmp file
75
+				$success = @rename($_tmp_file, $_filepath);
76
+			}
77
+		}
78
+		if (!$success) {
79
+			error_reporting($_error_reporting);
80
+			throw new SmartyException("unable to write file {$_filepath}");
81
+		}
82
+		if ($_file_perms !== null) {
83
+			// set file permissions
84
+			chmod($_filepath, $_file_perms);
85
+			umask($old_umask);
86
+		}
87
+		error_reporting($_error_reporting);
88 88
 
89
-        return true;
90
-    }
89
+		return true;
90
+	}
91 91
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_method_registerclass.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -11,36 +11,36 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_RegisterClass
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Registers static classes to be used in templates
23
-     *
24
-     * @api  Smarty::registerClass()
25
-     * @link http://www.smarty.net/docs/en/api.register.class.tpl
26
-     *
27
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
-     * @param  string                                                         $class_name
29
-     * @param  string                                                         $class_impl the referenced PHP class to
30
-     *                                                                                    register
31
-     *
32
-     * @return \Smarty|\Smarty_Internal_Template
33
-     * @throws \SmartyException
34
-     */
35
-    public function registerClass(Smarty_Internal_TemplateBase $obj, $class_name, $class_impl)
36
-    {
37
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
38
-        // test if exists
39
-        if (!class_exists($class_impl)) {
40
-            throw new SmartyException("Undefined class '$class_impl' in register template class");
41
-        }
42
-        // register the class
43
-        $smarty->registered_classes[ $class_name ] = $class_impl;
44
-        return $obj;
45
-    }
21
+	/**
22
+	 * Registers static classes to be used in templates
23
+	 *
24
+	 * @api  Smarty::registerClass()
25
+	 * @link http://www.smarty.net/docs/en/api.register.class.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
+	 * @param  string                                                         $class_name
29
+	 * @param  string                                                         $class_impl the referenced PHP class to
30
+	 *                                                                                    register
31
+	 *
32
+	 * @return \Smarty|\Smarty_Internal_Template
33
+	 * @throws \SmartyException
34
+	 */
35
+	public function registerClass(Smarty_Internal_TemplateBase $obj, $class_name, $class_impl)
36
+	{
37
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
38
+		// test if exists
39
+		if (!class_exists($class_impl)) {
40
+			throw new SmartyException("Undefined class '$class_impl' in register template class");
41
+		}
42
+		// register the class
43
+		$smarty->registered_classes[ $class_name ] = $class_impl;
44
+		return $obj;
45
+	}
46 46
 }
47 47
\ 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
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
             throw new SmartyException("Undefined class '$class_impl' in register template class");
41 41
         }
42 42
         // register the class
43
-        $smarty->registered_classes[ $class_name ] = $class_impl;
43
+        $smarty->registered_classes[$class_name] = $class_impl;
44 44
         return $obj;
45 45
     }
46 46
 }
47 47
\ No newline at end of file
Please login to merge, or discard this patch.
Smarty/libs/sysplugins/smarty_internal_method_unregisterplugin.php 2 patches
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,31 +11,31 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Method_UnregisterPlugin
13 13
 {
14
-    /**
15
-     * Valid for Smarty and template object
16
-     *
17
-     * @var int
18
-     */
19
-    public $objMap = 3;
14
+	/**
15
+	 * Valid for Smarty and template object
16
+	 *
17
+	 * @var int
18
+	 */
19
+	public $objMap = 3;
20 20
 
21
-    /**
22
-     * Registers plugin to be used in templates
23
-     *
24
-     * @api  Smarty::unregisterPlugin()
25
-     * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl
26
-     *
27
-     * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
-     * @param  string                                                         $type plugin type
29
-     * @param  string                                                         $name name of template tag
30
-     *
31
-     * @return \Smarty|\Smarty_Internal_Template
32
-     */
33
-    public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
34
-    {
35
-        $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
36
-        if (isset($smarty->registered_plugins[ $type ][ $name ])) {
37
-            unset($smarty->registered_plugins[ $type ][ $name ]);
38
-        }
39
-        return $obj;
40
-    }
21
+	/**
22
+	 * Registers plugin to be used in templates
23
+	 *
24
+	 * @api  Smarty::unregisterPlugin()
25
+	 * @link http://www.smarty.net/docs/en/api.unregister.plugin.tpl
26
+	 *
27
+	 * @param \Smarty_Internal_TemplateBase|\Smarty_Internal_Template|\Smarty $obj
28
+	 * @param  string                                                         $type plugin type
29
+	 * @param  string                                                         $name name of template tag
30
+	 *
31
+	 * @return \Smarty|\Smarty_Internal_Template
32
+	 */
33
+	public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
34
+	{
35
+		$smarty = isset($obj->smarty) ? $obj->smarty : $obj;
36
+		if (isset($smarty->registered_plugins[ $type ][ $name ])) {
37
+			unset($smarty->registered_plugins[ $type ][ $name ]);
38
+		}
39
+		return $obj;
40
+	}
41 41
 }
42 42
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,8 +33,8 @@
 block discarded – undo
33 33
     public function unregisterPlugin(Smarty_Internal_TemplateBase $obj, $type, $name)
34 34
     {
35 35
         $smarty = isset($obj->smarty) ? $obj->smarty : $obj;
36
-        if (isset($smarty->registered_plugins[ $type ][ $name ])) {
37
-            unset($smarty->registered_plugins[ $type ][ $name ]);
36
+        if (isset($smarty->registered_plugins[$type][$name])) {
37
+            unset($smarty->registered_plugins[$type][$name]);
38 38
         }
39 39
         return $obj;
40 40
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_runtime_updatescope.php 3 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -11,105 +11,105 @@
 block discarded – undo
11 11
 class Smarty_Internal_Runtime_UpdateScope
12 12
 {
13 13
 
14
-    /**
15
-     * Update new assigned template or config variable in other effected scopes
16
-     *
17
-     * @param Smarty_Internal_Template $tpl     data object
18
-     * @param string|null              $varName variable name
19
-     * @param int                      $tagScope   tag scope to which bubble up variable value
20
-     *
21
-     */
22
-    public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0)
23
-    {
24
-        if ($tagScope) {
25
-            $this->_updateVarStack($tpl, $varName);
26
-            $tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
27
-            if (!$tpl->scope && !$tagScope) return;
28
-        }
29
-        $mergedScope = $tagScope | $tpl->scope;
30
-        if ($mergedScope) {
31
-            if ($mergedScope & Smarty::SCOPE_GLOBAL && $varName) {
32
-                Smarty::$global_tpl_vars[ $varName ] = $tpl->tpl_vars[ $varName ];
33
-            }
34
-            // update scopes
35
-            foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
36
-                $this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
37
-                if($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
38
-                    $this->_updateVarStack($ptr, $varName);              }
39
-            }
40
-        }
41
-    }
14
+	/**
15
+	 * Update new assigned template or config variable in other effected scopes
16
+	 *
17
+	 * @param Smarty_Internal_Template $tpl     data object
18
+	 * @param string|null              $varName variable name
19
+	 * @param int                      $tagScope   tag scope to which bubble up variable value
20
+	 *
21
+	 */
22
+	public function _updateScope(Smarty_Internal_Template $tpl, $varName, $tagScope = 0)
23
+	{
24
+		if ($tagScope) {
25
+			$this->_updateVarStack($tpl, $varName);
26
+			$tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
27
+			if (!$tpl->scope && !$tagScope) return;
28
+		}
29
+		$mergedScope = $tagScope | $tpl->scope;
30
+		if ($mergedScope) {
31
+			if ($mergedScope & Smarty::SCOPE_GLOBAL && $varName) {
32
+				Smarty::$global_tpl_vars[ $varName ] = $tpl->tpl_vars[ $varName ];
33
+			}
34
+			// update scopes
35
+			foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
36
+				$this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
37
+				if($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
38
+					$this->_updateVarStack($ptr, $varName);              }
39
+			}
40
+		}
41
+	}
42 42
 
43
-    /**
44
-     * Get array of objects which needs to be updated  by given scope value
45
-     *
46
-     * @param Smarty_Internal_Template $tpl
47
-     * @param int                      $mergedScope merged tag and template scope to which bubble up variable value
48
-     *
49
-     * @return array
50
-     */
51
-    public function _getAffectedScopes(Smarty_Internal_Template $tpl, $mergedScope)
52
-    {
53
-        $_stack = array();
54
-        $ptr = $tpl->parent;
55
-        if ($mergedScope && isset($ptr) && $ptr->_objType == 2) {
56
-            $_stack[] = $ptr;
57
-            $mergedScope = $mergedScope & ~Smarty::SCOPE_PARENT;
58
-            if (!$mergedScope) {
59
-                // only parent was set, we are done
60
-                return $_stack;
61
-            }
62
-            $ptr = $ptr->parent;
63
-        }
64
-        while (isset($ptr) && $ptr->_objType == 2) {
65
-                $_stack[] = $ptr;
66
-             $ptr = $ptr->parent;
67
-        }
68
-        if ($mergedScope & Smarty::SCOPE_SMARTY) {
69
-            if (isset($tpl->smarty)) {
70
-                $_stack[] = $tpl->smarty;
71
-            }
72
-        } elseif ($mergedScope & Smarty::SCOPE_ROOT) {
73
-            while (isset($ptr)) {
74
-                if ($ptr->_objType != 2) {
75
-                    $_stack[] = $ptr;
76
-                    break;
77
-                }
78
-                $ptr = $ptr->parent;
79
-            }
80
-        }
81
-        return $_stack;
82
-    }
43
+	/**
44
+	 * Get array of objects which needs to be updated  by given scope value
45
+	 *
46
+	 * @param Smarty_Internal_Template $tpl
47
+	 * @param int                      $mergedScope merged tag and template scope to which bubble up variable value
48
+	 *
49
+	 * @return array
50
+	 */
51
+	public function _getAffectedScopes(Smarty_Internal_Template $tpl, $mergedScope)
52
+	{
53
+		$_stack = array();
54
+		$ptr = $tpl->parent;
55
+		if ($mergedScope && isset($ptr) && $ptr->_objType == 2) {
56
+			$_stack[] = $ptr;
57
+			$mergedScope = $mergedScope & ~Smarty::SCOPE_PARENT;
58
+			if (!$mergedScope) {
59
+				// only parent was set, we are done
60
+				return $_stack;
61
+			}
62
+			$ptr = $ptr->parent;
63
+		}
64
+		while (isset($ptr) && $ptr->_objType == 2) {
65
+				$_stack[] = $ptr;
66
+			 $ptr = $ptr->parent;
67
+		}
68
+		if ($mergedScope & Smarty::SCOPE_SMARTY) {
69
+			if (isset($tpl->smarty)) {
70
+				$_stack[] = $tpl->smarty;
71
+			}
72
+		} elseif ($mergedScope & Smarty::SCOPE_ROOT) {
73
+			while (isset($ptr)) {
74
+				if ($ptr->_objType != 2) {
75
+					$_stack[] = $ptr;
76
+					break;
77
+				}
78
+				$ptr = $ptr->parent;
79
+			}
80
+		}
81
+		return $_stack;
82
+	}
83 83
 
84
-    /**
85
-     * Update varibale in other scope
86
-     *
87
-     * @param array     $tpl_vars template variable array
88
-     * @param \Smarty_Internal_Template $from
89
-     * @param string               $varName variable name
90
-     */
91
-    public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName)
92
-    {
93
-        if (!isset($tpl_vars[ $varName ])) {
94
-            $tpl_vars[ $varName ] = clone $from->tpl_vars[ $varName ];
95
-        } else {
96
-            $tpl_vars[ $varName ] = clone $tpl_vars[ $varName ];
97
-            $tpl_vars[ $varName ]->value = $from->tpl_vars[ $varName ]->value;
98
-        }
99
-    }
84
+	/**
85
+	 * Update varibale in other scope
86
+	 *
87
+	 * @param array     $tpl_vars template variable array
88
+	 * @param \Smarty_Internal_Template $from
89
+	 * @param string               $varName variable name
90
+	 */
91
+	public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName)
92
+	{
93
+		if (!isset($tpl_vars[ $varName ])) {
94
+			$tpl_vars[ $varName ] = clone $from->tpl_vars[ $varName ];
95
+		} else {
96
+			$tpl_vars[ $varName ] = clone $tpl_vars[ $varName ];
97
+			$tpl_vars[ $varName ]->value = $from->tpl_vars[ $varName ]->value;
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     * Update variable in template local variable stack
103
-     *
104
-     * @param \Smarty_Internal_Template $tpl
105
-     * @param string|null               $varName variable name or null for config variables
106
-     */
107
-    public function _updateVarStack(Smarty_Internal_Template $tpl, $varName)
108
-    {
109
-        $i = 0;
110
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
111
-            $this->_updateVariableInOtherScope($tpl->_cache[ 'varStack' ][ $i ][ 'tpl' ], $tpl, $varName);
112
-            $i ++;
113
-        }
114
-    }
101
+	/**
102
+	 * Update variable in template local variable stack
103
+	 *
104
+	 * @param \Smarty_Internal_Template $tpl
105
+	 * @param string|null               $varName variable name or null for config variables
106
+	 */
107
+	public function _updateVarStack(Smarty_Internal_Template $tpl, $varName)
108
+	{
109
+		$i = 0;
110
+		while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
111
+			$this->_updateVariableInOtherScope($tpl->_cache[ 'varStack' ][ $i ][ 'tpl' ], $tpl, $varName);
112
+			$i ++;
113
+		}
114
+	}
115 115
 }
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
         $mergedScope = $tagScope | $tpl->scope;
30 30
         if ($mergedScope) {
31 31
             if ($mergedScope & Smarty::SCOPE_GLOBAL && $varName) {
32
-                Smarty::$global_tpl_vars[ $varName ] = $tpl->tpl_vars[ $varName ];
32
+                Smarty::$global_tpl_vars[$varName] = $tpl->tpl_vars[$varName];
33 33
             }
34 34
             // update scopes
35 35
             foreach ($this->_getAffectedScopes($tpl, $mergedScope) as $ptr) {
36 36
                 $this->_updateVariableInOtherScope($ptr->tpl_vars, $tpl, $varName);
37
-                if($tagScope && $ptr->_objType == 2 && isset($tpl->_cache[ 'varStack' ])) {
38
-                    $this->_updateVarStack($ptr, $varName);              }
37
+                if ($tagScope && $ptr->_objType == 2 && isset($tpl->_cache['varStack'])) {
38
+                    $this->_updateVarStack($ptr, $varName); }
39 39
             }
40 40
         }
41 41
     }
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
      */
91 91
     public function _updateVariableInOtherScope(&$tpl_vars, Smarty_Internal_Template $from, $varName)
92 92
     {
93
-        if (!isset($tpl_vars[ $varName ])) {
94
-            $tpl_vars[ $varName ] = clone $from->tpl_vars[ $varName ];
93
+        if (!isset($tpl_vars[$varName])) {
94
+            $tpl_vars[$varName] = clone $from->tpl_vars[$varName];
95 95
         } else {
96
-            $tpl_vars[ $varName ] = clone $tpl_vars[ $varName ];
97
-            $tpl_vars[ $varName ]->value = $from->tpl_vars[ $varName ]->value;
96
+            $tpl_vars[$varName] = clone $tpl_vars[$varName];
97
+            $tpl_vars[$varName]->value = $from->tpl_vars[$varName]->value;
98 98
         }
99 99
     }
100 100
 
@@ -107,9 +107,9 @@  discard block
 block discarded – undo
107 107
     public function _updateVarStack(Smarty_Internal_Template $tpl, $varName)
108 108
     {
109 109
         $i = 0;
110
-        while (isset($tpl->_cache[ 'varStack' ][ $i ])) {
111
-            $this->_updateVariableInOtherScope($tpl->_cache[ 'varStack' ][ $i ][ 'tpl' ], $tpl, $varName);
112
-            $i ++;
110
+        while (isset($tpl->_cache['varStack'][$i])) {
111
+            $this->_updateVariableInOtherScope($tpl->_cache['varStack'][$i]['tpl'], $tpl, $varName);
112
+            $i++;
113 113
         }
114 114
     }
115 115
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@
 block discarded – undo
24 24
         if ($tagScope) {
25 25
             $this->_updateVarStack($tpl, $varName);
26 26
             $tagScope = $tagScope & ~Smarty::SCOPE_LOCAL;
27
-            if (!$tpl->scope && !$tagScope) return;
27
+            if (!$tpl->scope && !$tagScope) {
28
+            	return;
29
+            }
28 30
         }
29 31
         $mergedScope = $tagScope | $tpl->scope;
30 32
         if ($mergedScope) {
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_resource_php.php 2 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -11,97 +11,97 @@
 block discarded – undo
11 11
  */
12 12
 class Smarty_Internal_Resource_Php extends Smarty_Internal_Resource_File
13 13
 {
14
-    /**
15
-     * Flag that it's an uncompiled resource
16
-     *
17
-     * @var bool
18
-     */
19
-    public $uncompiled = true;
14
+	/**
15
+	 * Flag that it's an uncompiled resource
16
+	 *
17
+	 * @var bool
18
+	 */
19
+	public $uncompiled = true;
20 20
 
21
-    /**
22
-     * container for short_open_tag directive's value before executing PHP templates
23
-     *
24
-     * @var string
25
-     */
26
-    protected $short_open_tag;
21
+	/**
22
+	 * container for short_open_tag directive's value before executing PHP templates
23
+	 *
24
+	 * @var string
25
+	 */
26
+	protected $short_open_tag;
27 27
 
28
-    /**
29
-     * Resource does implement populateCompiledFilepath() method
30
-     *
31
-     * @var bool
32
-     */
33
-    public $hasCompiledHandler = true;
28
+	/**
29
+	 * Resource does implement populateCompiledFilepath() method
30
+	 *
31
+	 * @var bool
32
+	 */
33
+	public $hasCompiledHandler = true;
34 34
 
35
-    /**
36
-     * Create a new PHP Resource
37
-     */
38
-    public function __construct()
39
-    {
40
-        $this->short_open_tag = ini_get('short_open_tag');
41
-    }
35
+	/**
36
+	 * Create a new PHP Resource
37
+	 */
38
+	public function __construct()
39
+	{
40
+		$this->short_open_tag = ini_get('short_open_tag');
41
+	}
42 42
 
43
-    /**
44
-     * Load template's source from file into current template object
45
-     *
46
-     * @param  Smarty_Template_Source $source source object
47
-     *
48
-     * @return string                 template source
49
-     * @throws SmartyException        if source cannot be loaded
50
-     */
51
-    public function getContent(Smarty_Template_Source $source)
52
-    {
53
-        if ($source->exists) {
54
-            return '';
55
-        }
56
-        throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
57
-    }
43
+	/**
44
+	 * Load template's source from file into current template object
45
+	 *
46
+	 * @param  Smarty_Template_Source $source source object
47
+	 *
48
+	 * @return string                 template source
49
+	 * @throws SmartyException        if source cannot be loaded
50
+	 */
51
+	public function getContent(Smarty_Template_Source $source)
52
+	{
53
+		if ($source->exists) {
54
+			return '';
55
+		}
56
+		throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
57
+	}
58 58
 
59
-    /**
60
-     * Render and output the template (without using the compiler)
61
-     *
62
-     * @param  Smarty_Template_Source   $source    source object
63
-     * @param  Smarty_Internal_Template $_template template object
64
-     *
65
-     * @return void
66
-     * @throws SmartyException          if template cannot be loaded or allow_php_templates is disabled
67
-     */
68
-    public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
69
-    {
70
-        if (!$source->smarty->allow_php_templates) {
71
-            throw new SmartyException("PHP templates are disabled");
72
-        }
73
-        if (!$source->exists) {
74
-            $parentIsTpl = isset($this->parent) && $this->parent->_objType == 2;
75
-            throw new SmartyException("Unable to load template {$source->type} '{$source->name}'" .
76
-                                      ($parentIsTpl ? " in '{$this->parent->template_resource}'" : ''));
77
-        }
59
+	/**
60
+	 * Render and output the template (without using the compiler)
61
+	 *
62
+	 * @param  Smarty_Template_Source   $source    source object
63
+	 * @param  Smarty_Internal_Template $_template template object
64
+	 *
65
+	 * @return void
66
+	 * @throws SmartyException          if template cannot be loaded or allow_php_templates is disabled
67
+	 */
68
+	public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
69
+	{
70
+		if (!$source->smarty->allow_php_templates) {
71
+			throw new SmartyException("PHP templates are disabled");
72
+		}
73
+		if (!$source->exists) {
74
+			$parentIsTpl = isset($this->parent) && $this->parent->_objType == 2;
75
+			throw new SmartyException("Unable to load template {$source->type} '{$source->name}'" .
76
+									  ($parentIsTpl ? " in '{$this->parent->template_resource}'" : ''));
77
+		}
78 78
 
79
-        // prepare variables
80
-        extract($_template->getTemplateVars());
79
+		// prepare variables
80
+		extract($_template->getTemplateVars());
81 81
 
82
-        // include PHP template with short open tags enabled
83
-        ini_set('short_open_tag', '1');
84
-        /** @var Smarty_Internal_Template $_smarty_template
85
-         * used in included file
86
-         */
87
-        $_smarty_template = $_template;
88
-        include($source->filepath);
89
-        ini_set('short_open_tag', $this->short_open_tag);
90
-    }
82
+		// include PHP template with short open tags enabled
83
+		ini_set('short_open_tag', '1');
84
+		/** @var Smarty_Internal_Template $_smarty_template
85
+		 * used in included file
86
+		 */
87
+		$_smarty_template = $_template;
88
+		include($source->filepath);
89
+		ini_set('short_open_tag', $this->short_open_tag);
90
+	}
91 91
 
92
-    /**
93
-     * populate compiled object with compiled filepath
94
-     *
95
-     * @param Smarty_Template_Compiled $compiled  compiled object
96
-     * @param Smarty_Internal_Template $_template template object (is ignored)
97
-     */
98
-    public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
99
-    {
100
-        $compiled->filepath = $_template->source->filepath;
101
-        $compiled->timestamp = $_template->source->timestamp;
102
-        $compiled->exists = $_template->source->exists;
103
-        $compiled->file_dependency[ $_template->source->uid ] =
104
-            array($compiled->filepath, $compiled->timestamp,
105
-                  $_template->source->type,);
106
-    }
92
+	/**
93
+	 * populate compiled object with compiled filepath
94
+	 *
95
+	 * @param Smarty_Template_Compiled $compiled  compiled object
96
+	 * @param Smarty_Internal_Template $_template template object (is ignored)
97
+	 */
98
+	public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
99
+	{
100
+		$compiled->filepath = $_template->source->filepath;
101
+		$compiled->timestamp = $_template->source->timestamp;
102
+		$compiled->exists = $_template->source->exists;
103
+		$compiled->file_dependency[ $_template->source->uid ] =
104
+			array($compiled->filepath, $compiled->timestamp,
105
+				  $_template->source->type,);
106
+	}
107 107
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,7 @@
 block discarded – undo
100 100
         $compiled->filepath = $_template->source->filepath;
101 101
         $compiled->timestamp = $_template->source->timestamp;
102 102
         $compiled->exists = $_template->source->exists;
103
-        $compiled->file_dependency[ $_template->source->uid ] =
103
+        $compiled->file_dependency[$_template->source->uid] =
104 104
             array($compiled->filepath, $compiled->timestamp,
105 105
                   $_template->source->type,);
106 106
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/sysplugins/smarty_internal_resource_extends.php 2 patches
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -17,108 +17,108 @@
 block discarded – undo
17 17
  */
18 18
 class Smarty_Internal_Resource_Extends extends Smarty_Resource
19 19
 {
20
-    /**
21
-     * mbstring.overload flag
22
-     *
23
-     * @var int
24
-     */
25
-    public $mbstring_overload = 0;
20
+	/**
21
+	 * mbstring.overload flag
22
+	 *
23
+	 * @var int
24
+	 */
25
+	public $mbstring_overload = 0;
26 26
 
27
-    /**
28
-     * populate Source Object with meta data from Resource
29
-     *
30
-     * @param Smarty_Template_Source   $source    source object
31
-     * @param Smarty_Internal_Template $_template template object
32
-     *
33
-     * @throws SmartyException
34
-     */
35
-    public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
36
-    {
37
-        $uid = '';
38
-        $sources = array();
39
-        $components = explode('|', $source->name);
40
-        $exists = true;
41
-        foreach ($components as $component) {
42
-            /* @var \Smarty_Template_Source $_s */
43
-            $_s = Smarty_Template_Source::load(null, $source->smarty, $component);
44
-            if ($_s->type == 'php') {
45
-                throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
46
-            }
47
-            $sources[ $_s->uid ] = $_s;
48
-            $uid .= $_s->filepath;
49
-            if ($_template) {
50
-                $exists = $exists && $_s->exists;
51
-            }
52
-        }
53
-        $source->components = $sources;
54
-        $source->filepath = $_s->filepath;
55
-        $source->uid = sha1($uid . $source->smarty->_joined_template_dir);
56
-        $source->exists = $exists;
57
-        if ($_template) {
58
-            $source->timestamp = $_s->timestamp;
59
-        }
60
-    }
27
+	/**
28
+	 * populate Source Object with meta data from Resource
29
+	 *
30
+	 * @param Smarty_Template_Source   $source    source object
31
+	 * @param Smarty_Internal_Template $_template template object
32
+	 *
33
+	 * @throws SmartyException
34
+	 */
35
+	public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
36
+	{
37
+		$uid = '';
38
+		$sources = array();
39
+		$components = explode('|', $source->name);
40
+		$exists = true;
41
+		foreach ($components as $component) {
42
+			/* @var \Smarty_Template_Source $_s */
43
+			$_s = Smarty_Template_Source::load(null, $source->smarty, $component);
44
+			if ($_s->type == 'php') {
45
+				throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
46
+			}
47
+			$sources[ $_s->uid ] = $_s;
48
+			$uid .= $_s->filepath;
49
+			if ($_template) {
50
+				$exists = $exists && $_s->exists;
51
+			}
52
+		}
53
+		$source->components = $sources;
54
+		$source->filepath = $_s->filepath;
55
+		$source->uid = sha1($uid . $source->smarty->_joined_template_dir);
56
+		$source->exists = $exists;
57
+		if ($_template) {
58
+			$source->timestamp = $_s->timestamp;
59
+		}
60
+	}
61 61
 
62
-    /**
63
-     * populate Source Object with timestamp and exists from Resource
64
-     *
65
-     * @param Smarty_Template_Source $source source object
66
-     */
67
-    public function populateTimestamp(Smarty_Template_Source $source)
68
-    {
69
-        $source->exists = true;
70
-        /* @var \Smarty_Template_Source $_s */
71
-        foreach ($source->components as $_s) {
72
-            $source->exists = $source->exists && $_s->exists;
73
-        }
74
-        $source->timestamp = $source->exists ? $_s->getTimeStamp() : false;
75
-    }
62
+	/**
63
+	 * populate Source Object with timestamp and exists from Resource
64
+	 *
65
+	 * @param Smarty_Template_Source $source source object
66
+	 */
67
+	public function populateTimestamp(Smarty_Template_Source $source)
68
+	{
69
+		$source->exists = true;
70
+		/* @var \Smarty_Template_Source $_s */
71
+		foreach ($source->components as $_s) {
72
+			$source->exists = $source->exists && $_s->exists;
73
+		}
74
+		$source->timestamp = $source->exists ? $_s->getTimeStamp() : false;
75
+	}
76 76
 
77
-    /**
78
-     * Load template's source from files into current template object
79
-     *
80
-     * @param Smarty_Template_Source $source source object
81
-     *
82
-     * @return string template source
83
-     * @throws SmartyException if source cannot be loaded
84
-     */
85
-    public function getContent(Smarty_Template_Source $source)
86
-    {
87
-        if (!$source->exists) {
88
-            throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
89
-        }
77
+	/**
78
+	 * Load template's source from files into current template object
79
+	 *
80
+	 * @param Smarty_Template_Source $source source object
81
+	 *
82
+	 * @return string template source
83
+	 * @throws SmartyException if source cannot be loaded
84
+	 */
85
+	public function getContent(Smarty_Template_Source $source)
86
+	{
87
+		if (!$source->exists) {
88
+			throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
89
+		}
90 90
 
91
-        $_components = array_reverse($source->components);
91
+		$_components = array_reverse($source->components);
92 92
 
93
-        $_content = '';
94
-        /* @var \Smarty_Template_Source $_s */
95
-        foreach ($_components as $_s) {
96
-            // read content
97
-            $_content .= $_s->getContent();
98
-        }
99
-        return $_content;
100
-    }
93
+		$_content = '';
94
+		/* @var \Smarty_Template_Source $_s */
95
+		foreach ($_components as $_s) {
96
+			// read content
97
+			$_content .= $_s->getContent();
98
+		}
99
+		return $_content;
100
+	}
101 101
 
102
-    /**
103
-     * Determine basename for compiled filename
104
-     *
105
-     * @param Smarty_Template_Source $source source object
106
-     *
107
-     * @return string resource's basename
108
-     */
109
-    public function getBasename(Smarty_Template_Source $source)
110
-    {
111
-        return str_replace(':', '.', basename($source->filepath));
112
-    }
102
+	/**
103
+	 * Determine basename for compiled filename
104
+	 *
105
+	 * @param Smarty_Template_Source $source source object
106
+	 *
107
+	 * @return string resource's basename
108
+	 */
109
+	public function getBasename(Smarty_Template_Source $source)
110
+	{
111
+		return str_replace(':', '.', basename($source->filepath));
112
+	}
113 113
 
114
-    /*
114
+	/*
115 115
       * Disable timestamp checks for extends resource.
116 116
       * The individual source components will be checked.
117 117
       *
118 118
       * @return bool
119 119
       */
120
-    public function checkTimestamps()
121
-    {
122
-        return false;
123
-    }
120
+	public function checkTimestamps()
121
+	{
122
+		return false;
123
+	}
124 124
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
             if ($_s->type == 'php') {
45 45
                 throw new SmartyException("Resource type {$_s->type} cannot be used with the extends resource type");
46 46
             }
47
-            $sources[ $_s->uid ] = $_s;
47
+            $sources[$_s->uid] = $_s;
48 48
             $uid .= $_s->filepath;
49 49
             if ($_template) {
50 50
                 $exists = $exists && $_s->exists;
Please login to merge, or discard this patch.