@@ -327,7 +327,7 @@ |
||
| 327 | 327 | /** |
| 328 | 328 | * If content is link to CSS file |
| 329 | 329 | */ |
| 330 | - $css = static::css( |
|
| 330 | + $css = static::css( |
|
| 331 | 331 | file_get_contents("$dir/$url"), |
| 332 | 332 | "$dir/$url", |
| 333 | 333 | $not_embedded_resources |
@@ -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'", |