@@ -117,7 +117,9 @@ discard block |
||
117 | 117 | |
118 | 118 | public static function status(string $code) { |
119 | 119 | |
120 | - if (self::isStatusCode($code)) header(getenv('SERVER_PROTOCOL') . ' ' . self::$status_codes[$code]); |
|
120 | + if (self::isStatusCode($code)) { |
|
121 | + header(getenv('SERVER_PROTOCOL') . ' ' . self::$status_codes[$code]); |
|
122 | + } |
|
121 | 123 | } |
122 | 124 | |
123 | 125 | # Send content header |
@@ -139,9 +141,13 @@ discard block |
||
139 | 141 | |
140 | 142 | public static function cache(string $limiter, int $expires) { |
141 | 143 | |
142 | - if (self::$cache_send) return; |
|
144 | + if (self::$cache_send) { |
|
145 | + return; |
|
146 | + } |
|
143 | 147 | |
144 | - if (!in_array($limiter, [CACHE_LIMITER_PRIVATE, CACHE_LIMITER_PUBLIC], true)) return; |
|
148 | + if (!in_array($limiter, [CACHE_LIMITER_PRIVATE, CACHE_LIMITER_PUBLIC], true)) { |
|
149 | + return; |
|
150 | + } |
|
145 | 151 | |
146 | 152 | header('Expires: ' . gmdate('D, d M Y H:i:s', (REQUEST_TIME + $expires)) . ' GMT'); |
147 | 153 | |
@@ -160,7 +166,9 @@ discard block |
||
160 | 166 | |
161 | 167 | public static function nocache() { |
162 | 168 | |
163 | - if (self::$cache_send) return; |
|
169 | + if (self::$cache_send) { |
|
170 | + return; |
|
171 | + } |
|
164 | 172 | |
165 | 173 | header('Expires: ' . gmdate('D, d M Y H:i:s', strtotime('-1 day')) . ' GMT'); |
166 | 174 |
@@ -19,7 +19,9 @@ |
||
19 | 19 | |
20 | 20 | public function error(string $value = null) { |
21 | 21 | |
22 | - if (null !== $value) $this->set('error', $value); |
|
22 | + if (null !== $value) { |
|
23 | + $this->set('error', $value); |
|
24 | + } |
|
23 | 25 | |
24 | 26 | $this->status = false; |
25 | 27 |
@@ -53,25 +53,25 @@ |
||
53 | 53 | |
54 | 54 | $pattern = [ |
55 | 55 | |
56 | - 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', |
|
57 | - 'Д' => 'D', 'Е' => 'E', 'Ж' => 'ZH', 'З' => 'Z', |
|
58 | - 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', |
|
59 | - 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', |
|
60 | - 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', |
|
61 | - 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'CH', |
|
62 | - 'Ш' => 'SH', 'Щ' => 'SCH', 'Ъ' => '', 'Ь' => '', |
|
63 | - 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'JU', 'Я' => 'JA', |
|
64 | - 'І' => 'I', 'Ї' => 'JI', 'Ё' => 'JO', |
|
65 | - |
|
66 | - 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', |
|
67 | - 'д' => 'd', 'е' => 'e', 'ж' => 'zh', 'з' => 'z', |
|
68 | - 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', |
|
69 | - 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', |
|
70 | - 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', |
|
71 | - 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', |
|
72 | - 'ш' => 'sh', 'щ' => 'sch', 'ъ' => '', 'ь' => '', |
|
73 | - 'ы' => 'y', 'э' => 'e', 'ю' => 'ju', 'я' => 'ja', |
|
74 | - 'і' => 'i', 'ї' => 'ji', 'ё' => 'jo' |
|
56 | + 'А' => 'A', 'Б' => 'B', 'В' => 'V', 'Г' => 'G', |
|
57 | + 'Д' => 'D', 'Е' => 'E', 'Ж' => 'ZH', 'З' => 'Z', |
|
58 | + 'И' => 'I', 'Й' => 'J', 'К' => 'K', 'Л' => 'L', |
|
59 | + 'М' => 'M', 'Н' => 'N', 'О' => 'O', 'П' => 'P', |
|
60 | + 'Р' => 'R', 'С' => 'S', 'Т' => 'T', 'У' => 'U', |
|
61 | + 'Ф' => 'F', 'Х' => 'H', 'Ц' => 'C', 'Ч' => 'CH', |
|
62 | + 'Ш' => 'SH', 'Щ' => 'SCH', 'Ъ' => '', 'Ь' => '', |
|
63 | + 'Ы' => 'Y', 'Э' => 'E', 'Ю' => 'JU', 'Я' => 'JA', |
|
64 | + 'І' => 'I', 'Ї' => 'JI', 'Ё' => 'JO', |
|
65 | + |
|
66 | + 'а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', |
|
67 | + 'д' => 'd', 'е' => 'e', 'ж' => 'zh', 'з' => 'z', |
|
68 | + 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', |
|
69 | + 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', |
|
70 | + 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'u', |
|
71 | + 'ф' => 'f', 'х' => 'h', 'ц' => 'c', 'ч' => 'ch', |
|
72 | + 'ш' => 'sh', 'щ' => 'sch', 'ъ' => '', 'ь' => '', |
|
73 | + 'ы' => 'y', 'э' => 'e', 'ю' => 'ju', 'я' => 'ja', |
|
74 | + 'і' => 'i', 'ї' => 'ji', 'ё' => 'jo' |
|
75 | 75 | ]; |
76 | 76 | |
77 | 77 | # ------------------------ |
@@ -10,14 +10,18 @@ discard block |
||
10 | 10 | |
11 | 11 | foreach (($string = explode("\n", $string)) as $key => $line) { |
12 | 12 | |
13 | - if ($multiline && $codestyle) $string[$key] = rtrim(preg_replace('/[\r\0\x0B]+/', '', $line)); |
|
14 | - |
|
15 | - else $string[$key] = trim(preg_replace(['/[ \t]+/', '/[\r\0\x0B]+/'], [' ', ''], $line)); |
|
13 | + if ($multiline && $codestyle) { |
|
14 | + $string[$key] = rtrim(preg_replace('/[\r\0\x0B]+/', '', $line)); |
|
15 | + } else { |
|
16 | + $string[$key] = trim(preg_replace(['/[ \t]+/', '/[\r\0\x0B]+/'], [' ', ''], $line)); |
|
17 | + } |
|
16 | 18 | } |
17 | 19 | |
18 | - if (!$multiline) $string = preg_replace('/ {2,}/', ' ', trim(implode(' ', $string), ' ')); |
|
19 | - |
|
20 | - else $string = preg_replace('/(\r\n){3,}/', "\r\n\r\n", trim(implode("\r\n", $string), "\r\n")); |
|
20 | + if (!$multiline) { |
|
21 | + $string = preg_replace('/ {2,}/', ' ', trim(implode(' ', $string), ' ')); |
|
22 | + } else { |
|
23 | + $string = preg_replace('/(\r\n){3,}/', "\r\n\r\n", trim(implode("\r\n", $string), "\r\n")); |
|
24 | + } |
|
21 | 25 | |
22 | 26 | # ------------------------ |
23 | 27 | |
@@ -136,7 +140,9 @@ discard block |
||
136 | 140 | |
137 | 141 | public static function cut(string $string, int $maxlength, bool $ellipsis = false) { |
138 | 142 | |
139 | - if (($maxlength < 1) || (self::length($string = trim($string)) <= $maxlength)) return $string; |
|
143 | + if (($maxlength < 1) || (self::length($string = trim($string)) <= $maxlength)) { |
|
144 | + return $string; |
|
145 | + } |
|
140 | 146 | |
141 | 147 | $string = (rtrim(self::substr($string, 0, $maxlength)) . ($ellipsis ? '...' : '')); |
142 | 148 | |
@@ -149,9 +155,13 @@ discard block |
||
149 | 155 | |
150 | 156 | public static function random(int $length, string $pool = STR_POOL_DEFAULT) { |
151 | 157 | |
152 | - if (($length < 1) || (0 === ($pool_length = self::length($pool)))) return ''; |
|
158 | + if (($length < 1) || (0 === ($pool_length = self::length($pool)))) { |
|
159 | + return ''; |
|
160 | + } |
|
153 | 161 | |
154 | - $string = ''; for ($i = 0; $i < $length; $i++) $string .= self::substr($pool, random_int(0, ($pool_length - 1)), 1); |
|
162 | + $string = ''; for ($i = 0; $i < $length; $i++) { |
|
163 | + $string .= self::substr($pool, random_int(0, ($pool_length - 1)), 1); |
|
164 | + } |
|
155 | 165 | |
156 | 166 | # ------------------------ |
157 | 167 |
@@ -10,9 +10,13 @@ discard block |
||
10 | 10 | |
11 | 11 | private static function search(array &$list) { |
12 | 12 | |
13 | - if (empty($agent = getenv('HTTP_USER_AGENT'))) return false; |
|
13 | + if (empty($agent = getenv('HTTP_USER_AGENT'))) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | |
15 | - foreach ($list as $item) if (false !== stripos($agent, $item)) return true; |
|
17 | + foreach ($list as $item) { |
|
18 | + if (false !== stripos($agent, $item)) return true; |
|
19 | + } |
|
16 | 20 | |
17 | 21 | # ------------------------ |
18 | 22 | |
@@ -27,9 +31,13 @@ discard block |
||
27 | 31 | |
28 | 32 | $file_robots = (DIR_DATA . 'Agent/Robots.php'); |
29 | 33 | |
30 | - if (is_array($mobiles = Explorer::php($file_mobiles))) self::$mobiles = $mobiles; |
|
34 | + if (is_array($mobiles = Explorer::php($file_mobiles))) { |
|
35 | + self::$mobiles = $mobiles; |
|
36 | + } |
|
31 | 37 | |
32 | - if (is_array($robots = Explorer::php($file_robots))) self::$robots = $robots; |
|
38 | + if (is_array($robots = Explorer::php($file_robots))) { |
|
39 | + self::$robots = $robots; |
|
40 | + } |
|
33 | 41 | } |
34 | 42 | |
35 | 43 | # Check if user agent is mobile |
@@ -8,11 +8,17 @@ discard block |
||
8 | 8 | |
9 | 9 | public static function format($number, int $min = 0, int $max = 0) { |
10 | 10 | |
11 | - if (!is_numeric($number) || (($number = intval($number)) < 0)) $number = 0; |
|
11 | + if (!is_numeric($number) || (($number = intval($number)) < 0)) { |
|
12 | + $number = 0; |
|
13 | + } |
|
12 | 14 | |
13 | - if (($min > 0) && ($number < $min)) return $min; |
|
15 | + if (($min > 0) && ($number < $min)) { |
|
16 | + return $min; |
|
17 | + } |
|
14 | 18 | |
15 | - if (($max > 0) && ($number > $max)) return $max; |
|
19 | + if (($max > 0) && ($number > $max)) { |
|
20 | + return $max; |
|
21 | + } |
|
16 | 22 | |
17 | 23 | # ------------------------ |
18 | 24 | |
@@ -23,11 +29,17 @@ discard block |
||
23 | 29 | |
24 | 30 | public static function formatFloat($number, float $min = 0, float $max = 0, int $decimals = 0) { |
25 | 31 | |
26 | - if (!is_numeric($number) || (($number = floatval($number)) < 0)) $number = 0; |
|
32 | + if (!is_numeric($number) || (($number = floatval($number)) < 0)) { |
|
33 | + $number = 0; |
|
34 | + } |
|
27 | 35 | |
28 | - if (($min > 0) && ($number < $min)) $number = $min; |
|
36 | + if (($min > 0) && ($number < $min)) { |
|
37 | + $number = $min; |
|
38 | + } |
|
29 | 39 | |
30 | - if (($max > 0) && ($number > $max)) $number = $max; |
|
40 | + if (($max > 0) && ($number > $max)) { |
|
41 | + $number = $max; |
|
42 | + } |
|
31 | 43 | |
32 | 44 | $number = floatval(number_format($number, $decimals, '.', '')); |
33 | 45 | |
@@ -42,9 +54,11 @@ discard block |
||
42 | 54 | |
43 | 55 | $number = (($number >= 0) ? $number : 0); $exponents = [0 => 'Bytes', 'KB', 'MB', 'GB', 'TB']; |
44 | 56 | |
45 | - foreach ($exponents as $exponent => $text) if ($number < pow(1024, ($exponent + 1))) { |
|
57 | + foreach ($exponents as $exponent => $text) { |
|
58 | + if ($number < pow(1024, ($exponent + 1))) { |
|
46 | 59 | |
47 | 60 | $number = number_format(($number / pow(1024, $exponent)), (($exponent < 2) ? $exponent : 2)); |
61 | + } |
|
48 | 62 | |
49 | 63 | return (floatval($number) . ' ' . $text); |
50 | 64 | } |
@@ -62,13 +76,21 @@ discard block |
||
62 | 76 | |
63 | 77 | $last_1 = substr($number, ($length - 1), 1); $last_2 = substr($number, ($length - 2), 2); |
64 | 78 | |
65 | - if (($last_2 >= 11) && ($last_2 <= 20)) return $variant_5; |
|
79 | + if (($last_2 >= 11) && ($last_2 <= 20)) { |
|
80 | + return $variant_5; |
|
81 | + } |
|
66 | 82 | |
67 | - if ($last_1 == 1) return $variant_1; |
|
83 | + if ($last_1 == 1) { |
|
84 | + return $variant_1; |
|
85 | + } |
|
68 | 86 | |
69 | - if (($last_1 >= 2) && ($last_1 <= 4)) return $variant_3; |
|
87 | + if (($last_1 >= 2) && ($last_1 <= 4)) { |
|
88 | + return $variant_3; |
|
89 | + } |
|
70 | 90 | |
71 | - if (($last_1 >= 5) || ($last_1 == 0)) return $variant_5; |
|
91 | + if (($last_1 >= 5) || ($last_1 == 0)) { |
|
92 | + return $variant_5; |
|
93 | + } |
|
72 | 94 | } |
73 | 95 | } |
74 | 96 | } |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | |
11 | 11 | private function addField(Form\Utils\Field $field) { |
12 | 12 | |
13 | - if ($this->posted || ('' === ($key = $field->key()))) return false; |
|
13 | + if ($this->posted || ('' === ($key = $field->key()))) { |
|
14 | + return false; |
|
15 | + } |
|
14 | 16 | |
15 | 17 | $this->fields[$key] = $field; |
16 | 18 | |
@@ -23,7 +25,9 @@ discard block |
||
23 | 25 | |
24 | 26 | public function __construct(string $name = '') { |
25 | 27 | |
26 | - if (preg_match(REGEX_FORM_NAME, $name)) $this->name = $name; |
|
28 | + if (preg_match(REGEX_FORM_NAME, $name)) { |
|
29 | + $this->name = $name; |
|
30 | + } |
|
27 | 31 | } |
28 | 32 | |
29 | 33 | # Add text field |
@@ -65,9 +69,15 @@ discard block |
||
65 | 69 | |
66 | 70 | foreach ($this->fields as $field) { |
67 | 71 | |
68 | - if (($field instanceof Form\Field\Checkbox) || $field->disabled()) continue; |
|
72 | + if (($field instanceof Form\Field\Checkbox) || $field->disabled()) { |
|
73 | + continue; |
|
74 | + } |
|
69 | 75 | |
70 | - if (false !== Request::post($field->name())) $check = true; else return false; |
|
76 | + if (false !== Request::post($field->name())) { |
|
77 | + $check = true; |
|
78 | + } else { |
|
79 | + return false; |
|
80 | + } |
|
71 | 81 | } |
72 | 82 | |
73 | 83 | # ------------------------ |
@@ -79,7 +89,9 @@ discard block |
||
79 | 89 | |
80 | 90 | public function post() { |
81 | 91 | |
82 | - if ($this->posted || !$this->check()) return false; |
|
92 | + if ($this->posted || !$this->check()) { |
|
93 | + return false; |
|
94 | + } |
|
83 | 95 | |
84 | 96 | $errors = false; $post = []; |
85 | 97 | |
@@ -87,7 +99,9 @@ discard block |
||
87 | 99 | |
88 | 100 | $field->post(); $post[$field->key()] = $field->value(); |
89 | 101 | |
90 | - if ($field->error()) $errors = true; |
|
102 | + if ($field->error()) { |
|
103 | + $errors = true; |
|
104 | + } |
|
91 | 105 | } |
92 | 106 | |
93 | 107 | $this->posted = true; $this->errors = $errors; |
@@ -44,7 +44,7 @@ |
||
44 | 44 | |
45 | 45 | public function __construct(Form $form, string $key, string $value = '', |
46 | 46 | |
47 | - array $options = [], string $default = null, array $config = []) { |
|
47 | + array $options = [], string $default = null, array $config = []) { |
|
48 | 48 | |
49 | 49 | # Init field |
50 | 50 |
@@ -92,9 +92,13 @@ |
||
92 | 92 | |
93 | 93 | $tag = $this->getTag('select'); |
94 | 94 | |
95 | - if ($this->config['search']) $tag->set('data-search', 'search'); |
|
95 | + if ($this->config['search']) { |
|
96 | + $tag->set('data-search', 'search'); |
|
97 | + } |
|
96 | 98 | |
97 | - if ($this->config['auto']) $tag->set('data-auto', 'auto'); |
|
99 | + if ($this->config['auto']) { |
|
100 | + $tag->set('data-auto', 'auto'); |
|
101 | + } |
|
98 | 102 | |
99 | 103 | $tag->contents($this->getOptions()); |
100 | 104 |
@@ -38,7 +38,9 @@ |
||
38 | 38 | |
39 | 39 | $tag->set('type', 'checkbox'); |
40 | 40 | |
41 | - if (false !== $this->value) $tag->set('checked', 'checked'); |
|
41 | + if (false !== $this->value) { |
|
42 | + $tag->set('checked', 'checked'); |
|
43 | + } |
|
42 | 44 | |
43 | 45 | # ------------------------ |
44 | 46 |
@@ -105,7 +105,7 @@ |
||
105 | 105 | |
106 | 106 | public function __construct(Form $form, string $key, string $value = '', |
107 | 107 | |
108 | - string $type = FORM_FIELD_TEXT, int $maxlength = 0, array $config = []) { |
|
108 | + string $type = FORM_FIELD_TEXT, int $maxlength = 0, array $config = []) { |
|
109 | 109 | |
110 | 110 | # Init field |
111 | 111 |
@@ -65,9 +65,13 @@ discard block |
||
65 | 65 | |
66 | 66 | $tag = $this->getTag('textarea', [], $this->value); |
67 | 67 | |
68 | - if ($this->config['rows'] > 0) $tag->set('rows', $this->config['rows']); |
|
68 | + if ($this->config['rows'] > 0) { |
|
69 | + $tag->set('rows', $this->config['rows']); |
|
70 | + } |
|
69 | 71 | |
70 | - if ($this->config['cols'] > 0) $tag->set('cols', $this->config['cols']); |
|
72 | + if ($this->config['cols'] > 0) { |
|
73 | + $tag->set('cols', $this->config['cols']); |
|
74 | + } |
|
71 | 75 | |
72 | 76 | # ------------------------ |
73 | 77 | |
@@ -78,27 +82,33 @@ discard block |
||
78 | 82 | |
79 | 83 | private function processSpaces() { |
80 | 84 | |
81 | - if ($this->config['spaces'] === 'strip') $this->value = Str::stripSpaces($this->value); |
|
82 | - |
|
83 | - else if ($this->config['spaces'] === 'single') $this->value = Str::singleSpaces($this->value); |
|
85 | + if ($this->config['spaces'] === 'strip') { |
|
86 | + $this->value = Str::stripSpaces($this->value); |
|
87 | + } else if ($this->config['spaces'] === 'single') { |
|
88 | + $this->value = Str::singleSpaces($this->value); |
|
89 | + } |
|
84 | 90 | } |
85 | 91 | |
86 | 92 | # Process convert |
87 | 93 | |
88 | 94 | private function processConvert() { |
89 | 95 | |
90 | - if ($this->config['convert'] === 'url') $this->value = Str::toUrl($this->value, $this->maxlength); |
|
91 | - |
|
92 | - else if ($this->config['convert'] === 'var') $this->value = Str::toVar($this->value, $this->maxlength); |
|
96 | + if ($this->config['convert'] === 'url') { |
|
97 | + $this->value = Str::toUrl($this->value, $this->maxlength); |
|
98 | + } else if ($this->config['convert'] === 'var') { |
|
99 | + $this->value = Str::toVar($this->value, $this->maxlength); |
|
100 | + } |
|
93 | 101 | } |
94 | 102 | |
95 | 103 | # Process transform |
96 | 104 | |
97 | 105 | private function processTransform() { |
98 | 106 | |
99 | - if ($this->config['transform'] === 'lower') $this->value = Str::toLower($this->value); |
|
100 | - |
|
101 | - else if ($this->config['transform'] === 'upper') $this->value = Str::toUpper($this->value); |
|
107 | + if ($this->config['transform'] === 'lower') { |
|
108 | + $this->value = Str::toLower($this->value); |
|
109 | + } else if ($this->config['transform'] === 'upper') { |
|
110 | + $this->value = Str::toUpper($this->value); |
|
111 | + } |
|
102 | 112 | } |
103 | 113 | |
104 | 114 | # Constructor |
@@ -164,7 +174,9 @@ discard block |
||
164 | 174 | |
165 | 175 | public function spaces(string $value) { |
166 | 176 | |
167 | - if (!in_array($value, ['strip', 'single'], true)) $value = ''; |
|
177 | + if (!in_array($value, ['strip', 'single'], true)) { |
|
178 | + $value = ''; |
|
179 | + } |
|
168 | 180 | |
169 | 181 | $this->config['spaces'] = $value; |
170 | 182 | } |
@@ -173,7 +185,9 @@ discard block |
||
173 | 185 | |
174 | 186 | public function convert(string $value) { |
175 | 187 | |
176 | - if (!in_array($value, ['url', 'var'], true)) $value = ''; |
|
188 | + if (!in_array($value, ['url', 'var'], true)) { |
|
189 | + $value = ''; |
|
190 | + } |
|
177 | 191 | |
178 | 192 | $this->config['convert'] = $value; |
179 | 193 | } |
@@ -182,7 +196,9 @@ discard block |
||
182 | 196 | |
183 | 197 | public function transform(string $value) { |
184 | 198 | |
185 | - if (!in_array($value, ['upper', 'lower'], true)) $value = ''; |
|
199 | + if (!in_array($value, ['upper', 'lower'], true)) { |
|
200 | + $value = ''; |
|
201 | + } |
|
186 | 202 | |
187 | 203 | $this->config['transform'] = $value; |
188 | 204 | } |
@@ -226,25 +242,35 @@ discard block |
||
226 | 242 | |
227 | 243 | public function block() { |
228 | 244 | |
229 | - if ($this->type === FORM_FIELD_HIDDEN) return $this->getHidden()->block(); |
|
230 | - |
|
231 | - else if ($this->type === FORM_FIELD_PASSWORD) $tag = $this->getPassword(); |
|
232 | - |
|
233 | - else if ($this->type === FORM_FIELD_CAPTCHA) $tag = $this->getCaptcha(); |
|
234 | - |
|
235 | - else if ($this->type === FORM_FIELD_TEXTAREA) $tag = $this->getTextarea(); |
|
236 | - |
|
237 | - else $tag = $this->getText(); |
|
245 | + if ($this->type === FORM_FIELD_HIDDEN) { |
|
246 | + return $this->getHidden()->block(); |
|
247 | + } else if ($this->type === FORM_FIELD_PASSWORD) { |
|
248 | + $tag = $this->getPassword(); |
|
249 | + } else if ($this->type === FORM_FIELD_CAPTCHA) { |
|
250 | + $tag = $this->getCaptcha(); |
|
251 | + } else if ($this->type === FORM_FIELD_TEXTAREA) { |
|
252 | + $tag = $this->getTextarea(); |
|
253 | + } else { |
|
254 | + $tag = $this->getText(); |
|
255 | + } |
|
238 | 256 | |
239 | 257 | # Set appearance |
240 | 258 | |
241 | - if ($this->maxlength > 0) $tag->set('maxlength', $this->maxlength); |
|
259 | + if ($this->maxlength > 0) { |
|
260 | + $tag->set('maxlength', $this->maxlength); |
|
261 | + } |
|
242 | 262 | |
243 | - if ('' !== $this->config['placeholder']) $tag->set('placeholder', $this->config['placeholder']); |
|
263 | + if ('' !== $this->config['placeholder']) { |
|
264 | + $tag->set('placeholder', $this->config['placeholder']); |
|
265 | + } |
|
244 | 266 | |
245 | - if ($this->config['readonly']) $tag->set('readonly', 'readonly'); |
|
267 | + if ($this->config['readonly']) { |
|
268 | + $tag->set('readonly', 'readonly'); |
|
269 | + } |
|
246 | 270 | |
247 | - if ($this->config['autofocus']) $tag->set('autofocus', 'autofocus'); |
|
271 | + if ($this->config['autofocus']) { |
|
272 | + $tag->set('autofocus', 'autofocus'); |
|
273 | + } |
|
248 | 274 | |
249 | 275 | # ------------------------ |
250 | 276 |