@@ -78,7 +78,7 @@ |
||
| 78 | 78 | "class" => "btn-success col-md-offset-2" |
| 79 | 79 | )) |
| 80 | 80 | ->addButton('add_field', _('Añadir nuevo parámetro'), 'button', array( |
| 81 | - "onclick" => "javascript:addNewField(document.getElementById('" . $this->getName() . "'));", |
|
| 81 | + "onclick" => "javascript:addNewField(document.getElementById('".$this->getName()."'));", |
|
| 82 | 82 | "class" => "btn-warning", |
| 83 | 83 | )); |
| 84 | 84 | } |
@@ -36,8 +36,8 @@ |
||
| 36 | 36 | $dto[$property->getName()] = $property->getValue($this); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | - } catch (\Exception $e) { |
|
| 40 | - Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); |
|
| 39 | + }catch (\Exception $e) { |
|
| 40 | + Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR); |
|
| 41 | 41 | } |
| 42 | 42 | return $dto; |
| 43 | 43 | } |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | { |
| 63 | 63 | if (preg_match('/^asc$/i', $direction)) { |
| 64 | 64 | return Order::ASC; |
| 65 | - } else { |
|
| 65 | + }else { |
|
| 66 | 66 | return Order::DESC; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | $vars['__menu__'] = $this->getMenu(); |
| 38 | 38 | $domain = (null === $domain) ? $this->getDomain() : $domain; |
| 39 | - return $this->tpl->render($domain . $template, $vars, $cookies); |
|
| 39 | + return $this->tpl->render($domain.$template, $vars, $cookies); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $vars['__menu__'] = $this->getMenu(); |
| 69 | 69 | $domain = $domain ?: $this->getDomain(); |
| 70 | - return $this->tpl->dump($domain . $template, $vars); |
|
| 70 | + return $this->tpl->dump($domain.$template, $vars); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | ///////////////////////////////////////////////////////////// |
| 97 | 97 | // Date in the past sets the value to already have been expired. |
| 98 | 98 | header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); |
| 99 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
|
| 99 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); |
|
| 100 | 100 | header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1 |
| 101 | 101 | header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1 |
| 102 | 102 | header("Pragma: no-cache"); |
| 103 | 103 | header("Expires: 0"); |
| 104 | 104 | header('Content-Transfer-Encoding: none'); |
| 105 | - header("Content-type: " . $content); |
|
| 106 | - header("Content-length: " . strlen($data)); |
|
| 107 | - header('Content-Disposition: attachment; filename="' . $filename . '"'); |
|
| 105 | + header("Content-type: ".$content); |
|
| 106 | + header("Content-length: ".strlen($data)); |
|
| 107 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
| 108 | 108 | echo $data; |
| 109 | 109 | ob_flush(); |
| 110 | 110 | ob_end_clean(); |
@@ -26,13 +26,13 @@ |
||
| 26 | 26 | { |
| 27 | 27 | $namespace = explode('\\', $this->getModelTableMap()); |
| 28 | 28 | $module = strtolower($namespace[0]); |
| 29 | - $secret = Config::getInstance()->get($module . '.api.secret'); |
|
| 29 | + $secret = Config::getInstance()->get($module.'.api.secret'); |
|
| 30 | 30 | if (NULL === $secret) { |
| 31 | 31 | $secret = Config::getInstance()->get("api.secret"); |
| 32 | 32 | } |
| 33 | 33 | if (NULL === $secret) { |
| 34 | 34 | $auth = TRUE; |
| 35 | - } else { |
|
| 35 | + }else { |
|
| 36 | 36 | $token = Request::getInstance()->getHeader('X-API-SEC-TOKEN'); |
| 37 | 37 | if (array_key_exists('API_TOKEN', $this->query)) { |
| 38 | 38 | $token = $this->query['API_TOKEN']; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @param ModelCriteria $query |
| 182 | 182 | */ |
| 183 | - private function addOrders(ModelCriteria &$query) |
|
| 183 | + private function addOrders(ModelCriteria & $query) |
|
| 184 | 184 | { |
| 185 | 185 | $orderAdded = FALSE; |
| 186 | 186 | $tableMap = $this->getTableMap(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $orderAdded = TRUE; |
| 190 | 190 | if ($direction === Order::ASC) { |
| 191 | 191 | $query->addAscendingOrderByColumn($column->getPhpName()); |
| 192 | - } else { |
|
| 192 | + }else { |
|
| 193 | 193 | $query->addDescendingOrderByColumn($column->getPhpName()); |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | if (count($pks) == 1) { |
| 210 | 210 | $pks = array_keys($pks); |
| 211 | 211 | $this->extraColumns[$pks[0]] = self::API_MODEL_KEY_FIELD; |
| 212 | - } else { |
|
| 212 | + }else { |
|
| 213 | 213 | throw new ApiException(_('El modelo de la API no está debidamente mapeado, no hay Primary Key o es compuesta')); |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | if (null !== $column) { |
| 233 | 233 | $this->extraColumns[$column->getFullyQualifiedName()] = self::API_LIST_NAME_FIELD; |
| 234 | - } else { |
|
| 234 | + }else { |
|
| 235 | 235 | $this->addClassListName($tableMap); |
| 236 | 236 | } |
| 237 | 237 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * |
| 244 | 244 | * @param ModelCriteria $query |
| 245 | 245 | */ |
| 246 | - private function addExtraColumns(ModelCriteria &$query) |
|
| 246 | + private function addExtraColumns(ModelCriteria & $query) |
|
| 247 | 247 | { |
| 248 | 248 | if (self::API_ACTION_LIST === $this->action) { |
| 249 | 249 | $this->addDefaultListField(); |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * |
| 262 | 262 | * @param ModelCriteria $query |
| 263 | 263 | */ |
| 264 | - protected function joinTables(ModelCriteria &$query) |
|
| 264 | + protected function joinTables(ModelCriteria & $query) |
|
| 265 | 265 | { |
| 266 | 266 | //TODO for specific implementations |
| 267 | 267 | } |
@@ -283,14 +283,14 @@ discard block |
||
| 283 | 283 | * |
| 284 | 284 | * @param ModelCriteria $query |
| 285 | 285 | */ |
| 286 | - private function addFilters(ModelCriteria &$query) |
|
| 286 | + private function addFilters(ModelCriteria & $query) |
|
| 287 | 287 | { |
| 288 | 288 | if (count($this->query) > 0) { |
| 289 | 289 | $tableMap = $this->getTableMap(); |
| 290 | 290 | foreach ($this->query as $field => $value) { |
| 291 | 291 | if (self::API_COMBO_FIELD === $field) { |
| 292 | 292 | ApiHelper::composerComboField($tableMap, $query, $this->extraColumns, $value); |
| 293 | - } else { |
|
| 293 | + }else { |
|
| 294 | 294 | ApiHelper::addModelField($tableMap, $query, $field, $value); |
| 295 | 295 | } |
| 296 | 296 | } |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | /** |
| 301 | 301 | * @param ModelCriteria $query |
| 302 | 302 | */ |
| 303 | - private function checkReturnFields(ModelCriteria &$query) |
|
| 303 | + private function checkReturnFields(ModelCriteria & $query) |
|
| 304 | 304 | { |
| 305 | 305 | $returnFields = $this->getRequest()->getQuery('__fields'); |
| 306 | 306 | if (null !== $returnFields) { |
@@ -336,10 +336,10 @@ discard block |
||
| 336 | 336 | list($page, $limit) = $this->extractPagination(); |
| 337 | 337 | if ($limit == -1) { |
| 338 | 338 | $this->list = $query->find($this->con); |
| 339 | - } else { |
|
| 339 | + }else { |
|
| 340 | 340 | $this->list = $query->paginate($page, $limit, $this->con); |
| 341 | 341 | } |
| 342 | - } catch (\Exception $e) { |
|
| 342 | + }catch (\Exception $e) { |
|
| 343 | 343 | Logger::log($e->getMessage(), LOG_ERR); |
| 344 | 344 | } |
| 345 | 345 | } |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $this->joinTables($query); |
| 357 | 357 | $this->addExtraColumns($query); |
| 358 | 358 | $this->model = $query->findPk($pk); |
| 359 | - } catch (\Exception $e) { |
|
| 359 | + }catch (\Exception $e) { |
|
| 360 | 360 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 361 | 361 | } |
| 362 | 362 | } |
@@ -447,8 +447,8 @@ discard block |
||
| 447 | 447 | $saved = TRUE; |
| 448 | 448 | $model = $this->model->toArray(); |
| 449 | 449 | } |
| 450 | - } catch (\Exception $e) { |
|
| 451 | - $model = _('Ha ocurrido un error intentando guardar el elemento: ') . $e->getMessage(); |
|
| 450 | + }catch (\Exception $e) { |
|
| 451 | + $model = _('Ha ocurrido un error intentando guardar el elemento: ').$e->getMessage(); |
|
| 452 | 452 | Logger::log($e->getMessage(), LOG_ERR); |
| 453 | 453 | } |
| 454 | 454 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | $this->model->delete($this->con); |
| 479 | 479 | $deleted = TRUE; |
| 480 | 480 | } |
| 481 | - } catch (\Exception $e) { |
|
| 481 | + }catch (\Exception $e) { |
|
| 482 | 482 | $message = _('Ha ocurrido un error intentando eliminar el elemento, por favor verifica que no tenga otros elementos relacionados'); |
| 483 | 483 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
| 484 | 484 | } |
@@ -513,14 +513,14 @@ discard block |
||
| 513 | 513 | $updated = TRUE; |
| 514 | 514 | $status = 200; |
| 515 | 515 | $model = $this->model->toArray(); |
| 516 | - } else { |
|
| 516 | + }else { |
|
| 517 | 517 | $model = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs'); |
| 518 | 518 | } |
| 519 | - } catch (\Exception $e) { |
|
| 519 | + }catch (\Exception $e) { |
|
| 520 | 520 | $model = $e->getMessage(); |
| 521 | 521 | Logger::getInstance(get_class($this->model))->errorLog($e->getMessage()); |
| 522 | 522 | } |
| 523 | - } else { |
|
| 523 | + }else { |
|
| 524 | 524 | $model = _('Ha ocurrido un error intentando actualizar el elemento, por favor revisa los logs'); |
| 525 | 525 | } |
| 526 | 526 | |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | */ |
| 533 | 533 | private function extractQuery() |
| 534 | 534 | { |
| 535 | - $queryReflector = new \ReflectionClass($this->getModelNamespace() . "Query"); |
|
| 535 | + $queryReflector = new \ReflectionClass($this->getModelNamespace()."Query"); |
|
| 536 | 536 | /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */ |
| 537 | 537 | $query = $queryReflector->getMethod('create')->invoke($this->con); |
| 538 | 538 | |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | if (null !== $this->con && $this->con->inTransaction()) { |
| 577 | 577 | if ($status === 200) { |
| 578 | 578 | $this->con->commit(); |
| 579 | - } else { |
|
| 579 | + }else { |
|
| 580 | 580 | $this->con->rollBack(); |
| 581 | 581 | } |
| 582 | 582 | } |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | "domain" => $this->getDomain(), |
| 629 | 629 | "listLabel" => self::API_LIST_NAME_FIELD, |
| 630 | 630 | 'modelId' => self::API_MODEL_KEY_FIELD, |
| 631 | - 'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-' . $this->getDomain() . '-' . $this->getApi()), TRUE)), |
|
| 632 | - "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain() . '-' . 'api-' . $this->getApi() . "-pk"), TRUE)), |
|
| 631 | + 'formUrl' => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower('admin-api-form-'.$this->getDomain().'-'.$this->getApi()), TRUE)), |
|
| 632 | + "url" => preg_replace('/\/\{(.*)\}$/i', '', $this->getRoute(strtolower($this->getDomain().'-'.'api-'.$this->getApi()."-pk"), TRUE)), |
|
| 633 | 633 | ), [], ''); |
| 634 | 634 | } |
| 635 | 635 | |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $total = $this->list->getNbResults(); |
| 669 | 669 | $pages = $this->list->getLastPage(); |
| 670 | 670 | } |
| 671 | - } catch (\Exception $e) { |
|
| 671 | + }catch (\Exception $e) { |
|
| 672 | 672 | Logger::getInstance(get_class($this))->errorLog($e->getMessage()); |
| 673 | 673 | } |
| 674 | 674 | |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | $return = array(); |
| 688 | 688 | if (NULL === $model && method_exists($model, 'toArray')) { |
| 689 | 689 | $code = 404; |
| 690 | - } else { |
|
| 690 | + }else { |
|
| 691 | 691 | $return = $model->toArray(); |
| 692 | 692 | } |
| 693 | 693 | |
@@ -702,10 +702,10 @@ discard block |
||
| 702 | 702 | $pks = ''; |
| 703 | 703 | $sep = ''; |
| 704 | 704 | foreach ($tableMap->getPrimaryKeys() as $pk) { |
| 705 | - $pks .= $sep . $pk->getFullyQualifiedName(); |
|
| 705 | + $pks .= $sep.$pk->getFullyQualifiedName(); |
|
| 706 | 706 | $sep = ', "|", '; |
| 707 | 707 | } |
| 708 | - $this->extraColumns['CONCAT("' . $tableMap->getPhpName() . ' #", ' . $pks . ')'] = self::API_LIST_NAME_FIELD; |
|
| 708 | + $this->extraColumns['CONCAT("'.$tableMap->getPhpName().' #", '.$pks.')'] = self::API_LIST_NAME_FIELD; |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
@@ -30,16 +30,16 @@ |
||
| 30 | 30 | $scripts = $this->getNode("scripts"); |
| 31 | 31 | |
| 32 | 32 | //Creamos el parser |
| 33 | - $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\'' . $this->type . '\')') |
|
| 33 | + $compiler->addDebugInfo($scripts)->write('$parser = new \\PSFS\\base\\extension\\AssetsParser(\''.$this->type.'\')') |
|
| 34 | 34 | ->raw(";\n"); |
| 35 | 35 | |
| 36 | 36 | //Asociamos el hash |
| 37 | - $compiler->write('$parser->setHash(\'' . $this->hash . '\')') |
|
| 37 | + $compiler->write('$parser->setHash(\''.$this->hash.'\')') |
|
| 38 | 38 | ->raw(";\n"); |
| 39 | 39 | |
| 40 | 40 | //Asociamos los ficheros |
| 41 | 41 | foreach ($scripts->getAttribute("value") as $value) { |
| 42 | - $compiler->write('$parser->addFile(\'' . $value . '\')')->raw(";\n"); |
|
| 42 | + $compiler->write('$parser->addFile(\''.$value.'\')')->raw(";\n"); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | //Procesamos los ficheros |
@@ -139,7 +139,7 @@ |
||
| 139 | 139 | $tmp = array(); |
| 140 | 140 | if (NULL === $node) { |
| 141 | 141 | $node = $value; |
| 142 | - } else { |
|
| 142 | + }else { |
|
| 143 | 143 | $tmp = $this->getTmpAttribute($node); |
| 144 | 144 | } |
| 145 | 145 | $tmp[] = $value->getAttribute("value"); |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | public function __construct($type = 'js') |
| 33 | 33 | { |
| 34 | 34 | $this->type = $type; |
| 35 | - $this->path = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 35 | + $this->path = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 36 | 36 | $this->domains = Template::getDomains(true); |
| 37 | 37 | $this->debug = Config::getInstance()->getDebugMode(); |
| 38 | 38 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | $source_file = explode("?", $source_file); |
| 55 | 55 | $source_file = $source_file[0]; |
| 56 | 56 | } |
| 57 | - $orig = realpath(dirname($filename_path) . DIRECTORY_SEPARATOR . $source_file); |
|
| 57 | + $orig = realpath(dirname($filename_path).DIRECTORY_SEPARATOR.$source_file); |
|
| 58 | 58 | return $orig; |
| 59 | 59 | } |
| 60 | 60 | |
@@ -67,12 +67,12 @@ discard block |
||
| 67 | 67 | */ |
| 68 | 68 | public function addFile($filename) |
| 69 | 69 | { |
| 70 | - if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) { |
|
| 70 | + if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) { |
|
| 71 | 71 | $this->files[] = $filename; |
| 72 | 72 | } elseif (!empty($this->domains)) { |
| 73 | 73 | foreach ($this->domains as $domain => $paths) { |
| 74 | 74 | $domain_filename = str_replace($domain, $paths["public"], $filename); |
| 75 | - if (file_exists($domain_filename) && preg_match('/\.' . $this->type . '$/i', $domain_filename)) { |
|
| 75 | + if (file_exists($domain_filename) && preg_match('/\.'.$this->type.'$/i', $domain_filename)) { |
|
| 76 | 76 | $this->files[] = $domain_filename; |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | public function setHash($hash) |
| 90 | 90 | { |
| 91 | 91 | $cache = Config::getInstance()->get('cache.var') ?: ''; |
| 92 | - $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache; |
|
| 92 | + $this->hash = $hash.(strlen($cache) ? '.' : '').$cache; |
|
| 93 | 93 | return $this; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -123,15 +123,15 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function compileCss() |
| 125 | 125 | { |
| 126 | - $base = $this->path . "css" . DIRECTORY_SEPARATOR; |
|
| 127 | - if ($this->debug || !file_exists($base . $this->hash . ".css")) { |
|
| 126 | + $base = $this->path."css".DIRECTORY_SEPARATOR; |
|
| 127 | + if ($this->debug || !file_exists($base.$this->hash.".css")) { |
|
| 128 | 128 | $data = ''; |
| 129 | 129 | if (0 < count($this->files)) { |
| 130 | 130 | foreach ($this->files as $file) { |
| 131 | 131 | $data = $this->processCssLine($file, $base, $data); |
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | - $this->storeContents($base . $this->hash . ".css", \CssMin::minify($data)); |
|
| 134 | + $this->storeContents($base.$this->hash.".css", \CssMin::minify($data)); |
|
| 135 | 135 | unset($cssMinifier); |
| 136 | 136 | } |
| 137 | 137 | return $this; |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | protected function compileJs() |
| 146 | 146 | { |
| 147 | - $base = $this->path . "js" . DIRECTORY_SEPARATOR; |
|
| 148 | - if ($this->debug || !file_exists($base . $this->hash . ".js")) { |
|
| 147 | + $base = $this->path."js".DIRECTORY_SEPARATOR; |
|
| 148 | + if ($this->debug || !file_exists($base.$this->hash.".js")) { |
|
| 149 | 149 | $data = ''; |
| 150 | 150 | if (0 < count($this->files)) { |
| 151 | 151 | foreach ($this->files as $file) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | if (file_exists($file)) { |
| 154 | 154 | if ($this->debug) { |
| 155 | 155 | $data = $this->putDebugJs($path_parts, $base, $file); |
| 156 | - } elseif (!file_exists($base . $this->hash . ".js")) { |
|
| 156 | + } elseif (!file_exists($base.$this->hash.".js")) { |
|
| 157 | 157 | $data = $this->putProductionJs($base, $file, $data); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | } |
| 162 | 162 | try { |
| 163 | 163 | $minifiedJs = Minifier::minify($data); |
| 164 | - } catch (\Exception $e) { |
|
| 164 | + }catch (\Exception $e) { |
|
| 165 | 165 | Logger::log($e->getMessage(), LOG_ERR); |
| 166 | 166 | $minifiedJs = false; |
| 167 | 167 | } |
| 168 | - $this->storeContents($base . $this->hash . ".js", (false !== $minifiedJs) ? $minifiedJs : $data); |
|
| 168 | + $this->storeContents($base.$this->hash.".js", (false !== $minifiedJs) ? $minifiedJs : $data); |
|
| 169 | 169 | } |
| 170 | 170 | return $this; |
| 171 | 171 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | { |
| 181 | 181 | GeneratorHelper::createDir(dirname($path)); |
| 182 | 182 | if ("" !== $content && false === file_put_contents($path, $content)) { |
| 183 | - throw new ConfigException(_('No se tienen permisos para escribir en ' . $path)); |
|
| 183 | + throw new ConfigException(_('No se tienen permisos para escribir en '.$path)); |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -209,8 +209,8 @@ discard block |
||
| 209 | 209 | foreach ($this->compiled_files as $file) { |
| 210 | 210 | echo "\t\t<script type='text/javascript' src='{$file}'></script>\n"; |
| 211 | 211 | } |
| 212 | - } else { |
|
| 213 | - echo "\t\t<script type='text/javascript' src='/js/" . $this->hash . ".js'></script>\n"; |
|
| 212 | + }else { |
|
| 213 | + echo "\t\t<script type='text/javascript' src='/js/".$this->hash.".js'></script>\n"; |
|
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | foreach ($this->compiled_files as $file) { |
| 224 | 224 | echo "\t\t<link href='{$file}' rel='stylesheet' media='screen, print'>"; |
| 225 | 225 | } |
| 226 | - } else { |
|
| 227 | - echo "\t\t<link href='/css/" . $this->hash . ".css' rel='stylesheet'>"; |
|
| 226 | + }else { |
|
| 227 | + echo "\t\t<link href='/css/".$this->hash.".css' rel='stylesheet'>"; |
|
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
@@ -235,20 +235,20 @@ discard block |
||
| 235 | 235 | protected function extractCssResources($source, $file) |
| 236 | 236 | { |
| 237 | 237 | $source_file = $this->extractSourceFilename($source); |
| 238 | - $orig = realpath(dirname($file) . DIRECTORY_SEPARATOR . $source_file); |
|
| 238 | + $orig = realpath(dirname($file).DIRECTORY_SEPARATOR.$source_file); |
|
| 239 | 239 | $orig_part = preg_split('/(\/|\\\)public(\/|\\\)/i', $orig); |
| 240 | 240 | try { |
| 241 | 241 | if (count($source) > 1 && array_key_exists(1, $orig_part)) { |
| 242 | - $dest = $this->path . $orig_part[1]; |
|
| 242 | + $dest = $this->path.$orig_part[1]; |
|
| 243 | 243 | GeneratorHelper::createDir(dirname($dest)); |
| 244 | 244 | if (!file_exists($dest) || filemtime($orig) > filemtime($dest)) { |
| 245 | 245 | if (@copy($orig, $dest) === FALSE) { |
| 246 | - throw new \RuntimeException('Can\' copy ' . $dest . ''); |
|
| 246 | + throw new \RuntimeException('Can\' copy '.$dest.''); |
|
| 247 | 247 | } |
| 248 | 248 | Logger::log("$orig copiado a $dest", LOG_INFO); |
| 249 | 249 | } |
| 250 | 250 | } |
| 251 | - } catch (\Exception $e) { |
|
| 251 | + }catch (\Exception $e) { |
|
| 252 | 252 | Logger::log($e->getMessage(), LOG_ERR); |
| 253 | 253 | } |
| 254 | 254 | } |
@@ -265,21 +265,21 @@ discard block |
||
| 265 | 265 | { |
| 266 | 266 | if (file_exists($file)) { |
| 267 | 267 | $path_parts = explode("/", $file); |
| 268 | - $file_path = $this->hash . "_" . $path_parts[count($path_parts) - 1]; |
|
| 269 | - if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($file) || $this->debug) { |
|
| 268 | + $file_path = $this->hash."_".$path_parts[count($path_parts) - 1]; |
|
| 269 | + if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($file) || $this->debug) { |
|
| 270 | 270 | //Si tenemos modificaciones tenemos que compilar de nuevo todos los ficheros modificados |
| 271 | - if (file_exists($base . $this->hash . ".css") && @unlink($base . $this->hash . ".css") === false) { |
|
| 272 | - throw new ConfigException("Can't unlink file " . $base . $this->hash . ".css"); |
|
| 271 | + if (file_exists($base.$this->hash.".css") && @unlink($base.$this->hash.".css") === false) { |
|
| 272 | + throw new ConfigException("Can't unlink file ".$base.$this->hash.".css"); |
|
| 273 | 273 | } |
| 274 | 274 | $this->loopCssLines($file); |
| 275 | 275 | } |
| 276 | 276 | if ($this->debug) { |
| 277 | 277 | $data = file_get_contents($file); |
| 278 | - $this->storeContents($base . $file_path, $data); |
|
| 279 | - } else { |
|
| 278 | + $this->storeContents($base.$file_path, $data); |
|
| 279 | + }else { |
|
| 280 | 280 | $data .= file_get_contents($file); |
| 281 | 281 | } |
| 282 | - $this->compiled_files[] = "/css/" . $file_path; |
|
| 282 | + $this->compiled_files[] = "/css/".$file_path; |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | return $data; |
@@ -294,12 +294,12 @@ discard block |
||
| 294 | 294 | */ |
| 295 | 295 | protected function putDebugJs($path_parts, $base, $file) |
| 296 | 296 | { |
| 297 | - $file_path = $this->hash . "_" . $path_parts[count($path_parts) - 1]; |
|
| 298 | - $this->compiled_files[] = "/js/" . $file_path; |
|
| 297 | + $file_path = $this->hash."_".$path_parts[count($path_parts) - 1]; |
|
| 298 | + $this->compiled_files[] = "/js/".$file_path; |
|
| 299 | 299 | $data = ""; |
| 300 | - if (!file_exists($base . $file_path) || filemtime($base . $file_path) < filemtime($file)) { |
|
| 300 | + if (!file_exists($base.$file_path) || filemtime($base.$file_path) < filemtime($file)) { |
|
| 301 | 301 | $data = file_get_contents($file); |
| 302 | - $this->storeContents($base . $file_path, $data); |
|
| 302 | + $this->storeContents($base.$file_path, $data); |
|
| 303 | 303 | } |
| 304 | 304 | return $data; |
| 305 | 305 | } |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | { |
| 317 | 317 | $js = file_get_contents($file); |
| 318 | 318 | try { |
| 319 | - $data .= ";\n" . $js; |
|
| 320 | - } catch (\Exception $e) { |
|
| 319 | + $data .= ";\n".$js; |
|
| 320 | + }catch (\Exception $e) { |
|
| 321 | 321 | throw new ConfigException($e->getMessage()); |
| 322 | 322 | } |
| 323 | 323 | return $data; |
@@ -360,50 +360,50 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | $ppath = explode("/", $string); |
| 362 | 362 | $original_filename = $ppath[count($ppath) - 1]; |
| 363 | - $base = WEB_DIR . DIRECTORY_SEPARATOR; |
|
| 363 | + $base = WEB_DIR.DIRECTORY_SEPARATOR; |
|
| 364 | 364 | $file = ""; |
| 365 | 365 | $html_base = ""; |
| 366 | 366 | $debug = Config::getInstance()->getDebugMode(); |
| 367 | 367 | $cache = Config::getInstance()->get('cache.var'); |
| 368 | - $cache = $cache ? '.' . $cache : ''; |
|
| 368 | + $cache = $cache ? '.'.$cache : ''; |
|
| 369 | 369 | if (preg_match('/\.css$/i', $string)) { |
| 370 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.css"; |
|
| 370 | + $file = "/".substr(md5($string), 0, 8)."$cache.css"; |
|
| 371 | 371 | $html_base = "css"; |
| 372 | 372 | if ($debug) { |
| 373 | - $file = str_replace(".css", "_" . $original_filename, $file); |
|
| 373 | + $file = str_replace(".css", "_".$original_filename, $file); |
|
| 374 | 374 | } |
| 375 | 375 | } elseif (preg_match('/\.js$/i', $string)) { |
| 376 | - $file = "/" . substr(md5($string), 0, 8) . "$cache.js"; |
|
| 376 | + $file = "/".substr(md5($string), 0, 8)."$cache.js"; |
|
| 377 | 377 | $html_base = "js"; |
| 378 | 378 | if ($debug) { |
| 379 | - $file = str_replace(".js", "_" . $original_filename, $file); |
|
| 379 | + $file = str_replace(".js", "_".$original_filename, $file); |
|
| 380 | 380 | } |
| 381 | 381 | } elseif (preg_match("/image/i", mime_content_type($filename_path))) { |
| 382 | 382 | $ext = explode(".", $string); |
| 383 | - $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1]; |
|
| 383 | + $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1]; |
|
| 384 | 384 | $html_base = "img"; |
| 385 | 385 | if ($debug) { |
| 386 | - $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file); |
|
| 386 | + $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file); |
|
| 387 | 387 | } |
| 388 | 388 | } elseif (preg_match("/(doc|pdf)/i", mime_content_type($filename_path))) { |
| 389 | 389 | $ext = explode(".", $string); |
| 390 | - $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1]; |
|
| 390 | + $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1]; |
|
| 391 | 391 | $html_base = "docs"; |
| 392 | 392 | if ($debug) { |
| 393 | - $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file); |
|
| 393 | + $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file); |
|
| 394 | 394 | } |
| 395 | 395 | } elseif (preg_match("/(video|audio|ogg)/i", mime_content_type($filename_path))) { |
| 396 | 396 | $ext = explode(".", $string); |
| 397 | - $file = "/" . substr(md5($string), 0, 8) . "." . $ext[count($ext) - 1]; |
|
| 397 | + $file = "/".substr(md5($string), 0, 8).".".$ext[count($ext) - 1]; |
|
| 398 | 398 | $html_base = "media"; |
| 399 | 399 | if ($debug) { |
| 400 | - $file = str_replace("." . $ext[count($ext) - 1], "_" . $original_filename, $file); |
|
| 400 | + $file = str_replace(".".$ext[count($ext) - 1], "_".$original_filename, $file); |
|
| 401 | 401 | } |
| 402 | 402 | } elseif (!$return && !is_null($name)) { |
| 403 | 403 | $html_base = ''; |
| 404 | 404 | $file = $name; |
| 405 | 405 | } |
| 406 | - $file_path = $html_base . $file; |
|
| 406 | + $file_path = $html_base.$file; |
|
| 407 | 407 | |
| 408 | 408 | return array($base, $html_base, $file_path); |
| 409 | 409 | } |
@@ -422,10 +422,10 @@ discard block |
||
| 422 | 422 | foreach ($urls as $source) { |
| 423 | 423 | $orig = self::calculateResourcePathname($filename_path, $source); |
| 424 | 424 | $orig_part = explode("Public", $orig); |
| 425 | - $dest = WEB_DIR . $orig_part[1]; |
|
| 425 | + $dest = WEB_DIR.$orig_part[1]; |
|
| 426 | 426 | GeneratorHelper::createDir(dirname($dest)); |
| 427 | 427 | if (@copy($orig, $dest) === false) { |
| 428 | - throw new ConfigException("Can't copy " . $orig . " to " . $dest); |
|
| 428 | + throw new ConfigException("Can't copy ".$orig." to ".$dest); |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | } |