@@ -37,40 +37,40 @@ discard block |
||
| 37 | 37 | /** |
| 38 | 38 | * Callback response data header name. |
| 39 | 39 | */ |
| 40 | - const CALLBACK_DATA_HEADER = 'X-PRADO-DATA'; |
|
| 40 | + const CALLBACK_DATA_HEADER='X-PRADO-DATA'; |
|
| 41 | 41 | /** |
| 42 | 42 | * Callback response client-side action header name. |
| 43 | 43 | */ |
| 44 | - const CALLBACK_ACTION_HEADER = 'X-PRADO-ACTIONS'; |
|
| 44 | + const CALLBACK_ACTION_HEADER='X-PRADO-ACTIONS'; |
|
| 45 | 45 | /** |
| 46 | 46 | * Callback error header name. |
| 47 | 47 | */ |
| 48 | - const CALLBACK_ERROR_HEADER = 'X-PRADO-ERROR'; |
|
| 48 | + const CALLBACK_ERROR_HEADER='X-PRADO-ERROR'; |
|
| 49 | 49 | /** |
| 50 | 50 | * Callback page state header name. |
| 51 | 51 | */ |
| 52 | - const CALLBACK_PAGESTATE_HEADER = 'X-PRADO-PAGESTATE'; |
|
| 52 | + const CALLBACK_PAGESTATE_HEADER='X-PRADO-PAGESTATE'; |
|
| 53 | 53 | /** |
| 54 | 54 | * Script list header name. |
| 55 | 55 | */ |
| 56 | - const CALLBACK_SCRIPTLIST_HEADER = 'X-PRADO-SCRIPTLIST'; |
|
| 56 | + const CALLBACK_SCRIPTLIST_HEADER='X-PRADO-SCRIPTLIST'; |
|
| 57 | 57 | /** |
| 58 | 58 | * Stylesheet list header name. |
| 59 | 59 | */ |
| 60 | - const CALLBACK_STYLESHEETLIST_HEADER = 'X-PRADO-STYLESHEETLIST'; |
|
| 60 | + const CALLBACK_STYLESHEETLIST_HEADER='X-PRADO-STYLESHEETLIST'; |
|
| 61 | 61 | /** |
| 62 | 62 | * Stylesheet header name. |
| 63 | 63 | */ |
| 64 | - const CALLBACK_STYLESHEET_HEADER = 'X-PRADO-STYLESHEET'; |
|
| 64 | + const CALLBACK_STYLESHEET_HEADER='X-PRADO-STYLESHEET'; |
|
| 65 | 65 | /** |
| 66 | 66 | * Hidden field list header name. |
| 67 | 67 | */ |
| 68 | - const CALLBACK_HIDDENFIELDLIST_HEADER = 'X-PRADO-HIDDENFIELDLIST'; |
|
| 68 | + const CALLBACK_HIDDENFIELDLIST_HEADER='X-PRADO-HIDDENFIELDLIST'; |
|
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * Callback redirect url header name. |
| 72 | 72 | */ |
| 73 | - const CALLBACK_REDIRECT = 'X-PRADO-REDIRECT'; |
|
| 73 | + const CALLBACK_REDIRECT='X-PRADO-REDIRECT'; |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * @var ICallbackEventHandler callback event handler. |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | parent::__construct($control); |
| 97 | 97 | |
| 98 | 98 | //TODO: can this be done later? |
| 99 | - $response = $this->getApplication()->getResponse(); |
|
| 99 | + $response=$this->getApplication()->getResponse(); |
|
| 100 | 100 | $response->setAdapter(new TCallbackResponseAdapter($response)); |
| 101 | 101 | |
| 102 | 102 | $this->trapCallbackErrorsExceptions(); |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function processCallbackEvent($writer) |
| 110 | 110 | { |
| 111 | - Prado::trace("ActivePage raiseCallbackEvent()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 111 | + Prado::trace("ActivePage raiseCallbackEvent()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 112 | 112 | $this->raiseCallbackEvent(); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | * @param TControl control for defered rendering |
| 118 | 118 | * @param THtmlWriter the renderer |
| 119 | 119 | */ |
| 120 | - public function registerControlToRender($control,$writer) |
|
| 120 | + public function registerControlToRender($control, $writer) |
|
| 121 | 121 | { |
| 122 | - $id = $control->getUniqueID(); |
|
| 122 | + $id=$control->getUniqueID(); |
|
| 123 | 123 | if(!isset($this->_controlsToRender[$id])) |
| 124 | - $this->_controlsToRender[$id] = array($control,$writer); |
|
| 124 | + $this->_controlsToRender[$id]=array($control, $writer); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function renderCallbackResponse($writer) |
| 140 | 140 | { |
| 141 | - Prado::trace("ActivePage renderCallbackResponse()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 142 | - if(($url = $this->getResponse()->getAdapter()->getRedirectedUrl())===null) |
|
| 141 | + Prado::trace("ActivePage renderCallbackResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 142 | + if(($url=$this->getResponse()->getAdapter()->getRedirectedUrl())===null) |
|
| 143 | 143 | $this->renderResponse($writer); |
| 144 | 144 | else |
| 145 | 145 | $this->redirect($url); |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | protected function redirect($url) |
| 153 | 153 | { |
| 154 | - Prado::trace("ActivePage redirect()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 154 | + Prado::trace("ActivePage redirect()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 155 | 155 | $this->appendContentPart($this->getResponse(), self::CALLBACK_REDIRECT, $url); |
| 156 | 156 | } |
| 157 | 157 | |
@@ -162,31 +162,31 @@ discard block |
||
| 162 | 162 | */ |
| 163 | 163 | protected function renderResponse($writer) |
| 164 | 164 | { |
| 165 | - Prado::trace("ActivePage renderResponse()",'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 165 | + Prado::trace("ActivePage renderResponse()", 'Prado\Web\UI\ActiveControls\TActivePageAdapter'); |
|
| 166 | 166 | //renders all the defered render() calls. |
| 167 | 167 | foreach($this->_controlsToRender as $rid => $forRender) |
| 168 | 168 | $forRender[0]->render($forRender[1]); |
| 169 | 169 | |
| 170 | - $response = $this->getResponse(); |
|
| 170 | + $response=$this->getResponse(); |
|
| 171 | 171 | |
| 172 | 172 | //send response data in header |
| 173 | 173 | if($response->getHasAdapter()) |
| 174 | 174 | { |
| 175 | - $responseData = $response->getAdapter()->getResponseData(); |
|
| 175 | + $responseData=$response->getAdapter()->getResponseData(); |
|
| 176 | 176 | if($responseData!==null) |
| 177 | 177 | { |
| 178 | - $data = TJavaScript::jsonEncode($responseData); |
|
| 178 | + $data=TJavaScript::jsonEncode($responseData); |
|
| 179 | 179 | |
| 180 | 180 | $this->appendContentPart($response, self::CALLBACK_DATA_HEADER, $data); |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | //sends page state in header |
| 185 | - if(($handler = $this->getCallbackEventTarget()) !== null) |
|
| 185 | + if(($handler=$this->getCallbackEventTarget())!==null) |
|
| 186 | 186 | { |
| 187 | 187 | if($handler->getActiveControl()->getClientSide()->getEnablePageStateUpdate()) |
| 188 | 188 | { |
| 189 | - $pagestate = $this->getPage()->getClientState(); |
|
| 189 | + $pagestate=$this->getPage()->getClientState(); |
|
| 190 | 190 | $this->appendContentPart($response, self::CALLBACK_PAGESTATE_HEADER, $pagestate); |
| 191 | 191 | } |
| 192 | 192 | } |
@@ -197,37 +197,37 @@ discard block |
||
| 197 | 197 | //output the end javascript |
| 198 | 198 | if($this->getPage()->getClientScript()->hasEndScripts()) |
| 199 | 199 | { |
| 200 | - $writer = $response->createHtmlWriter(); |
|
| 200 | + $writer=$response->createHtmlWriter(); |
|
| 201 | 201 | $this->getPage()->getClientScript()->renderEndScriptsCallback($writer); |
| 202 | 202 | $this->getPage()->getCallbackClient()->evaluateScript($writer); |
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | //output the actions |
| 206 | - $executeJavascript = $this->getCallbackClientHandler()->getClientFunctionsToExecute(); |
|
| 207 | - $actions = TJavaScript::jsonEncode($executeJavascript); |
|
| 206 | + $executeJavascript=$this->getCallbackClientHandler()->getClientFunctionsToExecute(); |
|
| 207 | + $actions=TJavaScript::jsonEncode($executeJavascript); |
|
| 208 | 208 | $this->appendContentPart($response, self::CALLBACK_ACTION_HEADER, $actions); |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - $cs = $this->Page->getClientScript(); |
|
| 211 | + $cs=$this->Page->getClientScript(); |
|
| 212 | 212 | |
| 213 | 213 | // collect all stylesheet file references |
| 214 | - $stylesheets = $cs->getStyleSheetUrls(); |
|
| 215 | - if (count($stylesheets)>0) |
|
| 214 | + $stylesheets=$cs->getStyleSheetUrls(); |
|
| 215 | + if(count($stylesheets) > 0) |
|
| 216 | 216 | $this->appendContentPart($response, self::CALLBACK_STYLESHEETLIST_HEADER, TJavaScript::jsonEncode($stylesheets)); |
| 217 | 217 | |
| 218 | 218 | // collect all stylesheet snippets references |
| 219 | - $stylesheets = $cs->getStyleSheetCodes(); |
|
| 220 | - if (count($stylesheets)>0) |
|
| 219 | + $stylesheets=$cs->getStyleSheetCodes(); |
|
| 220 | + if(count($stylesheets) > 0) |
|
| 221 | 221 | $this->appendContentPart($response, self::CALLBACK_STYLESHEET_HEADER, TJavaScript::jsonEncode($stylesheets)); |
| 222 | 222 | |
| 223 | 223 | // collect all script file references |
| 224 | - $scripts = $cs->getScriptUrls(); |
|
| 225 | - if (count($scripts)>0) |
|
| 224 | + $scripts=$cs->getScriptUrls(); |
|
| 225 | + if(count($scripts) > 0) |
|
| 226 | 226 | $this->appendContentPart($response, self::CALLBACK_SCRIPTLIST_HEADER, TJavaScript::jsonEncode($scripts)); |
| 227 | 227 | |
| 228 | 228 | // collect all hidden field references |
| 229 | - $fields = $cs->getHiddenFields(); |
|
| 230 | - if (count($fields)>0) |
|
| 229 | + $fields=$cs->getHiddenFields(); |
|
| 230 | + if(count($fields) > 0) |
|
| 231 | 231 | $this->appendContentPart($response, self::CALLBACK_HIDDENFIELDLIST_HEADER, TJavaScript::jsonEncode($fields)); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | */ |
| 237 | 237 | private function appendContentPart($response, $delimiter, $data) |
| 238 | 238 | { |
| 239 | - $content = $response->createHtmlWriter(); |
|
| 239 | + $content=$response->createHtmlWriter(); |
|
| 240 | 240 | $content->getWriter()->setBoundary($delimiter); |
| 241 | 241 | $content->write($data); |
| 242 | 242 | } |
@@ -253,8 +253,8 @@ discard block |
||
| 253 | 253 | { |
| 254 | 254 | if($callbackHandler instanceof ICallbackEventHandler) |
| 255 | 255 | { |
| 256 | - $param = $this->getCallbackEventParameter(); |
|
| 257 | - $result = new TCallbackEventParameter($this->getResponse(), $param); |
|
| 256 | + $param=$this->getCallbackEventParameter(); |
|
| 257 | + $result=new TCallbackEventParameter($this->getResponse(), $param); |
|
| 258 | 258 | $callbackHandler->raiseCallbackEvent($result); |
| 259 | 259 | } |
| 260 | 260 | else |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | else |
| 267 | 267 | { |
| 268 | - $target = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
|
| 268 | + $target=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_TARGET); |
|
| 269 | 269 | throw new TInvalidCallbackException('callback_invalid_target', $target); |
| 270 | 270 | } |
| 271 | 271 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | { |
| 303 | 303 | if($this->_callbackEventParameter===null) |
| 304 | 304 | { |
| 305 | - $param = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
| 305 | + $param=$this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER); |
|
| 306 | 306 | $this->_callbackEventParameter=$param; |
| 307 | 307 | } |
| 308 | 308 | return $this->_callbackEventParameter; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | public function getCallbackClientHandler() |
| 325 | 325 | { |
| 326 | 326 | if($this->_callbackClient===null) |
| 327 | - $this->_callbackClient = new TCallbackClientScript; |
|
| 327 | + $this->_callbackClient=new TCallbackClientScript; |
|
| 328 | 328 | return $this->_callbackClient; |
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | \ No newline at end of file |
@@ -74,21 +74,21 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | if(($fileName=$this->getLocalizedTemplate($fileName))!==null) |
| 76 | 76 | { |
| 77 | - Prado::trace("Loading template $fileName",'\Prado\Web\UI\TTemplateManager'); |
|
| 77 | + Prado::trace("Loading template $fileName", '\Prado\Web\UI\TTemplateManager'); |
|
| 78 | 78 | if(($cache=$this->getApplication()->getCache())===null) |
| 79 | - return new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName); |
|
| 79 | + return new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName); |
|
| 80 | 80 | else |
| 81 | 81 | { |
| 82 | 82 | $array=$cache->get(self::TEMPLATE_CACHE_PREFIX.$fileName); |
| 83 | 83 | if(is_array($array)) |
| 84 | 84 | { |
| 85 | - list($template,$timestamps)=$array; |
|
| 85 | + list($template, $timestamps)=$array; |
|
| 86 | 86 | if($this->getApplication()->getMode()===TApplicationMode::Performance) |
| 87 | 87 | return $template; |
| 88 | 88 | $cacheValid=true; |
| 89 | 89 | foreach($timestamps as $tplFile=>$timestamp) |
| 90 | 90 | { |
| 91 | - if(!is_file($tplFile) || filemtime($tplFile)>$timestamp) |
|
| 91 | + if(!is_file($tplFile) || filemtime($tplFile) > $timestamp) |
|
| 92 | 92 | { |
| 93 | 93 | $cacheValid=false; |
| 94 | 94 | break; |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | if($cacheValid) |
| 98 | 98 | return $template; |
| 99 | 99 | } |
| 100 | - $template=new TTemplate(file_get_contents($fileName),dirname($fileName),$fileName); |
|
| 100 | + $template=new TTemplate(file_get_contents($fileName), dirname($fileName), $fileName); |
|
| 101 | 101 | $includedFiles=$template->getIncludedFiles(); |
| 102 | 102 | $timestamps=array(); |
| 103 | 103 | $timestamps[$fileName]=filemtime($fileName); |
| 104 | 104 | foreach($includedFiles as $includedFile) |
| 105 | 105 | $timestamps[$includedFile]=filemtime($includedFile); |
| 106 | - $cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName,array($template,$timestamps)); |
|
| 106 | + $cache->set(self::TEMPLATE_CACHE_PREFIX.$fileName, array($template, $timestamps)); |
|
| 107 | 107 | return $template; |
| 108 | 108 | } |
| 109 | 109 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | protected function getLocalizedTemplate($filename) |
| 120 | 120 | { |
| 121 | 121 | if(($app=$this->getApplication()->getGlobalization(false))===null) |
| 122 | - return is_file($filename)?$filename:null; |
|
| 122 | + return is_file($filename) ? $filename : null; |
|
| 123 | 123 | foreach($app->getLocalizedResource($filename) as $file) |
| 124 | 124 | { |
| 125 | 125 | if(($file=realpath($file))!==false && is_file($file)) |
@@ -91,9 +91,9 @@ discard block |
||
| 91 | 91 | if($this->_basePath===null) |
| 92 | 92 | $this->_basePath=dirname($application->getRequest()->getApplicationFilePath()).DIRECTORY_SEPARATOR.self::DEFAULT_BASEPATH; |
| 93 | 93 | if(!is_writable($this->_basePath) || !is_dir($this->_basePath)) |
| 94 | - throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath); |
|
| 94 | + throw new TConfigurationException('assetmanager_basepath_invalid', $this->_basePath); |
|
| 95 | 95 | if($this->_baseUrl===null) |
| 96 | - $this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()),'/\\').'/'.self::DEFAULT_BASEPATH; |
|
| 96 | + $this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationUrl()), '/\\').'/'.self::DEFAULT_BASEPATH; |
|
| 97 | 97 | $application->setAssetManager($this); |
| 98 | 98 | $this->_initialized=true; |
| 99 | 99 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $this->_basePath=Prado::getPathOfNamespace($value); |
| 122 | 122 | if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath)) |
| 123 | - throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value); |
|
| 123 | + throw new TInvalidDataValueException('assetmanager_basepath_invalid', $value); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if($this->_initialized) |
| 142 | 142 | throw new TInvalidOperationException('assetmanager_baseurl_unchangeable'); |
| 143 | 143 | else |
| 144 | - $this->_baseUrl=rtrim($value,'/'); |
|
| 144 | + $this->_baseUrl=rtrim($value, '/'); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | /** |
@@ -158,19 +158,19 @@ discard block |
||
| 158 | 158 | * @throws TInvalidDataValueException if the file path to be published is |
| 159 | 159 | * invalid |
| 160 | 160 | */ |
| 161 | - public function publishFilePath($path,$checkTimestamp=false) |
|
| 161 | + public function publishFilePath($path, $checkTimestamp=false) |
|
| 162 | 162 | { |
| 163 | 163 | if(isset($this->_published[$path])) |
| 164 | 164 | return $this->_published[$path]; |
| 165 | 165 | else if(empty($path) || ($fullpath=realpath($path))===false) |
| 166 | - throw new TInvalidDataValueException('assetmanager_filepath_invalid',$path); |
|
| 166 | + throw new TInvalidDataValueException('assetmanager_filepath_invalid', $path); |
|
| 167 | 167 | else if(is_file($fullpath)) |
| 168 | 168 | { |
| 169 | 169 | $dir=$this->hash(dirname($fullpath)); |
| 170 | 170 | $fileName=basename($fullpath); |
| 171 | 171 | $dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir; |
| 172 | 172 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 173 | - $this->copyFile($fullpath,$dst); |
|
| 173 | + $this->copyFile($fullpath, $dst); |
|
| 174 | 174 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir.'/'.$fileName; |
| 175 | 175 | } |
| 176 | 176 | else |
@@ -178,8 +178,8 @@ discard block |
||
| 178 | 178 | $dir=$this->hash($fullpath); |
| 179 | 179 | if(!is_dir($this->_basePath.DIRECTORY_SEPARATOR.$dir) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 180 | 180 | { |
| 181 | - Prado::trace("Publishing directory $fullpath",'Prado\Web\TAssetManager'); |
|
| 182 | - $this->copyDirectory($fullpath,$this->_basePath.DIRECTORY_SEPARATOR.$dir); |
|
| 181 | + Prado::trace("Publishing directory $fullpath", 'Prado\Web\TAssetManager'); |
|
| 182 | + $this->copyDirectory($fullpath, $this->_basePath.DIRECTORY_SEPARATOR.$dir); |
|
| 183 | 183 | } |
| 184 | 184 | return $this->_published[$path]=$this->_baseUrl.'/'.$dir; |
| 185 | 185 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | */ |
| 201 | 201 | protected function setPublished($values=array()) |
| 202 | 202 | { |
| 203 | - $this->_published = $values; |
|
| 203 | + $this->_published=$values; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | */ |
| 244 | 244 | protected function hash($dir) |
| 245 | 245 | { |
| 246 | - return sprintf('%x',crc32($dir.Prado::getVersion())); |
|
| 246 | + return sprintf('%x', crc32($dir.Prado::getVersion())); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @param string source file path |
| 254 | 254 | * @param string destination directory (if not exists, it will be created) |
| 255 | 255 | */ |
| 256 | - protected function copyFile($src,$dst) |
|
| 256 | + protected function copyFile($src, $dst) |
|
| 257 | 257 | { |
| 258 | 258 | if(!is_dir($dst)) |
| 259 | 259 | { |
@@ -261,10 +261,10 @@ discard block |
||
| 261 | 261 | @chmod($dst, PRADO_CHMOD); |
| 262 | 262 | } |
| 263 | 263 | $dstFile=$dst.DIRECTORY_SEPARATOR.basename($src); |
| 264 | - if(@filemtime($dstFile)<@filemtime($src)) |
|
| 264 | + if(@filemtime($dstFile) < @filemtime($src)) |
|
| 265 | 265 | { |
| 266 | - Prado::trace("Publishing file $src to $dstFile",'Prado\Web\TAssetManager'); |
|
| 267 | - @copy($src,$dstFile); |
|
| 266 | + Prado::trace("Publishing file $src to $dstFile", 'Prado\Web\TAssetManager'); |
|
| 267 | + @copy($src, $dstFile); |
|
| 268 | 268 | } |
| 269 | 269 | } |
| 270 | 270 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | * @param string the destination directory |
| 277 | 277 | * @todo a generic solution to ignore certain directories and files |
| 278 | 278 | */ |
| 279 | - public function copyDirectory($src,$dst) |
|
| 279 | + public function copyDirectory($src, $dst) |
|
| 280 | 280 | { |
| 281 | 281 | if(!is_dir($dst)) |
| 282 | 282 | { |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | continue; |
| 292 | 292 | else if(is_file($src.DIRECTORY_SEPARATOR.$file)) |
| 293 | 293 | { |
| 294 | - if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file)) |
|
| 294 | + if(@filemtime($dst.DIRECTORY_SEPARATOR.$file) < @filemtime($src.DIRECTORY_SEPARATOR.$file)) |
|
| 295 | 295 | { |
| 296 | - @copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
|
| 296 | + @copy($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file); |
|
| 297 | 297 | @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD); |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | else |
| 301 | - $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file); |
|
| 301 | + $this->copyDirectory($src.DIRECTORY_SEPARATOR.$file, $dst.DIRECTORY_SEPARATOR.$file); |
|
| 302 | 302 | } |
| 303 | 303 | closedir($folder); |
| 304 | 304 | } else { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | if(isset($this->_published[$md5sum])) |
| 323 | 323 | return $this->_published[$md5sum]; |
| 324 | 324 | else if(($fullpath=realpath($md5sum))===false || !is_file($fullpath)) |
| 325 | - throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid',$md5sum); |
|
| 325 | + throw new TInvalidDataValueException('assetmanager_tarchecksum_invalid', $md5sum); |
|
| 326 | 326 | else |
| 327 | 327 | { |
| 328 | 328 | $dir=$this->hash(dirname($fullpath)); |
@@ -330,10 +330,10 @@ discard block |
||
| 330 | 330 | $dst=$this->_basePath.DIRECTORY_SEPARATOR.$dir; |
| 331 | 331 | if(!is_file($dst.DIRECTORY_SEPARATOR.$fileName) || $checkTimestamp || $this->getApplication()->getMode()!==TApplicationMode::Performance) |
| 332 | 332 | { |
| 333 | - if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName)<@filemtime($fullpath)) |
|
| 333 | + if(@filemtime($dst.DIRECTORY_SEPARATOR.$fileName) < @filemtime($fullpath)) |
|
| 334 | 334 | { |
| 335 | - $this->copyFile($fullpath,$dst); |
|
| 336 | - $this->deployTarFile($tarfile,$dst); |
|
| 335 | + $this->copyFile($fullpath, $dst); |
|
| 336 | + $this->deployTarFile($tarfile, $dst); |
|
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | return $this->_published[$md5sum]=$this->_baseUrl.'/'.$dir; |
@@ -347,13 +347,13 @@ discard block |
||
| 347 | 347 | * @param string path where the contents of tar file are to be extracted |
| 348 | 348 | * @return boolean true if extract successful, false otherwise. |
| 349 | 349 | */ |
| 350 | - protected function deployTarFile($path,$destination) |
|
| 350 | + protected function deployTarFile($path, $destination) |
|
| 351 | 351 | { |
| 352 | 352 | if(($fullpath=realpath($path))===false || !is_file($fullpath)) |
| 353 | - throw new TIOException('assetmanager_tarfile_invalid',$path); |
|
| 353 | + throw new TIOException('assetmanager_tarfile_invalid', $path); |
|
| 354 | 354 | else |
| 355 | 355 | { |
| 356 | - $tar = new TTarFileExtractor($fullpath); |
|
| 356 | + $tar=new TTarFileExtractor($fullpath); |
|
| 357 | 357 | return $tar->extract($destination); |
| 358 | 358 | } |
| 359 | 359 | } |