@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function setDecayRate($value) |
| 81 | 81 | { |
| 82 | - $decay = TPropertyValue::ensureFloat($value); |
|
| 82 | + $decay=TPropertyValue::ensureFloat($value); |
|
| 83 | 83 | if($decay < 0) |
| 84 | 84 | throw new TConfigurationException('callback_decay_be_not_negative', $this->getID()); |
| 85 | 85 | $this->setViewState('Decay', $decay); |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function getTriggerOptions() |
| 92 | 92 | { |
| 93 | - $options = parent::getTriggerOptions(); |
|
| 94 | - $options['PropertyName'] = $this->getPropertyName(); |
|
| 95 | - $options['Interval'] = $this->getInterval(); |
|
| 96 | - $options['Decay'] = $this->getDecayRate(); |
|
| 93 | + $options=parent::getTriggerOptions(); |
|
| 94 | + $options['PropertyName']=$this->getPropertyName(); |
|
| 95 | + $options['Interval']=$this->getInterval(); |
|
| 96 | + $options['Decay']=$this->getDecayRate(); |
|
| 97 | 97 | return $options; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -119,8 +119,7 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $this->raiseCallbackEvent($param); |
| 121 | 121 | return true; |
| 122 | - } |
|
| 123 | - else return false; |
|
| 122 | + } else return false; |
|
| 124 | 123 | } |
| 125 | 124 | |
| 126 | 125 | /** |
@@ -163,8 +162,7 @@ discard block |
||
| 163 | 162 | parent::render($writer); |
| 164 | 163 | if ($this->getActiveControl()->canUpdateClientSide()) |
| 165 | 164 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
| 166 | - } |
|
| 167 | - else |
|
| 165 | + } else |
|
| 168 | 166 | { |
| 169 | 167 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
| 170 | 168 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
@@ -100,6 +100,7 @@ discard block |
||
| 100 | 100 | * TActiveTableRow. |
| 101 | 101 | * This method is mainly used by framework and control developers. |
| 102 | 102 | * @param TCallbackEventParameter the event parameter |
| 103 | + * @param TActiveTableCellEventParameter $param |
|
| 103 | 104 | */ |
| 104 | 105 | public function raiseCallbackEvent($param) |
| 105 | 106 | { |
@@ -131,6 +132,7 @@ discard block |
||
| 131 | 132 | * method, be sure to call the parent implementation so that the event |
| 132 | 133 | * handler can be invoked. |
| 133 | 134 | * @param TActiveTableRowEventParameter event parameter to be passed to the event handlers |
| 135 | + * @param TActiveTableRowEventParameter $param |
|
| 134 | 136 | */ |
| 135 | 137 | public function onRowSelected($param) |
| 136 | 138 | { |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function raiseCallbackEvent($param) |
| 105 | 105 | { |
| 106 | - $parameter = new TActiveTableRowEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getRowIndex()); |
|
| 106 | + $parameter=new TActiveTableRowEventParameter($this->getResponse(), $param->getCallbackParameter(), $this->getRowIndex()); |
|
| 107 | 107 | $this->onRowSelected($parameter); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function bubbleEvent($sender, $param) |
| 119 | 119 | { |
| 120 | - if ($param instanceof TActiveTableCellEventParameter) |
|
| 120 | + if($param instanceof TActiveTableCellEventParameter) |
|
| 121 | 121 | { |
| 122 | 122 | $this->raiseCallbackEvent($param); |
| 123 | 123 | return true; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | parent::addAttributesToRender($writer); |
| 149 | 149 | $writer->addAttribute('id', $this->getClientID()); |
| 150 | - if ($this->hasEventHandler('OnRowSelected')) |
|
| 150 | + if($this->hasEventHandler('OnRowSelected')) |
|
| 151 | 151 | $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); |
| 152 | 152 | } |
| 153 | 153 | |
@@ -160,10 +160,10 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function render($writer) |
| 162 | 162 | { |
| 163 | - if ($this->getHasPreRendered()) |
|
| 163 | + if($this->getHasPreRendered()) |
|
| 164 | 164 | { |
| 165 | 165 | parent::render($writer); |
| 166 | - if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 166 | + if($this->getActiveControl()->canUpdateClientSide()) |
|
| 167 | 167 | $this->getPage()->getCallbackClient()->replaceContent($this, $writer); |
| 168 | 168 | } |
| 169 | 169 | else |
@@ -171,9 +171,9 @@ discard block |
||
| 171 | 171 | $this->getPage()->getAdapter()->registerControlToRender($this, $writer); |
| 172 | 172 | // If we update a TActiveTableRow on callback, we shouldn't update all childs, |
| 173 | 173 | // because the whole content will be replaced by the parent. |
| 174 | - if ($this->getHasControls()) |
|
| 174 | + if($this->getHasControls()) |
|
| 175 | 175 | { |
| 176 | - foreach ($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
| 176 | + foreach($this->findControlsByType('Prado\Web\UI\ActiveControls\IActiveControl', false) as $control) |
|
| 177 | 177 | $control->getActiveControl()->setEnableUpdate(false); |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | protected function getPostBackOptions() |
| 188 | 188 | { |
| 189 | - $options['ID'] = $this->getClientID(); |
|
| 190 | - $options['EventTarget'] = $this->getUniqueID(); |
|
| 189 | + $options['ID']=$this->getClientID(); |
|
| 190 | + $options['EventTarget']=$this->getUniqueID(); |
|
| 191 | 191 | return $options; |
| 192 | 192 | } |
| 193 | 193 | |
@@ -199,8 +199,8 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function getRowIndex() |
| 201 | 201 | { |
| 202 | - foreach ($this->getTable()->getRows() as $key => $row) |
|
| 203 | - if ($row == $this) return $key; |
|
| 202 | + foreach($this->getTable()->getRows() as $key => $row) |
|
| 203 | + if($row==$this) return $key; |
|
| 204 | 204 | throw new TConfigurationException('tactivetablerow_control_notincollection', get_class($this), $this->getUniqueID()); |
| 205 | 205 | } |
| 206 | 206 | |
@@ -211,14 +211,14 @@ discard block |
||
| 211 | 211 | */ |
| 212 | 212 | public function getTable() |
| 213 | 213 | { |
| 214 | - if ($this->_table === null) |
|
| 214 | + if($this->_table===null) |
|
| 215 | 215 | { |
| 216 | - $table = $this->getParent(); |
|
| 217 | - while (!($table instanceof TTable) && $table !== null) |
|
| 216 | + $table=$this->getParent(); |
|
| 217 | + while(!($table instanceof TTable) && $table!==null) |
|
| 218 | 218 | { |
| 219 | - $table = $table->getParent(); |
|
| 219 | + $table=$table->getParent(); |
|
| 220 | 220 | } |
| 221 | - if ($table instanceof TTable) $this->_table = $table; |
|
| 221 | + if($table instanceof TTable) $this->_table=$table; |
|
| 222 | 222 | else throw new TConfigurationException('tactivetablerow_control_outoftable', get_class($this), $this->getUniqueID()); |
| 223 | 223 | } |
| 224 | 224 | return $this->_table; |
@@ -47,8 +47,8 @@ |
||
| 47 | 47 | */ |
| 48 | 48 | public function __construct($response, $parameter) |
| 49 | 49 | { |
| 50 | - $this->_response = $response; |
|
| 51 | - $this->_parameter = $parameter; |
|
| 50 | + $this->_response=$response; |
|
| 51 | + $this->_parameter=$parameter; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |
@@ -64,10 +64,10 @@ |
||
| 64 | 64 | */ |
| 65 | 65 | protected function getTriggerOptions() |
| 66 | 66 | { |
| 67 | - $options = parent::getTriggerOptions(); |
|
| 68 | - $name = preg_replace('/^on/', '', $this->getEventName()); |
|
| 69 | - $options['EventName'] = strtolower($name); |
|
| 70 | - $options['StopEvent'] = $this->getPreventDefaultAction(); |
|
| 67 | + $options=parent::getTriggerOptions(); |
|
| 68 | + $name=preg_replace('/^on/', '', $this->getEventName()); |
|
| 69 | + $options['EventName']=strtolower($name); |
|
| 70 | + $options['StopEvent']=$this->getPreventDefaultAction(); |
|
| 71 | 71 | return $options; |
| 72 | 72 | } |
| 73 | 73 | |
@@ -518,16 +518,14 @@ |
||
| 518 | 518 | { |
| 519 | 519 | $this->setIsValid(true); |
| 520 | 520 | $this->onValidationSuccess(); |
| 521 | - } |
|
| 522 | - else |
|
| 521 | + } else |
|
| 523 | 522 | { |
| 524 | 523 | if($target) |
| 525 | 524 | $target->setIsValid(false); |
| 526 | 525 | $this->setIsValid(false); |
| 527 | 526 | $this->onValidationError(); |
| 528 | 527 | } |
| 529 | - } |
|
| 530 | - else |
|
| 528 | + } else |
|
| 531 | 529 | { |
| 532 | 530 | $this->evaluateIsValid(); |
| 533 | 531 | $this->setIsValid(true); |
@@ -185,6 +185,7 @@ discard block |
||
| 185 | 185 | * TBaseValidator::$_clientClass, be sure to update the corresponding |
| 186 | 186 | * "Javascript/validation3.js" file as well. |
| 187 | 187 | * @param TControl control to validate. |
| 188 | + * @param \Prado\Web\UI\TControl $control |
|
| 188 | 189 | * @return string control type for client-side validation. |
| 189 | 190 | */ |
| 190 | 191 | private function getClientControlClass($control) |
@@ -263,7 +264,7 @@ discard block |
||
| 263 | 264 | /** |
| 264 | 265 | * Update the ControlToValidate component's css class depending |
| 265 | 266 | * if the ControlCssClass property is set, and whether this is valid. |
| 266 | - * @return boolean true if change, false otherwise. |
|
| 267 | + * @return boolean|null true if change, false otherwise. |
|
| 267 | 268 | */ |
| 268 | 269 | protected function updateControlCssClass() |
| 269 | 270 | { |
@@ -388,6 +389,7 @@ discard block |
||
| 388 | 389 | * The ID path is the dot-connected IDs of the controls reaching from |
| 389 | 390 | * the validator's naming container to the target control. |
| 390 | 391 | * @param string the ID path |
| 392 | + * @param string $value |
|
| 391 | 393 | */ |
| 392 | 394 | public function setControlToValidate($value) |
| 393 | 395 | { |
@@ -476,7 +478,7 @@ discard block |
||
| 476 | 478 | } |
| 477 | 479 | |
| 478 | 480 | /** |
| 479 | - * @return TControl control to be validated. Null if no control is found. |
|
| 481 | + * @return \Prado\Web\UI\TControl control to be validated. Null if no control is found. |
|
| 480 | 482 | * @throws TConfigurationException if {@link getControlToValidate |
| 481 | 483 | * ControlToValidate} is empty or does not point to a valid control |
| 482 | 484 | */ |
@@ -553,6 +555,7 @@ discard block |
||
| 553 | 555 | |
| 554 | 556 | /** |
| 555 | 557 | * @param string the css class that is applied to the control being validated in case the validation fails |
| 558 | + * @param string $value |
|
| 556 | 559 | */ |
| 557 | 560 | public function setControlCssClass($value) |
| 558 | 561 | { |
@@ -81,11 +81,11 @@ discard block |
||
| 81 | 81 | /** |
| 82 | 82 | * @var boolean whether the validation succeeds |
| 83 | 83 | */ |
| 84 | - private $_isValid = true; |
|
| 84 | + private $_isValid=true; |
|
| 85 | 85 | /** |
| 86 | 86 | * @var boolean whether the validator has been registered with the page |
| 87 | 87 | */ |
| 88 | - private $_registered = false; |
|
| 88 | + private $_registered=false; |
|
| 89 | 89 | /** |
| 90 | 90 | * @var TValidatorClientSide validator client-script options. |
| 91 | 91 | */ |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * them specially. |
| 96 | 96 | * @var array list of control class names |
| 97 | 97 | */ |
| 98 | - private static $_clientClass = ['THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList']; |
|
| 98 | + private static $_clientClass=['THtmlArea', 'THtmlArea4', 'TDatePicker', 'TListBox', 'TCheckBoxList']; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * Constructor. |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | { |
| 116 | 116 | parent::onInit($param); |
| 117 | 117 | $this->getPage()->getValidators()->add($this); |
| 118 | - $this->_registered = true; |
|
| 118 | + $this->_registered=true; |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | /** |
@@ -124,9 +124,9 @@ discard block |
||
| 124 | 124 | */ |
| 125 | 125 | public function onUnload($param) |
| 126 | 126 | { |
| 127 | - if($this->_registered && ($page = $this->getPage()) !== null) |
|
| 127 | + if($this->_registered && ($page=$this->getPage())!==null) |
|
| 128 | 128 | $page->getValidators()->remove($this); |
| 129 | - $this->_registered = false; |
|
| 129 | + $this->_registered=false; |
|
| 130 | 130 | parent::onUnload($param); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | protected function addAttributesToRender($writer) |
| 139 | 139 | { |
| 140 | - $display = $this->getDisplay(); |
|
| 141 | - $visible = $this->getEnabled(true) && !$this->getIsValid(); |
|
| 142 | - if($display === TValidatorDisplayStyle::None || (!$visible && $display === TValidatorDisplayStyle::Dynamic)) |
|
| 140 | + $display=$this->getDisplay(); |
|
| 141 | + $visible=$this->getEnabled(true) && !$this->getIsValid(); |
|
| 142 | + if($display===TValidatorDisplayStyle::None || (!$visible && $display===TValidatorDisplayStyle::Dynamic)) |
|
| 143 | 143 | $writer->addStyleAttribute('display', 'none'); |
| 144 | 144 | elseif(!$visible) |
| 145 | 145 | $writer->addStyleAttribute('visibility', 'hidden'); |
@@ -154,29 +154,29 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | protected function getClientScriptOptions() |
| 156 | 156 | { |
| 157 | - $control = $this->getValidationTarget(); |
|
| 158 | - $options['ID'] = $this->getClientID(); |
|
| 159 | - $options['FormID'] = $this->getPage()->getForm()->getClientID(); |
|
| 160 | - $options['Display'] = $this->getDisplay(); |
|
| 161 | - $options['ErrorMessage'] = $this->getErrorMessage(); |
|
| 157 | + $control=$this->getValidationTarget(); |
|
| 158 | + $options['ID']=$this->getClientID(); |
|
| 159 | + $options['FormID']=$this->getPage()->getForm()->getClientID(); |
|
| 160 | + $options['Display']=$this->getDisplay(); |
|
| 161 | + $options['ErrorMessage']=$this->getErrorMessage(); |
|
| 162 | 162 | if($this->getFocusOnError()) |
| 163 | 163 | { |
| 164 | - $options['FocusOnError'] = $this->getFocusOnError(); |
|
| 165 | - $options['FocusElementID'] = $this->getFocusElementID(); |
|
| 164 | + $options['FocusOnError']=$this->getFocusOnError(); |
|
| 165 | + $options['FocusElementID']=$this->getFocusElementID(); |
|
| 166 | 166 | } |
| 167 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 167 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 168 | 168 | if($control) |
| 169 | - $options['ControlToValidate'] = $control->getClientID(); |
|
| 170 | - $options['ControlCssClass'] = $this->getControlCssClass(); |
|
| 169 | + $options['ControlToValidate']=$control->getClientID(); |
|
| 170 | + $options['ControlCssClass']=$this->getControlCssClass(); |
|
| 171 | 171 | |
| 172 | - $options['ControlType'] = $this->getClientControlClass($control); |
|
| 173 | - $options['Enabled'] = $this->getEnabled(true); |
|
| 172 | + $options['ControlType']=$this->getClientControlClass($control); |
|
| 173 | + $options['Enabled']=$this->getEnabled(true); |
|
| 174 | 174 | |
| 175 | 175 | //get date format from date picker target control |
| 176 | 176 | if($control instanceof TDatePicker) |
| 177 | - $options['DateFormat'] = $control->getDateFormat(); |
|
| 177 | + $options['DateFormat']=$control->getDateFormat(); |
|
| 178 | 178 | |
| 179 | - $options = array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
| 179 | + $options=array_merge($options, $this->getClientSide()->getOptions()->toArray()); |
|
| 180 | 180 | |
| 181 | 181 | return $options; |
| 182 | 182 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | foreach(self::$_clientClass as $type) |
| 194 | 194 | if($control instanceof $type) |
| 195 | 195 | return $type; |
| 196 | - $reflectionClass = new \ReflectionClass($control); |
|
| 196 | + $reflectionClass=new \ReflectionClass($control); |
|
| 197 | 197 | return $reflectionClass->getShortName(); |
| 198 | 198 | } |
| 199 | 199 | |
@@ -215,8 +215,8 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function getClientSide() |
| 217 | 217 | { |
| 218 | - if($this->_clientSide === null) |
|
| 219 | - $this->_clientSide = $this->createClientSide(); |
|
| 218 | + if($this->_clientSide===null) |
|
| 219 | + $this->_clientSide=$this->createClientSide(); |
|
| 220 | 220 | return $this->_clientSide; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -236,15 +236,15 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | public function renderClientControlScript($writer) |
| 238 | 238 | { |
| 239 | - $scripts = $this->getPage()->getClientScript(); |
|
| 240 | - if ($this->getEnableClientScript()) |
|
| 239 | + $scripts=$this->getPage()->getClientScript(); |
|
| 240 | + if($this->getEnableClientScript()) |
|
| 241 | 241 | $scripts->registerPradoScript('validator'); |
| 242 | - $formID = $this->getPage()->getForm()->getClientID(); |
|
| 243 | - $scriptKey = "TBaseValidator:$formID"; |
|
| 242 | + $formID=$this->getPage()->getForm()->getClientID(); |
|
| 243 | + $scriptKey="TBaseValidator:$formID"; |
|
| 244 | 244 | if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey)) |
| 245 | 245 | { |
| 246 | - $manager['FormID'] = $formID; |
|
| 247 | - $options = TJavaScript::encode($manager); |
|
| 246 | + $manager['FormID']=$formID; |
|
| 247 | + $options=TJavaScript::encode($manager); |
|
| 248 | 248 | $scripts->registerEndScript($scriptKey, "new Prado.ValidationManager({$options});"); |
| 249 | 249 | } |
| 250 | 250 | if($this->getEnableClientScript()) |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * Override parent implementation to update the control CSS Class before |
| 256 | 256 | * the validated control is rendered |
| 257 | 257 | */ |
| 258 | - public function onPreRender ($param) |
|
| 258 | + public function onPreRender($param) |
|
| 259 | 259 | { |
| 260 | 260 | parent::onPreRender($param); |
| 261 | 261 | $this->updateControlCssClass(); |
@@ -268,17 +268,17 @@ discard block |
||
| 268 | 268 | */ |
| 269 | 269 | protected function updateControlCssClass() |
| 270 | 270 | { |
| 271 | - if(($cssClass = $this->getControlCssClass()) !== '') |
|
| 271 | + if(($cssClass=$this->getControlCssClass())!=='') |
|
| 272 | 272 | { |
| 273 | - $control = $this->getValidationTarget(); |
|
| 273 | + $control=$this->getValidationTarget(); |
|
| 274 | 274 | if($control instanceof TWebControl) |
| 275 | 275 | { |
| 276 | - $class = preg_replace('/ ' . preg_quote($cssClass) . '/', '', $control->getCssClass()); |
|
| 276 | + $class=preg_replace('/ '.preg_quote($cssClass).'/', '', $control->getCssClass()); |
|
| 277 | 277 | if(!$this->getIsValid()) |
| 278 | 278 | { |
| 279 | - $class .= ' ' . $cssClass; |
|
| 279 | + $class.=' '.$cssClass; |
|
| 280 | 280 | $control->setCssClass($class); |
| 281 | - } elseif ($control->getIsValid()) |
|
| 281 | + } elseif($control->getIsValid()) |
|
| 282 | 282 | $control->setCssClass($class); |
| 283 | 283 | } |
| 284 | 284 | } |
@@ -289,11 +289,11 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | protected function registerClientScriptValidator() |
| 291 | 291 | { |
| 292 | - $key = 'prado:' . $this->getClientID(); |
|
| 292 | + $key='prado:'.$this->getClientID(); |
|
| 293 | 293 | if(!$this->getPage()->getClientScript()->isEndScriptRegistered($key)) |
| 294 | 294 | { |
| 295 | - $options = TJavaScript::encode($this->getClientScriptOptions()); |
|
| 296 | - $script = 'new ' . $this->getClientClassName() . '(' . $options . ');'; |
|
| 295 | + $options=TJavaScript::encode($this->getClientScriptOptions()); |
|
| 296 | + $script='new '.$this->getClientClassName().'('.$options.');'; |
|
| 297 | 297 | $this->getPage()->getClientScript()->registerEndScript($key, $script); |
| 298 | 298 | } |
| 299 | 299 | } |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | public function setEnabled($value) |
| 323 | 323 | { |
| 324 | - $value = TPropertyValue::ensureBoolean($value); |
|
| 324 | + $value=TPropertyValue::ensureBoolean($value); |
|
| 325 | 325 | parent::setEnabled($value); |
| 326 | 326 | if(!$value) |
| 327 | - $this->_isValid = true; |
|
| 327 | + $this->_isValid=true; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |
@@ -418,17 +418,17 @@ discard block |
||
| 418 | 418 | */ |
| 419 | 419 | public function getFocusElementID() |
| 420 | 420 | { |
| 421 | - if(($id = $this->getViewState('FocusElementID', '')) === '') |
|
| 421 | + if(($id=$this->getViewState('FocusElementID', ''))==='') |
|
| 422 | 422 | { |
| 423 | - $target = $this->getValidationTarget(); |
|
| 423 | + $target=$this->getValidationTarget(); |
|
| 424 | 424 | /* Workaround: TCheckBoxList and TRadioButtonList nests the actual |
| 425 | 425 | * inputs inside a table; we ensure the first input gets focused |
| 426 | 426 | */ |
| 427 | 427 | if($target instanceof TCheckBoxList && $target->getItemCount() > 0) |
| 428 | 428 | { |
| 429 | - $id = $target->getClientID() . '_c0'; |
|
| 429 | + $id=$target->getClientID().'_c0'; |
|
| 430 | 430 | } else { |
| 431 | - $id = $target->getClientID(); |
|
| 431 | + $id=$target->getClientID(); |
|
| 432 | 432 | } |
| 433 | 433 | } |
| 434 | 434 | return $id; |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | */ |
| 474 | 474 | public function setIsValid($value) |
| 475 | 475 | { |
| 476 | - $this->_isValid = TPropertyValue::ensureBoolean($value); |
|
| 476 | + $this->_isValid=TPropertyValue::ensureBoolean($value); |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | */ |
| 484 | 484 | public function getValidationTarget() |
| 485 | 485 | { |
| 486 | - if(($id = $this->getControlToValidate()) !== '' && ($control = $this->findControl($id)) !== null) |
|
| 486 | + if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null) |
|
| 487 | 487 | return $control; |
| 488 | 488 | else |
| 489 | 489 | throw new TConfigurationException('basevalidator_controltovalidate_invalid', get_class($this)); |
@@ -513,10 +513,10 @@ discard block |
||
| 513 | 513 | $this->onValidate(); |
| 514 | 514 | if($this->getVisible(true) && $this->getEnabled(true)) |
| 515 | 515 | { |
| 516 | - $target = $this->getValidationTarget(); |
|
| 516 | + $target=$this->getValidationTarget(); |
|
| 517 | 517 | // if the target is not a disabled web control |
| 518 | - if($target === null || |
|
| 519 | - ($target !== null && |
|
| 518 | + if($target===null || |
|
| 519 | + ($target!==null && |
|
| 520 | 520 | !($target instanceof TWebControl && !$target->getEnabled(true)))) |
| 521 | 521 | { |
| 522 | 522 | if($this->evaluateIsValid()) |
@@ -600,9 +600,9 @@ discard block |
||
| 600 | 600 | */ |
| 601 | 601 | public function renderContents($writer) |
| 602 | 602 | { |
| 603 | - if(($text = $this->getText()) !== '') |
|
| 603 | + if(($text=$this->getText())!=='') |
|
| 604 | 604 | $writer->write($text); |
| 605 | - elseif(($text = $this->getErrorMessage()) !== '') |
|
| 605 | + elseif(($text=$this->getErrorMessage())!=='') |
|
| 606 | 606 | $writer->write($text); |
| 607 | 607 | else |
| 608 | 608 | parent::renderContents($writer); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | * To trim or not to trim the contents. |
| 51 | 51 | * @var boolean |
| 52 | 52 | */ |
| 53 | - protected $trim = true; |
|
| 53 | + protected $trim=true; |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function setKey($value) |
| 72 | 72 | { |
| 73 | - $this->key = $value; |
|
| 73 | + $this->key=$value; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function setTrim($value) |
| 81 | 81 | { |
| 82 | - $this->trim = TPropertyValue::ensureBoolean($value); |
|
| 82 | + $this->trim=TPropertyValue::ensureBoolean($value); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | */ |
| 107 | 107 | public function getParameter() |
| 108 | 108 | { |
| 109 | - $value = $this->getValue(); |
|
| 109 | + $value=$this->getValue(); |
|
| 110 | 110 | if(strlen($value) > 0) |
| 111 | 111 | return $value; |
| 112 | - $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
| 112 | + $htmlWriter=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter()); |
|
| 113 | 113 | $this->renderControl($htmlWriter); |
| 114 | 114 | return $this->getTrim() ? |
| 115 | 115 | trim($htmlWriter->flush()) : $htmlWriter->flush(); |
@@ -260,8 +260,7 @@ discard block |
||
| 260 | 260 | if(!empty($this->cache)) |
| 261 | 261 | $this->cache->clean($variant, $this->culture); |
| 262 | 262 | return true; |
| 263 | - } |
|
| 264 | - else |
|
| 263 | + } else |
|
| 265 | 264 | return false; |
| 266 | 265 | } |
| 267 | 266 | return false; |
@@ -304,8 +303,7 @@ discard block |
||
| 304 | 303 | if(!empty($this->cache)) |
| 305 | 304 | $this->cache->clean($variant, $this->culture); |
| 306 | 305 | return true; |
| 307 | - } |
|
| 308 | - else |
|
| 306 | + } else |
|
| 309 | 307 | return false; |
| 310 | 308 | } |
| 311 | 309 | } |
@@ -354,8 +352,7 @@ discard block |
||
| 354 | 352 | if(!empty($this->cache)) |
| 355 | 353 | $this->cache->clean($variant, $this->culture); |
| 356 | 354 | return true; |
| 357 | - } |
|
| 358 | - else |
|
| 355 | + } else |
|
| 359 | 356 | return false; |
| 360 | 357 | } |
| 361 | 358 | } |
@@ -199,6 +199,9 @@ discard block |
||
| 199 | 199 | return false; |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | + /** |
|
| 203 | + * @param string $MOFile |
|
| 204 | + */ |
|
| 202 | 205 | private function getPOFile($MOFile) |
| 203 | 206 | { |
| 204 | 207 | $filebase = substr($MOFile, 0, strlen($MOFile) - strlen($this->dataExt)); |
@@ -421,6 +424,9 @@ discard block |
||
| 421 | 424 | return $catalogue; |
| 422 | 425 | } |
| 423 | 426 | |
| 427 | + /** |
|
| 428 | + * @param string $catalogue |
|
| 429 | + */ |
|
| 424 | 430 | protected function createMessageTemplate($catalogue) |
| 425 | 431 | { |
| 426 | 432 | if($catalogue === null) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | /** |
| 26 | 26 | * Get the Gettext class. |
| 27 | 27 | */ |
| 28 | -require_once(dirname(__FILE__) . '/Gettext/TGettext.php'); |
|
| 28 | +require_once(dirname(__FILE__).'/Gettext/TGettext.php'); |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * MessageSource_gettext class. |
@@ -44,23 +44,23 @@ discard block |
||
| 44 | 44 | * Message data filename extension. |
| 45 | 45 | * @var string |
| 46 | 46 | */ |
| 47 | - protected $dataExt = '.mo'; |
|
| 47 | + protected $dataExt='.mo'; |
|
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | 50 | * PO data filename extension |
| 51 | 51 | * @var string |
| 52 | 52 | */ |
| 53 | - protected $poExt = '.po'; |
|
| 53 | + protected $poExt='.po'; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * Separator between culture name and source. |
| 57 | 57 | * @var string |
| 58 | 58 | */ |
| 59 | - protected $dataSeparator = '.'; |
|
| 59 | + protected $dataSeparator='.'; |
|
| 60 | 60 | |
| 61 | 61 | public function __construct($source) |
| 62 | 62 | { |
| 63 | - $this->source = (string)$source; |
|
| 63 | + $this->source=(string) $source; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | |
@@ -71,17 +71,17 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | protected function &loadData($filename) |
| 73 | 73 | { |
| 74 | - $mo = TGettext::factory('MO', $filename); |
|
| 74 | + $mo=TGettext::factory('MO', $filename); |
|
| 75 | 75 | $mo->load(); |
| 76 | - $result = $mo->toArray(); |
|
| 76 | + $result=$mo->toArray(); |
|
| 77 | 77 | |
| 78 | - $results = []; |
|
| 79 | - $count = 0; |
|
| 78 | + $results=[]; |
|
| 79 | + $count=0; |
|
| 80 | 80 | foreach($result['strings'] as $source => $target) |
| 81 | 81 | { |
| 82 | - $results[$source][] = $target; //target |
|
| 83 | - $results[$source][] = $count++; //id |
|
| 84 | - $results[$source][] = ''; //comments |
|
| 82 | + $results[$source][]=$target; //target |
|
| 83 | + $results[$source][]=$count++; //id |
|
| 84 | + $results[$source][]=''; //comments |
|
| 85 | 85 | } |
| 86 | 86 | return $results; |
| 87 | 87 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | protected function getSource($variant) |
| 106 | 106 | { |
| 107 | - return $this->source . '/' . $variant; |
|
| 107 | + return $this->source.'/'.$variant; |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -128,24 +128,24 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | protected function getCatalogueList($catalogue) |
| 130 | 130 | { |
| 131 | - $variants = explode('_', $this->culture); |
|
| 132 | - $source = $catalogue . $this->dataExt; |
|
| 131 | + $variants=explode('_', $this->culture); |
|
| 132 | + $source=$catalogue.$this->dataExt; |
|
| 133 | 133 | |
| 134 | - $catalogues = [$source]; |
|
| 134 | + $catalogues=[$source]; |
|
| 135 | 135 | |
| 136 | - $variant = null; |
|
| 136 | + $variant=null; |
|
| 137 | 137 | |
| 138 | - for($i = 0, $k = count($variants); $i < $k; ++$i) |
|
| 138 | + for($i=0, $k=count($variants); $i < $k; ++$i) |
|
| 139 | 139 | { |
| 140 | 140 | if(isset($variants[$i]{0})) |
| 141 | 141 | { |
| 142 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
| 143 | - $catalogues[] = $catalogue . $this->dataSeparator . |
|
| 144 | - $variant . $this->dataExt; |
|
| 142 | + $variant.=($variant) ? '_'.$variants[$i] : $variants[$i]; |
|
| 143 | + $catalogues[]=$catalogue.$this->dataSeparator. |
|
| 144 | + $variant.$this->dataExt; |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | - $byDir = $this->getCatalogueByDir($catalogue); |
|
| 148 | - $catalogues = array_merge($byDir, array_reverse($catalogues)); |
|
| 147 | + $byDir=$this->getCatalogueByDir($catalogue); |
|
| 148 | + $catalogues=array_merge($byDir, array_reverse($catalogues)); |
|
| 149 | 149 | return $catalogues; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -159,17 +159,17 @@ discard block |
||
| 159 | 159 | */ |
| 160 | 160 | private function getCatalogueByDir($catalogue) |
| 161 | 161 | { |
| 162 | - $variants = explode('_', $this->culture); |
|
| 163 | - $catalogues = []; |
|
| 162 | + $variants=explode('_', $this->culture); |
|
| 163 | + $catalogues=[]; |
|
| 164 | 164 | |
| 165 | - $variant = null; |
|
| 165 | + $variant=null; |
|
| 166 | 166 | |
| 167 | - for($i = 0, $k = count($variants); $i < $k; ++$i) |
|
| 167 | + for($i=0, $k=count($variants); $i < $k; ++$i) |
|
| 168 | 168 | { |
| 169 | 169 | if(isset($variants[$i]{0})) |
| 170 | 170 | { |
| 171 | - $variant .= ($variant)?'_' . $variants[$i]:$variants[$i]; |
|
| 172 | - $catalogues[] = $variant . '/' . $catalogue . $this->dataExt; |
|
| 171 | + $variant.=($variant) ? '_'.$variants[$i] : $variants[$i]; |
|
| 172 | + $catalogues[]=$variant.'/'.$catalogue.$this->dataExt; |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | return array_reverse($catalogues); |
@@ -183,16 +183,16 @@ discard block |
||
| 183 | 183 | * @see update() |
| 184 | 184 | * @see delete() |
| 185 | 185 | */ |
| 186 | - private function getVariants($catalogue = 'messages') |
|
| 186 | + private function getVariants($catalogue='messages') |
|
| 187 | 187 | { |
| 188 | - if($catalogue === null) { |
|
| 189 | - $catalogue = 'messages'; |
|
| 188 | + if($catalogue===null) { |
|
| 189 | + $catalogue='messages'; |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | foreach($this->getCatalogueList($catalogue) as $variant) |
| 193 | 193 | { |
| 194 | - $file = $this->getSource($variant); |
|
| 195 | - $po = $this->getPOFile($file); |
|
| 194 | + $file=$this->getSource($variant); |
|
| 195 | + $po=$this->getPOFile($file); |
|
| 196 | 196 | if(is_file($file) || is_file($po)) |
| 197 | 197 | return [$variant, $file, $po]; |
| 198 | 198 | } |
@@ -201,8 +201,8 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | private function getPOFile($MOFile) |
| 203 | 203 | { |
| 204 | - $filebase = substr($MOFile, 0, strlen($MOFile) - strlen($this->dataExt)); |
|
| 205 | - return $filebase . $this->poExt; |
|
| 204 | + $filebase=substr($MOFile, 0, strlen($MOFile) - strlen($this->dataExt)); |
|
| 205 | + return $filebase.$this->poExt; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | /** |
@@ -212,48 +212,48 @@ discard block |
||
| 212 | 212 | * @param string the catalogue to add to |
| 213 | 213 | * @return boolean true if saved successfuly, false otherwise. |
| 214 | 214 | */ |
| 215 | - public function save($catalogue = 'messages') |
|
| 215 | + public function save($catalogue='messages') |
|
| 216 | 216 | { |
| 217 | - $messages = $this->untranslated; |
|
| 217 | + $messages=$this->untranslated; |
|
| 218 | 218 | |
| 219 | 219 | if(count($messages) <= 0) return false; |
| 220 | 220 | |
| 221 | - $variants = $this->getVariants($catalogue); |
|
| 221 | + $variants=$this->getVariants($catalogue); |
|
| 222 | 222 | |
| 223 | 223 | if($variants) |
| 224 | - list($variant, $MOFile, $POFile) = $variants; |
|
| 224 | + list($variant, $MOFile, $POFile)=$variants; |
|
| 225 | 225 | else |
| 226 | - list($variant, $MOFile, $POFile) = $this->createMessageTemplate($catalogue); |
|
| 226 | + list($variant, $MOFile, $POFile)=$this->createMessageTemplate($catalogue); |
|
| 227 | 227 | |
| 228 | - if(is_writable($MOFile) == false) |
|
| 228 | + if(is_writable($MOFile)==false) |
|
| 229 | 229 | throw new TIOException("Unable to save to file {$MOFile}, file must be writable."); |
| 230 | - if(is_writable($POFile) == false) |
|
| 230 | + if(is_writable($POFile)==false) |
|
| 231 | 231 | throw new TIOException("Unable to save to file {$POFile}, file must be writable."); |
| 232 | 232 | |
| 233 | 233 | //set the strings as untranslated. |
| 234 | - $strings = []; |
|
| 234 | + $strings=[]; |
|
| 235 | 235 | foreach($messages as $message) |
| 236 | - $strings[$message] = ''; |
|
| 236 | + $strings[$message]=''; |
|
| 237 | 237 | |
| 238 | 238 | //load the PO |
| 239 | - $po = TGettext::factory('PO', $POFile); |
|
| 239 | + $po=TGettext::factory('PO', $POFile); |
|
| 240 | 240 | $po->load(); |
| 241 | - $result = $po->toArray(); |
|
| 241 | + $result=$po->toArray(); |
|
| 242 | 242 | |
| 243 | - $existing = count($result['strings']); |
|
| 243 | + $existing=count($result['strings']); |
|
| 244 | 244 | |
| 245 | 245 | //add to strings to the existing message list |
| 246 | - $result['strings'] = array_merge($result['strings'], $strings); |
|
| 246 | + $result['strings']=array_merge($result['strings'], $strings); |
|
| 247 | 247 | |
| 248 | - $new = count($result['strings']); |
|
| 248 | + $new=count($result['strings']); |
|
| 249 | 249 | |
| 250 | 250 | if($new > $existing) |
| 251 | 251 | { |
| 252 | 252 | //change the date 2004-12-25 12:26 |
| 253 | - $result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s'); |
|
| 253 | + $result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s'); |
|
| 254 | 254 | |
| 255 | 255 | $po->fromArray($result); |
| 256 | - $mo = $po->toMO(); |
|
| 256 | + $mo=$po->toMO(); |
|
| 257 | 257 | if($po->save() && $mo->save($MOFile)) |
| 258 | 258 | { |
| 259 | 259 | if(!empty($this->cache)) |
@@ -272,32 +272,32 @@ discard block |
||
| 272 | 272 | * @param string the catalogue to delete from. |
| 273 | 273 | * @return boolean true if deleted, false otherwise. |
| 274 | 274 | */ |
| 275 | - public function delete($message, $catalogue = 'messages') |
|
| 275 | + public function delete($message, $catalogue='messages') |
|
| 276 | 276 | { |
| 277 | - $variants = $this->getVariants($catalogue); |
|
| 277 | + $variants=$this->getVariants($catalogue); |
|
| 278 | 278 | if($variants) |
| 279 | - list($variant, $MOFile, $POFile) = $variants; |
|
| 279 | + list($variant, $MOFile, $POFile)=$variants; |
|
| 280 | 280 | else |
| 281 | 281 | return false; |
| 282 | 282 | |
| 283 | - if(is_writable($MOFile) == false) |
|
| 283 | + if(is_writable($MOFile)==false) |
|
| 284 | 284 | throw new TIOException("Unable to modify file {$MOFile}, file must be writable."); |
| 285 | - if(is_writable($POFile) == false) |
|
| 285 | + if(is_writable($POFile)==false) |
|
| 286 | 286 | throw new TIOException("Unable to modify file {$POFile}, file must be writable."); |
| 287 | 287 | |
| 288 | - $po = TGettext::factory('PO', $POFile); |
|
| 288 | + $po=TGettext::factory('PO', $POFile); |
|
| 289 | 289 | $po->load(); |
| 290 | - $result = $po->toArray(); |
|
| 290 | + $result=$po->toArray(); |
|
| 291 | 291 | |
| 292 | 292 | foreach($result['strings'] as $string => $value) |
| 293 | 293 | { |
| 294 | - if($string == $message) |
|
| 294 | + if($string==$message) |
|
| 295 | 295 | { |
| 296 | - $result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s'); |
|
| 296 | + $result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s'); |
|
| 297 | 297 | unset($result['strings'][$string]); |
| 298 | 298 | |
| 299 | 299 | $po->fromArray($result); |
| 300 | - $mo = $po->toMO(); |
|
| 300 | + $mo=$po->toMO(); |
|
| 301 | 301 | if($po->save() && $mo->save($MOFile)) |
| 302 | 302 | { |
| 303 | 303 | if(!empty($this->cache)) |
@@ -320,33 +320,33 @@ discard block |
||
| 320 | 320 | * @param string the catalogue of the translation. |
| 321 | 321 | * @return boolean true if translation was updated, false otherwise. |
| 322 | 322 | */ |
| 323 | - public function update($text, $target, $comments, $catalogue = 'messages') |
|
| 323 | + public function update($text, $target, $comments, $catalogue='messages') |
|
| 324 | 324 | { |
| 325 | - $variants = $this->getVariants($catalogue); |
|
| 325 | + $variants=$this->getVariants($catalogue); |
|
| 326 | 326 | if($variants) |
| 327 | - list($variant, $MOFile, $POFile) = $variants; |
|
| 327 | + list($variant, $MOFile, $POFile)=$variants; |
|
| 328 | 328 | else |
| 329 | 329 | return false; |
| 330 | 330 | |
| 331 | - if(is_writable($MOFile) == false) |
|
| 331 | + if(is_writable($MOFile)==false) |
|
| 332 | 332 | throw new TIOException("Unable to update file {$MOFile}, file must be writable."); |
| 333 | - if(is_writable($POFile) == false) |
|
| 333 | + if(is_writable($POFile)==false) |
|
| 334 | 334 | throw new TIOException("Unable to update file {$POFile}, file must be writable."); |
| 335 | 335 | |
| 336 | 336 | |
| 337 | - $po = TGettext::factory('PO', $POFile); |
|
| 337 | + $po=TGettext::factory('PO', $POFile); |
|
| 338 | 338 | $po->load(); |
| 339 | - $result = $po->toArray(); |
|
| 339 | + $result=$po->toArray(); |
|
| 340 | 340 | |
| 341 | 341 | foreach($result['strings'] as $string => $value) |
| 342 | 342 | { |
| 343 | - if($string == $text) |
|
| 343 | + if($string==$text) |
|
| 344 | 344 | { |
| 345 | - $result['strings'][$string] = $target; |
|
| 346 | - $result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s'); |
|
| 345 | + $result['strings'][$string]=$target; |
|
| 346 | + $result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s'); |
|
| 347 | 347 | |
| 348 | 348 | $po->fromArray($result); |
| 349 | - $mo = $po->toMO(); |
|
| 349 | + $mo=$po->toMO(); |
|
| 350 | 350 | |
| 351 | 351 | if($po->save() && $mo->save($MOFile)) |
| 352 | 352 | { |
@@ -378,42 +378,42 @@ discard block |
||
| 378 | 378 | * E.g. array('messages','en_AU') |
| 379 | 379 | * @return array list of catalogues |
| 380 | 380 | */ |
| 381 | - protected function getCatalogues($dir = null, $variant = null) |
|
| 381 | + protected function getCatalogues($dir=null, $variant=null) |
|
| 382 | 382 | { |
| 383 | - $dir = $dir?$dir:$this->source; |
|
| 384 | - $files = scandir($dir); |
|
| 383 | + $dir=$dir ? $dir : $this->source; |
|
| 384 | + $files=scandir($dir); |
|
| 385 | 385 | |
| 386 | - $catalogue = []; |
|
| 386 | + $catalogue=[]; |
|
| 387 | 387 | |
| 388 | 388 | foreach($files as $file) |
| 389 | 389 | { |
| 390 | - if(is_dir($dir . '/' . $file) |
|
| 390 | + if(is_dir($dir.'/'.$file) |
|
| 391 | 391 | && preg_match('/^[a-z]{2}(_[A-Z]{2,3})?$/', $file)) |
| 392 | 392 | { |
| 393 | 393 | |
| 394 | - $catalogue = array_merge($catalogue, |
|
| 395 | - $this->getCatalogues($dir . '/' . $file, $file)); |
|
| 394 | + $catalogue=array_merge($catalogue, |
|
| 395 | + $this->getCatalogues($dir.'/'.$file, $file)); |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $pos = strpos($file, $this->dataExt); |
|
| 398 | + $pos=strpos($file, $this->dataExt); |
|
| 399 | 399 | |
| 400 | 400 | if($pos > 0 |
| 401 | - && substr($file, -1 * strlen($this->dataExt)) == $this->dataExt) |
|
| 401 | + && substr($file, -1 * strlen($this->dataExt))==$this->dataExt) |
|
| 402 | 402 | { |
| 403 | - $name = substr($file, 0, $pos); |
|
| 404 | - $dot = strrpos($name, $this->dataSeparator); |
|
| 405 | - $culture = $variant; |
|
| 406 | - $cat = $name; |
|
| 403 | + $name=substr($file, 0, $pos); |
|
| 404 | + $dot=strrpos($name, $this->dataSeparator); |
|
| 405 | + $culture=$variant; |
|
| 406 | + $cat=$name; |
|
| 407 | 407 | if(is_int($dot)) |
| 408 | 408 | { |
| 409 | - $culture = substr($name, $dot + 1, strlen($name)); |
|
| 410 | - $cat = substr($name, 0, $dot); |
|
| 409 | + $culture=substr($name, $dot + 1, strlen($name)); |
|
| 410 | + $cat=substr($name, 0, $dot); |
|
| 411 | 411 | } |
| 412 | - $details[0] = $cat; |
|
| 413 | - $details[1] = $culture; |
|
| 412 | + $details[0]=$cat; |
|
| 413 | + $details[1]=$culture; |
|
| 414 | 414 | |
| 415 | 415 | |
| 416 | - $catalogue[] = $details; |
|
| 416 | + $catalogue[]=$details; |
|
| 417 | 417 | } |
| 418 | 418 | } |
| 419 | 419 | sort($catalogue); |
@@ -423,15 +423,15 @@ discard block |
||
| 423 | 423 | |
| 424 | 424 | protected function createMessageTemplate($catalogue) |
| 425 | 425 | { |
| 426 | - if($catalogue === null) { |
|
| 427 | - $catalogue = 'messages'; |
|
| 426 | + if($catalogue===null) { |
|
| 427 | + $catalogue='messages'; |
|
| 428 | 428 | } |
| 429 | - $variants = $this->getCatalogueList($catalogue); |
|
| 430 | - $variant = array_shift($variants); |
|
| 431 | - $mo_file = $this->getSource($variant); |
|
| 432 | - $po_file = $this->getPOFile($mo_file); |
|
| 429 | + $variants=$this->getCatalogueList($catalogue); |
|
| 430 | + $variant=array_shift($variants); |
|
| 431 | + $mo_file=$this->getSource($variant); |
|
| 432 | + $po_file=$this->getPOFile($mo_file); |
|
| 433 | 433 | |
| 434 | - $dir = dirname($mo_file); |
|
| 434 | + $dir=dirname($mo_file); |
|
| 435 | 435 | if(!is_dir($dir)) |
| 436 | 436 | { |
| 437 | 437 | @mkdir($dir); |
@@ -440,12 +440,12 @@ discard block |
||
| 440 | 440 | if(!is_dir($dir)) |
| 441 | 441 | throw new TException("Unable to create directory $dir"); |
| 442 | 442 | |
| 443 | - $po = TGettext::factory('PO', $po_file); |
|
| 444 | - $result['meta']['PO-Revision-Date'] = @date('Y-m-d H:i:s'); |
|
| 445 | - $result['strings'] = []; |
|
| 443 | + $po=TGettext::factory('PO', $po_file); |
|
| 444 | + $result['meta']['PO-Revision-Date']=@date('Y-m-d H:i:s'); |
|
| 445 | + $result['strings']=[]; |
|
| 446 | 446 | |
| 447 | 447 | $po->fromArray($result); |
| 448 | - $mo = $po->toMO(); |
|
| 448 | + $mo=$po->toMO(); |
|
| 449 | 449 | if($po->save() && $mo->save($mo_file)) |
| 450 | 450 | return [$variant, $mo_file, $po_file]; |
| 451 | 451 | else |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function setText($value) |
| 52 | 52 | { |
| 53 | - if(parent::getText() === $value) |
|
| 53 | + if(parent::getText()===$value) |
|
| 54 | 54 | return; |
| 55 | 55 | |
| 56 | 56 | parent::setText($value); |
@@ -64,14 +64,14 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function setImageUrl($value) |
| 66 | 66 | { |
| 67 | - if(parent::getImageUrl() === $value) |
|
| 67 | + if(parent::getImageUrl()===$value) |
|
| 68 | 68 | return; |
| 69 | 69 | |
| 70 | 70 | parent::setImageUrl($value); |
| 71 | - if($this->getActiveControl()->canUpdateClientSide() && $value !== '') |
|
| 71 | + if($this->getActiveControl()->canUpdateClientSide() && $value!=='') |
|
| 72 | 72 | { |
| 73 | - $textWriter = new TTextWriter; |
|
| 74 | - $renderer = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter); |
|
| 73 | + $textWriter=new TTextWriter; |
|
| 74 | + $renderer=Prado::createComponent($this->GetResponse()->getHtmlWriterType(), $textWriter); |
|
| 75 | 75 | $this->createImage($value)->renderControl($renderer); |
| 76 | 76 | $this->getPage()->getCallbackClient()->update($this, $textWriter->flush()); |
| 77 | 77 | } |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function setNavigateUrl($value) |
| 85 | 85 | { |
| 86 | - if(parent::getNavigateUrl() === $value) |
|
| 86 | + if(parent::getNavigateUrl()===$value) |
|
| 87 | 87 | return; |
| 88 | 88 | |
| 89 | 89 | parent::setNavigateUrl($value); |
| 90 | 90 | if($this->getActiveControl()->canUpdateClientSide()) |
| 91 | 91 | { |
| 92 | 92 | //replace & with & and urldecode the url (setting the href using javascript is literal) |
| 93 | - $url = urldecode(str_replace('&', '&', $value)); |
|
| 93 | + $url=urldecode(str_replace('&', '&', $value)); |
|
| 94 | 94 | $this->getPage()->getCallbackClient()->setAttribute($this, 'href', $url); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function setTarget($value) |
| 103 | 103 | { |
| 104 | - if(parent::getTarget() === $value) |
|
| 104 | + if(parent::getTarget()===$value) |
|
| 105 | 105 | return; |
| 106 | 106 | |
| 107 | 107 | parent::setTarget($value); |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function setAlternateText($value) |
| 50 | 50 | { |
| 51 | - if(parent::getAlternateText() === $value) |
|
| 51 | + if(parent::getAlternateText()===$value) |
|
| 52 | 52 | return; |
| 53 | 53 | |
| 54 | 54 | parent::setAlternateText($value); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function setImageAlign($value) |
| 67 | 67 | { |
| 68 | - if(parent::getImageAlign() === $value) |
|
| 68 | + if(parent::getImageAlign()===$value) |
|
| 69 | 69 | return; |
| 70 | 70 | |
| 71 | 71 | parent::setImageAlign($value); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function setImageUrl($value) |
| 80 | 80 | { |
| 81 | - if(parent::getImageUrl() === $value) |
|
| 81 | + if(parent::getImageUrl()===$value) |
|
| 82 | 82 | return; |
| 83 | 83 | |
| 84 | 84 | parent::setImageUrl($value); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function setDescriptionUrl($value) |
| 93 | 93 | { |
| 94 | - if(parent::getDescriptionUrl() === $value) |
|
| 94 | + if(parent::getDescriptionUrl()===$value) |
|
| 95 | 95 | return; |
| 96 | 96 | |
| 97 | 97 | parent::setDescriptionUrl($value); |
@@ -48,6 +48,7 @@ discard block |
||
| 48 | 48 | /** |
| 49 | 49 | * Sets the alternative text to be displayed in the TImage when the image is unavailable. |
| 50 | 50 | * @param string the alternative text |
| 51 | + * @param string $value |
|
| 51 | 52 | */ |
| 52 | 53 | public function setAlternateText($value) |
| 53 | 54 | { |
@@ -78,6 +79,7 @@ discard block |
||
| 78 | 79 | |
| 79 | 80 | /** |
| 80 | 81 | * @param string the URL of the image file |
| 82 | + * @param string $value |
|
| 81 | 83 | */ |
| 82 | 84 | public function setImageUrl($value) |
| 83 | 85 | { |