@@ -37,6 +37,7 @@ |
||
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Creates a new TActiveTableRowEventParameter. |
| 40 | + * @param \Prado\Web\THttpResponse $response |
|
| 40 | 41 | */ |
| 41 | 42 | public function __construct($response, $parameter, $index = -1) |
| 42 | 43 | { |
@@ -33,15 +33,15 @@ |
||
| 33 | 33 | /** |
| 34 | 34 | * @var integer the zero-based index of the row. |
| 35 | 35 | */ |
| 36 | - private $_selectedRowIndex = -1; |
|
| 36 | + private $_selectedRowIndex=-1; |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Creates a new TActiveTableRowEventParameter. |
| 40 | 40 | */ |
| 41 | - public function __construct($response, $parameter, $index = -1) |
|
| 41 | + public function __construct($response, $parameter, $index=-1) |
|
| 42 | 42 | { |
| 43 | 43 | parent::__construct($response, $parameter); |
| 44 | - $this->_selectedRowIndex = $index; |
|
| 44 | + $this->_selectedRowIndex=$index; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
@@ -60,6 +60,7 @@ discard block |
||
| 60 | 60 | /** |
| 61 | 61 | * Sets the client side options. Can only be set when client side is null. |
| 62 | 62 | * @param TCallbackClientSide client side options. |
| 63 | + * @param TActiveCustomValidatorClientSide $client |
|
| 63 | 64 | */ |
| 64 | 65 | public function setClientSide($client) |
| 65 | 66 | { |
@@ -226,6 +227,7 @@ discard block |
||
| 226 | 227 | * {@link getClientSide ClientSide} property. |
| 227 | 228 | * @param string client side javascript class name. |
| 228 | 229 | * @param array additional callback options. |
| 230 | + * @param string $class |
|
| 229 | 231 | */ |
| 230 | 232 | public function registerCallbackClientScript($class, $options = null) |
| 231 | 233 | { |
@@ -49,9 +49,9 @@ discard block |
||
| 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 | - $client = $this->createClientSide(); |
|
| 54 | + $client=$this->createClientSide(); |
|
| 55 | 55 | $this->setOption('ClientSide', $client); |
| 56 | 56 | } |
| 57 | 57 | return $client; |
@@ -63,7 +63,7 @@ discard block |
||
| 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,20 +108,20 @@ discard block |
||
| 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 | - $control = $this->getControl()->getSubProperty(substr($id, 0, $pos)); |
|
| 116 | - $newid = substr($id, $pos + 1); |
|
| 117 | - if ($control !== null) |
|
| 118 | - $control = $control->$newid; |
|
| 115 | + $control=$this->getControl()->getSubProperty(substr($id, 0, $pos)); |
|
| 116 | + $newid=substr($id, $pos + 1); |
|
| 117 | + if($control!==null) |
|
| 118 | + $control=$control->$newid; |
|
| 119 | 119 | } |
| 120 | 120 | else |
| 121 | 121 | { |
| 122 | 122 | // TCheckBoxList overrides findControl() with a fake implementation |
| 123 | 123 | // but accepts a second parameter to use the standard one |
| 124 | - $control = $this->getControl()->findControl($id, true); |
|
| 124 | + $control=$this->getControl()->findControl($id, true); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if($control instanceof TCallbackOptions) |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | { |
| 178 | 178 | if($this->getCausesValidation()) |
| 179 | 179 | { |
| 180 | - $group = $this->getValidationGroup(); |
|
| 180 | + $group=$this->getValidationGroup(); |
|
| 181 | 181 | return $this->getPage()->getValidators($group)->getCount() > 0; |
| 182 | 182 | } |
| 183 | 183 | else |
@@ -206,15 +206,15 @@ discard block |
||
| 206 | 206 | */ |
| 207 | 207 | protected function getClientSideOptions() |
| 208 | 208 | { |
| 209 | - $default = $this->getDefaultClientSideOptions(); |
|
| 210 | - $options = array_merge($default, $this->getClientSide()->getOptions()->toArray()); |
|
| 211 | - $validate = $this->getCausesValidation(); |
|
| 212 | - $options['CausesValidation'] = $validate ? '' : false; |
|
| 213 | - $options['ValidationGroup'] = $this->getValidationGroup(); |
|
| 214 | - $options['CallbackParameter'] = $this->getCallbackParameter(); |
|
| 209 | + $default=$this->getDefaultClientSideOptions(); |
|
| 210 | + $options=array_merge($default, $this->getClientSide()->getOptions()->toArray()); |
|
| 211 | + $validate=$this->getCausesValidation(); |
|
| 212 | + $options['CausesValidation']=$validate ? '' : false; |
|
| 213 | + $options['ValidationGroup']=$this->getValidationGroup(); |
|
| 214 | + $options['CallbackParameter']=$this->getCallbackParameter(); |
|
| 215 | 215 | // needed for TCallback |
| 216 | 216 | if(!isset($options['EventTarget'])) |
| 217 | - $options['EventTarget'] = $this->getControl()->getUniqueID(); |
|
| 217 | + $options['EventTarget']=$this->getControl()->getUniqueID(); |
|
| 218 | 218 | return $options; |
| 219 | 219 | } |
| 220 | 220 | |
@@ -227,17 +227,17 @@ discard block |
||
| 227 | 227 | * @param string client side javascript class name. |
| 228 | 228 | * @param array additional callback options. |
| 229 | 229 | */ |
| 230 | - public function registerCallbackClientScript($class, $options = null) |
|
| 230 | + public function registerCallbackClientScript($class, $options=null) |
|
| 231 | 231 | { |
| 232 | - $cs = $this->getPage()->getClientScript(); |
|
| 232 | + $cs=$this->getPage()->getClientScript(); |
|
| 233 | 233 | if(is_array($options)) |
| 234 | - $options = array_merge($this->getClientSideOptions(), $options); |
|
| 234 | + $options=array_merge($this->getClientSideOptions(), $options); |
|
| 235 | 235 | else |
| 236 | - $options = $this->getClientSideOptions(); |
|
| 236 | + $options=$this->getClientSideOptions(); |
|
| 237 | 237 | |
| 238 | 238 | //remove true as default to save bytes |
| 239 | - if($options['CausesValidation'] === true) |
|
| 240 | - $options['CausesValidation'] = ''; |
|
| 239 | + if($options['CausesValidation']===true) |
|
| 240 | + $options['CausesValidation']=''; |
|
| 241 | 241 | $cs->registerCallbackControl($class, $options); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | public function getJavascript() |
| 264 | 264 | { |
| 265 | - $client = $this->getPage()->getClientScript(); |
|
| 265 | + $client=$this->getPage()->getClientScript(); |
|
| 266 | 266 | return $client->getCallbackReference($this->getControl(), $this->getClientSideOptions()); |
| 267 | 267 | } |
| 268 | 268 | |
@@ -116,8 +116,7 @@ discard block |
||
| 116 | 116 | $newid = substr($id, $pos + 1); |
| 117 | 117 | if ($control !== null) |
| 118 | 118 | $control = $control->$newid; |
| 119 | - } |
|
| 120 | - else |
|
| 119 | + } else |
|
| 121 | 120 | { |
| 122 | 121 | // TCheckBoxList overrides findControl() with a fake implementation |
| 123 | 122 | // but accepts a second parameter to use the standard one |
@@ -179,8 +178,7 @@ discard block |
||
| 179 | 178 | { |
| 180 | 179 | $group = $this->getValidationGroup(); |
| 181 | 180 | return $this->getPage()->getValidators($group)->getCount() > 0; |
| 182 | - } |
|
| 183 | - else |
|
| 181 | + } else |
|
| 184 | 182 | return false; |
| 185 | 183 | } |
| 186 | 184 | |
@@ -58,6 +58,8 @@ discard block |
||
| 58 | 58 | * @param string option name. |
| 59 | 59 | * @param mixed new value. |
| 60 | 60 | * @param mixed default value. |
| 61 | + * @param string $name |
|
| 62 | + * @param string|boolean $default |
|
| 61 | 63 | * @return mixed options value. |
| 62 | 64 | */ |
| 63 | 65 | protected function setOption($name, $value, $default = null) |
@@ -72,6 +74,8 @@ discard block |
||
| 72 | 74 | * named values for the base active controls. |
| 73 | 75 | * @param string option name. |
| 74 | 76 | * @param mixed default value. |
| 77 | + * @param string $name |
|
| 78 | + * @param string|boolean $default |
|
| 75 | 79 | * @return mixed options value. |
| 76 | 80 | */ |
| 77 | 81 | protected function getOption($name, $default = null) |
@@ -89,7 +93,7 @@ discard block |
||
| 89 | 93 | } |
| 90 | 94 | |
| 91 | 95 | /** |
| 92 | - * @return TPage the page containing the attached control. |
|
| 96 | + * @return \Prado\Web\UI\TPage the page containing the attached control. |
|
| 93 | 97 | */ |
| 94 | 98 | protected function getPage() |
| 95 | 99 | { |
@@ -48,8 +48,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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()); |
@@ -95,6 +95,7 @@ discard block |
||
| 95 | 95 | * Executes a client-side statement. |
| 96 | 96 | * @param string javascript function name |
| 97 | 97 | * @param array list of arguments for the function |
| 98 | + * @param string $function |
|
| 98 | 99 | */ |
| 99 | 100 | public function callClientFunction($function, $params = []) |
| 100 | 101 | { |
@@ -155,6 +156,7 @@ discard block |
||
| 155 | 156 | * @param string selection method |
| 156 | 157 | * @param string|int the value or index to select/check. |
| 157 | 158 | * @param string selection control type, either 'check' or 'select' |
| 159 | + * @param string $type |
|
| 158 | 160 | */ |
| 159 | 161 | public function select($control, $method = 'Value', $value = null, $type = null) |
| 160 | 162 | { |
@@ -424,6 +426,7 @@ discard block |
||
| 424 | 426 | * @param TControl control element or HTML element id. |
| 425 | 427 | * @param string HTML fragement or the control to be rendered. |
| 426 | 428 | * @param boolean whether to fully replace the element or just its inner content. |
| 429 | + * @param boolean $self |
|
| 427 | 430 | * @see insertAbout |
| 428 | 431 | * @see insertBelow |
| 429 | 432 | * @see insertBefore |
@@ -482,6 +485,7 @@ discard block |
||
| 482 | 485 | * Similar to to evaluateScript(), but functions declared in the |
| 483 | 486 | * inline block will be available to page elements. |
| 484 | 487 | * @param THtmlWriter writer for the content. |
| 488 | + * @param \Prado\TComponent $content |
|
| 485 | 489 | */ |
| 486 | 490 | public function appendScriptBlock($content) |
| 487 | 491 | { |
@@ -503,6 +507,7 @@ discard block |
||
| 503 | 507 | * component developers. The render() method is defered to be called in the |
| 504 | 508 | * TActivePageAdapter class. |
| 505 | 509 | * @param TControl control to be rendered on callback response. |
| 510 | + * @param TControl $control |
|
| 506 | 511 | * @return string the boundary for which the rendered content is wrapped. |
| 507 | 512 | */ |
| 508 | 513 | private function getRenderedContentBoundary($control) |
@@ -515,6 +520,7 @@ discard block |
||
| 515 | 520 | |
| 516 | 521 | /** |
| 517 | 522 | * @param THtmlWriter the writer responsible for rendering html content. |
| 523 | + * @param THtmlWriter $html |
|
| 518 | 524 | * @return string content boundary. |
| 519 | 525 | */ |
| 520 | 526 | private function getResponseContentBoundary($html) |
@@ -534,6 +540,7 @@ discard block |
||
| 534 | 540 | * @param string visual effect function name. |
| 535 | 541 | * @param TControl control element or element id |
| 536 | 542 | * @param array visual effect key-value pair options. |
| 543 | + * @param string $type |
|
| 537 | 544 | */ |
| 538 | 545 | public function visualEffect($type, $element, $options = []) |
| 539 | 546 | { |
@@ -641,6 +648,7 @@ discard block |
||
| 641 | 648 | * @param string visual effect function name. |
| 642 | 649 | * @param TControl control element or element id |
| 643 | 650 | * @param array effect options. |
| 651 | + * @param string $effect |
|
| 644 | 652 | */ |
| 645 | 653 | public function juiEffect($element, $effect, $options = []) |
| 646 | 654 | { |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function __construct() |
| 81 | 81 | { |
| 82 | - $this->_actions = new TList; |
|
| 82 | + $this->_actions=new TList; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
@@ -96,17 +96,17 @@ discard block |
||
| 96 | 96 | * @param string javascript function name |
| 97 | 97 | * @param array list of arguments for the function |
| 98 | 98 | */ |
| 99 | - public function callClientFunction($function, $params = []) |
|
| 99 | + public function callClientFunction($function, $params=[]) |
|
| 100 | 100 | { |
| 101 | 101 | if(!is_array($params)) |
| 102 | - $params = [$params]; |
|
| 102 | + $params=[$params]; |
|
| 103 | 103 | |
| 104 | 104 | if(count($params) > 0) |
| 105 | 105 | { |
| 106 | - if ($params[0] instanceof ISurroundable) |
|
| 107 | - $params[0] = $params[0]->getSurroundingTagID(); |
|
| 106 | + if($params[0] instanceof ISurroundable) |
|
| 107 | + $params[0]=$params[0]->getSurroundingTagID(); |
|
| 108 | 108 | elseif($params[0] instanceof TControl) |
| 109 | - $params[0] = $params[0]->getClientID(); |
|
| 109 | + $params[0]=$params[0]->getClientID(); |
|
| 110 | 110 | } |
| 111 | 111 | $this->_actions->add([$function => $params]); |
| 112 | 112 | } |
@@ -117,15 +117,15 @@ discard block |
||
| 117 | 117 | * @param string jQuery method name |
| 118 | 118 | * @param array list of arguments for the function |
| 119 | 119 | */ |
| 120 | - public function jQuery($element, $method, $params = []) |
|
| 120 | + public function jQuery($element, $method, $params=[]) |
|
| 121 | 121 | { |
| 122 | - if ($element instanceof ISurroundable) |
|
| 123 | - $element = $element->getSurroundingTagID(); |
|
| 122 | + if($element instanceof ISurroundable) |
|
| 123 | + $element=$element->getSurroundingTagID(); |
|
| 124 | 124 | elseif($element instanceof TControl) |
| 125 | - $element = $element->getClientID(); |
|
| 125 | + $element=$element->getClientID(); |
|
| 126 | 126 | |
| 127 | 127 | if(!is_array($params)) |
| 128 | - $params = [$params]; |
|
| 128 | + $params=[$params]; |
|
| 129 | 129 | |
| 130 | 130 | $this->_actions->add(['Prado.Element.j' => [$element, $method, $params]]); |
| 131 | 131 | } |
@@ -156,19 +156,19 @@ discard block |
||
| 156 | 156 | * @param string|int the value or index to select/check. |
| 157 | 157 | * @param string selection control type, either 'check' or 'select' |
| 158 | 158 | */ |
| 159 | - public function select($control, $method = 'Value', $value = null, $type = null) |
|
| 159 | + public function select($control, $method='Value', $value=null, $type=null) |
|
| 160 | 160 | { |
| 161 | - $method = TPropertyValue::ensureEnum($method, |
|
| 161 | + $method=TPropertyValue::ensureEnum($method, |
|
| 162 | 162 | 'Value', 'Index', 'Clear', 'Indices', 'Values', 'All', 'Invert'); |
| 163 | - $type = ($type === null) ? $this->getSelectionControlType($control) : $type; |
|
| 164 | - $total = $this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
|
| 163 | + $type=($type===null) ? $this->getSelectionControlType($control) : $type; |
|
| 164 | + $total=$this->getSelectionControlIsListType($control) ? $control->getItemCount() : 1; |
|
| 165 | 165 | |
| 166 | 166 | // pass the ID to avoid getting the surrounding elements (ISurroundable) |
| 167 | 167 | if($control instanceof TControl) |
| 168 | - $control = $control->getClientID(); |
|
| 168 | + $control=$control->getClientID(); |
|
| 169 | 169 | |
| 170 | 170 | $this->callClientFunction('Prado.Element.select', |
| 171 | - [$control, $type . $method, $value, $total]); |
|
| 171 | + [$control, $type.$method, $value, $total]); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | private function getSelectionControlType($control) |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param TControl control element or element id |
| 202 | 202 | * @param boolean check or uncheck the checkbox or radio button. |
| 203 | 203 | */ |
| 204 | - public function check($checkbox, $checked = true) |
|
| 204 | + public function check($checkbox, $checked=true) |
|
| 205 | 205 | { |
| 206 | 206 | $this->select($checkbox, "Value", $checked); |
| 207 | 207 | } |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | public function setAttribute($control, $name, $value) |
| 226 | 226 | { |
| 227 | 227 | // Attributes should be applied on Surrounding tag, except for 'disabled' attribute |
| 228 | - if ($control instanceof ISurroundable && strtolower($name) !== 'disabled') |
|
| 229 | - $control = $control->getSurroundingTagID(); |
|
| 228 | + if($control instanceof ISurroundable && strtolower($name)!=='disabled') |
|
| 229 | + $control=$control->getSurroundingTagID(); |
|
| 230 | 230 | $this->callClientFunction('Prado.Element.setAttribute', [$control, $name, $value]); |
| 231 | 231 | } |
| 232 | 232 | |
@@ -237,25 +237,25 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function setListItems($control, $items) |
| 239 | 239 | { |
| 240 | - $options = []; |
|
| 240 | + $options=[]; |
|
| 241 | 241 | if($control instanceof TListControl) |
| 242 | 242 | { |
| 243 | - $promptText = $control->getPromptText(); |
|
| 244 | - $promptValue = $control->getPromptValue(); |
|
| 243 | + $promptText=$control->getPromptText(); |
|
| 244 | + $promptValue=$control->getPromptValue(); |
|
| 245 | 245 | |
| 246 | - if($promptValue === '') |
|
| 247 | - $promptValue = $promptText; |
|
| 246 | + if($promptValue==='') |
|
| 247 | + $promptValue=$promptText; |
|
| 248 | 248 | |
| 249 | - if($promptValue !== '') |
|
| 250 | - $options[] = [$promptText, $promptValue]; |
|
| 249 | + if($promptValue!=='') |
|
| 250 | + $options[]=[$promptText, $promptValue]; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | foreach($items as $item) |
| 254 | 254 | { |
| 255 | 255 | if($item->getHasAttributes()) |
| 256 | - $options[] = [$item->getText(),$item->getValue(), $item->getAttributes()->itemAt('Group')]; |
|
| 256 | + $options[]=[$item->getText(), $item->getValue(), $item->getAttributes()->itemAt('Group')]; |
|
| 257 | 257 | else |
| 258 | - $options[] = [$item->getText(),$item->getValue()]; |
|
| 258 | + $options[]=[$item->getText(), $item->getValue()]; |
|
| 259 | 259 | } |
| 260 | 260 | $this->callClientFunction('Prado.Element.setOptions', [$control, $options]); |
| 261 | 261 | } |
@@ -284,21 +284,21 @@ discard block |
||
| 284 | 284 | * @param string visual effect, such as, 'fade' or 'slide'. |
| 285 | 285 | * @param array additional options. |
| 286 | 286 | */ |
| 287 | - public function toggle($element, $effect = null, $options = []) |
|
| 287 | + public function toggle($element, $effect=null, $options=[]) |
|
| 288 | 288 | { |
| 289 | 289 | switch(strtolower($effect)) |
| 290 | 290 | { |
| 291 | 291 | case 'fade': |
| 292 | - $method = 'fadeToggle'; |
|
| 292 | + $method='fadeToggle'; |
|
| 293 | 293 | break; |
| 294 | 294 | case 'slide': |
| 295 | - $method = 'slideToggle'; |
|
| 295 | + $method='slideToggle'; |
|
| 296 | 296 | break; |
| 297 | 297 | default: |
| 298 | - $method = 'toggle'; |
|
| 298 | + $method='toggle'; |
|
| 299 | 299 | // avoid fancy effect by default |
| 300 | 300 | if(!array_key_exists('duration', $options)) |
| 301 | - $options['duration'] = 0; |
|
| 301 | + $options['duration']=0; |
|
| 302 | 302 | break; |
| 303 | 303 | } |
| 304 | 304 | $this->jQuery($element, $method, $options); |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | * @param TControl control element or element id |
| 352 | 352 | * @param array additional options: 'duration' in ms, 'offset' from the top in pixels |
| 353 | 353 | */ |
| 354 | - public function scrollTo($element, $options = []) |
|
| 354 | + public function scrollTo($element, $options=[]) |
|
| 355 | 355 | { |
| 356 | 356 | $this->callClientFunction('Prado.Element.scrollTo', [$element, $options]); |
| 357 | 357 | } |
@@ -433,16 +433,16 @@ discard block |
||
| 433 | 433 | { |
| 434 | 434 | if($content instanceof TControl) |
| 435 | 435 | { |
| 436 | - $boundary = $this->getRenderedContentBoundary($content); |
|
| 437 | - $content = null; |
|
| 436 | + $boundary=$this->getRenderedContentBoundary($content); |
|
| 437 | + $content=null; |
|
| 438 | 438 | } |
| 439 | 439 | elseif($content instanceof THtmlWriter) |
| 440 | 440 | { |
| 441 | - $boundary = $this->getResponseContentBoundary($content); |
|
| 442 | - $content = null; |
|
| 441 | + $boundary=$this->getResponseContentBoundary($content); |
|
| 442 | + $content=null; |
|
| 443 | 443 | } |
| 444 | 444 | else |
| 445 | - $boundary = null; |
|
| 445 | + $boundary=null; |
|
| 446 | 446 | |
| 447 | 447 | $this->callClientFunction('Prado.Element.replace', [$element, $content, $boundary, $self]); |
| 448 | 448 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | * @param string HTML fragement or the control to be rendered. |
| 454 | 454 | * @param boolean whether to fully replace the element or just its inner content, defaults to true. |
| 455 | 455 | */ |
| 456 | - public function replaceContent($element, $content, $self = true) |
|
| 456 | + public function replaceContent($element, $content, $self=true) |
|
| 457 | 457 | { |
| 458 | 458 | $this->replace($element, $content, $self); |
| 459 | 459 | } |
@@ -467,11 +467,11 @@ discard block |
||
| 467 | 467 | { |
| 468 | 468 | if($writer instanceof THtmlWriter) |
| 469 | 469 | { |
| 470 | - $boundary = $this->getResponseContentBoundary($writer); |
|
| 471 | - $content = null; |
|
| 470 | + $boundary=$this->getResponseContentBoundary($writer); |
|
| 471 | + $content=null; |
|
| 472 | 472 | } else { |
| 473 | - $boundary = null; |
|
| 474 | - $content = $writer; |
|
| 473 | + $boundary=null; |
|
| 474 | + $content=$writer; |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | $this->callClientFunction('Prado.Element.evaluateScript', [$content, $boundary]); |
@@ -487,11 +487,11 @@ discard block |
||
| 487 | 487 | { |
| 488 | 488 | if($content instanceof TControl) |
| 489 | 489 | { |
| 490 | - $boundary = $this->getRenderedContentBoundary($content); |
|
| 490 | + $boundary=$this->getRenderedContentBoundary($content); |
|
| 491 | 491 | } |
| 492 | 492 | elseif($content instanceof THtmlWriter) |
| 493 | 493 | { |
| 494 | - $boundary = $this->getResponseContentBoundary($content); |
|
| 494 | + $boundary=$this->getResponseContentBoundary($content); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | $this->callClientFunction('Prado.Element.appendScriptBlock', [$boundary]); |
@@ -507,8 +507,8 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | private function getRenderedContentBoundary($control) |
| 509 | 509 | { |
| 510 | - $writer = $this->getResponse()->createHtmlWriter(); |
|
| 511 | - $adapter = $control->getPage()->getAdapter(); |
|
| 510 | + $writer=$this->getResponse()->createHtmlWriter(); |
|
| 511 | + $adapter=$control->getPage()->getAdapter(); |
|
| 512 | 512 | $adapter->registerControlToRender($control, $writer); |
| 513 | 513 | return $writer->getWriter()->getBoundary(); |
| 514 | 514 | } |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | * @param TControl control element or element id |
| 536 | 536 | * @param array visual effect key-value pair options. |
| 537 | 537 | */ |
| 538 | - public function visualEffect($type, $element, $options = []) |
|
| 538 | + public function visualEffect($type, $element, $options=[]) |
|
| 539 | 539 | { |
| 540 | 540 | $this->jQuery($element, $type, $options); |
| 541 | 541 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | * @param TControl control element or element id |
| 549 | 549 | * @param array visual effect key-value pair options. |
| 550 | 550 | */ |
| 551 | - public function fadeIn($element, $options = []) |
|
| 551 | + public function fadeIn($element, $options=[]) |
|
| 552 | 552 | { |
| 553 | 553 | $this->visualEffect('fadeIn', $element, $options); |
| 554 | 554 | } |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @param TControl control element or element id |
| 560 | 560 | * @param array visual effect key-value pair options. |
| 561 | 561 | */ |
| 562 | - public function fadeOut($element, $options = []) |
|
| 562 | + public function fadeOut($element, $options=[]) |
|
| 563 | 563 | { |
| 564 | 564 | $this->visualEffect('fadeOut', $element, $options); |
| 565 | 565 | } |
@@ -570,9 +570,9 @@ discard block |
||
| 570 | 570 | * @param TControl control element or element id |
| 571 | 571 | * @param float opacity value between 1 and 0 |
| 572 | 572 | */ |
| 573 | - public function fadeTo($element, $value, $duration = 500) |
|
| 573 | + public function fadeTo($element, $value, $duration=500) |
|
| 574 | 574 | { |
| 575 | - $value = TPropertyValue::ensureFloat($value); |
|
| 575 | + $value=TPropertyValue::ensureFloat($value); |
|
| 576 | 576 | $this->visualEffect('fadeTo', $element, [$duration, $value]); |
| 577 | 577 | } |
| 578 | 578 | |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | * @param TControl control element or element id |
| 583 | 583 | * @param array visual effect key-value pair options. |
| 584 | 584 | */ |
| 585 | - public function slideDown($element, $options = []) |
|
| 585 | + public function slideDown($element, $options=[]) |
|
| 586 | 586 | { |
| 587 | 587 | $this->visualEffect('slideDown', $element, $options); |
| 588 | 588 | } |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | * @param TControl control element or element id |
| 594 | 594 | * @param array visual effect key-value pair options. |
| 595 | 595 | */ |
| 596 | - public function slideUp($element, $options = []) |
|
| 596 | + public function slideUp($element, $options=[]) |
|
| 597 | 597 | { |
| 598 | 598 | $this->visualEffect('slideUp', $element, $options); |
| 599 | 599 | } |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | * @param TControl control element or element id |
| 607 | 607 | * @param array visual effect key-value pair options. |
| 608 | 608 | */ |
| 609 | - public function appear($element, $options = []) |
|
| 609 | + public function appear($element, $options=[]) |
|
| 610 | 610 | { |
| 611 | 611 | $this->fadeIn($element, $options); |
| 612 | 612 | } |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | * @param TControl control element or element id |
| 618 | 618 | * @param array visual effect key-value pair options. |
| 619 | 619 | */ |
| 620 | - public function fade($element, $options = []) |
|
| 620 | + public function fade($element, $options=[]) |
|
| 621 | 621 | { |
| 622 | 622 | $this->fadeOut($element, $options); |
| 623 | 623 | } |
@@ -642,9 +642,9 @@ discard block |
||
| 642 | 642 | * @param TControl control element or element id |
| 643 | 643 | * @param array effect options. |
| 644 | 644 | */ |
| 645 | - public function juiEffect($element, $effect, $options = []) |
|
| 645 | + public function juiEffect($element, $effect, $options=[]) |
|
| 646 | 646 | { |
| 647 | - $options['effect'] = $effect; |
|
| 647 | + $options['effect']=$effect; |
|
| 648 | 648 | $this->jQuery($element, 'effect', [$options]); |
| 649 | 649 | } |
| 650 | 650 | |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | * @param TControl control element or element id |
| 655 | 655 | * @param array visual effect key-value pair options. |
| 656 | 656 | */ |
| 657 | - public function blind($element, $options = []) |
|
| 657 | + public function blind($element, $options=[]) |
|
| 658 | 658 | { |
| 659 | 659 | $this->juiEffect($element, 'blind', $options); |
| 660 | 660 | } |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | * @param TControl control element or element id |
| 666 | 666 | * @param array visual effect key-value pair options. |
| 667 | 667 | */ |
| 668 | - public function drop($element, $options = []) |
|
| 668 | + public function drop($element, $options=[]) |
|
| 669 | 669 | { |
| 670 | 670 | $this->juiEffect($element, 'drop', $options); |
| 671 | 671 | } |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | * @param TControl control element or element id |
| 677 | 677 | * @param array visual effect key-value pair options. |
| 678 | 678 | */ |
| 679 | - public function fold($element, $options = []) |
|
| 679 | + public function fold($element, $options=[]) |
|
| 680 | 680 | { |
| 681 | 681 | $this->juiEffect($element, 'fold', $options); |
| 682 | 682 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | * @param TControl control element or element id |
| 688 | 688 | * @param array visual effect key-value pair options. |
| 689 | 689 | */ |
| 690 | - public function size($element, $options = []) |
|
| 690 | + public function size($element, $options=[]) |
|
| 691 | 691 | { |
| 692 | 692 | $this->juiEffect($element, 'size', $options); |
| 693 | 693 | } |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | * @param TControl control element or element id |
| 699 | 699 | * @param array visual effect key-value pair options. |
| 700 | 700 | */ |
| 701 | - public function puff($element, $options = []) |
|
| 701 | + public function puff($element, $options=[]) |
|
| 702 | 702 | { |
| 703 | 703 | $this->juiEffect($element, 'puff', $options); |
| 704 | 704 | } |
@@ -709,7 +709,7 @@ discard block |
||
| 709 | 709 | * @param TControl control element or element id |
| 710 | 710 | * @param array visual effect key-value pair options. |
| 711 | 711 | */ |
| 712 | - public function pulsate($element, $options = []) |
|
| 712 | + public function pulsate($element, $options=[]) |
|
| 713 | 713 | { |
| 714 | 714 | $this->juiEffect($element, 'pulsate', $options); |
| 715 | 715 | } |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | * @param TControl control element or element id |
| 721 | 721 | * @param array visual effect key-value pair options. |
| 722 | 722 | */ |
| 723 | - public function shake($element, $options = []) |
|
| 723 | + public function shake($element, $options=[]) |
|
| 724 | 724 | { |
| 725 | 725 | $this->juiEffect($element, 'shake', $options); |
| 726 | 726 | } |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | * @param TControl control element or element id |
| 732 | 732 | * @param array visual effect key-value pair options. |
| 733 | 733 | */ |
| 734 | - public function scale($element, $options = []) |
|
| 734 | + public function scale($element, $options=[]) |
|
| 735 | 735 | { |
| 736 | 736 | $this->juiEffect($element, 'scale', $options); |
| 737 | 737 | } |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | * @param TControl control element or element id |
| 743 | 743 | * @param array visual effect key-value pair options. |
| 744 | 744 | */ |
| 745 | - public function highlight($element, $options = []) |
|
| 745 | + public function highlight($element, $options=[]) |
|
| 746 | 746 | { |
| 747 | 747 | $this->juiEffect($element, 'highlight', $options); |
| 748 | 748 | } |
@@ -755,9 +755,9 @@ discard block |
||
| 755 | 755 | * @param TControl control element or element id |
| 756 | 756 | * @param array visual effect key-value pair options. |
| 757 | 757 | */ |
| 758 | - public function blindDown($element, $options = []) |
|
| 758 | + public function blindDown($element, $options=[]) |
|
| 759 | 759 | { |
| 760 | - $options['direction'] = 'down'; |
|
| 760 | + $options['direction']='down'; |
|
| 761 | 761 | $this->blind($element, $options); |
| 762 | 762 | } |
| 763 | 763 | |
@@ -767,9 +767,9 @@ discard block |
||
| 767 | 767 | * @param TControl control element or element id |
| 768 | 768 | * @param array visual effect key-value pair options. |
| 769 | 769 | */ |
| 770 | - public function blindUp($element, $options = []) |
|
| 770 | + public function blindUp($element, $options=[]) |
|
| 771 | 771 | { |
| 772 | - $options['direction'] = 'up'; |
|
| 772 | + $options['direction']='up'; |
|
| 773 | 773 | $this->blind($element, $options); |
| 774 | 774 | } |
| 775 | 775 | |
@@ -779,7 +779,7 @@ discard block |
||
| 779 | 779 | * @param TControl control element or element id |
| 780 | 780 | * @param array visual effect key-value pair options. |
| 781 | 781 | */ |
| 782 | - public function dropOut($element, $options = []) |
|
| 782 | + public function dropOut($element, $options=[]) |
|
| 783 | 783 | { |
| 784 | 784 | $this->drop($element, $options); |
| 785 | 785 | } |
@@ -790,7 +790,7 @@ discard block |
||
| 790 | 790 | * @param TControl control element or element id |
| 791 | 791 | * @param array visual effect key-value pair options. |
| 792 | 792 | */ |
| 793 | - public function grow($element, $options = []) |
|
| 793 | + public function grow($element, $options=[]) |
|
| 794 | 794 | { |
| 795 | 795 | $this->size($element, $options); |
| 796 | 796 | } |
@@ -801,9 +801,9 @@ discard block |
||
| 801 | 801 | * @param TControl control element or element id |
| 802 | 802 | * @param array visual effect key-value pair options. |
| 803 | 803 | */ |
| 804 | - public function shrink($element, $options = []) |
|
| 804 | + public function shrink($element, $options=[]) |
|
| 805 | 805 | { |
| 806 | - $options['percent'] = 0; |
|
| 806 | + $options['percent']=0; |
|
| 807 | 807 | $this->scale($element, $options); |
| 808 | 808 | } |
| 809 | 809 | |
@@ -813,10 +813,10 @@ discard block |
||
| 813 | 813 | * @param TControl control element or element id |
| 814 | 814 | * @param array visual effect key-value pair options. |
| 815 | 815 | */ |
| 816 | - public function squish($element, $options = []) |
|
| 816 | + public function squish($element, $options=[]) |
|
| 817 | 817 | { |
| 818 | - $options['origin'] = ['top', 'left']; |
|
| 819 | - $options['percent'] = 0; |
|
| 818 | + $options['origin']=['top', 'left']; |
|
| 819 | + $options['percent']=0; |
|
| 820 | 820 | $this->scale($element, $options); |
| 821 | 821 | } |
| 822 | 822 | |
@@ -826,10 +826,10 @@ discard block |
||
| 826 | 826 | * @param TControl control element or element id |
| 827 | 827 | * @param array visual effect key-value pair options. |
| 828 | 828 | */ |
| 829 | - public function switchOff($element, $options = []) |
|
| 829 | + public function switchOff($element, $options=[]) |
|
| 830 | 830 | { |
| 831 | - $options['direction'] = 'vertical'; |
|
| 832 | - $options['percent'] = 0; |
|
| 831 | + $options['direction']='vertical'; |
|
| 832 | + $options['percent']=0; |
|
| 833 | 833 | $this->scale($element, $options); |
| 834 | 834 | } |
| 835 | 835 | |
@@ -30,6 +30,7 @@ |
||
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Creates a new TCallbackEventParameter. |
| 33 | + * @param \Prado\Web\THttpResponse $response |
|
| 33 | 34 | */ |
| 34 | 35 | public function __construct($response, $parameter, $index = -1) |
| 35 | 36 | { |
@@ -26,15 +26,15 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class TJuiAutoCompleteEventParameter extends TCallbackEventParameter |
| 28 | 28 | { |
| 29 | - private $_selectedIndex = -1; |
|
| 29 | + private $_selectedIndex=-1; |
|
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | 32 | * Creates a new TCallbackEventParameter. |
| 33 | 33 | */ |
| 34 | - public function __construct($response, $parameter, $index = -1) |
|
| 34 | + public function __construct($response, $parameter, $index=-1) |
|
| 35 | 35 | { |
| 36 | 36 | parent::__construct($response, $parameter); |
| 37 | - $this->_selectedIndex = $index; |
|
| 37 | + $this->_selectedIndex=$index; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -154,6 +154,7 @@ discard block |
||
| 154 | 154 | * Registers Prado javascript by library name. See "Web/Javascripts/packages.php" |
| 155 | 155 | * for library names. |
| 156 | 156 | * @param string script library name. |
| 157 | + * @param string $name |
|
| 157 | 158 | */ |
| 158 | 159 | public function registerPradoScript($name) |
| 159 | 160 | { |
@@ -267,7 +268,7 @@ discard block |
||
| 267 | 268 | |
| 268 | 269 | /** |
| 269 | 270 | * @param string javascript or css package path. |
| 270 | - * @return array tuple($path,$url). |
|
| 271 | + * @return string[] tuple($path,$url). |
|
| 271 | 272 | */ |
| 272 | 273 | protected function getPackagePathUrl($base) |
| 273 | 274 | { |
@@ -359,6 +360,7 @@ discard block |
||
| 359 | 360 | * the javascript code registration. |
| 360 | 361 | * @param string javascript class responsible for the control being registered for postback |
| 361 | 362 | * @param array postback options |
| 363 | + * @param string $class |
|
| 362 | 364 | */ |
| 363 | 365 | public function registerPostBackControl($class, $options) |
| 364 | 366 | { |
@@ -438,6 +440,7 @@ discard block |
||
| 438 | 440 | * Registers Prado style by library name. See "Web/Javascripts/packages.php" |
| 439 | 441 | * for library names. |
| 440 | 442 | * @param string style library name. |
| 443 | + * @param string $name |
|
| 441 | 444 | */ |
| 442 | 445 | public function registerPradoStyle($name) |
| 443 | 446 | { |
@@ -618,6 +621,7 @@ discard block |
||
| 618 | 621 | * Registers a javascript script block at the beginning of the form |
| 619 | 622 | * @param string a unique key identifying the script block |
| 620 | 623 | * @param string javascript block |
| 624 | + * @param string $key |
|
| 621 | 625 | */ |
| 622 | 626 | public function registerBeginScript($key, $script) |
| 623 | 627 | { |
@@ -646,6 +650,7 @@ discard block |
||
| 646 | 650 | * @param string a unique key identifying the hidden field |
| 647 | 651 | * @param string|array hidden field value, if the value is an array, every element |
| 648 | 652 | * in the array will be rendered as a hidden field value. |
| 653 | + * @param string $name |
|
| 649 | 654 | */ |
| 650 | 655 | public function registerHiddenField($name, $value) |
| 651 | 656 | { |
@@ -657,6 +662,7 @@ discard block |
||
| 657 | 662 | |
| 658 | 663 | /** |
| 659 | 664 | * @param string a unique key |
| 665 | + * @param string $key |
|
| 660 | 666 | * @return boolean whether there is a CSS file registered with the specified key |
| 661 | 667 | */ |
| 662 | 668 | public function isStyleSheetFileRegistered($key) |
@@ -693,6 +699,7 @@ discard block |
||
| 693 | 699 | |
| 694 | 700 | /** |
| 695 | 701 | * @param string a unique key |
| 702 | + * @param string $key |
|
| 696 | 703 | * @return boolean whether there is a javascript file registered with the specified key |
| 697 | 704 | */ |
| 698 | 705 | public function isScriptFileRegistered($key) |
@@ -873,6 +880,7 @@ discard block |
||
| 873 | 880 | * Flushes all pending script registrations |
| 874 | 881 | * @param THtmlWriter writer for the rendering purpose |
| 875 | 882 | * @param TControl the control forcing the flush (used only in error messages) |
| 883 | + * @param WebControls\TClientScript $control |
|
| 876 | 884 | */ |
| 877 | 885 | public function flushScriptFiles($writer, $control = null) |
| 878 | 886 | { |
@@ -889,6 +897,7 @@ discard block |
||
| 889 | 897 | * Unfortunately this attribute is invalid for hidden fields, so text fields are |
| 890 | 898 | * rendered instead (#642). |
| 891 | 899 | * @param THtmlWriter writer for the rendering purpose |
| 900 | + * @param boolean $initial |
|
| 892 | 901 | */ |
| 893 | 902 | |
| 894 | 903 | protected function renderHiddenFieldsInt($writer, $initial) |
@@ -34,11 +34,11 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -275,8 +275,7 @@ discard block |
||
| 275 | 275 | if(strpos($base, $assets->getBaseUrl()) === false) |
| 276 | 276 | { |
| 277 | 277 | return [$assets->getPublishedPath($base), $assets->publishFilePath($base)]; |
| 278 | - } |
|
| 279 | - else |
|
| 278 | + } else |
|
| 280 | 279 | { |
| 281 | 280 | return [$assets->getBasePath() . str_replace($assets->getBaseUrl(), '', $base), $base]; |
| 282 | 281 | } |
@@ -903,8 +902,7 @@ discard block |
||
| 903 | 902 | { |
| 904 | 903 | foreach($value as $v) |
| 905 | 904 | $str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '[]" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n"; |
| 906 | - } |
|
| 907 | - else |
|
| 905 | + } else |
|
| 908 | 906 | { |
| 909 | 907 | $str .= '<input type="text" style="display:none" autocomplete="off" name="' . $name . '" id="' . $id . '" value="' . THttpUtility::htmlEncode($value) . "\" />\n"; |
| 910 | 908 | } |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * the control ID will take the precedence. |
| 214 | 214 | * |
| 215 | 215 | * @param string the property name or control ID |
| 216 | - * @return bool wether the control or property exists |
|
| 216 | + * @return boolean|null wether the control or property exists |
|
| 217 | 217 | * @see __get |
| 218 | 218 | */ |
| 219 | 219 | public function __isset($name) { |
@@ -290,6 +290,7 @@ discard block |
||
| 290 | 290 | * Sets the page for a control. |
| 291 | 291 | * Only framework developers should use this method. |
| 292 | 292 | * @param TPage the page that contains this control |
| 293 | + * @param TPage $page |
|
| 293 | 294 | */ |
| 294 | 295 | public function setPage($page) |
| 295 | 296 | { |
@@ -571,6 +572,7 @@ discard block |
||
| 571 | 572 | |
| 572 | 573 | /** |
| 573 | 574 | * @param boolean whether the control is visible |
| 575 | + * @param boolean $value |
|
| 574 | 576 | */ |
| 575 | 577 | public function setVisible($value) |
| 576 | 578 | { |
@@ -638,6 +640,7 @@ discard block |
||
| 638 | 640 | } |
| 639 | 641 | |
| 640 | 642 | /** |
| 643 | + * @param string $name |
|
| 641 | 644 | * @return boolean whether the named attribute exists |
| 642 | 645 | */ |
| 643 | 646 | public function hasAttribute($name) |
@@ -649,6 +652,7 @@ discard block |
||
| 649 | 652 | } |
| 650 | 653 | |
| 651 | 654 | /** |
| 655 | + * @param string $name |
|
| 652 | 656 | * @return string attribute value, null if attribute does not exist |
| 653 | 657 | */ |
| 654 | 658 | public function getAttribute($name) |
@@ -663,6 +667,7 @@ discard block |
||
| 663 | 667 | * Sets a custom control attribute. |
| 664 | 668 | * @param string attribute name |
| 665 | 669 | * @param string value of the attribute |
| 670 | + * @param string $name |
|
| 666 | 671 | */ |
| 667 | 672 | public function setAttribute($name, $value) |
| 668 | 673 | { |
@@ -700,6 +705,7 @@ discard block |
||
| 700 | 705 | |
| 701 | 706 | /** |
| 702 | 707 | * @param boolean set whether to enable viewstate |
| 708 | + * @param boolean $value |
|
| 703 | 709 | */ |
| 704 | 710 | public function setEnableViewState($value) |
| 705 | 711 | { |
@@ -716,6 +722,8 @@ discard block |
||
| 716 | 722 | * that must be kept in controlstate. |
| 717 | 723 | * @param string the name of the controlstate value to be returned |
| 718 | 724 | * @param mixed the default value. If $key is not found in controlstate, $defaultValue will be returned |
| 725 | + * @param string $key |
|
| 726 | + * @param integer $defaultValue |
|
| 719 | 727 | * @return mixed the controlstate value corresponding to $key |
| 720 | 728 | */ |
| 721 | 729 | protected function getControlState($key, $defaultValue = null) |
@@ -732,6 +740,8 @@ discard block |
||
| 732 | 740 | * @param string the name of the controlstate value |
| 733 | 741 | * @param mixed the controlstate value to be set |
| 734 | 742 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from controlstate |
| 743 | + * @param string $key |
|
| 744 | + * @param integer $defaultValue |
|
| 735 | 745 | */ |
| 736 | 746 | protected function setControlState($key, $value, $defaultValue = null) |
| 737 | 747 | { |
@@ -755,6 +765,7 @@ discard block |
||
| 755 | 765 | * When it is false, data saved via setViewState() will not be persisted. |
| 756 | 766 | * By default, it is true, meaning data will be persisted across postbacks. |
| 757 | 767 | * @param boolean whether data should be persisted |
| 768 | + * @param boolean $enabled |
|
| 758 | 769 | */ |
| 759 | 770 | public function trackViewState($enabled) |
| 760 | 771 | { |
@@ -768,6 +779,7 @@ discard block |
||
| 768 | 779 | * that must be kept in viewstate. |
| 769 | 780 | * @param string the name of the viewstate value to be returned |
| 770 | 781 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
| 782 | + * @param string $key |
|
| 771 | 783 | * @return mixed the viewstate value corresponding to $key |
| 772 | 784 | */ |
| 773 | 785 | public function getViewState($key, $defaultValue = null) |
@@ -793,6 +805,7 @@ discard block |
||
| 793 | 805 | * @param string the name of the viewstate value |
| 794 | 806 | * @param mixed the viewstate value to be set |
| 795 | 807 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
| 808 | + * @param string $key |
|
| 796 | 809 | */ |
| 797 | 810 | public function setViewState($key, $value, $defaultValue = null) |
| 798 | 811 | { |
@@ -814,6 +827,7 @@ discard block |
||
| 814 | 827 | /** |
| 815 | 828 | * Clears a viewstate value. |
| 816 | 829 | * @param string the name of the viewstate value to be cleared |
| 830 | + * @param string $key |
|
| 817 | 831 | */ |
| 818 | 832 | public function clearViewState($key) |
| 819 | 833 | { |
@@ -919,6 +933,7 @@ discard block |
||
| 919 | 933 | * Sets a value indicating whether child controls are created. |
| 920 | 934 | * If false, any existing child controls will be cleared up. |
| 921 | 935 | * @param boolean whether child controls are created |
| 936 | + * @param boolean $value |
|
| 922 | 937 | */ |
| 923 | 938 | final protected function setChildControlsCreated($value) |
| 924 | 939 | { |
@@ -1009,6 +1024,7 @@ discard block |
||
| 1009 | 1024 | * Finds all child and grand-child controls that are of the specified type. |
| 1010 | 1025 | * @param string the class name |
| 1011 | 1026 | * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned. |
| 1027 | + * @param string $type |
|
| 1012 | 1028 | * @return array list of controls found |
| 1013 | 1029 | */ |
| 1014 | 1030 | public function findControlsByType($type, $strict = true) |
@@ -1069,7 +1085,7 @@ discard block |
||
| 1069 | 1085 | * A registered object can be accessed like a public member variable. |
| 1070 | 1086 | * This method should only be used by framework and control developers. |
| 1071 | 1087 | * @param string name of the object |
| 1072 | - * @param object object to be declared |
|
| 1088 | + * @param object WebControls\TCheckBox to be declared |
|
| 1073 | 1089 | * @see __get |
| 1074 | 1090 | */ |
| 1075 | 1091 | public function registerObject($name, $object) |
@@ -1143,6 +1159,7 @@ discard block |
||
| 1143 | 1159 | * A component with explicit ID on a template will be registered to |
| 1144 | 1160 | * the template owner. This method allows you to obtain this component |
| 1145 | 1161 | * with the ID. |
| 1162 | + * @param string $name |
|
| 1146 | 1163 | * @return mixed the named registered object. Null if object is not found. |
| 1147 | 1164 | */ |
| 1148 | 1165 | public function getRegisteredObject($name) |
@@ -1200,6 +1217,7 @@ discard block |
||
| 1200 | 1217 | * Control lifecycles will be caught up during the addition. |
| 1201 | 1218 | * Only framework developers should use this method. |
| 1202 | 1219 | * @param TControl the new child control |
| 1220 | + * @param TControl $control |
|
| 1203 | 1221 | */ |
| 1204 | 1222 | public function addedControl($control) |
| 1205 | 1223 | { |
@@ -1245,6 +1263,7 @@ discard block |
||
| 1245 | 1263 | * Removes a control from the child collection of the control. |
| 1246 | 1264 | * Only framework developers should use this method. |
| 1247 | 1265 | * @param TControl the child control removed |
| 1266 | + * @param TControl $control |
|
| 1248 | 1267 | */ |
| 1249 | 1268 | public function removedControl($control) |
| 1250 | 1269 | { |
@@ -1496,6 +1515,7 @@ discard block |
||
| 1496 | 1515 | * @param string name of the broadcast event |
| 1497 | 1516 | * @param TControl sender of the event |
| 1498 | 1517 | * @param TBroadcastEventParameter event parameter |
| 1518 | + * @param TBroadcastEventParameter $param |
|
| 1499 | 1519 | */ |
| 1500 | 1520 | private function broadcastEventInternal($name, $sender, $param) |
| 1501 | 1521 | { |
@@ -1720,6 +1740,7 @@ discard block |
||
| 1720 | 1740 | * Clears the cached UniqueID. |
| 1721 | 1741 | * If $recursive=true, all children's cached UniqueID will be cleared as well. |
| 1722 | 1742 | * @param boolean whether the clearing is recursive. |
| 1743 | + * @param boolean $recursive |
|
| 1723 | 1744 | */ |
| 1724 | 1745 | private function clearCachedUniqueID($recursive) |
| 1725 | 1746 | { |
@@ -1757,6 +1778,7 @@ discard block |
||
| 1757 | 1778 | * Updates the list of the controls whose IDs are managed by the specified naming container. |
| 1758 | 1779 | * @param TControl the naming container |
| 1759 | 1780 | * @param TControlCollection list of controls |
| 1781 | + * @param TControl $container |
|
| 1760 | 1782 | * @throws TInvalidDataValueException if a control's ID is not unique within its naming container. |
| 1761 | 1783 | */ |
| 1762 | 1784 | private function fillNameTable($container, $controls) |
@@ -75,61 +75,61 @@ discard block |
||
| 75 | 75 | /** |
| 76 | 76 | * format of control ID |
| 77 | 77 | */ |
| 78 | - const ID_FORMAT = '/^[a-zA-Z_]\\w*$/'; |
|
| 78 | + const ID_FORMAT='/^[a-zA-Z_]\\w*$/'; |
|
| 79 | 79 | /** |
| 80 | 80 | * separator char between IDs in a UniqueID |
| 81 | 81 | */ |
| 82 | - const ID_SEPARATOR = '$'; |
|
| 82 | + const ID_SEPARATOR='$'; |
|
| 83 | 83 | /** |
| 84 | 84 | * separator char between IDs in a ClientID |
| 85 | 85 | */ |
| 86 | - const CLIENT_ID_SEPARATOR = '_'; |
|
| 86 | + const CLIENT_ID_SEPARATOR='_'; |
|
| 87 | 87 | /** |
| 88 | 88 | * prefix to an ID automatically generated |
| 89 | 89 | */ |
| 90 | - const AUTOMATIC_ID_PREFIX = 'ctl'; |
|
| 90 | + const AUTOMATIC_ID_PREFIX='ctl'; |
|
| 91 | 91 | |
| 92 | 92 | /** |
| 93 | 93 | * the stage of lifecycles that the control is currently at |
| 94 | 94 | */ |
| 95 | - const CS_CONSTRUCTED = 0; |
|
| 96 | - const CS_CHILD_INITIALIZED = 1; |
|
| 97 | - const CS_INITIALIZED = 2; |
|
| 98 | - const CS_STATE_LOADED = 3; |
|
| 99 | - const CS_LOADED = 4; |
|
| 100 | - const CS_PRERENDERED = 5; |
|
| 95 | + const CS_CONSTRUCTED=0; |
|
| 96 | + const CS_CHILD_INITIALIZED=1; |
|
| 97 | + const CS_INITIALIZED=2; |
|
| 98 | + const CS_STATE_LOADED=3; |
|
| 99 | + const CS_LOADED=4; |
|
| 100 | + const CS_PRERENDERED=5; |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * State bits. |
| 104 | 104 | */ |
| 105 | - const IS_ID_SET = 0x01; |
|
| 106 | - const IS_DISABLE_VIEWSTATE = 0x02; |
|
| 107 | - const IS_SKIN_APPLIED = 0x04; |
|
| 108 | - const IS_STYLESHEET_APPLIED = 0x08; |
|
| 109 | - const IS_DISABLE_THEMING = 0x10; |
|
| 110 | - const IS_CHILD_CREATED = 0x20; |
|
| 111 | - const IS_CREATING_CHILD = 0x40; |
|
| 105 | + const IS_ID_SET=0x01; |
|
| 106 | + const IS_DISABLE_VIEWSTATE=0x02; |
|
| 107 | + const IS_SKIN_APPLIED=0x04; |
|
| 108 | + const IS_STYLESHEET_APPLIED=0x08; |
|
| 109 | + const IS_DISABLE_THEMING=0x10; |
|
| 110 | + const IS_CHILD_CREATED=0x20; |
|
| 111 | + const IS_CREATING_CHILD=0x40; |
|
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Indexes for the rare fields. |
| 115 | 115 | * In order to save memory, rare fields will only be created if they are needed. |
| 116 | 116 | */ |
| 117 | - const RF_CONTROLS = 0; // child controls |
|
| 118 | - const RF_CHILD_STATE = 1; // child state field |
|
| 119 | - const RF_NAMED_CONTROLS = 2; // list of controls whose namingcontainer is this control |
|
| 120 | - const RF_NAMED_CONTROLS_ID = 3; // counter for automatic id |
|
| 121 | - const RF_SKIN_ID = 4; // skin ID |
|
| 122 | - const RF_DATA_BINDINGS = 5; // data bindings |
|
| 123 | - const RF_EVENTS = 6; // event handlers |
|
| 124 | - const RF_CONTROLSTATE = 7; // controlstate |
|
| 125 | - const RF_NAMED_OBJECTS = 8; // controls declared with ID on template |
|
| 126 | - const RF_ADAPTER = 9; // adapter |
|
| 127 | - const RF_AUTO_BINDINGS = 10; // auto data bindings |
|
| 117 | + const RF_CONTROLS=0; // child controls |
|
| 118 | + const RF_CHILD_STATE=1; // child state field |
|
| 119 | + const RF_NAMED_CONTROLS=2; // list of controls whose namingcontainer is this control |
|
| 120 | + const RF_NAMED_CONTROLS_ID=3; // counter for automatic id |
|
| 121 | + const RF_SKIN_ID=4; // skin ID |
|
| 122 | + const RF_DATA_BINDINGS=5; // data bindings |
|
| 123 | + const RF_EVENTS=6; // event handlers |
|
| 124 | + const RF_CONTROLSTATE=7; // controlstate |
|
| 125 | + const RF_NAMED_OBJECTS=8; // controls declared with ID on template |
|
| 126 | + const RF_ADAPTER=9; // adapter |
|
| 127 | + const RF_AUTO_BINDINGS=10; // auto data bindings |
|
| 128 | 128 | |
| 129 | 129 | /** |
| 130 | 130 | * @var string control ID |
| 131 | 131 | */ |
| 132 | - private $_id = ''; |
|
| 132 | + private $_id=''; |
|
| 133 | 133 | /** |
| 134 | 134 | * @var string control unique ID |
| 135 | 135 | */ |
@@ -153,27 +153,27 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * @var array viewstate data |
| 155 | 155 | */ |
| 156 | - private $_viewState = []; |
|
| 156 | + private $_viewState=[]; |
|
| 157 | 157 | /** |
| 158 | 158 | * @var array temporary state (usually set in template) |
| 159 | 159 | */ |
| 160 | - private $_tempState = []; |
|
| 160 | + private $_tempState=[]; |
|
| 161 | 161 | /** |
| 162 | 162 | * @var boolean whether we should keep state in viewstate |
| 163 | 163 | */ |
| 164 | - private $_trackViewState = true; |
|
| 164 | + private $_trackViewState=true; |
|
| 165 | 165 | /** |
| 166 | 166 | * @var integer the current stage of the control lifecycles |
| 167 | 167 | */ |
| 168 | - private $_stage = 0; |
|
| 168 | + private $_stage=0; |
|
| 169 | 169 | /** |
| 170 | 170 | * @var integer representation of the state bits |
| 171 | 171 | */ |
| 172 | - private $_flags = 0; |
|
| 172 | + private $_flags=0; |
|
| 173 | 173 | /** |
| 174 | 174 | * @var array a collection of rare control data |
| 175 | 175 | */ |
| 176 | - private $_rf = []; |
|
| 176 | + private $_rf=[]; |
|
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | 179 | * Returns a property value by name or a control by ID. |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function getAdapter() |
| 239 | 239 | { |
| 240 | - return isset($this->_rf[self::RF_ADAPTER])?$this->_rf[self::RF_ADAPTER]:null; |
|
| 240 | + return isset($this->_rf[self::RF_ADAPTER]) ? $this->_rf[self::RF_ADAPTER] : null; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | /** |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | */ |
| 246 | 246 | public function setAdapter(TControlAdapter $adapter) |
| 247 | 247 | { |
| 248 | - $this->_rf[self::RF_ADAPTER] = $adapter; |
|
| 248 | + $this->_rf[self::RF_ADAPTER]=$adapter; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | /** |
@@ -264,9 +264,9 @@ discard block |
||
| 264 | 264 | if(!$this->_namingContainer && $this->_parent) |
| 265 | 265 | { |
| 266 | 266 | if($this->_parent instanceof INamingContainer) |
| 267 | - $this->_namingContainer = $this->_parent; |
|
| 267 | + $this->_namingContainer=$this->_parent; |
|
| 268 | 268 | else |
| 269 | - $this->_namingContainer = $this->_parent->getNamingContainer(); |
|
| 269 | + $this->_namingContainer=$this->_parent->getNamingContainer(); |
|
| 270 | 270 | } |
| 271 | 271 | return $this->_namingContainer; |
| 272 | 272 | } |
@@ -279,9 +279,9 @@ discard block |
||
| 279 | 279 | if(!$this->_page) |
| 280 | 280 | { |
| 281 | 281 | if($this->_parent) |
| 282 | - $this->_page = $this->_parent->getPage(); |
|
| 282 | + $this->_page=$this->_parent->getPage(); |
|
| 283 | 283 | elseif($this->_tplControl) |
| 284 | - $this->_page = $this->_tplControl->getPage(); |
|
| 284 | + $this->_page=$this->_tplControl->getPage(); |
|
| 285 | 285 | } |
| 286 | 286 | return $this->_page; |
| 287 | 287 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | */ |
| 294 | 294 | public function setPage($page) |
| 295 | 295 | { |
| 296 | - $this->_page = $page; |
|
| 296 | + $this->_page=$page; |
|
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | /** |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | */ |
| 304 | 304 | public function setTemplateControl($control) |
| 305 | 305 | { |
| 306 | - $this->_tplControl = $control; |
|
| 306 | + $this->_tplControl=$control; |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | /** |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | public function getTemplateControl() |
| 313 | 313 | { |
| 314 | 314 | if(!$this->_tplControl && $this->_parent) |
| 315 | - $this->_tplControl = $this->_parent->getTemplateControl(); |
|
| 315 | + $this->_tplControl=$this->_parent->getTemplateControl(); |
|
| 316 | 316 | return $this->_tplControl; |
| 317 | 317 | } |
| 318 | 318 | |
@@ -323,8 +323,8 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | public function getSourceTemplateControl() |
| 325 | 325 | { |
| 326 | - $control = $this; |
|
| 327 | - while(($control instanceof TControl) && ($control = $control->getTemplateControl()) !== null) |
|
| 326 | + $control=$this; |
|
| 327 | + while(($control instanceof TControl) && ($control=$control->getTemplateControl())!==null) |
|
| 328 | 328 | { |
| 329 | 329 | if(($control instanceof TTemplateControl) && $control->getIsSourceTemplateControl()) |
| 330 | 330 | return $control; |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | protected function setControlStage($value) |
| 355 | 355 | { |
| 356 | - $this->_stage = $value; |
|
| 356 | + $this->_stage=$value; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @param boolean whether to hide automatically generated ID |
| 364 | 364 | * @return string the ID of the control |
| 365 | 365 | */ |
| 366 | - public function getID($hideAutoID = true) |
|
| 366 | + public function getID($hideAutoID=true) |
|
| 367 | 367 | { |
| 368 | 368 | if($hideAutoID) |
| 369 | 369 | return ($this->_flags & self::IS_ID_SET) ? $this->_id : ''; |
@@ -379,8 +379,8 @@ discard block |
||
| 379 | 379 | { |
| 380 | 380 | if(!preg_match(self::ID_FORMAT, $id)) |
| 381 | 381 | throw new TInvalidDataValueException('control_id_invalid', get_class($this), $id); |
| 382 | - $this->_id = $id; |
|
| 383 | - $this->_flags |= self::IS_ID_SET; |
|
| 382 | + $this->_id=$id; |
|
| 383 | + $this->_flags|=self::IS_ID_SET; |
|
| 384 | 384 | $this->clearCachedUniqueID($this instanceof INamingContainer); |
| 385 | 385 | if($this->_namingContainer) |
| 386 | 386 | $this->_namingContainer->clearNameTable(); |
@@ -395,17 +395,17 @@ discard block |
||
| 395 | 395 | */ |
| 396 | 396 | public function getUniqueID() |
| 397 | 397 | { |
| 398 | - if($this->_uid === '' || $this->_uid === null) // need to build the UniqueID |
|
| 398 | + if($this->_uid==='' || $this->_uid===null) // need to build the UniqueID |
|
| 399 | 399 | { |
| 400 | - $this->_uid = ''; // set to not-null, so that clearCachedUniqueID() may take action |
|
| 401 | - if($namingContainer = $this->getNamingContainer()) |
|
| 400 | + $this->_uid=''; // set to not-null, so that clearCachedUniqueID() may take action |
|
| 401 | + if($namingContainer=$this->getNamingContainer()) |
|
| 402 | 402 | { |
| 403 | - if($this->getPage() === $namingContainer) |
|
| 404 | - return ($this->_uid = $this->_id); |
|
| 405 | - elseif(($prefix = $namingContainer->getUniqueID()) === '') |
|
| 403 | + if($this->getPage()===$namingContainer) |
|
| 404 | + return ($this->_uid=$this->_id); |
|
| 405 | + elseif(($prefix=$namingContainer->getUniqueID())==='') |
|
| 406 | 406 | return $this->_id; |
| 407 | 407 | else |
| 408 | - return ($this->_uid = $prefix . self::ID_SEPARATOR . $this->_id); |
|
| 408 | + return ($this->_uid=$prefix.self::ID_SEPARATOR.$this->_id); |
|
| 409 | 409 | } |
| 410 | 410 | else // no naming container |
| 411 | 411 | return $this->_id; |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | */ |
| 450 | 450 | public function getSkinID() |
| 451 | 451 | { |
| 452 | - return isset($this->_rf[self::RF_SKIN_ID])?$this->_rf[self::RF_SKIN_ID]:''; |
|
| 452 | + return isset($this->_rf[self::RF_SKIN_ID]) ? $this->_rf[self::RF_SKIN_ID] : ''; |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | /** |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | if(($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage >= self::CS_CHILD_INITIALIZED) |
| 462 | 462 | throw new TInvalidOperationException('control_skinid_unchangeable', get_class($this)); |
| 463 | 463 | else |
| 464 | - $this->_rf[self::RF_SKIN_ID] = $value; |
|
| 464 | + $this->_rf[self::RF_SKIN_ID]=$value; |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /** |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | if($this->_flags & self::IS_DISABLE_THEMING) |
| 483 | 483 | return false; |
| 484 | 484 | else |
| 485 | - return $this->_parent?$this->_parent->getEnableTheming():true; |
|
| 485 | + return $this->_parent ? $this->_parent->getEnableTheming() : true; |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | /** |
@@ -494,9 +494,9 @@ discard block |
||
| 494 | 494 | if($this->_stage >= self::CS_CHILD_INITIALIZED) |
| 495 | 495 | throw new TInvalidOperationException('control_enabletheming_unchangeable', get_class($this), $this->getUniqueID()); |
| 496 | 496 | elseif(TPropertyValue::ensureBoolean($value)) |
| 497 | - $this->_flags &= ~self::IS_DISABLE_THEMING; |
|
| 497 | + $this->_flags&=~self::IS_DISABLE_THEMING; |
|
| 498 | 498 | else |
| 499 | - $this->_flags |= self::IS_DISABLE_THEMING; |
|
| 499 | + $this->_flags|=self::IS_DISABLE_THEMING; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | /** |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | public function getControls() |
| 536 | 536 | { |
| 537 | 537 | if(!isset($this->_rf[self::RF_CONTROLS])) |
| 538 | - $this->_rf[self::RF_CONTROLS] = $this->createControlCollection(); |
|
| 538 | + $this->_rf[self::RF_CONTROLS]=$this->createControlCollection(); |
|
| 539 | 539 | return $this->_rf[self::RF_CONTROLS]; |
| 540 | 540 | } |
| 541 | 541 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | */ |
| 547 | 547 | protected function createControlCollection() |
| 548 | 548 | { |
| 549 | - return $this->getAllowChildControls()?new TControlCollection($this):new TEmptyControlCollection($this); |
|
| 549 | + return $this->getAllowChildControls() ? new TControlCollection($this) : new TEmptyControlCollection($this); |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | /** |
@@ -556,11 +556,11 @@ discard block |
||
| 556 | 556 | * @param boolean whether the parents should also be checked if visible |
| 557 | 557 | * @return boolean whether the control is visible (default=true). |
| 558 | 558 | */ |
| 559 | - public function getVisible($checkParents = true) |
|
| 559 | + public function getVisible($checkParents=true) |
|
| 560 | 560 | { |
| 561 | 561 | if($checkParents) |
| 562 | 562 | { |
| 563 | - for($control = $this;$control;$control = $control->_parent) |
|
| 563 | + for($control=$this; $control; $control=$control->_parent) |
|
| 564 | 564 | if(!$control->getVisible(false)) |
| 565 | 565 | return false; |
| 566 | 566 | return true; |
@@ -587,11 +587,11 @@ discard block |
||
| 587 | 587 | * @param boolean whether the parents should also be checked enabled |
| 588 | 588 | * @return boolean whether the control is enabled. |
| 589 | 589 | */ |
| 590 | - public function getEnabled($checkParents = false) |
|
| 590 | + public function getEnabled($checkParents=false) |
|
| 591 | 591 | { |
| 592 | 592 | if($checkParents) |
| 593 | 593 | { |
| 594 | - for($control = $this;$control;$control = $control->_parent) |
|
| 594 | + for($control=$this; $control; $control=$control->_parent) |
|
| 595 | 595 | if(!$control->getViewState('Enabled', true)) |
| 596 | 596 | return false; |
| 597 | 597 | return true; |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | */ |
| 614 | 614 | public function getHasAttributes() |
| 615 | 615 | { |
| 616 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 616 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 617 | 617 | return $attributes->getCount() > 0; |
| 618 | 618 | else |
| 619 | 619 | return false; |
@@ -627,11 +627,11 @@ discard block |
||
| 627 | 627 | */ |
| 628 | 628 | public function getAttributes() |
| 629 | 629 | { |
| 630 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 630 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 631 | 631 | return $attributes; |
| 632 | 632 | else |
| 633 | 633 | { |
| 634 | - $attributes = new TAttributeCollection; |
|
| 634 | + $attributes=new TAttributeCollection; |
|
| 635 | 635 | $this->setViewState('Attributes', $attributes, null); |
| 636 | 636 | return $attributes; |
| 637 | 637 | } |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | */ |
| 643 | 643 | public function hasAttribute($name) |
| 644 | 644 | { |
| 645 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 645 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 646 | 646 | return $attributes->contains($name); |
| 647 | 647 | else |
| 648 | 648 | return false; |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | */ |
| 654 | 654 | public function getAttribute($name) |
| 655 | 655 | { |
| 656 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 656 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 657 | 657 | return $attributes->itemAt($name); |
| 658 | 658 | else |
| 659 | 659 | return null; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | */ |
| 677 | 677 | public function removeAttribute($name) |
| 678 | 678 | { |
| 679 | - if($attributes = $this->getViewState('Attributes', null)) |
|
| 679 | + if($attributes=$this->getViewState('Attributes', null)) |
|
| 680 | 680 | return $attributes->remove($name); |
| 681 | 681 | else |
| 682 | 682 | return null; |
@@ -685,11 +685,11 @@ discard block |
||
| 685 | 685 | /** |
| 686 | 686 | * @return boolean whether viewstate is enabled |
| 687 | 687 | */ |
| 688 | - public function getEnableViewState($checkParents = false) |
|
| 688 | + public function getEnableViewState($checkParents=false) |
|
| 689 | 689 | { |
| 690 | 690 | if($checkParents) |
| 691 | 691 | { |
| 692 | - for($control = $this;$control !== null;$control = $control->getParent()) |
|
| 692 | + for($control=$this; $control!==null; $control=$control->getParent()) |
|
| 693 | 693 | if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
| 694 | 694 | return false; |
| 695 | 695 | return true; |
@@ -704,9 +704,9 @@ discard block |
||
| 704 | 704 | public function setEnableViewState($value) |
| 705 | 705 | { |
| 706 | 706 | if(TPropertyValue::ensureBoolean($value)) |
| 707 | - $this->_flags &= ~self::IS_DISABLE_VIEWSTATE; |
|
| 707 | + $this->_flags&=~self::IS_DISABLE_VIEWSTATE; |
|
| 708 | 708 | else |
| 709 | - $this->_flags |= self::IS_DISABLE_VIEWSTATE; |
|
| 709 | + $this->_flags|=self::IS_DISABLE_VIEWSTATE; |
|
| 710 | 710 | } |
| 711 | 711 | |
| 712 | 712 | /** |
@@ -718,9 +718,9 @@ discard block |
||
| 718 | 718 | * @param mixed the default value. If $key is not found in controlstate, $defaultValue will be returned |
| 719 | 719 | * @return mixed the controlstate value corresponding to $key |
| 720 | 720 | */ |
| 721 | - protected function getControlState($key, $defaultValue = null) |
|
| 721 | + protected function getControlState($key, $defaultValue=null) |
|
| 722 | 722 | { |
| 723 | - return isset($this->_rf[self::RF_CONTROLSTATE][$key])?$this->_rf[self::RF_CONTROLSTATE][$key]:$defaultValue; |
|
| 723 | + return isset($this->_rf[self::RF_CONTROLSTATE][$key]) ? $this->_rf[self::RF_CONTROLSTATE][$key] : $defaultValue; |
|
| 724 | 724 | } |
| 725 | 725 | |
| 726 | 726 | /** |
@@ -733,12 +733,12 @@ discard block |
||
| 733 | 733 | * @param mixed the controlstate value to be set |
| 734 | 734 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from controlstate |
| 735 | 735 | */ |
| 736 | - protected function setControlState($key, $value, $defaultValue = null) |
|
| 736 | + protected function setControlState($key, $value, $defaultValue=null) |
|
| 737 | 737 | { |
| 738 | - if($value === $defaultValue) |
|
| 738 | + if($value===$defaultValue) |
|
| 739 | 739 | unset($this->_rf[self::RF_CONTROLSTATE][$key]); |
| 740 | 740 | else |
| 741 | - $this->_rf[self::RF_CONTROLSTATE][$key] = $value; |
|
| 741 | + $this->_rf[self::RF_CONTROLSTATE][$key]=$value; |
|
| 742 | 742 | } |
| 743 | 743 | |
| 744 | 744 | /** |
@@ -758,7 +758,7 @@ discard block |
||
| 758 | 758 | */ |
| 759 | 759 | public function trackViewState($enabled) |
| 760 | 760 | { |
| 761 | - $this->_trackViewState = TPropertyValue::ensureBoolean($enabled); |
|
| 761 | + $this->_trackViewState=TPropertyValue::ensureBoolean($enabled); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | /** |
@@ -770,14 +770,14 @@ discard block |
||
| 770 | 770 | * @param mixed the default value. If $key is not found in viewstate, $defaultValue will be returned |
| 771 | 771 | * @return mixed the viewstate value corresponding to $key |
| 772 | 772 | */ |
| 773 | - public function getViewState($key, $defaultValue = null) |
|
| 773 | + public function getViewState($key, $defaultValue=null) |
|
| 774 | 774 | { |
| 775 | 775 | if(isset($this->_viewState[$key])) |
| 776 | - return $this->_viewState[$key] !== null?$this->_viewState[$key]:$defaultValue; |
|
| 776 | + return $this->_viewState[$key]!==null ? $this->_viewState[$key] : $defaultValue; |
|
| 777 | 777 | elseif(isset($this->_tempState[$key])) |
| 778 | 778 | { |
| 779 | 779 | if(is_object($this->_tempState[$key]) && $this->_trackViewState) |
| 780 | - $this->_viewState[$key] = $this->_tempState[$key]; |
|
| 780 | + $this->_viewState[$key]=$this->_tempState[$key]; |
|
| 781 | 781 | return $this->_tempState[$key]; |
| 782 | 782 | } |
| 783 | 783 | else |
@@ -794,20 +794,20 @@ discard block |
||
| 794 | 794 | * @param mixed the viewstate value to be set |
| 795 | 795 | * @param mixed default value. If $value===$defaultValue, the item will be cleared from the viewstate. |
| 796 | 796 | */ |
| 797 | - public function setViewState($key, $value, $defaultValue = null) |
|
| 797 | + public function setViewState($key, $value, $defaultValue=null) |
|
| 798 | 798 | { |
| 799 | 799 | if($this->_trackViewState) |
| 800 | 800 | { |
| 801 | 801 | unset($this->_tempState[$key]); |
| 802 | - $this->_viewState[$key] = $value; |
|
| 802 | + $this->_viewState[$key]=$value; |
|
| 803 | 803 | } |
| 804 | 804 | else |
| 805 | 805 | { |
| 806 | 806 | unset($this->_viewState[$key]); |
| 807 | - if($value === $defaultValue) |
|
| 807 | + if($value===$defaultValue) |
|
| 808 | 808 | unset($this->_tempState[$key]); |
| 809 | 809 | else |
| 810 | - $this->_tempState[$key] = $value; |
|
| 810 | + $this->_tempState[$key]=$value; |
|
| 811 | 811 | } |
| 812 | 812 | } |
| 813 | 813 | |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | */ |
| 830 | 830 | public function bindProperty($name, $expression) |
| 831 | 831 | { |
| 832 | - $this->_rf[self::RF_DATA_BINDINGS][$name] = $expression; |
|
| 832 | + $this->_rf[self::RF_DATA_BINDINGS][$name]=$expression; |
|
| 833 | 833 | } |
| 834 | 834 | |
| 835 | 835 | /** |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | */ |
| 852 | 852 | public function autoBindProperty($name, $expression) |
| 853 | 853 | { |
| 854 | - $this->_rf[self::RF_AUTO_BINDINGS][$name] = $expression; |
|
| 854 | + $this->_rf[self::RF_AUTO_BINDINGS][$name]=$expression; |
|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | /** |
@@ -872,8 +872,8 @@ discard block |
||
| 872 | 872 | Prado::trace("Data bind properties", 'Prado\Web\UI\TControl'); |
| 873 | 873 | if(isset($this->_rf[self::RF_DATA_BINDINGS])) |
| 874 | 874 | { |
| 875 | - if(($context = $this->getTemplateControl()) === null) |
|
| 876 | - $context = $this; |
|
| 875 | + if(($context=$this->getTemplateControl())===null) |
|
| 876 | + $context=$this; |
|
| 877 | 877 | foreach($this->_rf[self::RF_DATA_BINDINGS] as $property => $expression) |
| 878 | 878 | $this->setSubProperty($property, $context->evaluateExpression($expression)); |
| 879 | 879 | } |
@@ -886,8 +886,8 @@ discard block |
||
| 886 | 886 | { |
| 887 | 887 | if(isset($this->_rf[self::RF_AUTO_BINDINGS])) |
| 888 | 888 | { |
| 889 | - if(($context = $this->getTemplateControl()) === null) |
|
| 890 | - $context = $this; |
|
| 889 | + if(($context=$this->getTemplateControl())===null) |
|
| 890 | + $context=$this; |
|
| 891 | 891 | foreach($this->_rf[self::RF_AUTO_BINDINGS] as $property => $expression) |
| 892 | 892 | $this->setSubProperty($property, $context->evaluateExpression($expression)); |
| 893 | 893 | } |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | */ |
| 913 | 913 | final protected function getChildControlsCreated() |
| 914 | 914 | { |
| 915 | - return ($this->_flags & self::IS_CHILD_CREATED) !== 0; |
|
| 915 | + return ($this->_flags & self::IS_CHILD_CREATED)!==0; |
|
| 916 | 916 | } |
| 917 | 917 | |
| 918 | 918 | /** |
@@ -923,12 +923,12 @@ discard block |
||
| 923 | 923 | final protected function setChildControlsCreated($value) |
| 924 | 924 | { |
| 925 | 925 | if($value) |
| 926 | - $this->_flags |= self::IS_CHILD_CREATED; |
|
| 926 | + $this->_flags|=self::IS_CHILD_CREATED; |
|
| 927 | 927 | else |
| 928 | 928 | { |
| 929 | 929 | if($this->getHasControls() && ($this->_flags & self::IS_CHILD_CREATED)) |
| 930 | 930 | $this->getControls()->clear(); |
| 931 | - $this->_flags &= ~self::IS_CHILD_CREATED; |
|
| 931 | + $this->_flags&=~self::IS_CHILD_CREATED; |
|
| 932 | 932 | } |
| 933 | 933 | } |
| 934 | 934 | |
@@ -943,18 +943,18 @@ discard block |
||
| 943 | 943 | { |
| 944 | 944 | try |
| 945 | 945 | { |
| 946 | - $this->_flags |= self::IS_CREATING_CHILD; |
|
| 946 | + $this->_flags|=self::IS_CREATING_CHILD; |
|
| 947 | 947 | if(isset($this->_rf[self::RF_ADAPTER])) |
| 948 | 948 | $this->_rf[self::RF_ADAPTER]->createChildControls(); |
| 949 | 949 | else |
| 950 | 950 | $this->createChildControls(); |
| 951 | - $this->_flags &= ~self::IS_CREATING_CHILD; |
|
| 952 | - $this->_flags |= self::IS_CHILD_CREATED; |
|
| 951 | + $this->_flags&=~self::IS_CREATING_CHILD; |
|
| 952 | + $this->_flags|=self::IS_CHILD_CREATED; |
|
| 953 | 953 | } |
| 954 | 954 | catch(Exception $e) |
| 955 | 955 | { |
| 956 | - $this->_flags &= ~self::IS_CREATING_CHILD; |
|
| 957 | - $this->_flags |= self::IS_CHILD_CREATED; |
|
| 956 | + $this->_flags&=~self::IS_CREATING_CHILD; |
|
| 957 | + $this->_flags|=self::IS_CHILD_CREATED; |
|
| 958 | 958 | throw $e; |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -983,21 +983,21 @@ discard block |
||
| 983 | 983 | */ |
| 984 | 984 | public function findControl($id) |
| 985 | 985 | { |
| 986 | - $id = strtr($id, '.', self::ID_SEPARATOR); |
|
| 987 | - $container = ($this instanceof INamingContainer)?$this:$this->getNamingContainer(); |
|
| 986 | + $id=strtr($id, '.', self::ID_SEPARATOR); |
|
| 987 | + $container=($this instanceof INamingContainer) ? $this : $this->getNamingContainer(); |
|
| 988 | 988 | if(!$container || !$container->getHasControls()) |
| 989 | 989 | return null; |
| 990 | 990 | if(!isset($container->_rf[self::RF_NAMED_CONTROLS])) |
| 991 | 991 | { |
| 992 | - $container->_rf[self::RF_NAMED_CONTROLS] = []; |
|
| 992 | + $container->_rf[self::RF_NAMED_CONTROLS]=[]; |
|
| 993 | 993 | $container->fillNameTable($container, $container->_rf[self::RF_CONTROLS]); |
| 994 | 994 | } |
| 995 | - if(($pos = strpos($id, self::ID_SEPARATOR)) === false) |
|
| 996 | - return isset($container->_rf[self::RF_NAMED_CONTROLS][$id])?$container->_rf[self::RF_NAMED_CONTROLS][$id]:null; |
|
| 995 | + if(($pos=strpos($id, self::ID_SEPARATOR))===false) |
|
| 996 | + return isset($container->_rf[self::RF_NAMED_CONTROLS][$id]) ? $container->_rf[self::RF_NAMED_CONTROLS][$id] : null; |
|
| 997 | 997 | else |
| 998 | 998 | { |
| 999 | - $cid = substr($id, 0, $pos); |
|
| 1000 | - $sid = substr($id, $pos + 1); |
|
| 999 | + $cid=substr($id, 0, $pos); |
|
| 1000 | + $sid=substr($id, $pos + 1); |
|
| 1001 | 1001 | if(isset($container->_rf[self::RF_NAMED_CONTROLS][$cid])) |
| 1002 | 1002 | return $container->_rf[self::RF_NAMED_CONTROLS][$cid]->findControl($sid); |
| 1003 | 1003 | else |
@@ -1011,17 +1011,17 @@ discard block |
||
| 1011 | 1011 | * @param boolean whether the type comparison is strict or not. If false, controls of the parent classes of the specified class will also be returned. |
| 1012 | 1012 | * @return array list of controls found |
| 1013 | 1013 | */ |
| 1014 | - public function findControlsByType($type, $strict = true) |
|
| 1014 | + public function findControlsByType($type, $strict=true) |
|
| 1015 | 1015 | { |
| 1016 | - $controls = []; |
|
| 1016 | + $controls=[]; |
|
| 1017 | 1017 | if($this->getHasControls()) |
| 1018 | 1018 | { |
| 1019 | 1019 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
| 1020 | 1020 | { |
| 1021 | - if(is_object($control) && (get_class($control) === $type || (!$strict && ($control instanceof $type)))) |
|
| 1022 | - $controls[] = $control; |
|
| 1021 | + if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type)))) |
|
| 1022 | + $controls[]=$control; |
|
| 1023 | 1023 | if(($control instanceof TControl) && $control->getHasControls()) |
| 1024 | - $controls = array_merge($controls, $control->findControlsByType($type, $strict)); |
|
| 1024 | + $controls=array_merge($controls, $control->findControlsByType($type, $strict)); |
|
| 1025 | 1025 | } |
| 1026 | 1026 | } |
| 1027 | 1027 | return $controls; |
@@ -1038,16 +1038,16 @@ discard block |
||
| 1038 | 1038 | */ |
| 1039 | 1039 | public function findControlsByID($id) |
| 1040 | 1040 | { |
| 1041 | - $controls = []; |
|
| 1041 | + $controls=[]; |
|
| 1042 | 1042 | if($this->getHasControls()) |
| 1043 | 1043 | { |
| 1044 | 1044 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
| 1045 | 1045 | { |
| 1046 | 1046 | if($control instanceof TControl) |
| 1047 | 1047 | { |
| 1048 | - if($control->_id === $id) |
|
| 1049 | - $controls[] = $control; |
|
| 1050 | - $controls = array_merge($controls, $control->findControlsByID($id)); |
|
| 1048 | + if($control->_id===$id) |
|
| 1049 | + $controls[]=$control; |
|
| 1050 | + $controls=array_merge($controls, $control->findControlsByID($id)); |
|
| 1051 | 1051 | } |
| 1052 | 1052 | } |
| 1053 | 1053 | } |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | { |
| 1077 | 1077 | if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name])) |
| 1078 | 1078 | throw new TInvalidOperationException('control_object_reregistered', $name); |
| 1079 | - $this->_rf[self::RF_NAMED_OBJECTS][$name] = $object; |
|
| 1079 | + $this->_rf[self::RF_NAMED_OBJECTS][$name]=$object; |
|
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | /** |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | */ |
| 1148 | 1148 | public function getRegisteredObject($name) |
| 1149 | 1149 | { |
| 1150 | - return isset($this->_rf[self::RF_NAMED_OBJECTS][$name])?$this->_rf[self::RF_NAMED_OBJECTS][$name]:null; |
|
| 1150 | + return isset($this->_rf[self::RF_NAMED_OBJECTS][$name]) ? $this->_rf[self::RF_NAMED_OBJECTS][$name] : null; |
|
| 1151 | 1151 | } |
| 1152 | 1152 | |
| 1153 | 1153 | /** |
@@ -1189,10 +1189,10 @@ discard block |
||
| 1189 | 1189 | */ |
| 1190 | 1190 | final protected function isDescendentOf($ancestor) |
| 1191 | 1191 | { |
| 1192 | - $control = $this; |
|
| 1193 | - while($control !== $ancestor && $control->_parent) |
|
| 1194 | - $control = $control->_parent; |
|
| 1195 | - return $control === $ancestor; |
|
| 1192 | + $control=$this; |
|
| 1193 | + while($control!==$ancestor && $control->_parent) |
|
| 1194 | + $control=$control->_parent; |
|
| 1195 | + return $control===$ancestor; |
|
| 1196 | 1196 | } |
| 1197 | 1197 | |
| 1198 | 1198 | /** |
@@ -1205,13 +1205,13 @@ discard block |
||
| 1205 | 1205 | { |
| 1206 | 1206 | if($control->_parent) |
| 1207 | 1207 | $control->_parent->getControls()->remove($control); |
| 1208 | - $control->_parent = $this; |
|
| 1209 | - $control->_page = $this->getPage(); |
|
| 1210 | - $namingContainer = ($this instanceof INamingContainer)?$this:$this->_namingContainer; |
|
| 1208 | + $control->_parent=$this; |
|
| 1209 | + $control->_page=$this->getPage(); |
|
| 1210 | + $namingContainer=($this instanceof INamingContainer) ? $this : $this->_namingContainer; |
|
| 1211 | 1211 | if($namingContainer) |
| 1212 | 1212 | { |
| 1213 | - $control->_namingContainer = $namingContainer; |
|
| 1214 | - if($control->_id === '') |
|
| 1213 | + $control->_namingContainer=$namingContainer; |
|
| 1214 | + if($control->_id==='') |
|
| 1215 | 1215 | $control->generateAutomaticID(); |
| 1216 | 1216 | else |
| 1217 | 1217 | $namingContainer->clearNameTable(); |
@@ -1225,11 +1225,11 @@ discard block |
||
| 1225 | 1225 | { |
| 1226 | 1226 | if(isset($this->_rf[self::RF_CHILD_STATE][$control->_id])) |
| 1227 | 1227 | { |
| 1228 | - $state = $this->_rf[self::RF_CHILD_STATE][$control->_id]; |
|
| 1228 | + $state=$this->_rf[self::RF_CHILD_STATE][$control->_id]; |
|
| 1229 | 1229 | unset($this->_rf[self::RF_CHILD_STATE][$control->_id]); |
| 1230 | 1230 | } |
| 1231 | 1231 | else |
| 1232 | - $state = null; |
|
| 1232 | + $state=null; |
|
| 1233 | 1233 | $control->loadStateRecursive($state, !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
| 1234 | 1234 | if($this->_stage >= self::CS_LOADED) |
| 1235 | 1235 | { |
@@ -1251,13 +1251,13 @@ discard block |
||
| 1251 | 1251 | if($this->_namingContainer) |
| 1252 | 1252 | $this->_namingContainer->clearNameTable(); |
| 1253 | 1253 | $control->unloadRecursive(); |
| 1254 | - $control->_parent = null; |
|
| 1255 | - $control->_page = null; |
|
| 1256 | - $control->_namingContainer = null; |
|
| 1257 | - $control->_tplControl = null; |
|
| 1254 | + $control->_parent=null; |
|
| 1255 | + $control->_page=null; |
|
| 1256 | + $control->_namingContainer=null; |
|
| 1257 | + $control->_tplControl=null; |
|
| 1258 | 1258 | //$control->_stage=self::CS_CONSTRUCTED; |
| 1259 | 1259 | if(!($control->_flags & self::IS_ID_SET)) |
| 1260 | - $control->_id = ''; |
|
| 1260 | + $control->_id=''; |
|
| 1261 | 1261 | else |
| 1262 | 1262 | unset($this->_rf[self::RF_NAMED_OBJECTS][$control->_id]); |
| 1263 | 1263 | $control->clearCachedUniqueID(true); |
@@ -1268,21 +1268,21 @@ discard block |
||
| 1268 | 1268 | * Only framework developers should use this method. |
| 1269 | 1269 | * @param TControl the naming container control |
| 1270 | 1270 | */ |
| 1271 | - protected function initRecursive($namingContainer = null) |
|
| 1271 | + protected function initRecursive($namingContainer=null) |
|
| 1272 | 1272 | { |
| 1273 | 1273 | $this->ensureChildControls(); |
| 1274 | 1274 | if($this->getHasControls()) |
| 1275 | 1275 | { |
| 1276 | 1276 | if($this instanceof INamingContainer) |
| 1277 | - $namingContainer = $this; |
|
| 1278 | - $page = $this->getPage(); |
|
| 1277 | + $namingContainer=$this; |
|
| 1278 | + $page=$this->getPage(); |
|
| 1279 | 1279 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
| 1280 | 1280 | { |
| 1281 | 1281 | if($control instanceof TControl) |
| 1282 | 1282 | { |
| 1283 | - $control->_namingContainer = $namingContainer; |
|
| 1284 | - $control->_page = $page; |
|
| 1285 | - if($control->_id === '' && $namingContainer) |
|
| 1283 | + $control->_namingContainer=$namingContainer; |
|
| 1284 | + $control->_page=$page; |
|
| 1285 | + if($control->_id==='' && $namingContainer) |
|
| 1286 | 1286 | $control->generateAutomaticID(); |
| 1287 | 1287 | $control->initRecursive($namingContainer); |
| 1288 | 1288 | } |
@@ -1290,17 +1290,17 @@ discard block |
||
| 1290 | 1290 | } |
| 1291 | 1291 | if($this->_stage < self::CS_INITIALIZED) |
| 1292 | 1292 | { |
| 1293 | - $this->_stage = self::CS_CHILD_INITIALIZED; |
|
| 1294 | - if(($page = $this->getPage()) && $this->getEnableTheming() && !($this->_flags & self::IS_SKIN_APPLIED)) |
|
| 1293 | + $this->_stage=self::CS_CHILD_INITIALIZED; |
|
| 1294 | + if(($page=$this->getPage()) && $this->getEnableTheming() && !($this->_flags & self::IS_SKIN_APPLIED)) |
|
| 1295 | 1295 | { |
| 1296 | 1296 | $page->applyControlSkin($this); |
| 1297 | - $this->_flags |= self::IS_SKIN_APPLIED; |
|
| 1297 | + $this->_flags|=self::IS_SKIN_APPLIED; |
|
| 1298 | 1298 | } |
| 1299 | 1299 | if(isset($this->_rf[self::RF_ADAPTER])) |
| 1300 | 1300 | $this->_rf[self::RF_ADAPTER]->onInit(null); |
| 1301 | 1301 | else |
| 1302 | 1302 | $this->onInit(null); |
| 1303 | - $this->_stage = self::CS_INITIALIZED; |
|
| 1303 | + $this->_stage=self::CS_INITIALIZED; |
|
| 1304 | 1304 | } |
| 1305 | 1305 | } |
| 1306 | 1306 | |
@@ -1326,7 +1326,7 @@ discard block |
||
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | 1328 | if($this->_stage < self::CS_LOADED) |
| 1329 | - $this->_stage = self::CS_LOADED; |
|
| 1329 | + $this->_stage=self::CS_LOADED; |
|
| 1330 | 1330 | } |
| 1331 | 1331 | |
| 1332 | 1332 | /** |
@@ -1354,7 +1354,7 @@ discard block |
||
| 1354 | 1354 | } |
| 1355 | 1355 | } |
| 1356 | 1356 | } |
| 1357 | - $this->_stage = self::CS_PRERENDERED; |
|
| 1357 | + $this->_stage=self::CS_PRERENDERED; |
|
| 1358 | 1358 | } |
| 1359 | 1359 | |
| 1360 | 1360 | /** |
@@ -1364,7 +1364,7 @@ discard block |
||
| 1364 | 1364 | protected function unloadRecursive() |
| 1365 | 1365 | { |
| 1366 | 1366 | if(!($this->_flags & self::IS_ID_SET)) |
| 1367 | - $this->_id = ''; |
|
| 1367 | + $this->_id=''; |
|
| 1368 | 1368 | if($this->getHasControls()) |
| 1369 | 1369 | { |
| 1370 | 1370 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
@@ -1446,8 +1446,8 @@ discard block |
||
| 1446 | 1446 | */ |
| 1447 | 1447 | protected function raiseBubbleEvent($sender, $param) |
| 1448 | 1448 | { |
| 1449 | - $control = $this; |
|
| 1450 | - while($control = $control->_parent) |
|
| 1449 | + $control=$this; |
|
| 1450 | + while($control=$control->_parent) |
|
| 1451 | 1451 | { |
| 1452 | 1452 | if($control->bubbleEvent($sender, $param)) |
| 1453 | 1453 | break; |
@@ -1486,7 +1486,7 @@ discard block |
||
| 1486 | 1486 | */ |
| 1487 | 1487 | public function broadcastEvent($name, $sender, $param) |
| 1488 | 1488 | { |
| 1489 | - $rootControl = (($page = $this->getPage()) === null)?$this:$page; |
|
| 1489 | + $rootControl=(($page=$this->getPage())===null) ? $this : $page; |
|
| 1490 | 1490 | $rootControl->broadcastEventInternal($name, $sender, new TBroadcastEventParameter($name, $param)); |
| 1491 | 1491 | } |
| 1492 | 1492 | |
@@ -1530,9 +1530,9 @@ discard block |
||
| 1530 | 1530 | * @param callback callback invoked before traversing child controls. If null, it is ignored. |
| 1531 | 1531 | * @param callback callback invoked after traversing child controls. If null, it is ignored. |
| 1532 | 1532 | */ |
| 1533 | - protected function traverseChildControls($param, $preCallback = null, $postCallback = null) |
|
| 1533 | + protected function traverseChildControls($param, $preCallback=null, $postCallback=null) |
|
| 1534 | 1534 | { |
| 1535 | - if($preCallback !== null) |
|
| 1535 | + if($preCallback!==null) |
|
| 1536 | 1536 | call_user_func($preCallback, $this, $param); |
| 1537 | 1537 | if($this->getHasControls()) |
| 1538 | 1538 | { |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | } |
| 1545 | 1545 | } |
| 1546 | 1546 | } |
| 1547 | - if($postCallback !== null) |
|
| 1547 | + if($postCallback!==null) |
|
| 1548 | 1548 | call_user_func($postCallback, $this, $param); |
| 1549 | 1549 | } |
| 1550 | 1550 | |
@@ -1622,16 +1622,16 @@ discard block |
||
| 1622 | 1622 | * @param array the collection of the state |
| 1623 | 1623 | * @param boolean whether the viewstate should be loaded |
| 1624 | 1624 | */ |
| 1625 | - protected function loadStateRecursive(&$state, $needViewState = true) |
|
| 1625 | + protected function loadStateRecursive(&$state, $needViewState=true) |
|
| 1626 | 1626 | { |
| 1627 | 1627 | if(is_array($state)) |
| 1628 | 1628 | { |
| 1629 | 1629 | // A null state means the stateful properties all take default values. |
| 1630 | 1630 | // So if the state is enabled, we have to assign the null value. |
| 1631 | - $needViewState = ($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
|
| 1631 | + $needViewState=($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
|
| 1632 | 1632 | if(isset($state[1])) |
| 1633 | 1633 | { |
| 1634 | - $this->_rf[self::RF_CONTROLSTATE] = &$state[1]; |
|
| 1634 | + $this->_rf[self::RF_CONTROLSTATE]=&$state[1]; |
|
| 1635 | 1635 | unset($state[1]); |
| 1636 | 1636 | } |
| 1637 | 1637 | else |
@@ -1639,9 +1639,9 @@ discard block |
||
| 1639 | 1639 | if($needViewState) |
| 1640 | 1640 | { |
| 1641 | 1641 | if(isset($state[0])) |
| 1642 | - $this->_viewState = &$state[0]; |
|
| 1642 | + $this->_viewState=&$state[0]; |
|
| 1643 | 1643 | else |
| 1644 | - $this->_viewState = []; |
|
| 1644 | + $this->_viewState=[]; |
|
| 1645 | 1645 | } |
| 1646 | 1646 | unset($state[0]); |
| 1647 | 1647 | if($this->getHasControls()) |
@@ -1659,9 +1659,9 @@ discard block |
||
| 1659 | 1659 | } |
| 1660 | 1660 | } |
| 1661 | 1661 | if(!empty($state)) |
| 1662 | - $this->_rf[self::RF_CHILD_STATE] = &$state; |
|
| 1662 | + $this->_rf[self::RF_CHILD_STATE]=&$state; |
|
| 1663 | 1663 | } |
| 1664 | - $this->_stage = self::CS_STATE_LOADED; |
|
| 1664 | + $this->_stage=self::CS_STATE_LOADED; |
|
| 1665 | 1665 | if(isset($this->_rf[self::RF_ADAPTER])) |
| 1666 | 1666 | $this->_rf[self::RF_ADAPTER]->loadState(); |
| 1667 | 1667 | else |
@@ -1674,29 +1674,29 @@ discard block |
||
| 1674 | 1674 | * @param boolean whether the viewstate should be saved |
| 1675 | 1675 | * @return array the collection of the control state (including its children's state). |
| 1676 | 1676 | */ |
| 1677 | - protected function &saveStateRecursive($needViewState = true) |
|
| 1677 | + protected function &saveStateRecursive($needViewState=true) |
|
| 1678 | 1678 | { |
| 1679 | 1679 | if(isset($this->_rf[self::RF_ADAPTER])) |
| 1680 | 1680 | $this->_rf[self::RF_ADAPTER]->saveState(); |
| 1681 | 1681 | else |
| 1682 | 1682 | $this->saveState(); |
| 1683 | - $needViewState = ($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
|
| 1684 | - $state = []; |
|
| 1683 | + $needViewState=($needViewState && !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
|
| 1684 | + $state=[]; |
|
| 1685 | 1685 | if($this->getHasControls()) |
| 1686 | 1686 | { |
| 1687 | 1687 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
| 1688 | 1688 | { |
| 1689 | 1689 | if($control instanceof TControl) |
| 1690 | 1690 | { |
| 1691 | - if(count($tmp = &$control->saveStateRecursive($needViewState))) |
|
| 1692 | - $state[$control->_id] = $tmp; |
|
| 1691 | + if(count($tmp=&$control->saveStateRecursive($needViewState))) |
|
| 1692 | + $state[$control->_id]=$tmp; |
|
| 1693 | 1693 | } |
| 1694 | 1694 | } |
| 1695 | 1695 | } |
| 1696 | 1696 | if($needViewState && !empty($this->_viewState)) |
| 1697 | - $state[0] = &$this->_viewState; |
|
| 1697 | + $state[0]=&$this->_viewState; |
|
| 1698 | 1698 | if(isset($this->_rf[self::RF_CONTROLSTATE])) |
| 1699 | - $state[1] = &$this->_rf[self::RF_CONTROLSTATE]; |
|
| 1699 | + $state[1]=&$this->_rf[self::RF_CONTROLSTATE]; |
|
| 1700 | 1700 | return $state; |
| 1701 | 1701 | } |
| 1702 | 1702 | |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | if($page && !($this->_flags & self::IS_STYLESHEET_APPLIED)) |
| 1711 | 1711 | { |
| 1712 | 1712 | $page->applyControlStyleSheet($this); |
| 1713 | - $this->_flags |= self::IS_STYLESHEET_APPLIED; |
|
| 1713 | + $this->_flags|=self::IS_STYLESHEET_APPLIED; |
|
| 1714 | 1714 | } |
| 1715 | 1715 | elseif($this->_flags & self::IS_STYLESHEET_APPLIED) |
| 1716 | 1716 | throw new TInvalidOperationException('control_stylesheet_applied', get_class($this)); |
@@ -1723,13 +1723,13 @@ discard block |
||
| 1723 | 1723 | */ |
| 1724 | 1724 | private function clearCachedUniqueID($recursive) |
| 1725 | 1725 | { |
| 1726 | - if($recursive && $this->_uid !== null && isset($this->_rf[self::RF_CONTROLS])) |
|
| 1726 | + if($recursive && $this->_uid!==null && isset($this->_rf[self::RF_CONTROLS])) |
|
| 1727 | 1727 | { |
| 1728 | 1728 | foreach($this->_rf[self::RF_CONTROLS] as $control) |
| 1729 | 1729 | if($control instanceof TControl) |
| 1730 | 1730 | $control->clearCachedUniqueID($recursive); |
| 1731 | 1731 | } |
| 1732 | - $this->_uid = null; |
|
| 1732 | + $this->_uid=null; |
|
| 1733 | 1733 | } |
| 1734 | 1734 | |
| 1735 | 1735 | /** |
@@ -1737,11 +1737,11 @@ discard block |
||
| 1737 | 1737 | */ |
| 1738 | 1738 | private function generateAutomaticID() |
| 1739 | 1739 | { |
| 1740 | - $this->_flags &= ~self::IS_ID_SET; |
|
| 1740 | + $this->_flags&=~self::IS_ID_SET; |
|
| 1741 | 1741 | if(!isset($this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID])) |
| 1742 | - $this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID] = 0; |
|
| 1743 | - $id = $this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]++; |
|
| 1744 | - $this->_id = self::AUTOMATIC_ID_PREFIX . $id; |
|
| 1742 | + $this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]=0; |
|
| 1743 | + $id=$this->_namingContainer->_rf[self::RF_NAMED_CONTROLS_ID]++; |
|
| 1744 | + $this->_id=self::AUTOMATIC_ID_PREFIX.$id; |
|
| 1745 | 1745 | $this->_namingContainer->clearNameTable(); |
| 1746 | 1746 | } |
| 1747 | 1747 | |
@@ -1765,12 +1765,12 @@ discard block |
||
| 1765 | 1765 | { |
| 1766 | 1766 | if($control instanceof TControl) |
| 1767 | 1767 | { |
| 1768 | - if($control->_id !== '') |
|
| 1768 | + if($control->_id!=='') |
|
| 1769 | 1769 | { |
| 1770 | 1770 | if(isset($container->_rf[self::RF_NAMED_CONTROLS][$control->_id])) |
| 1771 | 1771 | throw new TInvalidDataValueException('control_id_nonunique', get_class($control), $control->_id); |
| 1772 | 1772 | else |
| 1773 | - $container->_rf[self::RF_NAMED_CONTROLS][$control->_id] = $control; |
|
| 1773 | + $container->_rf[self::RF_NAMED_CONTROLS][$control->_id]=$control; |
|
| 1774 | 1774 | } |
| 1775 | 1775 | if(!($control instanceof INamingContainer) && $control->getHasControls()) |
| 1776 | 1776 | $this->fillNameTable($container, $control->_rf[self::RF_CONTROLS]); |
@@ -406,11 +406,9 @@ discard block |
||
| 406 | 406 | return $this->_id; |
| 407 | 407 | else |
| 408 | 408 | return ($this->_uid = $prefix . self::ID_SEPARATOR . $this->_id); |
| 409 | - } |
|
| 410 | - else // no naming container |
|
| 409 | + } else // no naming container |
|
| 411 | 410 | return $this->_id; |
| 412 | - } |
|
| 413 | - else |
|
| 411 | + } else |
|
| 414 | 412 | return $this->_uid; |
| 415 | 413 | } |
| 416 | 414 | |
@@ -564,8 +562,7 @@ discard block |
||
| 564 | 562 | if(!$control->getVisible(false)) |
| 565 | 563 | return false; |
| 566 | 564 | return true; |
| 567 | - } |
|
| 568 | - else |
|
| 565 | + } else |
|
| 569 | 566 | return $this->getViewState('Visible', true); |
| 570 | 567 | } |
| 571 | 568 | |
@@ -595,8 +592,7 @@ discard block |
||
| 595 | 592 | if(!$control->getViewState('Enabled', true)) |
| 596 | 593 | return false; |
| 597 | 594 | return true; |
| 598 | - } |
|
| 599 | - else |
|
| 595 | + } else |
|
| 600 | 596 | return $this->getViewState('Enabled', true); |
| 601 | 597 | } |
| 602 | 598 | |
@@ -693,8 +689,7 @@ discard block |
||
| 693 | 689 | if($control->_flags & self::IS_DISABLE_VIEWSTATE) |
| 694 | 690 | return false; |
| 695 | 691 | return true; |
| 696 | - } |
|
| 697 | - else |
|
| 692 | + } else |
|
| 698 | 693 | return !($this->_flags & self::IS_DISABLE_VIEWSTATE); |
| 699 | 694 | } |
| 700 | 695 | |
@@ -779,8 +774,7 @@ discard block |
||
| 779 | 774 | if(is_object($this->_tempState[$key]) && $this->_trackViewState) |
| 780 | 775 | $this->_viewState[$key] = $this->_tempState[$key]; |
| 781 | 776 | return $this->_tempState[$key]; |
| 782 | - } |
|
| 783 | - else |
|
| 777 | + } else |
|
| 784 | 778 | return $defaultValue; |
| 785 | 779 | } |
| 786 | 780 | |
@@ -800,8 +794,7 @@ discard block |
||
| 800 | 794 | { |
| 801 | 795 | unset($this->_tempState[$key]); |
| 802 | 796 | $this->_viewState[$key] = $value; |
| 803 | - } |
|
| 804 | - else |
|
| 797 | + } else |
|
| 805 | 798 | { |
| 806 | 799 | unset($this->_viewState[$key]); |
| 807 | 800 | if($value === $defaultValue) |
@@ -950,8 +943,7 @@ discard block |
||
| 950 | 943 | $this->createChildControls(); |
| 951 | 944 | $this->_flags &= ~self::IS_CREATING_CHILD; |
| 952 | 945 | $this->_flags |= self::IS_CHILD_CREATED; |
| 953 | - } |
|
| 954 | - catch(Exception $e) |
|
| 946 | + } catch(Exception $e) |
|
| 955 | 947 | { |
| 956 | 948 | $this->_flags &= ~self::IS_CREATING_CHILD; |
| 957 | 949 | $this->_flags |= self::IS_CHILD_CREATED; |
@@ -1190,8 +1182,9 @@ discard block |
||
| 1190 | 1182 | final protected function isDescendentOf($ancestor) |
| 1191 | 1183 | { |
| 1192 | 1184 | $control = $this; |
| 1193 | - while($control !== $ancestor && $control->_parent) |
|
| 1194 | - $control = $control->_parent; |
|
| 1185 | + while($control !== $ancestor && $control->_parent) { |
|
| 1186 | + $control = $control->_parent; |
|
| 1187 | + } |
|
| 1195 | 1188 | return $control === $ancestor; |
| 1196 | 1189 | } |
| 1197 | 1190 | |
@@ -1227,8 +1220,7 @@ discard block |
||
| 1227 | 1220 | { |
| 1228 | 1221 | $state = $this->_rf[self::RF_CHILD_STATE][$control->_id]; |
| 1229 | 1222 | unset($this->_rf[self::RF_CHILD_STATE][$control->_id]); |
| 1230 | - } |
|
| 1231 | - else |
|
| 1223 | + } else |
|
| 1232 | 1224 | $state = null; |
| 1233 | 1225 | $control->loadStateRecursive($state, !($this->_flags & self::IS_DISABLE_VIEWSTATE)); |
| 1234 | 1226 | if($this->_stage >= self::CS_LOADED) |
@@ -1633,8 +1625,7 @@ discard block |
||
| 1633 | 1625 | { |
| 1634 | 1626 | $this->_rf[self::RF_CONTROLSTATE] = &$state[1]; |
| 1635 | 1627 | unset($state[1]); |
| 1636 | - } |
|
| 1637 | - else |
|
| 1628 | + } else |
|
| 1638 | 1629 | unset($this->_rf[self::RF_CONTROLSTATE]); |
| 1639 | 1630 | if($needViewState) |
| 1640 | 1631 | { |
@@ -1711,8 +1702,7 @@ discard block |
||
| 1711 | 1702 | { |
| 1712 | 1703 | $page->applyControlStyleSheet($this); |
| 1713 | 1704 | $this->_flags |= self::IS_STYLESHEET_APPLIED; |
| 1714 | - } |
|
| 1715 | - elseif($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
| 1705 | + } elseif($this->_flags & self::IS_STYLESHEET_APPLIED) |
|
| 1716 | 1706 | throw new TInvalidOperationException('control_stylesheet_applied', get_class($this)); |
| 1717 | 1707 | } |
| 1718 | 1708 | |
@@ -290,6 +290,9 @@ discard block |
||
| 290 | 290 | $this->unloadRecursive(); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | + /** |
|
| 294 | + * @param string $enc |
|
| 295 | + */ |
|
| 293 | 296 | protected static function decodeUTF8($data, $enc) |
| 294 | 297 | { |
| 295 | 298 | if(is_array($data)) |
@@ -460,6 +463,7 @@ discard block |
||
| 460 | 463 | * Returns a list of registered validators. |
| 461 | 464 | * If validation group is specified, only the validators in that group will be returned. |
| 462 | 465 | * @param string validation group |
| 466 | + * @param string $validationGroup |
|
| 463 | 467 | * @return TList registered validators in the requested group. If the group is null, all validators will be returned. |
| 464 | 468 | */ |
| 465 | 469 | public function getValidators($validationGroup = null) |
@@ -571,6 +575,7 @@ discard block |
||
| 571 | 575 | * Applies a skin in the current theme to a control. |
| 572 | 576 | * This method should only be used by framework developers. |
| 573 | 577 | * @param TControl a control to be applied skin with |
| 578 | + * @param TControl $control |
|
| 574 | 579 | */ |
| 575 | 580 | public function applyControlSkin($control) |
| 576 | 581 | { |
@@ -862,6 +867,8 @@ discard block |
||
| 862 | 867 | * Processes post data. |
| 863 | 868 | * @param TMap post data to be processed |
| 864 | 869 | * @param boolean whether this method is invoked before {@link onLoad OnLoad}. |
| 870 | + * @param TMap $postData |
|
| 871 | + * @param boolean $beforeLoad |
|
| 865 | 872 | */ |
| 866 | 873 | protected function processPostData($postData, $beforeLoad) |
| 867 | 874 | { |
@@ -987,6 +994,7 @@ discard block |
||
| 987 | 994 | /** |
| 988 | 995 | * Sets input focus on a control after the page is rendered to users. |
| 989 | 996 | * @param TControl|string control to receive focus, or the ID of the element on the page to receive focus |
| 997 | + * @param TControl $value |
|
| 990 | 998 | */ |
| 991 | 999 | public function setFocus($value) |
| 992 | 1000 | { |
@@ -1072,6 +1080,7 @@ discard block |
||
| 1072 | 1080 | * Sets the state to be stored on the client side. |
| 1073 | 1081 | * This method should only be used by framework and control developers. |
| 1074 | 1082 | * @param string the state to be stored on the client side |
| 1083 | + * @param string $state |
|
| 1075 | 1084 | */ |
| 1076 | 1085 | public function setClientState($state) |
| 1077 | 1086 | { |
@@ -1191,6 +1200,8 @@ discard block |
||
| 1191 | 1200 | * referring to the context object (e.g. Page, Page.ClientScript). |
| 1192 | 1201 | * @param string method name of the context object |
| 1193 | 1202 | * @param array list of parameters to be passed to the action method |
| 1203 | + * @param string $context |
|
| 1204 | + * @param string $funcName |
|
| 1194 | 1205 | */ |
| 1195 | 1206 | public function registerCachingAction($context, $funcName, $funcParams) |
| 1196 | 1207 | { |
@@ -41,17 +41,17 @@ discard block |
||
| 41 | 41 | /** |
| 42 | 42 | * system post fields |
| 43 | 43 | */ |
| 44 | - const FIELD_POSTBACK_TARGET = 'PRADO_POSTBACK_TARGET'; |
|
| 45 | - const FIELD_POSTBACK_PARAMETER = 'PRADO_POSTBACK_PARAMETER'; |
|
| 46 | - const FIELD_LASTFOCUS = 'PRADO_LASTFOCUS'; |
|
| 47 | - const FIELD_PAGESTATE = 'PRADO_PAGESTATE'; |
|
| 48 | - const FIELD_CALLBACK_TARGET = 'PRADO_CALLBACK_TARGET'; |
|
| 49 | - const FIELD_CALLBACK_PARAMETER = 'PRADO_CALLBACK_PARAMETER'; |
|
| 44 | + const FIELD_POSTBACK_TARGET='PRADO_POSTBACK_TARGET'; |
|
| 45 | + const FIELD_POSTBACK_PARAMETER='PRADO_POSTBACK_PARAMETER'; |
|
| 46 | + const FIELD_LASTFOCUS='PRADO_LASTFOCUS'; |
|
| 47 | + const FIELD_PAGESTATE='PRADO_PAGESTATE'; |
|
| 48 | + const FIELD_CALLBACK_TARGET='PRADO_CALLBACK_TARGET'; |
|
| 49 | + const FIELD_CALLBACK_PARAMETER='PRADO_CALLBACK_PARAMETER'; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * @var array system post fields |
| 53 | 53 | */ |
| 54 | - private static $_systemPostFields = [ |
|
| 54 | + private static $_systemPostFields=[ |
|
| 55 | 55 | 'PRADO_POSTBACK_TARGET' => true, |
| 56 | 56 | 'PRADO_POSTBACK_PARAMETER' => true, |
| 57 | 57 | 'PRADO_LASTFOCUS' => true, |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | /** |
| 71 | 71 | * @var array list of registered validators |
| 72 | 72 | */ |
| 73 | - private $_validators = []; |
|
| 73 | + private $_validators=[]; |
|
| 74 | 74 | /** |
| 75 | 75 | * @var boolean if validation has been performed |
| 76 | 76 | */ |
| 77 | - private $_validated = false; |
|
| 77 | + private $_validated=false; |
|
| 78 | 78 | /** |
| 79 | 79 | * @var TTheme page theme |
| 80 | 80 | */ |
@@ -102,15 +102,15 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * @var array list of controls whose data have been changed due to the postback |
| 104 | 104 | */ |
| 105 | - protected $_controlsPostDataChanged = []; |
|
| 105 | + protected $_controlsPostDataChanged=[]; |
|
| 106 | 106 | /** |
| 107 | 107 | * @var array list of controls that need to load post data in the current request |
| 108 | 108 | */ |
| 109 | - protected $_controlsRequiringPostData = []; |
|
| 109 | + protected $_controlsRequiringPostData=[]; |
|
| 110 | 110 | /** |
| 111 | 111 | * @var array list of controls that need to load post data in the next postback |
| 112 | 112 | */ |
| 113 | - protected $_controlsRegisteredForPostData = []; |
|
| 113 | + protected $_controlsRegisteredForPostData=[]; |
|
| 114 | 114 | /** |
| 115 | 115 | * @var TControl control that needs to raise postback event |
| 116 | 116 | */ |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | /** |
| 123 | 123 | * @var boolean whether the form has been rendered |
| 124 | 124 | */ |
| 125 | - protected $_formRendered = false; |
|
| 125 | + protected $_formRendered=false; |
|
| 126 | 126 | /** |
| 127 | 127 | * @var boolean whether the current rendering is within a form |
| 128 | 128 | */ |
| 129 | - protected $_inFormRender = false; |
|
| 129 | + protected $_inFormRender=false; |
|
| 130 | 130 | /** |
| 131 | 131 | * @var TControl|string the control or the ID of the element on the page to be focused when the page is sent back to user |
| 132 | 132 | */ |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | /** |
| 135 | 135 | * @var string page path to this page |
| 136 | 136 | */ |
| 137 | - private $_pagePath = ''; |
|
| 137 | + private $_pagePath=''; |
|
| 138 | 138 | /** |
| 139 | 139 | * @var boolean whether page state should be HMAC validated |
| 140 | 140 | */ |
| 141 | - private $_enableStateValidation = true; |
|
| 141 | + private $_enableStateValidation=true; |
|
| 142 | 142 | /** |
| 143 | 143 | * @var boolean whether page state should be encrypted |
| 144 | 144 | */ |
| 145 | - private $_enableStateEncryption = false; |
|
| 145 | + private $_enableStateEncryption=false; |
|
| 146 | 146 | /** |
| 147 | 147 | * @var boolean whether page state should be compressed |
| 148 | 148 | * @since 3.1.6 |
| 149 | 149 | */ |
| 150 | - private $_enableStateCompression = true; |
|
| 150 | + private $_enableStateCompression=true; |
|
| 151 | 151 | /** |
| 152 | 152 | * @var string page state persister class name |
| 153 | 153 | */ |
| 154 | - private $_statePersisterClass = '\Prado\Web\UI\TPageStatePersister'; |
|
| 154 | + private $_statePersisterClass='\Prado\Web\UI\TPageStatePersister'; |
|
| 155 | 155 | /** |
| 156 | 156 | * @var mixed page state persister |
| 157 | 157 | */ |
@@ -163,15 +163,15 @@ discard block |
||
| 163 | 163 | /** |
| 164 | 164 | * @var string state string to be stored on the client side |
| 165 | 165 | */ |
| 166 | - private $_clientState = ''; |
|
| 166 | + private $_clientState=''; |
|
| 167 | 167 | /** |
| 168 | 168 | * @var boolean true if loading post data. |
| 169 | 169 | */ |
| 170 | - protected $_isLoadingPostData = false; |
|
| 170 | + protected $_isLoadingPostData=false; |
|
| 171 | 171 | /** |
| 172 | 172 | * @var boolean whether client supports javascript |
| 173 | 173 | */ |
| 174 | - private $_enableJavaScript = true; |
|
| 174 | + private $_enableJavaScript=true; |
|
| 175 | 175 | /** |
| 176 | 176 | * @var THtmlWriter current html render writer |
| 177 | 177 | */ |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | public function run($writer) |
| 195 | 195 | { |
| 196 | 196 | Prado::trace("Running page life cycles", 'Prado\Web\UI\TPage'); |
| 197 | - $this->_writer = $writer; |
|
| 197 | + $this->_writer=$writer; |
|
| 198 | 198 | |
| 199 | 199 | $this->determinePostBackMode(); |
| 200 | 200 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | else |
| 209 | 209 | $this->processNormalRequest($writer); |
| 210 | 210 | |
| 211 | - $this->_writer = null; |
|
| 211 | + $this->_writer=null; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | protected function processNormalRequest($writer) |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | Prado::trace("Page onInitComplete()", 'Prado\Web\UI\TPage'); |
| 257 | 257 | $this->onInitComplete(null); |
| 258 | 258 | |
| 259 | - $this->_restPostData = new TMap; |
|
| 259 | + $this->_restPostData=new TMap; |
|
| 260 | 260 | Prado::trace("Page loadPageState()", 'Prado\Web\UI\TPage'); |
| 261 | 261 | $this->loadPageState(); |
| 262 | 262 | Prado::trace("Page processPostData()", 'Prado\Web\UI\TPage'); |
@@ -295,10 +295,10 @@ discard block |
||
| 295 | 295 | if(is_array($data)) |
| 296 | 296 | { |
| 297 | 297 | foreach($data as $k => $v) |
| 298 | - $data[$k] = self::decodeUTF8($v, $enc); |
|
| 298 | + $data[$k]=self::decodeUTF8($v, $enc); |
|
| 299 | 299 | return $data; |
| 300 | 300 | } elseif(is_string($data)) { |
| 301 | - return iconv('UTF-8', $enc . '//IGNORE', $data); |
|
| 301 | + return iconv('UTF-8', $enc.'//IGNORE', $data); |
|
| 302 | 302 | } else { |
| 303 | 303 | return $data; |
| 304 | 304 | } |
@@ -312,15 +312,15 @@ discard block |
||
| 312 | 312 | { |
| 313 | 313 | $this->setAdapter(new TActivePageAdapter($this)); |
| 314 | 314 | |
| 315 | - $callbackEventParameter = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
| 315 | + $callbackEventParameter=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
| 316 | 316 | if(strlen($callbackEventParameter) > 0) |
| 317 | - $this->_postData[TPage::FIELD_CALLBACK_PARAMETER] = TJavaScript::jsonDecode((string)$callbackEventParameter); |
|
| 317 | + $this->_postData[TPage::FIELD_CALLBACK_PARAMETER]=TJavaScript::jsonDecode((string) $callbackEventParameter); |
|
| 318 | 318 | |
| 319 | 319 | // Decode Callback postData from UTF-8 to current Charset |
| 320 | - if (($g = $this->getApplication()->getGlobalization(false)) !== null && |
|
| 321 | - strtoupper($enc = $g->getCharset()) != 'UTF-8') |
|
| 322 | - foreach ($this->_postData as $k => $v) |
|
| 323 | - $this->_postData[$k] = self::decodeUTF8($v, $enc); |
|
| 320 | + if(($g=$this->getApplication()->getGlobalization(false))!==null && |
|
| 321 | + strtoupper($enc=$g->getCharset())!='UTF-8') |
|
| 322 | + foreach($this->_postData as $k => $v) |
|
| 323 | + $this->_postData[$k]=self::decodeUTF8($v, $enc); |
|
| 324 | 324 | |
| 325 | 325 | Prado::trace("Page onPreInit()", 'Prado\Web\UI\TPage'); |
| 326 | 326 | $this->onPreInit(null); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | Prado::trace("Page onInitComplete()", 'Prado\Web\UI\TPage'); |
| 332 | 332 | $this->onInitComplete(null); |
| 333 | 333 | |
| 334 | - $this->_restPostData = new TMap; |
|
| 334 | + $this->_restPostData=new TMap; |
|
| 335 | 335 | Prado::trace("Page loadPageState()", 'Prado\Web\UI\TPage'); |
| 336 | 336 | $this->loadPageState(); |
| 337 | 337 | Prado::trace("Page processPostData()", 'Prado\Web\UI\TPage'); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public function getCallbackClient() |
| 386 | 386 | { |
| 387 | - if($this->getAdapter() !== null) |
|
| 387 | + if($this->getAdapter()!==null) |
|
| 388 | 388 | return $this->getAdapter()->getCallbackClientHandler(); |
| 389 | 389 | else |
| 390 | 390 | return new TCallbackClientScript(); |
@@ -450,8 +450,8 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function setForm(TForm $form) |
| 452 | 452 | { |
| 453 | - if($this->_form === null) |
|
| 454 | - $this->_form = $form; |
|
| 453 | + if($this->_form===null) |
|
| 454 | + $this->_form=$form; |
|
| 455 | 455 | else |
| 456 | 456 | throw new TInvalidOperationException('page_form_duplicated'); |
| 457 | 457 | } |
@@ -462,17 +462,17 @@ discard block |
||
| 462 | 462 | * @param string validation group |
| 463 | 463 | * @return TList registered validators in the requested group. If the group is null, all validators will be returned. |
| 464 | 464 | */ |
| 465 | - public function getValidators($validationGroup = null) |
|
| 465 | + public function getValidators($validationGroup=null) |
|
| 466 | 466 | { |
| 467 | 467 | if(!$this->_validators) |
| 468 | - $this->_validators = new TList; |
|
| 469 | - if(empty($validationGroup) === true) |
|
| 468 | + $this->_validators=new TList; |
|
| 469 | + if(empty($validationGroup)===true) |
|
| 470 | 470 | return $this->_validators; |
| 471 | 471 | else |
| 472 | 472 | { |
| 473 | - $list = new TList; |
|
| 473 | + $list=new TList; |
|
| 474 | 474 | foreach($this->_validators as $validator) |
| 475 | - if($validator->getValidationGroup() === $validationGroup) |
|
| 475 | + if($validator->getValidationGroup()===$validationGroup) |
|
| 476 | 476 | $list->add($validator); |
| 477 | 477 | return $list; |
| 478 | 478 | } |
@@ -484,13 +484,13 @@ discard block |
||
| 484 | 484 | * If validation group is specified, only the validators in that group will be invoked. |
| 485 | 485 | * @param string validation group. If null, all validators will perform validation. |
| 486 | 486 | */ |
| 487 | - public function validate($validationGroup = null) |
|
| 487 | + public function validate($validationGroup=null) |
|
| 488 | 488 | { |
| 489 | 489 | Prado::trace("Page validate()", 'Prado\Web\UI\TPage'); |
| 490 | - $this->_validated = true; |
|
| 490 | + $this->_validated=true; |
|
| 491 | 491 | if($this->_validators && $this->_validators->getCount()) |
| 492 | 492 | { |
| 493 | - if($validationGroup === null) |
|
| 493 | + if($validationGroup===null) |
|
| 494 | 494 | { |
| 495 | 495 | foreach($this->_validators as $validator) |
| 496 | 496 | $validator->validate(); |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | { |
| 500 | 500 | foreach($this->_validators as $validator) |
| 501 | 501 | { |
| 502 | - if($validator->getValidationGroup() === $validationGroup) |
|
| 502 | + if($validator->getValidationGroup()===$validationGroup) |
|
| 503 | 503 | $validator->validate(); |
| 504 | 504 | } |
| 505 | 505 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | public function getTheme() |
| 535 | 535 | { |
| 536 | 536 | if(is_string($this->_theme)) |
| 537 | - $this->_theme = $this->getService()->getThemeManager()->getTheme($this->_theme); |
|
| 537 | + $this->_theme=$this->getService()->getThemeManager()->getTheme($this->_theme); |
|
| 538 | 538 | return $this->_theme; |
| 539 | 539 | } |
| 540 | 540 | |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | */ |
| 545 | 545 | public function setTheme($value) |
| 546 | 546 | { |
| 547 | - $this->_theme = empty($value)?null:$value; |
|
| 547 | + $this->_theme=empty($value) ?null:$value; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | public function getStyleSheetTheme() |
| 555 | 555 | { |
| 556 | 556 | if(is_string($this->_styleSheet)) |
| 557 | - $this->_styleSheet = $this->getService()->getThemeManager()->getTheme($this->_styleSheet); |
|
| 557 | + $this->_styleSheet=$this->getService()->getThemeManager()->getTheme($this->_styleSheet); |
|
| 558 | 558 | return $this->_styleSheet; |
| 559 | 559 | } |
| 560 | 560 | |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | */ |
| 565 | 565 | public function setStyleSheetTheme($value) |
| 566 | 566 | { |
| 567 | - $this->_styleSheet = empty($value)?null:$value; |
|
| 567 | + $this->_styleSheet=empty($value) ?null:$value; |
|
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | /** |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | */ |
| 575 | 575 | public function applyControlSkin($control) |
| 576 | 576 | { |
| 577 | - if(($theme = $this->getTheme()) !== null) |
|
| 577 | + if(($theme=$this->getTheme())!==null) |
|
| 578 | 578 | $theme->applySkin($control); |
| 579 | 579 | } |
| 580 | 580 | |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | */ |
| 586 | 586 | public function applyControlStyleSheet($control) |
| 587 | 587 | { |
| 588 | - if(($theme = $this->getStyleSheetTheme()) !== null) |
|
| 588 | + if(($theme=$this->getStyleSheetTheme())!==null) |
|
| 589 | 589 | $theme->applySkin($control); |
| 590 | 590 | } |
| 591 | 591 | |
@@ -595,12 +595,12 @@ discard block |
||
| 595 | 595 | public function getClientScript() |
| 596 | 596 | { |
| 597 | 597 | if(!$this->_clientScript) { |
| 598 | - $className = $classPath = $this->getService()->getClientScriptManagerClass(); |
|
| 598 | + $className=$classPath=$this->getService()->getClientScriptManagerClass(); |
|
| 599 | 599 | |
| 600 | - if($className !== '\Prado\Web\UI\TClientScriptManager' && !is_subclass_of($className, '\Prado\Web\UI\TClientScriptManager')) |
|
| 600 | + if($className!=='\Prado\Web\UI\TClientScriptManager' && !is_subclass_of($className, '\Prado\Web\UI\TClientScriptManager')) |
|
| 601 | 601 | throw new THttpException(404, 'page_csmanagerclass_invalid', $className); |
| 602 | 602 | |
| 603 | - $this->_clientScript = new $className($this); |
|
| 603 | + $this->_clientScript=new $className($this); |
|
| 604 | 604 | } |
| 605 | 605 | return $this->_clientScript; |
| 606 | 606 | } |
@@ -669,8 +669,8 @@ discard block |
||
| 669 | 669 | public function onPreRenderComplete($param) |
| 670 | 670 | { |
| 671 | 671 | $this->raiseEvent('OnPreRenderComplete', $this, $param); |
| 672 | - $cs = $this->getClientScript(); |
|
| 673 | - $theme = $this->getTheme(); |
|
| 672 | + $cs=$this->getClientScript(); |
|
| 673 | + $theme=$this->getTheme(); |
|
| 674 | 674 | if($theme instanceof ITheme) |
| 675 | 675 | { |
| 676 | 676 | foreach($theme->getStyleSheetFiles() as $url) |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | foreach($theme->getJavaScriptFiles() as $url) |
| 679 | 679 | $cs->registerHeadScriptFile($url, $url); |
| 680 | 680 | } |
| 681 | - $styleSheet = $this->getStyleSheetTheme(); |
|
| 681 | + $styleSheet=$this->getStyleSheetTheme(); |
|
| 682 | 682 | if($styleSheet instanceof ITheme) |
| 683 | 683 | { |
| 684 | 684 | foreach($styleSheet->getStyleSheetFiles() as $url) |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $cs->registerHeadScriptFile($url, $url); |
| 688 | 688 | } |
| 689 | 689 | |
| 690 | - if($cs->getRequiresHead() && $this->getHead() === null) |
|
| 690 | + if($cs->getRequiresHead() && $this->getHead()===null) |
|
| 691 | 691 | throw new TConfigurationException('page_head_required'); |
| 692 | 692 | } |
| 693 | 693 | |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | */ |
| 702 | 702 | private function getCssMediaType($url) |
| 703 | 703 | { |
| 704 | - $segs = explode('.', basename($url)); |
|
| 704 | + $segs=explode('.', basename($url)); |
|
| 705 | 705 | if(isset($segs[2])) |
| 706 | 706 | return $segs[count($segs) - 2]; |
| 707 | 707 | else |
@@ -726,9 +726,9 @@ discard block |
||
| 726 | 726 | */ |
| 727 | 727 | private function determinePostBackMode() |
| 728 | 728 | { |
| 729 | - $postData = $this->getRequest(); |
|
| 729 | + $postData=$this->getRequest(); |
|
| 730 | 730 | if($postData->contains(self::FIELD_PAGESTATE) || $postData->contains(self::FIELD_POSTBACK_TARGET)) |
| 731 | - $this->_postData = $postData; |
|
| 731 | + $this->_postData=$postData; |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | */ |
| 737 | 737 | public function getIsPostBack() |
| 738 | 738 | { |
| 739 | - return $this->_postData !== null; |
|
| 739 | + return $this->_postData!==null; |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /** |
@@ -766,7 +766,7 @@ discard block |
||
| 766 | 766 | public function loadState() |
| 767 | 767 | { |
| 768 | 768 | parent::loadState(); |
| 769 | - $this->_controlsRequiringPostData = $this->getViewState('ControlsRequiringPostBack', []); |
|
| 769 | + $this->_controlsRequiringPostData=$this->getViewState('ControlsRequiringPostBack', []); |
|
| 770 | 770 | } |
| 771 | 771 | |
| 772 | 772 | /** |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | protected function loadPageState() |
| 776 | 776 | { |
| 777 | 777 | Prado::trace("Loading state", 'Prado\Web\UI\TPage'); |
| 778 | - $state = $this->getStatePersister()->load(); |
|
| 778 | + $state=$this->getStatePersister()->load(); |
|
| 779 | 779 | $this->loadStateRecursive($state, $this->getEnableViewState()); |
| 780 | 780 | } |
| 781 | 781 | |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | protected function savePageState() |
| 786 | 786 | { |
| 787 | 787 | Prado::trace("Saving state", 'Prado\Web\UI\TPage'); |
| 788 | - $state = &$this->saveStateRecursive($this->getEnableViewState()); |
|
| 788 | + $state=&$this->saveStateRecursive($this->getEnableViewState()); |
|
| 789 | 789 | $this->getStatePersister()->save($state); |
| 790 | 790 | } |
| 791 | 791 | |
@@ -807,9 +807,9 @@ discard block |
||
| 807 | 807 | */ |
| 808 | 808 | public function registerRequiresPostData($control) |
| 809 | 809 | { |
| 810 | - $id = is_string($control)?$control:$control->getUniqueID(); |
|
| 811 | - $this->_controlsRegisteredForPostData[$id] = true; |
|
| 812 | - $params = func_get_args(); |
|
| 810 | + $id=is_string($control) ? $control : $control->getUniqueID(); |
|
| 811 | + $this->_controlsRegisteredForPostData[$id]=true; |
|
| 812 | + $params=func_get_args(); |
|
| 813 | 813 | foreach($this->getCachingStack() as $item) |
| 814 | 814 | $item->registerAction('Page', 'registerRequiresPostData', [$id]); |
| 815 | 815 | } |
@@ -819,11 +819,11 @@ discard block |
||
| 819 | 819 | */ |
| 820 | 820 | public function getPostBackEventTarget() |
| 821 | 821 | { |
| 822 | - if($this->_postBackEventTarget === null && $this->_postData !== null) |
|
| 822 | + if($this->_postBackEventTarget===null && $this->_postData!==null) |
|
| 823 | 823 | { |
| 824 | - $eventTarget = $this->_postData->itemAt(self::FIELD_POSTBACK_TARGET); |
|
| 824 | + $eventTarget=$this->_postData->itemAt(self::FIELD_POSTBACK_TARGET); |
|
| 825 | 825 | if(!empty($eventTarget)) |
| 826 | - $this->_postBackEventTarget = $this->findControl($eventTarget); |
|
| 826 | + $this->_postBackEventTarget=$this->findControl($eventTarget); |
|
| 827 | 827 | } |
| 828 | 828 | return $this->_postBackEventTarget; |
| 829 | 829 | } |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | */ |
| 835 | 835 | public function setPostBackEventTarget(TControl $control) |
| 836 | 836 | { |
| 837 | - $this->_postBackEventTarget = $control; |
|
| 837 | + $this->_postBackEventTarget=$control; |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | /** |
@@ -842,10 +842,10 @@ discard block |
||
| 842 | 842 | */ |
| 843 | 843 | public function getPostBackEventParameter() |
| 844 | 844 | { |
| 845 | - if($this->_postBackEventParameter === null && $this->_postData !== null) |
|
| 845 | + if($this->_postBackEventParameter===null && $this->_postData!==null) |
|
| 846 | 846 | { |
| 847 | - if(($this->_postBackEventParameter = $this->_postData->itemAt(self::FIELD_POSTBACK_PARAMETER)) === null) |
|
| 848 | - $this->_postBackEventParameter = ''; |
|
| 847 | + if(($this->_postBackEventParameter=$this->_postData->itemAt(self::FIELD_POSTBACK_PARAMETER))===null) |
|
| 848 | + $this->_postBackEventParameter=''; |
|
| 849 | 849 | } |
| 850 | 850 | return $this->_postBackEventParameter; |
| 851 | 851 | } |
@@ -855,7 +855,7 @@ discard block |
||
| 855 | 855 | */ |
| 856 | 856 | public function setPostBackEventParameter($value) |
| 857 | 857 | { |
| 858 | - $this->_postBackEventParameter = $value; |
|
| 858 | + $this->_postBackEventParameter=$value; |
|
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | /** |
@@ -865,24 +865,24 @@ discard block |
||
| 865 | 865 | */ |
| 866 | 866 | protected function processPostData($postData, $beforeLoad) |
| 867 | 867 | { |
| 868 | - $this->_isLoadingPostData = true; |
|
| 868 | + $this->_isLoadingPostData=true; |
|
| 869 | 869 | if($beforeLoad) |
| 870 | - $this->_restPostData = new TMap; |
|
| 870 | + $this->_restPostData=new TMap; |
|
| 871 | 871 | foreach($postData as $key => $value) |
| 872 | 872 | { |
| 873 | 873 | if($this->isSystemPostField($key)) |
| 874 | 874 | continue; |
| 875 | - elseif($control = $this->findControl($key)) |
|
| 875 | + elseif($control=$this->findControl($key)) |
|
| 876 | 876 | { |
| 877 | 877 | if($control instanceof \Prado\Web\UI\IPostBackDataHandler) |
| 878 | 878 | { |
| 879 | 879 | if($control->loadPostData($key, $postData)) |
| 880 | - $this->_controlsPostDataChanged[] = $control; |
|
| 880 | + $this->_controlsPostDataChanged[]=$control; |
|
| 881 | 881 | } |
| 882 | 882 | elseif($control instanceof IPostBackEventHandler && |
| 883 | 883 | empty($this->_postData[self::FIELD_POSTBACK_TARGET])) |
| 884 | 884 | { |
| 885 | - $this->_postData->add(self::FIELD_POSTBACK_TARGET, $key); // not calling setPostBackEventTarget() because the control may be removed later |
|
| 885 | + $this->_postData->add(self::FIELD_POSTBACK_TARGET, $key); // not calling setPostBackEventTarget() because the control may be removed later |
|
| 886 | 886 | } |
| 887 | 887 | unset($this->_controlsRequiringPostData[$key]); |
| 888 | 888 | } |
@@ -892,19 +892,19 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | foreach($this->_controlsRequiringPostData as $key => $value) |
| 894 | 894 | { |
| 895 | - if($control = $this->findControl($key)) |
|
| 895 | + if($control=$this->findControl($key)) |
|
| 896 | 896 | { |
| 897 | 897 | if($control instanceof \Prado\Web\UI\IPostBackDataHandler) |
| 898 | 898 | { |
| 899 | 899 | if($control->loadPostData($key, $this->_postData)) |
| 900 | - $this->_controlsPostDataChanged[] = $control; |
|
| 900 | + $this->_controlsPostDataChanged[]=$control; |
|
| 901 | 901 | } |
| 902 | 902 | else |
| 903 | 903 | throw new TInvalidDataValueException('page_postbackcontrol_invalid', $key); |
| 904 | 904 | unset($this->_controlsRequiringPostData[$key]); |
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | - $this->_isLoadingPostData = false; |
|
| 907 | + $this->_isLoadingPostData=false; |
|
| 908 | 908 | } |
| 909 | 909 | |
| 910 | 910 | /** |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | protected function raisePostBackEvent() |
| 931 | 931 | { |
| 932 | - if(($postBackHandler = $this->getPostBackEventTarget()) === null) |
|
| 932 | + if(($postBackHandler=$this->getPostBackEventTarget())===null) |
|
| 933 | 933 | $this->validate(); |
| 934 | 934 | elseif($postBackHandler instanceof IPostBackEventHandler) |
| 935 | 935 | $postBackHandler->raisePostBackEvent($this->getPostBackEventParameter()); |
@@ -961,9 +961,9 @@ discard block |
||
| 961 | 961 | { |
| 962 | 962 | if($this->_formRendered) |
| 963 | 963 | throw new TConfigurationException('page_form_duplicated'); |
| 964 | - $this->_formRendered = true; |
|
| 964 | + $this->_formRendered=true; |
|
| 965 | 965 | $this->getClientScript()->registerHiddenField(self::FIELD_PAGESTATE, $this->getClientState()); |
| 966 | - $this->_inFormRender = true; |
|
| 966 | + $this->_inFormRender=true; |
|
| 967 | 967 | } |
| 968 | 968 | |
| 969 | 969 | /** |
@@ -974,14 +974,14 @@ discard block |
||
| 974 | 974 | if($this->_focus) |
| 975 | 975 | { |
| 976 | 976 | if(($this->_focus instanceof TControl) && $this->_focus->getVisible(true)) |
| 977 | - $focus = $this->_focus->getClientID(); |
|
| 977 | + $focus=$this->_focus->getClientID(); |
|
| 978 | 978 | else |
| 979 | - $focus = $this->_focus; |
|
| 979 | + $focus=$this->_focus; |
|
| 980 | 980 | $this->getClientScript()->registerFocusControl($focus); |
| 981 | 981 | } |
| 982 | - elseif($this->_postData && ($lastFocus = $this->_postData->itemAt(self::FIELD_LASTFOCUS)) !== null) |
|
| 982 | + elseif($this->_postData && ($lastFocus=$this->_postData->itemAt(self::FIELD_LASTFOCUS))!==null) |
|
| 983 | 983 | $this->getClientScript()->registerFocusControl($lastFocus); |
| 984 | - $this->_inFormRender = false; |
|
| 984 | + $this->_inFormRender=false; |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | /** |
@@ -990,7 +990,7 @@ discard block |
||
| 990 | 990 | */ |
| 991 | 991 | public function setFocus($value) |
| 992 | 992 | { |
| 993 | - $this->_focus = $value; |
|
| 993 | + $this->_focus=$value; |
|
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | /** |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | */ |
| 1007 | 1007 | public function setClientSupportsJavaScript($value) |
| 1008 | 1008 | { |
| 1009 | - $this->_enableJavaScript = TPropertyValue::ensureBoolean($value); |
|
| 1009 | + $this->_enableJavaScript=TPropertyValue::ensureBoolean($value); |
|
| 1010 | 1010 | } |
| 1011 | 1011 | |
| 1012 | 1012 | /** |
@@ -1025,11 +1025,11 @@ discard block |
||
| 1025 | 1025 | { |
| 1026 | 1026 | if($this->_head) |
| 1027 | 1027 | throw new TInvalidOperationException('page_head_duplicated'); |
| 1028 | - $this->_head = $value; |
|
| 1029 | - if($this->_title !== null) |
|
| 1028 | + $this->_head=$value; |
|
| 1029 | + if($this->_title!==null) |
|
| 1030 | 1030 | { |
| 1031 | 1031 | $this->_head->setTitle($this->_title); |
| 1032 | - $this->_title = null; |
|
| 1032 | + $this->_title=null; |
|
| 1033 | 1033 | } |
| 1034 | 1034 | } |
| 1035 | 1035 | |
@@ -1041,7 +1041,7 @@ discard block |
||
| 1041 | 1041 | if($this->_head) |
| 1042 | 1042 | return $this->_head->getTitle(); |
| 1043 | 1043 | else |
| 1044 | - return $this->_title === null ? '' : $this->_title; |
|
| 1044 | + return $this->_title===null ? '' : $this->_title; |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | /** |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | if($this->_head) |
| 1056 | 1056 | $this->_head->setTitle($value); |
| 1057 | 1057 | else |
| 1058 | - $this->_title = $value; |
|
| 1058 | + $this->_title=$value; |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | /** |
@@ -1075,7 +1075,7 @@ discard block |
||
| 1075 | 1075 | */ |
| 1076 | 1076 | public function setClientState($state) |
| 1077 | 1077 | { |
| 1078 | - $this->_clientState = $state; |
|
| 1078 | + $this->_clientState=$state; |
|
| 1079 | 1079 | } |
| 1080 | 1080 | |
| 1081 | 1081 | /** |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | */ |
| 1100 | 1100 | public function setStatePersisterClass($value) |
| 1101 | 1101 | { |
| 1102 | - $this->_statePersisterClass = $value; |
|
| 1102 | + $this->_statePersisterClass=$value; |
|
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | /** |
@@ -1107,9 +1107,9 @@ discard block |
||
| 1107 | 1107 | */ |
| 1108 | 1108 | public function getStatePersister() |
| 1109 | 1109 | { |
| 1110 | - if($this->_statePersister === null) |
|
| 1110 | + if($this->_statePersister===null) |
|
| 1111 | 1111 | { |
| 1112 | - $this->_statePersister = Prado::createComponent($this->_statePersisterClass); |
|
| 1112 | + $this->_statePersister=Prado::createComponent($this->_statePersisterClass); |
|
| 1113 | 1113 | if(!($this->_statePersister instanceof IPageStatePersister)) |
| 1114 | 1114 | throw new TInvalidDataTypeException('page_statepersister_invalid'); |
| 1115 | 1115 | $this->_statePersister->setPage($this); |
@@ -1130,7 +1130,7 @@ discard block |
||
| 1130 | 1130 | */ |
| 1131 | 1131 | public function setEnableStateValidation($value) |
| 1132 | 1132 | { |
| 1133 | - $this->_enableStateValidation = TPropertyValue::ensureBoolean($value); |
|
| 1133 | + $this->_enableStateValidation=TPropertyValue::ensureBoolean($value); |
|
| 1134 | 1134 | } |
| 1135 | 1135 | |
| 1136 | 1136 | /** |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | */ |
| 1147 | 1147 | public function setEnableStateEncryption($value) |
| 1148 | 1148 | { |
| 1149 | - $this->_enableStateEncryption = TPropertyValue::ensureBoolean($value); |
|
| 1149 | + $this->_enableStateEncryption=TPropertyValue::ensureBoolean($value); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | /** |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | */ |
| 1165 | 1165 | public function setEnableStateCompression($value) |
| 1166 | 1166 | { |
| 1167 | - $this->_enableStateCompression = TPropertyValue::ensureBoolean($value); |
|
| 1167 | + $this->_enableStateCompression=TPropertyValue::ensureBoolean($value); |
|
| 1168 | 1168 | } |
| 1169 | 1169 | |
| 1170 | 1170 | /** |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | */ |
| 1181 | 1181 | public function setPagePath($value) |
| 1182 | 1182 | { |
| 1183 | - $this->_pagePath = $value; |
|
| 1183 | + $this->_pagePath=$value; |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | public function getCachingStack() |
| 1208 | 1208 | { |
| 1209 | 1209 | if(!$this->_cachingStack) |
| 1210 | - $this->_cachingStack = new TStack; |
|
| 1210 | + $this->_cachingStack=new TStack; |
|
| 1211 | 1211 | return $this->_cachingStack; |
| 1212 | 1212 | } |
| 1213 | 1213 | |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | */ |
| 1217 | 1217 | public function flushWriter() |
| 1218 | 1218 | { |
| 1219 | - if ($this->_writer) |
|
| 1219 | + if($this->_writer) |
|
| 1220 | 1220 | $this->Response->write($this->_writer->flush()); |
| 1221 | 1221 | } |
| 1222 | 1222 | } |
| 1223 | 1223 | \ No newline at end of file |
@@ -204,8 +204,7 @@ discard block |
||
| 204 | 204 | $this->processCallbackRequest($writer); |
| 205 | 205 | else |
| 206 | 206 | $this->processPostBackRequest($writer); |
| 207 | - } |
|
| 208 | - else |
|
| 207 | + } else |
|
| 209 | 208 | $this->processNormalRequest($writer); |
| 210 | 209 | |
| 211 | 210 | $this->_writer = null; |
@@ -494,8 +493,7 @@ discard block |
||
| 494 | 493 | { |
| 495 | 494 | foreach($this->_validators as $validator) |
| 496 | 495 | $validator->validate(); |
| 497 | - } |
|
| 498 | - else |
|
| 496 | + } else |
|
| 499 | 497 | { |
| 500 | 498 | foreach($this->_validators as $validator) |
| 501 | 499 | { |
@@ -523,8 +521,7 @@ discard block |
||
| 523 | 521 | return false; |
| 524 | 522 | } |
| 525 | 523 | return true; |
| 526 | - } |
|
| 527 | - else |
|
| 524 | + } else |
|
| 528 | 525 | throw new TInvalidOperationException('page_isvalid_unknown'); |
| 529 | 526 | } |
| 530 | 527 | |
@@ -878,15 +875,13 @@ discard block |
||
| 878 | 875 | { |
| 879 | 876 | if($control->loadPostData($key, $postData)) |
| 880 | 877 | $this->_controlsPostDataChanged[] = $control; |
| 881 | - } |
|
| 882 | - elseif($control instanceof IPostBackEventHandler && |
|
| 878 | + } elseif($control instanceof IPostBackEventHandler && |
|
| 883 | 879 | empty($this->_postData[self::FIELD_POSTBACK_TARGET])) |
| 884 | 880 | { |
| 885 | 881 | $this->_postData->add(self::FIELD_POSTBACK_TARGET, $key); // not calling setPostBackEventTarget() because the control may be removed later |
| 886 | 882 | } |
| 887 | 883 | unset($this->_controlsRequiringPostData[$key]); |
| 888 | - } |
|
| 889 | - elseif($beforeLoad) |
|
| 884 | + } elseif($beforeLoad) |
|
| 890 | 885 | $this->_restPostData->add($key, $value); |
| 891 | 886 | } |
| 892 | 887 | |
@@ -898,8 +893,7 @@ discard block |
||
| 898 | 893 | { |
| 899 | 894 | if($control->loadPostData($key, $this->_postData)) |
| 900 | 895 | $this->_controlsPostDataChanged[] = $control; |
| 901 | - } |
|
| 902 | - else |
|
| 896 | + } else |
|
| 903 | 897 | throw new TInvalidDataValueException('page_postbackcontrol_invalid', $key); |
| 904 | 898 | unset($this->_controlsRequiringPostData[$key]); |
| 905 | 899 | } |
@@ -978,8 +972,7 @@ discard block |
||
| 978 | 972 | else |
| 979 | 973 | $focus = $this->_focus; |
| 980 | 974 | $this->getClientScript()->registerFocusControl($focus); |
| 981 | - } |
|
| 982 | - elseif($this->_postData && ($lastFocus = $this->_postData->itemAt(self::FIELD_LASTFOCUS)) !== null) |
|
| 975 | + } elseif($this->_postData && ($lastFocus = $this->_postData->itemAt(self::FIELD_LASTFOCUS)) !== null) |
|
| 983 | 976 | $this->getClientScript()->registerFocusControl($lastFocus); |
| 984 | 977 | $this->_inFormRender = false; |
| 985 | 978 | } |
@@ -120,6 +120,7 @@ discard block |
||
| 120 | 120 | * @param integer the line number that parsing starts from (internal use) |
| 121 | 121 | * @param boolean whether this template is a source template, i.e., this template is loaded from |
| 122 | 122 | * some external storage rather than from within another template. |
| 123 | + * @param string $tplFile |
|
| 123 | 124 | */ |
| 124 | 125 | public function __construct($template, $contextPath, $tplFile = null, $startingLine = 0, $sourceTemplate = true) |
| 125 | 126 | { |
@@ -302,6 +303,7 @@ discard block |
||
| 302 | 303 | * @param TControl control to be configured |
| 303 | 304 | * @param string property name |
| 304 | 305 | * @param mixed property initial value |
| 306 | + * @param TControl $control |
|
| 305 | 307 | */ |
| 306 | 308 | protected function configureControl($control, $name, $value) |
| 307 | 309 | { |
@@ -318,6 +320,7 @@ discard block |
||
| 318 | 320 | * @param TComponent component to be configured |
| 319 | 321 | * @param string property name |
| 320 | 322 | * @param mixed property initial value |
| 323 | + * @param TComponent $component |
|
| 321 | 324 | */ |
| 322 | 325 | protected function configureComponent($component, $name, $value) |
| 323 | 326 | { |
@@ -704,6 +707,8 @@ discard block |
||
| 704 | 707 | /** |
| 705 | 708 | * Parses the attributes of a tag from a string. |
| 706 | 709 | * @param string the string to be parsed. |
| 710 | + * @param string $str |
|
| 711 | + * @param string $offset |
|
| 707 | 712 | * @return array attribute values indexed by names. |
| 708 | 713 | */ |
| 709 | 714 | protected function parseAttributes($str, $offset) |
@@ -738,6 +743,9 @@ discard block |
||
| 738 | 743 | return $attributes; |
| 739 | 744 | } |
| 740 | 745 | |
| 746 | + /** |
|
| 747 | + * @param string $content |
|
| 748 | + */ |
|
| 741 | 749 | protected function parseTemplateProperty($content, $offset) |
| 742 | 750 | { |
| 743 | 751 | $line = $this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1; |
@@ -747,6 +755,7 @@ discard block |
||
| 747 | 755 | /** |
| 748 | 756 | * Parses a single attribute. |
| 749 | 757 | * @param string the string to be parsed. |
| 758 | + * @param string $value |
|
| 750 | 759 | * @return array attribute initialization |
| 751 | 760 | */ |
| 752 | 761 | protected function parseAttribute($value) |
@@ -890,6 +899,8 @@ discard block |
||
| 890 | 899 | * @param Exception template exception |
| 891 | 900 | * @param int line number |
| 892 | 901 | * @param string template string if no source file is used |
| 902 | + * @param \Exception $e |
|
| 903 | + * @param integer $line |
|
| 893 | 904 | */ |
| 894 | 905 | protected function handleException($e, $line, $input = null) |
| 895 | 906 | { |
@@ -959,7 +970,7 @@ discard block |
||
| 959 | 970 | |
| 960 | 971 | /** |
| 961 | 972 | * Checks if the given method belongs to a previously attached class behavior. |
| 962 | - * @param ReflectionClass $class |
|
| 973 | + * @param \ReflectionClass $class |
|
| 963 | 974 | * @param string $method |
| 964 | 975 | * @return boolean |
| 965 | 976 | */ |
@@ -61,26 +61,26 @@ discard block |
||
| 61 | 61 | * '<%[%#~\/\\$=\\[](.*?)%>' - expressions |
| 62 | 62 | * '<prop:([\w\.\-]+)((?:\s*[\w\.\-]+=\'.*?\'|\s*[\w\.\-]+=".*?"|\s*[\w\.\-]+=<%.*?%>)*)\s*\/>' - group subproperty tags |
| 63 | 63 | */ |
| 64 | - const REGEX_RULES = '/<!--.*?--!>|<!---.*?--->|<\/?com:([\w\.\\\]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.\-]+)\s*>|<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>|<%[%#~\/\\$=\\[](.*?)%>|<prop:([\w\.\-]+)((?:\s*[\w\.\-]+\s*=\s*\'.*?\'|\s*[\w\.\-]+\s*=\s*".*?"|\s*[\w\.\-]+\s*=\s*<%.*?%>)*)\s*\/>/msS'; |
|
| 64 | + const REGEX_RULES='/<!--.*?--!>|<!---.*?--->|<\/?com:([\w\.\\\]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.\-]+)\s*>|<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>|<%[%#~\/\\$=\\[](.*?)%>|<prop:([\w\.\-]+)((?:\s*[\w\.\-]+\s*=\s*\'.*?\'|\s*[\w\.\-]+\s*=\s*".*?"|\s*[\w\.\-]+\s*=\s*<%.*?%>)*)\s*\/>/msS'; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Different configurations of component property/event/attribute |
| 68 | 68 | */ |
| 69 | - const CONFIG_DATABIND = 0; |
|
| 70 | - const CONFIG_EXPRESSION = 1; |
|
| 71 | - const CONFIG_ASSET = 2; |
|
| 72 | - const CONFIG_PARAMETER = 3; |
|
| 73 | - const CONFIG_LOCALIZATION = 4; |
|
| 74 | - const CONFIG_TEMPLATE = 5; |
|
| 69 | + const CONFIG_DATABIND=0; |
|
| 70 | + const CONFIG_EXPRESSION=1; |
|
| 71 | + const CONFIG_ASSET=2; |
|
| 72 | + const CONFIG_PARAMETER=3; |
|
| 73 | + const CONFIG_LOCALIZATION=4; |
|
| 74 | + const CONFIG_TEMPLATE=5; |
|
| 75 | 75 | |
| 76 | 76 | /** |
| 77 | 77 | * @var array list of component tags and strings |
| 78 | 78 | */ |
| 79 | - private $_tpl = []; |
|
| 79 | + private $_tpl=[]; |
|
| 80 | 80 | /** |
| 81 | 81 | * @var array list of directive settings |
| 82 | 82 | */ |
| 83 | - private $_directive = []; |
|
| 83 | + private $_directive=[]; |
|
| 84 | 84 | /** |
| 85 | 85 | * @var string context path |
| 86 | 86 | */ |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | /** |
| 93 | 93 | * @var integer the line number that parsing starts from (internal use) |
| 94 | 94 | */ |
| 95 | - private $_startingLine = 0; |
|
| 95 | + private $_startingLine=0; |
|
| 96 | 96 | /** |
| 97 | 97 | * @var string template content to be parsed |
| 98 | 98 | */ |
@@ -100,15 +100,15 @@ discard block |
||
| 100 | 100 | /** |
| 101 | 101 | * @var boolean whether this template is a source template |
| 102 | 102 | */ |
| 103 | - private $_sourceTemplate = true; |
|
| 103 | + private $_sourceTemplate=true; |
|
| 104 | 104 | /** |
| 105 | 105 | * @var string hash code of the template |
| 106 | 106 | */ |
| 107 | - private $_hashCode = ''; |
|
| 107 | + private $_hashCode=''; |
|
| 108 | 108 | private $_tplControl; |
| 109 | - private $_includedFiles = []; |
|
| 110 | - private $_includeAtLine = []; |
|
| 111 | - private $_includeLines = []; |
|
| 109 | + private $_includedFiles=[]; |
|
| 110 | + private $_includeAtLine=[]; |
|
| 111 | + private $_includeLines=[]; |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -121,16 +121,16 @@ discard block |
||
| 121 | 121 | * @param boolean whether this template is a source template, i.e., this template is loaded from |
| 122 | 122 | * some external storage rather than from within another template. |
| 123 | 123 | */ |
| 124 | - public function __construct($template, $contextPath, $tplFile = null, $startingLine = 0, $sourceTemplate = true) |
|
| 124 | + public function __construct($template, $contextPath, $tplFile=null, $startingLine=0, $sourceTemplate=true) |
|
| 125 | 125 | { |
| 126 | - $this->_sourceTemplate = $sourceTemplate; |
|
| 127 | - $this->_contextPath = $contextPath; |
|
| 128 | - $this->_tplFile = $tplFile; |
|
| 129 | - $this->_startingLine = $startingLine; |
|
| 130 | - $this->_content = $template; |
|
| 131 | - $this->_hashCode = md5($template); |
|
| 126 | + $this->_sourceTemplate=$sourceTemplate; |
|
| 127 | + $this->_contextPath=$contextPath; |
|
| 128 | + $this->_tplFile=$tplFile; |
|
| 129 | + $this->_startingLine=$startingLine; |
|
| 130 | + $this->_content=$template; |
|
| 131 | + $this->_hashCode=md5($template); |
|
| 132 | 132 | $this->parse($template); |
| 133 | - $this->_content = null; // reset to save memory |
|
| 133 | + $this->_content=null; // reset to save memory |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -189,36 +189,36 @@ discard block |
||
| 189 | 189 | * @param TControl the control who owns the template |
| 190 | 190 | * @param TControl the control who will become the root parent of the controls on the template. If null, it uses the template control. |
| 191 | 191 | */ |
| 192 | - public function instantiateIn($tplControl, $parentControl = null) |
|
| 192 | + public function instantiateIn($tplControl, $parentControl=null) |
|
| 193 | 193 | { |
| 194 | - $this->_tplControl = $tplControl; |
|
| 195 | - if($parentControl === null) |
|
| 196 | - $parentControl = $tplControl; |
|
| 197 | - if(($page = $tplControl->getPage()) === null) |
|
| 198 | - $page = $this->getService()->getRequestedPage(); |
|
| 199 | - $controls = []; |
|
| 200 | - $directChildren = []; |
|
| 194 | + $this->_tplControl=$tplControl; |
|
| 195 | + if($parentControl===null) |
|
| 196 | + $parentControl=$tplControl; |
|
| 197 | + if(($page=$tplControl->getPage())===null) |
|
| 198 | + $page=$this->getService()->getRequestedPage(); |
|
| 199 | + $controls=[]; |
|
| 200 | + $directChildren=[]; |
|
| 201 | 201 | foreach($this->_tpl as $key => $object) |
| 202 | 202 | { |
| 203 | - if($object[0] === -1) |
|
| 204 | - $parent = $parentControl; |
|
| 203 | + if($object[0]===-1) |
|
| 204 | + $parent=$parentControl; |
|
| 205 | 205 | elseif(isset($controls[$object[0]])) |
| 206 | - $parent = $controls[$object[0]]; |
|
| 206 | + $parent=$controls[$object[0]]; |
|
| 207 | 207 | else |
| 208 | 208 | continue; |
| 209 | 209 | if(isset($object[2])) // component |
| 210 | 210 | { |
| 211 | - $component = Prado::createComponent($object[1]); |
|
| 212 | - $properties = &$object[2]; |
|
| 211 | + $component=Prado::createComponent($object[1]); |
|
| 212 | + $properties=&$object[2]; |
|
| 213 | 213 | if($component instanceof TControl) |
| 214 | 214 | { |
| 215 | 215 | if($component instanceof \Prado\Web\UI\WebControls\TOutputCache) |
| 216 | - $component->setCacheKeyPrefix($this->_hashCode . $key); |
|
| 216 | + $component->setCacheKeyPrefix($this->_hashCode.$key); |
|
| 217 | 217 | $component->setTemplateControl($tplControl); |
| 218 | 218 | if(isset($properties['id'])) |
| 219 | 219 | { |
| 220 | 220 | if(is_array($properties['id'])) |
| 221 | - $properties['id'] = $component->evaluateExpression($properties['id'][1]); |
|
| 221 | + $properties['id']=$component->evaluateExpression($properties['id'][1]); |
|
| 222 | 222 | $tplControl->registerObject($properties['id'], $component); |
| 223 | 223 | } |
| 224 | 224 | if(isset($properties['skinid'])) |
@@ -238,28 +238,28 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | $component->trackViewState(true); |
| 240 | 240 | |
| 241 | - if($parent === $parentControl) |
|
| 242 | - $directChildren[] = $component; |
|
| 241 | + if($parent===$parentControl) |
|
| 242 | + $directChildren[]=$component; |
|
| 243 | 243 | else |
| 244 | 244 | $component->createdOnTemplate($parent); |
| 245 | 245 | if($component->getAllowChildControls()) |
| 246 | - $controls[$key] = $component; |
|
| 246 | + $controls[$key]=$component; |
|
| 247 | 247 | } |
| 248 | 248 | elseif($component instanceof TComponent) |
| 249 | 249 | { |
| 250 | - $controls[$key] = $component; |
|
| 250 | + $controls[$key]=$component; |
|
| 251 | 251 | if(isset($properties['id'])) |
| 252 | 252 | { |
| 253 | 253 | if(is_array($properties['id'])) |
| 254 | - $properties['id'] = $component->evaluateExpression($properties['id'][1]); |
|
| 254 | + $properties['id']=$component->evaluateExpression($properties['id'][1]); |
|
| 255 | 255 | $tplControl->registerObject($properties['id'], $component); |
| 256 | 256 | if(!$component->hasProperty('id')) |
| 257 | 257 | unset($properties['id']); |
| 258 | 258 | } |
| 259 | 259 | foreach($properties as $name => $value) |
| 260 | 260 | $this->configureComponent($component, $name, $value); |
| 261 | - if($parent === $parentControl) |
|
| 262 | - $directChildren[] = $component; |
|
| 261 | + if($parent===$parentControl) |
|
| 262 | + $directChildren[]=$component; |
|
| 263 | 263 | else |
| 264 | 264 | $component->createdOnTemplate($parent); |
| 265 | 265 | } |
@@ -269,17 +269,17 @@ discard block |
||
| 269 | 269 | if($object[1] instanceof TCompositeLiteral) |
| 270 | 270 | { |
| 271 | 271 | // need to clone a new object because the one in template is reused |
| 272 | - $o = clone $object[1]; |
|
| 272 | + $o=clone $object[1]; |
|
| 273 | 273 | $o->setContainer($tplControl); |
| 274 | - if($parent === $parentControl) |
|
| 275 | - $directChildren[] = $o; |
|
| 274 | + if($parent===$parentControl) |
|
| 275 | + $directChildren[]=$o; |
|
| 276 | 276 | else |
| 277 | 277 | $parent->addParsedObject($o); |
| 278 | 278 | } |
| 279 | 279 | else |
| 280 | 280 | { |
| 281 | - if($parent === $parentControl) |
|
| 282 | - $directChildren[] = $object[1]; |
|
| 281 | + if($parent===$parentControl) |
|
| 282 | + $directChildren[]=$object[1]; |
|
| 283 | 283 | else |
| 284 | 284 | $parent->addParsedObject($object[1]); |
| 285 | 285 | } |
@@ -305,9 +305,9 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | protected function configureControl($control, $name, $value) |
| 307 | 307 | { |
| 308 | - if(strncasecmp($name, 'on', 2) === 0) // is an event |
|
| 308 | + if(strncasecmp($name, 'on', 2)===0) // is an event |
|
| 309 | 309 | $this->configureEvent($control, $name, $value, $control); |
| 310 | - elseif(($pos = strrpos($name, '.')) === false) // is a simple property or custom attribute |
|
| 310 | + elseif(($pos=strrpos($name, '.'))===false) // is a simple property or custom attribute |
|
| 311 | 311 | $this->configureProperty($control, $name, $value); |
| 312 | 312 | else // is a subproperty |
| 313 | 313 | $this->configureSubProperty($control, $name, $value); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | */ |
| 322 | 322 | protected function configureComponent($component, $name, $value) |
| 323 | 323 | { |
| 324 | - if(strpos($name, '.') === false) // is a simple property or custom attribute |
|
| 324 | + if(strpos($name, '.')===false) // is a simple property or custom attribute |
|
| 325 | 325 | $this->configureProperty($component, $name, $value); |
| 326 | 326 | else // is a subproperty |
| 327 | 327 | $this->configureSubProperty($component, $name, $value); |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | */ |
| 337 | 337 | protected function configureEvent($control, $name, $value, $contextControl) |
| 338 | 338 | { |
| 339 | - if(strpos($value, '.') === false) |
|
| 340 | - $control->attachEventHandler($name, [$contextControl,'TemplateControl.' . $value]); |
|
| 339 | + if(strpos($value, '.')===false) |
|
| 340 | + $control->attachEventHandler($name, [$contextControl, 'TemplateControl.'.$value]); |
|
| 341 | 341 | else |
| 342 | - $control->attachEventHandler($name, [$contextControl,$value]); |
|
| 342 | + $control->attachEventHandler($name, [$contextControl, $value]); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | /** |
@@ -362,25 +362,25 @@ discard block |
||
| 362 | 362 | $component->autoBindProperty($name, $value[1]); |
| 363 | 363 | else |
| 364 | 364 | { |
| 365 | - $setter = 'set' . $name; |
|
| 365 | + $setter='set'.$name; |
|
| 366 | 366 | $component->$setter($this->_tplControl->evaluateExpression($value[1])); |
| 367 | 367 | } |
| 368 | 368 | break; |
| 369 | 369 | case self::CONFIG_TEMPLATE: |
| 370 | - $setter = 'set' . $name; |
|
| 370 | + $setter='set'.$name; |
|
| 371 | 371 | $component->$setter($value[1]); |
| 372 | 372 | break; |
| 373 | 373 | case self::CONFIG_ASSET: // asset URL |
| 374 | - $setter = 'set' . $name; |
|
| 375 | - $url = $this->publishFilePath($this->_contextPath . DIRECTORY_SEPARATOR . $value[1]); |
|
| 374 | + $setter='set'.$name; |
|
| 375 | + $url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]); |
|
| 376 | 376 | $component->$setter($url); |
| 377 | 377 | break; |
| 378 | 378 | case self::CONFIG_PARAMETER: // application parameter |
| 379 | - $setter = 'set' . $name; |
|
| 379 | + $setter='set'.$name; |
|
| 380 | 380 | $component->$setter($this->getApplication()->getParameters()->itemAt($value[1])); |
| 381 | 381 | break; |
| 382 | 382 | case self::CONFIG_LOCALIZATION: |
| 383 | - $setter = 'set' . $name; |
|
| 383 | + $setter='set'.$name; |
|
| 384 | 384 | $component->$setter(Prado::localize($value[1])); |
| 385 | 385 | break; |
| 386 | 386 | default: // an error if reaching here |
@@ -390,10 +390,10 @@ discard block |
||
| 390 | 390 | } |
| 391 | 391 | else |
| 392 | 392 | { |
| 393 | - if (substr($name, 0, 2) == 'js') |
|
| 394 | - if ($value and !($value instanceof TJavaScriptLiteral)) |
|
| 395 | - $value = new TJavaScriptLiteral($value); |
|
| 396 | - $setter = 'set' . $name; |
|
| 393 | + if(substr($name, 0, 2)=='js') |
|
| 394 | + if($value and !($value instanceof TJavaScriptLiteral)) |
|
| 395 | + $value=new TJavaScriptLiteral($value); |
|
| 396 | + $setter='set'.$name; |
|
| 397 | 397 | $component->$setter($value); |
| 398 | 398 | } |
| 399 | 399 | } |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | $component->setSubProperty($name, $value[1]); |
| 424 | 424 | break; |
| 425 | 425 | case self::CONFIG_ASSET: // asset URL |
| 426 | - $url = $this->publishFilePath($this->_contextPath . DIRECTORY_SEPARATOR . $value[1]); |
|
| 426 | + $url=$this->publishFilePath($this->_contextPath.DIRECTORY_SEPARATOR.$value[1]); |
|
| 427 | 427 | $component->setSubProperty($name, $url); |
| 428 | 428 | break; |
| 429 | 429 | case self::CONFIG_PARAMETER: // application parameter |
@@ -464,240 +464,240 @@ discard block |
||
| 464 | 464 | */ |
| 465 | 465 | protected function parse($input) |
| 466 | 466 | { |
| 467 | - $input = $this->preprocess($input); |
|
| 468 | - $tpl = &$this->_tpl; |
|
| 469 | - $n = preg_match_all(self::REGEX_RULES, $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); |
|
| 470 | - $expectPropEnd = false; |
|
| 471 | - $textStart = 0; |
|
| 472 | - $stack = []; |
|
| 473 | - $container = -1; |
|
| 474 | - $matchEnd = 0; |
|
| 475 | - $c = 0; |
|
| 476 | - $this->_directive = null; |
|
| 467 | + $input=$this->preprocess($input); |
|
| 468 | + $tpl=&$this->_tpl; |
|
| 469 | + $n=preg_match_all(self::REGEX_RULES, $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); |
|
| 470 | + $expectPropEnd=false; |
|
| 471 | + $textStart=0; |
|
| 472 | + $stack=[]; |
|
| 473 | + $container=-1; |
|
| 474 | + $matchEnd=0; |
|
| 475 | + $c=0; |
|
| 476 | + $this->_directive=null; |
|
| 477 | 477 | try |
| 478 | 478 | { |
| 479 | - for($i = 0;$i < $n;++$i) |
|
| 479 | + for($i=0; $i < $n; ++$i) |
|
| 480 | 480 | { |
| 481 | - $match = &$matches[$i]; |
|
| 482 | - $str = $match[0][0]; |
|
| 483 | - $matchStart = $match[0][1]; |
|
| 484 | - $matchEnd = $matchStart + strlen($str) - 1; |
|
| 485 | - if(strpos($str, '<com:') === 0) // opening component tag |
|
| 481 | + $match=&$matches[$i]; |
|
| 482 | + $str=$match[0][0]; |
|
| 483 | + $matchStart=$match[0][1]; |
|
| 484 | + $matchEnd=$matchStart + strlen($str) - 1; |
|
| 485 | + if(strpos($str, '<com:')===0) // opening component tag |
|
| 486 | 486 | { |
| 487 | 487 | if($expectPropEnd) |
| 488 | 488 | continue; |
| 489 | 489 | if($matchStart > $textStart) |
| 490 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 491 | - $textStart = $matchEnd + 1; |
|
| 492 | - $type = $match[1][0]; |
|
| 493 | - $attributes = $this->parseAttributes($match[2][0], $match[2][1]); |
|
| 494 | - $class = $this->validateAttributes($type, $attributes); |
|
| 495 | - $tpl[$c++] = [$container,$class,$attributes]; |
|
| 496 | - if($str[strlen($str) - 2] !== '/') // open tag |
|
| 490 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 491 | + $textStart=$matchEnd + 1; |
|
| 492 | + $type=$match[1][0]; |
|
| 493 | + $attributes=$this->parseAttributes($match[2][0], $match[2][1]); |
|
| 494 | + $class=$this->validateAttributes($type, $attributes); |
|
| 495 | + $tpl[$c++]=[$container, $class, $attributes]; |
|
| 496 | + if($str[strlen($str) - 2]!=='/') // open tag |
|
| 497 | 497 | { |
| 498 | - $stack[] = $type; |
|
| 499 | - $container = $c - 1; |
|
| 498 | + $stack[]=$type; |
|
| 499 | + $container=$c - 1; |
|
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | - elseif(strpos($str, '</com:') === 0) // closing component tag |
|
| 502 | + elseif(strpos($str, '</com:')===0) // closing component tag |
|
| 503 | 503 | { |
| 504 | 504 | if($expectPropEnd) |
| 505 | 505 | continue; |
| 506 | 506 | if($matchStart > $textStart) |
| 507 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 508 | - $textStart = $matchEnd + 1; |
|
| 509 | - $type = $match[1][0]; |
|
| 507 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 508 | + $textStart=$matchEnd + 1; |
|
| 509 | + $type=$match[1][0]; |
|
| 510 | 510 | |
| 511 | 511 | if(empty($stack)) |
| 512 | 512 | throw new TConfigurationException('template_closingtag_unexpected', "</com:$type>"); |
| 513 | 513 | |
| 514 | - $name = array_pop($stack); |
|
| 515 | - if($name !== $type) |
|
| 514 | + $name=array_pop($stack); |
|
| 515 | + if($name!==$type) |
|
| 516 | 516 | { |
| 517 | - $tag = $name[0] === '@' ? '</prop:' . substr($name, 1) . '>' : "</com:$name>"; |
|
| 517 | + $tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>"; |
|
| 518 | 518 | throw new TConfigurationException('template_closingtag_expected', $tag, "</com:$type>"); |
| 519 | 519 | } |
| 520 | - $container = $tpl[$container][0]; |
|
| 520 | + $container=$tpl[$container][0]; |
|
| 521 | 521 | } |
| 522 | - elseif(strpos($str, '<%@') === 0) // directive |
|
| 522 | + elseif(strpos($str, '<%@')===0) // directive |
|
| 523 | 523 | { |
| 524 | 524 | if($expectPropEnd) |
| 525 | 525 | continue; |
| 526 | 526 | if($matchStart > $textStart) |
| 527 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 528 | - $textStart = $matchEnd + 1; |
|
| 529 | - if(isset($tpl[0]) || $this->_directive !== null) |
|
| 527 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 528 | + $textStart=$matchEnd + 1; |
|
| 529 | + if(isset($tpl[0]) || $this->_directive!==null) |
|
| 530 | 530 | throw new TConfigurationException('template_directive_nonunique'); |
| 531 | - $this->_directive = $this->parseAttributes($match[4][0], $match[4][1]); |
|
| 531 | + $this->_directive=$this->parseAttributes($match[4][0], $match[4][1]); |
|
| 532 | 532 | } |
| 533 | - elseif(strpos($str, '<%') === 0) // expression |
|
| 533 | + elseif(strpos($str, '<%')===0) // expression |
|
| 534 | 534 | { |
| 535 | 535 | if($expectPropEnd) |
| 536 | 536 | continue; |
| 537 | 537 | if($matchStart > $textStart) |
| 538 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 539 | - $textStart = $matchEnd + 1; |
|
| 540 | - $literal = trim($match[5][0]); |
|
| 541 | - if($str[2] === '=') // expression |
|
| 542 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,$literal]]; |
|
| 543 | - elseif($str[2] === '%') // statements |
|
| 544 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_STATEMENTS,$literal]]; |
|
| 545 | - elseif($str[2] === '#') |
|
| 546 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_DATABINDING,$literal]]; |
|
| 547 | - elseif($str[2] === '$') |
|
| 548 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"\$this->getApplication()->getParameters()->itemAt('$literal')"]]; |
|
| 549 | - elseif($str[2] === '~') |
|
| 550 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')"]]; |
|
| 551 | - elseif($str[2] === '/') |
|
| 552 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]]; |
|
| 553 | - elseif($str[2] === '[') |
|
| 538 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 539 | + $textStart=$matchEnd + 1; |
|
| 540 | + $literal=trim($match[5][0]); |
|
| 541 | + if($str[2]==='=') // expression |
|
| 542 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_EXPRESSION, $literal]]; |
|
| 543 | + elseif($str[2]==='%') // statements |
|
| 544 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_STATEMENTS, $literal]]; |
|
| 545 | + elseif($str[2]==='#') |
|
| 546 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_DATABINDING, $literal]]; |
|
| 547 | + elseif($str[2]==='$') |
|
| 548 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_EXPRESSION, "\$this->getApplication()->getParameters()->itemAt('$literal')"]]; |
|
| 549 | + elseif($str[2]==='~') |
|
| 550 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_EXPRESSION, "\$this->publishFilePath('$this->_contextPath/$literal')"]]; |
|
| 551 | + elseif($str[2]==='/') |
|
| 552 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]]; |
|
| 553 | + elseif($str[2]==='[') |
|
| 554 | 554 | { |
| 555 | - $literal = strtr(trim(substr($literal, 0, strlen($literal) - 1)), ["'" => "\'","\\" => "\\\\"]); |
|
| 556 | - $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"]]; |
|
| 555 | + $literal=strtr(trim(substr($literal, 0, strlen($literal) - 1)), ["'" => "\'", "\\" => "\\\\"]); |
|
| 556 | + $tpl[$c++]=[$container, [TCompositeLiteral::TYPE_EXPRESSION, "Prado::localize('$literal')"]]; |
|
| 557 | 557 | } |
| 558 | 558 | } |
| 559 | - elseif(strpos($str, '<prop:') === 0) // opening property |
|
| 559 | + elseif(strpos($str, '<prop:')===0) // opening property |
|
| 560 | 560 | { |
| 561 | - if(strrpos($str, '/>') === strlen($str) - 2) //subproperties |
|
| 561 | + if(strrpos($str, '/>')===strlen($str) - 2) //subproperties |
|
| 562 | 562 | { |
| 563 | 563 | if($expectPropEnd) |
| 564 | 564 | continue; |
| 565 | 565 | if($matchStart > $textStart) |
| 566 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 567 | - $textStart = $matchEnd + 1; |
|
| 568 | - $prop = strtolower($match[6][0]); |
|
| 569 | - $attrs = $this->parseAttributes($match[7][0], $match[7][1]); |
|
| 570 | - $attributes = []; |
|
| 566 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 567 | + $textStart=$matchEnd + 1; |
|
| 568 | + $prop=strtolower($match[6][0]); |
|
| 569 | + $attrs=$this->parseAttributes($match[7][0], $match[7][1]); |
|
| 570 | + $attributes=[]; |
|
| 571 | 571 | foreach($attrs as $name => $value) |
| 572 | - $attributes[$prop . '.' . $name] = $value; |
|
| 573 | - $type = $tpl[$container][1]; |
|
| 572 | + $attributes[$prop.'.'.$name]=$value; |
|
| 573 | + $type=$tpl[$container][1]; |
|
| 574 | 574 | $this->validateAttributes($type, $attributes); |
| 575 | 575 | foreach($attributes as $name => $value) |
| 576 | 576 | { |
| 577 | 577 | if(isset($tpl[$container][2][$name])) |
| 578 | 578 | throw new TConfigurationException('template_property_duplicated', $name); |
| 579 | - $tpl[$container][2][$name] = $value; |
|
| 579 | + $tpl[$container][2][$name]=$value; |
|
| 580 | 580 | } |
| 581 | 581 | } |
| 582 | 582 | else // regular property |
| 583 | 583 | { |
| 584 | - $prop = strtolower($match[3][0]); |
|
| 585 | - $stack[] = '@' . $prop; |
|
| 584 | + $prop=strtolower($match[3][0]); |
|
| 585 | + $stack[]='@'.$prop; |
|
| 586 | 586 | if(!$expectPropEnd) |
| 587 | 587 | { |
| 588 | 588 | if($matchStart > $textStart) |
| 589 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 590 | - $textStart = $matchEnd + 1; |
|
| 591 | - $expectPropEnd = true; |
|
| 589 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 590 | + $textStart=$matchEnd + 1; |
|
| 591 | + $expectPropEnd=true; |
|
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | - elseif(strpos($str, '</prop:') === 0) // closing property |
|
| 595 | + elseif(strpos($str, '</prop:')===0) // closing property |
|
| 596 | 596 | { |
| 597 | - $prop = strtolower($match[3][0]); |
|
| 597 | + $prop=strtolower($match[3][0]); |
|
| 598 | 598 | if(empty($stack)) |
| 599 | 599 | throw new TConfigurationException('template_closingtag_unexpected', "</prop:$prop>"); |
| 600 | - $name = array_pop($stack); |
|
| 601 | - if($name !== '@' . $prop) |
|
| 600 | + $name=array_pop($stack); |
|
| 601 | + if($name!=='@'.$prop) |
|
| 602 | 602 | { |
| 603 | - $tag = $name[0] === '@' ? '</prop:' . substr($name, 1) . '>' : "</com:$name>"; |
|
| 603 | + $tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>"; |
|
| 604 | 604 | throw new TConfigurationException('template_closingtag_expected', $tag, "</prop:$prop>"); |
| 605 | 605 | } |
| 606 | - if(($last = count($stack)) < 1 || $stack[$last - 1][0] !== '@') |
|
| 606 | + if(($last=count($stack)) < 1 || $stack[$last - 1][0]!=='@') |
|
| 607 | 607 | { |
| 608 | 608 | if($matchStart > $textStart) |
| 609 | 609 | { |
| 610 | - $value = substr($input, $textStart, $matchStart - $textStart); |
|
| 611 | - if(substr($prop, -8, 8) === 'template') |
|
| 612 | - $value = $this->parseTemplateProperty($value, $textStart); |
|
| 610 | + $value=substr($input, $textStart, $matchStart - $textStart); |
|
| 611 | + if(substr($prop, -8, 8)==='template') |
|
| 612 | + $value=$this->parseTemplateProperty($value, $textStart); |
|
| 613 | 613 | else |
| 614 | - $value = $this->parseAttribute($value); |
|
| 614 | + $value=$this->parseAttribute($value); |
|
| 615 | 615 | if($container >= 0) |
| 616 | 616 | { |
| 617 | - $type = $tpl[$container][1]; |
|
| 617 | + $type=$tpl[$container][1]; |
|
| 618 | 618 | $this->validateAttributes($type, [$prop => $value]); |
| 619 | 619 | if(isset($tpl[$container][2][$prop])) |
| 620 | 620 | throw new TConfigurationException('template_property_duplicated', $prop); |
| 621 | - $tpl[$container][2][$prop] = $value; |
|
| 621 | + $tpl[$container][2][$prop]=$value; |
|
| 622 | 622 | } |
| 623 | 623 | else // a property for the template control |
| 624 | - $this->_directive[$prop] = $value; |
|
| 625 | - $textStart = $matchEnd + 1; |
|
| 624 | + $this->_directive[$prop]=$value; |
|
| 625 | + $textStart=$matchEnd + 1; |
|
| 626 | 626 | } |
| 627 | - $expectPropEnd = false; |
|
| 627 | + $expectPropEnd=false; |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | - elseif(strpos($str, '<!--') === 0) // comments |
|
| 630 | + elseif(strpos($str, '<!--')===0) // comments |
|
| 631 | 631 | { |
| 632 | 632 | if($expectPropEnd) |
| 633 | 633 | throw new TConfigurationException('template_comments_forbidden'); |
| 634 | 634 | if($matchStart > $textStart) |
| 635 | - $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
|
| 636 | - $textStart = $matchEnd + 1; |
|
| 635 | + $tpl[$c++]=[$container, substr($input, $textStart, $matchStart - $textStart)]; |
|
| 636 | + $textStart=$matchEnd + 1; |
|
| 637 | 637 | } |
| 638 | 638 | else |
| 639 | 639 | throw new TConfigurationException('template_matching_unexpected', $match); |
| 640 | 640 | } |
| 641 | 641 | if(!empty($stack)) |
| 642 | 642 | { |
| 643 | - $name = array_pop($stack); |
|
| 644 | - $tag = $name[0] === '@' ? '</prop:' . substr($name, 1) . '>' : "</com:$name>"; |
|
| 643 | + $name=array_pop($stack); |
|
| 644 | + $tag=$name[0]==='@' ? '</prop:'.substr($name, 1).'>' : "</com:$name>"; |
|
| 645 | 645 | throw new TConfigurationException('template_closingtag_expected', $tag, "nothing"); |
| 646 | 646 | } |
| 647 | 647 | if($textStart < strlen($input)) |
| 648 | - $tpl[$c++] = [$container,substr($input, $textStart)]; |
|
| 648 | + $tpl[$c++]=[$container, substr($input, $textStart)]; |
|
| 649 | 649 | } |
| 650 | 650 | catch(\Exception $e) |
| 651 | 651 | { |
| 652 | 652 | if(($e instanceof TException) && ($e instanceof TTemplateException)) |
| 653 | 653 | throw $e; |
| 654 | - if($matchEnd === 0) |
|
| 655 | - $line = $this->_startingLine + 1; |
|
| 654 | + if($matchEnd===0) |
|
| 655 | + $line=$this->_startingLine + 1; |
|
| 656 | 656 | else |
| 657 | - $line = $this->_startingLine + count(explode("\n", substr($input, 0, $matchEnd + 1))); |
|
| 657 | + $line=$this->_startingLine + count(explode("\n", substr($input, 0, $matchEnd + 1))); |
|
| 658 | 658 | $this->handleException($e, $line, $input); |
| 659 | 659 | } |
| 660 | 660 | |
| 661 | - if($this->_directive === null) |
|
| 662 | - $this->_directive = []; |
|
| 661 | + if($this->_directive===null) |
|
| 662 | + $this->_directive=[]; |
|
| 663 | 663 | |
| 664 | 664 | // optimization by merging consecutive strings, expressions, statements and bindings |
| 665 | - $objects = []; |
|
| 666 | - $parent = null; |
|
| 667 | - $merged = []; |
|
| 665 | + $objects=[]; |
|
| 666 | + $parent=null; |
|
| 667 | + $merged=[]; |
|
| 668 | 668 | foreach($tpl as $id => $object) |
| 669 | 669 | { |
| 670 | - if(isset($object[2]) || $object[0] !== $parent) |
|
| 670 | + if(isset($object[2]) || $object[0]!==$parent) |
|
| 671 | 671 | { |
| 672 | - if($parent !== null) |
|
| 672 | + if($parent!==null) |
|
| 673 | 673 | { |
| 674 | - if(count($merged[1]) === 1 && is_string($merged[1][0])) |
|
| 675 | - $objects[$id - 1] = [$merged[0],$merged[1][0]]; |
|
| 674 | + if(count($merged[1])===1 && is_string($merged[1][0])) |
|
| 675 | + $objects[$id - 1]=[$merged[0], $merged[1][0]]; |
|
| 676 | 676 | else |
| 677 | - $objects[$id - 1] = [$merged[0],new TCompositeLiteral($merged[1])]; |
|
| 677 | + $objects[$id - 1]=[$merged[0], new TCompositeLiteral($merged[1])]; |
|
| 678 | 678 | } |
| 679 | 679 | if(isset($object[2])) |
| 680 | 680 | { |
| 681 | - $parent = null; |
|
| 682 | - $objects[$id] = $object; |
|
| 681 | + $parent=null; |
|
| 682 | + $objects[$id]=$object; |
|
| 683 | 683 | } |
| 684 | 684 | else |
| 685 | 685 | { |
| 686 | - $parent = $object[0]; |
|
| 687 | - $merged = [$parent,[$object[1]]]; |
|
| 686 | + $parent=$object[0]; |
|
| 687 | + $merged=[$parent, [$object[1]]]; |
|
| 688 | 688 | } |
| 689 | 689 | } |
| 690 | 690 | else |
| 691 | - $merged[1][] = $object[1]; |
|
| 691 | + $merged[1][]=$object[1]; |
|
| 692 | 692 | } |
| 693 | - if($parent !== null) |
|
| 693 | + if($parent!==null) |
|
| 694 | 694 | { |
| 695 | - if(count($merged[1]) === 1 && is_string($merged[1][0])) |
|
| 696 | - $objects[$id] = [$merged[0],$merged[1][0]]; |
|
| 695 | + if(count($merged[1])===1 && is_string($merged[1][0])) |
|
| 696 | + $objects[$id]=[$merged[0], $merged[1][0]]; |
|
| 697 | 697 | else |
| 698 | - $objects[$id] = [$merged[0],new TCompositeLiteral($merged[1])]; |
|
| 698 | + $objects[$id]=[$merged[0], new TCompositeLiteral($merged[1])]; |
|
| 699 | 699 | } |
| 700 | - $tpl = $objects; |
|
| 700 | + $tpl=$objects; |
|
| 701 | 701 | return $objects; |
| 702 | 702 | } |
| 703 | 703 | |
@@ -708,31 +708,31 @@ discard block |
||
| 708 | 708 | */ |
| 709 | 709 | protected function parseAttributes($str, $offset) |
| 710 | 710 | { |
| 711 | - if($str === '') |
|
| 711 | + if($str==='') |
|
| 712 | 712 | return []; |
| 713 | - $pattern = '/([\w\.\-]+)\s*=\s*(\'.*?\'|".*?"|<%.*?%>)/msS'; |
|
| 714 | - $attributes = []; |
|
| 715 | - $n = preg_match_all($pattern, $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); |
|
| 716 | - for($i = 0;$i < $n;++$i) |
|
| 713 | + $pattern='/([\w\.\-]+)\s*=\s*(\'.*?\'|".*?"|<%.*?%>)/msS'; |
|
| 714 | + $attributes=[]; |
|
| 715 | + $n=preg_match_all($pattern, $str, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE); |
|
| 716 | + for($i=0; $i < $n; ++$i) |
|
| 717 | 717 | { |
| 718 | - $match = &$matches[$i]; |
|
| 719 | - $name = strtolower($match[1][0]); |
|
| 718 | + $match=&$matches[$i]; |
|
| 719 | + $name=strtolower($match[1][0]); |
|
| 720 | 720 | if(isset($attributes[$name])) |
| 721 | 721 | throw new TConfigurationException('template_property_duplicated', $name); |
| 722 | - $value = $match[2][0]; |
|
| 723 | - if(substr($name, -8, 8) === 'template') |
|
| 722 | + $value=$match[2][0]; |
|
| 723 | + if(substr($name, -8, 8)==='template') |
|
| 724 | 724 | { |
| 725 | - if($value[0] === '\'' || $value[0] === '"') |
|
| 726 | - $attributes[$name] = $this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1); |
|
| 725 | + if($value[0]==='\'' || $value[0]==='"') |
|
| 726 | + $attributes[$name]=$this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1); |
|
| 727 | 727 | else |
| 728 | - $attributes[$name] = $this->parseTemplateProperty($value, $match[2][1]); |
|
| 728 | + $attributes[$name]=$this->parseTemplateProperty($value, $match[2][1]); |
|
| 729 | 729 | } |
| 730 | 730 | else |
| 731 | 731 | { |
| 732 | - if($value[0] === '\'' || $value[0] === '"') |
|
| 733 | - $attributes[$name] = $this->parseAttribute(substr($value, 1, strlen($value) - 2)); |
|
| 732 | + if($value[0]==='\'' || $value[0]==='"') |
|
| 733 | + $attributes[$name]=$this->parseAttribute(substr($value, 1, strlen($value) - 2)); |
|
| 734 | 734 | else |
| 735 | - $attributes[$name] = $this->parseAttribute($value); |
|
| 735 | + $attributes[$name]=$this->parseAttribute($value); |
|
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | return $attributes; |
@@ -740,8 +740,8 @@ discard block |
||
| 740 | 740 | |
| 741 | 741 | protected function parseTemplateProperty($content, $offset) |
| 742 | 742 | { |
| 743 | - $line = $this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1; |
|
| 744 | - return [self::CONFIG_TEMPLATE,new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false)]; |
|
| 743 | + $line=$this->_startingLine + count(explode("\n", substr($this->_content, 0, $offset))) - 1; |
|
| 744 | + return [self::CONFIG_TEMPLATE, new TTemplate($content, $this->_contextPath, $this->_tplFile, $line, false)]; |
|
| 745 | 745 | } |
| 746 | 746 | |
| 747 | 747 | /** |
@@ -751,44 +751,44 @@ discard block |
||
| 751 | 751 | */ |
| 752 | 752 | protected function parseAttribute($value) |
| 753 | 753 | { |
| 754 | - if(($n = preg_match_all('/<%[#=].*?%>/msS', $value, $matches, PREG_OFFSET_CAPTURE)) > 0) |
|
| 754 | + if(($n=preg_match_all('/<%[#=].*?%>/msS', $value, $matches, PREG_OFFSET_CAPTURE)) > 0) |
|
| 755 | 755 | { |
| 756 | - $isDataBind = false; |
|
| 757 | - $textStart = 0; |
|
| 758 | - $expr = ''; |
|
| 759 | - for($i = 0;$i < $n;++$i) |
|
| 756 | + $isDataBind=false; |
|
| 757 | + $textStart=0; |
|
| 758 | + $expr=''; |
|
| 759 | + for($i=0; $i < $n; ++$i) |
|
| 760 | 760 | { |
| 761 | - $match = $matches[0][$i]; |
|
| 762 | - $token = $match[0]; |
|
| 763 | - $offset = $match[1]; |
|
| 764 | - $length = strlen($token); |
|
| 765 | - if($token[2] === '#') |
|
| 766 | - $isDataBind = true; |
|
| 761 | + $match=$matches[0][$i]; |
|
| 762 | + $token=$match[0]; |
|
| 763 | + $offset=$match[1]; |
|
| 764 | + $length=strlen($token); |
|
| 765 | + if($token[2]==='#') |
|
| 766 | + $isDataBind=true; |
|
| 767 | 767 | if($offset > $textStart) |
| 768 | - $expr .= ".'" . strtr(substr($value, $textStart, $offset - $textStart), ["'" => "\\'","\\" => "\\\\"]) . "'"; |
|
| 769 | - $expr .= '.(' . substr($token, 3, $length - 5) . ')'; |
|
| 770 | - $textStart = $offset + $length; |
|
| 768 | + $expr.=".'".strtr(substr($value, $textStart, $offset - $textStart), ["'" => "\\'", "\\" => "\\\\"])."'"; |
|
| 769 | + $expr.='.('.substr($token, 3, $length - 5).')'; |
|
| 770 | + $textStart=$offset + $length; |
|
| 771 | 771 | } |
| 772 | - $length = strlen($value); |
|
| 772 | + $length=strlen($value); |
|
| 773 | 773 | if($length > $textStart) |
| 774 | - $expr .= ".'" . strtr(substr($value, $textStart, $length - $textStart), ["'" => "\\'","\\" => "\\\\"]) . "'"; |
|
| 774 | + $expr.=".'".strtr(substr($value, $textStart, $length - $textStart), ["'" => "\\'", "\\" => "\\\\"])."'"; |
|
| 775 | 775 | if($isDataBind) |
| 776 | - return [self::CONFIG_DATABIND,ltrim($expr, '.')]; |
|
| 776 | + return [self::CONFIG_DATABIND, ltrim($expr, '.')]; |
|
| 777 | 777 | else |
| 778 | - return [self::CONFIG_EXPRESSION,ltrim($expr, '.')]; |
|
| 778 | + return [self::CONFIG_EXPRESSION, ltrim($expr, '.')]; |
|
| 779 | 779 | } |
| 780 | - elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0] === $value) |
|
| 780 | + elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0]===$value) |
|
| 781 | 781 | { |
| 782 | - $value = $matches[1]; |
|
| 783 | - if($value[2] === '~') |
|
| 784 | - return [self::CONFIG_ASSET,trim(substr($value, 3, strlen($value) - 5))]; |
|
| 785 | - elseif($value[2] === '[') |
|
| 786 | - return [self::CONFIG_LOCALIZATION,trim(substr($value, 3, strlen($value) - 6))]; |
|
| 787 | - elseif($value[2] === '$') |
|
| 788 | - return [self::CONFIG_PARAMETER,trim(substr($value, 3, strlen($value) - 5))]; |
|
| 789 | - elseif($value[2] === '/') { |
|
| 790 | - $literal = trim(substr($value, 3, strlen($value) - 5)); |
|
| 791 | - return [self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]; |
|
| 782 | + $value=$matches[1]; |
|
| 783 | + if($value[2]==='~') |
|
| 784 | + return [self::CONFIG_ASSET, trim(substr($value, 3, strlen($value) - 5))]; |
|
| 785 | + elseif($value[2]==='[') |
|
| 786 | + return [self::CONFIG_LOCALIZATION, trim(substr($value, 3, strlen($value) - 6))]; |
|
| 787 | + elseif($value[2]==='$') |
|
| 788 | + return [self::CONFIG_PARAMETER, trim(substr($value, 3, strlen($value) - 5))]; |
|
| 789 | + elseif($value[2]==='/') { |
|
| 790 | + $literal=trim(substr($value, 3, strlen($value) - 5)); |
|
| 791 | + return [self::CONFIG_EXPRESSION, "rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]; |
|
| 792 | 792 | } |
| 793 | 793 | } |
| 794 | 794 | else |
@@ -798,23 +798,23 @@ discard block |
||
| 798 | 798 | protected function validateAttributes($type, $attributes) |
| 799 | 799 | { |
| 800 | 800 | Prado::using($type); |
| 801 | - if(($pos = strrpos($type, '.')) !== false) |
|
| 802 | - $className = substr($type, $pos + 1); |
|
| 801 | + if(($pos=strrpos($type, '.'))!==false) |
|
| 802 | + $className=substr($type, $pos + 1); |
|
| 803 | 803 | else |
| 804 | - $className = $type; |
|
| 805 | - $class = new \ReflectionClass($className); |
|
| 806 | - if(is_subclass_of($className, '\Prado\Web\UI\TControl') || $className === '\Prado\Web\UI\TControl') |
|
| 804 | + $className=$type; |
|
| 805 | + $class=new \ReflectionClass($className); |
|
| 806 | + if(is_subclass_of($className, '\Prado\Web\UI\TControl') || $className==='\Prado\Web\UI\TControl') |
|
| 807 | 807 | { |
| 808 | 808 | foreach($attributes as $name => $att) |
| 809 | 809 | { |
| 810 | - if(($pos = strpos($name, '.')) !== false) |
|
| 810 | + if(($pos=strpos($name, '.'))!==false) |
|
| 811 | 811 | { |
| 812 | 812 | // a subproperty, so the first segment must be readable |
| 813 | - $subname = substr($name, 0, $pos); |
|
| 814 | - if(!$class->hasMethod('get' . $subname)) |
|
| 813 | + $subname=substr($name, 0, $pos); |
|
| 814 | + if(!$class->hasMethod('get'.$subname)) |
|
| 815 | 815 | throw new TConfigurationException('template_property_unknown', $type, $subname); |
| 816 | 816 | } |
| 817 | - elseif(strncasecmp($name, 'on', 2) === 0) |
|
| 817 | + elseif(strncasecmp($name, 'on', 2)===0) |
|
| 818 | 818 | { |
| 819 | 819 | // an event |
| 820 | 820 | if(!$class->hasMethod($name)) |
@@ -825,44 +825,44 @@ discard block |
||
| 825 | 825 | else |
| 826 | 826 | { |
| 827 | 827 | // a simple property |
| 828 | - if (! ($class->hasMethod('set' . $name) || $class->hasMethod('setjs' . $name) || $this->isClassBehaviorMethod($class, 'set' . $name))) |
|
| 828 | + if(!($class->hasMethod('set'.$name) || $class->hasMethod('setjs'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name))) |
|
| 829 | 829 | { |
| 830 | - if ($class->hasMethod('get' . $name) || $class->hasMethod('getjs' . $name)) |
|
| 830 | + if($class->hasMethod('get'.$name) || $class->hasMethod('getjs'.$name)) |
|
| 831 | 831 | throw new TConfigurationException('template_property_readonly', $type, $name); |
| 832 | 832 | else |
| 833 | 833 | throw new TConfigurationException('template_property_unknown', $type, $name); |
| 834 | 834 | } |
| 835 | - elseif(is_array($att) && $att[0] !== self::CONFIG_EXPRESSION) |
|
| 835 | + elseif(is_array($att) && $att[0]!==self::CONFIG_EXPRESSION) |
|
| 836 | 836 | { |
| 837 | - if(strcasecmp($name, 'id') === 0) |
|
| 837 | + if(strcasecmp($name, 'id')===0) |
|
| 838 | 838 | throw new TConfigurationException('template_controlid_invalid', $type); |
| 839 | - elseif(strcasecmp($name, 'skinid') === 0) |
|
| 839 | + elseif(strcasecmp($name, 'skinid')===0) |
|
| 840 | 840 | throw new TConfigurationException('template_controlskinid_invalid', $type); |
| 841 | 841 | } |
| 842 | 842 | } |
| 843 | 843 | } |
| 844 | 844 | } |
| 845 | - elseif(is_subclass_of($className, '\Prado\TComponent') || $className === '\Prado\TComponent') |
|
| 845 | + elseif(is_subclass_of($className, '\Prado\TComponent') || $className==='\Prado\TComponent') |
|
| 846 | 846 | { |
| 847 | 847 | foreach($attributes as $name => $att) |
| 848 | 848 | { |
| 849 | - if(is_array($att) && ($att[0] === self::CONFIG_DATABIND)) |
|
| 849 | + if(is_array($att) && ($att[0]===self::CONFIG_DATABIND)) |
|
| 850 | 850 | throw new TConfigurationException('template_databind_forbidden', $type, $name); |
| 851 | - if(($pos = strpos($name, '.')) !== false) |
|
| 851 | + if(($pos=strpos($name, '.'))!==false) |
|
| 852 | 852 | { |
| 853 | 853 | // a subproperty, so the first segment must be readable |
| 854 | - $subname = substr($name, 0, $pos); |
|
| 855 | - if(!$class->hasMethod('get' . $subname)) |
|
| 854 | + $subname=substr($name, 0, $pos); |
|
| 855 | + if(!$class->hasMethod('get'.$subname)) |
|
| 856 | 856 | throw new TConfigurationException('template_property_unknown', $type, $subname); |
| 857 | 857 | } |
| 858 | - elseif(strncasecmp($name, 'on', 2) === 0) |
|
| 858 | + elseif(strncasecmp($name, 'on', 2)===0) |
|
| 859 | 859 | throw new TConfigurationException('template_event_forbidden', $type, $name); |
| 860 | 860 | else |
| 861 | 861 | { |
| 862 | 862 | // id is still alowed for TComponent, even if id property doesn't exist |
| 863 | - if(strcasecmp($name, 'id') !== 0 && !($class->hasMethod('set' . $name) || $this->isClassBehaviorMethod($class, 'set' . $name))) |
|
| 863 | + if(strcasecmp($name, 'id')!==0 && !($class->hasMethod('set'.$name) || $this->isClassBehaviorMethod($class, 'set'.$name))) |
|
| 864 | 864 | { |
| 865 | - if($class->hasMethod('get' . $name)) |
|
| 865 | + if($class->hasMethod('get'.$name)) |
|
| 866 | 866 | throw new TConfigurationException('template_property_readonly', $type, $name); |
| 867 | 867 | else |
| 868 | 868 | throw new TConfigurationException('template_property_unknown', $type, $name); |
@@ -891,28 +891,28 @@ discard block |
||
| 891 | 891 | * @param int line number |
| 892 | 892 | * @param string template string if no source file is used |
| 893 | 893 | */ |
| 894 | - protected function handleException($e, $line, $input = null) |
|
| 894 | + protected function handleException($e, $line, $input=null) |
|
| 895 | 895 | { |
| 896 | - $srcFile = $this->_tplFile; |
|
| 896 | + $srcFile=$this->_tplFile; |
|
| 897 | 897 | |
| 898 | - if(($n = count($this->_includedFiles)) > 0) // need to adjust error row number and file name |
|
| 898 | + if(($n=count($this->_includedFiles)) > 0) // need to adjust error row number and file name |
|
| 899 | 899 | { |
| 900 | - for($i = $n - 1;$i >= 0;--$i) |
|
| 900 | + for($i=$n - 1; $i >= 0; --$i) |
|
| 901 | 901 | { |
| 902 | 902 | if($this->_includeAtLine[$i] <= $line) |
| 903 | 903 | { |
| 904 | 904 | if($line < $this->_includeAtLine[$i] + $this->_includeLines[$i]) |
| 905 | 905 | { |
| 906 | - $line = $line - $this->_includeAtLine[$i] + 1; |
|
| 907 | - $srcFile = $this->_includedFiles[$i]; |
|
| 906 | + $line=$line - $this->_includeAtLine[$i] + 1; |
|
| 907 | + $srcFile=$this->_includedFiles[$i]; |
|
| 908 | 908 | break; |
| 909 | 909 | } |
| 910 | 910 | else |
| 911 | - $line = $line - $this->_includeLines[$i] + 1; |
|
| 911 | + $line=$line - $this->_includeLines[$i] + 1; |
|
| 912 | 912 | } |
| 913 | 913 | } |
| 914 | 914 | } |
| 915 | - $exception = new TTemplateException('template_format_invalid', $e->getMessage()); |
|
| 915 | + $exception=new TTemplateException('template_format_invalid', $e->getMessage()); |
|
| 916 | 916 | $exception->setLineNumber($line); |
| 917 | 917 | if(!empty($srcFile)) |
| 918 | 918 | $exception->setTemplateFile($srcFile); |
@@ -928,29 +928,29 @@ discard block |
||
| 928 | 928 | */ |
| 929 | 929 | protected function preprocess($input) |
| 930 | 930 | { |
| 931 | - if($n = preg_match_all('/<%include(.*?)%>/', $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) |
|
| 931 | + if($n=preg_match_all('/<%include(.*?)%>/', $input, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE)) |
|
| 932 | 932 | { |
| 933 | - for($i = 0;$i < $n;++$i) |
|
| 933 | + for($i=0; $i < $n; ++$i) |
|
| 934 | 934 | { |
| 935 | - $filePath = Prado::getPathOfNamespace(trim($matches[$i][1][0]), TTemplateManager::TEMPLATE_FILE_EXT); |
|
| 936 | - if($filePath !== null && is_file($filePath)) |
|
| 937 | - $this->_includedFiles[] = $filePath; |
|
| 935 | + $filePath=Prado::getPathOfNamespace(trim($matches[$i][1][0]), TTemplateManager::TEMPLATE_FILE_EXT); |
|
| 936 | + if($filePath!==null && is_file($filePath)) |
|
| 937 | + $this->_includedFiles[]=$filePath; |
|
| 938 | 938 | else |
| 939 | 939 | { |
| 940 | - $errorLine = count(explode("\n", substr($input, 0, $matches[$i][0][1] + 1))); |
|
| 940 | + $errorLine=count(explode("\n", substr($input, 0, $matches[$i][0][1] + 1))); |
|
| 941 | 941 | $this->handleException(new TConfigurationException('template_include_invalid', trim($matches[$i][1][0])), $errorLine, $input); |
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | - $base = 0; |
|
| 945 | - for($i = 0;$i < $n;++$i) |
|
| 944 | + $base=0; |
|
| 945 | + for($i=0; $i < $n; ++$i) |
|
| 946 | 946 | { |
| 947 | - $ext = file_get_contents($this->_includedFiles[$i]); |
|
| 948 | - $length = strlen($matches[$i][0][0]); |
|
| 949 | - $offset = $base + $matches[$i][0][1]; |
|
| 950 | - $this->_includeAtLine[$i] = count(explode("\n", substr($input, 0, $offset))); |
|
| 951 | - $this->_includeLines[$i] = count(explode("\n", $ext)); |
|
| 952 | - $input = substr_replace($input, $ext, $offset, $length); |
|
| 953 | - $base += strlen($ext) - $length; |
|
| 947 | + $ext=file_get_contents($this->_includedFiles[$i]); |
|
| 948 | + $length=strlen($matches[$i][0][0]); |
|
| 949 | + $offset=$base + $matches[$i][0][1]; |
|
| 950 | + $this->_includeAtLine[$i]=count(explode("\n", substr($input, 0, $offset))); |
|
| 951 | + $this->_includeLines[$i]=count(explode("\n", $ext)); |
|
| 952 | + $input=substr_replace($input, $ext, $offset, $length); |
|
| 953 | + $base+=strlen($ext) - $length; |
|
| 954 | 954 | } |
| 955 | 955 | } |
| 956 | 956 | |
@@ -965,13 +965,13 @@ discard block |
||
| 965 | 965 | */ |
| 966 | 966 | protected function isClassBehaviorMethod(\ReflectionClass $class, $method) |
| 967 | 967 | { |
| 968 | - $component = new \ReflectionClass('\Prado\TComponent'); |
|
| 969 | - $behaviors = $component->getStaticProperties(); |
|
| 968 | + $component=new \ReflectionClass('\Prado\TComponent'); |
|
| 969 | + $behaviors=$component->getStaticProperties(); |
|
| 970 | 970 | if(!isset($behaviors['_um'])) |
| 971 | 971 | return false; |
| 972 | 972 | foreach($behaviors['_um'] as $name => $list) |
| 973 | 973 | { |
| 974 | - if(strtolower($class->getShortName()) !== $name && !$class->isSubclassOf($name)) continue; |
|
| 974 | + if(strtolower($class->getShortName())!==$name && !$class->isSubclassOf($name)) continue; |
|
| 975 | 975 | foreach($list as $param) |
| 976 | 976 | { |
| 977 | 977 | if(method_exists($param->getBehavior(), $method)) |
@@ -244,8 +244,7 @@ discard block |
||
| 244 | 244 | $component->createdOnTemplate($parent); |
| 245 | 245 | if($component->getAllowChildControls()) |
| 246 | 246 | $controls[$key] = $component; |
| 247 | - } |
|
| 248 | - elseif($component instanceof TComponent) |
|
| 247 | + } elseif($component instanceof TComponent) |
|
| 249 | 248 | { |
| 250 | 249 | $controls[$key] = $component; |
| 251 | 250 | if(isset($properties['id'])) |
@@ -263,8 +262,7 @@ discard block |
||
| 263 | 262 | else |
| 264 | 263 | $component->createdOnTemplate($parent); |
| 265 | 264 | } |
| 266 | - } |
|
| 267 | - else |
|
| 265 | + } else |
|
| 268 | 266 | { |
| 269 | 267 | if($object[1] instanceof TCompositeLiteral) |
| 270 | 268 | { |
@@ -275,8 +273,7 @@ discard block |
||
| 275 | 273 | $directChildren[] = $o; |
| 276 | 274 | else |
| 277 | 275 | $parent->addParsedObject($o); |
| 278 | - } |
|
| 279 | - else |
|
| 276 | + } else |
|
| 280 | 277 | { |
| 281 | 278 | if($parent === $parentControl) |
| 282 | 279 | $directChildren[] = $object[1]; |
@@ -387,8 +384,7 @@ discard block |
||
| 387 | 384 | throw new TConfigurationException('template_tag_unexpected', $name, $value[1]); |
| 388 | 385 | break; |
| 389 | 386 | } |
| 390 | - } |
|
| 391 | - else |
|
| 387 | + } else |
|
| 392 | 388 | { |
| 393 | 389 | if (substr($name, 0, 2) == 'js') |
| 394 | 390 | if ($value and !($value instanceof TJavaScriptLiteral)) |
@@ -436,8 +432,7 @@ discard block |
||
| 436 | 432 | throw new TConfigurationException('template_tag_unexpected', $name, $value[1]); |
| 437 | 433 | break; |
| 438 | 434 | } |
| 439 | - } |
|
| 440 | - else |
|
| 435 | + } else |
|
| 441 | 436 | $component->setSubProperty($name, $value); |
| 442 | 437 | } |
| 443 | 438 | |
@@ -498,8 +493,7 @@ discard block |
||
| 498 | 493 | $stack[] = $type; |
| 499 | 494 | $container = $c - 1; |
| 500 | 495 | } |
| 501 | - } |
|
| 502 | - elseif(strpos($str, '</com:') === 0) // closing component tag |
|
| 496 | + } elseif(strpos($str, '</com:') === 0) // closing component tag |
|
| 503 | 497 | { |
| 504 | 498 | if($expectPropEnd) |
| 505 | 499 | continue; |
@@ -518,8 +512,7 @@ discard block |
||
| 518 | 512 | throw new TConfigurationException('template_closingtag_expected', $tag, "</com:$type>"); |
| 519 | 513 | } |
| 520 | 514 | $container = $tpl[$container][0]; |
| 521 | - } |
|
| 522 | - elseif(strpos($str, '<%@') === 0) // directive |
|
| 515 | + } elseif(strpos($str, '<%@') === 0) // directive |
|
| 523 | 516 | { |
| 524 | 517 | if($expectPropEnd) |
| 525 | 518 | continue; |
@@ -529,8 +522,7 @@ discard block |
||
| 529 | 522 | if(isset($tpl[0]) || $this->_directive !== null) |
| 530 | 523 | throw new TConfigurationException('template_directive_nonunique'); |
| 531 | 524 | $this->_directive = $this->parseAttributes($match[4][0], $match[4][1]); |
| 532 | - } |
|
| 533 | - elseif(strpos($str, '<%') === 0) // expression |
|
| 525 | + } elseif(strpos($str, '<%') === 0) // expression |
|
| 534 | 526 | { |
| 535 | 527 | if($expectPropEnd) |
| 536 | 528 | continue; |
@@ -555,8 +547,7 @@ discard block |
||
| 555 | 547 | $literal = strtr(trim(substr($literal, 0, strlen($literal) - 1)), ["'" => "\'","\\" => "\\\\"]); |
| 556 | 548 | $tpl[$c++] = [$container,[TCompositeLiteral::TYPE_EXPRESSION,"Prado::localize('$literal')"]]; |
| 557 | 549 | } |
| 558 | - } |
|
| 559 | - elseif(strpos($str, '<prop:') === 0) // opening property |
|
| 550 | + } elseif(strpos($str, '<prop:') === 0) // opening property |
|
| 560 | 551 | { |
| 561 | 552 | if(strrpos($str, '/>') === strlen($str) - 2) //subproperties |
| 562 | 553 | { |
@@ -578,8 +569,7 @@ discard block |
||
| 578 | 569 | throw new TConfigurationException('template_property_duplicated', $name); |
| 579 | 570 | $tpl[$container][2][$name] = $value; |
| 580 | 571 | } |
| 581 | - } |
|
| 582 | - else // regular property |
|
| 572 | + } else // regular property |
|
| 583 | 573 | { |
| 584 | 574 | $prop = strtolower($match[3][0]); |
| 585 | 575 | $stack[] = '@' . $prop; |
@@ -591,8 +581,7 @@ discard block |
||
| 591 | 581 | $expectPropEnd = true; |
| 592 | 582 | } |
| 593 | 583 | } |
| 594 | - } |
|
| 595 | - elseif(strpos($str, '</prop:') === 0) // closing property |
|
| 584 | + } elseif(strpos($str, '</prop:') === 0) // closing property |
|
| 596 | 585 | { |
| 597 | 586 | $prop = strtolower($match[3][0]); |
| 598 | 587 | if(empty($stack)) |
@@ -619,23 +608,20 @@ discard block |
||
| 619 | 608 | if(isset($tpl[$container][2][$prop])) |
| 620 | 609 | throw new TConfigurationException('template_property_duplicated', $prop); |
| 621 | 610 | $tpl[$container][2][$prop] = $value; |
| 622 | - } |
|
| 623 | - else // a property for the template control |
|
| 611 | + } else // a property for the template control |
|
| 624 | 612 | $this->_directive[$prop] = $value; |
| 625 | 613 | $textStart = $matchEnd + 1; |
| 626 | 614 | } |
| 627 | 615 | $expectPropEnd = false; |
| 628 | 616 | } |
| 629 | - } |
|
| 630 | - elseif(strpos($str, '<!--') === 0) // comments |
|
| 617 | + } elseif(strpos($str, '<!--') === 0) // comments |
|
| 631 | 618 | { |
| 632 | 619 | if($expectPropEnd) |
| 633 | 620 | throw new TConfigurationException('template_comments_forbidden'); |
| 634 | 621 | if($matchStart > $textStart) |
| 635 | 622 | $tpl[$c++] = [$container,substr($input, $textStart, $matchStart - $textStart)]; |
| 636 | 623 | $textStart = $matchEnd + 1; |
| 637 | - } |
|
| 638 | - else |
|
| 624 | + } else |
|
| 639 | 625 | throw new TConfigurationException('template_matching_unexpected', $match); |
| 640 | 626 | } |
| 641 | 627 | if(!empty($stack)) |
@@ -646,8 +632,7 @@ discard block |
||
| 646 | 632 | } |
| 647 | 633 | if($textStart < strlen($input)) |
| 648 | 634 | $tpl[$c++] = [$container,substr($input, $textStart)]; |
| 649 | - } |
|
| 650 | - catch(\Exception $e) |
|
| 635 | + } catch(\Exception $e) |
|
| 651 | 636 | { |
| 652 | 637 | if(($e instanceof TException) && ($e instanceof TTemplateException)) |
| 653 | 638 | throw $e; |
@@ -680,14 +665,12 @@ discard block |
||
| 680 | 665 | { |
| 681 | 666 | $parent = null; |
| 682 | 667 | $objects[$id] = $object; |
| 683 | - } |
|
| 684 | - else |
|
| 668 | + } else |
|
| 685 | 669 | { |
| 686 | 670 | $parent = $object[0]; |
| 687 | 671 | $merged = [$parent,[$object[1]]]; |
| 688 | 672 | } |
| 689 | - } |
|
| 690 | - else |
|
| 673 | + } else |
|
| 691 | 674 | $merged[1][] = $object[1]; |
| 692 | 675 | } |
| 693 | 676 | if($parent !== null) |
@@ -726,8 +709,7 @@ discard block |
||
| 726 | 709 | $attributes[$name] = $this->parseTemplateProperty(substr($value, 1, strlen($value) - 2), $match[2][1] + 1); |
| 727 | 710 | else |
| 728 | 711 | $attributes[$name] = $this->parseTemplateProperty($value, $match[2][1]); |
| 729 | - } |
|
| 730 | - else |
|
| 712 | + } else |
|
| 731 | 713 | { |
| 732 | 714 | if($value[0] === '\'' || $value[0] === '"') |
| 733 | 715 | $attributes[$name] = $this->parseAttribute(substr($value, 1, strlen($value) - 2)); |
@@ -776,8 +758,7 @@ discard block |
||
| 776 | 758 | return [self::CONFIG_DATABIND,ltrim($expr, '.')]; |
| 777 | 759 | else |
| 778 | 760 | return [self::CONFIG_EXPRESSION,ltrim($expr, '.')]; |
| 779 | - } |
|
| 780 | - elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0] === $value) |
|
| 761 | + } elseif(preg_match('/\\s*(<%~.*?%>|<%\\$.*?%>|<%\\[.*?\\]%>|<%\/.*?%>)\\s*/msS', $value, $matches) && $matches[0] === $value) |
|
| 781 | 762 | { |
| 782 | 763 | $value = $matches[1]; |
| 783 | 764 | if($value[2] === '~') |
@@ -790,8 +771,7 @@ discard block |
||
| 790 | 771 | $literal = trim(substr($value, 3, strlen($value) - 5)); |
| 791 | 772 | return [self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '\/').'/$literal'"]; |
| 792 | 773 | } |
| 793 | - } |
|
| 794 | - else |
|
| 774 | + } else |
|
| 795 | 775 | return $value; |
| 796 | 776 | } |
| 797 | 777 | |
@@ -813,16 +793,14 @@ discard block |
||
| 813 | 793 | $subname = substr($name, 0, $pos); |
| 814 | 794 | if(!$class->hasMethod('get' . $subname)) |
| 815 | 795 | throw new TConfigurationException('template_property_unknown', $type, $subname); |
| 816 | - } |
|
| 817 | - elseif(strncasecmp($name, 'on', 2) === 0) |
|
| 796 | + } elseif(strncasecmp($name, 'on', 2) === 0) |
|
| 818 | 797 | { |
| 819 | 798 | // an event |
| 820 | 799 | if(!$class->hasMethod($name)) |
| 821 | 800 | throw new TConfigurationException('template_event_unknown', $type, $name); |
| 822 | 801 | elseif(!is_string($att)) |
| 823 | 802 | throw new TConfigurationException('template_eventhandler_invalid', $type, $name); |
| 824 | - } |
|
| 825 | - else |
|
| 803 | + } else |
|
| 826 | 804 | { |
| 827 | 805 | // a simple property |
| 828 | 806 | if (! ($class->hasMethod('set' . $name) || $class->hasMethod('setjs' . $name) || $this->isClassBehaviorMethod($class, 'set' . $name))) |
@@ -831,8 +809,7 @@ discard block |
||
| 831 | 809 | throw new TConfigurationException('template_property_readonly', $type, $name); |
| 832 | 810 | else |
| 833 | 811 | throw new TConfigurationException('template_property_unknown', $type, $name); |
| 834 | - } |
|
| 835 | - elseif(is_array($att) && $att[0] !== self::CONFIG_EXPRESSION) |
|
| 812 | + } elseif(is_array($att) && $att[0] !== self::CONFIG_EXPRESSION) |
|
| 836 | 813 | { |
| 837 | 814 | if(strcasecmp($name, 'id') === 0) |
| 838 | 815 | throw new TConfigurationException('template_controlid_invalid', $type); |
@@ -841,8 +818,7 @@ discard block |
||
| 841 | 818 | } |
| 842 | 819 | } |
| 843 | 820 | } |
| 844 | - } |
|
| 845 | - elseif(is_subclass_of($className, '\Prado\TComponent') || $className === '\Prado\TComponent') |
|
| 821 | + } elseif(is_subclass_of($className, '\Prado\TComponent') || $className === '\Prado\TComponent') |
|
| 846 | 822 | { |
| 847 | 823 | foreach($attributes as $name => $att) |
| 848 | 824 | { |
@@ -854,8 +830,7 @@ discard block |
||
| 854 | 830 | $subname = substr($name, 0, $pos); |
| 855 | 831 | if(!$class->hasMethod('get' . $subname)) |
| 856 | 832 | throw new TConfigurationException('template_property_unknown', $type, $subname); |
| 857 | - } |
|
| 858 | - elseif(strncasecmp($name, 'on', 2) === 0) |
|
| 833 | + } elseif(strncasecmp($name, 'on', 2) === 0) |
|
| 859 | 834 | throw new TConfigurationException('template_event_forbidden', $type, $name); |
| 860 | 835 | else |
| 861 | 836 | { |
@@ -869,8 +844,7 @@ discard block |
||
| 869 | 844 | } |
| 870 | 845 | } |
| 871 | 846 | } |
| 872 | - } |
|
| 873 | - else |
|
| 847 | + } else |
|
| 874 | 848 | throw new TConfigurationException('template_component_required', $type); |
| 875 | 849 | return $class->getName(); |
| 876 | 850 | } |
@@ -906,8 +880,7 @@ discard block |
||
| 906 | 880 | $line = $line - $this->_includeAtLine[$i] + 1; |
| 907 | 881 | $srcFile = $this->_includedFiles[$i]; |
| 908 | 882 | break; |
| 909 | - } |
|
| 910 | - else |
|
| 883 | + } else |
|
| 911 | 884 | $line = $line - $this->_includeLines[$i] + 1; |
| 912 | 885 | } |
| 913 | 886 | } |