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/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 1 patch
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.
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.
lib/Dwoo/Adapters/ZendFramework/PluginProxy.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -19,88 +19,88 @@
 block discarded – undo
19 19
  */
20 20
 class Dwoo_Adapters_ZendFramework_PluginProxy implements Dwoo_IPluginProxy
21 21
 {
22
-    /**
23
-     * reference to the zend view owning this proxy.
24
-     *
25
-     * @var Zend_View_Interface
26
-     */
27
-    public $view;
22
+	/**
23
+	 * reference to the zend view owning this proxy.
24
+	 *
25
+	 * @var Zend_View_Interface
26
+	 */
27
+	public $view;
28 28
 
29
-    /**
30
-     * Dwoo_Adapters_ZendFramework_PluginProxy's constructor.
31
-     *
32
-     * @param Zend_View_Interface $view
33
-     */
34
-    public function __construct(Zend_View_Interface $view)
35
-    {
36
-        $this->view = $view;
37
-    }
29
+	/**
30
+	 * Dwoo_Adapters_ZendFramework_PluginProxy's constructor.
31
+	 *
32
+	 * @param Zend_View_Interface $view
33
+	 */
34
+	public function __construct(Zend_View_Interface $view)
35
+	{
36
+		$this->view = $view;
37
+	}
38 38
 
39
-    /**
40
-     * Called from Dwoo_Compiler to check if the requested plugin is available.
41
-     *
42
-     * @param string $name
43
-     *
44
-     * @return bool
45
-     */
46
-    public function handles($name)
47
-    {
48
-        try {
49
-            $this->view->getHelper($name);
50
-        } catch (Zend_Loader_PluginLoader_Exception $e) {
51
-            return false;
52
-        }
39
+	/**
40
+	 * Called from Dwoo_Compiler to check if the requested plugin is available.
41
+	 *
42
+	 * @param string $name
43
+	 *
44
+	 * @return bool
45
+	 */
46
+	public function handles($name)
47
+	{
48
+		try {
49
+			$this->view->getHelper($name);
50
+		} catch (Zend_Loader_PluginLoader_Exception $e) {
51
+			return false;
52
+		}
53 53
 
54
-        return true;
55
-    }
54
+		return true;
55
+	}
56 56
 
57
-    /**
58
-     * returns the code (as a string) to call the plugin
59
-     * (this will be executed at runtime inside the Dwoo class).
60
-     *
61
-     * @param string $name   the plugin name
62
-     * @param array  $params a parameter array, array key "*" is the rest array
63
-     *
64
-     * @return string
65
-     */
66
-    public function getCode($name, $params)
67
-    {
68
-        return '$this->getPluginProxy()->view->'.$name.'('.Dwoo_Compiler::implode_r($params).')';
69
-    }
57
+	/**
58
+	 * returns the code (as a string) to call the plugin
59
+	 * (this will be executed at runtime inside the Dwoo class).
60
+	 *
61
+	 * @param string $name   the plugin name
62
+	 * @param array  $params a parameter array, array key "*" is the rest array
63
+	 *
64
+	 * @return string
65
+	 */
66
+	public function getCode($name, $params)
67
+	{
68
+		return '$this->getPluginProxy()->view->'.$name.'('.Dwoo_Compiler::implode_r($params).')';
69
+	}
70 70
 
71
-    /**
72
-     * returns a callback to the plugin, this is used with the reflection API to
73
-     * find out about the plugin's parameter names etc.
74
-     *
75
-     * should you need a rest array (i.e. for ZendFramework helpers) without the
76
-     * possibility to edit the plugin's code, you can provide a callback to some
77
-     * other function with the correct parameter signature, i.e. :
78
-     * <code>
79
-     * return array($this, "callbackHelper");
80
-     * // and callbackHelper would be as such:
81
-     * public function callbackHelper(array $rest=array()){}
82
-     * </code>
83
-     *
84
-     * @param string $name the plugin name
85
-     *
86
-     * @return callback
87
-     */
88
-    public function getCallback($name)
89
-    {
90
-        return array($this->view->getHelper($name), $name);
91
-    }
71
+	/**
72
+	 * returns a callback to the plugin, this is used with the reflection API to
73
+	 * find out about the plugin's parameter names etc.
74
+	 *
75
+	 * should you need a rest array (i.e. for ZendFramework helpers) without the
76
+	 * possibility to edit the plugin's code, you can provide a callback to some
77
+	 * other function with the correct parameter signature, i.e. :
78
+	 * <code>
79
+	 * return array($this, "callbackHelper");
80
+	 * // and callbackHelper would be as such:
81
+	 * public function callbackHelper(array $rest=array()){}
82
+	 * </code>
83
+	 *
84
+	 * @param string $name the plugin name
85
+	 *
86
+	 * @return callback
87
+	 */
88
+	public function getCallback($name)
89
+	{
90
+		return array($this->view->getHelper($name), $name);
91
+	}
92 92
 
93
-    /**
94
-     * returns some code that will check if the plugin is loaded and if not load it
95
-     * this is optional, if your plugins are autoloaded or whatever, just return an
96
-     * empty string.
97
-     *
98
-     * @param string $name the plugin name
99
-     *
100
-     * @return string
101
-     */
102
-    public function getLoader($name)
103
-    {
104
-        return '';
105
-    }
93
+	/**
94
+	 * returns some code that will check if the plugin is loaded and if not load it
95
+	 * this is optional, if your plugins are autoloaded or whatever, just return an
96
+	 * empty string.
97
+	 *
98
+	 * @param string $name the plugin name
99
+	 *
100
+	 * @return string
101
+	 */
102
+	public function getLoader($name)
103
+	{
104
+		return '';
105
+	}
106 106
 }
Please login to merge, or discard this patch.