Completed
Pull Request — master (#56)
by David
05:43
created
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/Adapters/CodeIgniter/config/dwootemplate.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
  */
16 16
 
17 17
 if (!defined('BASEPATH')) {
18
-    exit('No direct script access allowed');
18
+	exit('No direct script access allowed');
19 19
 }
20 20
 
21 21
 // The name of the directory where templates are located.
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/CodeIgniter/libraries/Dwootemplate.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  */
16 16
 
17 17
 if (!defined('BASEPATH')) {
18
-    exit('No direct script access allowed');
18
+	exit('No direct script access allowed');
19 19
 }
20 20
 
21 21
 require 'dwoo/dwooAutoload.php';
@@ -39,154 +39,154 @@  discard block
 block discarded – undo
39 39
  */
40 40
 class Dwootemplate extends Dwoo_Core
41 41
 {
42
-    protected $dwoo_data = array();
43
-
44
-    /**
45
-     * Constructor for the DwooTemplate engine.
46
-     */
47
-    public function __construct()
48
-    {
49
-        // Call parents constructor
50
-        parent::__construct();
51
-
52
-        // Set the config settings
53
-        $this->initialize();
54
-
55
-        // Assign some defaults to dwoo
56
-        $CI = get_instance();
57
-        $this->dwoo_data = new Dwoo_Data();
58
-        $this->dwoo_data->js_files = array();
59
-        $this->dwoo_data->css_files = array();
60
-        $this->dwoo_data->CI = $CI;
61
-        $this->dwoo_data->site_url = $CI->config->site_url(); // so we can get the full path to CI easily
62
-        $this->dwoo_data->uniqid = uniqid();
63
-        $this->dwoo_data->timestamp = mktime();
64
-
65
-        log_message('debug', 'Dwoo Template Class Initialized');
66
-    }
67
-
68
-    /**
69
-     * Assign data to dwoo data object.
70
-     *
71
-     * @param string $key
72
-     * @param mixed  $value
73
-     */
74
-    public function assign($key, $value)
75
-    {
76
-        $this->dwoo_data->$key = $value;
77
-    }
78
-
79
-    /**
80
-     * Add Javascript files to template.
81
-     *
82
-     * @param string $js
83
-     */
84
-    public function add_js($js)
85
-    {
86
-        $current = $this->dwoo_data->js_files;
87
-        $current[] = $js;
88
-        $this->dwoo_data->js_files = $current;
89
-    }
90
-
91
-    /**
92
-     * Add Css stylesheets to template.
93
-     *
94
-     * @param string $css
95
-     */
96
-    public function add_css($css)
97
-    {
98
-        $current = $this->dwoo_data->css_files;
99
-        $current[] = $css;
100
-        $this->dwoo_data->css_files = $current;
101
-    }
102
-
103
-    /**
104
-     * Display or return the compiled template
105
-     * Since we assign the results to the standard CI output module
106
-     * you can also use the helper from CI in your templates!!
107
-     *
108
-     * @param string $sTemplate
109
-     * @param bool   $return
110
-     *
111
-     * @return mixed
112
-     */
113
-    public function display($sTemplate, $return = false)
114
-    {
115
-        // Start benchmark
116
-        $CI = get_instance();
117
-        $CI->benchmark->mark('dwoo_parse_start');
118
-
119
-        // Check if file exists
120
-        if (!file_exists($this->template_dir.$sTemplate)) {
121
-            $message = sprintf('Template file \'%s\' not found.', $sTemplate);
122
-            show_error($message);
123
-            log_message('error', $message);
124
-        }
125
-
126
-        // Create new template
127
-        $tpl = new Dwoo_Template_File($this->template_dir.$sTemplate);
128
-
129
-        // render the template
130
-        $template = $this->get($tpl, $this->dwoo_data);
131
-
132
-        // Finish benchmark
133
-        $CI->benchmark->mark('dwoo_parse_end');
134
-
135
-        // Return results or not ?
136
-        if ($return == false) {
137
-            $CI->output->final_output = $template;
138
-        } else {
139
-            return $template;
140
-        }
141
-    }
142
-
143
-    /**
144
-     * Toggle Codeigniter profiler on/off.
145
-     */
146
-    public function enable_profiler($toggle = true)
147
-    {
148
-        $CI = get_instance();
149
-        $CI->output->enable_profiler($toggle);
150
-    }
151
-
152
-    /**
153
-     * Set http header.
154
-     *
155
-     * @example $this->output->set_header("HTTP/1.1 200 OK");
156
-     * @example $this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
157
-     *
158
-     * @param string $header
159
-     */
160
-    public function set_header($header)
161
-    {
162
-        $CI = get_instance();
163
-        $CI->output->set_header($header);
164
-    }
165
-
166
-    /**
167
-     * Set status header.
168
-     *
169
-     * @example $this->output->set_status_header('401');
170
-     * @example // Sets the header as: Unauthorized
171
-     *
172
-     * @param string $header
173
-     */
174
-    public function set_status_header($header)
175
-    {
176
-        $CI = get_instance();
177
-        $CI->output->set_status_header($header);
178
-    }
179
-
180
-    /**
181
-     * Assign the dwootemplate config items to the instance.
182
-     */
183
-    private function initialize()
184
-    {
185
-        $CI = get_instance();
186
-        $CI->config->load('dwootemplate', true);
187
-        $config = $CI->config->item('dwootemplate');
188
-        foreach ($config as $key => $val) {
189
-            $this->$key = $val;
190
-        }
191
-    }
42
+	protected $dwoo_data = array();
43
+
44
+	/**
45
+	 * Constructor for the DwooTemplate engine.
46
+	 */
47
+	public function __construct()
48
+	{
49
+		// Call parents constructor
50
+		parent::__construct();
51
+
52
+		// Set the config settings
53
+		$this->initialize();
54
+
55
+		// Assign some defaults to dwoo
56
+		$CI = get_instance();
57
+		$this->dwoo_data = new Dwoo_Data();
58
+		$this->dwoo_data->js_files = array();
59
+		$this->dwoo_data->css_files = array();
60
+		$this->dwoo_data->CI = $CI;
61
+		$this->dwoo_data->site_url = $CI->config->site_url(); // so we can get the full path to CI easily
62
+		$this->dwoo_data->uniqid = uniqid();
63
+		$this->dwoo_data->timestamp = mktime();
64
+
65
+		log_message('debug', 'Dwoo Template Class Initialized');
66
+	}
67
+
68
+	/**
69
+	 * Assign data to dwoo data object.
70
+	 *
71
+	 * @param string $key
72
+	 * @param mixed  $value
73
+	 */
74
+	public function assign($key, $value)
75
+	{
76
+		$this->dwoo_data->$key = $value;
77
+	}
78
+
79
+	/**
80
+	 * Add Javascript files to template.
81
+	 *
82
+	 * @param string $js
83
+	 */
84
+	public function add_js($js)
85
+	{
86
+		$current = $this->dwoo_data->js_files;
87
+		$current[] = $js;
88
+		$this->dwoo_data->js_files = $current;
89
+	}
90
+
91
+	/**
92
+	 * Add Css stylesheets to template.
93
+	 *
94
+	 * @param string $css
95
+	 */
96
+	public function add_css($css)
97
+	{
98
+		$current = $this->dwoo_data->css_files;
99
+		$current[] = $css;
100
+		$this->dwoo_data->css_files = $current;
101
+	}
102
+
103
+	/**
104
+	 * Display or return the compiled template
105
+	 * Since we assign the results to the standard CI output module
106
+	 * you can also use the helper from CI in your templates!!
107
+	 *
108
+	 * @param string $sTemplate
109
+	 * @param bool   $return
110
+	 *
111
+	 * @return mixed
112
+	 */
113
+	public function display($sTemplate, $return = false)
114
+	{
115
+		// Start benchmark
116
+		$CI = get_instance();
117
+		$CI->benchmark->mark('dwoo_parse_start');
118
+
119
+		// Check if file exists
120
+		if (!file_exists($this->template_dir.$sTemplate)) {
121
+			$message = sprintf('Template file \'%s\' not found.', $sTemplate);
122
+			show_error($message);
123
+			log_message('error', $message);
124
+		}
125
+
126
+		// Create new template
127
+		$tpl = new Dwoo_Template_File($this->template_dir.$sTemplate);
128
+
129
+		// render the template
130
+		$template = $this->get($tpl, $this->dwoo_data);
131
+
132
+		// Finish benchmark
133
+		$CI->benchmark->mark('dwoo_parse_end');
134
+
135
+		// Return results or not ?
136
+		if ($return == false) {
137
+			$CI->output->final_output = $template;
138
+		} else {
139
+			return $template;
140
+		}
141
+	}
142
+
143
+	/**
144
+	 * Toggle Codeigniter profiler on/off.
145
+	 */
146
+	public function enable_profiler($toggle = true)
147
+	{
148
+		$CI = get_instance();
149
+		$CI->output->enable_profiler($toggle);
150
+	}
151
+
152
+	/**
153
+	 * Set http header.
154
+	 *
155
+	 * @example $this->output->set_header("HTTP/1.1 200 OK");
156
+	 * @example $this->output->set_header('Last-Modified: '.gmdate('D, d M Y H:i:s', $last_update).' GMT');
157
+	 *
158
+	 * @param string $header
159
+	 */
160
+	public function set_header($header)
161
+	{
162
+		$CI = get_instance();
163
+		$CI->output->set_header($header);
164
+	}
165
+
166
+	/**
167
+	 * Set status header.
168
+	 *
169
+	 * @example $this->output->set_status_header('401');
170
+	 * @example // Sets the header as: Unauthorized
171
+	 *
172
+	 * @param string $header
173
+	 */
174
+	public function set_status_header($header)
175
+	{
176
+		$CI = get_instance();
177
+		$CI->output->set_status_header($header);
178
+	}
179
+
180
+	/**
181
+	 * Assign the dwootemplate config items to the instance.
182
+	 */
183
+	private function initialize()
184
+	{
185
+		$CI = get_instance();
186
+		$CI->config->load('dwootemplate', true);
187
+		$config = $CI->config->item('dwootemplate');
188
+		foreach ($config as $key => $val) {
189
+			$this->$key = $val;
190
+		}
191
+	}
192 192
 }
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/View.php 1 patch
Indentation   +503 added lines, -503 removed lines patch added patch discarded remove patch
@@ -16,507 +16,507 @@
 block discarded – undo
16 16
  */
17 17
 class Dwoo_Adapters_ZendFramework_View extends Zend_View_Abstract
18 18
 {
19
-    /**
20
-     * @var Core
21
-     */
22
-    protected $_engine = null;
23
-
24
-    /**
25
-     * @var Dwoo_Data
26
-     */
27
-    protected $_dataProvider = null;
28
-
29
-    /**
30
-     * @var Dwoo_Compiler
31
-     */
32
-    protected $_compiler = null;
33
-
34
-    /**
35
-     * Changing Filter's scope to play nicely.
36
-     *
37
-     * @var array
38
-     */
39
-    protected $_filter = array();
40
-
41
-    /**
42
-     * @var string
43
-     */
44
-    protected $_templateFileClass = 'Dwoo_Template_File';
45
-
46
-    /**
47
-     * @var array
48
-     */
49
-    protected $_templateFileSettings = array();
50
-
51
-    /**
52
-     * @var Dwoo_IPluginProxy
53
-     */
54
-    protected $_pluginProxy = null;
55
-
56
-    /**
57
-     * Constructor method.
58
-     * See setOptions for $opt details.
59
-     *
60
-     * @see setOptions
61
-     *
62
-     * @param array|Zend_Config List of options or Zend_Config instance
63
-     */
64
-    public function __construct($opt = array())
65
-    {
66
-        if (is_array($opt)) {
67
-            $this->setOptions($opt);
68
-        } elseif ($opt instanceof Zend_Config) {
69
-            $this->setConfig($opt);
70
-        }
71
-
72
-        $this->init();
73
-    }
74
-
75
-    /**
76
-     * Set object state from options array
77
-     *  - engine        = engine class name|engine object|array of options for engine
78
-     *  - dataProvider  = data provider class name|data provider object|array of options for data provider
79
-     *  - compiler      = compiler class name|compiler object|array of options for compiler
80
-     *  - templateFile  =.
81
-     *
82
-     *  Array of options:
83
-     *  - type class name or object for engine, dataProvider or compiler
84
-     *  - any set* method (compileDir for setCompileDir ...)
85
-     *
86
-     * @param array $options
87
-     *
88
-     * @return Dwoo_Adapters_ZendFramework_View
89
-     */
90
-    public function setOptions(array $opt = array())
91
-    {
92
-        // Making sure that everything is loaded.
93
-        $classes = array('engine', 'dataProvider', 'compiler');
94
-
95
-        // Setting options to Dwoo objects...
96
-        foreach ($opt as $type => $settings) {
97
-            if (!method_exists($this, 'set'.$type)) {
98
-                throw new Dwoo_Exception("Unknown type $type");
99
-            }
100
-
101
-            if (is_string($settings) || is_object($settings)) {
102
-                call_user_func(array($this, 'set'.$type), $settings);
103
-            } elseif (is_array($settings)) {
104
-                // Set requested class
105
-                if (array_key_exists('type', $settings)) {
106
-                    call_user_func(array($this, 'set'.$type), $settings['type']);
107
-                }
108
-
109
-                if (in_array($type, $classes)) {
110
-                    // Call get so that the class is initialized
111
-                    $rel = call_user_func(array($this, 'get'.$type));
112
-
113
-                    // Call set*() methods so that all the settings are set.
114
-                    foreach ($settings as $method => $value) {
115
-                        if (method_exists($rel, 'set'.$method)) {
116
-                            call_user_func(array($rel, 'set'.$method), $value);
117
-                        }
118
-                    }
119
-                } elseif ('templateFile' == $type) {
120
-                    // Remember the settings for the templateFile
121
-                    $this->_templateFileSettings = $settings;
122
-                }
123
-            }
124
-        }
125
-    }
126
-
127
-    /**
128
-     * Set object state from Zend_Config object.
129
-     *
130
-     * @param Zend_Config $config
131
-     *
132
-     * @return Dwoo_Adapters_ZendFramework_View
133
-     */
134
-    public function setConfig(Zend_Config $config)
135
-    {
136
-        return $this->setOptions($config->toArray());
137
-    }
138
-
139
-    /**
140
-     * Called before template rendering.
141
-     *
142
-     * Binds plugin proxy to the Dwoo.
143
-     *
144
-     * @see Dwoo_Adapters_ZendFramework_View::getPluginProxy();
145
-     * @see Dwoo_Core::setPluginProxy();
146
-     */
147
-    protected function preRender()
148
-    {
149
-        $this->getEngine()->setPluginProxy($this->getPluginProxy());
150
-    }
151
-
152
-    /**
153
-     * Wraper for Dwoo_Data::__set()
154
-     * allows to assign variables using the object syntax.
155
-     *
156
-     * @see Dwoo_Data::__set()
157
-     *
158
-     * @param string $name  the variable name
159
-     * @param string $value the value to assign to it
160
-     */
161
-    public function __set($name, $value)
162
-    {
163
-        $this->getDataProvider()->__set($name, $value);
164
-    }
165
-
166
-    /**
167
-     * Sraper for Dwoo_Data::__get() allows to read variables using the object
168
-     * syntax.
169
-     *
170
-     * @see Dwoo_Data::__get()
171
-     *
172
-     * @param string $name the variable name
173
-     *
174
-     * @return mixed
175
-     */
176
-    public function __get($name)
177
-    {
178
-        return $this->getDataProvider()->__get($name);
179
-    }
180
-
181
-    /**
182
-     * Wraper for Dwoo_Data::__isset()
183
-     * supports calls to isset($dwooData->var).
184
-     *
185
-     * @see Dwoo_Data::__isset()
186
-     *
187
-     * @param string $name the variable name
188
-     */
189
-    public function __isset($name)
190
-    {
191
-        return $this->getDataProvider()->__isset($name);
192
-    }
193
-
194
-    /**
195
-     * Wraper for Dwoo_Data::_unset()
196
-     * supports unsetting variables using the object syntax.
197
-     *
198
-     * @see Dwoo_Data::__unset()
199
-     *
200
-     * @param string $name the variable name
201
-     */
202
-    public function __unset($name)
203
-    {
204
-        $this->getDataProvider()->__unset($name);
205
-    }
206
-
207
-    /**
208
-     * Catches clone request and clones data provider.
209
-     */
210
-    public function __clone()
211
-    {
212
-        $this->setDataProvider(clone $this->getDataProvider());
213
-    }
214
-
215
-    /**
216
-     * Returns plugin proxy interface.
217
-     *
218
-     * @return Dwoo_IPluginProxy
219
-     */
220
-    public function getPluginProxy()
221
-    {
222
-        if (!$this->_pluginProxy) {
223
-            $this->_pluginProxy = new Dwoo_Adapters_ZendFramework_PluginProxy($this);
224
-        }
225
-
226
-        return $this->_pluginProxy;
227
-    }
228
-
229
-    /**
230
-     * Sets plugin proxy.
231
-     *
232
-     * @param Dwoo_IPluginProxy
233
-     *
234
-     * @return Dwoo_Adapters_ZendFramework_View
235
-     */
236
-    public function setPluginProxy(Dwoo_IPluginProxy $pluginProxy)
237
-    {
238
-        $this->_pluginProxy = $pluginProxy;
239
-
240
-        return $this;
241
-    }
242
-
243
-    /**
244
-     * Sets template engine.
245
-     *
246
-     * @param string|Dwoo Object or name of the class
247
-     */
248
-    public function setEngine($engine)
249
-    {
250
-        // if param given as an object
251
-        if ($engine instanceof Dwoo_Core) {
252
-            $this->_engine = $engine;
253
-        } elseif (is_subclass_of($engine, 'Dwoo') || 'Dwoo' === $engine) {
254
-            $this->_engine = new $engine();
255
-        } else {
256
-            throw new Dwoo_Exception('Custom engine must be a subclass of Dwoo');
257
-        }
258
-    }
259
-
260
-    /**
261
-     * Return the Dwoo template engine object.
262
-     *
263
-     * @return Dwoo
264
-     */
265
-    public function getEngine()
266
-    {
267
-        if (null === $this->_engine) {
268
-            $this->_engine = new Dwoo_Adapters_ZendFramework_Dwoo();
269
-        }
270
-
271
-        return $this->_engine;
272
-    }
273
-
274
-    /**
275
-     * Sets Dwoo data object.
276
-     *
277
-     * @param string|Dwoo_Data Object or name of the class
278
-     */
279
-    public function setDataProvider($data)
280
-    {
281
-        if ($data instanceof Dwoo_IDataProvider) {
282
-            $this->_dataProvider = $data;
283
-        } elseif (is_subclass_of($data, 'Dwoo_Data') || 'Dwoo_Data' == $data) {
284
-            $this->_dataProvider = new $data();
285
-        } else {
286
-            throw new Dwoo_Exception('Custom data provider must be a subclass of Dwoo_Data or instance of Dwoo_IDataProvider');
287
-        }
288
-    }
289
-
290
-    /**
291
-     * Return the Dwoo data object.
292
-     *
293
-     * @return Dwoo_Data
294
-     */
295
-    public function getDataProvider()
296
-    {
297
-        if (null === $this->_dataProvider) {
298
-            $this->_dataProvider = new Dwoo_Data();
299
-
300
-            // Satisfy Zend_View_Abstract wishes to access this unexisting property
301
-            // by setting it to empty array (see Zend_View_Abstract::_filter)
302
-            $this->_dataProvider->_filter = array();
303
-        }
304
-
305
-        return $this->_dataProvider;
306
-    }
307
-
308
-    /**
309
-     * Sets Dwoo compiler.
310
-     *
311
-     * @param string|Dwoo_Compiler Object or name of the class
312
-     */
313
-    public function setCompiler($compiler)
314
-    {
315
-
316
-        // if param given as an object
317
-        if ($compiler instanceof Dwoo_ICompiler) {
318
-            $this->_compiler = $compiler;
319
-        }
320
-        // if param given as a string
321
-        elseif (is_subclass_of($compiler, 'Dwoo_Compiler') || 'Dwoo_Compiler' == $compiler) {
322
-            $this->_compiler = new $compiler();
323
-        } else {
324
-            throw new Dwoo_Exception('Custom compiler must be a subclass of Dwoo_Compiler or instance of Dwoo_ICompiler');
325
-        }
326
-    }
327
-
328
-    /**
329
-     * Return the Dwoo compiler object.
330
-     *
331
-     * @return Dwoo_Compiler
332
-     */
333
-    public function getCompiler()
334
-    {
335
-        if (null === $this->_compiler) {
336
-            $this->_compiler = Dwoo_Compiler::compilerFactory();
337
-        }
338
-
339
-        return $this->_compiler;
340
-    }
341
-
342
-    /**
343
-     * Initializes Dwoo_ITemplate type of class and sets properties from _templateFileSettings.
344
-     *
345
-     * @param string Dwoo_ITemplate $template
346
-     *
347
-     * @return Dwoo_ITemplate
348
-     */
349
-    public function getTemplateFile($template)
350
-    {
351
-        $templateFileClass = $this->_templateFileClass;
352
-
353
-        $dwooTemplateFile = new $templateFileClass($template);
354
-
355
-        if (!($dwooTemplateFile instanceof Dwoo_ITemplate)) {
356
-            throw new Dwoo_Exception('Custom templateFile class must be a subclass of Dwoo_ITemplate');
357
-        }
358
-
359
-        foreach ($this->_templateFileSettings as $method => $value) {
360
-            if (method_exists($dwooTemplateFile, 'set'.$method)) {
361
-                call_user_func(array($dwooTemplateFile, 'set'.$method), $value);
362
-            }
363
-        }
364
-
365
-        return $dwooTemplateFile;
366
-    }
367
-
368
-    /**
369
-     * Dwoo_ITemplate type of class.
370
-     *
371
-     * @param string Name of the class
372
-     */
373
-    public function setTemplateFile($tempateFileClass)
374
-    {
375
-        $this->_templateFileClass = $tempateFileClass;
376
-    }
377
-
378
-    /**
379
-     * Passes data to Dwoo_Data object.
380
-     *
381
-     * @see Dwoo_Data::assign()
382
-     *
383
-     * @param array|string $name
384
-     * @param mixed        $val
385
-     *
386
-     * @return Dwoo_Adapters_ZendFramework_View
387
-     */
388
-    public function assign($name, $val = null)
389
-    {
390
-        $this->getDataProvider()->assign($name, $val);
391
-
392
-        return $this;
393
-    }
394
-
395
-    /**
396
-     * Return list of all assigned variables.
397
-     *
398
-     * @return array
399
-     */
400
-    public function getVars()
401
-    {
402
-        return $this->getDataProvider()->getData();
403
-    }
404
-
405
-    /**
406
-     * Clear all assigned variables.
407
-     *
408
-     * Clears all variables assigned to Zend_View either via {@link assign()} or
409
-     * property overloading ({@link __get()}/{@link __set()}).
410
-     *
411
-     * @return Dwoo_Adapters_ZendFramework_View
412
-     */
413
-    public function clearVars()
414
-    {
415
-        $this->getDataProvider()->clear();
416
-
417
-        return $this;
418
-    }
419
-
420
-    /**
421
-     * Wraper for parent's render method so preRender method
422
-     * can be called (that will bind the plugin proxy to the
423
-     * engine.
424
-     *
425
-     * @see Zend_View_Abstract::render
426
-     *
427
-     * @return string The script output
428
-     */
429
-    public function render($name)
430
-    {
431
-        $this->preRender();
432
-
433
-        return parent::render($name);
434
-    }
435
-
436
-    /**
437
-     * Processes a view script and outputs it. Output is then
438
-     * passed through filters.
439
-     *
440
-     * @param string $name The script script name to process
441
-     *
442
-     * @return string The script output
443
-     */
444
-    public function _run()
445
-    {
446
-        echo $this->_engine->get(
447
-            $this->getTemplateFile(func_get_arg(0)),
448
-            $this->getDataProvider(),
449
-            $this->getCompiler()
450
-        );
451
-    }
452
-
453
-    /**
454
-     * Add plugin path.
455
-     *
456
-     * @param string $dir Directory
457
-     *
458
-     * @return Dwoo_Adapters_ZendFramework_View
459
-     */
460
-    public function addPluginDir($dir)
461
-    {
462
-        $this->getEngine()->getLoader()->addDirectory($dir);
463
-
464
-        return $this;
465
-    }
466
-
467
-    /**
468
-     * Set compile path.
469
-     *
470
-     * @param string $dir Directory
471
-     *
472
-     * @return Dwoo_Adapters_ZendFramework_View
473
-     */
474
-    public function setCompileDir($dir)
475
-    {
476
-        $this->getEngine()->setCompileDir($dir);
477
-
478
-        return $this;
479
-    }
480
-
481
-    /**
482
-     * Set cache path.
483
-     *
484
-     * @param string $dir Directory
485
-     *
486
-     * @return Dwoo_Adapters_ZendFramework_View
487
-     */
488
-    public function setCacheDir($dir)
489
-    {
490
-        $this->getEngine()->setCacheDir($dir);
491
-
492
-        return $this;
493
-    }
494
-
495
-    /**
496
-     * Set cache lifetime.
497
-     *
498
-     * @param string $seconds Lifetime in seconds
499
-     *
500
-     * @return Dwoo_Adapters_ZendFramework_View
501
-     */
502
-    public function setCacheLifetime($seconds)
503
-    {
504
-        $this->getEngine()->setCacheTime($seconds);
505
-
506
-        return $this;
507
-    }
508
-
509
-    /**
510
-     * Set charset.
511
-     *
512
-     * @param string $charset
513
-     *
514
-     * @return Dwoo_Adapters_ZendFramework_View
515
-     */
516
-    public function setCharset($charset)
517
-    {
518
-        $this->_engine->setCharset($charset);
519
-
520
-        return $this;
521
-    }
19
+	/**
20
+	 * @var Core
21
+	 */
22
+	protected $_engine = null;
23
+
24
+	/**
25
+	 * @var Dwoo_Data
26
+	 */
27
+	protected $_dataProvider = null;
28
+
29
+	/**
30
+	 * @var Dwoo_Compiler
31
+	 */
32
+	protected $_compiler = null;
33
+
34
+	/**
35
+	 * Changing Filter's scope to play nicely.
36
+	 *
37
+	 * @var array
38
+	 */
39
+	protected $_filter = array();
40
+
41
+	/**
42
+	 * @var string
43
+	 */
44
+	protected $_templateFileClass = 'Dwoo_Template_File';
45
+
46
+	/**
47
+	 * @var array
48
+	 */
49
+	protected $_templateFileSettings = array();
50
+
51
+	/**
52
+	 * @var Dwoo_IPluginProxy
53
+	 */
54
+	protected $_pluginProxy = null;
55
+
56
+	/**
57
+	 * Constructor method.
58
+	 * See setOptions for $opt details.
59
+	 *
60
+	 * @see setOptions
61
+	 *
62
+	 * @param array|Zend_Config List of options or Zend_Config instance
63
+	 */
64
+	public function __construct($opt = array())
65
+	{
66
+		if (is_array($opt)) {
67
+			$this->setOptions($opt);
68
+		} elseif ($opt instanceof Zend_Config) {
69
+			$this->setConfig($opt);
70
+		}
71
+
72
+		$this->init();
73
+	}
74
+
75
+	/**
76
+	 * Set object state from options array
77
+	 *  - engine        = engine class name|engine object|array of options for engine
78
+	 *  - dataProvider  = data provider class name|data provider object|array of options for data provider
79
+	 *  - compiler      = compiler class name|compiler object|array of options for compiler
80
+	 *  - templateFile  =.
81
+	 *
82
+	 *  Array of options:
83
+	 *  - type class name or object for engine, dataProvider or compiler
84
+	 *  - any set* method (compileDir for setCompileDir ...)
85
+	 *
86
+	 * @param array $options
87
+	 *
88
+	 * @return Dwoo_Adapters_ZendFramework_View
89
+	 */
90
+	public function setOptions(array $opt = array())
91
+	{
92
+		// Making sure that everything is loaded.
93
+		$classes = array('engine', 'dataProvider', 'compiler');
94
+
95
+		// Setting options to Dwoo objects...
96
+		foreach ($opt as $type => $settings) {
97
+			if (!method_exists($this, 'set'.$type)) {
98
+				throw new Dwoo_Exception("Unknown type $type");
99
+			}
100
+
101
+			if (is_string($settings) || is_object($settings)) {
102
+				call_user_func(array($this, 'set'.$type), $settings);
103
+			} elseif (is_array($settings)) {
104
+				// Set requested class
105
+				if (array_key_exists('type', $settings)) {
106
+					call_user_func(array($this, 'set'.$type), $settings['type']);
107
+				}
108
+
109
+				if (in_array($type, $classes)) {
110
+					// Call get so that the class is initialized
111
+					$rel = call_user_func(array($this, 'get'.$type));
112
+
113
+					// Call set*() methods so that all the settings are set.
114
+					foreach ($settings as $method => $value) {
115
+						if (method_exists($rel, 'set'.$method)) {
116
+							call_user_func(array($rel, 'set'.$method), $value);
117
+						}
118
+					}
119
+				} elseif ('templateFile' == $type) {
120
+					// Remember the settings for the templateFile
121
+					$this->_templateFileSettings = $settings;
122
+				}
123
+			}
124
+		}
125
+	}
126
+
127
+	/**
128
+	 * Set object state from Zend_Config object.
129
+	 *
130
+	 * @param Zend_Config $config
131
+	 *
132
+	 * @return Dwoo_Adapters_ZendFramework_View
133
+	 */
134
+	public function setConfig(Zend_Config $config)
135
+	{
136
+		return $this->setOptions($config->toArray());
137
+	}
138
+
139
+	/**
140
+	 * Called before template rendering.
141
+	 *
142
+	 * Binds plugin proxy to the Dwoo.
143
+	 *
144
+	 * @see Dwoo_Adapters_ZendFramework_View::getPluginProxy();
145
+	 * @see Dwoo_Core::setPluginProxy();
146
+	 */
147
+	protected function preRender()
148
+	{
149
+		$this->getEngine()->setPluginProxy($this->getPluginProxy());
150
+	}
151
+
152
+	/**
153
+	 * Wraper for Dwoo_Data::__set()
154
+	 * allows to assign variables using the object syntax.
155
+	 *
156
+	 * @see Dwoo_Data::__set()
157
+	 *
158
+	 * @param string $name  the variable name
159
+	 * @param string $value the value to assign to it
160
+	 */
161
+	public function __set($name, $value)
162
+	{
163
+		$this->getDataProvider()->__set($name, $value);
164
+	}
165
+
166
+	/**
167
+	 * Sraper for Dwoo_Data::__get() allows to read variables using the object
168
+	 * syntax.
169
+	 *
170
+	 * @see Dwoo_Data::__get()
171
+	 *
172
+	 * @param string $name the variable name
173
+	 *
174
+	 * @return mixed
175
+	 */
176
+	public function __get($name)
177
+	{
178
+		return $this->getDataProvider()->__get($name);
179
+	}
180
+
181
+	/**
182
+	 * Wraper for Dwoo_Data::__isset()
183
+	 * supports calls to isset($dwooData->var).
184
+	 *
185
+	 * @see Dwoo_Data::__isset()
186
+	 *
187
+	 * @param string $name the variable name
188
+	 */
189
+	public function __isset($name)
190
+	{
191
+		return $this->getDataProvider()->__isset($name);
192
+	}
193
+
194
+	/**
195
+	 * Wraper for Dwoo_Data::_unset()
196
+	 * supports unsetting variables using the object syntax.
197
+	 *
198
+	 * @see Dwoo_Data::__unset()
199
+	 *
200
+	 * @param string $name the variable name
201
+	 */
202
+	public function __unset($name)
203
+	{
204
+		$this->getDataProvider()->__unset($name);
205
+	}
206
+
207
+	/**
208
+	 * Catches clone request and clones data provider.
209
+	 */
210
+	public function __clone()
211
+	{
212
+		$this->setDataProvider(clone $this->getDataProvider());
213
+	}
214
+
215
+	/**
216
+	 * Returns plugin proxy interface.
217
+	 *
218
+	 * @return Dwoo_IPluginProxy
219
+	 */
220
+	public function getPluginProxy()
221
+	{
222
+		if (!$this->_pluginProxy) {
223
+			$this->_pluginProxy = new Dwoo_Adapters_ZendFramework_PluginProxy($this);
224
+		}
225
+
226
+		return $this->_pluginProxy;
227
+	}
228
+
229
+	/**
230
+	 * Sets plugin proxy.
231
+	 *
232
+	 * @param Dwoo_IPluginProxy
233
+	 *
234
+	 * @return Dwoo_Adapters_ZendFramework_View
235
+	 */
236
+	public function setPluginProxy(Dwoo_IPluginProxy $pluginProxy)
237
+	{
238
+		$this->_pluginProxy = $pluginProxy;
239
+
240
+		return $this;
241
+	}
242
+
243
+	/**
244
+	 * Sets template engine.
245
+	 *
246
+	 * @param string|Dwoo Object or name of the class
247
+	 */
248
+	public function setEngine($engine)
249
+	{
250
+		// if param given as an object
251
+		if ($engine instanceof Dwoo_Core) {
252
+			$this->_engine = $engine;
253
+		} elseif (is_subclass_of($engine, 'Dwoo') || 'Dwoo' === $engine) {
254
+			$this->_engine = new $engine();
255
+		} else {
256
+			throw new Dwoo_Exception('Custom engine must be a subclass of Dwoo');
257
+		}
258
+	}
259
+
260
+	/**
261
+	 * Return the Dwoo template engine object.
262
+	 *
263
+	 * @return Dwoo
264
+	 */
265
+	public function getEngine()
266
+	{
267
+		if (null === $this->_engine) {
268
+			$this->_engine = new Dwoo_Adapters_ZendFramework_Dwoo();
269
+		}
270
+
271
+		return $this->_engine;
272
+	}
273
+
274
+	/**
275
+	 * Sets Dwoo data object.
276
+	 *
277
+	 * @param string|Dwoo_Data Object or name of the class
278
+	 */
279
+	public function setDataProvider($data)
280
+	{
281
+		if ($data instanceof Dwoo_IDataProvider) {
282
+			$this->_dataProvider = $data;
283
+		} elseif (is_subclass_of($data, 'Dwoo_Data') || 'Dwoo_Data' == $data) {
284
+			$this->_dataProvider = new $data();
285
+		} else {
286
+			throw new Dwoo_Exception('Custom data provider must be a subclass of Dwoo_Data or instance of Dwoo_IDataProvider');
287
+		}
288
+	}
289
+
290
+	/**
291
+	 * Return the Dwoo data object.
292
+	 *
293
+	 * @return Dwoo_Data
294
+	 */
295
+	public function getDataProvider()
296
+	{
297
+		if (null === $this->_dataProvider) {
298
+			$this->_dataProvider = new Dwoo_Data();
299
+
300
+			// Satisfy Zend_View_Abstract wishes to access this unexisting property
301
+			// by setting it to empty array (see Zend_View_Abstract::_filter)
302
+			$this->_dataProvider->_filter = array();
303
+		}
304
+
305
+		return $this->_dataProvider;
306
+	}
307
+
308
+	/**
309
+	 * Sets Dwoo compiler.
310
+	 *
311
+	 * @param string|Dwoo_Compiler Object or name of the class
312
+	 */
313
+	public function setCompiler($compiler)
314
+	{
315
+
316
+		// if param given as an object
317
+		if ($compiler instanceof Dwoo_ICompiler) {
318
+			$this->_compiler = $compiler;
319
+		}
320
+		// if param given as a string
321
+		elseif (is_subclass_of($compiler, 'Dwoo_Compiler') || 'Dwoo_Compiler' == $compiler) {
322
+			$this->_compiler = new $compiler();
323
+		} else {
324
+			throw new Dwoo_Exception('Custom compiler must be a subclass of Dwoo_Compiler or instance of Dwoo_ICompiler');
325
+		}
326
+	}
327
+
328
+	/**
329
+	 * Return the Dwoo compiler object.
330
+	 *
331
+	 * @return Dwoo_Compiler
332
+	 */
333
+	public function getCompiler()
334
+	{
335
+		if (null === $this->_compiler) {
336
+			$this->_compiler = Dwoo_Compiler::compilerFactory();
337
+		}
338
+
339
+		return $this->_compiler;
340
+	}
341
+
342
+	/**
343
+	 * Initializes Dwoo_ITemplate type of class and sets properties from _templateFileSettings.
344
+	 *
345
+	 * @param string Dwoo_ITemplate $template
346
+	 *
347
+	 * @return Dwoo_ITemplate
348
+	 */
349
+	public function getTemplateFile($template)
350
+	{
351
+		$templateFileClass = $this->_templateFileClass;
352
+
353
+		$dwooTemplateFile = new $templateFileClass($template);
354
+
355
+		if (!($dwooTemplateFile instanceof Dwoo_ITemplate)) {
356
+			throw new Dwoo_Exception('Custom templateFile class must be a subclass of Dwoo_ITemplate');
357
+		}
358
+
359
+		foreach ($this->_templateFileSettings as $method => $value) {
360
+			if (method_exists($dwooTemplateFile, 'set'.$method)) {
361
+				call_user_func(array($dwooTemplateFile, 'set'.$method), $value);
362
+			}
363
+		}
364
+
365
+		return $dwooTemplateFile;
366
+	}
367
+
368
+	/**
369
+	 * Dwoo_ITemplate type of class.
370
+	 *
371
+	 * @param string Name of the class
372
+	 */
373
+	public function setTemplateFile($tempateFileClass)
374
+	{
375
+		$this->_templateFileClass = $tempateFileClass;
376
+	}
377
+
378
+	/**
379
+	 * Passes data to Dwoo_Data object.
380
+	 *
381
+	 * @see Dwoo_Data::assign()
382
+	 *
383
+	 * @param array|string $name
384
+	 * @param mixed        $val
385
+	 *
386
+	 * @return Dwoo_Adapters_ZendFramework_View
387
+	 */
388
+	public function assign($name, $val = null)
389
+	{
390
+		$this->getDataProvider()->assign($name, $val);
391
+
392
+		return $this;
393
+	}
394
+
395
+	/**
396
+	 * Return list of all assigned variables.
397
+	 *
398
+	 * @return array
399
+	 */
400
+	public function getVars()
401
+	{
402
+		return $this->getDataProvider()->getData();
403
+	}
404
+
405
+	/**
406
+	 * Clear all assigned variables.
407
+	 *
408
+	 * Clears all variables assigned to Zend_View either via {@link assign()} or
409
+	 * property overloading ({@link __get()}/{@link __set()}).
410
+	 *
411
+	 * @return Dwoo_Adapters_ZendFramework_View
412
+	 */
413
+	public function clearVars()
414
+	{
415
+		$this->getDataProvider()->clear();
416
+
417
+		return $this;
418
+	}
419
+
420
+	/**
421
+	 * Wraper for parent's render method so preRender method
422
+	 * can be called (that will bind the plugin proxy to the
423
+	 * engine.
424
+	 *
425
+	 * @see Zend_View_Abstract::render
426
+	 *
427
+	 * @return string The script output
428
+	 */
429
+	public function render($name)
430
+	{
431
+		$this->preRender();
432
+
433
+		return parent::render($name);
434
+	}
435
+
436
+	/**
437
+	 * Processes a view script and outputs it. Output is then
438
+	 * passed through filters.
439
+	 *
440
+	 * @param string $name The script script name to process
441
+	 *
442
+	 * @return string The script output
443
+	 */
444
+	public function _run()
445
+	{
446
+		echo $this->_engine->get(
447
+			$this->getTemplateFile(func_get_arg(0)),
448
+			$this->getDataProvider(),
449
+			$this->getCompiler()
450
+		);
451
+	}
452
+
453
+	/**
454
+	 * Add plugin path.
455
+	 *
456
+	 * @param string $dir Directory
457
+	 *
458
+	 * @return Dwoo_Adapters_ZendFramework_View
459
+	 */
460
+	public function addPluginDir($dir)
461
+	{
462
+		$this->getEngine()->getLoader()->addDirectory($dir);
463
+
464
+		return $this;
465
+	}
466
+
467
+	/**
468
+	 * Set compile path.
469
+	 *
470
+	 * @param string $dir Directory
471
+	 *
472
+	 * @return Dwoo_Adapters_ZendFramework_View
473
+	 */
474
+	public function setCompileDir($dir)
475
+	{
476
+		$this->getEngine()->setCompileDir($dir);
477
+
478
+		return $this;
479
+	}
480
+
481
+	/**
482
+	 * Set cache path.
483
+	 *
484
+	 * @param string $dir Directory
485
+	 *
486
+	 * @return Dwoo_Adapters_ZendFramework_View
487
+	 */
488
+	public function setCacheDir($dir)
489
+	{
490
+		$this->getEngine()->setCacheDir($dir);
491
+
492
+		return $this;
493
+	}
494
+
495
+	/**
496
+	 * Set cache lifetime.
497
+	 *
498
+	 * @param string $seconds Lifetime in seconds
499
+	 *
500
+	 * @return Dwoo_Adapters_ZendFramework_View
501
+	 */
502
+	public function setCacheLifetime($seconds)
503
+	{
504
+		$this->getEngine()->setCacheTime($seconds);
505
+
506
+		return $this;
507
+	}
508
+
509
+	/**
510
+	 * Set charset.
511
+	 *
512
+	 * @param string $charset
513
+	 *
514
+	 * @return Dwoo_Adapters_ZendFramework_View
515
+	 */
516
+	public function setCharset($charset)
517
+	{
518
+		$this->_engine->setCharset($charset);
519
+
520
+		return $this;
521
+	}
522 522
 }
Please login to merge, or discard this patch.
lib/Dwoo/Adapters/ZendFramework/Dwoo.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -16,26 +16,26 @@
 block discarded – undo
16 16
  */
17 17
 class Dwoo_Adapters_ZendFramework_Dwoo extends Dwoo_Core
18 18
 {
19
-    /**
20
-     * Redirects all unknown properties to plugin proxy
21
-     * to support $this->viewVariable from within templates.
22
-     *
23
-     * @param string $name Property name
24
-     *
25
-     * @return mixed
26
-     */
27
-    public function __get($name)
28
-    {
29
-        if (isset($this->getPluginProxy()->view->$name)) {
30
-            return $this->getPluginProxy()->view->$name;
31
-        }
32
-        $trace = debug_backtrace();
33
-        trigger_error(
34
-            'Undefined property via __get(): '.$name.
35
-                      ' in '.$trace[0]['file'].
36
-            ' on line '.$trace[0]['line'], E_USER_NOTICE
37
-        );
19
+	/**
20
+	 * Redirects all unknown properties to plugin proxy
21
+	 * to support $this->viewVariable from within templates.
22
+	 *
23
+	 * @param string $name Property name
24
+	 *
25
+	 * @return mixed
26
+	 */
27
+	public function __get($name)
28
+	{
29
+		if (isset($this->getPluginProxy()->view->$name)) {
30
+			return $this->getPluginProxy()->view->$name;
31
+		}
32
+		$trace = debug_backtrace();
33
+		trigger_error(
34
+			'Undefined property via __get(): '.$name.
35
+					  ' in '.$trace[0]['file'].
36
+			' on line '.$trace[0]['line'], E_USER_NOTICE
37
+		);
38 38
 
39
-        return null;
40
-    }
39
+		return null;
40
+	}
41 41
 }
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
@@ -36,88 +36,88 @@
 block discarded – undo
36 36
  */
37 37
 class Dwoo_Adapters_ZendFramework_PluginProxy implements IPluginProxy
38 38
 {
39
-    /**
40
-     * reference to the zend view owning this proxy.
41
-     *
42
-     * @var Zend_View_Interface
43
-     */
44
-    public $view;
39
+	/**
40
+	 * reference to the zend view owning this proxy.
41
+	 *
42
+	 * @var Zend_View_Interface
43
+	 */
44
+	public $view;
45 45
 
46
-    /**
47
-     * Dwoo_Adapters_ZendFramework_PluginProxy's constructor.
48
-     *
49
-     * @param Zend_View_Interface $view
50
-     */
51
-    public function __construct(Zend_View_Interface $view)
52
-    {
53
-        $this->view = $view;
54
-    }
46
+	/**
47
+	 * Dwoo_Adapters_ZendFramework_PluginProxy's constructor.
48
+	 *
49
+	 * @param Zend_View_Interface $view
50
+	 */
51
+	public function __construct(Zend_View_Interface $view)
52
+	{
53
+		$this->view = $view;
54
+	}
55 55
 
56
-    /**
57
-     * Called from Dwoo_Compiler to check if the requested plugin is available.
58
-     *
59
-     * @param string $name
60
-     *
61
-     * @return bool
62
-     */
63
-    public function handles($name)
64
-    {
65
-        try {
66
-            $this->view->getHelper($name);
67
-        } catch (Zend_Loader_PluginLoader_Exception $e) {
68
-            return false;
69
-        }
56
+	/**
57
+	 * Called from Dwoo_Compiler to check if the requested plugin is available.
58
+	 *
59
+	 * @param string $name
60
+	 *
61
+	 * @return bool
62
+	 */
63
+	public function handles($name)
64
+	{
65
+		try {
66
+			$this->view->getHelper($name);
67
+		} catch (Zend_Loader_PluginLoader_Exception $e) {
68
+			return false;
69
+		}
70 70
 
71
-        return true;
72
-    }
71
+		return true;
72
+	}
73 73
 
74
-    /**
75
-     * returns the code (as a string) to call the plugin
76
-     * (this will be executed at runtime inside the Dwoo class).
77
-     *
78
-     * @param string $name   the plugin name
79
-     * @param array  $params a parameter array, array key "*" is the rest array
80
-     *
81
-     * @return string
82
-     */
83
-    public function getCode($name, $params)
84
-    {
85
-        return '$this->getPluginProxy()->view->'.$name.'('.Compiler::implode_r($params).')';
86
-    }
74
+	/**
75
+	 * returns the code (as a string) to call the plugin
76
+	 * (this will be executed at runtime inside the Dwoo class).
77
+	 *
78
+	 * @param string $name   the plugin name
79
+	 * @param array  $params a parameter array, array key "*" is the rest array
80
+	 *
81
+	 * @return string
82
+	 */
83
+	public function getCode($name, $params)
84
+	{
85
+		return '$this->getPluginProxy()->view->'.$name.'('.Compiler::implode_r($params).')';
86
+	}
87 87
 
88
-    /**
89
-     * returns a callback to the plugin, this is used with the reflection API to
90
-     * find out about the plugin's parameter names etc.
91
-     *
92
-     * should you need a rest array (i.e. for ZendFramework helpers) without the
93
-     * possibility to edit the plugin's code, you can provide a callback to some
94
-     * other function with the correct parameter signature, i.e. :
95
-     * <code>
96
-     * return array($this, "callbackHelper");
97
-     * // and callbackHelper would be as such:
98
-     * public function callbackHelper(array $rest=array()){}
99
-     * </code>
100
-     *
101
-     * @param string $name the plugin name
102
-     *
103
-     * @return callback
104
-     */
105
-    public function getCallback($name)
106
-    {
107
-        return array($this->view->getHelper($name), $name);
108
-    }
88
+	/**
89
+	 * returns a callback to the plugin, this is used with the reflection API to
90
+	 * find out about the plugin's parameter names etc.
91
+	 *
92
+	 * should you need a rest array (i.e. for ZendFramework helpers) without the
93
+	 * possibility to edit the plugin's code, you can provide a callback to some
94
+	 * other function with the correct parameter signature, i.e. :
95
+	 * <code>
96
+	 * return array($this, "callbackHelper");
97
+	 * // and callbackHelper would be as such:
98
+	 * public function callbackHelper(array $rest=array()){}
99
+	 * </code>
100
+	 *
101
+	 * @param string $name the plugin name
102
+	 *
103
+	 * @return callback
104
+	 */
105
+	public function getCallback($name)
106
+	{
107
+		return array($this->view->getHelper($name), $name);
108
+	}
109 109
 
110
-    /**
111
-     * returns some code that will check if the plugin is loaded and if not load it
112
-     * this is optional, if your plugins are autoloaded or whatever, just return an
113
-     * empty string.
114
-     *
115
-     * @param string $name the plugin name
116
-     *
117
-     * @return string
118
-     */
119
-    public function getLoader($name)
120
-    {
121
-        return '';
122
-    }
110
+	/**
111
+	 * returns some code that will check if the plugin is loaded and if not load it
112
+	 * this is optional, if your plugins are autoloaded or whatever, just return an
113
+	 * empty string.
114
+	 *
115
+	 * @param string $name the plugin name
116
+	 *
117
+	 * @return string
118
+	 */
119
+	public function getLoader($name)
120
+	{
121
+		return '';
122
+	}
123 123
 }
Please login to merge, or discard this patch.
lib/Dwoo/Processor.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -23,30 +23,30 @@
 block discarded – undo
23 23
  */
24 24
 abstract class Processor
25 25
 {
26
-    /**
27
-     * The compiler instance that runs this processor.
28
-     *
29
-     * @var Core
30
-     */
31
-    protected $compiler;
26
+	/**
27
+	 * The compiler instance that runs this processor.
28
+	 *
29
+	 * @var Core
30
+	 */
31
+	protected $compiler;
32 32
 
33
-    /**
34
-     * Constructor, if you override it, call parent::__construct($compiler); or assign
35
-     * the dwoo instance yourself if you need it.
36
-     *
37
-     * @param Compiler $compiler the compiler class
38
-     */
39
-    public function __construct(Compiler $compiler)
40
-    {
41
-        $this->compiler = $compiler;
42
-    }
33
+	/**
34
+	 * Constructor, if you override it, call parent::__construct($compiler); or assign
35
+	 * the dwoo instance yourself if you need it.
36
+	 *
37
+	 * @param Compiler $compiler the compiler class
38
+	 */
39
+	public function __construct(Compiler $compiler)
40
+	{
41
+		$this->compiler = $compiler;
42
+	}
43 43
 
44
-    /**
45
-     * Processes the input and returns it filtered.
46
-     *
47
-     * @param string $input the template to process
48
-     *
49
-     * @return string
50
-     */
51
-    abstract public function process($input);
44
+	/**
45
+	 * Processes the input and returns it filtered.
46
+	 *
47
+	 * @param string $input the template to process
48
+	 *
49
+	 * @return string
50
+	 */
51
+	abstract public function process($input);
52 52
 }
Please login to merge, or discard this patch.