Completed
Push — prado-3.3 ( f5b914 )
by Fabio
07:15
created
framework/Web/UI/WebControls/TRegularExpressionValidator.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function getRegularExpression()
64 64
 	{
65
-		return $this->getViewState('RegularExpression','');
65
+		return $this->getViewState('RegularExpression', '');
66 66
 	}
67 67
 
68 68
 	/**
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 	 */
71 71
 	public function setRegularExpression($value)
72 72
 	{
73
-		$this->setViewState('RegularExpression',$value,'');
73
+		$this->setViewState('RegularExpression', $value, '');
74 74
 	}
75 75
 
76 76
 	/**
@@ -84,10 +84,10 @@  discard block
 block discarded – undo
84 84
 	{
85 85
 		if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
86 86
 			return true;
87
-		if(($expression=addcslashes($this->getRegularExpression(),"/"))!=='')
87
+		if(($expression=addcslashes($this->getRegularExpression(), "/"))!=='')
88 88
 		{
89
-			$mods = $this->getPatternModifiers();
90
-			return preg_match("/^$expression\$/{$mods}",$value);
89
+			$mods=$this->getPatternModifiers();
90
+			return preg_match("/^$expression\$/{$mods}", $value);
91 91
 		}
92 92
 		else
93 93
 			return true;
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 */
134 134
 	protected function getClientScriptOptions()
135 135
 	{
136
-		$options = parent::getClientScriptOptions();
136
+		$options=parent::getClientScriptOptions();
137 137
 		$options['ValidationExpression']=$this->getRegularExpression();
138 138
 		$options['PatternModifiers']=$this->getClientSidePatternModifiers();
139 139
 		return $options;
Please login to merge, or discard this patch.
framework/Web/UI/WebControls/TCaptchaValidator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function getCaptchaControl()
52 52
 	{
53
-		return $this->getViewState('CaptchaControl','');
53
+		return $this->getViewState('CaptchaControl', '');
54 54
 	}
55 55
 
56 56
 	/**
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public function setCaptchaControl($value)
63 63
 	{
64
-		$this->setViewState('CaptchaControl',TPropertyValue::ensureString($value),'');
64
+		$this->setViewState('CaptchaControl', TPropertyValue::ensureString($value), '');
65 65
 	}
66 66
 
67 67
 	/**
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
 		if(($id=$this->getCaptchaControl())==='')
88 88
 			throw new TConfigurationException('captchavalidator_captchacontrol_required');
89 89
 		else if(($control=$this->findControl($id))===null)
90
-			throw new TConfigurationException('captchavalidator_captchacontrol_inexistent',$id);
90
+			throw new TConfigurationException('captchavalidator_captchacontrol_inexistent', $id);
91 91
 		else if(!($control instanceof TCaptcha))
92
-			throw new TConfigurationException('captchavalidator_captchacontrol_invalid',$id);
92
+			throw new TConfigurationException('captchavalidator_captchacontrol_invalid', $id);
93 93
 		else
94 94
 			return $control;
95 95
 	}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	private function generateTokenHash($token)
119 119
 	{
120
-		for($h=0,$i=strlen($token)-1;$i>=0;--$i)
120
+		for($h=0, $i=strlen($token) - 1; $i >= 0; --$i)
121 121
 			$h+=ord($token[$i]);
122 122
 		return $h;
123 123
 	}
Please login to merge, or discard this patch.
framework/Web/UI/TTemplateControl.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	protected function loadTemplate()
117 117
 	{
118
-		Prado::trace("Loading template ".get_class($this),'System.Web.UI.TTemplateControl');
118
+		Prado::trace("Loading template ".get_class($this), 'System.Web.UI.TTemplateControl');
119 119
 		$template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this));
120 120
 		return $template;
121 121
 	}
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 			foreach($tpl->getDirective() as $name=>$value)
133 133
 			{
134 134
 				if(is_string($value))
135
-					$this->setSubProperty($name,$value);
135
+					$this->setSubProperty($name, $value);
136 136
 				else
137
-					throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
137
+					throw new TConfigurationException('templatecontrol_directive_invalid', get_class($this), $name);
138 138
 			}
139 139
 			$tpl->instantiateIn($this);
140 140
 		}
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
 	 * @param string ID of the content
146 146
 	 * @param TContent
147 147
 	 */
148
-	public function registerContent($id,TContent $object)
148
+	public function registerContent($id, TContent $object)
149 149
 	{
150 150
 		if(isset($this->_contents[$id]))
151
-			throw new TConfigurationException('templatecontrol_contentid_duplicated',$id);
151
+			throw new TConfigurationException('templatecontrol_contentid_duplicated', $id);
152 152
 		else
153 153
 			$this->_contents[$id]=$object;
154 154
 	}
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	 * @param string placeholder ID
160 160
 	 * @param TContentPlaceHolder placeholder control
161 161
 	 */
162
-	public function registerContentPlaceHolder($id,TContentPlaceHolder $object)
162
+	public function registerContentPlaceHolder($id, TContentPlaceHolder $object)
163 163
 	{
164 164
 		if(isset($this->_placeholders[$id]))
165
-			throw new TConfigurationException('templatecontrol_placeholderid_duplicated',$id);
165
+			throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id);
166 166
 		else
167 167
 			$this->_placeholders[$id]=$object;
168 168
 	}
@@ -197,17 +197,17 @@  discard block
 block discarded – undo
197 197
 	 * @param string ID of the content control
198 198
 	 * @param TContent the content to be injected
199 199
 	 */
200
-	public function injectContent($id,$content)
200
+	public function injectContent($id, $content)
201 201
 	{
202 202
 		if(isset($this->_placeholders[$id]))
203 203
 		{
204 204
 			$placeholder=$this->_placeholders[$id];
205 205
 			$controls=$placeholder->getParent()->getControls();
206 206
 			$loc=$controls->remove($placeholder);
207
-			$controls->insertAt($loc,$content);
207
+			$controls->insertAt($loc, $content);
208 208
 		}
209 209
 		else
210
-			throw new TConfigurationException('templatecontrol_placeholder_inexistent',$id);
210
+			throw new TConfigurationException('templatecontrol_placeholder_inexistent', $id);
211 211
 	}
212 212
 
213 213
 	/**
@@ -231,10 +231,10 @@  discard block
 block discarded – undo
231 231
 			$this->getControls()->add($master);
232 232
 			$master->ensureChildControls();
233 233
 			foreach($this->_contents as $id=>$content)
234
-				$master->injectContent($id,$content);
234
+				$master->injectContent($id, $content);
235 235
 		}
236 236
 		else if(!empty($this->_contents))
237
-			throw new TConfigurationException('templatecontrol_mastercontrol_required',get_class($this));
237
+			throw new TConfigurationException('templatecontrol_mastercontrol_required', get_class($this));
238 238
 		parent::initRecursive($namingContainer);
239 239
 	}
240 240
         
@@ -245,38 +245,38 @@  discard block
 block discarded – undo
245 245
          * @param Boolean $throwExceptions Wheter or not to throw exceptions
246 246
          * @author Daniel Sampedro <[email protected]>
247 247
          */
248
-        public function tryToUpdateView($arObj, $throwExceptions = false)
248
+        public function tryToUpdateView($arObj, $throwExceptions=false)
249 249
         {
250
-                $objAttrs = get_class_vars(get_class($arObj));
251
-                foreach (array_keys($objAttrs) as $key)
250
+                $objAttrs=get_class_vars(get_class($arObj));
251
+                foreach(array_keys($objAttrs) as $key)
252 252
                 {
253 253
                         try
254 254
                         {
255
-                                if ($key != "RELATIONS")
255
+                                if($key!="RELATIONS")
256 256
                                 {
257
-                                        $control = $this->{$key};
258
-                                        if ($control instanceof TTextBox)
259
-                                                $control->Text = $arObj->{$key};
260
-                                        elseif ($control instanceof TCheckBox)
261
-                                                $control->Checked = (boolean) $arObj->{$key};
262
-                                        elseif ($control instanceof TDatePicker)
263
-                                                $control->Date = $arObj->{$key};
257
+                                        $control=$this->{$key};
258
+                                        if($control instanceof TTextBox)
259
+                                                $control->Text=$arObj->{$key};
260
+                                        elseif($control instanceof TCheckBox)
261
+                                                $control->Checked=(boolean) $arObj->{$key};
262
+                                        elseif($control instanceof TDatePicker)
263
+                                                $control->Date=$arObj->{$key};
264 264
                                 }
265 265
                                 else
266 266
                                 {
267
-                                        foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
267
+                                        foreach($objAttrs["RELATIONS"] as $relKey => $relValues)
268 268
                                         {
269
-                                                $relControl = $this->{$relKey};
270
-                                                switch ($relValues[0])
269
+                                                $relControl=$this->{$relKey};
270
+                                                switch($relValues[0])
271 271
                                                 {
272 272
                                                         case TActiveRecord::BELONGS_TO:
273 273
                                                         case TActiveRecord::HAS_ONE:
274
-                                                                $relControl->Text = $arObj->{$relKey};
274
+                                                                $relControl->Text=$arObj->{$relKey};
275 275
                                                                 break;
276 276
                                                         case TActiveRecord::HAS_MANY:
277
-                                                                if ($relControl instanceof TListControl)
277
+                                                                if($relControl instanceof TListControl)
278 278
                                                                 {
279
-                                                                        $relControl->DataSource = $arObj->{$relKey};
279
+                                                                        $relControl->DataSource=$arObj->{$relKey};
280 280
                                                                         $relControl->dataBind();
281 281
                                                                 }
282 282
                                                                 break;
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
                                         break;
286 286
                                 }
287 287
                         } 
288
-                        catch (Exception $ex)
288
+                        catch(Exception $ex)
289 289
                         {
290
-                                if ($throwExceptions)
290
+                                if($throwExceptions)
291 291
                                         throw $ex;
292 292
                         }
293 293
                 }
@@ -299,26 +299,26 @@  discard block
 block discarded – undo
299 299
          * @param Boolean $throwExceptions Wheter or not to throw exceptions
300 300
          * @author Daniel Sampedro <[email protected]>
301 301
          */
302
-        public function tryToUpdateAR($arObj, $throwExceptions = false)
302
+        public function tryToUpdateAR($arObj, $throwExceptions=false)
303 303
         {
304
-                $objAttrs = get_class_vars(get_class($arObj));
305
-                foreach (array_keys($objAttrs) as $key)
304
+                $objAttrs=get_class_vars(get_class($arObj));
305
+                foreach(array_keys($objAttrs) as $key)
306 306
                 {
307 307
                         try
308 308
                         {
309
-                                if ($key == "RELATIONS")
309
+                                if($key=="RELATIONS")
310 310
                                         break;
311
-                                $control = $this->{$key};
312
-                                if ($control instanceof TTextBox)
313
-                                        $arObj->{$key} = $control->Text;
314
-                                elseif ($control instanceof TCheckBox)
315
-                                        $arObj->{$key} = $control->Checked;
316
-                                elseif ($control instanceof TDatePicker)
317
-                                        $arObj->{$key} = $control->Date;
311
+                                $control=$this->{$key};
312
+                                if($control instanceof TTextBox)
313
+                                        $arObj->{$key}=$control->Text;
314
+                                elseif($control instanceof TCheckBox)
315
+                                        $arObj->{$key}=$control->Checked;
316
+                                elseif($control instanceof TDatePicker)
317
+                                        $arObj->{$key}=$control->Date;
318 318
                         } 
319
-                        catch (Exception $ex)
319
+                        catch(Exception $ex)
320 320
                         {
321
-                                if ($throwExceptions)
321
+                                if($throwExceptions)
322 322
                                         throw $ex;
323 323
                         }
324 324
                 }
Please login to merge, or discard this patch.
framework/Web/UI/TSessionPageStatePersister.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function setHistorySize($value)
81 81
 	{
82
-		if(($value=TPropertyValue::ensureInteger($value))>0)
82
+		if(($value=TPropertyValue::ensureInteger($value)) > 0)
83 83
 			$this->_historySize=$value;
84 84
 		else
85 85
 			throw new TInvalidDataValueException('sessionpagestatepersister_historysize_invalid');
@@ -93,19 +93,19 @@  discard block
 block discarded – undo
93 93
 		$session=$this->_page->getSession();
94 94
 		$session->open();
95 95
 		$data=serialize($state);
96
-		$timestamp=(string)microtime(true);
96
+		$timestamp=(string) microtime(true);
97 97
 		$key=self::STATE_SESSION_KEY.$timestamp;
98
-		$session->add($key,$data);
98
+		$session->add($key, $data);
99 99
 		if(($queue=$session->itemAt(self::QUEUE_SESSION_KEY))===null)
100 100
 			$queue=array();
101 101
 		$queue[]=$key;
102
-		if(count($queue)>$this->getHistorySize())
102
+		if(count($queue) > $this->getHistorySize())
103 103
 		{
104 104
 			$expiredKey=array_shift($queue);
105 105
 			$session->remove($expiredKey);
106 106
 		}
107
-		$session->add(self::QUEUE_SESSION_KEY,$queue);
108
-		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page,$timestamp));
107
+		$session->add(self::QUEUE_SESSION_KEY, $queue);
108
+		$this->_page->setClientState(TPageStateFormatter::serialize($this->_page, $timestamp));
109 109
 	}
110 110
 
111 111
 	/**
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	public function load()
117 117
 	{
118
-		if(($timestamp=TPageStateFormatter::unserialize($this->_page,$this->_page->getRequestClientState()))!==null)
118
+		if(($timestamp=TPageStateFormatter::unserialize($this->_page, $this->_page->getRequestClientState()))!==null)
119 119
 		{
120 120
 			$session=$this->_page->getSession();
121 121
 			$session->open();
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			if(($data=$session->itemAt($key))!==null)
124 124
 				return unserialize($data);
125 125
 		}
126
-		throw new THttpException(400,'sessionpagestatepersister_pagestate_corrupted');
126
+		throw new THttpException(400, 'sessionpagestatepersister_pagestate_corrupted');
127 127
 	}
128 128
 }
129 129
 
Please login to merge, or discard this patch.
framework/Web/UI/TControlAdapter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 	 */
49 49
 	public function getPage()
50 50
 	{
51
-		return $this->_control?$this->_control->getPage():null;
51
+		return $this->_control ? $this->_control->getPage() : null;
52 52
 	}
53 53
 
54 54
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/TForm.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	protected function addAttributesToRender($writer)
45 45
 	{
46
-		$writer->addAttribute('id',$this->getClientID());
47
-		$writer->addAttribute('method',$this->getMethod());
46
+		$writer->addAttribute('id', $this->getClientID());
47
+		$writer->addAttribute('method', $this->getMethod());
48 48
 		$uri=$this->getRequest()->getRequestURI();
49
-		$writer->addAttribute('action',str_replace('&','&amp;',str_replace('&amp;','&',$uri)));
49
+		$writer->addAttribute('action', str_replace('&', '&amp;', str_replace('&amp;', '&', $uri)));
50 50
 		if(($enctype=$this->getEnctype())!=='')
51
-			$writer->addAttribute('enctype',$enctype);
51
+			$writer->addAttribute('enctype', $enctype);
52 52
 
53 53
 		$attributes=$this->getAttributes();
54 54
 		$attributes->remove('action');
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			if(($button=$this->findControl($butt))!==null)
60 60
 				$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
61 61
 			else
62
-				throw new TInvalidDataValueException('form_defaultbutton_invalid',$butt);
62
+				throw new TInvalidDataValueException('form_defaultbutton_invalid', $butt);
63 63
 		}
64 64
 	}
65 65
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	public function getDefaultButton()
110 110
 	{
111
-		return $this->getViewState('DefaultButton','');
111
+		return $this->getViewState('DefaultButton', '');
112 112
 	}
113 113
 
114 114
 	/**
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function setDefaultButton($value)
121 121
 	{
122
-		$this->setViewState('DefaultButton',$value,'');
122
+		$this->setViewState('DefaultButton', $value, '');
123 123
 	}
124 124
 
125 125
 	/**
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function getMethod()
129 129
 	{
130
-		return $this->getViewState('Method','post');
130
+		return $this->getViewState('Method', 'post');
131 131
 	}
132 132
 
133 133
 	/**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function setMethod($value)
137 137
 	{
138
-		$this->setViewState('Method',TPropertyValue::ensureEnum($value,'post','get'),'post');
138
+		$this->setViewState('Method', TPropertyValue::ensureEnum($value, 'post', 'get'), 'post');
139 139
 	}
140 140
 
141 141
 	/**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 	 */
144 144
 	public function getEnctype()
145 145
 	{
146
-		return $this->getViewState('Enctype','');
146
+		return $this->getViewState('Enctype', '');
147 147
 	}
148 148
 
149 149
 	/**
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 	 */
156 156
 	public function setEnctype($value)
157 157
 	{
158
-		$this->setViewState('Enctype',$value,'');
158
+		$this->setViewState('Enctype', $value, '');
159 159
 	}
160 160
 
161 161
 	/**
Please login to merge, or discard this patch.
framework/Web/UI/THtmlWriter.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 
89 89
 	public function setWriter($writer)
90 90
 	{
91
-		$this->_writer = $writer;
91
+		$this->_writer=$writer;
92 92
 	}
93 93
 	/**
94 94
 	 * Adds a list of attributes to be rendered.
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @param string name of the attribute
106 106
 	 * @param string value of the attribute
107 107
 	 */
108
-	public function addAttribute($name,$value)
108
+	public function addAttribute($name, $value)
109 109
 	{
110 110
 		$this->_attributes[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value);
111 111
 	}
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 	 * @param string stylesheet attribute name
135 135
 	 * @param string stylesheet attribute value
136 136
 	 */
137
-	public function addStyleAttribute($name,$value)
137
+	public function addStyleAttribute($name, $value)
138 138
 	{
139 139
 		$this->_styles[THttpUtility::htmlStrip($name)]=THttpUtility::htmlEncode($value);
140 140
 	}
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 		if(isset(self::$_simpleTags[$tagName]))
204 204
 		{
205 205
 			$str.=' />';
206
-			$this->_openTags[] = '';
206
+			$this->_openTags[]='';
207 207
 		}
208 208
 		else
209 209
 		{
210 210
 			$str.='>';
211
-			$this->_openTags[] = $tagName;
211
+			$this->_openTags[]=$tagName;
212 212
 		}
213 213
 		$this->_writer->write($str);
214 214
 		$this->_attributes=array();
Please login to merge, or discard this patch.
framework/Web/UI/TControl.php 1 patch
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 * Indexes for the rare fields.
111 111
 	 * In order to save memory, rare fields will only be created if they are needed.
112 112
 	 */
113
-	const RF_CONTROLS=0;			// child controls
114
-	const RF_CHILD_STATE=1;			// child state field
115
-	const RF_NAMED_CONTROLS=2;		// list of controls whose namingcontainer is this control
116
-	const RF_NAMED_CONTROLS_ID=3;	// counter for automatic id
117
-	const RF_SKIN_ID=4;				// skin ID
118
-	const RF_DATA_BINDINGS=5;		// data bindings
119
-	const RF_EVENTS=6;				// event handlers
120
-	const RF_CONTROLSTATE=7;		// controlstate
121
-	const RF_NAMED_OBJECTS=8;		// controls declared with ID on template
122
-	const RF_ADAPTER=9;				// adapter
123
-	const RF_AUTO_BINDINGS=10;		// auto data bindings
113
+	const RF_CONTROLS=0; // child controls
114
+	const RF_CHILD_STATE=1; // child state field
115
+	const RF_NAMED_CONTROLS=2; // list of controls whose namingcontainer is this control
116
+	const RF_NAMED_CONTROLS_ID=3; // counter for automatic id
117
+	const RF_SKIN_ID=4; // skin ID
118
+	const RF_DATA_BINDINGS=5; // data bindings
119
+	const RF_EVENTS=6; // event handlers
120
+	const RF_CONTROLSTATE=7; // controlstate
121
+	const RF_NAMED_OBJECTS=8; // controls declared with ID on template
122
+	const RF_ADAPTER=9; // adapter
123
+	const RF_AUTO_BINDINGS=10; // auto data bindings
124 124
 
125 125
 	/**
126 126
 	 * @var string control ID
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 */
209 209
 	public function getAdapter()
210 210
 	{
211
-		return isset($this->_rf[self::RF_ADAPTER])?$this->_rf[self::RF_ADAPTER]:null;
211
+		return isset($this->_rf[self::RF_ADAPTER]) ? $this->_rf[self::RF_ADAPTER] : null;
212 212
 	}
213 213
 
214 214
 	/**
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
 	 */
349 349
 	public function setID($id)
350 350
 	{
351
-		if(!preg_match(self::ID_FORMAT,$id))
352
-			throw new TInvalidDataValueException('control_id_invalid',get_class($this),$id);
351
+		if(!preg_match(self::ID_FORMAT, $id))
352
+			throw new TInvalidDataValueException('control_id_invalid', get_class($this), $id);
353 353
 		$this->_id=$id;
354
-		$this->_flags |= self::IS_ID_SET;
354
+		$this->_flags|=self::IS_ID_SET;
355 355
 		$this->clearCachedUniqueID($this instanceof INamingContainer);
356 356
 		if($this->_namingContainer)
357 357
 			$this->_namingContainer->clearNameTable();
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 	{
369 369
 		if($this->_uid==='' || $this->_uid===null)	// need to build the UniqueID
370 370
 		{
371
-			$this->_uid='';  // set to not-null, so that clearCachedUniqueID() may take action
371
+			$this->_uid=''; // set to not-null, so that clearCachedUniqueID() may take action
372 372
 			if($namingContainer=$this->getNamingContainer())
373 373
 			{
374 374
 				if($this->getPage()===$namingContainer)
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 */
403 403
 	public function getClientID()
404 404
 	{
405
-		return strtr($this->getUniqueID(),self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR);
405
+		return strtr($this->getUniqueID(), self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR);
406 406
 	}
407 407
 
408 408
 	/**
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	public static function convertUniqueIdToClientId($uniqueID)
414 414
 	{
415
-		return strtr($uniqueID,self::ID_SEPARATOR,self::CLIENT_ID_SEPARATOR);
415
+		return strtr($uniqueID, self::ID_SEPARATOR, self::CLIENT_ID_SEPARATOR);
416 416
 	}
417 417
 
418 418
 	/**
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 	 */
421 421
 	public function getSkinID()
422 422
 	{
423
-		return isset($this->_rf[self::RF_SKIN_ID])?$this->_rf[self::RF_SKIN_ID]:'';
423
+		return isset($this->_rf[self::RF_SKIN_ID]) ? $this->_rf[self::RF_SKIN_ID] : '';
424 424
 	}
425 425
 
426 426
 	/**
@@ -429,8 +429,8 @@  discard block
 block discarded – undo
429 429
 	 */
430 430
 	public function setSkinID($value)
431 431
 	{
432
-		if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage>=self::CS_CHILD_INITIALIZED)
433
-			throw new TInvalidOperationException('control_skinid_unchangeable',get_class($this));
432
+		if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage >= self::CS_CHILD_INITIALIZED)
433
+			throw new TInvalidOperationException('control_skinid_unchangeable', get_class($this));
434 434
 		else
435 435
 			$this->_rf[self::RF_SKIN_ID]=$value;
436 436
 	}
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 		if($this->_flags & self::IS_DISABLE_THEMING)
454 454
 			return false;
455 455
 		else
456
-			return $this->_parent?$this->_parent->getEnableTheming():true;
456
+			return $this->_parent ? $this->_parent->getEnableTheming() : true;
457 457
 	}
458 458
 
459 459
 	/**
@@ -462,12 +462,12 @@  discard block
 block discarded – undo
462 462
 	 */
463 463
 	public function setEnableTheming($value)
464 464
 	{
465
-		if($this->_stage>=self::CS_CHILD_INITIALIZED)
466
-			throw new TInvalidOperationException('control_enabletheming_unchangeable',get_class($this),$this->getUniqueID());
465
+		if($this->_stage >= self::CS_CHILD_INITIALIZED)
466
+			throw new TInvalidOperationException('control_enabletheming_unchangeable', get_class($this), $this->getUniqueID());
467 467
 		else if(TPropertyValue::ensureBoolean($value))
468
-			$this->_flags &= ~self::IS_DISABLE_THEMING;
468
+			$this->_flags&=~self::IS_DISABLE_THEMING;
469 469
 		else
470
-			$this->_flags |= self::IS_DISABLE_THEMING;
470
+			$this->_flags|=self::IS_DISABLE_THEMING;
471 471
 	}
472 472
 
473 473
 	/**
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 */
480 480
 	public function getCustomData()
481 481
 	{
482
-		return $this->getViewState('CustomData',null);
482
+		return $this->getViewState('CustomData', null);
483 483
 	}
484 484
 
485 485
 	/**
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 */
490 490
 	public function setCustomData($value)
491 491
 	{
492
-		$this->setViewState('CustomData',$value,null);
492
+		$this->setViewState('CustomData', $value, null);
493 493
 	}
494 494
 
495 495
 	/**
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 	 */
498 498
 	public function getHasControls()
499 499
 	{
500
-		return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount()>0;
500
+		return isset($this->_rf[self::RF_CONTROLS]) && $this->_rf[self::RF_CONTROLS]->getCount() > 0;
501 501
 	}
502 502
 
503 503
 	/**
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 */
518 518
 	protected function createControlCollection()
519 519
 	{
520
-		return $this->getAllowChildControls()?new TControlCollection($this):new TEmptyControlCollection($this);
520
+		return $this->getAllowChildControls() ? new TControlCollection($this) : new TEmptyControlCollection($this);
521 521
 	}
522 522
 
523 523
 	/**
@@ -531,13 +531,13 @@  discard block
 block discarded – undo
531 531
 	{
532 532
 		if($checkParents)
533 533
 		{
534
-			for($control=$this;$control;$control=$control->_parent)
534
+			for($control=$this; $control; $control=$control->_parent)
535 535
 				if(!$control->getVisible(false))
536 536
 					return false;
537 537
 			return true;
538 538
 		}
539 539
 		else
540
-			return $this->getViewState('Visible',true);
540
+			return $this->getViewState('Visible', true);
541 541
 	}
542 542
 
543 543
 	/**
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
 	 */
546 546
 	public function setVisible($value)
547 547
 	{
548
-		$this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true);
548
+		$this->setViewState('Visible', TPropertyValue::ensureBoolean($value), true);
549 549
 	}
550 550
 
551 551
 	/**
@@ -562,13 +562,13 @@  discard block
 block discarded – undo
562 562
 	{
563 563
 		if($checkParents)
564 564
 		{
565
-			for($control=$this;$control;$control=$control->_parent)
566
-				if(!$control->getViewState('Enabled',true))
565
+			for($control=$this; $control; $control=$control->_parent)
566
+				if(!$control->getViewState('Enabled', true))
567 567
 					return false;
568 568
 			return true;
569 569
 		}
570 570
 		else
571
-			return $this->getViewState('Enabled',true);
571
+			return $this->getViewState('Enabled', true);
572 572
 	}
573 573
 
574 574
 	/**
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 	 */
577 577
 	public function setEnabled($value)
578 578
 	{
579
-		$this->setViewState('Enabled',TPropertyValue::ensureBoolean($value),true);
579
+		$this->setViewState('Enabled', TPropertyValue::ensureBoolean($value), true);
580 580
 	}
581 581
 
582 582
 	/**
@@ -584,8 +584,8 @@  discard block
 block discarded – undo
584 584
 	 */
585 585
 	public function getHasAttributes()
586 586
 	{
587
-		if($attributes=$this->getViewState('Attributes',null))
588
-			return $attributes->getCount()>0;
587
+		if($attributes=$this->getViewState('Attributes', null))
588
+			return $attributes->getCount() > 0;
589 589
 		else
590 590
 			return false;
591 591
 	}
@@ -598,12 +598,12 @@  discard block
 block discarded – undo
598 598
 	 */
599 599
 	public function getAttributes()
600 600
 	{
601
-		if($attributes=$this->getViewState('Attributes',null))
601
+		if($attributes=$this->getViewState('Attributes', null))
602 602
 			return $attributes;
603 603
 		else
604 604
 		{
605 605
 			$attributes=new TAttributeCollection;
606
-			$this->setViewState('Attributes',$attributes,null);
606
+			$this->setViewState('Attributes', $attributes, null);
607 607
 			return $attributes;
608 608
 		}
609 609
 	}
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 */
614 614
 	public function hasAttribute($name)
615 615
 	{
616
-		if($attributes=$this->getViewState('Attributes',null))
616
+		if($attributes=$this->getViewState('Attributes', null))
617 617
 			return $attributes->contains($name);
618 618
 		else
619 619
 			return false;
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 	 */
625 625
 	public function getAttribute($name)
626 626
 	{
627
-		if($attributes=$this->getViewState('Attributes',null))
627
+		if($attributes=$this->getViewState('Attributes', null))
628 628
 			return $attributes->itemAt($name);
629 629
 		else
630 630
 			return null;
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
 	 * @param string attribute name
636 636
 	 * @param string value of the attribute
637 637
 	 */
638
-	public function setAttribute($name,$value)
638
+	public function setAttribute($name, $value)
639 639
 	{
640
-		$this->getAttributes()->add($name,$value);
640
+		$this->getAttributes()->add($name, $value);
641 641
 	}
642 642
 
643 643
 	/**
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
 	 */
648 648
 	public function removeAttribute($name)
649 649
 	{
650
-		if($attributes=$this->getViewState('Attributes',null))
650
+		if($attributes=$this->getViewState('Attributes', null))
651 651
 			return $attributes->remove($name);
652 652
 		else
653 653
 			return null;
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 	{
661 661
 		if($checkParents)
662 662
 		{
663
-			for($control=$this;$control!==null;$control=$control->getParent())
663
+			for($control=$this; $control!==null; $control=$control->getParent())
664 664
 				if($control->_flags & self::IS_DISABLE_VIEWSTATE)
665 665
 					return false;
666 666
 			return true;
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
 	public function setEnableViewState($value)
676 676
 	{
677 677
 		if(TPropertyValue::ensureBoolean($value))
678
-			$this->_flags &= ~self::IS_DISABLE_VIEWSTATE;
678
+			$this->_flags&=~self::IS_DISABLE_VIEWSTATE;
679 679
 		else
680
-			$this->_flags |= self::IS_DISABLE_VIEWSTATE;
680
+			$this->_flags|=self::IS_DISABLE_VIEWSTATE;
681 681
 	}
682 682
 
683 683
 	/**
@@ -689,9 +689,9 @@  discard block
 block discarded – undo
689 689
 	 * @param mixed the default value. If $key is not found in controlstate, $defaultValue will be returned
690 690
 	 * @return mixed the controlstate value corresponding to $key
691 691
 	 */
692
-	protected function getControlState($key,$defaultValue=null)
692
+	protected function getControlState($key, $defaultValue=null)
693 693
 	{
694
-		return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue;
694
+		return isset($this->_rf[self::RF_CONTROLSTATE][$key]) ? $this->_rf[self::RF_CONTROLSTATE][$key] : $defaultValue;
695 695
 	}
696 696
 
697 697
 	/**
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 	 * @param mixed the controlstate value to be set
705 705
 	 * @param mixed default value. If $value===$defaultValue, the item will be cleared from controlstate
706 706
 	 */
707
-	protected function setControlState($key,$value,$defaultValue=null)
707
+	protected function setControlState($key, $value, $defaultValue=null)
708 708
 	{
709 709
 		if($value===$defaultValue)
710 710
 			unset($this->_rf[self::RF_CONTROLSTATE][$key]);
@@ -741,10 +741,10 @@  discard block
 block discarded – undo
741 741
 	 * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned
742 742
 	 * @return mixed the viewstate value corresponding to $key
743 743
 	 */
744
-	public function getViewState($key,$defaultValue=null)
744
+	public function getViewState($key, $defaultValue=null)
745 745
 	{
746 746
 		if(isset($this->_viewState[$key]))
747
-			return $this->_viewState[$key]!==null?$this->_viewState[$key]:$defaultValue;
747
+			return $this->_viewState[$key]!==null ? $this->_viewState[$key] : $defaultValue;
748 748
 		else if(isset($this->_tempState[$key]))
749 749
 		{
750 750
 			if(is_object($this->_tempState[$key]) && $this->_trackViewState)
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	 * @param mixed the viewstate value to be set
766 766
 	 * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate.
767 767
 	 */
768
-	public function setViewState($key,$value,$defaultValue=null)
768
+	public function setViewState($key, $value, $defaultValue=null)
769 769
 	{
770 770
 		if($this->_trackViewState)
771 771
 		{
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 	 * @param string the property name, or property path
802 802
 	 * @param string the expression
803 803
 	 */
804
-	public function bindProperty($name,$expression)
804
+	public function bindProperty($name, $expression)
805 805
 	{
806 806
 		$this->_rf[self::RF_DATA_BINDINGS][$name]=$expression;
807 807
 	}
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 	 * @param string the property name, or property path
824 824
 	 * @param string the expression
825 825
 	 */
826
-	public function autoBindProperty($name,$expression)
826
+	public function autoBindProperty($name, $expression)
827 827
 	{
828 828
 		$this->_rf[self::RF_AUTO_BINDINGS][$name]=$expression;
829 829
 	}
@@ -843,13 +843,13 @@  discard block
 block discarded – undo
843 843
 	 */
844 844
 	protected function dataBindProperties()
845 845
 	{
846
-		Prado::trace("Data bind properties",'System.Web.UI.TControl');
846
+		Prado::trace("Data bind properties", 'System.Web.UI.TControl');
847 847
 		if(isset($this->_rf[self::RF_DATA_BINDINGS]))
848 848
 		{
849 849
 			if(($context=$this->getTemplateControl())===null)
850 850
 				$context=$this;
851 851
 			foreach($this->_rf[self::RF_DATA_BINDINGS] as $property=>$expression)
852
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
852
+				$this->setSubProperty($property, $context->evaluateExpression($expression));
853 853
 		}
854 854
 	}
855 855
 
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
 			if(($context=$this->getTemplateControl())===null)
864 864
 				$context=$this;
865 865
 			foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property=>$expression)
866
-				$this->setSubProperty($property,$context->evaluateExpression($expression));
866
+				$this->setSubProperty($property, $context->evaluateExpression($expression));
867 867
 		}
868 868
 	}
869 869
 
@@ -872,7 +872,7 @@  discard block
 block discarded – undo
872 872
 	 */
873 873
 	protected function dataBindChildren()
874 874
 	{
875
-		Prado::trace("dataBindChildren()",'System.Web.UI.TControl');
875
+		Prado::trace("dataBindChildren()", 'System.Web.UI.TControl');
876 876
 		if(isset($this->_rf[self::RF_CONTROLS]))
877 877
 		{
878 878
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
@@ -897,12 +897,12 @@  discard block
 block discarded – undo
897 897
 	final protected function setChildControlsCreated($value)
898 898
 	{
899 899
 		if($value)
900
-			$this->_flags |= self::IS_CHILD_CREATED;
900
+			$this->_flags|=self::IS_CHILD_CREATED;
901 901
 		else
902 902
 		{
903 903
 			if($this->getHasControls() && ($this->_flags & self::IS_CHILD_CREATED))
904 904
 				$this->getControls()->clear();
905
-			$this->_flags &= ~self::IS_CHILD_CREATED;
905
+			$this->_flags&=~self::IS_CHILD_CREATED;
906 906
 		}
907 907
 	}
908 908
 
@@ -917,18 +917,18 @@  discard block
 block discarded – undo
917 917
 		{
918 918
 			try
919 919
 			{
920
-				$this->_flags |= self::IS_CREATING_CHILD;
920
+				$this->_flags|=self::IS_CREATING_CHILD;
921 921
 				if(isset($this->_rf[self::RF_ADAPTER]))
922 922
 					$this->_rf[self::RF_ADAPTER]->createChildControls();
923 923
 				else
924 924
 					$this->createChildControls();
925
-				$this->_flags &= ~self::IS_CREATING_CHILD;
926
-				$this->_flags |= self::IS_CHILD_CREATED;
925
+				$this->_flags&=~self::IS_CREATING_CHILD;
926
+				$this->_flags|=self::IS_CHILD_CREATED;
927 927
 			}
928 928
 			catch(Exception $e)
929 929
 			{
930
-				$this->_flags &= ~self::IS_CREATING_CHILD;
931
-				$this->_flags |= self::IS_CHILD_CREATED;
930
+				$this->_flags&=~self::IS_CREATING_CHILD;
931
+				$this->_flags|=self::IS_CHILD_CREATED;
932 932
 				throw $e;
933 933
 			}
934 934
 		}
@@ -957,21 +957,21 @@  discard block
 block discarded – undo
957 957
 	 */
958 958
 	public function findControl($id)
959 959
 	{
960
-		$id=strtr($id,'.',self::ID_SEPARATOR);
961
-		$container=($this instanceof INamingContainer)?$this:$this->getNamingContainer();
960
+		$id=strtr($id, '.', self::ID_SEPARATOR);
961
+		$container=($this instanceof INamingContainer) ? $this : $this->getNamingContainer();
962 962
 		if(!$container || !$container->getHasControls())
963 963
 			return null;
964 964
 		if(!isset($container->_rf[self::RF_NAMED_CONTROLS]))
965 965
 		{
966 966
 			$container->_rf[self::RF_NAMED_CONTROLS]=array();
967
-			$container->fillNameTable($container,$container->_rf[self::RF_CONTROLS]);
967
+			$container->fillNameTable($container, $container->_rf[self::RF_CONTROLS]);
968 968
 		}
969
-		if(($pos=strpos($id,self::ID_SEPARATOR))===false)
970
-			return isset($container->_rf[self::RF_NAMED_CONTROLS][$id])?$container->_rf[self::RF_NAMED_CONTROLS][$id]:null;
969
+		if(($pos=strpos($id, self::ID_SEPARATOR))===false)
970
+			return isset($container->_rf[self::RF_NAMED_CONTROLS][$id]) ? $container->_rf[self::RF_NAMED_CONTROLS][$id] : null;
971 971
 		else
972 972
 		{
973
-			$cid=substr($id,0,$pos);
974
-			$sid=substr($id,$pos+1);
973
+			$cid=substr($id, 0, $pos);
974
+			$sid=substr($id, $pos + 1);
975 975
 			if(isset($container->_rf[self::RF_NAMED_CONTROLS][$cid]))
976 976
 				return $container->_rf[self::RF_NAMED_CONTROLS][$cid]->findControl($sid);
977 977
 			else
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 	 * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned.
986 986
 	 * @return array list of controls found
987 987
 	 */
988
-	public function findControlsByType($type,$strict=true)
988
+	public function findControlsByType($type, $strict=true)
989 989
 	{
990 990
 		$controls=array();
991 991
 		if($this->getHasControls())
@@ -995,7 +995,7 @@  discard block
 block discarded – undo
995 995
 				if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type))))
996 996
 					$controls[]=$control;
997 997
 				if(($control instanceof TControl) && $control->getHasControls())
998
-					$controls=array_merge($controls,$control->findControlsByType($type,$strict));
998
+					$controls=array_merge($controls, $control->findControlsByType($type, $strict));
999 999
 			}
1000 1000
 		}
1001 1001
 		return $controls;
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 				{
1022 1022
 					if($control->_id===$id)
1023 1023
 						$controls[]=$control;
1024
-					$controls=array_merge($controls,$control->findControlsByID($id));
1024
+					$controls=array_merge($controls, $control->findControlsByID($id));
1025 1025
 				}
1026 1026
 			}
1027 1027
 		}
@@ -1046,10 +1046,10 @@  discard block
 block discarded – undo
1046 1046
 	 * @param object object to be declared
1047 1047
 	 * @see __get
1048 1048
 	 */
1049
-	public function registerObject($name,$object)
1049
+	public function registerObject($name, $object)
1050 1050
 	{
1051 1051
 		if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name]))
1052
-			throw new TInvalidOperationException('control_object_reregistered',$name);
1052
+			throw new TInvalidOperationException('control_object_reregistered', $name);
1053 1053
 		$this->_rf[self::RF_NAMED_OBJECTS][$name]=$object;
1054 1054
 	}
1055 1055
 
@@ -1121,7 +1121,7 @@  discard block
 block discarded – undo
1121 1121
 	 */
1122 1122
 	public function getRegisteredObject($name)
1123 1123
 	{
1124
-		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null;
1124
+		return isset($this->_rf[self::RF_NAMED_OBJECTS][$name]) ? $this->_rf[self::RF_NAMED_OBJECTS][$name] : null;
1125 1125
 	}
1126 1126
 
1127 1127
 	/**
@@ -1181,7 +1181,7 @@  discard block
 block discarded – undo
1181 1181
 			$control->_parent->getControls()->remove($control);
1182 1182
 		$control->_parent=$this;
1183 1183
 		$control->_page=$this->getPage();
1184
-		$namingContainer=($this instanceof INamingContainer)?$this:$this->_namingContainer;
1184
+		$namingContainer=($this instanceof INamingContainer) ? $this : $this->_namingContainer;
1185 1185
 		if($namingContainer)
1186 1186
 		{
1187 1187
 			$control->_namingContainer=$namingContainer;
@@ -1192,10 +1192,10 @@  discard block
 block discarded – undo
1192 1192
 			$control->clearCachedUniqueID($control instanceof INamingContainer);
1193 1193
 		}
1194 1194
 
1195
-		if($this->_stage>=self::CS_CHILD_INITIALIZED)
1195
+		if($this->_stage >= self::CS_CHILD_INITIALIZED)
1196 1196
 		{
1197 1197
 			$control->initRecursive($namingContainer);
1198
-			if($this->_stage>=self::CS_STATE_LOADED)
1198
+			if($this->_stage >= self::CS_STATE_LOADED)
1199 1199
 			{
1200 1200
 				if(isset($this->_rf[self::RF_CHILD_STATE][$control->_id]))
1201 1201
 				{
@@ -1204,11 +1204,11 @@  discard block
 block discarded – undo
1204 1204
 				}
1205 1205
 				else
1206 1206
 					$state=null;
1207
-				$control->loadStateRecursive($state,!($this->_flags & self::IS_DISABLE_VIEWSTATE));
1208
-				if($this->_stage>=self::CS_LOADED)
1207
+				$control->loadStateRecursive($state, !($this->_flags & self::IS_DISABLE_VIEWSTATE));
1208
+				if($this->_stage >= self::CS_LOADED)
1209 1209
 				{
1210 1210
 					$control->loadRecursive();
1211
-					if($this->_stage>=self::CS_PRERENDERED)
1211
+					if($this->_stage >= self::CS_PRERENDERED)
1212 1212
 						$control->preRenderRecursive();
1213 1213
 				}
1214 1214
 			}
@@ -1262,13 +1262,13 @@  discard block
 block discarded – undo
1262 1262
 				}
1263 1263
 			}
1264 1264
 		}
1265
-		if($this->_stage<self::CS_INITIALIZED)
1265
+		if($this->_stage < self::CS_INITIALIZED)
1266 1266
 		{
1267 1267
 			$this->_stage=self::CS_CHILD_INITIALIZED;
1268 1268
 			if(($page=$this->getPage()) && $this->getEnableTheming() && !($this->_flags & self::IS_SKIN_APPLIED))
1269 1269
 			{
1270 1270
 				$page->applyControlSkin($this);
1271
-				$this->_flags |= self::IS_SKIN_APPLIED;
1271
+				$this->_flags|=self::IS_SKIN_APPLIED;
1272 1272
 			}
1273 1273
 			if(isset($this->_rf[self::RF_ADAPTER]))
1274 1274
 				$this->_rf[self::RF_ADAPTER]->onInit(null);
@@ -1284,7 +1284,7 @@  discard block
 block discarded – undo
1284 1284
 	 */
1285 1285
 	protected function loadRecursive()
1286 1286
 	{
1287
-		if($this->_stage<self::CS_LOADED)
1287
+		if($this->_stage < self::CS_LOADED)
1288 1288
 		{
1289 1289
 			if(isset($this->_rf[self::RF_ADAPTER]))
1290 1290
 				$this->_rf[self::RF_ADAPTER]->onLoad(null);
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 					$control->loadRecursive();
1300 1300
 			}
1301 1301
 		}
1302
-		if($this->_stage<self::CS_LOADED)
1302
+		if($this->_stage < self::CS_LOADED)
1303 1303
 			$this->_stage=self::CS_LOADED;
1304 1304
 	}
1305 1305
 
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 	 */
1361 1361
 	public function onInit($param)
1362 1362
 	{
1363
-		$this->raiseEvent('OnInit',$this,$param);
1363
+		$this->raiseEvent('OnInit', $this, $param);
1364 1364
 	}
1365 1365
 
1366 1366
 	/**
@@ -1372,7 +1372,7 @@  discard block
 block discarded – undo
1372 1372
 	 */
1373 1373
 	public function onLoad($param)
1374 1374
 	{
1375
-		$this->raiseEvent('OnLoad',$this,$param);
1375
+		$this->raiseEvent('OnLoad', $this, $param);
1376 1376
 	}
1377 1377
 
1378 1378
 	/**
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
 	 */
1383 1383
 	public function onDataBinding($param)
1384 1384
 	{
1385
-		Prado::trace("onDataBinding()",'System.Web.UI.TControl');
1386
-		$this->raiseEvent('OnDataBinding',$this,$param);
1385
+		Prado::trace("onDataBinding()", 'System.Web.UI.TControl');
1386
+		$this->raiseEvent('OnDataBinding', $this, $param);
1387 1387
 	}
1388 1388
 
1389 1389
 
@@ -1396,7 +1396,7 @@  discard block
 block discarded – undo
1396 1396
 	 */
1397 1397
 	public function onUnload($param)
1398 1398
 	{
1399
-		$this->raiseEvent('OnUnload',$this,$param);
1399
+		$this->raiseEvent('OnUnload', $this, $param);
1400 1400
 	}
1401 1401
 
1402 1402
 	/**
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
 	 */
1409 1409
 	public function onPreRender($param)
1410 1410
 	{
1411
-		$this->raiseEvent('OnPreRender',$this,$param);
1411
+		$this->raiseEvent('OnPreRender', $this, $param);
1412 1412
 	}
1413 1413
 
1414 1414
 	/**
@@ -1418,12 +1418,12 @@  discard block
 block discarded – undo
1418 1418
 	 * @param TEventParameter event parameter
1419 1419
 	 * @see bubbleEvent
1420 1420
 	 */
1421
-	protected function raiseBubbleEvent($sender,$param)
1421
+	protected function raiseBubbleEvent($sender, $param)
1422 1422
 	{
1423 1423
 		$control=$this;
1424 1424
 		while($control=$control->_parent)
1425 1425
 		{
1426
-			if($control->bubbleEvent($sender,$param))
1426
+			if($control->bubbleEvent($sender, $param))
1427 1427
 				break;
1428 1428
 		}
1429 1429
 	}
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 	 * @return boolean true if the event bubbling is handled and no more bubbling.
1438 1438
 	 * @see raiseBubbleEvent
1439 1439
 	 */
1440
-	public function bubbleEvent($sender,$param)
1440
+	public function bubbleEvent($sender, $param)
1441 1441
 	{
1442 1442
 		return false;
1443 1443
 	}
@@ -1458,10 +1458,10 @@  discard block
 block discarded – undo
1458 1458
 	 * @param TControl sender of this event
1459 1459
 	 * @param TEventParameter event parameter
1460 1460
 	 */
1461
-	public function broadcastEvent($name,$sender,$param)
1461
+	public function broadcastEvent($name, $sender, $param)
1462 1462
 	{
1463
-		$rootControl=(($page=$this->getPage())===null)?$this:$page;
1464
-		$rootControl->broadcastEventInternal($name,$sender,new TBroadcastEventParameter($name,$param));
1463
+		$rootControl=(($page=$this->getPage())===null) ? $this : $page;
1464
+		$rootControl->broadcastEventInternal($name, $sender, new TBroadcastEventParameter($name, $param));
1465 1465
 	}
1466 1466
 
1467 1467
 	/**
@@ -1471,18 +1471,18 @@  discard block
 block discarded – undo
1471 1471
 	 * @param TControl sender of the event
1472 1472
 	 * @param TBroadcastEventParameter event parameter
1473 1473
 	 */
1474
-	private function broadcastEventInternal($name,$sender,$param)
1474
+	private function broadcastEventInternal($name, $sender, $param)
1475 1475
 	{
1476 1476
 		if($this->hasEvent($name))
1477
-			$this->raiseEvent($name,$sender,$param->getParameter());
1477
+			$this->raiseEvent($name, $sender, $param->getParameter());
1478 1478
 		if($this instanceof IBroadcastEventReceiver)
1479
-			$this->broadcastEventReceived($sender,$param);
1479
+			$this->broadcastEventReceived($sender, $param);
1480 1480
 		if($this->getHasControls())
1481 1481
 		{
1482 1482
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
1483 1483
 			{
1484 1484
 				if($control instanceof TControl)
1485
-					$control->broadcastEventInternal($name,$sender,$param);
1485
+					$control->broadcastEventInternal($name, $sender, $param);
1486 1486
 			}
1487 1487
 		}
1488 1488
 	}
@@ -1504,22 +1504,22 @@  discard block
 block discarded – undo
1504 1504
 	 * @param callback callback invoked before traversing child controls. If null, it is ignored.
1505 1505
 	 * @param callback callback invoked after traversing child controls. If null, it is ignored.
1506 1506
 	 */
1507
-	protected function traverseChildControls($param,$preCallback=null,$postCallback=null)
1507
+	protected function traverseChildControls($param, $preCallback=null, $postCallback=null)
1508 1508
 	{
1509 1509
 		if($preCallback!==null)
1510
-			call_user_func($preCallback,$this,$param);
1510
+			call_user_func($preCallback, $this, $param);
1511 1511
 		if($this->getHasControls())
1512 1512
 		{
1513 1513
 			foreach($this->_rf[self::RF_CONTROLS] as $control)
1514 1514
 			{
1515 1515
 				if($control instanceof TControl)
1516 1516
 				{
1517
-					$control->traverseChildControls($param,$preCallback,$postCallback);
1517
+					$control->traverseChildControls($param, $preCallback, $postCallback);
1518 1518
 				}
1519 1519
 			}
1520 1520
 		}
1521 1521
 		if($postCallback!==null)
1522
-			call_user_func($postCallback,$this,$param);
1522
+			call_user_func($postCallback, $this, $param);
1523 1523
 	}
1524 1524
 
1525 1525
 	/**
@@ -1596,7 +1596,7 @@  discard block
 block discarded – undo
1596 1596
 	 * @param array the collection of the state
1597 1597
 	 * @param boolean whether the viewstate should be loaded
1598 1598
 	 */
1599
-	protected function loadStateRecursive(&$state,$needViewState=true)
1599
+	protected function loadStateRecursive(&$state, $needViewState=true)
1600 1600
 	{
1601 1601
 		if(is_array($state))
1602 1602
 		{
@@ -1626,7 +1626,7 @@  discard block
 block discarded – undo
1626 1626
 					{
1627 1627
 						if(isset($state[$control->_id]))
1628 1628
 						{
1629
-							$control->loadStateRecursive($state[$control->_id],$needViewState);
1629
+							$control->loadStateRecursive($state[$control->_id], $needViewState);
1630 1630
 							unset($state[$control->_id]);
1631 1631
 						}
1632 1632
 					}
@@ -1662,7 +1662,7 @@  discard block
 block discarded – undo
1662 1662
 			{
1663 1663
 				if($control instanceof TControl)
1664 1664
 				{
1665
-					if(count($tmp = &$control->saveStateRecursive($needViewState)))
1665
+					if(count($tmp=&$control->saveStateRecursive($needViewState)))
1666 1666
 						$state[$control->_id]=$tmp;
1667 1667
 				}
1668 1668
 			}
@@ -1684,10 +1684,10 @@  discard block
 block discarded – undo
1684 1684
 		if($page && !($this->_flags & self::IS_STYLESHEET_APPLIED))
1685 1685
 		{
1686 1686
 			$page->applyControlStyleSheet($this);
1687
-			$this->_flags |= self::IS_STYLESHEET_APPLIED;
1687
+			$this->_flags|=self::IS_STYLESHEET_APPLIED;
1688 1688
 		}
1689 1689
 		else if($this->_flags & self::IS_STYLESHEET_APPLIED)
1690
-			throw new TInvalidOperationException('control_stylesheet_applied',get_class($this));
1690
+			throw new TInvalidOperationException('control_stylesheet_applied', get_class($this));
1691 1691
 	}
1692 1692
 
1693 1693
 	/**
@@ -1711,11 +1711,11 @@  discard block
 block discarded – undo
1711 1711
 	 */
1712 1712
 	private function generateAutomaticID()
1713 1713
 	{
1714
-		$this->_flags &= ~self::IS_ID_SET;
1714
+		$this->_flags&=~self::IS_ID_SET;
1715 1715
 		if(!isset($this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]))
1716 1716
 			$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]=0;
1717 1717
 		$id=$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]++;
1718
-		$this->_id=self::AUTOMATIC_ID_PREFIX . $id;
1718
+		$this->_id=self::AUTOMATIC_ID_PREFIX.$id;
1719 1719
 		$this->_namingContainer->clearNameTable();
1720 1720
 	}
1721 1721
 
@@ -1733,7 +1733,7 @@  discard block
 block discarded – undo
1733 1733
 	 * @param TControlCollection list of controls
1734 1734
 	 * @throws TInvalidDataValueException if a control's ID is not unique within its naming container.
1735 1735
 	 */
1736
-	private function fillNameTable($container,$controls)
1736
+	private function fillNameTable($container, $controls)
1737 1737
 	{
1738 1738
 		foreach($controls as $control)
1739 1739
 		{
@@ -1742,12 +1742,12 @@  discard block
 block discarded – undo
1742 1742
 				if($control->_id!=='')
1743 1743
 				{
1744 1744
 					if(isset($container->_rf[self::RF_NAMED_CONTROLS][$control->_id]))
1745
-						throw new TInvalidDataValueException('control_id_nonunique',get_class($control),$control->_id);
1745
+						throw new TInvalidDataValueException('control_id_nonunique', get_class($control), $control->_id);
1746 1746
 					else
1747 1747
 						$container->_rf[self::RF_NAMED_CONTROLS][$control->_id]=$control;
1748 1748
 				}
1749 1749
 				if(!($control instanceof INamingContainer) && $control->getHasControls())
1750
-					$this->fillNameTable($container,$control->_rf[self::RF_CONTROLS]);
1750
+					$this->fillNameTable($container, $control->_rf[self::RF_CONTROLS]);
1751 1751
 			}
1752 1752
 		}
1753 1753
 	}
@@ -1777,10 +1777,10 @@  discard block
 block discarded – undo
1777 1777
 	 * @param TControl the control that owns this collection.
1778 1778
 	 * @param boolean whether the list is read-only
1779 1779
 	 */
1780
-	public function __construct(TControl $owner,$readOnly=false)
1780
+	public function __construct(TControl $owner, $readOnly=false)
1781 1781
 	{
1782 1782
 		$this->_o=$owner;
1783
-		parent::__construct(null,$readOnly);
1783
+		parent::__construct(null, $readOnly);
1784 1784
 	}
1785 1785
 
1786 1786
 	/**
@@ -1799,15 +1799,15 @@  discard block
 block discarded – undo
1799 1799
 	 * @param mixed new item
1800 1800
 	 * @throws TInvalidDataTypeException if the item to be inserted is neither a string nor a TControl.
1801 1801
 	 */
1802
-	public function insertAt($index,$item)
1802
+	public function insertAt($index, $item)
1803 1803
 	{
1804 1804
 		if($item instanceof TControl)
1805 1805
 		{
1806
-			parent::insertAt($index,$item);
1806
+			parent::insertAt($index, $item);
1807 1807
 			$this->_o->addedControl($item);
1808 1808
 		}
1809 1809
 		else if(is_string($item) || ($item instanceof IRenderable))
1810
-			parent::insertAt($index,$item);
1810
+			parent::insertAt($index, $item);
1811 1811
 		else
1812 1812
 			throw new TInvalidDataTypeException('controlcollection_control_required');
1813 1813
 	}
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
 	 */
1857 1857
 	public function __construct(TControl $owner)
1858 1858
 	{
1859
-		parent::__construct($owner,true);
1859
+		parent::__construct($owner, true);
1860 1860
 	}
1861 1861
 
1862 1862
 	/**
@@ -1865,10 +1865,10 @@  discard block
 block discarded – undo
1865 1865
 	 * @param integer the speicified position.
1866 1866
 	 * @param mixed new item
1867 1867
 	 */
1868
-	public function insertAt($index,$item)
1868
+	public function insertAt($index, $item)
1869 1869
 	{
1870 1870
 		if(!is_string($item))  // string is possible if property tag is used. we simply ignore it in this case
1871
-			parent::insertAt($index,$item);  // this will generate an exception in parent implementation
1871
+			parent::insertAt($index, $item); // this will generate an exception in parent implementation
1872 1872
 	}
1873 1873
 }
1874 1874
 
@@ -1923,7 +1923,7 @@  discard block
 block discarded – undo
1923 1923
 	 * @param array the input data collection
1924 1924
 	 * @return boolean whether the data of the control has been changed
1925 1925
 	 */
1926
-	public function loadPostData($key,$values);
1926
+	public function loadPostData($key, $values);
1927 1927
 	/**
1928 1928
 	 * Raises postdata changed event.
1929 1929
 	 * The implementation of this function should raise appropriate event(s) (e.g. OnTextChanged)
@@ -2019,7 +2019,7 @@  discard block
 block discarded – undo
2019 2019
 	 * @param TControl sender of the event
2020 2020
 	 * @param TBroadCastEventParameter event parameter
2021 2021
 	 */
2022
-	public function broadcastEventReceived($sender,$param);
2022
+	public function broadcastEventReceived($sender, $param);
2023 2023
 }
2024 2024
 
2025 2025
 /**
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
 	 * @param string name of the broadcast event
2193 2193
 	 * @param mixed parameter of the broadcast event
2194 2194
 	 */
2195
-	public function __construct($name='',$parameter=null)
2195
+	public function __construct($name='', $parameter=null)
2196 2196
 	{
2197 2197
 		$this->_name=$name;
2198 2198
 		$this->_param=$parameter;
@@ -2253,7 +2253,7 @@  discard block
 block discarded – undo
2253 2253
 	 * @param string name of the command
2254 2254
 	 * @param string parameter of the command
2255 2255
 	 */
2256
-	public function __construct($name='',$parameter='')
2256
+	public function __construct($name='', $parameter='')
2257 2257
 	{
2258 2258
 		$this->_name=$name;
2259 2259
 		$this->_param=$parameter;
@@ -2345,7 +2345,7 @@  discard block
 block discarded – undo
2345 2345
 	 */
2346 2346
 	public function evaluateDynamicContent()
2347 2347
 	{
2348
-		$context=$this->_container===null?$this:$this->_container;
2348
+		$context=$this->_container===null ? $this : $this->_container;
2349 2349
 		foreach($this->_expressions as $id=>$expression)
2350 2350
 			$this->_items[$id]=$context->evaluateExpression($expression);
2351 2351
 		foreach($this->_statements as $id=>$statement)
@@ -2358,7 +2358,7 @@  discard block
 block discarded – undo
2358 2358
 	 */
2359 2359
 	public function dataBind()
2360 2360
 	{
2361
-		$context=$this->_container===null?$this:$this->_container;
2361
+		$context=$this->_container===null ? $this : $this->_container;
2362 2362
 		foreach($this->_bindings as $id=>$binding)
2363 2363
 			$this->_items[$id]=$context->evaluateExpression($binding);
2364 2364
 	}
@@ -2370,7 +2370,7 @@  discard block
 block discarded – undo
2370 2370
 	 */
2371 2371
 	public function render($writer)
2372 2372
 	{
2373
-		$writer->write(implode('',$this->_items));
2373
+		$writer->write(implode('', $this->_items));
2374 2374
 	}
2375 2375
 }
2376 2376
 
Please login to merge, or discard this patch.
framework/Web/UI/TTemplateManager.php 1 patch
Spacing   +200 added lines, -200 removed lines patch added patch discarded remove patch
@@ -75,21 +75,21 @@  discard block
 block discarded – undo
75 75
 	{
76 76
 		if(($fileName=$this->getLocalizedTemplate($fileName))!==null)
77 77
 		{
78
-			Prado::trace("Loading template $fileName",'System.Web.UI.TTemplateManager');
78
+			Prado::trace("Loading template $fileName", 'System.Web.UI.TTemplateManager');
79 79
 			if(($cache=$this->getApplication()->getCache())===null)
80
-				return new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName);
80
+				return new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
81 81
 			else
82 82
 			{
83 83
 				$array=$cache->get(self::TEMPLATE_CACHE_PREFIX.$fileName);
84 84
 				if(is_array($array))
85 85
 				{
86
-					list($template,$timestamps)=$array;
86
+					list($template, $timestamps)=$array;
87 87
 					if($this->getApplication()->getMode()===TApplicationMode::Performance)
88 88
 						return $template;
89 89
 					$cacheValid=true;
90 90
 					foreach($timestamps as $tplFile=>$timestamp)
91 91
 					{
92
-						if(!is_file($tplFile) || filemtime($tplFile)>$timestamp)
92
+						if(!is_file($tplFile) || filemtime($tplFile) > $timestamp)
93 93
 						{
94 94
 							$cacheValid=false;
95 95
 							break;
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
 					if($cacheValid)
99 99
 						return $template;
100 100
 				}
101
-				$template=new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName);
101
+				$template=new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
102 102
 				$includedFiles=$template->getIncludedFiles();
103 103
 				$timestamps=array();
104 104
 				$timestamps[$fileName]=filemtime($fileName);
105 105
 				foreach($includedFiles as $includedFile)
106 106
 					$timestamps[$includedFile]=filemtime($includedFile);
107
-				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps));
107
+				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName, array($template, $timestamps));
108 108
 				return $template;
109 109
 			}
110 110
 		}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	protected function getLocalizedTemplate($filename)
121 121
 	{
122 122
 		if(($app=$this->getApplication()->getGlobalization(false))===null)
123
-			return is_file($filename)?$filename:null;
123
+			return is_file($filename) ? $filename : null;
124 124
 		foreach($app->getLocalizedResource($filename) as $file)
125 125
 		{
126 126
 			if(($file=realpath($file))!==false && is_file($file))
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	 * @param boolean whether this template is a source template, i.e., this template is loaded from
235 235
 	 * some external storage rather than from within another template.
236 236
 	 */
237
-	public function __construct($template,$contextPath,$tplFile=null,$startingLine=0,$sourceTemplate=true)
237
+	public function __construct($template, $contextPath, $tplFile=null, $startingLine=0, $sourceTemplate=true)
238 238
 	{
239 239
 		$this->_sourceTemplate=$sourceTemplate;
240 240
 		$this->_contextPath=$contextPath;
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 	 * @param TControl the control who owns the template
303 303
 	 * @param TControl the control who will become the root parent of the controls on the template. If null, it uses the template control.
304 304
 	 */
305
-	public function instantiateIn($tplControl,$parentControl=null)
305
+	public function instantiateIn($tplControl, $parentControl=null)
306 306
 	{
307 307
 		$this->_tplControl=$tplControl;
308 308
 		if($parentControl===null)
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 					{
333 333
 						if(is_array($properties['id']))
334 334
 							$properties['id']=$component->evaluateExpression($properties['id'][1]);
335
-						$tplControl->registerObject($properties['id'],$component);
335
+						$tplControl->registerObject($properties['id'], $component);
336 336
 					}
337 337
 					if(isset($properties['skinid']))
338 338
 					{
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 
348 348
 					$component->applyStyleSheetSkin($page);
349 349
 					foreach($properties as $name=>$value)
350
-						$this->configureControl($component,$name,$value);
350
+						$this->configureControl($component, $name, $value);
351 351
 
352 352
 					$component->trackViewState(true);
353 353
 
@@ -365,12 +365,12 @@  discard block
 block discarded – undo
365 365
 					{
366 366
 						if(is_array($properties['id']))
367 367
 							$properties['id']=$component->evaluateExpression($properties['id'][1]);
368
-						$tplControl->registerObject($properties['id'],$component);
368
+						$tplControl->registerObject($properties['id'], $component);
369 369
 						if(!$component->hasProperty('id'))
370 370
 							unset($properties['id']);
371 371
 					}
372 372
 					foreach($properties as $name=>$value)
373
-						$this->configureComponent($component,$name,$value);
373
+						$this->configureComponent($component, $name, $value);
374 374
 					if($parent===$parentControl)
375 375
 						$directChildren[]=$component;
376 376
 					else
@@ -416,14 +416,14 @@  discard block
 block discarded – undo
416 416
 	 * @param string property name
417 417
 	 * @param mixed property initial value
418 418
 	 */
419
-	protected function configureControl($control,$name,$value)
419
+	protected function configureControl($control, $name, $value)
420 420
 	{
421
-		if(strncasecmp($name,'on',2)===0)		// is an event
422
-			$this->configureEvent($control,$name,$value,$control);
423
-		else if(($pos=strrpos($name,'.'))===false)	// is a simple property or custom attribute
424
-			$this->configureProperty($control,$name,$value);
421
+		if(strncasecmp($name, 'on', 2)===0)		// is an event
422
+			$this->configureEvent($control, $name, $value, $control);
423
+		else if(($pos=strrpos($name, '.'))===false)	// is a simple property or custom attribute
424
+			$this->configureProperty($control, $name, $value);
425 425
 		else	// is a subproperty
426
-			$this->configureSubProperty($control,$name,$value);
426
+			$this->configureSubProperty($control, $name, $value);
427 427
 	}
428 428
 
429 429
 	/**
@@ -432,12 +432,12 @@  discard block
 block discarded – undo
432 432
 	 * @param string property name
433 433
 	 * @param mixed property initial value
434 434
 	 */
435
-	protected function configureComponent($component,$name,$value)
435
+	protected function configureComponent($component, $name, $value)
436 436
 	{
437
-		if(strpos($name,'.')===false)	// is a simple property or custom attribute
438
-			$this->configureProperty($component,$name,$value);
437
+		if(strpos($name, '.')===false)	// is a simple property or custom attribute
438
+			$this->configureProperty($component, $name, $value);
439 439
 		else	// is a subproperty
440
-			$this->configureSubProperty($component,$name,$value);
440
+			$this->configureSubProperty($component, $name, $value);
441 441
 	}
442 442
 
443 443
 	/**
@@ -447,12 +447,12 @@  discard block
 block discarded – undo
447 447
 	 * @param string event handler
448 448
 	 * @param TControl context control
449 449
 	 */
450
-	protected function configureEvent($control,$name,$value,$contextControl)
450
+	protected function configureEvent($control, $name, $value, $contextControl)
451 451
 	{
452
-		if(strpos($value,'.')===false)
453
-			$control->attachEventHandler($name,array($contextControl,'TemplateControl.'.$value));
452
+		if(strpos($value, '.')===false)
453
+			$control->attachEventHandler($name, array($contextControl, 'TemplateControl.'.$value));
454 454
 		else
455
-			$control->attachEventHandler($name,array($contextControl,$value));
455
+			$control->attachEventHandler($name, array($contextControl, $value));
456 456
 	}
457 457
 
458 458
 	/**
@@ -461,18 +461,18 @@  discard block
 block discarded – undo
461 461
 	 * @param string property name
462 462
 	 * @param mixed property initial value
463 463
 	 */
464
-	protected function configureProperty($component,$name,$value)
464
+	protected function configureProperty($component, $name, $value)
465 465
 	{
466 466
 		if(is_array($value))
467 467
 		{
468 468
 			switch($value[0])
469 469
 			{
470 470
 				case self::CONFIG_DATABIND:
471
-					$component->bindProperty($name,$value[1]);
471
+					$component->bindProperty($name, $value[1]);
472 472
 					break;
473 473
 				case self::CONFIG_EXPRESSION:
474 474
 					if($component instanceof TControl)
475
-						$component->autoBindProperty($name,$value[1]);
475
+						$component->autoBindProperty($name, $value[1]);
476 476
 					else
477 477
 					{
478 478
 						$setter='set'.$name;
@@ -497,15 +497,15 @@  discard block
 block discarded – undo
497 497
 					$component->$setter(Prado::localize($value[1]));
498 498
 					break;
499 499
 				default:	// an error if reaching here
500
-					throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
500
+					throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
501 501
 					break;
502 502
 			}
503 503
 		}
504 504
 		else
505 505
 		{
506
-			if (substr($name,0,2)=='js')
507
-				if ($value and !($value instanceof TJavaScriptLiteral))
508
-					$value = new TJavaScriptLiteral($value);
506
+			if(substr($name, 0, 2)=='js')
507
+				if($value and !($value instanceof TJavaScriptLiteral))
508
+					$value=new TJavaScriptLiteral($value);
509 509
 			$setter='set'.$name;
510 510
 			$component->$setter($value);
511 511
 		}
@@ -517,41 +517,41 @@  discard block
 block discarded – undo
517 517
 	 * @param string subproperty name
518 518
 	 * @param mixed subproperty initial value
519 519
 	 */
520
-	protected function configureSubProperty($component,$name,$value)
520
+	protected function configureSubProperty($component, $name, $value)
521 521
 	{
522 522
 		if(is_array($value))
523 523
 		{
524 524
 			switch($value[0])
525 525
 			{
526 526
 				case self::CONFIG_DATABIND:		// databinding
527
-					$component->bindProperty($name,$value[1]);
527
+					$component->bindProperty($name, $value[1]);
528 528
 					break;
529 529
 				case self::CONFIG_EXPRESSION:		// expression
530 530
 					if($component instanceof TControl)
531
-						$component->autoBindProperty($name,$value[1]);
531
+						$component->autoBindProperty($name, $value[1]);
532 532
 					else
533
-						$component->setSubProperty($name,$this->_tplControl->evaluateExpression($value[1]));
533
+						$component->setSubProperty($name, $this->_tplControl->evaluateExpression($value[1]));
534 534
 					break;
535 535
 				case self::CONFIG_TEMPLATE:
536
-					$component->setSubProperty($name,$value[1]);
536
+					$component->setSubProperty($name, $value[1]);
537 537
 					break;
538 538
 				case self::CONFIG_ASSET:		// asset URL
539 539
 					$url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]);
540
-					$component->setSubProperty($name,$url);
540
+					$component->setSubProperty($name, $url);
541 541
 					break;
542 542
 				case self::CONFIG_PARAMETER:		// application parameter
543
-					$component->setSubProperty($name,$this->getApplication()->getParameters()->itemAt($value[1]));
543
+					$component->setSubProperty($name, $this->getApplication()->getParameters()->itemAt($value[1]));
544 544
 					break;
545 545
 				case self::CONFIG_LOCALIZATION:
546
-					$component->setSubProperty($name,Prado::localize($value[1]));
546
+					$component->setSubProperty($name, Prado::localize($value[1]));
547 547
 					break;
548 548
 				default:	// an error if reaching here
549
-					throw new TConfigurationException('template_tag_unexpected',$name,$value[1]);
549
+					throw new TConfigurationException('template_tag_unexpected', $name, $value[1]);
550 550
 					break;
551 551
 			}
552 552
 		}
553 553
 		else
554
-			$component->setSubProperty($name,$value);
554
+			$component->setSubProperty($name, $value);
555 555
 	}
556 556
 
557 557
 	/**
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	{
580 580
 		$input=$this->preprocess($input);
581 581
 		$tpl=&$this->_tpl;
582
-		$n=preg_match_all(self::REGEX_RULES,$input,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
582
+		$n=preg_match_all(self::REGEX_RULES, $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
583 583
 		$expectPropEnd=false;
584 584
 		$textStart=0;
585 585
 				$stack=array();
@@ -589,186 +589,186 @@  discard block
 block discarded – undo
589 589
 		$this->_directive=null;
590 590
 		try
591 591
 		{
592
-			for($i=0;$i<$n;++$i)
592
+			for($i=0; $i < $n; ++$i)
593 593
 			{
594 594
 				$match=&$matches[$i];
595 595
 				$str=$match[0][0];
596 596
 				$matchStart=$match[0][1];
597
-				$matchEnd=$matchStart+strlen($str)-1;
598
-				if(strpos($str,'<com:')===0)	// opening component tag
597
+				$matchEnd=$matchStart + strlen($str) - 1;
598
+				if(strpos($str, '<com:')===0)	// opening component tag
599 599
 				{
600 600
 					if($expectPropEnd)
601 601
 						continue;
602
-					if($matchStart>$textStart)
603
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
604
-					$textStart=$matchEnd+1;
602
+					if($matchStart > $textStart)
603
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
604
+					$textStart=$matchEnd + 1;
605 605
 					$type=$match[1][0];
606
-					$attributes=$this->parseAttributes($match[2][0],$match[2][1]);
607
-					$this->validateAttributes($type,$attributes);
608
-					$tpl[$c++]=array($container,$type,$attributes);
609
-					if($str[strlen($str)-2]!=='/')  // open tag
606
+					$attributes=$this->parseAttributes($match[2][0], $match[2][1]);
607
+					$this->validateAttributes($type, $attributes);
608
+					$tpl[$c++]=array($container, $type, $attributes);
609
+					if($str[strlen($str) - 2]!=='/')  // open tag
610 610
 					{
611
-						$stack[] = $type;
612
-						$container=$c-1;
611
+						$stack[]=$type;
612
+						$container=$c - 1;
613 613
 					}
614 614
 				}
615
-				else if(strpos($str,'</com:')===0)	// closing component tag
615
+				else if(strpos($str, '</com:')===0)	// closing component tag
616 616
 				{
617 617
 					if($expectPropEnd)
618 618
 						continue;
619
-					if($matchStart>$textStart)
620
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
621
-					$textStart=$matchEnd+1;
619
+					if($matchStart > $textStart)
620
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
621
+					$textStart=$matchEnd + 1;
622 622
 					$type=$match[1][0];
623 623
 
624 624
 					if(empty($stack))
625
-						throw new TConfigurationException('template_closingtag_unexpected',"</com:$type>");
625
+						throw new TConfigurationException('template_closingtag_unexpected', "</com:$type>");
626 626
 
627 627
 					$name=array_pop($stack);
628 628
 					if($name!==$type)
629 629
 					{
630
-						$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
631
-						throw new TConfigurationException('template_closingtag_expected',$tag);
630
+						$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
631
+						throw new TConfigurationException('template_closingtag_expected', $tag);
632 632
 					}
633 633
 					$container=$tpl[$container][0];
634 634
 				}
635
-				else if(strpos($str,'<%@')===0)	// directive
635
+				else if(strpos($str, '<%@')===0)	// directive
636 636
 				{
637 637
 					if($expectPropEnd)
638 638
 						continue;
639
-					if($matchStart>$textStart)
640
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
641
-					$textStart=$matchEnd+1;
639
+					if($matchStart > $textStart)
640
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
641
+					$textStart=$matchEnd + 1;
642 642
 					if(isset($tpl[0]) || $this->_directive!==null)
643 643
 						throw new TConfigurationException('template_directive_nonunique');
644
-					$this->_directive=$this->parseAttributes($match[4][0],$match[4][1]);
644
+					$this->_directive=$this->parseAttributes($match[4][0], $match[4][1]);
645 645
 				}
646
-				else if(strpos($str,'<%')===0)	// expression
646
+				else if(strpos($str, '<%')===0)	// expression
647 647
 				{
648 648
 					if($expectPropEnd)
649 649
 						continue;
650
-					if($matchStart>$textStart)
651
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
652
-					$textStart=$matchEnd+1;
650
+					if($matchStart > $textStart)
651
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
652
+					$textStart=$matchEnd + 1;
653 653
 					$literal=trim($match[5][0]);
654 654
 					if($str[2]==='=')	// expression
655
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,$literal));
655
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, $literal));
656 656
 					else if($str[2]==='%')  // statements
657
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_STATEMENTS,$literal));
657
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_STATEMENTS, $literal));
658 658
 					else if($str[2]==='#')
659
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_DATABINDING,$literal));
659
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_DATABINDING, $literal));
660 660
 					else if($str[2]==='$')
661
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->getApplication()->getParameters()->itemAt('$literal')"));
661
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "\$this->getApplication()->getParameters()->itemAt('$literal')"));
662 662
 					else if($str[2]==='~')
663
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')"));
663
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "\$this->publishFilePath('$this->_contextPath/$literal')"));
664 664
 					else if($str[2]==='/')
665
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"));
665
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"));
666 666
 					else if($str[2]==='[')
667 667
 					{
668
-						$literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\"));
669
-						$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"));
668
+						$literal=strtr(trim(substr($literal, 0, strlen($literal) - 1)), array("'"=>"\'", "\\"=>"\\\\"));
669
+						$tpl[$c++]=array($container, array(TCompositeLiteral::TYPE_EXPRESSION, "Prado::localize('$literal')"));
670 670
 					}
671 671
 				}
672
-				else if(strpos($str,'<prop:')===0)	// opening property
672
+				else if(strpos($str, '<prop:')===0)	// opening property
673 673
 				{
674
-					if(strrpos($str,'/>')===strlen($str)-2)  //subproperties
674
+					if(strrpos($str, '/>')===strlen($str) - 2)  //subproperties
675 675
 					{
676 676
 						if($expectPropEnd)
677 677
 							continue;
678
-						if($matchStart>$textStart)
679
-							$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
680
-						$textStart=$matchEnd+1;
678
+						if($matchStart > $textStart)
679
+							$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
680
+						$textStart=$matchEnd + 1;
681 681
 						$prop=strtolower($match[6][0]);
682
-						$attrs=$this->parseAttributes($match[7][0],$match[7][1]);
682
+						$attrs=$this->parseAttributes($match[7][0], $match[7][1]);
683 683
 						$attributes=array();
684 684
 						foreach($attrs as $name=>$value)
685 685
 							$attributes[$prop.'.'.$name]=$value;
686 686
 						$type=$tpl[$container][1];
687
-						$this->validateAttributes($type,$attributes);
687
+						$this->validateAttributes($type, $attributes);
688 688
 						foreach($attributes as $name=>$value)
689 689
 						{
690 690
 							if(isset($tpl[$container][2][$name]))
691
-								throw new TConfigurationException('template_property_duplicated',$name);
691
+								throw new TConfigurationException('template_property_duplicated', $name);
692 692
 							$tpl[$container][2][$name]=$value;
693 693
 						}
694 694
 					}
695 695
 					else  // regular property
696 696
 					{
697 697
 						$prop=strtolower($match[3][0]);
698
-						$stack[] = '@'.$prop;
698
+						$stack[]='@'.$prop;
699 699
 						if(!$expectPropEnd)
700 700
 						{
701
-							if($matchStart>$textStart)
702
-								$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
703
-							$textStart=$matchEnd+1;
701
+							if($matchStart > $textStart)
702
+								$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
703
+							$textStart=$matchEnd + 1;
704 704
 							$expectPropEnd=true;
705 705
 						}
706 706
 					}
707 707
 				}
708
-				else if(strpos($str,'</prop:')===0)	// closing property
708
+				else if(strpos($str, '</prop:')===0)	// closing property
709 709
 				{
710 710
 					$prop=strtolower($match[3][0]);
711 711
 					if(empty($stack))
712
-						throw new TConfigurationException('template_closingtag_unexpected',"</prop:$prop>");
712
+						throw new TConfigurationException('template_closingtag_unexpected', "</prop:$prop>");
713 713
 					$name=array_pop($stack);
714 714
 					if($name!=='@'.$prop)
715 715
 					{
716
-						$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
717
-						throw new TConfigurationException('template_closingtag_expected',$tag);
716
+						$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
717
+						throw new TConfigurationException('template_closingtag_expected', $tag);
718 718
 					}
719
-					if(($last=count($stack))<1 || $stack[$last-1][0]!=='@')
719
+					if(($last=count($stack)) < 1 || $stack[$last - 1][0]!=='@')
720 720
 					{
721
-						if($matchStart>$textStart)
721
+						if($matchStart > $textStart)
722 722
 						{
723
-							$value=substr($input,$textStart,$matchStart-$textStart);
724
-							if(substr($prop,-8,8)==='template')
725
-								$value=$this->parseTemplateProperty($value,$textStart);
723
+							$value=substr($input, $textStart, $matchStart - $textStart);
724
+							if(substr($prop, -8, 8)==='template')
725
+								$value=$this->parseTemplateProperty($value, $textStart);
726 726
 							else
727 727
 								$value=$this->parseAttribute($value);
728
-							if($container>=0)
728
+							if($container >= 0)
729 729
 							{
730 730
 								$type=$tpl[$container][1];
731
-								$this->validateAttributes($type,array($prop=>$value));
731
+								$this->validateAttributes($type, array($prop=>$value));
732 732
 								if(isset($tpl[$container][2][$prop]))
733
-									throw new TConfigurationException('template_property_duplicated',$prop);
733
+									throw new TConfigurationException('template_property_duplicated', $prop);
734 734
 								$tpl[$container][2][$prop]=$value;
735 735
 							}
736 736
 							else	// a property for the template control
737 737
 								$this->_directive[$prop]=$value;
738
-							$textStart=$matchEnd+1;
738
+							$textStart=$matchEnd + 1;
739 739
 						}
740 740
 						$expectPropEnd=false;
741 741
 					}
742 742
 				}
743
-				else if(strpos($str,'<!--')===0)	// comments
743
+				else if(strpos($str, '<!--')===0)	// comments
744 744
 				{
745 745
 					if($expectPropEnd)
746 746
 						throw new TConfigurationException('template_comments_forbidden');
747
-					if($matchStart>$textStart)
748
-						$tpl[$c++]=array($container,substr($input,$textStart,$matchStart-$textStart));
749
-					$textStart=$matchEnd+1;
747
+					if($matchStart > $textStart)
748
+						$tpl[$c++]=array($container, substr($input, $textStart, $matchStart - $textStart));
749
+					$textStart=$matchEnd + 1;
750 750
 				}
751 751
 				else
752
-					throw new TConfigurationException('template_matching_unexpected',$match);
752
+					throw new TConfigurationException('template_matching_unexpected', $match);
753 753
 			}
754 754
 			if(!empty($stack))
755 755
 			{
756 756
 				$name=array_pop($stack);
757
-				$tag=$name[0]==='@' ? '</prop:'.substr($name,1).'>' : "</com:$name>";
758
-				throw new TConfigurationException('template_closingtag_expected',$tag);
757
+				$tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>";
758
+				throw new TConfigurationException('template_closingtag_expected', $tag);
759 759
 			}
760
-			if($textStart<strlen($input))
761
-				$tpl[$c++]=array($container,substr($input,$textStart));
760
+			if($textStart < strlen($input))
761
+				$tpl[$c++]=array($container, substr($input, $textStart));
762 762
 		}
763 763
 		catch(Exception $e)
764 764
 		{
765 765
 			if(($e instanceof TException) && ($e instanceof TTemplateException))
766 766
 				throw $e;
767 767
 			if($matchEnd===0)
768
-				$line=$this->_startingLine+1;
768
+				$line=$this->_startingLine + 1;
769 769
 			else
770
-				$line=$this->_startingLine+count(explode("\n",substr($input,0,$matchEnd+1)));
771
-			$this->handleException($e,$line,$input);
770
+				$line=$this->_startingLine + count(explode("\n", substr($input, 0, $matchEnd + 1)));
771
+			$this->handleException($e, $line, $input);
772 772
 		}
773 773
 
774 774
 		if($this->_directive===null)
@@ -785,9 +785,9 @@  discard block
 block discarded – undo
785 785
 				if($parent!==null)
786 786
 				{
787 787
 					if(count($merged[1])===1 && is_string($merged[1][0]))
788
-						$objects[$id-1]=array($merged[0],$merged[1][0]);
788
+						$objects[$id - 1]=array($merged[0], $merged[1][0]);
789 789
 					else
790
-						$objects[$id-1]=array($merged[0],new TCompositeLiteral($merged[1]));
790
+						$objects[$id - 1]=array($merged[0], new TCompositeLiteral($merged[1]));
791 791
 				}
792 792
 				if(isset($object[2]))
793 793
 				{
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
 				else
798 798
 				{
799 799
 					$parent=$object[0];
800
-					$merged=array($parent,array($object[1]));
800
+					$merged=array($parent, array($object[1]));
801 801
 				}
802 802
 			}
803 803
 			else
@@ -806,9 +806,9 @@  discard block
 block discarded – undo
806 806
 		if($parent!==null)
807 807
 		{
808 808
 			if(count($merged[1])===1 && is_string($merged[1][0]))
809
-				$objects[$id]=array($merged[0],$merged[1][0]);
809
+				$objects[$id]=array($merged[0], $merged[1][0]);
810 810
 			else
811
-				$objects[$id]=array($merged[0],new TCompositeLiteral($merged[1]));
811
+				$objects[$id]=array($merged[0], new TCompositeLiteral($merged[1]));
812 812
 		}
813 813
 		$tpl=$objects;
814 814
 		return $objects;
@@ -819,31 +819,31 @@  discard block
 block discarded – undo
819 819
 	 * @param string the string to be parsed.
820 820
 	 * @return array attribute values indexed by names.
821 821
 	 */
822
-	protected function parseAttributes($str,$offset)
822
+	protected function parseAttributes($str, $offset)
823 823
 	{
824 824
 		if($str==='')
825 825
 			return array();
826 826
 		$pattern='/([\w\.\-]+)\s*=\s*(\'.*?\'|".*?"|<%.*?%>)/msS';
827 827
 		$attributes=array();
828
-		$n=preg_match_all($pattern,$str,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE);
829
-		for($i=0;$i<$n;++$i)
828
+		$n=preg_match_all($pattern, $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
829
+		for($i=0; $i < $n; ++$i)
830 830
 		{
831 831
 			$match=&$matches[$i];
832 832
 			$name=strtolower($match[1][0]);
833 833
 			if(isset($attributes[$name]))
834
-				throw new TConfigurationException('template_property_duplicated',$name);
834
+				throw new TConfigurationException('template_property_duplicated', $name);
835 835
 			$value=$match[2][0];
836
-			if(substr($name,-8,8)==='template')
836
+			if(substr($name, -8, 8)==='template')
837 837
 			{
838 838
 				if($value[0]==='\'' || $value[0]==='"')
839
-					$attributes[$name]=$this->parseTemplateProperty(substr($value,1,strlen($value)-2),$match[2][1]+1);
839
+					$attributes[$name]=$this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1);
840 840
 				else
841
-					$attributes[$name]=$this->parseTemplateProperty($value,$match[2][1]);
841
+					$attributes[$name]=$this->parseTemplateProperty($value, $match[2][1]);
842 842
 			}
843 843
 			else
844 844
 			{
845 845
 				if($value[0]==='\'' || $value[0]==='"')
846
-					$attributes[$name]=$this->parseAttribute(substr($value,1,strlen($value)-2));
846
+					$attributes[$name]=$this->parseAttribute(substr($value, 1, strlen($value) - 2));
847 847
 				else
848 848
 					$attributes[$name]=$this->parseAttribute($value);
849 849
 			}
@@ -851,10 +851,10 @@  discard block
 block discarded – undo
851 851
 		return $attributes;
852 852
 	}
853 853
 
854
-	protected function parseTemplateProperty($content,$offset)
854
+	protected function parseTemplateProperty($content, $offset)
855 855
 	{
856
-		$line=$this->_startingLine+count(explode("\n",substr($this->_content,0,$offset)))-1;
857
-		return array(self::CONFIG_TEMPLATE,new TTemplate($content,$this->_contextPath,$this->_tplFile,$line,false));
856
+		$line=$this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1;
857
+		return array(self::CONFIG_TEMPLATE, new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false));
858 858
 	}
859 859
 
860 860
 	/**
@@ -864,12 +864,12 @@  discard block
 block discarded – undo
864 864
 	 */
865 865
 	protected function parseAttribute($value)
866 866
 	{
867
-		if(($n=preg_match_all('/<%[#=].*?%>/msS',$value,$matches,PREG_OFFSET_CAPTURE))>0)
867
+		if(($n=preg_match_all('/<%[#=].*?%>/msS', $value, $matches, PREG_OFFSET_CAPTURE)) > 0)
868 868
 		{
869 869
 			$isDataBind=false;
870 870
 			$textStart=0;
871 871
 			$expr='';
872
-			for($i=0;$i<$n;++$i)
872
+			for($i=0; $i < $n; ++$i)
873 873
 			{
874 874
 				$match=$matches[0][$i];
875 875
 				$token=$match[0];
@@ -877,114 +877,114 @@  discard block
 block discarded – undo
877 877
 				$length=strlen($token);
878 878
 				if($token[2]==='#')
879 879
 					$isDataBind=true;
880
-				if($offset>$textStart)
881
-					$expr.=".'".strtr(substr($value,$textStart,$offset-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
882
-				$expr.='.('.substr($token,3,$length-5).')';
883
-				$textStart=$offset+$length;
880
+				if($offset > $textStart)
881
+					$expr.=".'".strtr(substr($value, $textStart, $offset - $textStart), array("'"=>"\\'", "\\"=>"\\\\"))."'";
882
+				$expr.='.('.substr($token, 3, $length - 5).')';
883
+				$textStart=$offset + $length;
884 884
 			}
885 885
 			$length=strlen($value);
886
-			if($length>$textStart)
887
-				$expr.=".'".strtr(substr($value,$textStart,$length-$textStart),array("'"=>"\\'","\\"=>"\\\\"))."'";
886
+			if($length > $textStart)
887
+				$expr.=".'".strtr(substr($value, $textStart, $length - $textStart), array("'"=>"\\'", "\\"=>"\\\\"))."'";
888 888
 			if($isDataBind)
889
-				return array(self::CONFIG_DATABIND,ltrim($expr,'.'));
889
+				return array(self::CONFIG_DATABIND, ltrim($expr, '.'));
890 890
 			else
891
-				return array(self::CONFIG_EXPRESSION,ltrim($expr,'.'));
891
+				return array(self::CONFIG_EXPRESSION, ltrim($expr, '.'));
892 892
 		}
893
-		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS',$value,$matches) && $matches[0]===$value)
893
+		else if(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0]===$value)
894 894
 		{
895 895
 			$value=$matches[1];
896 896
 			if($value[2]==='~')
897
-				return array(self::CONFIG_ASSET,trim(substr($value,3,strlen($value)-5)));
897
+				return array(self::CONFIG_ASSET, trim(substr($value, 3, strlen($value) - 5)));
898 898
 			elseif($value[2]==='[')
899
-				return array(self::CONFIG_LOCALIZATION,trim(substr($value,3,strlen($value)-6)));
899
+				return array(self::CONFIG_LOCALIZATION, trim(substr($value, 3, strlen($value) - 6)));
900 900
 			elseif($value[2]==='$')
901
-				return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5)));
901
+				return array(self::CONFIG_PARAMETER, trim(substr($value, 3, strlen($value) - 5)));
902 902
 			elseif($value[2]==='/') {
903
-				$literal = trim(substr($value,3,strlen($value)-5));
904
-				return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
903
+				$literal=trim(substr($value, 3, strlen($value) - 5));
904
+				return array(self::CONFIG_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'");
905 905
 			}
906 906
 		}
907 907
 		else
908 908
 			return $value;
909 909
 	}
910 910
 
911
-	protected function validateAttributes($type,$attributes)
911
+	protected function validateAttributes($type, $attributes)
912 912
 	{
913 913
 		Prado::using($type);
914
-		if(($pos=strrpos($type,'.'))!==false)
915
-			$className=substr($type,$pos+1);
914
+		if(($pos=strrpos($type, '.'))!==false)
915
+			$className=substr($type, $pos + 1);
916 916
 		else
917 917
 			$className=$type;
918 918
 		$class=new ReflectionClass($className);
919
-		if(is_subclass_of($className,'TControl') || $className==='TControl')
919
+		if(is_subclass_of($className, 'TControl') || $className==='TControl')
920 920
 		{
921 921
 			foreach($attributes as $name=>$att)
922 922
 			{
923
-				if(($pos=strpos($name,'.'))!==false)
923
+				if(($pos=strpos($name, '.'))!==false)
924 924
 				{
925 925
 					// a subproperty, so the first segment must be readable
926
-					$subname=substr($name,0,$pos);
926
+					$subname=substr($name, 0, $pos);
927 927
 					if(!$class->hasMethod('get'.$subname))
928
-						throw new TConfigurationException('template_property_unknown',$type,$subname);
928
+						throw new TConfigurationException('template_property_unknown', $type, $subname);
929 929
 				}
930
-				else if(strncasecmp($name,'on',2)===0)
930
+				else if(strncasecmp($name, 'on', 2)===0)
931 931
 				{
932 932
 					// an event
933 933
 					if(!$class->hasMethod($name))
934
-						throw new TConfigurationException('template_event_unknown',$type,$name);
934
+						throw new TConfigurationException('template_event_unknown', $type, $name);
935 935
 					else if(!is_string($att))
936
-						throw new TConfigurationException('template_eventhandler_invalid',$type,$name);
936
+						throw new TConfigurationException('template_eventhandler_invalid', $type, $name);
937 937
 				}
938 938
 				else
939 939
 				{
940 940
 					// a simple property
941
-					if (! ($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)) )
941
+					if(!($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name)))
942 942
 					{
943
-						if ($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name))
944
-							throw new TConfigurationException('template_property_readonly',$type,$name);
943
+						if($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name))
944
+							throw new TConfigurationException('template_property_readonly', $type, $name);
945 945
 						else
946
-							throw new TConfigurationException('template_property_unknown',$type,$name);
946
+							throw new TConfigurationException('template_property_unknown', $type, $name);
947 947
 					}
948 948
 					else if(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION)
949 949
 					{
950
-						if(strcasecmp($name,'id')===0)
951
-							throw new TConfigurationException('template_controlid_invalid',$type);
952
-						else if(strcasecmp($name,'skinid')===0)
953
-							throw new TConfigurationException('template_controlskinid_invalid',$type);
950
+						if(strcasecmp($name, 'id')===0)
951
+							throw new TConfigurationException('template_controlid_invalid', $type);
952
+						else if(strcasecmp($name, 'skinid')===0)
953
+							throw new TConfigurationException('template_controlskinid_invalid', $type);
954 954
 					}
955 955
 				}
956 956
 			}
957 957
 		}
958
-		else if(is_subclass_of($className,'TComponent') || $className==='TComponent')
958
+		else if(is_subclass_of($className, 'TComponent') || $className==='TComponent')
959 959
 		{
960 960
 			foreach($attributes as $name=>$att)
961 961
 			{
962 962
 				if(is_array($att) && ($att[0]===self::CONFIG_DATABIND))
963
-					throw new TConfigurationException('template_databind_forbidden',$type,$name);
964
-				if(($pos=strpos($name,'.'))!==false)
963
+					throw new TConfigurationException('template_databind_forbidden', $type, $name);
964
+				if(($pos=strpos($name, '.'))!==false)
965 965
 				{
966 966
 					// a subproperty, so the first segment must be readable
967
-					$subname=substr($name,0,$pos);
967
+					$subname=substr($name, 0, $pos);
968 968
 					if(!$class->hasMethod('get'.$subname))
969
-						throw new TConfigurationException('template_property_unknown',$type,$subname);
969
+						throw new TConfigurationException('template_property_unknown', $type, $subname);
970 970
 				}
971
-				else if(strncasecmp($name,'on',2)===0)
972
-					throw new TConfigurationException('template_event_forbidden',$type,$name);
971
+				else if(strncasecmp($name, 'on', 2)===0)
972
+					throw new TConfigurationException('template_event_forbidden', $type, $name);
973 973
 				else
974 974
 				{
975 975
 					// id is still alowed for TComponent, even if id property doesn't exist
976
-					if(strcasecmp($name,'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class,'set'.$name)))
976
+					if(strcasecmp($name, 'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name)))
977 977
 					{
978 978
 						if($class->hasMethod('get'.$name))
979
-							throw new TConfigurationException('template_property_readonly',$type,$name);
979
+							throw new TConfigurationException('template_property_readonly', $type, $name);
980 980
 						else
981
-							throw new TConfigurationException('template_property_unknown',$type,$name);
981
+							throw new TConfigurationException('template_property_unknown', $type, $name);
982 982
 					}
983 983
 				}
984 984
 			}
985 985
 		}
986 986
 		else
987
-			throw new TConfigurationException('template_component_required',$type);
987
+			throw new TConfigurationException('template_component_required', $type);
988 988
 	}
989 989
 
990 990
 	/**
@@ -1003,28 +1003,28 @@  discard block
 block discarded – undo
1003 1003
 	 * @param int line number
1004 1004
 	 * @param string template string if no source file is used
1005 1005
 	 */
1006
-	protected function handleException($e,$line,$input=null)
1006
+	protected function handleException($e, $line, $input=null)
1007 1007
 	{
1008 1008
 		$srcFile=$this->_tplFile;
1009 1009
 
1010
-		if(($n=count($this->_includedFiles))>0) // need to adjust error row number and file name
1010
+		if(($n=count($this->_includedFiles)) > 0) // need to adjust error row number and file name
1011 1011
 		{
1012
-			for($i=$n-1;$i>=0;--$i)
1012
+			for($i=$n - 1; $i >= 0; --$i)
1013 1013
 			{
1014
-				if($this->_includeAtLine[$i]<=$line)
1014
+				if($this->_includeAtLine[$i] <= $line)
1015 1015
 				{
1016
-					if($line<$this->_includeAtLine[$i]+$this->_includeLines[$i])
1016
+					if($line < $this->_includeAtLine[$i] + $this->_includeLines[$i])
1017 1017
 					{
1018
-						$line=$line-$this->_includeAtLine[$i]+1;
1018
+						$line=$line - $this->_includeAtLine[$i] + 1;
1019 1019
 						$srcFile=$this->_includedFiles[$i];
1020 1020
 						break;
1021 1021
 					}
1022 1022
 					else
1023
-						$line=$line-$this->_includeLines[$i]+1;
1023
+						$line=$line - $this->_includeLines[$i] + 1;
1024 1024
 				}
1025 1025
 			}
1026 1026
 		}
1027
-		$exception=new TTemplateException('template_format_invalid',$e->getMessage());
1027
+		$exception=new TTemplateException('template_format_invalid', $e->getMessage());
1028 1028
 		$exception->setLineNumber($line);
1029 1029
 		if(!empty($srcFile))
1030 1030
 			$exception->setTemplateFile($srcFile);
@@ -1040,29 +1040,29 @@  discard block
 block discarded – undo
1040 1040
 	 */
1041 1041
 	protected function preprocess($input)
1042 1042
 	{
1043
-		if($n=preg_match_all('/<%include(.*?)%>/',$input,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE))
1043
+		if($n=preg_match_all('/<%include(.*?)%>/', $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
1044 1044
 		{
1045
-			for($i=0;$i<$n;++$i)
1045
+			for($i=0; $i < $n; ++$i)
1046 1046
 			{
1047
-				$filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]),TTemplateManager::TEMPLATE_FILE_EXT);
1047
+				$filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]), TTemplateManager::TEMPLATE_FILE_EXT);
1048 1048
 				if($filePath!==null && is_file($filePath))
1049 1049
 					$this->_includedFiles[]=$filePath;
1050 1050
 				else
1051 1051
 				{
1052
-					$errorLine=count(explode("\n",substr($input,0,$matches[$i][0][1]+1)));
1053
-					$this->handleException(new TConfigurationException('template_include_invalid',trim($matches[$i][1][0])),$errorLine,$input);
1052
+					$errorLine=count(explode("\n", substr($input, 0, $matches[$i][0][1] + 1)));
1053
+					$this->handleException(new TConfigurationException('template_include_invalid', trim($matches[$i][1][0])), $errorLine, $input);
1054 1054
 				}
1055 1055
 			}
1056 1056
 			$base=0;
1057
-			for($i=0;$i<$n;++$i)
1057
+			for($i=0; $i < $n; ++$i)
1058 1058
 			{
1059 1059
 				$ext=file_get_contents($this->_includedFiles[$i]);
1060 1060
 				$length=strlen($matches[$i][0][0]);
1061
-				$offset=$base+$matches[$i][0][1];
1062
-				$this->_includeAtLine[$i]=count(explode("\n",substr($input,0,$offset)));
1063
-				$this->_includeLines[$i]=count(explode("\n",$ext));
1064
-				$input=substr_replace($input,$ext,$offset,$length);
1065
-				$base+=strlen($ext)-$length;
1061
+				$offset=$base + $matches[$i][0][1];
1062
+				$this->_includeAtLine[$i]=count(explode("\n", substr($input, 0, $offset)));
1063
+				$this->_includeLines[$i]=count(explode("\n", $ext));
1064
+				$input=substr_replace($input, $ext, $offset, $length);
1065
+				$base+=strlen($ext) - $length;
1066 1066
 			}
1067 1067
 		}
1068 1068
 
@@ -1075,7 +1075,7 @@  discard block
 block discarded – undo
1075 1075
 	 * @param string $method
1076 1076
 	 * @return boolean
1077 1077
 	 */
1078
-	protected function isClassBehaviorMethod(ReflectionClass $class,$method)
1078
+	protected function isClassBehaviorMethod(ReflectionClass $class, $method)
1079 1079
 	{
1080 1080
 	  $component=new ReflectionClass('TComponent');
1081 1081
 	  $behaviors=$component->getStaticProperties();
@@ -1086,7 +1086,7 @@  discard block
 block discarded – undo
1086 1086
 	    if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue;
1087 1087
 	    foreach($list as $param)
1088 1088
 	    {
1089
-	      if(method_exists($param->getBehavior(),$method))
1089
+	      if(method_exists($param->getBehavior(), $method))
1090 1090
 	        return true;
1091 1091
 	    }
1092 1092
 	  }
Please login to merge, or discard this patch.