@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @subpackage Installer |
|
| 5 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | - * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi |
|
| 7 | - * @license MIT License, see license.txt |
|
| 8 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @subpackage Installer |
|
| 5 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 6 | + * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi |
|
| 7 | + * @license MIT License, see license.txt |
|
| 8 | + */ |
|
| 9 | 9 | function install_form () { |
| 10 | 10 | $timezones = get_timezones_list(); |
| 11 | 11 | return h::{'form[method=post]'}( |
@@ -1,14 +1,14 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | - * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi |
|
| 6 | - * @license MIT License, see license.txt |
|
| 7 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | + * @copyright Copyright (c) 2011-2016, Nazar Mokrynskyi |
|
| 6 | + * @license MIT License, see license.txt |
|
| 7 | + */ |
|
| 8 | 8 | /** |
| 9 | - * Base system functions, do not edit this file, or make it very carefully |
|
| 10 | - * otherwise system workability may be broken |
|
| 11 | - */ |
|
| 9 | + * Base system functions, do not edit this file, or make it very carefully |
|
| 10 | + * otherwise system workability may be broken |
|
| 11 | + */ |
|
| 12 | 12 | use |
| 13 | 13 | cs\Cache, |
| 14 | 14 | cs\Config, |
@@ -20,8 +20,8 @@ discard block |
||
| 20 | 20 | cs\Text, |
| 21 | 21 | cs\User; |
| 22 | 22 | /** |
| 23 | - * Auto Loading of classes |
|
| 24 | - */ |
|
| 23 | + * Auto Loading of classes |
|
| 24 | + */ |
|
| 25 | 25 | spl_autoload_register(function ($class) { |
| 26 | 26 | static $cache; |
| 27 | 27 | if (!isset($cache)) { |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | return false; |
| 57 | 57 | }, true, true); |
| 58 | 58 | /** |
| 59 | - * Clean cache of classes autoload and customization |
|
| 60 | - */ |
|
| 59 | + * Clean cache of classes autoload and customization |
|
| 60 | + */ |
|
| 61 | 61 | function clean_classes_cache () { |
| 62 | 62 | if (file_exists(CACHE.'/classes/autoload')) { |
| 63 | 63 | unlink(CACHE.'/classes/autoload'); |
@@ -113,38 +113,38 @@ discard block |
||
| 113 | 113 | User::instance(true)->__finish(); |
| 114 | 114 | } |
| 115 | 115 | /** |
| 116 | - * Enable of errors processing |
|
| 117 | - */ |
|
| 116 | + * Enable of errors processing |
|
| 117 | + */ |
|
| 118 | 118 | function errors_on () { |
| 119 | 119 | error_reporting(defined('DEBUG') && DEBUG ? E_ALL : E_ERROR | E_WARNING | E_PARSE); |
| 120 | 120 | } |
| 121 | 121 | /** |
| 122 | - * Disabling of errors processing |
|
| 123 | - */ |
|
| 122 | + * Disabling of errors processing |
|
| 123 | + */ |
|
| 124 | 124 | function errors_off () { |
| 125 | 125 | error_reporting(0); |
| 126 | 126 | } |
| 127 | 127 | /** |
| 128 | - * Enabling of page interface |
|
| 129 | - */ |
|
| 128 | + * Enabling of page interface |
|
| 129 | + */ |
|
| 130 | 130 | function interface_on () { |
| 131 | 131 | Page::instance()->interface = true; |
| 132 | 132 | } |
| 133 | 133 | /** |
| 134 | - * Disabling of page interface |
|
| 135 | - */ |
|
| 134 | + * Disabling of page interface |
|
| 135 | + */ |
|
| 136 | 136 | function interface_off () { |
| 137 | 137 | Page::instance()->interface = false; |
| 138 | 138 | } |
| 139 | 139 | /** |
| 140 | - * Easy getting of translations |
|
| 141 | - * |
|
| 142 | - * @param string $item |
|
| 143 | - * @param mixed $arguments There can be any necessary number of arguments here |
|
| 144 | - * @param mixed $_ |
|
| 145 | - * |
|
| 146 | - * @return string |
|
| 147 | - */ |
|
| 140 | + * Easy getting of translations |
|
| 141 | + * |
|
| 142 | + * @param string $item |
|
| 143 | + * @param mixed $arguments There can be any necessary number of arguments here |
|
| 144 | + * @param mixed $_ |
|
| 145 | + * |
|
| 146 | + * @return string |
|
| 147 | + */ |
|
| 148 | 148 | function __ ($item, $arguments = null, $_ = null) { |
| 149 | 149 | $L = Language::instance(); |
| 150 | 150 | if (func_num_args() > 1) { |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | /** |
| 157 | - * Get file url by it's destination in file system |
|
| 158 | - * |
|
| 159 | - * @param string $source |
|
| 160 | - * |
|
| 161 | - * @return false|string |
|
| 162 | - */ |
|
| 157 | + * Get file url by it's destination in file system |
|
| 158 | + * |
|
| 159 | + * @param string $source |
|
| 160 | + * |
|
| 161 | + * @return false|string |
|
| 162 | + */ |
|
| 163 | 163 | function url_by_source ($source) { |
| 164 | 164 | $Config = Config::instance(true); |
| 165 | 165 | if (!$Config) { |
@@ -172,12 +172,12 @@ discard block |
||
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | 174 | /** |
| 175 | - * Get file destination in file system by it's url |
|
| 176 | - * |
|
| 177 | - * @param string $url |
|
| 178 | - * |
|
| 179 | - * @return false|string |
|
| 180 | - */ |
|
| 175 | + * Get file destination in file system by it's url |
|
| 176 | + * |
|
| 177 | + * @param string $url |
|
| 178 | + * |
|
| 179 | + * @return false|string |
|
| 180 | + */ |
|
| 181 | 181 | function source_by_url ($url) { |
| 182 | 182 | $Config = Config::instance(true); |
| 183 | 183 | if (!$Config) { |
@@ -189,10 +189,10 @@ discard block |
||
| 189 | 189 | return false; |
| 190 | 190 | } |
| 191 | 191 | /** |
| 192 | - * Public cache cleaning |
|
| 193 | - * |
|
| 194 | - * @return bool |
|
| 195 | - */ |
|
| 192 | + * Public cache cleaning |
|
| 193 | + * |
|
| 194 | + * @return bool |
|
| 195 | + */ |
|
| 196 | 196 | function clean_pcache () { |
| 197 | 197 | $ok = true; |
| 198 | 198 | $list = get_files_list(PUBLIC_CACHE, false, 'fd', true, true, 'name|desc'); |
@@ -207,12 +207,12 @@ discard block |
||
| 207 | 207 | return $ok; |
| 208 | 208 | } |
| 209 | 209 | /** |
| 210 | - * Formatting of time in seconds to human-readable form |
|
| 211 | - * |
|
| 212 | - * @param int $time Time in seconds |
|
| 213 | - * |
|
| 214 | - * @return string |
|
| 215 | - */ |
|
| 210 | + * Formatting of time in seconds to human-readable form |
|
| 211 | + * |
|
| 212 | + * @param int $time Time in seconds |
|
| 213 | + * |
|
| 214 | + * @return string |
|
| 215 | + */ |
|
| 216 | 216 | function format_time ($time) { |
| 217 | 217 | if (!is_numeric($time)) { |
| 218 | 218 | return $time; |
@@ -250,13 +250,13 @@ discard block |
||
| 250 | 250 | return implode(' ', $res); |
| 251 | 251 | } |
| 252 | 252 | /** |
| 253 | - * Formatting of data size in bytes to human-readable form |
|
| 254 | - * |
|
| 255 | - * @param int $size |
|
| 256 | - * @param bool|int $round |
|
| 257 | - * |
|
| 258 | - * @return float|string |
|
| 259 | - */ |
|
| 253 | + * Formatting of data size in bytes to human-readable form |
|
| 254 | + * |
|
| 255 | + * @param int $size |
|
| 256 | + * @param bool|int $round |
|
| 257 | + * |
|
| 258 | + * @return float|string |
|
| 259 | + */ |
|
| 260 | 260 | function format_filesize ($size, $round = false) { |
| 261 | 261 | if (!is_numeric($size)) { |
| 262 | 262 | return $size; |
@@ -281,10 +281,10 @@ discard block |
||
| 281 | 281 | return $round ? round($size, $round).$unit : $size.$unit; |
| 282 | 282 | } |
| 283 | 283 | /** |
| 284 | - * Get list of timezones |
|
| 285 | - * |
|
| 286 | - * @return array |
|
| 287 | - */ |
|
| 284 | + * Get list of timezones |
|
| 285 | + * |
|
| 286 | + * @return array |
|
| 287 | + */ |
|
| 288 | 288 | function get_timezones_list () { |
| 289 | 289 | if ( |
| 290 | 290 | !class_exists('\\cs\\Cache', false) || |
@@ -320,12 +320,12 @@ discard block |
||
| 320 | 320 | return $timezones; |
| 321 | 321 | } |
| 322 | 322 | /** |
| 323 | - * Get multilingual value from $Config->core array |
|
| 324 | - * |
|
| 325 | - * @param string $item |
|
| 326 | - * |
|
| 327 | - * @return false|string |
|
| 328 | - */ |
|
| 323 | + * Get multilingual value from $Config->core array |
|
| 324 | + * |
|
| 325 | + * @param string $item |
|
| 326 | + * |
|
| 327 | + * @return false|string |
|
| 328 | + */ |
|
| 329 | 329 | function get_core_ml_text ($item) { |
| 330 | 330 | $Config = Config::instance(true); |
| 331 | 331 | if (!$Config) { |
@@ -41,10 +41,10 @@ discard block |
||
| 41 | 41 | * Try to load classes from different places. If not found in one place - try in another. |
| 42 | 42 | */ |
| 43 | 43 | if ( |
| 44 | - _require_once($file = DIR."/core/classes/$namespace/$class_name.php", false) || //Core classes |
|
| 44 | + _require_once($file = DIR."/core/classes/$namespace/$class_name.php", false) || //Core classes |
|
| 45 | 45 | _require_once($file = DIR."/core/thirdparty/$namespace/$class_name.php", false) || //Third party classes |
| 46 | - _require_once($file = DIR."/core/traits/$namespace/$class_name.php", false) || //Core traits |
|
| 47 | - _require_once($file = ENGINES."/$namespace/$class_name.php", false) || //Core engines |
|
| 46 | + _require_once($file = DIR."/core/traits/$namespace/$class_name.php", false) || //Core traits |
|
| 47 | + _require_once($file = ENGINES."/$namespace/$class_name.php", false) || //Core engines |
|
| 48 | 48 | _require_once($file = MODULES."/../$namespace/$class_name.php", false) //Classes in modules and plugins |
| 49 | 49 | ) { |
| 50 | 50 | $cache[$class] = realpath($file); |
@@ -128,13 +128,13 @@ discard block |
||
| 128 | 128 | * Enabling of page interface |
| 129 | 129 | */ |
| 130 | 130 | function interface_on () { |
| 131 | - Page::instance()->interface = true; |
|
| 131 | + Page::instance()->interface = true; |
|
| 132 | 132 | } |
| 133 | 133 | /** |
| 134 | 134 | * Disabling of page interface |
| 135 | 135 | */ |
| 136 | 136 | function interface_off () { |
| 137 | - Page::instance()->interface = false; |
|
| 137 | + Page::instance()->interface = false; |
|
| 138 | 138 | } |
| 139 | 139 | /** |
| 140 | 140 | * Easy getting of translations |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @return false|string |
| 162 | 162 | */ |
| 163 | 163 | function url_by_source ($source) { |
| 164 | - $Config = Config::instance(true); |
|
| 164 | + $Config = Config::instance(true); |
|
| 165 | 165 | if (!$Config) { |
| 166 | 166 | return false; |
| 167 | 167 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | * @return false|string |
| 180 | 180 | */ |
| 181 | 181 | function source_by_url ($url) { |
| 182 | - $Config = Config::instance(true); |
|
| 182 | + $Config = Config::instance(true); |
|
| 183 | 183 | if (!$Config) { |
| 184 | 184 | return false; |
| 185 | 185 | } |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | if (!is_numeric($time)) { |
| 218 | 218 | return $time; |
| 219 | 219 | } |
| 220 | - $L = Language::instance(); |
|
| 221 | - $res = []; |
|
| 220 | + $L = Language::instance(); |
|
| 221 | + $res = []; |
|
| 222 | 222 | if ($time >= 31536000) { |
| 223 | 223 | $time_x = round($time / 31536000); |
| 224 | 224 | $time -= $time_x * 31536000; |
@@ -229,12 +229,12 @@ discard block |
||
| 229 | 229 | $time -= $time_x * 2592000; |
| 230 | 230 | $res[] = $L->time($time_x, 'M'); |
| 231 | 231 | } |
| 232 | - if($time >= 86400) { |
|
| 232 | + if ($time >= 86400) { |
|
| 233 | 233 | $time_x = round($time / 86400); |
| 234 | 234 | $time -= $time_x * 86400; |
| 235 | 235 | $res[] = $L->time($time_x, 'd'); |
| 236 | 236 | } |
| 237 | - if($time >= 3600) { |
|
| 237 | + if ($time >= 3600) { |
|
| 238 | 238 | $time_x = round($time / 3600); |
| 239 | 239 | $time -= $time_x * 3600; |
| 240 | 240 | $res[] = $L->time($time_x, 'h'); |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $timezones_ = $timezones = []; |
| 296 | 296 | foreach ($tzs as $tz) { |
| 297 | 297 | $offset = (new DateTimeZone($tz))->getOffset(new DateTime); |
| 298 | - $offset_ = ($offset < 0 ? '-' : '+'). |
|
| 298 | + $offset_ = ($offset < 0 ? '-' : '+'). |
|
| 299 | 299 | str_pad(floor(abs($offset / 3600)), 2, 0, STR_PAD_LEFT).':'. |
| 300 | 300 | str_pad(abs(($offset % 3600) / 60), 2, 0, STR_PAD_LEFT); |
| 301 | 301 | $timezones_[(39600 + $offset).$tz] = [ |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * @return false|string |
| 328 | 328 | */ |
| 329 | 329 | function get_core_ml_text ($item) { |
| 330 | - $Config = Config::instance(true); |
|
| 330 | + $Config = Config::instance(true); |
|
| 331 | 331 | if (!$Config) { |
| 332 | 332 | return false; |
| 333 | 333 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | ] |
| 484 | 484 | ); |
| 485 | 485 | }; |
| 486 | - $render_page_item = function ($i) use ($page, $url, $head_links, $render_head_links) { |
|
| 486 | + $render_page_item = function ($i) use ($page, $url, $head_links, $render_head_links) { |
|
| 487 | 487 | if ($head_links) { |
| 488 | 488 | $render_head_links($i); |
| 489 | 489 | } |
@@ -576,14 +576,14 @@ discard block |
||
| 576 | 576 | } |
| 577 | 577 | $output = []; |
| 578 | 578 | if (!is_callable($url)) { |
| 579 | - $original_url = $url; |
|
| 579 | + $original_url = $url; |
|
| 580 | 580 | $url = function ($page) use ($original_url) { |
| 581 | 581 | return sprintf($original_url, $page); |
| 582 | 582 | }; |
| 583 | 583 | } |
| 584 | 584 | if ($total <= 11) { |
| 585 | 585 | for ($i = 1; $i <= $total; ++$i) { |
| 586 | - $output[] = [ |
|
| 586 | + $output[] = [ |
|
| 587 | 587 | $i, |
| 588 | 588 | [ |
| 589 | 589 | 'is' => 'cs-button', |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } else { |
| 598 | 598 | if ($page <= 6) { |
| 599 | 599 | for ($i = 1; $i <= 7; ++$i) { |
| 600 | - $output[] = [ |
|
| 600 | + $output[] = [ |
|
| 601 | 601 | $i, |
| 602 | 602 | [ |
| 603 | 603 | 'is' => 'cs-button', |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | ] |
| 609 | 609 | ]; |
| 610 | 610 | } |
| 611 | - $output[] = [ |
|
| 611 | + $output[] = [ |
|
| 612 | 612 | '...', |
| 613 | 613 | [ |
| 614 | 614 | 'is' => 'cs-button', |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | ] |
| 618 | 618 | ]; |
| 619 | 619 | for ($i = $total - 2; $i <= $total; ++$i) { |
| 620 | - $output[] = [ |
|
| 620 | + $output[] = [ |
|
| 621 | 621 | $i, |
| 622 | 622 | [ |
| 623 | 623 | 'is' => 'cs-button', |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | } elseif ($page >= $total - 5) { |
| 631 | 631 | for ($i = 1; $i <= 3; ++$i) { |
| 632 | - $output[] = [ |
|
| 632 | + $output[] = [ |
|
| 633 | 633 | $i, |
| 634 | 634 | [ |
| 635 | 635 | 'is' => 'cs-button', |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | ] |
| 640 | 640 | ]; |
| 641 | 641 | } |
| 642 | - $output[] = [ |
|
| 642 | + $output[] = [ |
|
| 643 | 643 | '...', |
| 644 | 644 | [ |
| 645 | 645 | 'is' => 'cs-button', |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | ] |
| 649 | 649 | ]; |
| 650 | 650 | for ($i = $total - 6; $i <= $total; ++$i) { |
| 651 | - $output[] = [ |
|
| 651 | + $output[] = [ |
|
| 652 | 652 | $i, |
| 653 | 653 | [ |
| 654 | 654 | 'is' => 'cs-button', |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | } |
| 662 | 662 | } else { |
| 663 | 663 | for ($i = 1; $i <= 2; ++$i) { |
| 664 | - $output[] = [ |
|
| 664 | + $output[] = [ |
|
| 665 | 665 | $i, |
| 666 | 666 | [ |
| 667 | 667 | 'is' => 'cs-button', |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | ] |
| 672 | 672 | ]; |
| 673 | 673 | } |
| 674 | - $output[] = [ |
|
| 674 | + $output[] = [ |
|
| 675 | 675 | '...', |
| 676 | 676 | [ |
| 677 | 677 | 'is' => 'cs-button', |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | ] |
| 681 | 681 | ]; |
| 682 | 682 | for ($i = $page - 2; $i <= $page + 2; ++$i) { |
| 683 | - $output[] = [ |
|
| 683 | + $output[] = [ |
|
| 684 | 684 | $i, |
| 685 | 685 | [ |
| 686 | 686 | 'is' => 'cs-button', |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | ] |
| 692 | 692 | ]; |
| 693 | 693 | } |
| 694 | - $output[] = [ |
|
| 694 | + $output[] = [ |
|
| 695 | 695 | '...', |
| 696 | 696 | [ |
| 697 | 697 | 'is' => 'cs-button', |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | ] |
| 701 | 701 | ]; |
| 702 | 702 | for ($i = $total - 1; $i <= $total; ++$i) { |
| 703 | - $output[] = [ |
|
| 703 | + $output[] = [ |
|
| 704 | 704 | $i, |
| 705 | 705 | [ |
| 706 | 706 | 'is' => 'cs-button', |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | * If match was not found - mirror is not allowed! |
| 83 | 83 | */ |
| 84 | 84 | if ($this->mirror_index === -1) { |
| 85 | - throw new ExitException("Mirror $Request->host not allowed", 400); |
|
| 85 | + throw new ExitException("mirror $Request->host not allowed", 400); |
|
| 86 | 86 | } |
| 87 | 87 | /** |
| 88 | 88 | * Remove trailing slashes |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * @package CleverStyle CMS |
|
| 4 | - * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | - * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 6 | - * @license MIT License, see license.txt |
|
| 7 | - */ |
|
| 3 | + * @package CleverStyle CMS |
|
| 4 | + * @author Nazar Mokrynskyi <[email protected]> |
|
| 5 | + * @copyright Copyright (c) 2015-2016, Nazar Mokrynskyi |
|
| 6 | + * @license MIT License, see license.txt |
|
| 7 | + */ |
|
| 8 | 8 | /** |
| 9 | - * Base system functions, do not edit this file, or make it very carefully |
|
| 10 | - * otherwise system workability may be broken |
|
| 11 | - * |
|
| 12 | - * This particular file contains functions that work with global state (cookies, headers, status codes, etc.) |
|
| 13 | - */ |
|
| 9 | + * Base system functions, do not edit this file, or make it very carefully |
|
| 10 | + * otherwise system workability may be broken |
|
| 11 | + * |
|
| 12 | + * This particular file contains functions that work with global state (cookies, headers, status codes, etc.) |
|
| 13 | + */ |
|
| 14 | 14 | use |
| 15 | 15 | cs\Config, |
| 16 | 16 | cs\Request, |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'aliases' => &$aliases, |
| 62 | 62 | 'final_class' => &$next_alias |
| 63 | 63 | ]; |
| 64 | - $classes = defined('CUSTOM') ? glob(CUSTOM.'/classes/'.substr($class, 2).'_*.php') : []; |
|
| 64 | + $classes = defined('CUSTOM') ? glob(CUSTOM.'/classes/'.substr($class, 2).'_*.php') : []; |
|
| 65 | 65 | foreach ($classes as $custom_class) { |
| 66 | 66 | // Path to file with customized class |
| 67 | 67 | $custom_class = str_replace(CUSTOM.'/classes/', '', substr($custom_class, 0, -4)); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | 'alias' => "cs\\custom\\$_custom_class", |
| 75 | 75 | 'path' => $custom_class |
| 76 | 76 | ]; |
| 77 | - $next_alias = "cs\\custom\\$custom_class"; |
|
| 77 | + $next_alias = "cs\\custom\\$custom_class"; |
|
| 78 | 78 | } |
| 79 | 79 | modified_classes($modified_classes); |
| 80 | 80 | } |