Completed
Push — master ( 0a774e...31b9a0 )
by Nazar
04:52
created
core/functions.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
 	 * Try to load classes from different places. If not found in one place - try in another.
41 41
 	 */
42 42
 	if (
43
-		_require_once($file = DIR."/core/classes/$namespace/$class_name.php", false) ||    //Core classes
43
+		_require_once($file = DIR."/core/classes/$namespace/$class_name.php", false) || //Core classes
44 44
 		_require_once($file = DIR."/core/thirdparty/$namespace/$class_name.php", false) || //Third party classes
45
-		_require_once($file = DIR."/core/traits/$namespace/$class_name.php", false) ||     //Core traits
46
-		_require_once($file = ENGINES."/$namespace/$class_name.php", false) ||             //Core engines
45
+		_require_once($file = DIR."/core/traits/$namespace/$class_name.php", false) || //Core traits
46
+		_require_once($file = ENGINES."/$namespace/$class_name.php", false) || //Core engines
47 47
 		_require_once($file = MODULES."/../$namespace/$class_name.php", false)             //Classes in modules and plugins
48 48
 	) {
49 49
 		$cache[$class] = realpath($file);
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
  * Enabling of page interface
121 121
  */
122 122
 function interface_on () {
123
-	Page::instance()->interface	= true;
123
+	Page::instance()->interface = true;
124 124
 }
125 125
 /**
126 126
  * Disabling of page interface
127 127
  */
128 128
 function interface_off () {
129
-	Page::instance()->interface	= false;
129
+	Page::instance()->interface = false;
130 130
 }
131 131
 /**
132 132
  * Easy getting of translations
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
  * @return false|string
154 154
  */
155 155
 function url_by_source ($source) {
156
-	$Config	= Config::instance(true);
156
+	$Config = Config::instance(true);
157 157
 	if (!$Config) {
158 158
 		return false;
159 159
 	}
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
  * @return false|string
172 172
  */
173 173
 function source_by_url ($url) {
174
-	$Config	= Config::instance(true);
174
+	$Config = Config::instance(true);
175 175
 	if (!$Config) {
176 176
 		return false;
177 177
 	}
@@ -209,8 +209,8 @@  discard block
 block discarded – undo
209 209
 	if (!is_numeric($time)) {
210 210
 		return $time;
211 211
 	}
212
-	$L		= Language::instance();
213
-	$res	= [];
212
+	$L = Language::instance();
213
+	$res = [];
214 214
 	if ($time >= 31536000) {
215 215
 		$time_x = round($time / 31536000);
216 216
 		$time -= $time_x * 31536000;
@@ -221,12 +221,12 @@  discard block
 block discarded – undo
221 221
 		$time -= $time_x * 2592000;
222 222
 		$res[] = $L->time($time_x, 'M');
223 223
 	}
224
-	if($time >= 86400) {
224
+	if ($time >= 86400) {
225 225
 		$time_x = round($time / 86400);
226 226
 		$time -= $time_x * 86400;
227 227
 		$res[] = $L->time($time_x, 'd');
228 228
 	}
229
-	if($time >= 3600) {
229
+	if ($time >= 3600) {
230 230
 		$time_x = round($time / 3600);
231 231
 		$time -= $time_x * 3600;
232 232
 		$res[] = $L->time($time_x, 'h');
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		$timezones_ = $timezones = [];
288 288
 		foreach ($tzs as $tz) {
289 289
 			$offset		= (new DateTimeZone($tz))->getOffset(new DateTime);
290
-			$offset_	=	($offset < 0 ? '-' : '+').
290
+			$offset_	= ($offset < 0 ? '-' : '+').
291 291
 							str_pad(floor(abs($offset / 3600)), 2, 0, STR_PAD_LEFT).':'.
292 292
 							str_pad(abs(($offset % 3600) / 60), 2, 0, STR_PAD_LEFT);
293 293
 			$timezones_[(39600 + $offset).$tz] = [
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
  * @return false|string
320 320
  */
321 321
 function get_core_ml_text ($item) {
322
-	$Config	= Config::instance(true);
322
+	$Config = Config::instance(true);
323 323
 	if (!$Config) {
324 324
 		return false;
325 325
 	}
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
  *
366 366
  * @return null|string
367 367
  */
368
-function status_code_string ($code){
368
+function status_code_string ($code) {
369 369
 	switch ($code) {
370 370
 		case 201:
371 371
 			$string_code = '201 Created';
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 			]
477 477
 		);
478 478
 	};
479
-	$render_page_item  = function ($i) use ($page, $url, $head_links, $render_head_links) {
479
+	$render_page_item = function ($i) use ($page, $url, $head_links, $render_head_links) {
480 480
 		if ($head_links) {
481 481
 			$render_head_links($i);
482 482
 		}
@@ -569,14 +569,14 @@  discard block
 block discarded – undo
569 569
 	}
570 570
 	$output	= [];
571 571
 	if (!is_callable($url)) {
572
-		$original_url	= $url;
572
+		$original_url = $url;
573 573
 		$url			= function ($page) use ($original_url) {
574 574
 			return sprintf($original_url, $page);
575 575
 		};
576 576
 	}
577 577
 	if ($total <= 11) {
578 578
 		for ($i = 1; $i <= $total; ++$i) {
579
-			$output[]	= [
579
+			$output[] = [
580 580
 				$i,
581 581
 				[
582 582
 					'is'			=> 'cs-button',
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 	} else {
591 591
 		if ($page <= 6) {
592 592
 			for ($i = 1; $i <= 7; ++$i) {
593
-				$output[]	= [
593
+				$output[] = [
594 594
 					$i,
595 595
 					[
596 596
 						'is'			=> 'cs-button',
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 					]
602 602
 				];
603 603
 			}
604
-			$output[]	= [
604
+			$output[] = [
605 605
 				'...',
606 606
 				[
607 607
 					'is'			=> 'cs-button',
@@ -610,7 +610,7 @@  discard block
 block discarded – undo
610 610
 				]
611 611
 			];
612 612
 			for ($i = $total - 2; $i <= $total; ++$i) {
613
-				$output[]	= [
613
+				$output[] = [
614 614
 					$i,
615 615
 					[
616 616
 						'is'			=> 'cs-button',
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 			}
623 623
 		} elseif ($page >= $total - 5) {
624 624
 			for ($i = 1; $i <= 3; ++$i) {
625
-				$output[]	= [
625
+				$output[] = [
626 626
 					$i,
627 627
 					[
628 628
 						'is'			=> 'cs-button',
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
 					]
633 633
 				];
634 634
 			}
635
-			$output[]	= [
635
+			$output[] = [
636 636
 				'...',
637 637
 				[
638 638
 					'is'			=> 'cs-button',
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 				]
642 642
 			];
643 643
 			for ($i = $total - 6; $i <= $total; ++$i) {
644
-				$output[]	= [
644
+				$output[] = [
645 645
 					$i,
646 646
 					[
647 647
 						'is'			=> 'cs-button',
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 			}
655 655
 		} else {
656 656
 			for ($i = 1; $i <= 2; ++$i) {
657
-				$output[]	= [
657
+				$output[] = [
658 658
 					$i,
659 659
 					[
660 660
 						'is'			=> 'cs-button',
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 					]
665 665
 				];
666 666
 			}
667
-			$output[]	= [
667
+			$output[] = [
668 668
 				'...',
669 669
 				[
670 670
 					'is'			=> 'cs-button',
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 				]
674 674
 			];
675 675
 			for ($i = $page - 2; $i <= $page + 2; ++$i) {
676
-				$output[]	= [
676
+				$output[] = [
677 677
 					$i,
678 678
 					[
679 679
 						'is'			=> 'cs-button',
@@ -684,7 +684,7 @@  discard block
 block discarded – undo
684 684
 					]
685 685
 				];
686 686
 			}
687
-			$output[]	= [
687
+			$output[] = [
688 688
 				'...',
689 689
 				[
690 690
 					'is'			=> 'cs-button',
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 				]
694 694
 			];
695 695
 			for ($i = $total - 1; $i <= $total; ++$i) {
696
-				$output[]	= [
696
+				$output[] = [
697 697
 					$i,
698 698
 					[
699 699
 						'is'			=> 'cs-button',
Please login to merge, or discard this patch.