@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | public function __construct() { |
14 | 14 | |
15 | - $urlset = '<?xml version="1.0" encoding="UTF-8" ?>' . |
|
15 | + $urlset = '<?xml version="1.0" encoding="UTF-8" ?>'. |
|
16 | 16 | |
17 | 17 | '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'; |
18 | 18 |
@@ -16,14 +16,18 @@ discard block |
||
16 | 16 | |
17 | 17 | '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />'; |
18 | 18 | |
19 | - if (false !== ($xml = XML::parse($urlset))) $this->xml = $xml; |
|
19 | + if (false !== ($xml = XML::parse($urlset))) { |
|
20 | + $this->xml = $xml; |
|
21 | + } |
|
20 | 22 | } |
21 | 23 | |
22 | 24 | # Load sitemap |
23 | 25 | |
24 | 26 | public function load(string $file_name) { |
25 | 27 | |
26 | - if (false === ($xml = XML::load($file_name))) return false; |
|
28 | + if (false === ($xml = XML::load($file_name))) { |
|
29 | + return false; |
|
30 | + } |
|
27 | 31 | |
28 | 32 | $this->xml = $xml; $this->loaded = true; |
29 | 33 | |
@@ -36,9 +40,13 @@ discard block |
||
36 | 40 | |
37 | 41 | public function save(string $file_name) { |
38 | 42 | |
39 | - if ((null === $this->xml) || $this->loaded) return false; |
|
43 | + if ((null === $this->xml) || $this->loaded) { |
|
44 | + return false; |
|
45 | + } |
|
40 | 46 | |
41 | - if (false === XML::save($file_name, $this->xml)) return false; |
|
47 | + if (false === XML::save($file_name, $this->xml)) { |
|
48 | + return false; |
|
49 | + } |
|
42 | 50 | |
43 | 51 | # ------------------------ |
44 | 52 | |
@@ -49,9 +57,13 @@ discard block |
||
49 | 57 | |
50 | 58 | public function add(string $loc, string $lastmod = null, string $changefreq = null, float $priority = null) { |
51 | 59 | |
52 | - if ((null === $this->xml) || $this->loaded) return false; |
|
60 | + if ((null === $this->xml) || $this->loaded) { |
|
61 | + return false; |
|
62 | + } |
|
53 | 63 | |
54 | - if (false === ($loc = Validate::url($loc))) return false; |
|
64 | + if (false === ($loc = Validate::url($loc))) { |
|
65 | + return false; |
|
66 | + } |
|
55 | 67 | |
56 | 68 | # Create url object |
57 | 69 | |
@@ -73,7 +85,9 @@ discard block |
||
73 | 85 | |
74 | 86 | # Set priority |
75 | 87 | |
76 | - if (null !== $priority) $url->addChild('priority', Number::forceFloat($priority, 0, 1, 1)); |
|
88 | + if (null !== $priority) { |
|
89 | + $url->addChild('priority', Number::forceFloat($priority, 0, 1, 1)); |
|
90 | + } |
|
77 | 91 | |
78 | 92 | # ------------------------ |
79 | 93 |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | |
35 | 35 | public function addParam(string $name, $default, callable $validator = null) : Dataset { |
36 | 36 | |
37 | - if ('' === $name) return $this; |
|
37 | + if ('' === $name) { |
|
38 | + return $this; |
|
39 | + } |
|
38 | 40 | |
39 | 41 | $this->data[$name] = $default; $this->defaults[$name] = $default; |
40 | 42 | |
@@ -53,7 +55,9 @@ discard block |
||
53 | 55 | |
54 | 56 | public function addParams(array $data) : Dataset { |
55 | 57 | |
56 | - foreach ($data as $name => $value) if (is_scalar($name)) $this->addParam($name, $value); |
|
58 | + foreach ($data as $name => $value) { |
|
59 | + if (is_scalar($name)) $this->addParam($name, $value); |
|
60 | + } |
|
57 | 61 | |
58 | 62 | return $this; |
59 | 63 | } |
@@ -66,16 +70,16 @@ discard block |
||
66 | 70 | |
67 | 71 | public function set(string $name, $value) { |
68 | 72 | |
69 | - if (!isset($this->validators[$name])) return null; |
|
73 | + if (!isset($this->validators[$name])) { |
|
74 | + return null; |
|
75 | + } |
|
70 | 76 | |
71 | 77 | try { |
72 | 78 | |
73 | - if (null === ($value = $this->validators[$name]($value))) return false; |
|
74 | - |
|
75 | - else { $this->data[$name] = $value; return true; } |
|
76 | - } |
|
77 | - |
|
78 | - catch (TypeError $e) { return false; } |
|
79 | + if (null === ($value = $this->validators[$name]($value))) { |
|
80 | + return false; |
|
81 | + } else { $this->data[$name] = $value; return true; } |
|
82 | + } catch (TypeError $e) { return false; } |
|
79 | 83 | } |
80 | 84 | |
81 | 85 | /** |
@@ -90,7 +94,9 @@ discard block |
||
90 | 94 | |
91 | 95 | foreach ($data as $name => $value) { |
92 | 96 | |
93 | - if (null !== ($value = $this->set($name, $value))) $setted[$name] = $value; |
|
97 | + if (null !== ($value = $this->set($name, $value))) { |
|
98 | + $setted[$name] = $value; |
|
99 | + } |
|
94 | 100 | } |
95 | 101 | |
96 | 102 | # ------------------------ |
@@ -106,16 +112,18 @@ discard block |
||
106 | 112 | |
107 | 113 | public function cast(string $name, $value) { |
108 | 114 | |
109 | - if (!isset($this->validators[$name])) return null; |
|
115 | + if (!isset($this->validators[$name])) { |
|
116 | + return null; |
|
117 | + } |
|
110 | 118 | |
111 | 119 | try { |
112 | 120 | |
113 | - if (null !== ($value = $this->validators[$name]($value))) return $value; |
|
114 | - |
|
115 | - else return $this->data[$name]; |
|
116 | - } |
|
117 | - |
|
118 | - catch (TypeError $e) { return $this->data[$name]; } |
|
121 | + if (null !== ($value = $this->validators[$name]($value))) { |
|
122 | + return $value; |
|
123 | + } else { |
|
124 | + return $this->data[$name]; |
|
125 | + } |
|
126 | + } catch (TypeError $e) { return $this->data[$name]; } |
|
119 | 127 | } |
120 | 128 | |
121 | 129 | /** |
@@ -130,7 +138,9 @@ discard block |
||
130 | 138 | |
131 | 139 | foreach ($data as $name => $value) { |
132 | 140 | |
133 | - if (null !== ($value = $this->cast($name, $value))) $casted[$name] = $value; |
|
141 | + if (null !== ($value = $this->cast($name, $value))) { |
|
142 | + $casted[$name] = $value; |
|
143 | + } |
|
134 | 144 | } |
135 | 145 | |
136 | 146 | # ------------------------ |
@@ -117,7 +117,7 @@ |
||
117 | 117 | |
118 | 118 | $block = clone (self::$block ?? (self::$block = Template::createBlock( |
119 | 119 | |
120 | - '<$name${ for:attributes } $name$="$value$"{ / for:attributes }>' . |
|
120 | + '<$name${ for:attributes } $name$="$value$"{ / for:attributes }>'. |
|
121 | 121 | |
122 | 122 | '{ block:contents / }$contents${ ! block:closing }</$name$>{ / block:closing }' |
123 | 123 | ))); |
@@ -58,7 +58,9 @@ discard block |
||
58 | 58 | |
59 | 59 | public function setAttributes(array $attributes) : Tag { |
60 | 60 | |
61 | - foreach ($attributes as $name => $value) if (is_scalar($value)) $this->setAttribute($name, $value); |
|
61 | + foreach ($attributes as $name => $value) { |
|
62 | + if (is_scalar($value)) $this->setAttribute($name, $value); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | return $this; |
64 | 66 | } |
@@ -71,7 +73,9 @@ discard block |
||
71 | 73 | |
72 | 74 | public function setContents($contents) : Tag { |
73 | 75 | |
74 | - if (Template::isBlock($contents) || is_scalar($contents) || is_null($contents)) $this->contents = $contents; |
|
76 | + if (Template::isBlock($contents) || is_scalar($contents) || is_null($contents)) { |
|
77 | + $this->contents = $contents; |
|
78 | + } |
|
75 | 79 | |
76 | 80 | return $this; |
77 | 81 | } |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | |
29 | 29 | public function __clone() { |
30 | 30 | |
31 | - foreach ($this->items as $name => $item) $this->items[$name] = clone $item; |
|
31 | + foreach ($this->items as $name => $item) { |
|
32 | + $this->items[$name] = clone $item; |
|
33 | + } |
|
32 | 34 | } |
33 | 35 | |
34 | 36 | /** |
@@ -52,7 +54,9 @@ discard block |
||
52 | 54 | |
53 | 55 | public function addItems(array $items) : Group { |
54 | 56 | |
55 | - foreach ($items as $item) if ($item instanceof Block) $this->addItem($item); |
|
57 | + foreach ($items as $item) { |
|
58 | + if ($item instanceof Block) $this->addItem($item); |
|
59 | + } |
|
56 | 60 | |
57 | 61 | return $this; |
58 | 62 | } |
@@ -111,7 +115,9 @@ discard block |
||
111 | 115 | |
112 | 116 | # Process items |
113 | 117 | |
114 | - foreach ($this->items as $block) $contents .= $block->getContents(); |
|
118 | + foreach ($this->items as $block) { |
|
119 | + $contents .= $block->getContents(); |
|
120 | + } |
|
115 | 121 | |
116 | 122 | # ------------------------ |
117 | 123 |
@@ -29,13 +29,19 @@ discard block |
||
29 | 29 | |
30 | 30 | # Validate name |
31 | 31 | |
32 | - if (false === ($name = Validate::templateComponentName($name))) return ['name', 'WIDGET_ERROR_NAME_INVALID']; |
|
32 | + if (false === ($name = Validate::templateComponentName($name))) { |
|
33 | + return ['name', 'WIDGET_ERROR_NAME_INVALID']; |
|
34 | + } |
|
33 | 35 | |
34 | 36 | # Check name exists |
35 | 37 | |
36 | - if (false === ($check_name = $this->widget->check($name, 'name'))) return 'WIDGET_ERROR_MODIFY'; |
|
38 | + if (false === ($check_name = $this->widget->check($name, 'name'))) { |
|
39 | + return 'WIDGET_ERROR_MODIFY'; |
|
40 | + } |
|
37 | 41 | |
38 | - if ($check_name === 1) return ['name', 'WIDGET_ERROR_NAME_DUPLICATE']; |
|
42 | + if ($check_name === 1) { |
|
43 | + return ['name', 'WIDGET_ERROR_NAME_DUPLICATE']; |
|
44 | + } |
|
39 | 45 | |
40 | 46 | # Modify widget |
41 | 47 | |
@@ -48,7 +54,9 @@ discard block |
||
48 | 54 | |
49 | 55 | $modifier = ((0 === $this->widget->id) ? 'create' : 'edit'); |
50 | 56 | |
51 | - if (!$this->widget->$modifier($data)) return 'WIDGET_ERROR_MODIFY'; |
|
57 | + if (!$this->widget->$modifier($data)) { |
|
58 | + return 'WIDGET_ERROR_MODIFY'; |
|
59 | + } |
|
52 | 60 | |
53 | 61 | # ------------------------ |
54 | 62 |
@@ -67,7 +67,7 @@ |
||
67 | 67 | |
68 | 68 | if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) return; |
69 | 69 | |
70 | - self::$routes['/' . implode('/', $path)] = ('Addons\\' . $name . '\\' . implode('\\', $handler)); |
|
70 | + self::$routes['/'.implode('/', $path)] = ('Addons\\'.$name.'\\'.implode('\\', $handler)); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | # Parse item |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | $parts = preg_split('/\//', $string, 0, PREG_SPLIT_NO_EMPTY); |
54 | 54 | |
55 | - foreach ($parts as $name) if (!preg_match($regex, $name)) return false; |
|
55 | + foreach ($parts as $name) { |
|
56 | + if (!preg_match($regex, $name)) return false; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | # ------------------------ |
58 | 60 | |
@@ -63,9 +65,13 @@ discard block |
||
63 | 65 | |
64 | 66 | private static function parseRoute(string $name, array $route) { |
65 | 67 | |
66 | - if (false === ($path = self::parseString($route['path'], REGEX_MAP_ITEM_PATH))) return; |
|
68 | + if (false === ($path = self::parseString($route['path'], REGEX_MAP_ITEM_PATH))) { |
|
69 | + return; |
|
70 | + } |
|
67 | 71 | |
68 | - if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) return; |
|
72 | + if (false === ($handler = self::parseString($route['handler'], REGEX_MAP_ITEM_HANDLER))) { |
|
73 | + return; |
|
74 | + } |
|
69 | 75 | |
70 | 76 | self::$routes['/' . implode('/', $path)] = ('Addons\\' . $name . '\\' . implode('\\', $handler)); |
71 | 77 | } |
@@ -74,14 +80,18 @@ discard block |
||
74 | 80 | |
75 | 81 | private static function parseItem(array $item) { |
76 | 82 | |
77 | - foreach ($item['routes'] as $route) self::parseRoute($item['name'], $route); |
|
83 | + foreach ($item['routes'] as $route) { |
|
84 | + self::parseRoute($item['name'], $route); |
|
85 | + } |
|
78 | 86 | } |
79 | 87 | |
80 | 88 | # Autoloader |
81 | 89 | |
82 | 90 | public static function __autoload() { |
83 | 91 | |
84 | - foreach (Extend\Addons::items() as $item) self::parseItem($item); |
|
92 | + foreach (Extend\Addons::items() as $item) { |
|
93 | + self::parseItem($item); |
|
94 | + } |
|
85 | 95 | } |
86 | 96 | |
87 | 97 | # Get handler by url |
@@ -31,4 +31,6 @@ |
||
31 | 31 | |
32 | 32 | # Set error reporting |
33 | 33 | |
34 | -if (DEBUG_MODE) error_reporting(E_ALL); |
|
34 | +if (DEBUG_MODE) { |
|
35 | + error_reporting(E_ALL); |
|
36 | +} |
@@ -9,32 +9,32 @@ |
||
9 | 9 | |
10 | 10 | # Define directories |
11 | 11 | |
12 | -define('DIR_SYSTEM', (dirname(__FILE__) . '/')); |
|
12 | +define('DIR_SYSTEM', (dirname(__FILE__).'/')); |
|
13 | 13 | |
14 | -define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM . 'Classes/')); |
|
15 | -define('DIR_SYSTEM_DATA', (DIR_SYSTEM . 'Data/')); |
|
16 | -define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM . 'Includes/')); |
|
17 | -define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM . 'Languages/')); |
|
18 | -define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM . 'Templates/')); |
|
14 | +define('DIR_SYSTEM_CLASSES', (DIR_SYSTEM.'Classes/')); |
|
15 | +define('DIR_SYSTEM_DATA', (DIR_SYSTEM.'Data/')); |
|
16 | +define('DIR_SYSTEM_INCLUDES', (DIR_SYSTEM.'Includes/')); |
|
17 | +define('DIR_SYSTEM_LANGUAGES', (DIR_SYSTEM.'Languages/')); |
|
18 | +define('DIR_SYSTEM_TEMPLATES', (DIR_SYSTEM.'Templates/')); |
|
19 | 19 | |
20 | 20 | # Require classes |
21 | 21 | |
22 | -require_once (DIR_SYSTEM . 'Exception.php'); |
|
22 | +require_once (DIR_SYSTEM.'Exception.php'); |
|
23 | 23 | |
24 | 24 | # Require configuration |
25 | 25 | |
26 | -require_once (DIR_SYSTEM_INCLUDES . 'Constants.php'); |
|
27 | -require_once (DIR_SYSTEM_INCLUDES . 'Config.php'); |
|
28 | -require_once (DIR_SYSTEM_INCLUDES . 'Regex.php'); |
|
29 | -require_once (DIR_SYSTEM_INCLUDES . 'Tables.php'); |
|
26 | +require_once (DIR_SYSTEM_INCLUDES.'Constants.php'); |
|
27 | +require_once (DIR_SYSTEM_INCLUDES.'Config.php'); |
|
28 | +require_once (DIR_SYSTEM_INCLUDES.'Regex.php'); |
|
29 | +require_once (DIR_SYSTEM_INCLUDES.'Tables.php'); |
|
30 | 30 | |
31 | 31 | # Set environment constants |
32 | 32 | |
33 | -define('HTTP_MOD_REWRITE', ($_SERVER['HTTP_MOD_REWRITE'] === 'on')); |
|
33 | +define('HTTP_MOD_REWRITE', ($_SERVER['HTTP_MOD_REWRITE'] === 'on')); |
|
34 | 34 | |
35 | -define('INSTALL_PATH', rtrim($_SERVER['INSTALL_PATH'], '/')); |
|
35 | +define('INSTALL_PATH', rtrim($_SERVER['INSTALL_PATH'], '/')); |
|
36 | 36 | |
37 | -define('DEBUG_MODE', @file_exists(DIR_SYSTEM_DATA . '.debug')); |
|
37 | +define('DEBUG_MODE', @file_exists(DIR_SYSTEM_DATA.'.debug')); |
|
38 | 38 | |
39 | 39 | # Set error reporting |
40 | 40 |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | |
76 | 76 | if ('' === static::$file_name) return null; |
77 | 77 | |
78 | - $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
|
78 | + $file_name = (DIR_SYSTEM_DATA.static::$file_name); |
|
79 | 79 | |
80 | 80 | if (null === ($data = JSON::load($file_name))) return null; |
81 | 81 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | if ('' === static::$file_name) return false; |
94 | 94 | |
95 | - $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
|
95 | + $file_name = (DIR_SYSTEM_DATA.static::$file_name); |
|
96 | 96 | |
97 | 97 | if (null === ($data = $this->validate($data))) return false; |
98 | 98 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | |
110 | 110 | if ('' === static::$file_name) return false; |
111 | 111 | |
112 | - $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
|
112 | + $file_name = (DIR_SYSTEM_DATA.static::$file_name); |
|
113 | 113 | |
114 | 114 | return (!Explorer::isFile($file_name) || Explorer::removeFile($file_name)); |
115 | 115 | } |
@@ -18,48 +18,62 @@ discard block |
||
18 | 18 | |
19 | 19 | protected function addArray(string $name) { |
20 | 20 | |
21 | - if ('' !== $name) return $this->properties[$name] = new _Array; |
|
21 | + if ('' !== $name) { |
|
22 | + return $this->properties[$name] = new _Array; |
|
23 | + } |
|
22 | 24 | } |
23 | 25 | |
24 | 26 | # Add boolean property |
25 | 27 | |
26 | 28 | protected function addBoolean(string $name) { |
27 | 29 | |
28 | - if ('' !== $name) return $this->properties[$name] = new _Boolean; |
|
30 | + if ('' !== $name) { |
|
31 | + return $this->properties[$name] = new _Boolean; |
|
32 | + } |
|
29 | 33 | } |
30 | 34 | |
31 | 35 | # Add integer property |
32 | 36 | |
33 | 37 | protected function addInteger(string $name) { |
34 | 38 | |
35 | - if ('' !== $name) return $this->properties[$name] = new _Integer; |
|
39 | + if ('' !== $name) { |
|
40 | + return $this->properties[$name] = new _Integer; |
|
41 | + } |
|
36 | 42 | } |
37 | 43 | |
38 | 44 | # Add object property |
39 | 45 | |
40 | 46 | protected function addObject(string $name) { |
41 | 47 | |
42 | - if ('' !== $name) return $this->properties[$name] = new _Object; |
|
48 | + if ('' !== $name) { |
|
49 | + return $this->properties[$name] = new _Object; |
|
50 | + } |
|
43 | 51 | } |
44 | 52 | |
45 | 53 | # Add string property |
46 | 54 | |
47 | 55 | protected function addString(string $name) { |
48 | 56 | |
49 | - if ('' !== $name) return $this->properties[$name] = new _String; |
|
57 | + if ('' !== $name) { |
|
58 | + return $this->properties[$name] = new _String; |
|
59 | + } |
|
50 | 60 | } |
51 | 61 | |
52 | 62 | # Validate data |
53 | 63 | |
54 | 64 | public function validate($data) { |
55 | 65 | |
56 | - if (!is_array($data)) return null; |
|
66 | + if (!is_array($data)) { |
|
67 | + return null; |
|
68 | + } |
|
57 | 69 | |
58 | 70 | $result = []; |
59 | 71 | |
60 | 72 | foreach ($this->properties as $name => $property) { |
61 | 73 | |
62 | - if (!isset($data[$name]) || (null === ($value = $property->validate($data[$name])))) return null; |
|
74 | + if (!isset($data[$name]) || (null === ($value = $property->validate($data[$name])))) { |
|
75 | + return null; |
|
76 | + } |
|
63 | 77 | |
64 | 78 | $result[$name] = $value; |
65 | 79 | } |
@@ -73,13 +87,19 @@ discard block |
||
73 | 87 | |
74 | 88 | public function load() { |
75 | 89 | |
76 | - if ('' === static::$file_name) return null; |
|
90 | + if ('' === static::$file_name) { |
|
91 | + return null; |
|
92 | + } |
|
77 | 93 | |
78 | 94 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
79 | 95 | |
80 | - if (null === ($data = JSON::load($file_name))) return null; |
|
96 | + if (null === ($data = JSON::load($file_name))) { |
|
97 | + return null; |
|
98 | + } |
|
81 | 99 | |
82 | - if (null === ($data = $this->validate($data))) return null; |
|
100 | + if (null === ($data = $this->validate($data))) { |
|
101 | + return null; |
|
102 | + } |
|
83 | 103 | |
84 | 104 | # ------------------------ |
85 | 105 | |
@@ -90,13 +110,19 @@ discard block |
||
90 | 110 | |
91 | 111 | public function save(array $data) { |
92 | 112 | |
93 | - if ('' === static::$file_name) return false; |
|
113 | + if ('' === static::$file_name) { |
|
114 | + return false; |
|
115 | + } |
|
94 | 116 | |
95 | 117 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
96 | 118 | |
97 | - if (null === ($data = $this->validate($data))) return false; |
|
119 | + if (null === ($data = $this->validate($data))) { |
|
120 | + return false; |
|
121 | + } |
|
98 | 122 | |
99 | - if (false === JSON::save($file_name, $data)) return false; |
|
123 | + if (false === JSON::save($file_name, $data)) { |
|
124 | + return false; |
|
125 | + } |
|
100 | 126 | |
101 | 127 | # ------------------------ |
102 | 128 | |
@@ -107,7 +133,9 @@ discard block |
||
107 | 133 | |
108 | 134 | public function remove() { |
109 | 135 | |
110 | - if ('' === static::$file_name) return false; |
|
136 | + if ('' === static::$file_name) { |
|
137 | + return false; |
|
138 | + } |
|
111 | 139 | |
112 | 140 | $file_name = (DIR_SYSTEM_DATA . static::$file_name); |
113 | 141 |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | public static function sendStatus(int $code) { |
136 | 136 | |
137 | - if (self::isStatusCode($code)) header($_SERVER['SERVER_PROTOCOL'] . ' ' . self::$status_codes[$code]); |
|
137 | + if (self::isStatusCode($code)) header($_SERVER['SERVER_PROTOCOL'].' '.self::$status_codes[$code]); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
@@ -145,12 +145,12 @@ discard block |
||
145 | 145 | |
146 | 146 | if (self::isTextContentType($type)) { |
147 | 147 | |
148 | - return header('Content-type: ' . self::$content_types_text[$type] . '; charset=UTF-8'); |
|
148 | + return header('Content-type: '.self::$content_types_text[$type].'; charset=UTF-8'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | if (self::isMediaContentType($type)) { |
152 | 152 | |
153 | - return header('Content-type: ' . self::$content_types_media[$type]); |
|
153 | + return header('Content-type: '.self::$content_types_media[$type]); |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | |
163 | 163 | if (self::$cache_sent) return; |
164 | 164 | |
165 | - header('Expires: ' . gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)) . ' GMT'); |
|
165 | + header('Expires: '.gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)).' GMT'); |
|
166 | 166 | |
167 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', REQUEST_TIME) . ' GMT'); |
|
167 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', REQUEST_TIME).' GMT'); |
|
168 | 168 | |
169 | 169 | $limiter = ($public ? 'public' : 'private'); |
170 | 170 | |
171 | - header('Cache-Control: ' . $limiter . ', max-age=' . $expires . ', pre-check=' . $expires); |
|
171 | + header('Cache-Control: '.$limiter.', max-age='.$expires.', pre-check='.$expires); |
|
172 | 172 | |
173 | - header('Pragma: ' . $limiter); |
|
173 | + header('Pragma: '.$limiter); |
|
174 | 174 | |
175 | 175 | # ------------------------ |
176 | 176 | |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | |
186 | 186 | if (self::$cache_sent) return; |
187 | 187 | |
188 | - header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
|
188 | + header('Expires: '.gmdate('D, d M Y H:i:s', strtotime('-1 day')).' GMT'); |
|
189 | 189 | |
190 | - header('Last-Modified: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
|
190 | + header('Last-Modified: '.gmdate('D, d M Y H:i:s', strtotime('-1 day')).' GMT'); |
|
191 | 191 | |
192 | 192 | header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0'); |
193 | 193 |
@@ -134,7 +134,9 @@ discard block |
||
134 | 134 | |
135 | 135 | public static function sendStatus(int $code) { |
136 | 136 | |
137 | - if (self::isStatusCode($code)) header($_SERVER['SERVER_PROTOCOL'] . ' ' . self::$status_codes[$code]); |
|
137 | + if (self::isStatusCode($code)) { |
|
138 | + header($_SERVER['SERVER_PROTOCOL'] . ' ' . self::$status_codes[$code]); |
|
139 | + } |
|
138 | 140 | } |
139 | 141 | |
140 | 142 | /** |
@@ -160,7 +162,9 @@ discard block |
||
160 | 162 | |
161 | 163 | public static function sendCache(int $expires, bool $public = false) { |
162 | 164 | |
163 | - if (self::$cache_sent) return; |
|
165 | + if (self::$cache_sent) { |
|
166 | + return; |
|
167 | + } |
|
164 | 168 | |
165 | 169 | header('Expires: ' . gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)) . ' GMT'); |
166 | 170 | |
@@ -183,7 +187,9 @@ discard block |
||
183 | 187 | |
184 | 188 | public static function sendNoCache() { |
185 | 189 | |
186 | - if (self::$cache_sent) return; |
|
190 | + if (self::$cache_sent) { |
|
191 | + return; |
|
192 | + } |
|
187 | 193 | |
188 | 194 | header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
189 | 195 |