@@ -9,8 +9,8 @@ |
||
| 9 | 9 | use |
| 10 | 10 | cs\Language; |
| 11 | 11 | /** |
| 12 | - * Class for simplified work with translations, when using common prefix |
|
| 13 | - */ |
|
| 12 | + * Class for simplified work with translations, when using common prefix |
|
| 13 | + */ |
|
| 14 | 14 | class Prefix { |
| 15 | 15 | /** |
| 16 | 16 | * @var string |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | /** |
| 372 | 372 | * Narrow the dependencies to current module only |
| 373 | 373 | */ |
| 374 | - $dependencies = array_merge( |
|
| 374 | + $dependencies = array_merge( |
|
| 375 | 375 | isset($dependencies[$current_module]) ? $dependencies[$current_module] : [], |
| 376 | 376 | $dependencies['System'] |
| 377 | 377 | ); |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | * @return string[][] |
| 426 | 426 | */ |
| 427 | 427 | protected function add_versions_hash ($includes) { |
| 428 | - $content = array_reduce( |
|
| 428 | + $content = array_reduce( |
|
| 429 | 429 | get_files_list(DIR.'/components', '/^meta\.json$/', 'f', true, true), |
| 430 | 430 | function ($content, $file) { |
| 431 | 431 | return $content.file_get_contents($file); |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | ). |
| 456 | 456 | h::style($this->core_css['plain'].$this->css['plain'] ?: false); |
| 457 | 457 | /** @noinspection NestedTernaryOperatorInspection */ |
| 458 | - $scripts = |
|
| 458 | + $scripts = |
|
| 459 | 459 | array_reduce( |
| 460 | 460 | array_merge($this->core_js['path'], $this->js['path']), |
| 461 | 461 | function ($content, $src) { |
@@ -9,9 +9,9 @@ |
||
| 9 | 9 | * Time of start of execution, is used as current time |
| 10 | 10 | */ |
| 11 | 11 | define('MICROTIME', microtime(true)); //In seconds (float) |
| 12 | -define('TIME', floor(MICROTIME)); //In seconds (integer) |
|
| 12 | +define('TIME', floor(MICROTIME)); //In seconds (integer) |
|
| 13 | 13 | chdir(__DIR__.'/..'); |
| 14 | -define('DIR', getcwd()); //Root directory |
|
| 14 | +define('DIR', getcwd()); //Root directory |
|
| 15 | 15 | /** |
| 16 | 16 | * Defining of basic constants with paths to system directories |
| 17 | 17 | */ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | Header set Content-Type application/octet-stream |
| 72 | 72 | </ifModule> |
| 73 | 73 | |
| 74 | -HTACCESS |
|
| 74 | +htaccess |
|
| 75 | 75 | ); |
| 76 | 76 | } |
| 77 | 77 | if (!is_dir(CACHE)) { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | AddEncoding gzip .css |
| 100 | 100 | AddEncoding gzip .html |
| 101 | 101 | |
| 102 | -HTACCESS |
|
| 102 | +htaccess |
|
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | if (!is_dir(LOGS)) { |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | <<<HTACCESS |
| 116 | 116 | Allow From All |
| 117 | 117 | |
| 118 | -HTACCESS |
|
| 118 | +htaccess |
|
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | /** |
@@ -319,7 +319,7 @@ |
||
| 319 | 319 | 1. <g>--TEST--</g> is not required and not even used (files names are used instead) |
| 320 | 320 | 2. Only sub-set of sections supported and only sub-set of <g>--EXPECTF--</g> tags |
| 321 | 321 | 3. <g>--EXPECT*--</g> sections are interpreted as code and its output is used as expected result |
| 322 | -HTML |
|
| 322 | +html |
|
| 323 | 323 | ); |
| 324 | 324 | exit; |
| 325 | 325 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $expect = rtrim(execute_code($working_dir, $parsed_test['EXPECT'], $php_arguments, $script_arguments)); |
| 112 | 112 | if ($expect === $output) { |
| 113 | 113 | line("<g>$base_text SUCCESS</g>", true); |
| 114 | - isset($parsed_test['CLEAN']) && execute_code($working_dir, $parsed_test['CLEAN'], $php_arguments, $script_arguments);; |
|
| 114 | + isset($parsed_test['CLEAN']) && execute_code($working_dir, $parsed_test['CLEAN'], $php_arguments, $script_arguments); ; |
|
| 115 | 115 | return 'success'; |
| 116 | 116 | } |
| 117 | 117 | $expect = $parsed_test['EXPECT']; |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | ); |
| 147 | 147 | if (preg_match("/^$regex\$/s", $output)) { |
| 148 | 148 | line("<g>$base_text SUCCESS</g>", true); |
| 149 | - isset($parsed_test['CLEAN']) && execute_code($working_dir, $parsed_test['CLEAN'], $php_arguments, $script_arguments);; |
|
| 149 | + isset($parsed_test['CLEAN']) && execute_code($working_dir, $parsed_test['CLEAN'], $php_arguments, $script_arguments); ; |
|
| 150 | 150 | return 'success'; |
| 151 | 151 | } |
| 152 | 152 | $expect = $parsed_test['EXPECTF']; |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $regex = preg_quote($expect, '/'); |
| 156 | 156 | if (preg_match("/^$regex\$/s", $output)) { |
| 157 | 157 | line("<g>$base_text SUCCESS</g>", true); |
| 158 | - isset($parsed_test['CLEAN']) && execute_code($working_dir, $parsed_test['CLEAN'], $php_arguments, $script_arguments);; |
|
| 158 | + isset($parsed_test['CLEAN']) && execute_code($working_dir, $parsed_test['CLEAN'], $php_arguments, $script_arguments); ; |
|
| 159 | 159 | return 'success'; |
| 160 | 160 | } |
| 161 | 161 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | ); |
| 274 | 274 | $base_target_file_name = basename($base_target_file_path); |
| 275 | 275 | // Replace first script with combined file |
| 276 | - $data = str_replace( |
|
| 276 | + $data = str_replace( |
|
| 277 | 277 | $scripts_to_replace[0], |
| 278 | 278 | "<script src=\"$base_target_file_name.js?$content_md5\"></script>", |
| 279 | 279 | $data |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | ); |
| 378 | 378 | $base_target_file_name = basename($base_target_file_path); |
| 379 | 379 | // Replace first link or style with combined file |
| 380 | - $data = str_replace( |
|
| 380 | + $data = str_replace( |
|
| 381 | 381 | $links_and_styles_to_replace[0], |
| 382 | 382 | "<link rel=\"import\" type=\"css\" href=\"$base_target_file_name.css?$content_md5\">", |
| 383 | 383 | $data |
@@ -101,7 +101,7 @@ |
||
| 101 | 101 | 'alias' => "cs\\custom\\$_custom_class", |
| 102 | 102 | 'path' => $custom_class |
| 103 | 103 | ]; |
| 104 | - $next_alias = "cs\\custom\\$custom_class"; |
|
| 104 | + $next_alias = "cs\\custom\\$custom_class"; |
|
| 105 | 105 | } |
| 106 | 106 | $modified_classes[$class] = [ |
| 107 | 107 | 'aliases' => $aliases, |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if ($User->guest()) { |
| 23 | 23 | throw new ExitException(403); |
| 24 | 24 | } |
| 25 | - $fields = [ |
|
| 25 | + $fields = [ |
|
| 26 | 26 | 'id', |
| 27 | 27 | 'login', |
| 28 | 28 | 'username', |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * @var int Avatar size in px, can be redefined |
| 35 | 35 | */ |
| 36 | - public $avatar_size = 36; |
|
| 36 | + public $avatar_size = 36; |
|
| 37 | 37 | |
| 38 | 38 | protected function construct () { |
| 39 | - $this->cache = new Cache_prefix('Comments'); |
|
| 39 | + $this->cache = new Cache_prefix('Comments'); |
|
| 40 | 40 | } |
| 41 | 41 | /** |
| 42 | 42 | * Returns database index |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @return array|false Array of comment data on success or <b>false</b> on failure |
| 55 | 55 | */ |
| 56 | 56 | function get ($id) { |
| 57 | - $id = (int)$id; |
|
| 57 | + $id = (int)$id; |
|
| 58 | 58 | return $this->db()->qf( |
| 59 | 59 | "SELECT |
| 60 | 60 | `id`, |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | * @return false|int |
| 84 | 84 | */ |
| 85 | 85 | function add ($item, $module, $text, $parent = 0) { |
| 86 | - $L = Language::instance(); |
|
| 86 | + $L = Language::instance(); |
|
| 87 | 87 | $User = User::instance(); |
| 88 | 88 | $text = xap($text, true); |
| 89 | 89 | if (!$text) { |
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | - $item = (int)$item; |
|
| 93 | - $parent = (int)$parent; |
|
| 92 | + $item = (int)$item; |
|
| 93 | + $parent = (int)$parent; |
|
| 94 | 94 | if ( |
| 95 | 95 | $parent != 0 && |
| 96 | 96 | $this->db_prime()->qfs( |
@@ -149,12 +149,12 @@ discard block |
||
| 149 | 149 | * @return bool |
| 150 | 150 | */ |
| 151 | 151 | function set ($id, $text) { |
| 152 | - $text = xap($text, true); |
|
| 152 | + $text = xap($text, true); |
|
| 153 | 153 | if (!$text) { |
| 154 | 154 | return false; |
| 155 | 155 | } |
| 156 | - $id = (int)$id; |
|
| 157 | - $comment = $this->get($id); |
|
| 156 | + $id = (int)$id; |
|
| 157 | + $comment = $this->get($id); |
|
| 158 | 158 | if (!$comment) { |
| 159 | 159 | return false; |
| 160 | 160 | } |
@@ -180,8 +180,8 @@ discard block |
||
| 180 | 180 | * @return bool |
| 181 | 181 | */ |
| 182 | 182 | function del ($id) { |
| 183 | - $id = (int)$id; |
|
| 184 | - $comment = $this->db_prime()->qf( |
|
| 183 | + $id = (int)$id; |
|
| 184 | + $comment = $this->db_prime()->qf( |
|
| 185 | 185 | "SELECT `p`.*, COUNT(`c`.`id`) AS `count` |
| 186 | 186 | FROM `[prefix]comments` AS `p` |
| 187 | 187 | LEFT JOIN `[prefix]comments` AS `c` |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @return bool |
| 216 | 216 | */ |
| 217 | 217 | function del_all ($item, $module) { |
| 218 | - $item = (int)$item; |
|
| 218 | + $item = (int)$item; |
|
| 219 | 219 | if ($this->db_prime()->q( |
| 220 | 220 | "DELETE FROM `[prefix]comments` |
| 221 | 221 | WHERE |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | if (!is_array($data)) { |
| 249 | 249 | return 0; |
| 250 | 250 | } |
| 251 | - $count = 0; |
|
| 251 | + $count = 0; |
|
| 252 | 252 | foreach ($data as &$d) { |
| 253 | - $count += $this->count_internal($d['comments']) + 1; |
|
| 253 | + $count += $this->count_internal($d['comments']) + 1; |
|
| 254 | 254 | } |
| 255 | 255 | return $count; |
| 256 | 256 | } |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | * @return false|array |
| 276 | 276 | */ |
| 277 | 277 | function tree_data ($item, $module, $parent = 0) { |
| 278 | - $Cache = $this->cache; |
|
| 279 | - $L = Language::instance(); |
|
| 278 | + $Cache = $this->cache; |
|
| 279 | + $L = Language::instance(); |
|
| 280 | 280 | if (($comments = $Cache->{"$module/$item/$L->clang"}) === false) { |
| 281 | - $item = (int)$item; |
|
| 282 | - $parent = (int)$parent; |
|
| 283 | - $comments = $this->db()->qfa( |
|
| 281 | + $item = (int)$item; |
|
| 282 | + $parent = (int)$parent; |
|
| 283 | + $comments = $this->db()->qfa( |
|
| 284 | 284 | "SELECT |
| 285 | 285 | `id`, |
| 286 | 286 | `parent`, |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | * Cache only root tree data |
| 308 | 308 | */ |
| 309 | 309 | if ($parent == 0) { |
| 310 | - $Cache->{"$module/$item/$L->clang"} = $comments; |
|
| 310 | + $Cache->{"$module/$item/$L->clang"} = $comments; |
|
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | return $comments; |
@@ -320,15 +320,15 @@ discard block |
||
| 320 | 320 | * @return string |
| 321 | 321 | */ |
| 322 | 322 | function tree_html ($comments) { |
| 323 | - $L = Language::instance(); |
|
| 324 | - $User = User::instance(); |
|
| 323 | + $L = Language::instance(); |
|
| 324 | + $User = User::instance(); |
|
| 325 | 325 | if (!is_array($comments) || !$comments) { |
| 326 | 326 | return ''; |
| 327 | 327 | } |
| 328 | - $content = ''; |
|
| 328 | + $content = ''; |
|
| 329 | 329 | foreach ($comments as $comment) { |
| 330 | - $uniqid = uniqid('comment_', true); |
|
| 331 | - $content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}( |
|
| 330 | + $uniqid = uniqid('comment_', true); |
|
| 331 | + $content .= str_replace($uniqid, $comment['text'], h::{'article.cs-comments-comment'}( |
|
| 332 | 332 | h::{'img.cs-comments-comment-avatar'}([ |
| 333 | 333 | 'src' => $User->avatar($this->avatar_size, $comment['user']), |
| 334 | 334 | 'alt' => $User->username($comment['user']), |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | * @return string |
| 386 | 386 | */ |
| 387 | 387 | function block ($item, $module) { |
| 388 | - $L = new Language_prefix('comments_'); |
|
| 388 | + $L = new Language_prefix('comments_'); |
|
| 389 | 389 | return h::{'section#comments.cs-comments-comments'}( |
| 390 | 390 | $L->comments.':'. |
| 391 | 391 | ( |
@@ -240,7 +240,7 @@ |
||
| 240 | 240 | function count ($item, $module) { |
| 241 | 241 | $item = (int)$item; |
| 242 | 242 | $L = Language::instance(); |
| 243 | - return $this->cache->get("$module/$item/count/$L->clang", function () use ($item, $module) { |
|
| 243 | + return $this->cache->get("$module/$item/count/$L->clang", function () use ($item, $module) { |
|
| 244 | 244 | return $this->count_internal($this->tree_data($item, $module)) ?: 0; |
| 245 | 245 | }); |
| 246 | 246 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | throw new ExitException($L->comment_deleting_server_error, 500); |
| 60 | 60 | } |
| 61 | 61 | if ($Comments->del($Request->route[0])) { |
| 62 | - $Page->json('');//TODO: get rid of this |
|
| 62 | + $Page->json(''); //TODO: get rid of this |
|
| 63 | 63 | } else { |
| 64 | 64 | throw new ExitException($L->comment_deleting_server_error, 500); |
| 65 | 65 | } |