Passed
Branch php-cs-fixer (b9836a)
by Fabio
15:58
created
framework/Web/UI/ActiveControls/TActiveListBox.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -89,13 +89,13 @@
 block discarded – undo
89 89
 	 */
90 90
 	public function setSelectionMode($value)
91 91
 	{
92
-		if(parent::getSelectionMode() === $value)
92
+		if (parent::getSelectionMode() === $value)
93 93
 			return;
94 94
 
95 95
 		parent::setSelectionMode($value);
96 96
 		$multiple = $this->getIsMultiSelect();
97
-		$id = $this->getUniqueID(); $multi_id = $id . '[]';
98
-		if($this->getActiveControl()->canUpdateClientSide())
97
+		$id = $this->getUniqueID(); $multi_id = $id.'[]';
98
+		if ($this->getActiveControl()->canUpdateClientSide())
99 99
 		{
100 100
 			$client = $this->getPage()->getCallbackClient();
101 101
 			$client->setAttribute($this, 'multiple', $multiple ? 'multiple' : false);
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -89,8 +89,9 @@  discard block
 block discarded – undo
89 89
 	 */
90 90
 	public function setSelectionMode($value)
91 91
 	{
92
-		if(parent::getSelectionMode() === $value)
93
-			return;
92
+		if(parent::getSelectionMode() === $value) {
93
+					return;
94
+		}
94 95
 
95 96
 		parent::setSelectionMode($value);
96 97
 		$multiple = $this->getIsMultiSelect();
@@ -151,9 +152,10 @@  discard block
 block discarded – undo
151 152
 	{
152 153
 		parent::addAttributesToRender($writer);
153 154
 		$writer->addAttribute('id', $this->getClientID());
154
-		if ($this->getAutoPostBack())
155
-			$this->getActiveControl()->registerCallbackClientScript(
155
+		if ($this->getAutoPostBack()) {
156
+					$this->getActiveControl()->registerCallbackClientScript(
156 157
 				$this->getClientClassName(), $this->getPostBackOptions());
158
+		}
157 159
 	}
158 160
 }
159 161
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TCallbackClientSide.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -273,7 +273,7 @@
 block discarded – undo
273 273
 	 */
274 274
 	public function setPostBackTarget($value)
275 275
 	{
276
-		if($value instanceof TControl)
276
+		if ($value instanceof TControl)
277 277
 			$value = $value->getUniqueID();
278 278
 		$this->setOption('EventTarget', $value);
279 279
 	}
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -273,8 +273,9 @@
 block discarded – undo
273 273
 	 */
274 274
 	public function setPostBackTarget($value)
275 275
 	{
276
-		if($value instanceof TControl)
277
-			$value = $value->getUniqueID();
276
+		if($value instanceof TControl) {
277
+					$value = $value->getUniqueID();
278
+		}
278 279
 		$this->setOption('EventTarget', $value);
279 280
 	}
280 281
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveHtmlArea4.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,9 +64,9 @@
 block discarded – undo
64 64
    */
65 65
   public function setText($value) {
66 66
 	parent::setText($value);
67
-	if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData())
67
+	if ($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData())
68 68
 	{
69
-	  if($this->getEnableVisualEdit())
69
+	  if ($this->getEnableVisualEdit())
70 70
 	  {
71 71
 		$value = str_ireplace(["\r\n", "\n"], "", $value);
72 72
 		$command = "tinymce.get('{$this->getClientID()}').setContent('{$value}')";
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -71,9 +71,9 @@
 block discarded – undo
71 71
 		$value = str_ireplace(["\r\n", "\n"], "", $value);
72 72
 		$command = "tinymce.get('{$this->getClientID()}').setContent('{$value}')";
73 73
 		$this->getPage()->getCallbackClient()->evaluateScript($command);
74
+	  } else {
75
+	  		$this->getPage()->getCallbackClient()->setValue($this, $value);
74 76
 	  }
75
-	  else
76
-		$this->getPage()->getCallbackClient()->setValue($this, $value);
77 77
 	}
78 78
   }
79 79
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TTriggeredCallback.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@
 block discarded – undo
50 50
 	protected function getTargetControl()
51 51
 	{
52 52
 		$id = $this->getControlID();
53
-		if(($control = $this->findControl($id)) instanceof TControl)
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));
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -50,8 +50,9 @@
 block discarded – undo
50 50
 	protected function getTargetControl()
51 51
 	{
52 52
 		$id = $this->getControlID();
53
-		if(($control = $this->findControl($id)) instanceof TControl)
54
-			return $control->getClientID();
53
+		if(($control = $this->findControl($id)) instanceof TControl) {
54
+					return $control->getClientID();
55
+		}
55 56
 		if($id === '')
56 57
 		{
57 58
 			throw new TConfigurationException(
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveHyperLinkColumn.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@  discard block
 block discarded – undo
37 37
 	{
38 38
 		$text = $this->getHeaderText();
39 39
 
40
-		if(($classPath = $this->getHeaderRenderer()) !== '')
40
+		if (($classPath = $this->getHeaderRenderer()) !== '')
41 41
 		{
42 42
 			$control = Prado::createComponent($classPath);
43
-			if($control instanceof \Prado\IDataRenderer)
43
+			if ($control instanceof \Prado\IDataRenderer)
44 44
 			{
45
-				if($control instanceof IItemDataRenderer)
45
+				if ($control instanceof IItemDataRenderer)
46 46
 				{
47 47
 					$item = $cell->getParent();
48 48
 					$control->setItemIndex($item->getItemIndex());
@@ -52,21 +52,21 @@  discard block
 block discarded – undo
52 52
 			}
53 53
 			$cell->getControls()->add($control);
54 54
 		}
55
-		elseif($this->getAllowSorting())
55
+		elseif ($this->getAllowSorting())
56 56
 		{
57 57
 			$sortExpression = $this->getSortExpression();
58
-			if(($url = $this->getHeaderImageUrl()) !== '')
58
+			if (($url = $this->getHeaderImageUrl()) !== '')
59 59
 			{
60 60
 				$button = new TActiveImageButton;
61 61
 				$button->setImageUrl($url);
62 62
 				$button->setCommandName(TDataGrid::CMD_SORT);
63 63
 				$button->setCommandParameter($sortExpression);
64
-				if($text !== '')
64
+				if ($text !== '')
65 65
 					$button->setAlternateText($text);
66 66
 				$button->setCausesValidation(false);
67 67
 				$cell->getControls()->add($button);
68 68
 			}
69
-			elseif($text !== '')
69
+			elseif ($text !== '')
70 70
 			{
71 71
 				$button = new TActiveLinkButton;
72 72
 				$button->setText($text);
@@ -80,15 +80,15 @@  discard block
 block discarded – undo
80 80
 		}
81 81
 		else
82 82
 		{
83
-			if(($url = $this->getHeaderImageUrl()) !== '')
83
+			if (($url = $this->getHeaderImageUrl()) !== '')
84 84
 			{
85 85
 				$image = new TActiveImage;
86 86
 				$image->setImageUrl($url);
87
-				if($text !== '')
87
+				if ($text !== '')
88 88
 					$image->setAlternateText($text);
89 89
 				$cell->getControls()->add($image);
90 90
 			}
91
-			elseif($text !== '')
91
+			elseif ($text !== '')
92 92
 				$cell->setText($text);
93 93
 			else
94 94
 				$cell->setText(' ');
Please login to merge, or discard this patch.
Braces   +15 added lines, -16 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
 				$control->setData($text);
52 52
 			}
53 53
 			$cell->getControls()->add($control);
54
-		}
55
-		elseif($this->getAllowSorting())
54
+		} elseif($this->getAllowSorting())
56 55
 		{
57 56
 			$sortExpression = $this->getSortExpression();
58 57
 			if(($url = $this->getHeaderImageUrl()) !== '')
@@ -61,12 +60,12 @@  discard block
 block discarded – undo
61 60
 				$button->setImageUrl($url);
62 61
 				$button->setCommandName(TDataGrid::CMD_SORT);
63 62
 				$button->setCommandParameter($sortExpression);
64
-				if($text !== '')
65
-					$button->setAlternateText($text);
63
+				if($text !== '') {
64
+									$button->setAlternateText($text);
65
+				}
66 66
 				$button->setCausesValidation(false);
67 67
 				$cell->getControls()->add($button);
68
-			}
69
-			elseif($text !== '')
68
+			} elseif($text !== '')
70 69
 			{
71 70
 				$button = new TActiveLinkButton;
72 71
 				$button->setText($text);
@@ -74,24 +73,24 @@  discard block
 block discarded – undo
74 73
 				$button->setCommandParameter($sortExpression);
75 74
 				$button->setCausesValidation(false);
76 75
 				$cell->getControls()->add($button);
76
+			} else {
77
+							$cell->setText(' ');
77 78
 			}
78
-			else
79
-				$cell->setText(' ');
80
-		}
81
-		else
79
+		} else
82 80
 		{
83 81
 			if(($url = $this->getHeaderImageUrl()) !== '')
84 82
 			{
85 83
 				$image = new TActiveImage;
86 84
 				$image->setImageUrl($url);
87
-				if($text !== '')
88
-					$image->setAlternateText($text);
85
+				if($text !== '') {
86
+									$image->setAlternateText($text);
87
+				}
89 88
 				$cell->getControls()->add($image);
89
+			} elseif($text !== '') {
90
+							$cell->setText($text);
91
+			} else {
92
+							$cell->setText(' ');
90 93
 			}
91
-			elseif($text !== '')
92
-				$cell->setText($text);
93
-			else
94
-				$cell->setText(' ');
95 94
 		}
96 95
 	}
97 96
 }
98 97
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveClientScript.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 	 */
46 46
 	protected function renderCustomScriptFile($writer)
47 47
 	{
48
-		if(($scriptUrl = $this->getScriptUrl()) !== '')
48
+		if (($scriptUrl = $this->getScriptUrl()) !== '')
49 49
 		{
50
-			if($this->getPage()->getIsCallback())
50
+			if ($this->getPage()->getIsCallback())
51 51
 			{
52 52
 				$cs = $this->getPage()->getClientScript();
53
-				$uniqueid = $this->ClientID . '_custom';
54
-				if(!$cs->isScriptFileRegistered($uniqueid))
53
+				$uniqueid = $this->ClientID.'_custom';
54
+				if (!$cs->isScriptFileRegistered($uniqueid))
55 55
 					$cs->registerScriptFile($uniqueid, $scriptUrl);
56 56
 			} else {
57 57
 				$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	protected function renderCustomScript($writer)
67 67
 	{
68
-		if($this->getHasControls())
68
+		if ($this->getHasControls())
69 69
 		{
70
-			if($this->getPage()->getIsCallback())
70
+			if ($this->getPage()->getIsCallback())
71 71
 			{
72 72
 				$extWriter = $this->getPage()->getResponse()->createHtmlWriter();
73 73
 				$extWriter->write("/*<![CDATA[*/\n");
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@
 block discarded – undo
51 51
 			{
52 52
 				$cs = $this->getPage()->getClientScript();
53 53
 				$uniqueid = $this->ClientID . '_custom';
54
-				if(!$cs->isScriptFileRegistered($uniqueid))
55
-					$cs->registerScriptFile($uniqueid, $scriptUrl);
54
+				if(!$cs->isScriptFileRegistered($uniqueid)) {
55
+									$cs->registerScriptFile($uniqueid, $scriptUrl);
56
+				}
56 57
 			} else {
57 58
 				$writer->write("<script type=\"text/javascript\" src=\"$scriptUrl\"></script>\n");
58 59
 			}
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TBaseActiveCallbackControl.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	public function getClientSide()
51 51
 	{
52
-		if(($client = $this->getOption('ClientSide')) === null)
52
+		if (($client = $this->getOption('ClientSide')) === null)
53 53
 		{
54 54
 			$client = $this->createClientSide();
55 55
 			$this->setOption('ClientSide', $client);
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function setClientSide($client)
65 65
 	{
66
-		if($this->getOption('ClientSide') === null)
66
+		if ($this->getOption('ClientSide') === null)
67 67
 			$this->setOption('ClientSide', $client);
68 68
 		else
69 69
 			throw new TConfigurationException(
@@ -108,9 +108,9 @@  discard block
 block discarded – undo
108 108
 	 */
109 109
 	protected function getDefaultClientSideOptions()
110 110
 	{
111
-		if(($id = $this->getCallbackOptions()) !== '')
111
+		if (($id = $this->getCallbackOptions()) !== '')
112 112
 		{
113
-			if(($pos = strrpos($id, '.')) !== false)
113
+			if (($pos = strrpos($id, '.')) !== false)
114 114
 			{
115 115
 				$control = $this->getControl()->getSubProperty(substr($id, 0, $pos));
116 116
 				$newid = substr($id, $pos + 1);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 				$control = $this->getControl()->findControl($id, true);
125 125
 			}
126 126
 
127
-			if($control instanceof TCallbackOptions)
127
+			if ($control instanceof TCallbackOptions)
128 128
 				return $control->getClientSide()->getOptions()->toArray();
129 129
 			else
130 130
 				throw new TConfigurationException('callback_invalid_callback_options', $this->getControl()->getID(), $id);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function canCauseValidation()
177 177
 	{
178
-		if($this->getCausesValidation())
178
+		if ($this->getCausesValidation())
179 179
 		{
180 180
 			$group = $this->getValidationGroup();
181 181
 			return $this->getPage()->getValidators($group)->getCount() > 0;
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 		$options['ValidationGroup'] = $this->getValidationGroup();
214 214
 		$options['CallbackParameter'] = $this->getCallbackParameter();
215 215
 		// needed for TCallback
216
-		if(!isset($options['EventTarget']))
216
+		if (!isset($options['EventTarget']))
217 217
 			$options['EventTarget'] = $this->getControl()->getUniqueID();
218 218
 		return $options;
219 219
 	}
@@ -230,13 +230,13 @@  discard block
 block discarded – undo
230 230
 	public function registerCallbackClientScript($class, $options = null)
231 231
 	{
232 232
 		$cs = $this->getPage()->getClientScript();
233
-		if(is_array($options))
233
+		if (is_array($options))
234 234
 			$options = array_merge($this->getClientSideOptions(), $options);
235 235
 		else
236 236
 			$options = $this->getClientSideOptions();
237 237
 
238 238
 		//remove true as default to save bytes
239
-		if($options['CausesValidation'] === true)
239
+		if ($options['CausesValidation'] === true)
240 240
 			$options['CausesValidation'] = '';
241 241
 		$cs->registerCallbackControl($class, $options);
242 242
 	}
Please login to merge, or discard this patch.
Braces   +27 added lines, -22 removed lines patch added patch discarded remove patch
@@ -63,11 +63,12 @@  discard block
 block discarded – undo
63 63
 	 */
64 64
 	public function setClientSide($client)
65 65
 	{
66
-		if($this->getOption('ClientSide') === null)
67
-			$this->setOption('ClientSide', $client);
68
-		else
69
-			throw new TConfigurationException(
66
+		if($this->getOption('ClientSide') === null) {
67
+					$this->setOption('ClientSide', $client);
68
+		} else {
69
+					throw new TConfigurationException(
70 70
 				'active_controls_client_side_exists', $this->getControl()->getID());
71
+		}
71 72
 	}
72 73
 
73 74
 	/**
@@ -114,20 +115,21 @@  discard block
 block discarded – undo
114 115
 			{
115 116
 				$control = $this->getControl()->getSubProperty(substr($id, 0, $pos));
116 117
 				$newid = substr($id, $pos + 1);
117
-				if ($control !== null)
118
-					$control = $control->$newid;
119
-			}
120
-			else
118
+				if ($control !== null) {
119
+									$control = $control->$newid;
120
+				}
121
+			} else
121 122
 			{
122 123
 				// TCheckBoxList overrides findControl() with a fake implementation
123 124
 				// but accepts a second parameter to use the standard one
124 125
 				$control = $this->getControl()->findControl($id, true);
125 126
 			}
126 127
 
127
-			if($control instanceof TCallbackOptions)
128
-				return $control->getClientSide()->getOptions()->toArray();
129
-			else
130
-				throw new TConfigurationException('callback_invalid_callback_options', $this->getControl()->getID(), $id);
128
+			if($control instanceof TCallbackOptions) {
129
+							return $control->getClientSide()->getOptions()->toArray();
130
+			} else {
131
+							throw new TConfigurationException('callback_invalid_callback_options', $this->getControl()->getID(), $id);
132
+			}
131 133
 		}
132 134
 
133 135
 		return [];
@@ -179,9 +181,9 @@  discard block
 block discarded – undo
179 181
 		{
180 182
 			$group = $this->getValidationGroup();
181 183
 			return $this->getPage()->getValidators($group)->getCount() > 0;
184
+		} else {
185
+					return false;
182 186
 		}
183
-		else
184
-			return false;
185 187
 	}
186 188
 
187 189
 	/**
@@ -213,8 +215,9 @@  discard block
 block discarded – undo
213 215
 		$options['ValidationGroup'] = $this->getValidationGroup();
214 216
 		$options['CallbackParameter'] = $this->getCallbackParameter();
215 217
 		// needed for TCallback
216
-		if(!isset($options['EventTarget']))
217
-			$options['EventTarget'] = $this->getControl()->getUniqueID();
218
+		if(!isset($options['EventTarget'])) {
219
+					$options['EventTarget'] = $this->getControl()->getUniqueID();
220
+		}
218 221
 		return $options;
219 222
 	}
220 223
 
@@ -230,14 +233,16 @@  discard block
 block discarded – undo
230 233
 	public function registerCallbackClientScript($class, $options = null)
231 234
 	{
232 235
 		$cs = $this->getPage()->getClientScript();
233
-		if(is_array($options))
234
-			$options = array_merge($this->getClientSideOptions(), $options);
235
-		else
236
-			$options = $this->getClientSideOptions();
236
+		if(is_array($options)) {
237
+					$options = array_merge($this->getClientSideOptions(), $options);
238
+		} else {
239
+					$options = $this->getClientSideOptions();
240
+		}
237 241
 
238 242
 		//remove true as default to save bytes
239
-		if($options['CausesValidation'] === true)
240
-			$options['CausesValidation'] = '';
243
+		if($options['CausesValidation'] === true) {
244
+					$options['CausesValidation'] = '';
245
+		}
241 246
 		$cs->registerCallbackControl($class, $options);
242 247
 	}
243 248
 
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveBoundColumn.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 	protected function initializeHeaderCell($cell, $columnIndex) {
38 38
 		$text = $this->getHeaderText();
39 39
 
40
-		if(($classPath = $this->getHeaderRenderer()) !== '') {
40
+		if (($classPath = $this->getHeaderRenderer()) !== '') {
41 41
 			$control = Prado::createComponent($classPath);
42
-			if($control instanceof \Prado\IDataRenderer) {
43
-				if($control instanceof IItemDataRenderer) {
42
+			if ($control instanceof \Prado\IDataRenderer) {
43
+				if ($control instanceof IItemDataRenderer) {
44 44
 					$item = $cell->getParent();
45 45
 					$control->setItemIndex($item->getItemIndex());
46 46
 					$control->setItemType($item->getItemType());
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
 			}
50 50
 			$cell->getControls()->add($control);
51 51
 		}
52
-		elseif($this->getAllowSorting()) {
52
+		elseif ($this->getAllowSorting()) {
53 53
 				$sortExpression = $this->getSortExpression();
54
-				if(($url = $this->getHeaderImageUrl()) !== '') {
54
+				if (($url = $this->getHeaderImageUrl()) !== '') {
55 55
 					$button = new TActiveImageButton;
56 56
 					$button->setImageUrl($url);
57 57
 					$button->setCommandName(TDataGrid::CMD_SORT);
58 58
 					$button->setCommandParameter($sortExpression);
59
-					if($text !== '') {
59
+					if ($text !== '') {
60 60
 						$button->setAlternateText($text);
61 61
 						$button->setToolTip($text);
62 62
 					}
63 63
 					$button->setCausesValidation(false);
64 64
 					$cell->getControls()->add($button);
65 65
 				}
66
-				elseif($text !== '') {
66
+				elseif ($text !== '') {
67 67
 						$button = new TActiveLinkButton;
68 68
 						$button->setText($text);
69 69
 						$button->setCommandName(TDataGrid::CMD_SORT);
@@ -75,16 +75,16 @@  discard block
 block discarded – undo
75 75
 						$cell->setText('&nbsp;');
76 76
 			}
77 77
 			else {
78
-				if(($url = $this->getHeaderImageUrl()) !== '') {
78
+				if (($url = $this->getHeaderImageUrl()) !== '') {
79 79
 					$image = new TActiveImage;
80 80
 					$image->setImageUrl($url);
81
-					if($text !== '') {
81
+					if ($text !== '') {
82 82
 						$image->setAlternateText($text);
83 83
 						$image->setToolTip($text);
84 84
 					}
85 85
 					$cell->getControls()->add($image);
86 86
 				}
87
-				elseif($text !== '')
87
+				elseif ($text !== '')
88 88
 						$cell->setText($text);
89 89
 					else
90 90
 						$cell->setText('&nbsp;');
Please login to merge, or discard this patch.
Braces   +10 added lines, -13 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@  discard block
 block discarded – undo
48 48
 				$control->setData($text);
49 49
 			}
50 50
 			$cell->getControls()->add($control);
51
-		}
52
-		elseif($this->getAllowSorting()) {
51
+		} elseif($this->getAllowSorting()) {
53 52
 				$sortExpression = $this->getSortExpression();
54 53
 				if(($url = $this->getHeaderImageUrl()) !== '') {
55 54
 					$button = new TActiveImageButton;
@@ -62,19 +61,17 @@  discard block
 block discarded – undo
62 61
 					}
63 62
 					$button->setCausesValidation(false);
64 63
 					$cell->getControls()->add($button);
65
-				}
66
-				elseif($text !== '') {
64
+				} elseif($text !== '') {
67 65
 						$button = new TActiveLinkButton;
68 66
 						$button->setText($text);
69 67
 						$button->setCommandName(TDataGrid::CMD_SORT);
70 68
 						$button->setCommandParameter($sortExpression);
71 69
 						$button->setCausesValidation(false);
72 70
 						$cell->getControls()->add($button);
71
+					} else {
72
+											$cell->setText('&nbsp;');
73 73
 					}
74
-					else
75
-						$cell->setText('&nbsp;');
76
-			}
77
-			else {
74
+			} else {
78 75
 				if(($url = $this->getHeaderImageUrl()) !== '') {
79 76
 					$image = new TActiveImage;
80 77
 					$image->setImageUrl($url);
@@ -83,11 +80,11 @@  discard block
 block discarded – undo
83 80
 						$image->setToolTip($text);
84 81
 					}
85 82
 					$cell->getControls()->add($image);
86
-				}
87
-				elseif($text !== '')
88
-						$cell->setText($text);
89
-					else
90
-						$cell->setText('&nbsp;');
83
+				} elseif($text !== '') {
84
+										$cell->setText($text);
85
+				} else {
86
+											$cell->setText('&nbsp;');
87
+					}
91 88
 			}
92 89
 	}
93 90
 }
94 91
\ No newline at end of file
Please login to merge, or discard this patch.
framework/Web/UI/ActiveControls/TActiveFileUpload.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	 * TActiveControlAdapter. If you override this class, be sure to set the
90 90
 	 * adapter appropriately by, for example, by calling this constructor.
91 91
 	 */
92
-	public function __construct(){
92
+	public function __construct() {
93 93
 		parent::__construct();
94 94
 		$this->setAdapter(new TActiveControlAdapter($this));
95 95
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	protected function getAssetUrl($file = '')
103 103
 	{
104 104
 		$base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
105
-		return $base . '/' . self::SCRIPT_PATH . '/' . $file;
105
+		return $base.'/'.self::SCRIPT_PATH.'/'.$file;
106 106
 	}
107 107
 
108 108
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 	 */
115 115
 	public function onFileUpload($param)
116 116
 	{
117
-		if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()){
117
+		if ($this->_flag->getValue() && $this->getPage()->getIsPostBack() && $param == $this->_target->getUniqueID()) {
118 118
 		  $params = new TActiveFileUploadCallbackParams;
119 119
 		  // save the files so that they will persist past the end of this return.
120 120
 		  foreach ($this->getFiles() as $file) {
@@ -129,12 +129,12 @@  discard block
 block discarded – undo
129 129
           	 Options = new Object();
130 130
           	 Options.clientID = '{$this->getClientID()}';
131 131
           	 Options.targetID = '{$this->_target->getUniqueID()}';
132
-          	 Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
132
+          	 Options.errorCode = '".(int) !$this->getHasAllFiles()."';
133 133
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
134
-          	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
135
-             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
136
-             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS) . "';
137
-             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS) . "';
134
+          	 Options.fileName = '".TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS)."';
135
+             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS)."';
136
+             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS)."';
137
+             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS)."';
138 138
           	 parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options);
139 139
            </script>";
140 140
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 	 * @return string the path where the uploaded file will be stored temporarily, in namespace format
147 147
 	 * default "Application.runtime.*"
148 148
 	 */
149
-	public function getTempPath(){
149
+	public function getTempPath() {
150 150
 		return $this->getViewState('TempPath', 'Application.runtime.*');
151 151
 	}
152 152
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param string the path where the uploaded file will be stored temporarily in namespace format
155 155
 	 * default "Application.runtime.*"
156 156
 	 */
157
-	public function setTempPath($value){
157
+	public function setTempPath($value) {
158 158
 		$this->setViewState('TempPath', $value, 'Application.runtime.*');
159 159
 	}
160 160
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	 * @return boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
163 163
 	 * Note: When set to false, you will need to trigger the callback yourself.
164 164
 	 */
165
-	public function getAutoPostBack(){
165
+	public function getAutoPostBack() {
166 166
 		return $this->getViewState('AutoPostBack', true);
167 167
 	}
168 168
 
@@ -170,28 +170,28 @@  discard block
 block discarded – undo
170 170
 	 * @param boolean a value indicating whether an automatic callback to the server will occur whenever the user modifies the text in the TTextBox control and then tabs out of the component. Defaults to true.
171 171
 	 * Note: When set to false, you will need to trigger the callback yourself.
172 172
 	 */
173
-	public function setAutoPostBack($value){
173
+	public function setAutoPostBack($value) {
174 174
 		$this->setViewState('AutoPostBack', TPropertyValue::ensureBoolean($value), true);
175 175
 	}
176 176
 
177 177
 	/**
178 178
 	 * @return string A chuck of javascript that will need to be called if {{@link getAutoPostBack AutoPostBack} is set to false}
179 179
 	 */
180
-	public function getCallbackJavascript(){
180
+	public function getCallbackJavascript() {
181 181
 		return "Prado.WebUI.TActiveFileUpload.fileChanged(\"{$this->getClientID()}\")";
182 182
 	}
183 183
 
184 184
 	/**
185 185
 	 * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable.
186 186
 	 */
187
-	public function onInit($sender){
187
+	public function onInit($sender) {
188 188
 		parent::onInit($sender);
189 189
 
190 190
 		if (!Prado::getApplication()->getCache())
191 191
 		  if (!Prado::getApplication()->getSecurityManager())
192 192
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
193 193
 
194
-		if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){
194
+		if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))) {
195 195
 			throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath());
196 196
 		}
197 197
 	}
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 	 * This method is mainly used by framework and control developers.
204 204
 	 * @param TCallbackEventParameter the event parameter
205 205
 	 */
206
-	public function raiseCallbackEvent($param){
206
+	public function raiseCallbackEvent($param) {
207 207
 		$cp = $param->getCallbackParameter();
208
-		if ($key = $cp->targetID == $this->_target->getUniqueID()){
208
+		if ($key = $cp->targetID == $this->_target->getUniqueID()) {
209 209
 
210 210
 			$params = $this->popParamsByToken($cp->callbackToken);
211
-	  foreach($params->files as $index => $file)
211
+	  foreach ($params->files as $index => $file)
212 212
 	  {
213 213
 			$_FILES[$key]['name'][$index] = stripslashes($file['fileName']);
214 214
 			$_FILES[$key]['size'][$index] = intval($file['fileSize']);
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		if ($cache = Prado::getApplication()->getCache())
238 238
 			{
239 239
 				// this is the most secure method, file info can't be forged from client side, no matter what
240
-				$token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000));
240
+				$token = md5('TActiveFileUpload::Params::'.$this->ClientID.'::'.rand(1000 * 1000, 9999 * 1000));
241 241
 				$cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually
242 242
 			}
243 243
 		elseif ($mgr = Prado::getApplication()->getSecurityManager())
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 	{
281 281
 		parent::onPreRender($param);
282 282
 
283
-		if(!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID())
283
+		if (!$this->getPage()->getIsPostBack() && isset($_GET['TActiveFileUpload_InputId']) && isset($_GET['TActiveFileUpload_TargetId']) && $_GET['TActiveFileUpload_InputId'] == $this->getClientID())
284 284
 		{
285 285
 		  $params = new TActiveFileUploadCallbackParams;
286 286
 		  foreach ($this->getFiles() as $file) {
@@ -295,12 +295,12 @@  discard block
 block discarded – undo
295 295
           	 Options = new Object();
296 296
           	 Options.clientID = '{$_GET['TActiveFileUpload_InputId']}';
297 297
           	 Options.targetID = '{$_GET['TActiveFileUpload_TargetId']}';
298
-			       Options.errorCode = '" . (int)!$this->getHasAllFiles() . "';
298
+			       Options.errorCode = '".(int) !$this->getHasAllFiles()."';
299 299
           	 Options.callbackToken = '{$this->pushParamsAndGetToken($params)}';
300
-          	 Options.fileName = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS) . "';
301
-             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS) . "';
302
-             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS) . "';
303
-             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS) . "';
300
+          	 Options.fileName = '".TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileName') : $this->getFileName(), JSON_HEX_APOS)."';
301
+             Options.fileSize = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileSize') : $this->getFileSize(), JSON_HEX_APOS)."';
302
+             Options.fileType = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'fileType') : $this->getFileType(), JSON_HEX_APOS)."';
303
+             Options.errorCode = '" . TJavaScript::jsonEncode($this->getMultiple() ? array_column($params->files, 'errorCode') : $this->getErrorCode(), JSON_HEX_APOS)."';
304 304
            	 parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options);
305 305
            </script>";
306 306
 		}
@@ -343,11 +343,11 @@  discard block
 block discarded – undo
343 343
 	/**
344 344
 	 * Removes localfile on ending of the callback.
345 345
 	 */
346
-	public function onUnload($param){
346
+	public function onUnload($param) {
347 347
 		if ($this->getPage()->getIsCallback())
348 348
 		{
349
-		  foreach($this->getFiles() as $file)
350
-			if($file->getHasFile() && file_exists($file->getLocalName())){
349
+		  foreach ($this->getFiles() as $file)
350
+			if ($file->getHasFile() && file_exists($file->getLocalName())) {
351 351
 			  unlink($file->getLocalName());
352 352
 		  }
353 353
 		}
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 	/**
358 358
 	 * @return TBaseActiveCallbackControl standard callback control options.
359 359
 	 */
360
-	public function getActiveControl(){
360
+	public function getActiveControl() {
361 361
 		return $this->getAdapter()->getBaseActiveControl();
362 362
 	}
363 363
 
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 	 * Adds ID attribute, and renders the javascript for active component.
374 374
 	 * @param THtmlWriter the writer used for the rendering purpose
375 375
 	 */
376
-	public function addAttributesToRender($writer){
376
+	public function addAttributesToRender($writer) {
377 377
 		parent::addAttributesToRender($writer);
378 378
 		$writer->addAttribute('id', $this->getClientID());
379 379
 
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 	/**
384 384
 	 * @return string corresponding javascript class name for this control.
385 385
 	 */
386
-	protected function getClientClassName(){
386
+	protected function getClientClassName() {
387 387
 		return 'Prado.WebUI.TActiveFileUpload';
388 388
 	}
389 389
 
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 	 * 					completeID => complete client ID,
398 398
 	 * 					errorID => error client ID)
399 399
 	 */
400
-	protected function getClientOptions(){
400
+	protected function getClientOptions() {
401 401
 		$options['ID'] = $this->getClientID();
402 402
 		$options['EventTarget'] = $this->getUniqueID();
403 403
 
@@ -419,8 +419,8 @@  discard block
 block discarded – undo
419 419
 	 * If true, you will not be able to save the uploaded file again.
420 420
 	 * @return boolean true if the file saving is successful
421 421
 	 */
422
-	public function saveAs($fileName, $deleteTempFile = true, $index = 0){
423
-		if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){
422
+	public function saveAs($fileName, $deleteTempFile = true, $index = 0) {
423
+		if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))) {
424 424
 			if ($deleteTempFile)
425 425
 				return rename($this->getLocalName($index), $fileName);
426 426
 			else
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 	 * @return TImage the image displayed when an upload
434 434
 	 * 		completes successfully.
435 435
 	 */
436
-	public function getSuccessImage(){
436
+	public function getSuccessImage() {
437 437
 		$this->ensureChildControls();
438 438
 		return $this->_success;
439 439
 	}
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
 	 * @return TImage the image displayed when an upload
443 443
 	 * 		does not complete successfully.
444 444
 	 */
445
-	public function getErrorImage(){
445
+	public function getErrorImage() {
446 446
 		$this->ensureChildControls();
447 447
 		return $this->_error;
448 448
 	}
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
 	 * @return TImage the image displayed when an upload
452 452
 	 * 		is in progress.
453 453
 	 */
454
-	public function getBusyImage(){
454
+	public function getBusyImage() {
455 455
 		$this->ensureChildControls();
456 456
 		return $this->_busy;
457 457
 	}
Please login to merge, or discard this patch.
Braces   +22 added lines, -20 removed lines patch added patch discarded remove patch
@@ -187,9 +187,10 @@  discard block
 block discarded – undo
187 187
 	public function onInit($sender){
188 188
 		parent::onInit($sender);
189 189
 
190
-		if (!Prado::getApplication()->getCache())
191
-		  if (!Prado::getApplication()->getSecurityManager())
190
+		if (!Prado::getApplication()->getCache()) {
191
+				  if (!Prado::getApplication()->getSecurityManager())
192 192
 			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
193
+		}
193 194
 
194 195
 		if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){
195 196
 			throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath());
@@ -239,14 +240,13 @@  discard block
 block discarded – undo
239 240
 				// this is the most secure method, file info can't be forged from client side, no matter what
240 241
 				$token = md5('TActiveFileUpload::Params::' . $this->ClientID . '::' . rand(1000 * 1000, 9999 * 1000));
241 242
 				$cache->set($token, serialize($params), 5 * 60); // expire in 5 minutes - the callback should arrive back in seconds, actually
242
-			}
243
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
243
+			} elseif ($mgr = Prado::getApplication()->getSecurityManager())
244 244
 			{
245 245
 				// this is a less secure method, file info can be still forged from client side, but only if attacker knows the secret application key
246 246
 				$token = urlencode(base64_encode($mgr->encrypt(serialize($params))));
247
-			}
248
-		else
249
-			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
247
+			} else {
248
+					throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
249
+		}
250 250
 
251 251
 		return $token;
252 252
 	}
@@ -259,14 +259,13 @@  discard block
 block discarded – undo
259 259
 				assert($v != '');
260 260
 				$cache->delete($token); // remove it from cache so it can't be used again and won't take up space either
261 261
 				$params = unserialize($v);
262
-			}
263
-		elseif ($mgr = Prado::getApplication()->getSecurityManager())
262
+			} elseif ($mgr = Prado::getApplication()->getSecurityManager())
264 263
 			{
265 264
 				$v = $mgr->decrypt(base64_decode(urldecode($token)));
266 265
 				$params = unserialize($v);
267
-			}
268
-		else
269
-			throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
266
+			} else {
267
+					throw new Exception('TActiveFileUpload needs either an application level cache or a security manager to work securely');
268
+		}
270 269
 
271 270
 		assert($params instanceof TActiveFileUploadCallbackParams);
272 271
 
@@ -346,10 +345,11 @@  discard block
 block discarded – undo
346 345
 	public function onUnload($param){
347 346
 		if ($this->getPage()->getIsCallback())
348 347
 		{
349
-		  foreach($this->getFiles() as $file)
350
-			if($file->getHasFile() && file_exists($file->getLocalName())){
348
+		  foreach($this->getFiles() as $file) {
349
+		  			if($file->getHasFile() && file_exists($file->getLocalName())){
351 350
 			  unlink($file->getLocalName());
352 351
 		  }
352
+		  }
353 353
 		}
354 354
 		parent::onUnload($param);
355 355
 	}
@@ -421,12 +421,14 @@  discard block
 block discarded – undo
421 421
 	 */
422 422
 	public function saveAs($fileName, $deleteTempFile = true, $index = 0){
423 423
 		if (($this->getErrorCode($index) === UPLOAD_ERR_OK) && (file_exists($this->getLocalName($index)))){
424
-			if ($deleteTempFile)
425
-				return rename($this->getLocalName($index), $fileName);
426
-			else
427
-				return copy($this->getLocalName($index), $fileName);
428
-		} else
429
-			return false;
424
+			if ($deleteTempFile) {
425
+							return rename($this->getLocalName($index), $fileName);
426
+			} else {
427
+							return copy($this->getLocalName($index), $fileName);
428
+			}
429
+		} else {
430
+					return false;
431
+		}
430 432
 	}
431 433
 
432 434
 	/**
Please login to merge, or discard this patch.