@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | public function add($name, array $value = []) |
31 | 31 | { |
32 | 32 | $this->fields[$name] = $value; |
33 | - $this->fields[$name]['name'] = $this->getName() . '[' . $name . ']'; |
|
34 | - $this->fields[$name]['id'] = $this->getName() . '_' . $name; |
|
33 | + $this->fields[$name]['name'] = $this->getName().'['.$name.']'; |
|
34 | + $this->fields[$name]['id'] = $this->getName().'_'.$name; |
|
35 | 35 | $this->fields[$name]['placeholder'] = array_key_exists('placeholder', $value) ? $value['placeholder'] : $name; |
36 | 36 | $this->fields[$name]['hasLabel'] = array_key_exists('hasLabel', $value) ? $value['hasLabel'] : true; |
37 | 37 | return $this; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $data = array(); |
71 | 71 | if (count($this->fields) > 0) { |
72 | 72 | foreach ($this->fields as $key => $field) { |
73 | - if (self::SEPARATOR !== $key && $key !== ($this->getName() . '_token')) { |
|
73 | + if (self::SEPARATOR !== $key && $key !== ($this->getName().'_token')) { |
|
74 | 74 | $data[$key] = array_key_exists('value', $field) ? $field['value'] : null; |
75 | 75 | } |
76 | 76 | } |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | if (array_key_exists($key, $data[$formName])) { |
118 | 118 | if (preg_match('/id/i', $key) && ($data[$formName][$key] === 0 || $data[$formName][$key] === '%' || $data[$formName][$key] === '')) { |
119 | 119 | $field['value'] = null; |
120 | - } else { |
|
120 | + }else { |
|
121 | 121 | $field['value'] = $data[$formName][$key]; |
122 | 122 | } |
123 | - } else { |
|
123 | + }else { |
|
124 | 124 | unset($field['value']); |
125 | 125 | } |
126 | 126 | return array($data, $field); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | if (array_key_exists('i18n', $behaviors)) { |
133 | - $relateI18n = $tableMap->getRelation($tableMap->getPhpName() . 'I18n'); |
|
133 | + $relateI18n = $tableMap->getRelation($tableMap->getPhpName().'I18n'); |
|
134 | 134 | if (null !== $relateI18n) { |
135 | 135 | $i18NTableMap = $relateI18n->getLocalTable(); |
136 | 136 | foreach ($i18NTableMap->getColumns() as $columnMap) { |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | try { |
174 | 174 | foreach ($tableMap->getColumns() as $tableMapColumn) { |
175 | 175 | $columnName = $tableMapColumn->getPhpName(); |
176 | - if (preg_match('/^' . $field . '$/i', $columnName)) { |
|
176 | + if (preg_match('/^'.$field.'$/i', $columnName)) { |
|
177 | 177 | $column = $tableMapColumn; |
178 | 178 | break; |
179 | 179 | } |
180 | 180 | } |
181 | - } catch (\Exception $e) { |
|
181 | + }catch (\Exception $e) { |
|
182 | 182 | Logger::log($e->getMessage(), LOG_DEBUG); |
183 | 183 | } |
184 | 184 | return $column; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $fDto->entity = $relatedModel; |
34 | 34 | $relatedField = $foreignTable->getColumn($mappedColumn->getRelatedColumnName()); |
35 | 35 | $fDto->relatedField = $relatedField->getPhpName(); |
36 | - $fDto->url = Router::getInstance()->getRoute(strtolower($domain) . '-api-' . $relatedModel); |
|
36 | + $fDto->url = Router::getInstance()->getRoute(strtolower($domain).'-api-'.$relatedModel); |
|
37 | 37 | return $fDto; |
38 | 38 | } |
39 | 39 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @param ModelCriteria $query |
43 | 43 | * @param mixed $value |
44 | 44 | */ |
45 | - private static function addQueryFilter(ColumnMap $column, ModelCriteria &$query, $value = null) |
|
45 | + private static function addQueryFilter(ColumnMap $column, ModelCriteria & $query, $value = null) |
|
46 | 46 | { |
47 | 47 | $tableField = $column->getFullyQualifiedName(); |
48 | 48 | if (is_array($value)) { |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | } elseif (preg_match('/^(\'|\")(.*)(\'|\")$/', $value)) { |
53 | 53 | $text = preg_replace('/(\'|\")/', '', $value); |
54 | 54 | $text = preg_replace('/\ /', '%', $text); |
55 | - $query->add($tableField, '%' . $text . '%', Criteria::LIKE); |
|
56 | - } else { |
|
55 | + $query->add($tableField, '%'.$text.'%', Criteria::LIKE); |
|
56 | + }else { |
|
57 | 57 | if (null !== $column->getValueSet()) { |
58 | 58 | $valueSet = $column->getValueSet(); |
59 | 59 | if (in_array($value, $valueSet)) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @param string $field |
72 | 72 | * @param mixed $value |
73 | 73 | */ |
74 | - public static function addModelField(TableMap $tableMap, ModelCriteria &$query, $field, $value = null) |
|
74 | + public static function addModelField(TableMap $tableMap, ModelCriteria & $query, $field, $value = null) |
|
75 | 75 | { |
76 | 76 | if ($column = self::checkFieldExists($tableMap, $field)) { |
77 | 77 | self::addQueryFilter($column, $query, $value); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public static function extractQuery($modelNameNamespace, ConnectionInterface $con = null) |
88 | 88 | { |
89 | - $queryReflector = new \ReflectionClass($modelNameNamespace . "Query"); |
|
89 | + $queryReflector = new \ReflectionClass($modelNameNamespace."Query"); |
|
90 | 90 | /** @var \Propel\Runtime\ActiveQuery\ModelCriteria $query */ |
91 | 91 | $query = $queryReflector->getMethod('create')->invoke($con); |
92 | 92 | |
@@ -99,13 +99,13 @@ discard block |
||
99 | 99 | * @param array $extraColumns |
100 | 100 | * @param mixed $value |
101 | 101 | */ |
102 | - public static function composerComboField(TableMap $tableMap, ModelCriteria &$query, array $extraColumns = [], $value = null) |
|
102 | + public static function composerComboField(TableMap $tableMap, ModelCriteria & $query, array $extraColumns = [], $value = null) |
|
103 | 103 | { |
104 | 104 | $exp = 'CONCAT('; |
105 | 105 | $sep = ''; |
106 | 106 | foreach ($tableMap->getColumns() as $column) { |
107 | 107 | if ($column->isText()) { |
108 | - $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")'; |
|
108 | + $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")'; |
|
109 | 109 | $sep = ', " ", '; |
110 | 110 | } |
111 | 111 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | $localeTableMap = $relation->getLocalTable(); |
115 | 115 | foreach ($localeTableMap->getColumns() as $column) { |
116 | 116 | if ($column->isText()) { |
117 | - $exp .= $sep . 'IFNULL(' . $column->getFullyQualifiedName() . ',"")'; |
|
117 | + $exp .= $sep.'IFNULL('.$column->getFullyQualifiedName().',"")'; |
|
118 | 118 | $sep = ', " ", '; |
119 | 119 | } |
120 | 120 | } |
@@ -122,14 +122,14 @@ discard block |
||
122 | 122 | } |
123 | 123 | foreach (array_keys($extraColumns) as $extra) { |
124 | 124 | if (!preg_match("/(COUNT|DISTINCT|SUM|MAX|MIN|GROUP)/i", $extra)) { |
125 | - $exp .= $sep . $extra; |
|
125 | + $exp .= $sep.$extra; |
|
126 | 126 | $sep = ', " ", '; |
127 | 127 | } |
128 | 128 | } |
129 | 129 | $exp .= ")"; |
130 | 130 | $text = preg_replace('/(\'|\")/', '', $value); |
131 | 131 | $text = preg_replace('/\ /', '%', $text); |
132 | - $query->where($exp . Criteria::LIKE . '"%' . $text . '%"'); |
|
132 | + $query->where($exp.Criteria::LIKE.'"%'.$text.'%"'); |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | $model = $class->newInstance(); |
104 | 104 | $this->hydrateModelFromRequest($model, $item); |
105 | 105 | $this->list[] = $model; |
106 | - } else { |
|
107 | - Logger::log(t('Max items per bulk insert raised'), LOG_WARNING, count($this->data) . t('items')); |
|
106 | + }else { |
|
107 | + Logger::log(t('Max items per bulk insert raised'), LOG_WARNING, count($this->data).t('items')); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | try { |
122 | 122 | $model->save($con); |
123 | 123 | $con->commit(); |
124 | - } catch (\Exception $e) { |
|
124 | + }catch (\Exception $e) { |
|
125 | 125 | Logger::log($e->getMessage(), LOG_ERR, $model->toArray()); |
126 | 126 | $con->rollBack(); |
127 | 127 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param ModelCriteria $query |
148 | 148 | */ |
149 | - protected function joinTables(ModelCriteria &$query) |
|
149 | + protected function joinTables(ModelCriteria & $query) |
|
150 | 150 | { |
151 | 151 | //TODO for specific implementations |
152 | 152 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $pks = explode(Api::API_PK_SEPARATOR, urldecode($primaryKey)); |
163 | 163 | if (count($pks) === 1 && !empty($pks[0])) { |
164 | 164 | $query->filterByPrimaryKey($pks[0]); |
165 | - } else { |
|
165 | + }else { |
|
166 | 166 | $item = 0; |
167 | 167 | foreach ($this->getPkDbName() as $phpName) { |
168 | 168 | try { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | if ($item >= count($pks)) { |
172 | 172 | break; |
173 | 173 | } |
174 | - } catch (\Exception $e) { |
|
174 | + }catch (\Exception $e) { |
|
175 | 175 | Logger::log($e->getMessage(), LOG_DEBUG); |
176 | 176 | } |
177 | 177 | } |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | try { |
203 | 203 | $query = $this->prepareQuery(); |
204 | 204 | $this->model = $this->findPk($query, $primaryKey); |
205 | - } catch (\Exception $e) { |
|
206 | - Logger::log(get_class($this) . ': ' . $e->getMessage(), LOG_ERR); |
|
205 | + }catch (\Exception $e) { |
|
206 | + Logger::log(get_class($this).': '.$e->getMessage(), LOG_ERR); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | /** |
225 | 225 | * @param ModelCriteria $query |
226 | 226 | */ |
227 | - protected function checkReturnFields(ModelCriteria &$query) |
|
227 | + protected function checkReturnFields(ModelCriteria & $query) |
|
228 | 228 | { |
229 | 229 | $returnFields = Request::getInstance()->getQuery(Api::API_FIELDS_RESULT_FIELD); |
230 | 230 | if (null !== $returnFields) { |
@@ -52,7 +52,7 @@ |
||
52 | 52 | if (null !== $this->con && $this->con->inTransaction()) { |
53 | 53 | if ($status === 200) { |
54 | 54 | $this->con->commit(); |
55 | - } else { |
|
55 | + }else { |
|
56 | 56 | $this->con->rollBack(); |
57 | 57 | } |
58 | 58 | } |
@@ -12,5 +12,5 @@ |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | define('PSFS_BOOSTRAP_TRAT_LOADED', true); |
15 | - require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'bootstrap.php'; |
|
15 | + require_once __DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'bootstrap.php'; |
|
16 | 16 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @param string $path |
17 | 17 | * @return int|bool |
18 | 18 | */ |
19 | - public static function writeFile(string $path, mixed $data): int|bool |
|
19 | + public static function writeFile(string $path, mixed $data): int | bool |
|
20 | 20 | { |
21 | 21 | return @file_put_contents($path, $data); |
22 | 22 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @param string $path |
26 | 26 | * @return string|bool |
27 | 27 | */ |
28 | - public static function readFile(string $path): string|bool |
|
28 | + public static function readFile(string $path): string | bool |
|
29 | 29 | { |
30 | 30 | $data = false; |
31 | 31 | if (file_exists($path)) { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function generateHashFilename(string $verb, string $slug, array $query = []): string |
44 | 44 | { |
45 | - return sha1(strtolower($verb) . ' ' . $slug . ' ' . strtolower(http_build_query($query))); |
|
45 | + return sha1(strtolower($verb).' '.$slug.' '.strtolower(http_build_query($query))); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | { |
55 | 55 | $class = GeneratorHelper::extractClassFromNamespace($action['class']); |
56 | 56 | $filename = self::generateHashFilename($action['http'], $action['slug'], $query); |
57 | - $subPath = substr($filename, 0, 2) . DIRECTORY_SEPARATOR . substr($filename, 2, 2); |
|
58 | - return $action['module'] . DIRECTORY_SEPARATOR . $class . DIRECTORY_SEPARATOR . $action['method'] . DIRECTORY_SEPARATOR . $subPath . DIRECTORY_SEPARATOR; |
|
57 | + $subPath = substr($filename, 0, 2).DIRECTORY_SEPARATOR.substr($filename, 2, 2); |
|
58 | + return $action['module'].DIRECTORY_SEPARATOR.$class.DIRECTORY_SEPARATOR.$action['method'].DIRECTORY_SEPARATOR.$subPath.DIRECTORY_SEPARATOR; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -84,8 +84,8 @@ |
||
84 | 84 | 'icon' => 'fa-plus', |
85 | 85 | ]; |
86 | 86 | if (Config::getParam('admin.version', 'v1') === 'v1') { |
87 | - $add['onclick'] = 'javascript:addNewField(document.getElementById("' . $this->getName() . '"));'; |
|
88 | - } else { |
|
87 | + $add['onclick'] = 'javascript:addNewField(document.getElementById("'.$this->getName().'"));'; |
|
88 | + }else { |
|
89 | 89 | $add['ng-click'] = 'addNewField()'; |
90 | 90 | } |
91 | 91 | $this->addButton('submit', t('Guardar configuración'), 'submit', array( |
@@ -13,8 +13,8 @@ discard block |
||
13 | 13 | use PSFS\base\types\helpers\GeneratorHelper; |
14 | 14 | use PSFS\base\types\helpers\Inspector; |
15 | 15 | |
16 | -defined('CSS_SRI_FILENAME') or define('CSS_SRI_FILENAME', CACHE_DIR . DIRECTORY_SEPARATOR . 'css.sri.json'); |
|
17 | -defined('JS_SRI_FILENAME') or define('JS_SRI_FILENAME', CACHE_DIR . DIRECTORY_SEPARATOR . 'js.sri.json'); |
|
16 | +defined('CSS_SRI_FILENAME') or define('CSS_SRI_FILENAME', CACHE_DIR.DIRECTORY_SEPARATOR.'css.sri.json'); |
|
17 | +defined('JS_SRI_FILENAME') or define('JS_SRI_FILENAME', CACHE_DIR.DIRECTORY_SEPARATOR.'js.sri.json'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Class AssetsParser |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | public function __construct($type = 'js') |
82 | 82 | { |
83 | 83 | $this->type = $type; |
84 | - $this->path = WEB_DIR . DIRECTORY_SEPARATOR; |
|
84 | + $this->path = WEB_DIR.DIRECTORY_SEPARATOR; |
|
85 | 85 | $this->domains = Template::getDomains(true); |
86 | 86 | $this->cdnPath = Config::getParam('resources.cdn.url', Request::getInstance()->getRootUrl()); |
87 | 87 | } |
@@ -94,12 +94,12 @@ discard block |
||
94 | 94 | */ |
95 | 95 | public function addFile($filename) |
96 | 96 | { |
97 | - if (file_exists($this->path . $filename) && preg_match('/\.' . $this->type . '$/i', $filename)) { |
|
97 | + if (file_exists($this->path.$filename) && preg_match('/\.'.$this->type.'$/i', $filename)) { |
|
98 | 98 | $this->files[] = $filename; |
99 | 99 | } elseif (!empty($this->domains)) { |
100 | 100 | foreach ($this->domains as $domain => $paths) { |
101 | 101 | $domainFilename = str_replace($domain, $paths["public"], $filename); |
102 | - if (file_exists($domainFilename) && preg_match('/\.' . $this->type . '$/i', $domainFilename)) { |
|
102 | + if (file_exists($domainFilename) && preg_match('/\.'.$this->type.'$/i', $domainFilename)) { |
|
103 | 103 | $this->files[] = $domainFilename; |
104 | 104 | } |
105 | 105 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | public function setHash($hash) |
117 | 117 | { |
118 | 118 | $cache = Config::getParam('cache.var', ''); |
119 | - $this->hash = $hash . (strlen($cache) ? '.' : '') . $cache; |
|
119 | + $this->hash = $hash.(strlen($cache) ? '.' : '').$cache; |
|
120 | 120 | return $this; |
121 | 121 | } |
122 | 122 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | $sourceFile = explode("?", $sourceFile); |
179 | 179 | $sourceFile = $sourceFile[0]; |
180 | 180 | } |
181 | - $orig = realpath(dirname($filenamePath) . DIRECTORY_SEPARATOR . $sourceFile); |
|
181 | + $orig = realpath(dirname($filenamePath).DIRECTORY_SEPARATOR.$sourceFile); |
|
182 | 182 | return $orig; |
183 | 183 | } |
184 | 184 | |
@@ -197,13 +197,13 @@ discard block |
||
197 | 197 | $orig = self::calculateResourcePathname($filenamePath, $source); |
198 | 198 | if (!empty($orig)) { |
199 | 199 | $orig_part = preg_split("/Public/i", $orig); |
200 | - $dest = WEB_DIR . $orig_part[1]; |
|
200 | + $dest = WEB_DIR.$orig_part[1]; |
|
201 | 201 | GeneratorHelper::createDir(dirname($dest)); |
202 | 202 | if (@copy($orig, $dest) === false) { |
203 | - throw new ConfigException("Can't copy " . $orig . " to " . $dest); |
|
203 | + throw new ConfigException("Can't copy ".$orig." to ".$dest); |
|
204 | 204 | } |
205 | - } else { |
|
206 | - Logger::log($filenamePath . ' has an empty origin with the url ' . $source, LOG_WARNING); |
|
205 | + }else { |
|
206 | + Logger::log($filenamePath.' has an empty origin with the url '.$source, LOG_WARNING); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | } |
@@ -219,9 +219,9 @@ discard block |
||
219 | 219 | { |
220 | 220 | if (array_key_exists($hash, $this->sri)) { |
221 | 221 | $sriHash = $this->sri[$hash]; |
222 | - } else { |
|
223 | - Inspector::stats('[SRITrait] Generating SRI for ' . $hash, Inspector::SCOPE_DEBUG); |
|
224 | - $filename = WEB_DIR . DIRECTORY_SEPARATOR . $type . DIRECTORY_SEPARATOR . $hash . '.' . $type; |
|
222 | + }else { |
|
223 | + Inspector::stats('[SRITrait] Generating SRI for '.$hash, Inspector::SCOPE_DEBUG); |
|
224 | + $filename = WEB_DIR.DIRECTORY_SEPARATOR.$type.DIRECTORY_SEPARATOR.$hash.'.'.$type; |
|
225 | 225 | $sriHash = base64_encode(hash("sha384", file_get_contents($filename), true)); |
226 | 226 | $this->sri[$hash] = $sriHash; |
227 | 227 | Cache::getInstance()->storeData($this->sriFilename, $this->sri, Cache::JSON, true); |