@@ -92,7 +92,7 @@ |
||
| 92 | 92 | 0, |
| 93 | 93 | strpos($table_name, '"') |
| 94 | 94 | ); |
| 95 | - $update = preg_replace_callback( |
|
| 95 | + $update = preg_replace_callback( |
|
| 96 | 96 | '/"([^"]+)"/', |
| 97 | 97 | function ($matches) { |
| 98 | 98 | return "\"$matches[1]\" = EXCLUDED.\"$matches[1]\""; |
@@ -75,10 +75,10 @@ |
||
| 75 | 75 | * Try to load classes from different places. If not found in one place - try in another. |
| 76 | 76 | */ |
| 77 | 77 | if ( |
| 78 | - file_exists($file = CORE."/classes/$namespace/$class_name.php") || //Core classes |
|
| 78 | + file_exists($file = CORE."/classes/$namespace/$class_name.php") || //Core classes |
|
| 79 | 79 | file_exists($file = CORE."/thirdparty/$namespace/$class_name.php") || //Third party classes |
| 80 | - file_exists($file = CORE."/traits/$namespace/$class_name.php") || //Core traits |
|
| 81 | - file_exists($file = CORE."/drivers/$namespace/$class_name.php") || //Core drivers |
|
| 80 | + file_exists($file = CORE."/traits/$namespace/$class_name.php") || //Core traits |
|
| 81 | + file_exists($file = CORE."/drivers/$namespace/$class_name.php") || //Core drivers |
|
| 82 | 82 | file_exists($file = MODULES."/../$namespace/$class_name.php") //Classes in modules |
| 83 | 83 | ) { |
| 84 | 84 | $cache[$class] = realpath($file); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | )", |
| 68 | 68 | $prepared_arguments |
| 69 | 69 | ); |
| 70 | - $id = $insert_id !== false ? $insert_id : $this->db_prime()->id(); |
|
| 70 | + $id = $insert_id !== false ? $insert_id : $this->db_prime()->id(); |
|
| 71 | 71 | /** |
| 72 | 72 | * Id might be 0 if insertion failed or if we insert duplicate entry (which is fine since we use 'INSERT IGNORE' |
| 73 | 73 | */ |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | $language_field_condition", |
| 275 | 275 | $id |
| 276 | 276 | ) ?: []; |
| 277 | - $language_field = isset($model['language_field']) ? $model['language_field'] : null; |
|
| 277 | + $language_field = isset($model['language_field']) ? $model['language_field'] : null; |
|
| 278 | 278 | /** |
| 279 | 279 | * If no rows found for current language - find another language that should contain some rows |
| 280 | 280 | */ |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | return false; |
| 350 | 350 | } |
| 351 | 351 | list($prepared_arguments, $joined_tables) = $this->crud_arguments_preparation(array_slice($data_model, 1), $prepared_arguments, $id); |
| 352 | - $columns = implode( |
|
| 352 | + $columns = implode( |
|
| 353 | 353 | ',', |
| 354 | 354 | array_map( |
| 355 | 355 | function ($column) { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | $columns = '`'.implode('`,`', array_keys($columns)).'`'; |
| 195 | 195 | $first_column = array_keys($data_model)[0]; |
| 196 | 196 | $data = $this->db()->qf( |
| 197 | - "SELECT $columns |
|
| 197 | + "select $columns |
|
| 198 | 198 | FROM `$table` |
| 199 | 199 | WHERE `$first_column` = ? |
| 200 | 200 | LIMIT 1", |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | : ''; |
| 267 | 267 | $fields = '`'.implode('`,`', array_keys($model['data_model'])).'`'; |
| 268 | 268 | $rows = $this->db_prime()->qfa( |
| 269 | - "SELECT $fields |
|
| 269 | + "select $fields |
|
| 270 | 270 | FROM `{$this->table}_$table` |
| 271 | 271 | WHERE |
| 272 | 272 | `$id_field` = ? |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | /** |
| 351 | 351 | * Narrow the dependencies to current module only |
| 352 | 352 | */ |
| 353 | - $dependencies = array_unique( |
|
| 353 | + $dependencies = array_unique( |
|
| 354 | 354 | array_merge( |
| 355 | 355 | ['System'], |
| 356 | 356 | $dependencies['System'], |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | * @return string[][] |
| 418 | 418 | */ |
| 419 | 419 | protected function add_versions_hash ($assets) { |
| 420 | - $content = array_reduce( |
|
| 420 | + $content = array_reduce( |
|
| 421 | 421 | get_files_list(DIR.'/components', '/^meta\.json$/', 'f', true, true), |
| 422 | 422 | function ($content, $file) { |
| 423 | 423 | return $content.file_get_contents($file); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $module_data = Config::instance()->module('Photo_gallery'); |
| 39 | 39 | if (!$module_data->directory_created) { |
| 40 | 40 | $this->storage()->mkdir('Photo_gallery'); |
| 41 | - $module_data->directory_created = 1; |
|
| 41 | + $module_data->directory_created = 1; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | /** |
@@ -70,8 +70,8 @@ discard block |
||
| 70 | 70 | if (is_array($id)) { |
| 71 | 71 | return array_map([$this, 'get'], $id); |
| 72 | 72 | } |
| 73 | - $L = Language::instance(); |
|
| 74 | - $id = (int)$id; |
|
| 73 | + $L = Language::instance(); |
|
| 74 | + $id = (int)$id; |
|
| 75 | 75 | return $this->cache->get("images/$id/$L->clang", function () use ($id) { |
| 76 | 76 | $data = $this->db()->qf( |
| 77 | 77 | "SELECT |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | $id |
| 90 | 90 | ); |
| 91 | 91 | if ($data) { |
| 92 | - $data['title'] = $this->ml_process($data['title']); |
|
| 93 | - $data['description'] = $this->ml_process($data['description']); |
|
| 92 | + $data['title'] = $this->ml_process($data['title']); |
|
| 93 | + $data['description'] = $this->ml_process($data['description']); |
|
| 94 | 94 | } |
| 95 | 95 | return $data; |
| 96 | 96 | }); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if (!filter_var($original, FILTER_VALIDATE_URL)) { |
| 113 | 113 | return false; |
| 114 | 114 | } |
| 115 | - $gallery = (int)$gallery; |
|
| 115 | + $gallery = (int)$gallery; |
|
| 116 | 116 | if ($this->db_prime()->q( |
| 117 | 117 | "INSERT INTO `[prefix]photo_gallery_images` |
| 118 | 118 | ( |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | time(), |
| 134 | 134 | $original |
| 135 | 135 | )) { |
| 136 | - $id = $this->db_prime()->id(); |
|
| 136 | + $id = $this->db_prime()->id(); |
|
| 137 | 137 | if ($this->set($id, $title, $description)) { |
| 138 | 138 | Event::instance()->fire( |
| 139 | 139 | 'System/upload_files/add_tag', |
@@ -142,10 +142,10 @@ discard block |
||
| 142 | 142 | 'url' => $original |
| 143 | 143 | ] |
| 144 | 144 | ); |
| 145 | - $hash = md5(random_bytes(1000)); |
|
| 146 | - $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 145 | + $hash = md5(random_bytes(1000)); |
|
| 146 | + $tmp_file = TEMP.'/'.User::instance()->id."_$hash"; |
|
| 147 | 147 | try { |
| 148 | - $SimpleImage = new SimpleImage($original); |
|
| 148 | + $SimpleImage = new SimpleImage($original); |
|
| 149 | 149 | $SimpleImage->thumbnail(256)->save($tmp_file = "$tmp_file.".$SimpleImage->get_original_info()['format']); |
| 150 | 150 | unset($SimpleImage); |
| 151 | 151 | } catch (Exception $e) { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | trigger_error($e->getMessage(), E_USER_WARNING); |
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | - $storage = $this->storage(); |
|
| 156 | + $storage = $this->storage(); |
|
| 157 | 157 | if (!$storage->file_exists("Photo_gallery/$gallery")) { |
| 158 | 158 | $storage->mkdir("Photo_gallery/$gallery"); |
| 159 | 159 | } |
@@ -194,10 +194,10 @@ discard block |
||
| 194 | 194 | * @return bool |
| 195 | 195 | */ |
| 196 | 196 | public function set ($id, $title, $description) { |
| 197 | - $User = User::instance(); |
|
| 198 | - $id = (int)$id; |
|
| 199 | - $title = xap(trim($title)); |
|
| 200 | - $description = xap(trim($description)); |
|
| 197 | + $User = User::instance(); |
|
| 198 | + $id = (int)$id; |
|
| 199 | + $title = xap(trim($title)); |
|
| 200 | + $description = xap(trim($description)); |
|
| 201 | 201 | if ($this->db_prime()->q( |
| 202 | 202 | "UPDATE `[prefix]photo_gallery_images` |
| 203 | 203 | SET |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | * @return bool |
| 229 | 229 | */ |
| 230 | 230 | public function del ($id) { |
| 231 | - $id = (int)$id; |
|
| 232 | - $data = $this->get($id); |
|
| 231 | + $id = (int)$id; |
|
| 232 | + $data = $this->get($id); |
|
| 233 | 233 | if ($this->db_prime()->q( |
| 234 | 234 | "DELETE FROM `[prefix]photo_gallery_images` |
| 235 | 235 | WHERE `id` = $id" |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | if ($data['preview']) { |
| 246 | 246 | $this->storage()->unlink($this->storage()->source_by_url($data['preview'])); |
| 247 | 247 | } |
| 248 | - $Cache = $this->cache; |
|
| 248 | + $Cache = $this->cache; |
|
| 249 | 249 | unset( |
| 250 | 250 | $Cache->{"images/$id"}, |
| 251 | 251 | $Cache->{"galleries/$data[gallery]"} |
@@ -293,8 +293,8 @@ discard block |
||
| 293 | 293 | if (is_array($id)) { |
| 294 | 294 | return array_map([$this, 'get_gallery'], $id); |
| 295 | 295 | } |
| 296 | - $L = Language::instance(); |
|
| 297 | - $id = (int)$id; |
|
| 296 | + $L = Language::instance(); |
|
| 297 | + $id = (int)$id; |
|
| 298 | 298 | return $this->cache->get("galleries/$id/$L->clang", function () use ($id) { |
| 299 | 299 | if ($data = $this->db()->qf( |
| 300 | 300 | "SELECT |
@@ -314,17 +314,17 @@ discard block |
||
| 314 | 314 | LIMIT 1", |
| 315 | 315 | $id |
| 316 | 316 | )) { |
| 317 | - $data['title'] = $this->ml_process($data['title']); |
|
| 318 | - $data['path'] = $this->ml_process($data['path']); |
|
| 319 | - $data['description'] = $this->ml_process($data['description']); |
|
| 320 | - $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 321 | - $data['preview'] = $this->db()->qfs( |
|
| 317 | + $data['title'] = $this->ml_process($data['title']); |
|
| 318 | + $data['path'] = $this->ml_process($data['path']); |
|
| 319 | + $data['description'] = $this->ml_process($data['description']); |
|
| 320 | + $order = $data['preview_image'] == 'first' ? 'ASC' : 'DESC'; |
|
| 321 | + $data['preview'] = $this->db()->qfs( |
|
| 322 | 322 | "SELECT `preview` |
| 323 | 323 | FROM `[prefix]photo_gallery_images` |
| 324 | 324 | WHERE `gallery` = $data[id] |
| 325 | 325 | ORDER BY `id` $order" |
| 326 | 326 | ) ?: ''; |
| 327 | - $data['images'] = $this->db()->qfas( |
|
| 327 | + $data['images'] = $this->db()->qfas( |
|
| 328 | 328 | "SELECT `id` |
| 329 | 329 | FROM `[prefix]photo_gallery_images` |
| 330 | 330 | WHERE `gallery` = $data[id] |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | ('%s')", |
| 354 | 354 | (int)(bool)$active |
| 355 | 355 | )) { |
| 356 | - $id = $this->db_prime()->id(); |
|
| 356 | + $id = $this->db_prime()->id(); |
|
| 357 | 357 | $this->set_gallery($id, $title, $path, $description, $active, $preview_image); |
| 358 | 358 | return $id; |
| 359 | 359 | } |
@@ -372,10 +372,10 @@ discard block |
||
| 372 | 372 | * @return bool |
| 373 | 373 | */ |
| 374 | 374 | public function set_gallery ($id, $title, $path, $description, $active, $preview_image) { |
| 375 | - $path = path($path ?: $title); |
|
| 376 | - $title = xap(trim($title)); |
|
| 377 | - $description = xap(trim($description)); |
|
| 378 | - $id = (int)$id; |
|
| 375 | + $path = path($path ?: $title); |
|
| 376 | + $title = xap(trim($title)); |
|
| 377 | + $description = xap(trim($description)); |
|
| 378 | + $id = (int)$id; |
|
| 379 | 379 | if ($this->db_prime()->q( |
| 380 | 380 | "UPDATE `[prefix]photo_gallery_galleries` |
| 381 | 381 | SET |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $preview_image, |
| 393 | 393 | $id |
| 394 | 394 | )) { |
| 395 | - $Cache = $this->cache; |
|
| 395 | + $Cache = $this->cache; |
|
| 396 | 396 | unset( |
| 397 | 397 | $Cache->{"galleries/$id"}, |
| 398 | 398 | $Cache->{'galleries/list'} |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * @return bool |
| 411 | 411 | */ |
| 412 | 412 | public function del_gallery ($id) { |
| 413 | - $id = (int)$id; |
|
| 413 | + $id = (int)$id; |
|
| 414 | 414 | if (!$this->db_prime()->q( |
| 415 | 415 | "DELETE FROM `[prefix]photo_gallery_galleries` |
| 416 | 416 | WHERE `id` = '%s'", |
@@ -421,12 +421,12 @@ discard block |
||
| 421 | 421 | $this->ml_del('Photo_gallery/galleries/title', $id); |
| 422 | 422 | $this->ml_del('Photo_gallery/galleries/path', $id); |
| 423 | 423 | $this->ml_del('Photo_gallery/galleries/description', $id); |
| 424 | - $Cache = $this->cache; |
|
| 424 | + $Cache = $this->cache; |
|
| 425 | 425 | unset( |
| 426 | 426 | $Cache->{"galleries/$id"}, |
| 427 | 427 | $Cache->{'galleries/list'} |
| 428 | 428 | ); |
| 429 | - $images = $this->db()->qfas( |
|
| 429 | + $images = $this->db()->qfas( |
|
| 430 | 430 | "SELECT `id` |
| 431 | 431 | FROM `[prefix]photo_gallery_images` |
| 432 | 432 | WHERE `gallery` = '%s'", |
@@ -65,14 +65,14 @@ |
||
| 65 | 65 | $Page = Page::instance(); |
| 66 | 66 | $core_url = $Config->core_url(); |
| 67 | 67 | $base_url = $Config->base_url(); |
| 68 | - $Page->Head .= h::link( |
|
| 68 | + $Page->Head .= h::link( |
|
| 69 | 69 | [ |
| 70 | 70 | 'hreflang' => 'x-default', |
| 71 | 71 | 'href' => $Request->home_page ? $core_url : "$core_url/$relative_address", |
| 72 | 72 | 'rel' => 'alternate' |
| 73 | 73 | ] |
| 74 | 74 | ); |
| 75 | - $clangs = Cache::instance()->get( |
|
| 75 | + $clangs = Cache::instance()->get( |
|
| 76 | 76 | 'languages/clangs', |
| 77 | 77 | function () use ($Config) { |
| 78 | 78 | $clangs = []; |
@@ -194,7 +194,7 @@ |
||
| 194 | 194 | "$this->root/index.php", |
| 195 | 195 | "$this->root/package.json" |
| 196 | 196 | ]; |
| 197 | - $files = []; |
|
| 197 | + $files = []; |
|
| 198 | 198 | foreach ($files_to_include as $s) { |
| 199 | 199 | if (is_file($s)) { |
| 200 | 200 | $files[] = $s; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | Phar::webPhar(null, 'web.php'); |
| 166 | 166 | } |
| 167 | 167 | __HALT_COMPILER(); |
| 168 | -STUB |
|
| 168 | +stub |
|
| 169 | 169 | ); |
| 170 | 170 | $phar->stopBuffering(); |
| 171 | 171 | return "Done! CleverStyle Framework $version"; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | </Files> |
| 294 | 294 | |
| 295 | 295 | RewriteRule .* index.php |
| 296 | -HTACCESS; |
|
| 296 | +htaccess; |
|
| 297 | 297 | } |
| 298 | 298 | /** |
| 299 | 299 | * @param string $module |
@@ -54,7 +54,7 @@ |
||
| 54 | 54 | php build.php -M core -m Plupload,Static_pages |
| 55 | 55 | php build.php -M core -p TinyMCE -t DarkEnergy -s custom |
| 56 | 56 | php build.php -M module -m Plupload,Static_pages |
| 57 | -HELP; |
|
| 57 | +help; |
|
| 58 | 58 | } elseif ($mode == 'core') { |
| 59 | 59 | echo $Builder->core($modules, $themes, $suffix)."\n"; |
| 60 | 60 | } else { |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | Clean Composer's files: |
| 28 | 28 | <g>./cli clean:Composer</g> |
| 29 | 29 | |
| 30 | -HELP; |
|
| 30 | +help; |
|
| 31 | 31 | } |
| 32 | 32 | /** |
| 33 | 33 | * @param \cs\Request $Request |