Completed
Push — php-cs-fixer ( b6f93e...b9836a )
by Fabio
07:15
created
framework/Web/UI/TTemplateControl.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
 	/**
34 34
 	 * template file extension.
35 35
 	 */
36
-	const EXT_TEMPLATE = '.tpl';
36
+	const EXT_TEMPLATE='.tpl';
37 37
 
38 38
 	/**
39 39
 	 * @var ITemplate the parsed template structure shared by the same control class
40 40
 	 */
41
-	private static $_template = [];
41
+	private static $_template=[];
42 42
 	/**
43 43
 	 * @var ITemplate the parsed template structure specific for this control instance
44 44
 	 */
@@ -50,15 +50,15 @@  discard block
 block discarded – undo
50 50
 	/**
51 51
 	 * @var string master control class name
52 52
 	 */
53
-	private $_masterClass = '';
53
+	private $_masterClass='';
54 54
 	/**
55 55
 	 * @var array list of TContent controls
56 56
 	 */
57
-	private $_contents = [];
57
+	private $_contents=[];
58 58
 	/**
59 59
 	 * @var array list of TContentPlaceHolder controls
60 60
 	 */
61
-	private $_placeholders = [];
61
+	private $_placeholders=[];
62 62
 
63 63
 	/**
64 64
 	 * Returns the template object associated with this control object.
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 	 */
67 67
 	public function getTemplate()
68 68
 	{
69
-		if($this->_localTemplate === null)
69
+		if($this->_localTemplate===null)
70 70
 		{
71
-			$class = get_class($this);
71
+			$class=get_class($this);
72 72
 			if(!isset(self::$_template[$class]))
73
-				self::$_template[$class] = $this->loadTemplate();
73
+				self::$_template[$class]=$this->loadTemplate();
74 74
 			return self::$_template[$class];
75 75
 		}
76 76
 		else
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function setTemplate($value)
87 87
 	{
88
-		$this->_localTemplate = $value;
88
+		$this->_localTemplate=$value;
89 89
 	}
90 90
 
91 91
 	/**
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	 */
96 96
 	public function getIsSourceTemplateControl()
97 97
 	{
98
-		if(($template = $this->getTemplate()) !== null)
98
+		if(($template=$this->getTemplate())!==null)
99 99
 			return $template->getIsSourceTemplate();
100 100
 		else
101 101
 			return false;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	public function getTemplateDirectory()
108 108
 	{
109
-		if(($template = $this->getTemplate()) !== null)
109
+		if(($template=$this->getTemplate())!==null)
110 110
 			return $template->getContextPath();
111 111
 		else
112 112
 			return '';
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
 	 */
119 119
 	protected function loadTemplate()
120 120
 	{
121
-		Prado::trace("Loading template " . get_class($this), '\Prado\Web\UI\TTemplateControl');
122
-		$template = $this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this));
121
+		Prado::trace("Loading template ".get_class($this), '\Prado\Web\UI\TTemplateControl');
122
+		$template=$this->getService()->getTemplateManager()->getTemplateByClassName(get_class($this));
123 123
 		return $template;
124 124
 	}
125 125
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 	 */
131 131
 	public function createChildControls()
132 132
 	{
133
-		if($tpl = $this->getTemplate())
133
+		if($tpl=$this->getTemplate())
134 134
 		{
135 135
 			foreach($tpl->getDirective() as $name => $value)
136 136
 			{
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 		if(isset($this->_contents[$id]))
154 154
 			throw new TConfigurationException('templatecontrol_contentid_duplicated', $id);
155 155
 		else
156
-			$this->_contents[$id] = $object;
156
+			$this->_contents[$id]=$object;
157 157
 	}
158 158
 
159 159
 	/**
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		if(isset($this->_placeholders[$id]))
168 168
 			throw new TConfigurationException('templatecontrol_placeholderid_duplicated', $id);
169 169
 		else
170
-			$this->_placeholders[$id] = $object;
170
+			$this->_placeholders[$id]=$object;
171 171
 	}
172 172
 
173 173
 	/**
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function setMasterClass($value)
185 185
 	{
186
-		$this->_masterClass = $value;
186
+		$this->_masterClass=$value;
187 187
 	}
188 188
 
189 189
 	/**
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 	{
205 205
 		if(isset($this->_placeholders[$id]))
206 206
 		{
207
-			$placeholder = $this->_placeholders[$id];
208
-			$controls = $placeholder->getParent()->getControls();
209
-			$loc = $controls->remove($placeholder);
207
+			$placeholder=$this->_placeholders[$id];
208
+			$controls=$placeholder->getParent()->getControls();
209
+			$loc=$controls->remove($placeholder);
210 210
 			$controls->insertAt($loc, $content);
211 211
 		}
212 212
 		else
@@ -221,15 +221,15 @@  discard block
 block discarded – undo
221 221
 	 * Only framework developers should use this method.
222 222
 	 * @param TControl the naming container control
223 223
 	 */
224
-	protected function initRecursive($namingContainer = null)
224
+	protected function initRecursive($namingContainer=null)
225 225
 	{
226 226
 		$this->ensureChildControls();
227
-		if($this->_masterClass !== '')
227
+		if($this->_masterClass!=='')
228 228
 		{
229
-			$master = Prado::createComponent($this->_masterClass);
229
+			$master=Prado::createComponent($this->_masterClass);
230 230
 			if(!($master instanceof TTemplateControl))
231 231
 				throw new TInvalidDataValueException('templatecontrol_mastercontrol_invalid');
232
-			$this->_master = $master;
232
+			$this->_master=$master;
233 233
 			$this->getControls()->clear();
234 234
 			$this->getControls()->add($master);
235 235
 			$master->ensureChildControls();
@@ -248,38 +248,38 @@  discard block
 block discarded – undo
248 248
 		 * @param Boolean $throwExceptions Wheter or not to throw exceptions
249 249
 		 * @author Daniel Sampedro <[email protected]>
250 250
 		 */
251
-		public function tryToUpdateView($arObj, $throwExceptions = false)
251
+		public function tryToUpdateView($arObj, $throwExceptions=false)
252 252
 		{
253
-				$objAttrs = get_class_vars(get_class($arObj));
254
-				foreach (array_keys($objAttrs) as $key)
253
+				$objAttrs=get_class_vars(get_class($arObj));
254
+				foreach(array_keys($objAttrs) as $key)
255 255
 				{
256 256
 						try
257 257
 						{
258
-								if ($key != "RELATIONS")
258
+								if($key!="RELATIONS")
259 259
 								{
260
-										$control = $this->{$key};
261
-										if ($control instanceof TTextBox)
262
-												$control->Text = $arObj->{$key};
263
-										elseif ($control instanceof TCheckBox)
264
-												$control->Checked = (boolean) $arObj->{$key};
265
-										elseif ($control instanceof TDatePicker)
266
-												$control->Date = $arObj->{$key};
260
+										$control=$this->{$key};
261
+										if($control instanceof TTextBox)
262
+												$control->Text=$arObj->{$key};
263
+										elseif($control instanceof TCheckBox)
264
+												$control->Checked=(boolean) $arObj->{$key};
265
+										elseif($control instanceof TDatePicker)
266
+												$control->Date=$arObj->{$key};
267 267
 								}
268 268
 								else
269 269
 								{
270
-										foreach ($objAttrs["RELATIONS"] as $relKey => $relValues)
270
+										foreach($objAttrs["RELATIONS"] as $relKey => $relValues)
271 271
 										{
272
-												$relControl = $this->{$relKey};
273
-												switch ($relValues[0])
272
+												$relControl=$this->{$relKey};
273
+												switch($relValues[0])
274 274
 												{
275 275
 														case TActiveRecord::BELONGS_TO:
276 276
 														case TActiveRecord::HAS_ONE:
277
-																$relControl->Text = $arObj->{$relKey};
277
+																$relControl->Text=$arObj->{$relKey};
278 278
 																break;
279 279
 														case TActiveRecord::HAS_MANY:
280
-																if ($relControl instanceof TListControl)
280
+																if($relControl instanceof TListControl)
281 281
 																{
282
-																		$relControl->DataSource = $arObj->{$relKey};
282
+																		$relControl->DataSource=$arObj->{$relKey};
283 283
 																		$relControl->dataBind();
284 284
 																}
285 285
 																break;
@@ -288,9 +288,9 @@  discard block
 block discarded – undo
288 288
 										break;
289 289
 								}
290 290
 						}
291
-						catch (Exception $ex)
291
+						catch(Exception $ex)
292 292
 						{
293
-								if ($throwExceptions)
293
+								if($throwExceptions)
294 294
 										throw $ex;
295 295
 						}
296 296
 				}
@@ -302,26 +302,26 @@  discard block
 block discarded – undo
302 302
 		 * @param Boolean $throwExceptions Wheter or not to throw exceptions
303 303
 		 * @author Daniel Sampedro <[email protected]>
304 304
 		 */
305
-		public function tryToUpdateAR($arObj, $throwExceptions = false)
305
+		public function tryToUpdateAR($arObj, $throwExceptions=false)
306 306
 		{
307
-				$objAttrs = get_class_vars(get_class($arObj));
308
-				foreach (array_keys($objAttrs) as $key)
307
+				$objAttrs=get_class_vars(get_class($arObj));
308
+				foreach(array_keys($objAttrs) as $key)
309 309
 				{
310 310
 						try
311 311
 						{
312
-								if ($key == "RELATIONS")
312
+								if($key=="RELATIONS")
313 313
 										break;
314
-								$control = $this->{$key};
315
-								if ($control instanceof TTextBox)
316
-										$arObj->{$key} = $control->Text;
317
-								elseif ($control instanceof TCheckBox)
318
-										$arObj->{$key} = $control->Checked;
319
-								elseif ($control instanceof TDatePicker)
320
-										$arObj->{$key} = $control->Date;
314
+								$control=$this->{$key};
315
+								if($control instanceof TTextBox)
316
+										$arObj->{$key}=$control->Text;
317
+								elseif($control instanceof TCheckBox)
318
+										$arObj->{$key}=$control->Checked;
319
+								elseif($control instanceof TDatePicker)
320
+										$arObj->{$key}=$control->Date;
321 321
 						}
322
-						catch (Exception $ex)
322
+						catch(Exception $ex)
323 323
 						{
324
-								if ($throwExceptions)
324
+								if($throwExceptions)
325 325
 										throw $ex;
326 326
 						}
327 327
 				}
Please login to merge, or discard this patch.
framework/Web/UI/TClientScriptManager.php 1 patch
Spacing   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	/**
35 35
 	 * file containing javascript packages and their cross dependencies
36 36
 	 */
37
-	const PACKAGES_FILE = 'Web/Javascripts/packages.php';
37
+	const PACKAGES_FILE='Web/Javascripts/packages.php';
38 38
 	/**
39 39
 	 * file containing css packages and their cross dependencies
40 40
 	 */
41
-	const CSS_PACKAGES_FILE = 'Web/Javascripts/css-packages.php';
41
+	const CSS_PACKAGES_FILE='Web/Javascripts/css-packages.php';
42 42
 	/**
43 43
 	 * @var TPage page who owns this manager
44 44
 	 */
@@ -46,39 +46,39 @@  discard block
 block discarded – undo
46 46
 	/**
47 47
 	 * @var array registered hidden fields, indexed by hidden field names
48 48
 	 */
49
-	private $_hiddenFields = [];
49
+	private $_hiddenFields=[];
50 50
 	/**
51 51
 	 * @var array javascript blocks to be rendered at the beginning of the form
52 52
 	 */
53
-	private $_beginScripts = [];
53
+	private $_beginScripts=[];
54 54
 	/**
55 55
 	 * @var array javascript blocks to be rendered at the end of the form
56 56
 	 */
57
-	private $_endScripts = [];
57
+	private $_endScripts=[];
58 58
 	/**
59 59
 	 * @var array javascript files to be rendered in the form
60 60
 	 */
61
-	private $_scriptFiles = [];
61
+	private $_scriptFiles=[];
62 62
 	/**
63 63
 	 * @var array javascript files to be rendered in page head section
64 64
 	 */
65
-	private $_headScriptFiles = [];
65
+	private $_headScriptFiles=[];
66 66
 	/**
67 67
 	 * @var array javascript blocks to be rendered in page head section
68 68
 	 */
69
-	private $_headScripts = [];
69
+	private $_headScripts=[];
70 70
 	/**
71 71
 	 * @var array CSS files
72 72
 	 */
73
-	private $_styleSheetFiles = [];
73
+	private $_styleSheetFiles=[];
74 74
 	/**
75 75
 	 * @var array CSS declarations
76 76
 	 */
77
-	private $_styleSheets = [];
77
+	private $_styleSheets=[];
78 78
 	/**
79 79
 	 * @var array registered PRADO script libraries
80 80
 	 */
81
-	private $_registeredScripts = [];
81
+	private $_registeredScripts=[];
82 82
 	/**
83 83
 	 * Client-side javascript library dependencies, loads from PACKAGES_FILE;
84 84
 	 * @var array
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 	/**
98 98
 	 * @var array registered PRADO style libraries
99 99
 	 */
100
-	private $_registeredStyles = [];
100
+	private $_registeredStyles=[];
101 101
 	/**
102 102
 	 * Client-side style library dependencies, loads from CSS_PACKAGES_FILE;
103 103
 	 * @var array
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 
117 117
 	private $_renderedHiddenFields;
118 118
 
119
-	private $_renderedScriptFiles = [];
119
+	private $_renderedScriptFiles=[];
120 120
 
121 121
 	private $_expandedScripts;
122 122
 	private $_expandedStyles;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 */
128 128
 	public function __construct(TPage $owner)
129 129
 	{
130
-		$this->_page = $owner;
130
+		$this->_page=$owner;
131 131
 	}
132 132
 
133 133
 	/**
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 	public function registerPradoScript($name)
159 159
 	{
160 160
 		$this->registerPradoScriptInternal($name);
161
-		$params = func_get_args();
161
+		$params=func_get_args();
162 162
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerPradoScript', $params);
163 163
 	}
164 164
 
@@ -170,50 +170,50 @@  discard block
 block discarded – undo
170 170
 		// $this->checkIfNotInRender();
171 171
 		if(!isset($this->_registeredScripts[$name]))
172 172
 		{
173
-			if(self::$_scripts === null)
173
+			if(self::$_scripts===null)
174 174
 			{
175
-				$packageFile = Prado::getFrameworkPath() . DIRECTORY_SEPARATOR . self::PACKAGES_FILE;
176
-				list($folders, $packages, $deps) = include($packageFile);
177
-				self::$_scriptsFolders = $folders;
178
-				self::$_scripts = $deps;
179
-				self::$_scriptsPackages = $packages;
175
+				$packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::PACKAGES_FILE;
176
+				list($folders, $packages, $deps)=include($packageFile);
177
+				self::$_scriptsFolders=$folders;
178
+				self::$_scripts=$deps;
179
+				self::$_scriptsPackages=$packages;
180 180
 			}
181 181
 
182
-			if (isset(self::$_scripts[$name]))
183
-				$this->_registeredScripts[$name] = true;
182
+			if(isset(self::$_scripts[$name]))
183
+				$this->_registeredScripts[$name]=true;
184 184
 			else
185 185
 				throw new TInvalidOperationException('csmanager_pradoscript_invalid', $name);
186 186
 
187
-			if(($packages = array_keys($this->_registeredScripts)) !== [])
187
+			if(($packages=array_keys($this->_registeredScripts))!==[])
188 188
 			{
189
-				$packagesUrl = [];
190
-				$isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug;
191
-				foreach ($packages as $p)
189
+				$packagesUrl=[];
190
+				$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
191
+				foreach($packages as $p)
192 192
 				{
193
-					foreach (self::$_scripts[$p] as $dep)
193
+					foreach(self::$_scripts[$p] as $dep)
194 194
 					{
195
-						foreach (self::$_scriptsPackages[$dep] as $script)
195
+						foreach(self::$_scriptsPackages[$dep] as $script)
196 196
 						{
197
-							if (!isset($this->_expandedScripts[$script]))
197
+							if(!isset($this->_expandedScripts[$script]))
198 198
 							{
199
-								list($base, $subPath) = $this->getScriptPackageFolder($script);
200
-								list($path, $baseUrl) = $this->getPackagePathUrl($base);
199
+								list($base, $subPath)=$this->getScriptPackageFolder($script);
200
+								list($path, $baseUrl)=$this->getPackagePathUrl($base);
201 201
 
202
-								$this->_expandedScripts[$script] = true;
202
+								$this->_expandedScripts[$script]=true;
203 203
 								if($isDebug)
204 204
 								{
205
-									if (!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl))
206
-										$packagesUrl[] = $url;
205
+									if(!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl))
206
+										$packagesUrl[]=$url;
207 207
 								} else {
208
-								  $minPath = preg_replace('/^(.*)(?<!\.min)\.js$/', "\\1.min.js", $subPath);
209
-								  if (!in_array($url = $baseUrl . '/' . $minPath, $packagesUrl))
208
+								  $minPath=preg_replace('/^(.*)(?<!\.min)\.js$/', "\\1.min.js", $subPath);
209
+								  if(!in_array($url=$baseUrl.'/'.$minPath, $packagesUrl))
210 210
 									{
211
-										if(!is_file($filePath = $path . DIRECTORY_SEPARATOR . $minPath))
211
+										if(!is_file($filePath=$path.DIRECTORY_SEPARATOR.$minPath))
212 212
 										{
213
-											file_put_contents($filePath, TJavaScript::JSMin(file_get_contents($base . '/' . $subPath)));
213
+											file_put_contents($filePath, TJavaScript::JSMin(file_get_contents($base.'/'.$subPath)));
214 214
 											chmod($filePath, PRADO_CHMOD);
215 215
 										}
216
-										$packagesUrl[] = $url;
216
+										$packagesUrl[]=$url;
217 217
 									}
218 218
 								}
219 219
 							}
@@ -229,26 +229,26 @@  discard block
 block discarded – undo
229 229
 	/**
230 230
 	 * @return string Prado javascript library base asset url.
231 231
 	 */
232
-	public function getPradoScriptAssetUrl($script = 'prado')
232
+	public function getPradoScriptAssetUrl($script='prado')
233 233
 	{
234 234
 		if(!isset(self::$_scriptsFolders[$script]))
235 235
 			$this->registerPradoScriptInternal($script);
236 236
 
237
-		$base = Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]);
238
-		$assets = Prado::getApplication()->getAssetManager();
237
+		$base=Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]);
238
+		$assets=Prado::getApplication()->getAssetManager();
239 239
 		return $assets->getPublishedUrl($base);
240 240
 	}
241 241
 
242 242
 	/**
243 243
 	 * @return string Prado javascript library base asset path in local filesystem.
244 244
 	 */
245
-	public function getPradoScriptAssetPath($script = 'prado')
245
+	public function getPradoScriptAssetPath($script='prado')
246 246
 	{
247 247
 		if(!isset(self::$_scriptsFolders[$script]))
248 248
 			$this->registerPradoScriptInternal($script);
249 249
 
250
-		$base = Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]);
251
-		$assets = Prado::getApplication()->getAssetManager();
250
+		$base=Prado::getPathOfNameSpace(self::$_scriptsFolders[$script]);
251
+		$assets=Prado::getApplication()->getAssetManager();
252 252
 		return $assets->getPublishedPath($base);
253 253
 	}
254 254
 
@@ -258,9 +258,9 @@  discard block
 block discarded – undo
258 258
 	 */
259 259
 	public function getScriptUrls()
260 260
 	{
261
-		$scripts = array_values($this->_headScriptFiles);
262
-		$scripts = array_merge($scripts, array_values($this->_scriptFiles));
263
-		$scripts = array_unique($scripts);
261
+		$scripts=array_values($this->_headScriptFiles);
262
+		$scripts=array_merge($scripts, array_values($this->_scriptFiles));
263
+		$scripts=array_unique($scripts);
264 264
 
265 265
 		return $scripts;
266 266
 	}
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	protected function getPackagePathUrl($base)
273 273
 	{
274
-		$assets = Prado::getApplication()->getAssetManager();
275
-		if(strpos($base, $assets->getBaseUrl()) === false)
274
+		$assets=Prado::getApplication()->getAssetManager();
275
+		if(strpos($base, $assets->getBaseUrl())===false)
276 276
 		{
277 277
 			return [$assets->getPublishedPath($base), $assets->publishFilePath($base)];
278 278
 		}
279 279
 		else
280 280
 		{
281
-			return [$assets->getBasePath() . str_replace($assets->getBaseUrl(), '', $base), $base];
281
+			return [$assets->getBasePath().str_replace($assets->getBaseUrl(), '', $base), $base];
282 282
 		}
283 283
 	}
284 284
 
@@ -288,14 +288,14 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	protected function getScriptPackageFolder($script)
290 290
 	{
291
-		list($base, $subPath) = explode("/", $script, 2);
291
+		list($base, $subPath)=explode("/", $script, 2);
292 292
 
293 293
 		if(!array_key_exists($base, self::$_scriptsFolders))
294 294
 			throw new TInvalidOperationException('csmanager_pradostyle_invalid', $base);
295 295
 
296
-		$namespace = self::$_scriptsFolders[$base];
297
-		if(($dir = Prado::getPathOfNameSpace($namespace)) !== null) {
298
-		  $namespace = $dir;
296
+		$namespace=self::$_scriptsFolders[$base];
297
+		if(($dir=Prado::getPathOfNameSpace($namespace))!==null) {
298
+		  $namespace=$dir;
299 299
 		}
300 300
 
301 301
 		return [$namespace, $subPath];
@@ -307,14 +307,14 @@  discard block
 block discarded – undo
307 307
 	 */
308 308
 	protected function getStylePackageFolder($script)
309 309
 	{
310
-		list($base, $subPath) = explode("/", $script, 2);
310
+		list($base, $subPath)=explode("/", $script, 2);
311 311
 
312 312
 		if(!array_key_exists($base, self::$_stylesFolders))
313 313
 			throw new TInvalidOperationException('csmanager_pradostyle_invalid', $base);
314 314
 
315
-		$namespace = self::$_stylesFolders[$base];
316
-		if(($dir = Prado::getPathOfNameSpace($namespace)) !== null) {
317
-		  $namespace = $dir;
315
+		$namespace=self::$_stylesFolders[$base];
316
+		if(($dir=Prado::getPathOfNameSpace($namespace))!==null) {
317
+		  $namespace=$dir;
318 318
 		}
319 319
 
320 320
 		return [$namespace, $subPath];
@@ -326,15 +326,15 @@  discard block
 block discarded – undo
326 326
 	 * @param array additional callback options
327 327
 	 * @return string javascript statement that creates a new callback request.
328 328
 	 */
329
-	public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options = null)
329
+	public function getCallbackReference(ICallbackEventHandler $callbackHandler, $options=null)
330 330
 	{
331
-		$options = !is_array($options) ? [] : $options;
332
-		$class = new \ReflectionClass($callbackHandler);
333
-		$clientSide = $callbackHandler->getActiveControl()->getClientSide();
334
-		$options = array_merge($options, $clientSide->getOptions()->toArray());
335
-		$optionString = TJavaScript::encode($options);
331
+		$options=!is_array($options) ? [] : $options;
332
+		$class=new \ReflectionClass($callbackHandler);
333
+		$clientSide=$callbackHandler->getActiveControl()->getClientSide();
334
+		$options=array_merge($options, $clientSide->getOptions()->toArray());
335
+		$optionString=TJavaScript::encode($options);
336 336
 		$this->registerPradoScriptInternal('ajax');
337
-		$id = $callbackHandler->getUniqueID();
337
+		$id=$callbackHandler->getUniqueID();
338 338
 		return "new Prado.CallbackRequest('{$id}',{$optionString})";
339 339
 	}
340 340
 
@@ -345,12 +345,12 @@  discard block
 block discarded – undo
345 345
 	 */
346 346
 	public function registerCallbackControl($class, $options)
347 347
 	{
348
-		$optionString = TJavaScript::encode($options);
349
-		$code = "new {$class}({$optionString});";
350
-		$this->_endScripts[sprintf('%08X', crc32($code))] = $code;
348
+		$optionString=TJavaScript::encode($options);
349
+		$code="new {$class}({$optionString});";
350
+		$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
351 351
 		$this->registerPradoScriptInternal('ajax');
352 352
 
353
-		$params = func_get_args();
353
+		$params=func_get_args();
354 354
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerCallbackControl', $params);
355 355
 	}
356 356
 
@@ -362,18 +362,18 @@  discard block
 block discarded – undo
362 362
 	 */
363 363
 	public function registerPostBackControl($class, $options)
364 364
 	{
365
-		if($class === null) {
365
+		if($class===null) {
366 366
 			return;
367 367
 		}
368
-		if(!isset($options['FormID']) && ($form = $this->_page->getForm()) !== null)
369
-			$options['FormID'] = $form->getClientID();
370
-		$optionString = TJavaScript::encode($options);
371
-		$code = "new {$class}({$optionString});";
368
+		if(!isset($options['FormID']) && ($form=$this->_page->getForm())!==null)
369
+			$options['FormID']=$form->getClientID();
370
+		$optionString=TJavaScript::encode($options);
371
+		$code="new {$class}({$optionString});";
372 372
 
373
-		$this->_endScripts[sprintf('%08X', crc32($code))] = $code;
373
+		$this->_endScripts[sprintf('%08X', crc32($code))]=$code;
374 374
 		$this->registerPradoScriptInternal('prado');
375 375
 
376
-		$params = func_get_args();
376
+		$params=func_get_args();
377 377
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerPostBackControl', $params);
378 378
 	}
379 379
 
@@ -385,22 +385,22 @@  discard block
 block discarded – undo
385 385
 	 */
386 386
 	public function registerDefaultButton($panel, $button)
387 387
 	{
388
-		$panelID = is_string($panel)?$panel:$panel->getUniqueID();
388
+		$panelID=is_string($panel) ? $panel : $panel->getUniqueID();
389 389
 
390 390
 		if(is_string($button))
391
-			$buttonID = $button;
391
+			$buttonID=$button;
392 392
 		else
393 393
 		{
394 394
 			$button->setIsDefaultButton(true);
395
-			$buttonID = $button->getUniqueID();
395
+			$buttonID=$button->getUniqueID();
396 396
 		}
397
-		$options = TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
398
-		$code = "new Prado.WebUI.DefaultButton($options);";
397
+		$options=TJavaScript::encode($this->getDefaultButtonOptions($panelID, $buttonID));
398
+		$code="new Prado.WebUI.DefaultButton($options);";
399 399
 
400
-		$this->_endScripts['prado:' . $panelID] = $code;
400
+		$this->_endScripts['prado:'.$panelID]=$code;
401 401
 		$this->registerPradoScriptInternal('prado');
402 402
 
403
-		$params = [$panelID,$buttonID];
403
+		$params=[$panelID, $buttonID];
404 404
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerDefaultButton', $params);
405 405
 	}
406 406
 
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 	 */
412 412
 	protected function getDefaultButtonOptions($panelID, $buttonID)
413 413
 	{
414
-		$options['ID'] = TControl::convertUniqueIdToClientId($panelID);
415
-		$options['Panel'] = TControl::convertUniqueIdToClientId($panelID);
416
-		$options['Target'] = TControl::convertUniqueIdToClientId($buttonID);
417
-		$options['EventTarget'] = $buttonID;
418
-		$options['Event'] = 'click';
414
+		$options['ID']=TControl::convertUniqueIdToClientId($panelID);
415
+		$options['Panel']=TControl::convertUniqueIdToClientId($panelID);
416
+		$options['Target']=TControl::convertUniqueIdToClientId($buttonID);
417
+		$options['EventTarget']=$buttonID;
418
+		$options['Event']='click';
419 419
 		return $options;
420 420
 	}
421 421
 
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	{
428 428
 		$this->registerPradoScriptInternal('jquery');
429 429
 		if($target instanceof TControl)
430
-			$target = $target->getClientID();
431
-		$this->_endScripts['prado:focus'] = 'jQuery(\'#' . $target . '\').focus();';
430
+			$target=$target->getClientID();
431
+		$this->_endScripts['prado:focus']='jQuery(\'#'.$target.'\').focus();';
432 432
 
433
-		$params = func_get_args();
433
+		$params=func_get_args();
434 434
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerFocusControl', $params);
435 435
 	}
436 436
 
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	public function registerPradoStyle($name)
443 443
 	{
444 444
 		$this->registerPradoStyleInternal($name);
445
-		$params = func_get_args();
445
+		$params=func_get_args();
446 446
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerPradoStyle', $params);
447 447
 	}
448 448
 
@@ -454,39 +454,39 @@  discard block
 block discarded – undo
454 454
 		// $this->checkIfNotInRender();
455 455
 		if(!isset($this->_registeredStyles[$name]))
456 456
 		{
457
-			if(self::$_styles === null)
457
+			if(self::$_styles===null)
458 458
 			{
459
-				$packageFile = Prado::getFrameworkPath() . DIRECTORY_SEPARATOR . self::CSS_PACKAGES_FILE;
460
-				list($folders, $packages, $deps) = include($packageFile);
461
-				self::$_stylesFolders = $folders;
462
-				self::$_styles = $deps;
463
-				self::$_stylesPackages = $packages;
459
+				$packageFile=Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::CSS_PACKAGES_FILE;
460
+				list($folders, $packages, $deps)=include($packageFile);
461
+				self::$_stylesFolders=$folders;
462
+				self::$_styles=$deps;
463
+				self::$_stylesPackages=$packages;
464 464
 			}
465 465
 
466
-			if (isset(self::$_styles[$name]))
467
-				$this->_registeredStyles[$name] = true;
466
+			if(isset(self::$_styles[$name]))
467
+				$this->_registeredStyles[$name]=true;
468 468
 			else
469 469
 				throw new TInvalidOperationException('csmanager_pradostyle_invalid', $name);
470 470
 
471
-			if(($packages = array_keys($this->_registeredStyles)) !== [])
471
+			if(($packages=array_keys($this->_registeredStyles))!==[])
472 472
 			{
473
-				$packagesUrl = [];
474
-				$isDebug = $this->getApplication()->getMode() === TApplicationMode::Debug;
475
-				foreach ($packages as $p)
473
+				$packagesUrl=[];
474
+				$isDebug=$this->getApplication()->getMode()===TApplicationMode::Debug;
475
+				foreach($packages as $p)
476 476
 				{
477
-					foreach (self::$_styles[$p] as $dep)
477
+					foreach(self::$_styles[$p] as $dep)
478 478
 					{
479
-						foreach (self::$_stylesPackages[$dep] as $style)
479
+						foreach(self::$_stylesPackages[$dep] as $style)
480 480
 						{
481
-							if (!isset($this->_expandedStyles[$style]))
481
+							if(!isset($this->_expandedStyles[$style]))
482 482
 							{
483
-								list($base, $subPath) = $this->getStylePackageFolder($style);
484
-								list($path, $baseUrl) = $this->getPackagePathUrl($base);
483
+								list($base, $subPath)=$this->getStylePackageFolder($style);
484
+								list($path, $baseUrl)=$this->getPackagePathUrl($base);
485 485
 
486
-								$this->_expandedStyles[$style] = true;
486
+								$this->_expandedStyles[$style]=true;
487 487
 								// TODO minify css?
488
-								if (!in_array($url = $baseUrl . '/' . $subPath, $packagesUrl))
489
-									$packagesUrl[] = $url;
488
+								if(!in_array($url=$baseUrl.'/'.$subPath, $packagesUrl))
489
+									$packagesUrl[]=$url;
490 490
 							}
491 491
 						}
492 492
 					}
@@ -519,14 +519,14 @@  discard block
 block discarded – undo
519 519
 	 * @param string URL to the CSS file
520 520
 	 * @param string media type of the CSS (such as 'print', 'screen', etc.). Defaults to empty, meaning the CSS applies to all media types.
521 521
 	 */
522
-	public function registerStyleSheetFile($key, $url, $media = '')
522
+	public function registerStyleSheetFile($key, $url, $media='')
523 523
 	{
524
-		if($media === '')
525
-			$this->_styleSheetFiles[$key] = $url;
524
+		if($media==='')
525
+			$this->_styleSheetFiles[$key]=$url;
526 526
 		else
527
-			$this->_styleSheetFiles[$key] = [$url,$media];
527
+			$this->_styleSheetFiles[$key]=[$url, $media];
528 528
 
529
-		$params = func_get_args();
529
+		$params=func_get_args();
530 530
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheetFile', $params);
531 531
 	}
532 532
 
@@ -535,11 +535,11 @@  discard block
 block discarded – undo
535 535
 	 * @param string a unique key identifying the CSS block
536 536
 	 * @param string CSS block
537 537
 	 */
538
-	public function registerStyleSheet($key, $css, $media = '')
538
+	public function registerStyleSheet($key, $css, $media='')
539 539
 	{
540
-		$this->_styleSheets[$key] = $css;
540
+		$this->_styleSheets[$key]=$css;
541 541
 
542
-		$params = func_get_args();
542
+		$params=func_get_args();
543 543
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerStyleSheet', $params);
544 544
 	}
545 545
 
@@ -549,17 +549,17 @@  discard block
 block discarded – undo
549 549
 	 */
550 550
 	public function getStyleSheetUrls()
551 551
 	{
552
-		$stylesheets = array_values(
552
+		$stylesheets=array_values(
553 553
 			array_map(function($e) {
554 554
 				return is_array($e) ? $e[0] : $e;
555 555
 			}, $this->_styleSheetFiles)
556 556
 		);
557 557
 
558 558
 		foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path => $url)
559
-			if (substr($url, strlen($url) - 4) == '.css')
560
-				$stylesheets[] = $url;
559
+			if(substr($url, strlen($url) - 4)=='.css')
560
+				$stylesheets[]=$url;
561 561
 
562
-		$stylesheets = array_unique($stylesheets);
562
+		$stylesheets=array_unique($stylesheets);
563 563
 
564 564
 		return $stylesheets;
565 565
 	}
@@ -581,9 +581,9 @@  discard block
 block discarded – undo
581 581
 	public function registerHeadScriptFile($key, $url)
582 582
 	{
583 583
 		$this->checkIfNotInRender();
584
-		$this->_headScriptFiles[$key] = $url;
584
+		$this->_headScriptFiles[$key]=$url;
585 585
 
586
-		$params = func_get_args();
586
+		$params=func_get_args();
587 587
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScriptFile', $params);
588 588
 	}
589 589
 
@@ -595,9 +595,9 @@  discard block
 block discarded – undo
595 595
 	public function registerHeadScript($key, $script)
596 596
 	{
597 597
 		$this->checkIfNotInRender();
598
-		$this->_headScripts[$key] = $script;
598
+		$this->_headScripts[$key]=$script;
599 599
 
600
-		$params = func_get_args();
600
+		$params=func_get_args();
601 601
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerHeadScript', $params);
602 602
 	}
603 603
 
@@ -608,9 +608,9 @@  discard block
 block discarded – undo
608 608
 	 */
609 609
 	public function registerScriptFile($key, $url)
610 610
 	{
611
-		$this->_scriptFiles[$key] = $url;
611
+		$this->_scriptFiles[$key]=$url;
612 612
 
613
-		$params = func_get_args();
613
+		$params=func_get_args();
614 614
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerScriptFile', $params);
615 615
 	}
616 616
 
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
 	public function registerBeginScript($key, $script)
623 623
 	{
624 624
 		$this->checkIfNotInRender();
625
-		$this->_beginScripts[$key] = $script;
625
+		$this->_beginScripts[$key]=$script;
626 626
 
627
-		$params = func_get_args();
627
+		$params=func_get_args();
628 628
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerBeginScript', $params);
629 629
 	}
630 630
 
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
 	 */
636 636
 	public function registerEndScript($key, $script)
637 637
 	{
638
-		$this->_endScripts[$key] = $script;
638
+		$this->_endScripts[$key]=$script;
639 639
 
640
-		$params = func_get_args();
640
+		$params=func_get_args();
641 641
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerEndScript', $params);
642 642
 	}
643 643
 
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
 	 */
650 650
 	public function registerHiddenField($name, $value)
651 651
 	{
652
-		$this->_hiddenFields[$name] = $value;
652
+		$this->_hiddenFields[$name]=$value;
653 653
 
654
-		$params = func_get_args();
654
+		$params=func_get_args();
655 655
 		$this->_page->registerCachingAction('Page.ClientScript', 'registerHiddenField', $params);
656 656
 	}
657 657
 
@@ -748,13 +748,13 @@  discard block
 block discarded – undo
748 748
 	 */
749 749
 	public function renderStyleSheetFiles($writer)
750 750
 	{
751
-		$str = '';
751
+		$str='';
752 752
 		foreach($this->_styleSheetFiles as $url)
753 753
 		{
754 754
 			if(is_array($url))
755
-				$str .= "<link rel=\"stylesheet\" type=\"text/css\" media=\"{$url[1]}\" href=\"" . THttpUtility::htmlEncode($url[0]) . "\" />\n";
755
+				$str.="<link rel=\"stylesheet\" type=\"text/css\" media=\"{$url[1]}\" href=\"".THttpUtility::htmlEncode($url[0])."\" />\n";
756 756
 			else
757
-				$str .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" . THttpUtility::htmlEncode($url) . "\" />\n";
757
+				$str.="<link rel=\"stylesheet\" type=\"text/css\" href=\"".THttpUtility::htmlEncode($url)."\" />\n";
758 758
 		}
759 759
 		$writer->write($str);
760 760
 	}
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 	public function renderStyleSheets($writer)
766 766
 	{
767 767
 		if(count($this->_styleSheets))
768
-			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n" . implode("\n", $this->_styleSheets) . "\n/*]]>*/\n</style>\n");
768
+			$writer->write("<style type=\"text/css\">\n/*<![CDATA[*/\n".implode("\n", $this->_styleSheets)."\n/*]]>*/\n</style>\n");
769 769
 	}
770 770
 
771 771
 	/**
@@ -796,8 +796,8 @@  discard block
 block discarded – undo
796 796
 
797 797
 	public function markScriptFileAsRendered($url)
798 798
 	{
799
-		$this->_renderedScriptFiles[$url] = $url;
800
-		$params = func_get_args();
799
+		$this->_renderedScriptFiles[$url]=$url;
800
+		$params=func_get_args();
801 801
 		$this->_page->registerCachingAction('Page.ClientScript', 'markScriptFileAsRendered', $params);
802 802
 	}
803 803
 
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 	{
823 823
 		if(!empty($this->_scriptFiles))
824 824
 		{
825
-			$addedScripts = array_diff($this->_scriptFiles, $this->getRenderedScriptFiles());
825
+			$addedScripts=array_diff($this->_scriptFiles, $this->getRenderedScriptFiles());
826 826
 			$this->renderScriptFiles($writer, $addedScripts);
827 827
 		}
828 828
 	}
@@ -874,7 +874,7 @@  discard block
 block discarded – undo
874 874
 	 * @param THtmlWriter writer for the rendering purpose
875 875
 	 * @param TControl the control forcing the flush (used only in error messages)
876 876
 	 */
877
-	public function flushScriptFiles($writer, $control = null)
877
+	public function flushScriptFiles($writer, $control=null)
878 878
 	{
879 879
 		if(!$this->_page->getIsCallback())
880 880
 		{
@@ -893,25 +893,25 @@  discard block
 block discarded – undo
893 893
 
894 894
 	protected function renderHiddenFieldsInt($writer, $initial)
895 895
 	{
896
-		if ($initial) $this->_renderedHiddenFields = [];
897
-		$str = '';
896
+		if($initial) $this->_renderedHiddenFields=[];
897
+		$str='';
898 898
 		foreach($this->_hiddenFields as $name => $value)
899 899
 		{
900
-			if (in_array($name, $this->_renderedHiddenFields)) continue;
901
-			$id = strtr($name, ':', '_');
900
+			if(in_array($name, $this->_renderedHiddenFields)) continue;
901
+			$id=strtr($name, ':', '_');
902 902
 			if(is_array($value))
903 903
 			{
904 904
 				foreach($value as $v)
905
-					$str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '[]" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n";
905
+					$str.='<input type="text" style="display:none" autocomplete="off" name="'.$name.'[]" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
906 906
 			}
907 907
 			else
908 908
 			{
909
-				$str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n";
909
+				$str.='<input type="text" style="display:none" autocomplete="off" name="'.$name.'" id="'.$id.'" value="'.THttpUtility::htmlEncode($value)."\" />\n";
910 910
 			}
911
-			$this->_renderedHiddenFields[] = $name;
911
+			$this->_renderedHiddenFields[]=$name;
912 912
 		}
913
-		if($str !== '')
914
-			$writer->write("<div style=\"visibility:hidden;\">\n" . $str . "</div>\n");
913
+		if($str!=='')
914
+			$writer->write("<div style=\"visibility:hidden;\">\n".$str."</div>\n");
915 915
 	}
916 916
 
917 917
 	public function getHiddenFields()
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 	 */
925 925
 	protected function checkIfNotInRender()
926 926
 	{
927
-		if ($form = $this->_page->InFormRender)
927
+		if($form=$this->_page->InFormRender)
928 928
 			throw new \Exception('Operation invalid when page is already rendering');
929 929
 	}
930 930
 }
Please login to merge, or discard this patch.
framework/Web/UI/TTemplateManager.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	/**
40 40
 	 * Template file extension
41 41
 	 */
42
-	const TEMPLATE_FILE_EXT = '.tpl';
42
+	const TEMPLATE_FILE_EXT='.tpl';
43 43
 	/**
44 44
 	 * Prefix of the cache variable name for storing parsed templates
45 45
 	 */
46
-	const TEMPLATE_CACHE_PREFIX = 'prado:template:';
46
+	const TEMPLATE_CACHE_PREFIX='prado:template:';
47 47
 
48 48
 	/**
49 49
 	 * Initializes the module.
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function getTemplateByClassName($className)
64 64
 	{
65
-		$class = new \ReflectionClass($className);
66
-		$tplFile = dirname($class->getFileName()) . DIRECTORY_SEPARATOR . $class->getShortName() . self::TEMPLATE_FILE_EXT;
65
+		$class=new \ReflectionClass($className);
66
+		$tplFile=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$class->getShortName().self::TEMPLATE_FILE_EXT;
67 67
 		return $this->getTemplateByFileName($tplFile);
68 68
 	}
69 69
 
@@ -73,38 +73,38 @@  discard block
 block discarded – undo
73 73
 	 */
74 74
 	public function getTemplateByFileName($fileName)
75 75
 	{
76
-		if(($fileName = $this->getLocalizedTemplate($fileName)) !== null)
76
+		if(($fileName=$this->getLocalizedTemplate($fileName))!==null)
77 77
 		{
78 78
 			Prado::trace("Loading template $fileName", '\Prado\Web\UI\TTemplateManager');
79
-			if(($cache = $this->getApplication()->getCache()) === null)
79
+			if(($cache=$this->getApplication()->getCache())===null)
80 80
 				return new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
81 81
 			else
82 82
 			{
83
-				$array = $cache->get(self::TEMPLATE_CACHE_PREFIX . $fileName);
83
+				$array=$cache->get(self::TEMPLATE_CACHE_PREFIX.$fileName);
84 84
 				if(is_array($array))
85 85
 				{
86
-					list($template, $timestamps) = $array;
87
-					if($this->getApplication()->getMode() === TApplicationMode::Performance)
86
+					list($template, $timestamps)=$array;
87
+					if($this->getApplication()->getMode()===TApplicationMode::Performance)
88 88
 						return $template;
89
-					$cacheValid = true;
89
+					$cacheValid=true;
90 90
 					foreach($timestamps as $tplFile => $timestamp)
91 91
 					{
92 92
 						if(!is_file($tplFile) || filemtime($tplFile) > $timestamp)
93 93
 						{
94
-							$cacheValid = false;
94
+							$cacheValid=false;
95 95
 							break;
96 96
 						}
97 97
 					}
98 98
 					if($cacheValid)
99 99
 						return $template;
100 100
 				}
101
-				$template = new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
102
-				$includedFiles = $template->getIncludedFiles();
103
-				$timestamps = [];
104
-				$timestamps[$fileName] = filemtime($fileName);
101
+				$template=new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName);
102
+				$includedFiles=$template->getIncludedFiles();
103
+				$timestamps=[];
104
+				$timestamps[$fileName]=filemtime($fileName);
105 105
 				foreach($includedFiles as $includedFile)
106
-					$timestamps[$includedFile] = filemtime($includedFile);
107
-				$cache->set(self::TEMPLATE_CACHE_PREFIX . $fileName, [$template,$timestamps]);
106
+					$timestamps[$includedFile]=filemtime($includedFile);
107
+				$cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName, [$template, $timestamps]);
108 108
 				return $template;
109 109
 			}
110 110
 		}
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	protected function getLocalizedTemplate($filename)
121 121
 	{
122
-		if(($app = $this->getApplication()->getGlobalization(false)) === null)
123
-			return is_file($filename)?$filename:null;
122
+		if(($app=$this->getApplication()->getGlobalization(false))===null)
123
+			return is_file($filename) ? $filename : null;
124 124
 		foreach($app->getLocalizedResource($filename) as $file)
125 125
 		{
126
-			if(($file = realpath($file)) !== false && is_file($file))
126
+			if(($file=realpath($file))!==false && is_file($file))
127 127
 				return $file;
128 128
 		}
129 129
 		return null;
Please login to merge, or discard this patch.
framework/Web/UI/TThemeManager.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -47,22 +47,22 @@  discard block
 block discarded – undo
47 47
 	/**
48 48
 	 * default themes base path
49 49
 	 */
50
-	const DEFAULT_BASEPATH = 'themes';
50
+	const DEFAULT_BASEPATH='themes';
51 51
 
52 52
 	/**
53 53
 	 * default theme class
54 54
 	 */
55
-	const DEFAULT_THEMECLASS = 'TTheme';
55
+	const DEFAULT_THEMECLASS='TTheme';
56 56
 
57 57
 	/**
58 58
 	 * @var string
59 59
 	 */
60
-	private $_themeClass = self::DEFAULT_THEMECLASS;
60
+	private $_themeClass=self::DEFAULT_THEMECLASS;
61 61
 
62 62
 	/**
63 63
 	 * @var boolean whether this module has been initialized
64 64
 	 */
65
-	private $_initialized = false;
65
+	private $_initialized=false;
66 66
 	/**
67 67
 	 * @var string the directory containing all themes
68 68
 	 */
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 	 */
80 80
 	public function init($config)
81 81
 	{
82
-		$this->_initialized = true;
83
-		$service = $this->getService();
82
+		$this->_initialized=true;
83
+		$service=$this->getService();
84 84
 		if($service instanceof TPageService)
85 85
 			$service->setThemeManager($this);
86 86
 		else
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
 	 */
94 94
 	public function getTheme($name)
95 95
 	{
96
-		$themePath = $this->getBasePath() . DIRECTORY_SEPARATOR . $name;
97
-		$themeUrl = rtrim($this->getBaseUrl(), '/') . '/' . $name;
96
+		$themePath=$this->getBasePath().DIRECTORY_SEPARATOR.$name;
97
+		$themeUrl=rtrim($this->getBaseUrl(), '/').'/'.$name;
98 98
 		return Prado::createComponent($this->getThemeClass(), $themePath, $themeUrl);
99 99
 	}
100 100
 
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	 * @param string|null $class Theme class name in namespace format
103 103
 	 */
104 104
 	public function setThemeClass($class) {
105
-		$this->_themeClass = $class === null ? self::DEFAULT_THEMECLASS : (string)$class;
105
+		$this->_themeClass=$class===null ? self::DEFAULT_THEMECLASS : (string) $class;
106 106
 	}
107 107
 
108 108
 	/**
@@ -117,13 +117,13 @@  discard block
 block discarded – undo
117 117
 	 */
118 118
 	public function getAvailableThemes()
119 119
 	{
120
-		$themes = [];
121
-		$basePath = $this->getBasePath();
122
-		$folder = @opendir($basePath);
123
-		while($file = @readdir($folder))
120
+		$themes=[];
121
+		$basePath=$this->getBasePath();
122
+		$folder=@opendir($basePath);
123
+		while($file=@readdir($folder))
124 124
 		{
125
-			if($file !== '.' && $file !== '..' && $file !== '.svn' && is_dir($basePath . DIRECTORY_SEPARATOR . $file))
126
-				$themes[] = $file;
125
+			if($file!=='.' && $file!=='..' && $file!=='.svn' && is_dir($basePath.DIRECTORY_SEPARATOR.$file))
126
+				$themes[]=$file;
127 127
 		}
128 128
 		closedir($folder);
129 129
 		return $themes;
@@ -135,12 +135,12 @@  discard block
 block discarded – undo
135 135
 	 */
136 136
 	public function getBasePath()
137 137
 	{
138
-		if($this->_basePath === null)
138
+		if($this->_basePath===null)
139 139
 		{
140
-			$this->_basePath = dirname($this->getRequest()->getApplicationFilePath()) . DIRECTORY_SEPARATOR . self::DEFAULT_BASEPATH;
141
-			if(($basePath = realpath($this->_basePath)) === false || !is_dir($basePath))
140
+			$this->_basePath=dirname($this->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH;
141
+			if(($basePath=realpath($this->_basePath))===false || !is_dir($basePath))
142 142
 				throw new TConfigurationException('thememanager_basepath_invalid2', $this->_basePath);
143
-			$this->_basePath = $basePath;
143
+			$this->_basePath=$basePath;
144 144
 		}
145 145
 		return $this->_basePath;
146 146
 	}
@@ -155,8 +155,8 @@  discard block
 block discarded – undo
155 155
 			throw new TInvalidOperationException('thememanager_basepath_unchangeable');
156 156
 		else
157 157
 		{
158
-			$this->_basePath = Prado::getPathOfNamespace($value);
159
-			if($this->_basePath === null || !is_dir($this->_basePath))
158
+			$this->_basePath=Prado::getPathOfNamespace($value);
159
+			if($this->_basePath===null || !is_dir($this->_basePath))
160 160
 				throw new TInvalidDataValueException('thememanager_basepath_invalid', $value);
161 161
 		}
162 162
 	}
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
 	 */
168 168
 	public function getBaseUrl()
169 169
 	{
170
-		if($this->_baseUrl === null)
170
+		if($this->_baseUrl===null)
171 171
 		{
172
-			$appPath = dirname($this->getRequest()->getApplicationFilePath());
173
-			$basePath = $this->getBasePath();
174
-			if(strpos($basePath, $appPath) === false)
172
+			$appPath=dirname($this->getRequest()->getApplicationFilePath());
173
+			$basePath=$this->getBasePath();
174
+			if(strpos($basePath, $appPath)===false)
175 175
 				throw new TConfigurationException('thememanager_baseurl_required');
176
-			$appUrl = rtrim(dirname($this->getRequest()->getApplicationUrl()), '/\\');
177
-			$this->_baseUrl = $appUrl . strtr(substr($basePath, strlen($appPath)), '\\', '/');
176
+			$appUrl=rtrim(dirname($this->getRequest()->getApplicationUrl()), '/\\');
177
+			$this->_baseUrl=$appUrl.strtr(substr($basePath, strlen($appPath)), '\\', '/');
178 178
 		}
179 179
 		return $this->_baseUrl;
180 180
 	}
@@ -184,6 +184,6 @@  discard block
 block discarded – undo
184 184
 	 */
185 185
 	public function setBaseUrl($value)
186 186
 	{
187
-		$this->_baseUrl = rtrim($value, '/');
187
+		$this->_baseUrl=rtrim($value, '/');
188 188
 	}
189 189
 }
190 190
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -48,16 +48,16 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function setInterval($value)
50 50
 	{
51
-		$interval = TPropertyValue::ensureFloat($value);
51
+		$interval=TPropertyValue::ensureFloat($value);
52 52
 		if($interval <= 0)
53 53
 			throw new TConfigurationException('callback_interval_be_positive', $this->getID());
54 54
 
55
-		if($this->getInterval() === $value)
55
+		if($this->getInterval()===$value)
56 56
 			return;
57 57
 
58 58
 		$this->setViewState('Interval', $interval, 1);
59
-		if ($this->getActiveControl()->canUpdateClientSide()){
60
-			$client = $this->getPage()->getCallbackClient();
59
+		if($this->getActiveControl()->canUpdateClientSide()) {
60
+			$client=$this->getPage()->getCallbackClient();
61 61
 			$client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setTimerInterval', [$this, $interval]);
62 62
 		}
63 63
 	}
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function startTimer()
69 69
 	{
70
-		$client = $this->getPage()->getCallbackClient();
70
+		$client=$this->getPage()->getCallbackClient();
71 71
 		$client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.start', [$this]);
72 72
 	}
73 73
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 	 */
77 77
 	public function stopTimer()
78 78
 	{
79
-		$client = $this->getPage()->getCallbackClient();
79
+		$client=$this->getPage()->getCallbackClient();
80 80
 		$client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.stop', [$this]);
81 81
 	}
82 82
 
@@ -102,9 +102,9 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	protected function getTriggerOptions()
104 104
 	{
105
-		$options['ID'] = $this->getClientID();
106
-		$options['EventTarget'] = $this->getUniqueID();
107
-		$options['Interval'] = $this->getInterval();
105
+		$options['ID']=$this->getClientID();
106
+		$options['EventTarget']=$this->getUniqueID();
107
+		$options['Interval']=$this->getInterval();
108 108
 		return $options;
109 109
 	}
110 110
 
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
 		parent::render($writer);
118 118
 		$this->getActiveControl()->registerCallbackClientScript(
119 119
 			$this->getClientClassName(), $this->getTriggerOptions());
120
-		if($this->getStartTimerOnLoad()){
121
-			$id = $this->getClientID();
122
-			$code = "Prado.WebUI.TTimeTriggeredCallback.start('{$id}');";
123
-			$cs = $this->getPage()->getClientScript();
120
+		if($this->getStartTimerOnLoad()) {
121
+			$id=$this->getClientID();
122
+			$code="Prado.WebUI.TTimeTriggeredCallback.start('{$id}');";
123
+			$cs=$this->getPage()->getClientScript();
124 124
 			$cs->registerEndScript("{$id}:start", $code);
125 125
 		}
126 126
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveLabel.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function setText($value)
61 61
 	{
62
-		if(parent::getText() === $value)
62
+		if(parent::getText()===$value)
63 63
 			return;
64 64
 
65 65
 		parent::setText($value);
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function setForControl($value)
77 77
 	{
78
-		if(parent::getForControl() === $value)
78
+		if(parent::getForControl()===$value)
79 79
 			return;
80 80
 
81 81
 		parent::setForControl($value);
82 82
 		if($this->getActiveControl()->canUpdateClientSide())
83 83
 		{
84
-			$id = $this->findControl($value)->getClientID();
84
+			$id=$this->findControl($value)->getClientID();
85 85
 			$this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id);
86 86
 		}
87 87
 	}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TBaseActiveControl.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public function __construct($control)
50 50
 	{
51
-		$this->_control = $control;
52
-		$this->_options = new TMap;
51
+		$this->_control=$control;
52
+		$this->_options=new TMap;
53 53
 	}
54 54
 
55 55
 	/**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 	 * @param mixed default value.
61 61
 	 * @return mixed options value.
62 62
 	 */
63
-	protected function setOption($name, $value, $default = null)
63
+	protected function setOption($name, $value, $default=null)
64 64
 	{
65
-		$value = ($value === null) ? $default : $value;
66
-		if($value !== null)
65
+		$value=($value===null) ? $default : $value;
66
+		if($value!==null)
67 67
 			$this->_options->add($name, $value);
68 68
 	}
69 69
 
@@ -74,10 +74,10 @@  discard block
 block discarded – undo
74 74
 	 * @param mixed default value.
75 75
 	 * @return mixed options value.
76 76
 	 */
77
-	protected function getOption($name, $default = null)
77
+	protected function getOption($name, $default=null)
78 78
 	{
79
-		$item = $this->_options->itemAt($name);
80
-		return ($item === null) ? $default : $item;
79
+		$item=$this->_options->itemAt($name);
80
+		return ($item===null) ? $default : $item;
81 81
 	}
82 82
 
83 83
 	/**
@@ -128,10 +128,10 @@  discard block
 block discarded – undo
128 128
 	 * @return boolean true if the callback response is allowed update
129 129
 	 * client-side contents.
130 130
 	 */
131
-	public function canUpdateClientSide($bDontRequireVisibility = false)
131
+	public function canUpdateClientSide($bDontRequireVisibility=false)
132 132
 	{
133 133
 		return 	$this->getControl()->getHasChildInitialized()
134
-				&& $this->getPage()->getIsLoadingPostData() == false
134
+				&& $this->getPage()->getIsLoadingPostData()==false
135 135
 				&& $this->getPage()->getIsCallback()
136 136
 				&& $this->getEnableUpdate()
137 137
 				&& ($bDontRequireVisibility || $this->getControl()->getVisible());
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TTriggeredCallback.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -49,10 +49,10 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function getTargetControl()
51 51
 	{
52
-		$id = $this->getControlID();
53
-		if(($control = $this->findControl($id)) instanceof TControl)
52
+		$id=$this->getControlID();
53
+		if(($control=$this->findControl($id)) instanceof TControl)
54 54
 			return $control->getClientID();
55
-		if($id === '')
55
+		if($id==='')
56 56
 		{
57 57
 			throw new TConfigurationException(
58 58
 				'ttriggeredcallback_invalid_controlid', get_class($this));
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function getTriggerOptions()
67 67
 	{
68
-		$options['ID'] = $this->getClientID();
69
-		$options['EventTarget'] = $this->getUniqueID();
70
-		$options['ControlID'] = $this->getTargetControl();
68
+		$options['ID']=$this->getClientID();
69
+		$options['EventTarget']=$this->getUniqueID();
70
+		$options['ControlID']=$this->getTargetControl();
71 71
 		return $options;
72 72
 	}
73 73
 }
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveTableCellEventParameter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,15 +34,15 @@
 block discarded – undo
34 34
 	/**
35 35
 	 * @var integer the zero-based index of the cell.
36 36
 	 */
37
-	private $_selectedCellIndex = -1;
37
+	private $_selectedCellIndex=-1;
38 38
 
39 39
 	/**
40 40
 	 * Creates a new TActiveTableRowEventParameter.
41 41
 	 */
42
-	public function __construct($response, $parameter, $index = -1)
42
+	public function __construct($response, $parameter, $index=-1)
43 43
 	{
44 44
 		parent::__construct($response, $parameter);
45
-		$this->_selectedCellIndex = $index;
45
+		$this->_selectedCellIndex=$index;
46 46
 	}
47 47
 
48 48
 	/**
Please login to merge, or discard this patch.