Completed
Push — 1.2 ( 261ddf...fd7ca1 )
by David
15:45 queued 09:58
created
lib/Dwoo/Adapters/CakePHP/dwoo.php 1 patch
Indentation   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -42,118 +42,118 @@
 block discarded – undo
42 42
  */
43 43
 class DwooView extends View
44 44
 {
45
-    protected $_sv_template_dir;
46
-    protected $_sv_layout_dir;
47
-    protected $_sv_compile_dir;
48
-    protected $_sv_cache_dir;
49
-    protected $_sv_compile_id;
50
-
51
-    protected $_dwoo;
52
-
53
-    public $sv_processedTpl;
45
+	protected $_sv_template_dir;
46
+	protected $_sv_layout_dir;
47
+	protected $_sv_compile_dir;
48
+	protected $_sv_cache_dir;
49
+	protected $_sv_compile_id;
50
+
51
+	protected $_dwoo;
52
+
53
+	public $sv_processedTpl;
54 54
 
55
-    public function __construct(&$controller)
56
-    {
57
-        parent::__construct($controller);
58
-
59
-        $this->ext = '.tpl';
60
-
61
-        $this->_sv_template_dir = array(
62
-            VIEWS.$this->viewPath.DS.$this->subDir,
63
-            VIEWS.$this->viewPath,
64
-            VIEWS,
65
-        );
66
-
67
-        $this->_sv_layout_dir = array(
68
-            LAYOUTS.$this->subDir,
69
-            VIEWS,
70
-        );
71
-
72
-        $this->_sv_compile_dir = TMP.'dwoo'.DS.'compile';
73
-        $this->_sv_cache_dir = TMP.'dwoo'.DS.'cache';
74
-
75
-        $this->_dwoo = new Dwoo_Core($this->_sv_compile_dir, $this->_sv_cache_dir);
76
-
77
-        $this->_sv_compile_id = $controller->name;
78
-
79
-        $this->_dwoo->sv_this = $this;
80
-        $this->_dwoo->setSecurityPolicy();
81
-
82
-        return;
83
-    }
84
-
85
-    /**
86
-     * changes the template directory.
87
-     */
88
-    public function setTemplateDir($path = VIEW)
89
-    {
90
-        $old = $this->_sv_template_dir;
91
-        $this->_sv_template_dir = $path;
92
-
93
-        return $old;
94
-    }
95
-
96
-    public function getTemplateDir()
97
-    {
98
-        return $this->_sv_template_dir;
99
-    }
100
-
101
-    public function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true)
102
-    {
103
-        // let's determine if this is a layout call or a template call
104
-        // and change the template dir accordingly
105
-        $layout = false;
106
-        if (isset($___data_for_view['content_for_layout'])) {
107
-            $this->_sv_template_dir = $this->_sv_layout_dir;
108
-            $layout = true;
109
-        }
110
-
111
-        $tpl = new Dwoo_Template_File($___viewFn);
112
-        $data = $___data_for_view;
113
-
114
-        $data['view'] = $this;
115
-
116
-        if ($this->helpers != false && $loadHelpers === true) {
117
-            $loadedHelpers = array();
118
-            $loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
119
-
120
-            foreach (array_keys($loadedHelpers) as $helper) {
121
-                $camelBackedHelper = strtolower(substr($helper, 0, 1)).substr($helper, 1);
122
-
123
-                ${$camelBackedHelper} = $loadedHelpers[$helper];
124
-
125
-                if (is_array(${$camelBackedHelper}->helpers) && !empty(${$camelBackedHelper}->helpers)) {
126
-                    $subHelpers = ${$camelBackedHelper}->helpers;
127
-                    foreach ($subHelpers as $subHelper) {
128
-                        ${$camelBackedHelper}->{$subHelper} = $loadedHelpers[$subHelper];
129
-                    }
130
-                }
131
-
132
-                if (isset($this->passedArgs)) {
133
-                    ${$camelBackedHelper}->passedArgs = $this->passedArgs;
134
-                }
135
-
136
-                $this->loaded[$camelBackedHelper] = ${$camelBackedHelper};
137
-
138
-                $data[$camelBackedHelper] = ${$camelBackedHelper};
139
-            }
140
-        }
141
-
142
-        if ($this->helpers != false && $loadHelpers === true) {
143
-            foreach ($loadedHelpers as $helper) {
144
-                if (is_object($helper)) {
145
-                    if (is_subclass_of($helper, 'Helper') || is_subclass_of($helper, 'helper')) {
146
-                        $helper->beforeRender();
147
-                    }
148
-                }
149
-            }
150
-        }
151
-
152
-        return $this->_dwoo->get($tpl, $data);
153
-    }
154
-
155
-    public function get()
156
-    {
157
-        return $this->_dwoo;
158
-    }
55
+	public function __construct(&$controller)
56
+	{
57
+		parent::__construct($controller);
58
+
59
+		$this->ext = '.tpl';
60
+
61
+		$this->_sv_template_dir = array(
62
+			VIEWS.$this->viewPath.DS.$this->subDir,
63
+			VIEWS.$this->viewPath,
64
+			VIEWS,
65
+		);
66
+
67
+		$this->_sv_layout_dir = array(
68
+			LAYOUTS.$this->subDir,
69
+			VIEWS,
70
+		);
71
+
72
+		$this->_sv_compile_dir = TMP.'dwoo'.DS.'compile';
73
+		$this->_sv_cache_dir = TMP.'dwoo'.DS.'cache';
74
+
75
+		$this->_dwoo = new Dwoo_Core($this->_sv_compile_dir, $this->_sv_cache_dir);
76
+
77
+		$this->_sv_compile_id = $controller->name;
78
+
79
+		$this->_dwoo->sv_this = $this;
80
+		$this->_dwoo->setSecurityPolicy();
81
+
82
+		return;
83
+	}
84
+
85
+	/**
86
+	 * changes the template directory.
87
+	 */
88
+	public function setTemplateDir($path = VIEW)
89
+	{
90
+		$old = $this->_sv_template_dir;
91
+		$this->_sv_template_dir = $path;
92
+
93
+		return $old;
94
+	}
95
+
96
+	public function getTemplateDir()
97
+	{
98
+		return $this->_sv_template_dir;
99
+	}
100
+
101
+	public function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true)
102
+	{
103
+		// let's determine if this is a layout call or a template call
104
+		// and change the template dir accordingly
105
+		$layout = false;
106
+		if (isset($___data_for_view['content_for_layout'])) {
107
+			$this->_sv_template_dir = $this->_sv_layout_dir;
108
+			$layout = true;
109
+		}
110
+
111
+		$tpl = new Dwoo_Template_File($___viewFn);
112
+		$data = $___data_for_view;
113
+
114
+		$data['view'] = $this;
115
+
116
+		if ($this->helpers != false && $loadHelpers === true) {
117
+			$loadedHelpers = array();
118
+			$loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers);
119
+
120
+			foreach (array_keys($loadedHelpers) as $helper) {
121
+				$camelBackedHelper = strtolower(substr($helper, 0, 1)).substr($helper, 1);
122
+
123
+				${$camelBackedHelper} = $loadedHelpers[$helper];
124
+
125
+				if (is_array(${$camelBackedHelper}->helpers) && !empty(${$camelBackedHelper}->helpers)) {
126
+					$subHelpers = ${$camelBackedHelper}->helpers;
127
+					foreach ($subHelpers as $subHelper) {
128
+						${$camelBackedHelper}->{$subHelper} = $loadedHelpers[$subHelper];
129
+					}
130
+				}
131
+
132
+				if (isset($this->passedArgs)) {
133
+					${$camelBackedHelper}->passedArgs = $this->passedArgs;
134
+				}
135
+
136
+				$this->loaded[$camelBackedHelper] = ${$camelBackedHelper};
137
+
138
+				$data[$camelBackedHelper] = ${$camelBackedHelper};
139
+			}
140
+		}
141
+
142
+		if ($this->helpers != false && $loadHelpers === true) {
143
+			foreach ($loadedHelpers as $helper) {
144
+				if (is_object($helper)) {
145
+					if (is_subclass_of($helper, 'Helper') || is_subclass_of($helper, 'helper')) {
146
+						$helper->beforeRender();
147
+					}
148
+				}
149
+			}
150
+		}
151
+
152
+		return $this->_dwoo->get($tpl, $data);
153
+	}
154
+
155
+	public function get()
156
+	{
157
+		return $this->_dwoo;
158
+	}
159 159
 }
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/Agavi/dwoo_plugins/t.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,5 +16,5 @@
 block discarded – undo
16 16
  */
17 17
 function Dwoo_Plugin_t_compile(Dwoo_Compiler $compiler, $string)
18 18
 {
19
-    return '$this->data[\'tm\']->_('.$string.')';
19
+	return '$this->data[\'tm\']->_('.$string.')';
20 20
 }
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/Agavi/dwoo_plugins/url.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@
 block discarded – undo
16 16
  */
17 17
 function Dwoo_Plugin_url_compile(Dwoo_Compiler $compiler, $route = null, $params = null, $options = null, array $rest = array())
18 18
 {
19
-    if ($params == 'null') {
20
-        if (count($rest)) {
21
-            $params = array();
22
-            foreach ($rest as $k => $v) {
23
-                if (is_numeric($k)) {
24
-                    $params[] = $k.'=>'.$v;
25
-                } else {
26
-                    $params[] = '"'.$k.'"=>'.$v;
27
-                }
28
-            }
29
-            $params = 'array('.implode(', ', $params).')';
30
-        } else {
31
-            $params = 'array()';
32
-        }
33
-    }
34
-    if ($options == 'null') {
35
-        $options = 'array()';
36
-    }
19
+	if ($params == 'null') {
20
+		if (count($rest)) {
21
+			$params = array();
22
+			foreach ($rest as $k => $v) {
23
+				if (is_numeric($k)) {
24
+					$params[] = $k.'=>'.$v;
25
+				} else {
26
+					$params[] = '"'.$k.'"=>'.$v;
27
+				}
28
+			}
29
+			$params = 'array('.implode(', ', $params).')';
30
+		} else {
31
+			$params = 'array()';
32
+		}
33
+	}
34
+	if ($options == 'null') {
35
+		$options = 'array()';
36
+	}
37 37
 
38
-    return '$this->data[\'ro\']->gen('.$route.', '.$params.', '.$options.')';
38
+	return '$this->data[\'ro\']->gen('.$route.', '.$params.', '.$options.')';
39 39
 }
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/CodeIgniter/controllers/dwoowelcome.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -16,15 +16,15 @@
 block discarded – undo
16 16
 
17 17
 class dwoowelcome extends Controller
18 18
 {
19
-    public function __construct()
20
-    {
21
-        parent::Controller();
22
-    }
19
+	public function __construct()
20
+	{
21
+		parent::Controller();
22
+	}
23 23
 
24
-    public function index()
25
-    {
26
-        $this->load->library('Dwootemplate');
27
-        $this->dwootemplate->assign('itshowlate', date('H:i:s'));
28
-        $this->dwootemplate->display('dwoowelcome.tpl');
29
-    }
24
+	public function index()
25
+	{
26
+		$this->load->library('Dwootemplate');
27
+		$this->dwootemplate->assign('itshowlate', date('H:i:s'));
28
+		$this->dwootemplate->display('dwoowelcome.tpl');
29
+	}
30 30
 }
Please login to merge, or discard this patch.
lib/Dwoo/Plugin.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -79,24 +79,24 @@
 block discarded – undo
79 79
 
80 80
         $out = '';
81 81
         foreach ($params as $attr => $val) {
82
-            $out .= ' ' . $attr . '=';
82
+            $out .= ' '.$attr.'=';
83 83
             if (trim($val, '"\'') == '' || $val == 'null') {
84
-                $out .= str_replace($delim, '\\' . $delim, '""');
84
+                $out .= str_replace($delim, '\\'.$delim, '""');
85 85
             } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
86
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
86
+                $out .= str_replace($delim, '\\'.$delim, '"'.substr($val, 1, - 1).'"');
87 87
             } else {
88 88
                 if (!$compiler) {
89 89
                     // disable double encoding since it can not be determined if it was encoded
90
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
90
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
91 91
                 } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
92 92
                     // escape if auto escaping is disabled, or there was no variable in the string
93
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
93
+                    $escapedVal = '.(is_string($tmp2='.$val.') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
94 94
                 } else {
95 95
                     // print as is
96
-                    $escapedVal = '.' . $val . '.';
96
+                    $escapedVal = '.'.$val.'.';
97 97
                 }
98 98
 
99
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
99
+                $out .= str_replace($delim, '\\'.$delim, '"').$delim.$escapedVal.$delim.str_replace($delim, '\\'.$delim, '"');
100 100
             }
101 101
         }
102 102
 
Please login to merge, or discard this patch.
Indentation   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -20,81 +20,81 @@
 block discarded – undo
20 20
  */
21 21
 abstract class Dwoo_Plugin
22 22
 {
23
-    /**
24
-     * The dwoo instance that runs this plugin.
25
-     *
26
-     * @var Dwoo
27
-     */
28
-    protected $dwoo;
23
+	/**
24
+	 * The dwoo instance that runs this plugin.
25
+	 *
26
+	 * @var Dwoo
27
+	 */
28
+	protected $dwoo;
29 29
 
30
-    /**
31
-     * Constructor, if you override it, call parent::__construct($dwoo); or assign
32
-     * the dwoo instance yourself if you need it.
33
-     *
34
-     * @param Dwoo_Core $dwoo the dwoo instance that runs this plugin
35
-     */
36
-    public function __construct(Dwoo_Core $dwoo)
37
-    {
38
-        $this->dwoo = $dwoo;
39
-    }
30
+	/**
31
+	 * Constructor, if you override it, call parent::__construct($dwoo); or assign
32
+	 * the dwoo instance yourself if you need it.
33
+	 *
34
+	 * @param Dwoo_Core $dwoo the dwoo instance that runs this plugin
35
+	 */
36
+	public function __construct(Dwoo_Core $dwoo)
37
+	{
38
+		$this->dwoo = $dwoo;
39
+	}
40 40
 
41
-    // plugins should always implement :
42
-    // public function process($arg, $arg, ...)
43
-    // or for block plugins :
44
-    // public function init($arg, $arg, ...)
41
+	// plugins should always implement :
42
+	// public function process($arg, $arg, ...)
43
+	// or for block plugins :
44
+	// public function init($arg, $arg, ...)
45 45
 
46
-    // this could be enforced with :
47
-    // abstract public function process(...);
48
-    // if my feature request gets enough interest one day
49
-    // see => http://bugs.php.net/bug.php?id=44043
46
+	// this could be enforced with :
47
+	// abstract public function process(...);
48
+	// if my feature request gets enough interest one day
49
+	// see => http://bugs.php.net/bug.php?id=44043
50 50
 
51
-    /**
52
-     * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag
53
-     * attributes. this is to be used in preProcessing or postProcessing functions, example :
54
-     *  $p = $compiler->getCompiledParams($params);
55
-     *  // get only the rest array as attributes
56
-     *  $attributes = Dwoo_Plugin::paramsToAttributes($p['*']);
57
-     *  // get all the parameters as attributes (if there is a rest array, it will be included)
58
-     *  $attributes = Dwoo_Plugin::paramsToAttributes($p);
59
-     *
60
-     * @param array         $params   an array of attributeName=>value items that will be compiled to be ready for
61
-     *                                inclusion in a php string
62
-     * @param string        $delim    the string delimiter you want to use (defaults to ')
63
-     * @param Dwoo_Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper
64
-     *                                escaping behavior)
65
-     *
66
-     * @return string
67
-     */
68
-    public static function paramsToAttributes(array $params, $delim = '\'', Dwoo_Compiler $compiler = null)
69
-    {
70
-        if (isset($params['*'])) {
71
-            $params = array_merge($params, $params['*']);
72
-            unset($params['*']);
73
-        }
51
+	/**
52
+	 * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag
53
+	 * attributes. this is to be used in preProcessing or postProcessing functions, example :
54
+	 *  $p = $compiler->getCompiledParams($params);
55
+	 *  // get only the rest array as attributes
56
+	 *  $attributes = Dwoo_Plugin::paramsToAttributes($p['*']);
57
+	 *  // get all the parameters as attributes (if there is a rest array, it will be included)
58
+	 *  $attributes = Dwoo_Plugin::paramsToAttributes($p);
59
+	 *
60
+	 * @param array         $params   an array of attributeName=>value items that will be compiled to be ready for
61
+	 *                                inclusion in a php string
62
+	 * @param string        $delim    the string delimiter you want to use (defaults to ')
63
+	 * @param Dwoo_Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper
64
+	 *                                escaping behavior)
65
+	 *
66
+	 * @return string
67
+	 */
68
+	public static function paramsToAttributes(array $params, $delim = '\'', Dwoo_Compiler $compiler = null)
69
+	{
70
+		if (isset($params['*'])) {
71
+			$params = array_merge($params, $params['*']);
72
+			unset($params['*']);
73
+		}
74 74
 
75
-        $out = '';
76
-        foreach ($params as $attr => $val) {
77
-            $out .= ' ' . $attr . '=';
78
-            if (trim($val, '"\'') == '' || $val == 'null') {
79
-                $out .= str_replace($delim, '\\' . $delim, '""');
80
-            } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
81
-                $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
82
-            } else {
83
-                if (!$compiler) {
84
-                    // disable double encoding since it can not be determined if it was encoded
85
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
86
-                } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
87
-                    // escape if auto escaping is disabled, or there was no variable in the string
88
-                    $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
89
-                } else {
90
-                    // print as is
91
-                    $escapedVal = '.' . $val . '.';
92
-                }
75
+		$out = '';
76
+		foreach ($params as $attr => $val) {
77
+			$out .= ' ' . $attr . '=';
78
+			if (trim($val, '"\'') == '' || $val == 'null') {
79
+				$out .= str_replace($delim, '\\' . $delim, '""');
80
+			} elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) {
81
+				$out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"');
82
+			} else {
83
+				if (!$compiler) {
84
+					// disable double encoding since it can not be determined if it was encoded
85
+					$escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).';
86
+				} elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) {
87
+					// escape if auto escaping is disabled, or there was no variable in the string
88
+					$escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).';
89
+				} else {
90
+					// print as is
91
+					$escapedVal = '.' . $val . '.';
92
+				}
93 93
 
94
-                $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
95
-            }
96
-        }
94
+				$out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"');
95
+			}
96
+		}
97 97
 
98
-        return ltrim($out);
99
-    }
98
+		return ltrim($out);
99
+	}
100 100
 }
Please login to merge, or discard this patch.
lib/Dwoo/IDataProvider.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@
 block discarded – undo
19 19
  */
20 20
 interface Dwoo_IDataProvider
21 21
 {
22
-    /**
23
-     * returns the data as an associative array that will be used in the template.
24
-     *
25
-     * @return array
26
-     */
27
-    public function getData();
22
+	/**
23
+	 * returns the data as an associative array that will be used in the template.
24
+	 *
25
+	 * @return array
26
+	 */
27
+	public function getData();
28 28
 }
Please login to merge, or discard this patch.
lib/Dwoo/Filter.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,30 +18,30 @@
 block discarded – undo
18 18
  */
19 19
 abstract class Dwoo_Filter
20 20
 {
21
-    /**
22
-     * The dwoo instance that runs this filter.
23
-     *
24
-     * @var Dwoo
25
-     */
26
-    protected $dwoo;
21
+	/**
22
+	 * The dwoo instance that runs this filter.
23
+	 *
24
+	 * @var Dwoo
25
+	 */
26
+	protected $dwoo;
27 27
 
28
-    /**
29
-     * Constructor, if you override it, call parent::__construct($dwoo); or assign
30
-     * the dwoo instance yourself if you need it.
31
-     *
32
-     * @param Dwoo_Core $dwoo the dwoo instance that runs this plugin
33
-     */
34
-    public function __construct(Dwoo_Core $dwoo)
35
-    {
36
-        $this->dwoo = $dwoo;
37
-    }
28
+	/**
29
+	 * Constructor, if you override it, call parent::__construct($dwoo); or assign
30
+	 * the dwoo instance yourself if you need it.
31
+	 *
32
+	 * @param Dwoo_Core $dwoo the dwoo instance that runs this plugin
33
+	 */
34
+	public function __construct(Dwoo_Core $dwoo)
35
+	{
36
+		$this->dwoo = $dwoo;
37
+	}
38 38
 
39
-    /**
40
-     * Processes the input and returns it filtered.
41
-     *
42
-     * @param string $input the template to process
43
-     *
44
-     * @return string
45
-     */
46
-    abstract public function process($input);
39
+	/**
40
+	 * Processes the input and returns it filtered.
41
+	 *
42
+	 * @param string $input the template to process
43
+	 *
44
+	 * @return string
45
+	 */
46
+	abstract public function process($input);
47 47
 }
Please login to merge, or discard this patch.
lib/Dwoo/Loader.php 2 patches
Indentation   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -19,143 +19,143 @@
 block discarded – undo
19 19
  */
20 20
 class Dwoo_Loader implements Dwoo_ILoader
21 21
 {
22
-    /**
23
-     * stores the plugin directories.
24
-     *
25
-     * @see addDirectory
26
-     *
27
-     * @var array
28
-     */
29
-    protected $paths = array();
22
+	/**
23
+	 * stores the plugin directories.
24
+	 *
25
+	 * @see addDirectory
26
+	 *
27
+	 * @var array
28
+	 */
29
+	protected $paths = array();
30 30
 
31
-    /**
32
-     * stores the plugins names/paths relationships
33
-     * don't edit this on your own, use addDirectory.
34
-     *
35
-     * @see addDirectory
36
-     *
37
-     * @var array
38
-     */
39
-    protected $classPath = array();
31
+	/**
32
+	 * stores the plugins names/paths relationships
33
+	 * don't edit this on your own, use addDirectory.
34
+	 *
35
+	 * @see addDirectory
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $classPath = array();
40 40
 
41
-    /**
42
-     * path where class paths cache files are written.
43
-     *
44
-     * @var string
45
-     */
46
-    protected $cacheDir;
41
+	/**
42
+	 * path where class paths cache files are written.
43
+	 *
44
+	 * @var string
45
+	 */
46
+	protected $cacheDir;
47 47
 
48
-    protected $corePluginDir;
48
+	protected $corePluginDir;
49 49
 
50
-    public function __construct($cacheDir)
51
-    {
52
-        $this->corePluginDir = DWOO_DIRECTORY.'plugins';
53
-        $this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
50
+	public function __construct($cacheDir)
51
+	{
52
+		$this->corePluginDir = DWOO_DIRECTORY.'plugins';
53
+		$this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
54 54
 
55
-        // include class paths or rebuild paths if the cache file isn't there
56
-        $cacheFile = $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php';
57
-        if (file_exists($cacheFile)) {
58
-            $classpath = file_get_contents($cacheFile);
59
-            $this->classPath = unserialize($classpath) + $this->classPath;
60
-        } else {
61
-            $this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
62
-        }
63
-    }
55
+		// include class paths or rebuild paths if the cache file isn't there
56
+		$cacheFile = $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php';
57
+		if (file_exists($cacheFile)) {
58
+			$classpath = file_get_contents($cacheFile);
59
+			$this->classPath = unserialize($classpath) + $this->classPath;
60
+		} else {
61
+			$this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
62
+		}
63
+	}
64 64
 
65
-    /**
66
-     * rebuilds class paths, scans the given directory recursively and saves all paths in the given file.
67
-     *
68
-     * @param string $path      the plugin path to scan
69
-     * @param string $cacheFile the file where to store the plugin paths cache, it will be overwritten
70
-     *
71
-     * @throws Dwoo_Exception
72
-     */
73
-    protected function rebuildClassPathCache($path, $cacheFile)
74
-    {
75
-        if ($cacheFile !== false) {
76
-            $tmp = $this->classPath;
77
-            $this->classPath = array();
78
-        }
65
+	/**
66
+	 * rebuilds class paths, scans the given directory recursively and saves all paths in the given file.
67
+	 *
68
+	 * @param string $path      the plugin path to scan
69
+	 * @param string $cacheFile the file where to store the plugin paths cache, it will be overwritten
70
+	 *
71
+	 * @throws Dwoo_Exception
72
+	 */
73
+	protected function rebuildClassPathCache($path, $cacheFile)
74
+	{
75
+		if ($cacheFile !== false) {
76
+			$tmp = $this->classPath;
77
+			$this->classPath = array();
78
+		}
79 79
 
80
-        // iterates over all files/folders
81
-        $list = glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*');
82
-        if (is_array($list)) {
83
-            foreach ($list as $f) {
84
-                if (is_dir($f)) {
85
-                    $this->rebuildClassPathCache($f, false);
86
-                } else {
87
-                    $this->classPath[str_replace(array('function.', 'block.', 'modifier.', 'outputfilter.', 'filter.', 'prefilter.', 'postfilter.', 'pre.', 'post.', 'output.', 'shared.', 'helper.'), '', basename($f, '.php'))] = $f;
88
-                }
89
-            }
90
-        }
80
+		// iterates over all files/folders
81
+		$list = glob(rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.'*');
82
+		if (is_array($list)) {
83
+			foreach ($list as $f) {
84
+				if (is_dir($f)) {
85
+					$this->rebuildClassPathCache($f, false);
86
+				} else {
87
+					$this->classPath[str_replace(array('function.', 'block.', 'modifier.', 'outputfilter.', 'filter.', 'prefilter.', 'postfilter.', 'pre.', 'post.', 'output.', 'shared.', 'helper.'), '', basename($f, '.php'))] = $f;
88
+				}
89
+			}
90
+		}
91 91
 
92
-        // save in file if it's the first call (not recursed)
93
-        if ($cacheFile !== false) {
94
-            if (!file_put_contents($cacheFile, serialize($this->classPath))) {
95
-                throw new Dwoo_Exception('Could not write into '.$cacheFile.', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()');
96
-            }
97
-            $this->classPath += $tmp;
98
-        }
99
-    }
92
+		// save in file if it's the first call (not recursed)
93
+		if ($cacheFile !== false) {
94
+			if (!file_put_contents($cacheFile, serialize($this->classPath))) {
95
+				throw new Dwoo_Exception('Could not write into '.$cacheFile.', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()');
96
+			}
97
+			$this->classPath += $tmp;
98
+		}
99
+	}
100 100
 
101
-    /**
102
-     * loads a plugin file.
103
-     *
104
-     * @param string $class       the plugin name, without the Dwoo_Plugin_ prefix
105
-     * @param bool   $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it has just been added, defaults to true
106
-     *
107
-     * @throws Dwoo_Exception
108
-     */
109
-    public function loadPlugin($class, $forceRehash = true)
110
-    {
111
-        // An unknown class was requested (maybe newly added) or the
112
-        // include failed so we rebuild the cache. include() will fail
113
-        // with an uncatchable error if the file doesn't exist, which
114
-        // usually means that the cache is stale and must be rebuilt,
115
-        // so we check for that before trying to include() the plugin.
116
-        if (!isset($this->classPath[$class]) ||
117
-            !is_readable($this->classPath[$class]) ||
118
-            !(include $this->classPath[$class])) {
119
-            if ($forceRehash) {
120
-                $this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php');
121
-                foreach ($this->paths as $path => $file) {
122
-                    $this->rebuildClassPathCache($path, $file);
123
-                }
124
-                if (isset($this->classPath[$class])) {
125
-                    include $this->classPath[$class];
126
-                }
127
-                throw new Dwoo_Exception('Plugin <em>'.$class.'</em> can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
128
-            }
129
-            throw new Dwoo_Exception('Plugin <em>'.$class.'</em> can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
130
-        }
131
-    }
101
+	/**
102
+	 * loads a plugin file.
103
+	 *
104
+	 * @param string $class       the plugin name, without the Dwoo_Plugin_ prefix
105
+	 * @param bool   $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it has just been added, defaults to true
106
+	 *
107
+	 * @throws Dwoo_Exception
108
+	 */
109
+	public function loadPlugin($class, $forceRehash = true)
110
+	{
111
+		// An unknown class was requested (maybe newly added) or the
112
+		// include failed so we rebuild the cache. include() will fail
113
+		// with an uncatchable error if the file doesn't exist, which
114
+		// usually means that the cache is stale and must be rebuilt,
115
+		// so we check for that before trying to include() the plugin.
116
+		if (!isset($this->classPath[$class]) ||
117
+			!is_readable($this->classPath[$class]) ||
118
+			!(include $this->classPath[$class])) {
119
+			if ($forceRehash) {
120
+				$this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php');
121
+				foreach ($this->paths as $path => $file) {
122
+					$this->rebuildClassPathCache($path, $file);
123
+				}
124
+				if (isset($this->classPath[$class])) {
125
+					include $this->classPath[$class];
126
+				}
127
+				throw new Dwoo_Exception('Plugin <em>'.$class.'</em> can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
128
+			}
129
+			throw new Dwoo_Exception('Plugin <em>'.$class.'</em> can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE);
130
+		}
131
+	}
132 132
 
133
-    /**
134
-     * adds a plugin directory, the plugins found in the new plugin directory
135
-     * will take precedence over the other directories (including the default
136
-     * dwoo plugin directory), you can use this for example to override plugins
137
-     * in a specific directory for a specific application while keeping all your
138
-     * usual plugins in the same place for all applications.
139
-     * TOCOM don't forget that php functions overrides are not rehashed so you
140
-     * need to clear the classpath caches by hand when adding those.
141
-     *
142
-     * @param string $pluginDirectory the plugin path to scan
143
-     *
144
-     * @throws Dwoo_Exception
145
-     */
146
-    public function addDirectory($pluginDirectory)
147
-    {
148
-        $pluginDir = realpath($pluginDirectory);
149
-        if (!$pluginDir) {
150
-            throw new Dwoo_Exception('Plugin directory does not exist or can not be read : '.$pluginDirectory);
151
-        }
152
-        $cacheFile = $this->cacheDir.'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----'), strlen($pluginDir) > 80 ? -80 : 0).'.d'.Dwoo_Core::RELEASE_TAG.'.php';
153
-        $this->paths[$pluginDir] = $cacheFile;
154
-        if (file_exists($cacheFile)) {
155
-            $classpath = file_get_contents($cacheFile);
156
-            $this->classPath = unserialize($classpath) + $this->classPath;
157
-        } else {
158
-            $this->rebuildClassPathCache($pluginDir, $cacheFile);
159
-        }
160
-    }
133
+	/**
134
+	 * adds a plugin directory, the plugins found in the new plugin directory
135
+	 * will take precedence over the other directories (including the default
136
+	 * dwoo plugin directory), you can use this for example to override plugins
137
+	 * in a specific directory for a specific application while keeping all your
138
+	 * usual plugins in the same place for all applications.
139
+	 * TOCOM don't forget that php functions overrides are not rehashed so you
140
+	 * need to clear the classpath caches by hand when adding those.
141
+	 *
142
+	 * @param string $pluginDirectory the plugin path to scan
143
+	 *
144
+	 * @throws Dwoo_Exception
145
+	 */
146
+	public function addDirectory($pluginDirectory)
147
+	{
148
+		$pluginDir = realpath($pluginDirectory);
149
+		if (!$pluginDir) {
150
+			throw new Dwoo_Exception('Plugin directory does not exist or can not be read : '.$pluginDirectory);
151
+		}
152
+		$cacheFile = $this->cacheDir.'classpath-'.substr(strtr($pluginDir, '/\\:'.PATH_SEPARATOR, '----'), strlen($pluginDir) > 80 ? -80 : 0).'.d'.Dwoo_Core::RELEASE_TAG.'.php';
153
+		$this->paths[$pluginDir] = $cacheFile;
154
+		if (file_exists($cacheFile)) {
155
+			$classpath = file_get_contents($cacheFile);
156
+			$this->classPath = unserialize($classpath) + $this->classPath;
157
+		} else {
158
+			$this->rebuildClassPathCache($pluginDir, $cacheFile);
159
+		}
160
+	}
161 161
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $cacheFile = $this->cacheDir.'classpath.cache.d'.Dwoo_Core::RELEASE_TAG.'.php';
57 57
         if (file_exists($cacheFile)) {
58 58
             $classpath = file_get_contents($cacheFile);
59
-            $this->classPath = unserialize($classpath) + $this->classPath;
59
+            $this->classPath = unserialize($classpath)+$this->classPath;
60 60
         } else {
61 61
             $this->rebuildClassPathCache($this->corePluginDir, $cacheFile);
62 62
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $this->paths[$pluginDir] = $cacheFile;
154 154
         if (file_exists($cacheFile)) {
155 155
             $classpath = file_get_contents($cacheFile);
156
-            $this->classPath = unserialize($classpath) + $this->classPath;
156
+            $this->classPath = unserialize($classpath)+$this->classPath;
157 157
         } else {
158 158
             $this->rebuildClassPathCache($pluginDir, $cacheFile);
159 159
         }
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/Dwoo.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -19,24 +19,24 @@
 block discarded – undo
19 19
  */
20 20
 class Dwoo_Adapters_ZendFramework_Dwoo extends Dwoo_Core
21 21
 {
22
-    /**
23
-     * Redirects all unknown properties to plugin proxy
24
-     * to support $this->viewVariable from within templates.
25
-     *
26
-     * @param string $name Property name
27
-     *
28
-     * @return mixed
29
-     */
30
-    public function __get($name)
31
-    {
32
-        if (isset($this->getPluginProxy()->view->$name)) {
33
-            return $this->getPluginProxy()->view->$name;
34
-        }
35
-        $trace = debug_backtrace();
36
-        trigger_error('Undefined property via __get(): '.$name.
37
-                      ' in '.$trace[0]['file'].
38
-                      ' on line '.$trace[0]['line'], E_USER_NOTICE);
22
+	/**
23
+	 * Redirects all unknown properties to plugin proxy
24
+	 * to support $this->viewVariable from within templates.
25
+	 *
26
+	 * @param string $name Property name
27
+	 *
28
+	 * @return mixed
29
+	 */
30
+	public function __get($name)
31
+	{
32
+		if (isset($this->getPluginProxy()->view->$name)) {
33
+			return $this->getPluginProxy()->view->$name;
34
+		}
35
+		$trace = debug_backtrace();
36
+		trigger_error('Undefined property via __get(): '.$name.
37
+					  ' in '.$trace[0]['file'].
38
+					  ' on line '.$trace[0]['line'], E_USER_NOTICE);
39 39
 
40
-        return null;
41
-    }
40
+		return null;
41
+	}
42 42
 }
Please login to merge, or discard this patch.