@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function insertAt($index, $item) |
| 62 | 62 | { |
| 63 | - if($item instanceof TControl) |
|
| 63 | + if ($item instanceof TControl) |
|
| 64 | 64 | { |
| 65 | 65 | parent::insertAt($index, $item); |
| 66 | 66 | $this->_o->addedControl($item); |
| 67 | 67 | } |
| 68 | - elseif(is_string($item) || ($item instanceof IRenderable)) |
|
| 68 | + elseif (is_string($item) || ($item instanceof IRenderable)) |
|
| 69 | 69 | parent::insertAt($index, $item); |
| 70 | 70 | else |
| 71 | 71 | throw new TInvalidDataTypeException('controlcollection_control_required'); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function removeAt($index) |
| 82 | 82 | { |
| 83 | 83 | $item = parent::removeAt($index); |
| 84 | - if($item instanceof TControl) |
|
| 84 | + if ($item instanceof TControl) |
|
| 85 | 85 | $this->_o->removedControl($item); |
| 86 | 86 | return $item; |
| 87 | 87 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function clear() |
| 93 | 93 | { |
| 94 | 94 | parent::clear(); |
| 95 | - if($this->_o instanceof INamingContainer) |
|
| 95 | + if ($this->_o instanceof INamingContainer) |
|
| 96 | 96 | $this->_o->clearNamingContainer(); |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | \ No newline at end of file |
@@ -89,33 +89,33 @@ discard block |
||
| 89 | 89 | $this->_name = basename($themePath); |
| 90 | 90 | $cacheValid = false; |
| 91 | 91 | // TODO: the following needs to be cleaned up (Qiang) |
| 92 | - if(($cache = $this->getApplication()->getCache()) !== null) |
|
| 92 | + if (($cache = $this->getApplication()->getCache()) !== null) |
|
| 93 | 93 | { |
| 94 | - $array = $cache->get(self::THEME_CACHE_PREFIX . $themePath); |
|
| 95 | - if(is_array($array)) |
|
| 94 | + $array = $cache->get(self::THEME_CACHE_PREFIX.$themePath); |
|
| 95 | + if (is_array($array)) |
|
| 96 | 96 | { |
| 97 | 97 | list($skins, $cssFiles, $jsFiles, $timestamp) = $array; |
| 98 | - if($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
| 98 | + if ($this->getApplication()->getMode() !== TApplicationMode::Performance) |
|
| 99 | 99 | { |
| 100 | - if(($dir = opendir($themePath)) === false) |
|
| 100 | + if (($dir = opendir($themePath)) === false) |
|
| 101 | 101 | throw new TIOException('theme_path_inexistent', $themePath); |
| 102 | 102 | $cacheValid = true; |
| 103 | - while(($file = readdir($dir)) !== false) |
|
| 103 | + while (($file = readdir($dir)) !== false) |
|
| 104 | 104 | { |
| 105 | - if($file === '.' || $file === '..') |
|
| 105 | + if ($file === '.' || $file === '..') |
|
| 106 | 106 | continue; |
| 107 | - elseif(basename($file, '.css') !== $file) |
|
| 108 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
| 109 | - elseif(basename($file, '.js') !== $file) |
|
| 110 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
| 111 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath . DIRECTORY_SEPARATOR . $file) > $timestamp) |
|
| 107 | + elseif (basename($file, '.css') !== $file) |
|
| 108 | + $this->_cssFiles[] = $themeUrl.'/'.$file; |
|
| 109 | + elseif (basename($file, '.js') !== $file) |
|
| 110 | + $this->_jsFiles[] = $themeUrl.'/'.$file; |
|
| 111 | + elseif (basename($file, self::SKIN_FILE_EXT) !== $file && filemtime($themePath.DIRECTORY_SEPARATOR.$file) > $timestamp) |
|
| 112 | 112 | { |
| 113 | 113 | $cacheValid = false; |
| 114 | 114 | break; |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | closedir($dir); |
| 118 | - if($cacheValid) |
|
| 118 | + if ($cacheValid) |
|
| 119 | 119 | $this->_skins = $skins; |
| 120 | 120 | } |
| 121 | 121 | else |
@@ -127,34 +127,34 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | - if(!$cacheValid) |
|
| 130 | + if (!$cacheValid) |
|
| 131 | 131 | { |
| 132 | 132 | $this->_cssFiles = []; |
| 133 | 133 | $this->_jsFiles = []; |
| 134 | 134 | $this->_skins = []; |
| 135 | - if(($dir = opendir($themePath)) === false) |
|
| 135 | + if (($dir = opendir($themePath)) === false) |
|
| 136 | 136 | throw new TIOException('theme_path_inexistent', $themePath); |
| 137 | - while(($file = readdir($dir)) !== false) |
|
| 137 | + while (($file = readdir($dir)) !== false) |
|
| 138 | 138 | { |
| 139 | - if($file === '.' || $file === '..') |
|
| 139 | + if ($file === '.' || $file === '..') |
|
| 140 | 140 | continue; |
| 141 | - elseif(basename($file, '.css') !== $file) |
|
| 142 | - $this->_cssFiles[] = $themeUrl . '/' . $file; |
|
| 143 | - elseif(basename($file, '.js') !== $file) |
|
| 144 | - $this->_jsFiles[] = $themeUrl . '/' . $file; |
|
| 145 | - elseif(basename($file, self::SKIN_FILE_EXT) !== $file) |
|
| 141 | + elseif (basename($file, '.css') !== $file) |
|
| 142 | + $this->_cssFiles[] = $themeUrl.'/'.$file; |
|
| 143 | + elseif (basename($file, '.js') !== $file) |
|
| 144 | + $this->_jsFiles[] = $themeUrl.'/'.$file; |
|
| 145 | + elseif (basename($file, self::SKIN_FILE_EXT) !== $file) |
|
| 146 | 146 | { |
| 147 | - $template = new TTemplate(file_get_contents($themePath . '/' . $file), $themePath, $themePath . '/' . $file); |
|
| 148 | - foreach($template->getItems() as $skin) |
|
| 147 | + $template = new TTemplate(file_get_contents($themePath.'/'.$file), $themePath, $themePath.'/'.$file); |
|
| 148 | + foreach ($template->getItems() as $skin) |
|
| 149 | 149 | { |
| 150 | - if(!isset($skin[2])) // a text string, ignored |
|
| 150 | + if (!isset($skin[2])) // a text string, ignored |
|
| 151 | 151 | continue; |
| 152 | - elseif($skin[0] !== -1) |
|
| 152 | + elseif ($skin[0] !== -1) |
|
| 153 | 153 | throw new TConfigurationException('theme_control_nested', $skin[1], dirname($themePath)); |
| 154 | 154 | $type = $skin[1]; |
| 155 | - $id = isset($skin[2]['skinid'])?$skin[2]['skinid']:0; |
|
| 155 | + $id = isset($skin[2]['skinid']) ? $skin[2]['skinid'] : 0; |
|
| 156 | 156 | unset($skin[2]['skinid']); |
| 157 | - if(isset($this->_skins[$type][$id])) |
|
| 157 | + if (isset($this->_skins[$type][$id])) |
|
| 158 | 158 | throw new TConfigurationException('theme_skinid_duplicated', $type, $id, dirname($themePath)); |
| 159 | 159 | /* |
| 160 | 160 | foreach($skin[2] as $name=>$value) |
@@ -170,8 +170,8 @@ discard block |
||
| 170 | 170 | closedir($dir); |
| 171 | 171 | sort($this->_cssFiles); |
| 172 | 172 | sort($this->_jsFiles); |
| 173 | - if($cache !== null) |
|
| 174 | - $cache->set(self::THEME_CACHE_PREFIX . $themePath, [$this->_skins,$this->_cssFiles,$this->_jsFiles,time()]); |
|
| 173 | + if ($cache !== null) |
|
| 174 | + $cache->set(self::THEME_CACHE_PREFIX.$themePath, [$this->_skins, $this->_cssFiles, $this->_jsFiles, time()]); |
|
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
@@ -251,22 +251,22 @@ discard block |
||
| 251 | 251 | public function applySkin($control) |
| 252 | 252 | { |
| 253 | 253 | $type = get_class($control); |
| 254 | - if(($id = $control->getSkinID()) === '') |
|
| 254 | + if (($id = $control->getSkinID()) === '') |
|
| 255 | 255 | $id = 0; |
| 256 | - if(isset($this->_skins[$type][$id])) |
|
| 256 | + if (isset($this->_skins[$type][$id])) |
|
| 257 | 257 | { |
| 258 | - foreach($this->_skins[$type][$id] as $name => $value) |
|
| 258 | + foreach ($this->_skins[$type][$id] as $name => $value) |
|
| 259 | 259 | { |
| 260 | 260 | Prado::trace("Applying skin $name to $type", 'Prado\Web\UI\TThemeManager'); |
| 261 | - if(is_array($value)) |
|
| 261 | + if (is_array($value)) |
|
| 262 | 262 | { |
| 263 | - switch($value[0]) |
|
| 263 | + switch ($value[0]) |
|
| 264 | 264 | { |
| 265 | 265 | case TTemplate::CONFIG_EXPRESSION: |
| 266 | 266 | $value = $this->evaluateExpression($value[1]); |
| 267 | 267 | break; |
| 268 | 268 | case TTemplate::CONFIG_ASSET: |
| 269 | - $value = $this->_themeUrl . '/' . ltrim($value[1], '/'); |
|
| 269 | + $value = $this->_themeUrl.'/'.ltrim($value[1], '/'); |
|
| 270 | 270 | break; |
| 271 | 271 | case TTemplate::CONFIG_DATABIND: |
| 272 | 272 | $control->bindProperty($name, $value[1]); |
@@ -285,15 +285,15 @@ discard block |
||
| 285 | 285 | break; |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | - if(!is_array($value)) |
|
| 288 | + if (!is_array($value)) |
|
| 289 | 289 | { |
| 290 | - if(strpos($name, '.') === false) // is simple property or custom attribute |
|
| 290 | + if (strpos($name, '.') === false) // is simple property or custom attribute |
|
| 291 | 291 | { |
| 292 | - if($control->hasProperty($name)) |
|
| 292 | + if ($control->hasProperty($name)) |
|
| 293 | 293 | { |
| 294 | - if($control->canSetProperty($name)) |
|
| 294 | + if ($control->canSetProperty($name)) |
|
| 295 | 295 | { |
| 296 | - $setter = 'set' . $name; |
|
| 296 | + $setter = 'set'.$name; |
|
| 297 | 297 | $control->$setter($value); |
| 298 | 298 | } |
| 299 | 299 | else |
@@ -36,17 +36,17 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class TActiveEditCommandColumn extends TEditCommandColumn { |
| 38 | 38 | protected function createButton($commandName, $text, $causesValidation, $validationGroup) { |
| 39 | - if($this->getButtonType() === TButtonColumnType::LinkButton) |
|
| 39 | + if ($this->getButtonType() === TButtonColumnType::LinkButton) |
|
| 40 | 40 | $button = new TActiveLinkButton; |
| 41 | - elseif($this->getButtonType() === TButtonColumnType::PushButton) |
|
| 41 | + elseif ($this->getButtonType() === TButtonColumnType::PushButton) |
|
| 42 | 42 | $button = new TActiveButton; |
| 43 | 43 | else // image buttons |
| 44 | 44 | { |
| 45 | 45 | $button = new TActiveImageButton; |
| 46 | 46 | $button->setToolTip($text); |
| 47 | - if(strcasecmp($commandName, 'Update') === 0) |
|
| 47 | + if (strcasecmp($commandName, 'Update') === 0) |
|
| 48 | 48 | $url = $this->getUpdateImageUrl(); |
| 49 | - elseif(strcasecmp($commandName, 'Cancel') === 0) |
|
| 49 | + elseif (strcasecmp($commandName, 'Cancel') === 0) |
|
| 50 | 50 | $url = $this->getCancelImageUrl(); |
| 51 | 51 | else |
| 52 | 52 | $url = $this->getEditImageUrl(); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function flushContent() |
| 61 | 61 | { |
| 62 | - foreach($this->_writers as $writer) |
|
| 62 | + foreach ($this->_writers as $writer) |
|
| 63 | 63 | echo $writer->flush(); |
| 64 | 64 | parent::flushContent(); |
| 65 | 65 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function httpRedirect($url) |
| 88 | 88 | { |
| 89 | - if($url[0] === '/') |
|
| 90 | - $url = $this->getRequest()->getBaseUrl() . $url; |
|
| 89 | + if ($url[0] === '/') |
|
| 90 | + $url = $this->getRequest()->getBaseUrl().$url; |
|
| 91 | 91 | $this->_redirectUrl = str_replace('&', '&', $url); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -59,11 +59,11 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function setText($value) |
| 61 | 61 | { |
| 62 | - if(parent::getText() === $value) |
|
| 62 | + if (parent::getText() === $value) |
|
| 63 | 63 | return; |
| 64 | 64 | |
| 65 | 65 | parent::setText($value); |
| 66 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 66 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 67 | 67 | $this->getPage()->getCallbackClient()->update($this, $value); |
| 68 | 68 | } |
| 69 | 69 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function setForControl($value) |
| 77 | 77 | { |
| 78 | - if(parent::getForControl() === $value) |
|
| 78 | + if (parent::getForControl() === $value) |
|
| 79 | 79 | return; |
| 80 | 80 | |
| 81 | 81 | parent::setForControl($value); |
| 82 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 82 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 83 | 83 | { |
| 84 | 84 | $id = $this->findControl($value)->getClientID(); |
| 85 | 85 | $this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id); |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | protected function setBaseControlClass($type) |
| 72 | 72 | { |
| 73 | - if($type === null) |
|
| 73 | + if ($type === null) |
|
| 74 | 74 | { |
| 75 | - if($this->getControl() instanceof ICallbackEventHandler) |
|
| 75 | + if ($this->getControl() instanceof ICallbackEventHandler) |
|
| 76 | 76 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveCallbackControl'; |
| 77 | 77 | else |
| 78 | 78 | $this->_activeControlType = 'Prado\\Web\UI\\ActiveControls\\TBaseActiveControl'; |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | public function render($writer) |
| 96 | 96 | { |
| 97 | 97 | $this->getPage()->getClientScript()->registerPradoScript('ajax'); |
| 98 | - if($this->_control->getVisible(false)) |
|
| 98 | + if ($this->_control->getVisible(false)) |
|
| 99 | 99 | { |
| 100 | 100 | parent::render($writer); |
| 101 | 101 | } else { |
| 102 | - $writer->write("<span id=\"" . $this->_control->getClientID() . "\" style=\"display:none\"></span>"); |
|
| 102 | + $writer->write("<span id=\"".$this->_control->getClientID()."\" style=\"display:none\"></span>"); |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function getBaseActiveControl() |
| 118 | 118 | { |
| 119 | - if($this->_baseActiveControl === null) |
|
| 119 | + if ($this->_baseActiveControl === null) |
|
| 120 | 120 | { |
| 121 | 121 | $type = $this->_activeControlType; |
| 122 | 122 | $this->_baseActiveControl = new $type($this->getControl()); |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | protected function getIsTrackingPageState() |
| 131 | 131 | { |
| 132 | - if($this->getPage()->getIsCallback()) |
|
| 132 | + if ($this->getPage()->getIsCallback()) |
|
| 133 | 133 | { |
| 134 | 134 | $target = $this->getPage()->getCallbackEventTarget(); |
| 135 | - if($target instanceof ICallbackEventHandler) |
|
| 135 | + if ($target instanceof ICallbackEventHandler) |
|
| 136 | 136 | { |
| 137 | 137 | $client = $target->getActiveControl()->getClientSide(); |
| 138 | 138 | return $client->getEnablePageStateUpdate(); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public function onLoad($param) |
| 148 | 148 | { |
| 149 | - if($this->getIsTrackingPageState()) |
|
| 149 | + if ($this->getIsTrackingPageState()) |
|
| 150 | 150 | { |
| 151 | 151 | $stateTrackerClass = $this->_stateTrackerClass; |
| 152 | 152 | $this->_stateTracker = new $stateTrackerClass($this->getControl()); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function saveState() |
| 163 | 163 | { |
| 164 | - if(($this->_stateTracker !== null) |
|
| 164 | + if (($this->_stateTracker !== null) |
|
| 165 | 165 | && $this->getControl()->getActiveControl()->canUpdateClientSide(true)) |
| 166 | 166 | { |
| 167 | 167 | $this->_stateTracker->respondToChanges(); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function displayException($exception) |
| 42 | 42 | { |
| 43 | - if($this->getApplication()->getMode() === TApplicationMode::Debug) |
|
| 43 | + if ($this->getApplication()->getMode() === TApplicationMode::Debug) |
|
| 44 | 44 | { |
| 45 | 45 | $response = $this->getApplication()->getResponse(); |
| 46 | 46 | $trace = $this->getExceptionStackTrace($exception); |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | else |
| 65 | 65 | { |
| 66 | - error_log("Error happened while processing an existing error:\n" . $exception->__toString()); |
|
| 66 | + error_log("Error happened while processing an existing error:\n".$exception->__toString()); |
|
| 67 | 67 | header('HTTP/1.0 500 Internal Server Error', true, 500); |
| 68 | 68 | } |
| 69 | 69 | $this->getApplication()->getResponse()->flush(); |
@@ -79,11 +79,11 @@ discard block |
||
| 79 | 79 | $data['file'] = $exception->getFile(); |
| 80 | 80 | $data['line'] = $exception->getLine(); |
| 81 | 81 | $data['trace'] = $exception->getTrace(); |
| 82 | - if($exception instanceof TPhpErrorException) |
|
| 82 | + if ($exception instanceof TPhpErrorException) |
|
| 83 | 83 | { |
| 84 | 84 | // if PHP exception, we want to show the 2nd stack level context |
| 85 | 85 | // because the 1st stack level is of little use (it's in error handler) |
| 86 | - if(isset($trace[0]) && isset($trace[0]['file']) && isset($trace[0]['line'])) |
|
| 86 | + if (isset($trace[0]) && isset($trace[0]['file']) && isset($trace[0]['line'])) |
|
| 87 | 87 | { |
| 88 | 88 | $data['file'] = $trace[0]['file']; |
| 89 | 89 | $data['line'] = $trace[0]['line']; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | $data['type'] = get_class($exception); |
| 93 | 93 | $data['message'] = $exception->getMessage(); |
| 94 | - $data['version'] = $_SERVER['SERVER_SOFTWARE'] . ' ' . Prado::getVersion(); |
|
| 94 | + $data['version'] = $_SERVER['SERVER_SOFTWARE'].' '.Prado::getVersion(); |
|
| 95 | 95 | $data['time'] = @strftime('%Y-%m-%d %H:%M', time()); |
| 96 | 96 | return $data; |
| 97 | 97 | } |
@@ -89,13 +89,13 @@ |
||
| 89 | 89 | */ |
| 90 | 90 | public function setSelectionMode($value) |
| 91 | 91 | { |
| 92 | - if(parent::getSelectionMode() === $value) |
|
| 92 | + if (parent::getSelectionMode() === $value) |
|
| 93 | 93 | return; |
| 94 | 94 | |
| 95 | 95 | parent::setSelectionMode($value); |
| 96 | 96 | $multiple = $this->getIsMultiSelect(); |
| 97 | - $id = $this->getUniqueID(); $multi_id = $id . '[]'; |
|
| 98 | - if($this->getActiveControl()->canUpdateClientSide()) |
|
| 97 | + $id = $this->getUniqueID(); $multi_id = $id.'[]'; |
|
| 98 | + if ($this->getActiveControl()->canUpdateClientSide()) |
|
| 99 | 99 | { |
| 100 | 100 | $client = $this->getPage()->getCallbackClient(); |
| 101 | 101 | $client->setAttribute($this, 'multiple', $multiple ? 'multiple' : false); |
@@ -273,7 +273,7 @@ |
||
| 273 | 273 | */ |
| 274 | 274 | public function setPostBackTarget($value) |
| 275 | 275 | { |
| 276 | - if($value instanceof TControl) |
|
| 276 | + if ($value instanceof TControl) |
|
| 277 | 277 | $value = $value->getUniqueID(); |
| 278 | 278 | $this->setOption('EventTarget', $value); |
| 279 | 279 | } |