@@ -72,13 +72,13 @@ |
||
72 | 72 | exit(EXIT_ERROR); |
73 | 73 | } |
74 | 74 | |
75 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
76 | - $vars[ 'HELPER' ] = underscore( |
|
75 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
76 | + $vars['HELPER'] = underscore( |
|
77 | 77 | snakecase( |
78 | 78 | pathinfo($filePath, PATHINFO_FILENAME) |
79 | 79 | ) |
80 | 80 | ); |
81 | - $vars[ 'FILEPATH' ] = $filePath; |
|
81 | + $vars['FILEPATH'] = $filePath; |
|
82 | 82 | |
83 | 83 | $phpTemplate = <<<PHPTEMPLATE |
84 | 84 | <?php |
@@ -72,9 +72,9 @@ |
||
72 | 72 | exit(EXIT_ERROR); |
73 | 73 | } |
74 | 74 | |
75 | - $vars[ 'CREATE_DATETIME' ] = date('d/m/Y H:m'); |
|
76 | - $vars[ 'CONFIG' ] = '$' . camelcase(pathinfo($filePath, PATHINFO_FILENAME)); |
|
77 | - $vars[ 'FILEPATH' ] = $filePath; |
|
75 | + $vars['CREATE_DATETIME'] = date('d/m/Y H:m'); |
|
76 | + $vars['CONFIG'] = '$' . camelcase(pathinfo($filePath, PATHINFO_FILENAME)); |
|
77 | + $vars['FILEPATH'] = $filePath; |
|
78 | 78 | |
79 | 79 | $phpTemplate = <<<PHPTEMPLATE |
80 | 80 | <?php |
@@ -151,16 +151,16 @@ discard block |
||
151 | 151 | $options = input()->get(); |
152 | 152 | |
153 | 153 | if (empty($options)) { |
154 | - $_GET[ 'switch' ] = 'ON'; |
|
155 | - $_GET[ 'mode' ] = 'default'; |
|
156 | - $_GET[ 'lifetime' ] = 300; |
|
157 | - $_GET[ 'title' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
158 | - $_GET[ 'message' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
154 | + $_GET['switch'] = 'ON'; |
|
155 | + $_GET['mode'] = 'default'; |
|
156 | + $_GET['lifetime'] = 300; |
|
157 | + $_GET['title'] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
158 | + $_GET['message'] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
159 | 159 | } else { |
160 | - $_GET[ 'mode' ] = 'default'; |
|
161 | - $_GET[ 'lifetime' ] = 300; |
|
162 | - $_GET[ 'title' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
163 | - $_GET[ 'message' ] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
160 | + $_GET['mode'] = 'default'; |
|
161 | + $_GET['lifetime'] = 300; |
|
162 | + $_GET['title'] = language()->getLine(strtoupper('CLI_MAINTENANCE_TITLE')); |
|
163 | + $_GET['message'] = language()->getLine(strtoupper('CLI_MAINTENANCE_MESSAGE')); |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | parent::execute(); |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | (new Format()) |
174 | 174 | ->setContextualClass(Format::DANGER) |
175 | 175 | ->setString(language()->getLine('CLI_MAINTENANCE_ALREADY_STARTED', [ |
176 | - $maintenanceInfo[ 'mode' ], |
|
177 | - $maintenanceInfo[ 'datetime' ], |
|
178 | - date('r', strtotime($maintenanceInfo[ 'datetime' ]) + $maintenanceInfo[ 'lifetime' ]), |
|
179 | - $maintenanceInfo[ 'title' ], |
|
180 | - $maintenanceInfo[ 'message' ], |
|
176 | + $maintenanceInfo['mode'], |
|
177 | + $maintenanceInfo['datetime'], |
|
178 | + date('r', strtotime($maintenanceInfo['datetime']) + $maintenanceInfo['lifetime']), |
|
179 | + $maintenanceInfo['title'], |
|
180 | + $maintenanceInfo['message'], |
|
181 | 181 | ])) |
182 | 182 | ->setNewLinesAfter(1) |
183 | 183 | ); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // or a multidimensional one, we need to do a little prepping. |
286 | 286 | if ( ! is_array($meta)) { |
287 | 287 | $meta = [['name' => $meta, 'content' => $content, 'type']]; |
288 | - } elseif (isset($meta[ 'name' ])) { |
|
288 | + } elseif (isset($meta['name'])) { |
|
289 | 289 | // Turn single array into multidimensional |
290 | 290 | $meta = [$meta]; |
291 | 291 | } |
@@ -295,11 +295,11 @@ discard block |
||
295 | 295 | foreach ($meta as $attributes) { |
296 | 296 | $element = new \O2System\Html\Element('meta'); |
297 | 297 | $element->attributes->addAttribute('type', |
298 | - (isset($attributes[ 'type' ]) && $attributes[ 'type' ] !== 'name') ? 'http-equiv' : 'name'); |
|
298 | + (isset($attributes['type']) && $attributes['type'] !== 'name') ? 'http-equiv' : 'name'); |
|
299 | 299 | $element->attributes->addAttribute('name', |
300 | - isset($attributes[ 'content' ]) ? $attributes[ 'content' ] : ''); |
|
300 | + isset($attributes['content']) ? $attributes['content'] : ''); |
|
301 | 301 | $element->attributes->addAttribute('name', |
302 | - isset($attributes[ 'content' ]) ? $attributes[ 'content' ] : ''); |
|
302 | + isset($attributes['content']) ? $attributes['content'] : ''); |
|
303 | 303 | |
304 | 304 | if (count($attributes)) { |
305 | 305 | foreach ($attributes as $meta => $value) { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | foreach ($xml->attributes() as $key => $node) { |
341 | - $attributes[ $key ] = (string)$node; |
|
341 | + $attributes[$key] = (string)$node; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $html = preg_match_all("/(\<" . $tag . ")(.*?)(" . $tag . ">)/si", $html, $matches); |
401 | 401 | |
402 | 402 | $result = ''; |
403 | - foreach ($matches[ 0 ] as $item) { |
|
403 | + foreach ($matches[0] as $item) { |
|
404 | 404 | $result = preg_replace("/\<[\/]?" . $tag . "\>/", '', $item); |
405 | 405 | } |
406 | 406 |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | function array_get_value($key, array $array, $default = null) |
32 | 32 | { |
33 | - return array_key_exists($key, $array) ? $array[ $key ] : $default; |
|
33 | + return array_key_exists($key, $array) ? $array[$key] : $default; |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | |
58 | 58 | foreach ($keys as $item) { |
59 | 59 | if (array_key_exists($item, $array)) { |
60 | - $return[ $item ] = $array[ $item ]; |
|
60 | + $return[$item] = $array[$item]; |
|
61 | 61 | } elseif (is_array($default) && array_key_exists($item, $default)) { |
62 | - $return[ $item ] = $default[ $item ]; |
|
62 | + $return[$item] = $default[$item]; |
|
63 | 63 | } elseif ( ! empty($default)) { |
64 | - $return[ $item ] = $default; |
|
64 | + $return[$item] = $default; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
@@ -88,12 +88,12 @@ discard block |
||
88 | 88 | $combine_array = []; |
89 | 89 | |
90 | 90 | foreach ($keys as $index => $key) { |
91 | - $combine_array[ $key ][] = $values[ $index ]; |
|
91 | + $combine_array[$key][] = $values[$index]; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | array_walk( |
95 | 95 | $combine_array, |
96 | - function (&$value) { |
|
96 | + function(&$value) { |
|
97 | 97 | $value = (count($value) == 1) ? array_pop($value) : $value; |
98 | 98 | } |
99 | 99 | ); |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | if ($flip) { |
123 | 123 | array_walk_recursive( |
124 | 124 | $array, |
125 | - function ($value, $key) use (&$group_array) { |
|
126 | - if ( ! isset($group_array[ $value ]) || ! is_array($group_array[ $value ])) { |
|
127 | - $group_array[ $value ] = []; |
|
125 | + function($value, $key) use (&$group_array) { |
|
126 | + if ( ! isset($group_array[$value]) || ! is_array($group_array[$value])) { |
|
127 | + $group_array[$value] = []; |
|
128 | 128 | } |
129 | - $group_array[ $value ][] = $key; |
|
129 | + $group_array[$value][] = $key; |
|
130 | 130 | } |
131 | 131 | ); |
132 | 132 | } else { |
133 | 133 | array_walk_recursive( |
134 | 134 | $array, |
135 | - function ($value, $key) use (&$group_array) { |
|
136 | - $group_array[ $key ][] = $value; |
|
135 | + function($value, $key) use (&$group_array) { |
|
136 | + $group_array[$key][] = $value; |
|
137 | 137 | } |
138 | 138 | ); |
139 | 139 | } |
@@ -173,14 +173,14 @@ discard block |
||
173 | 173 | } |
174 | 174 | if ( ! is_array($value)) { |
175 | 175 | if ($key != $value) { |
176 | - $result[ $key ] = $value; |
|
176 | + $result[$key] = $value; |
|
177 | 177 | $count++; |
178 | 178 | } |
179 | 179 | } else { |
180 | 180 | $sub = array_filter_recursive($value, $value, $limit); |
181 | 181 | if (count($sub) > 0) { |
182 | 182 | if ($key != $value) { |
183 | - $result[ $key ] = $sub; |
|
183 | + $result[$key] = $sub; |
|
184 | 184 | $count += count($sub); |
185 | 185 | } |
186 | 186 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if (is_array($value)) { |
276 | 276 | $flat_array = array_merge($flat_array, array_flatten($value)); |
277 | 277 | } else { |
278 | - $flat_array[ $key ] = $value; |
|
278 | + $flat_array[$key] = $value; |
|
279 | 279 | } |
280 | 280 | } |
281 | 281 | |
@@ -314,10 +314,10 @@ discard block |
||
314 | 314 | |
315 | 315 | $prices = []; |
316 | 316 | for ($i = 0; $i < count($ranges); $i++) { |
317 | - if ($ranges[ $i ] == $max) { |
|
317 | + if ($ranges[$i] == $max) { |
|
318 | 318 | break; |
319 | 319 | } else { |
320 | - $prices[ $ranges[ $i ] ] = ($ranges[ $i + 1 ] == 0) ? $ranges[ $i ] * 2 : $ranges[ $i + 1 ]; |
|
320 | + $prices[$ranges[$i]] = ($ranges[$i + 1] == 0) ? $ranges[$i] * 2 : $ranges[$i + 1]; |
|
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | $date_range = []; |
347 | 347 | for ($i = 0; $i < $days; $i++) { |
348 | - $date_range[ $i ] = $start_date + ($i * 24 * 60 * 60); |
|
348 | + $date_range[$i] = $start_date + ($i * 24 * 60 * 60); |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | return $date_range; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $years = []; |
373 | 373 | |
374 | 374 | foreach (range($min, $max, $step) as $year) { |
375 | - $years[ $year ] = $year; |
|
375 | + $years[$year] = $year; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | return $years; |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | } |
482 | 482 | |
483 | 483 | foreach ($string as $key => $val) { |
484 | - $string[ $key ] = str_strip_slashes($val); |
|
484 | + $string[$key] = str_strip_slashes($val); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | return $string; |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | { |
621 | 621 | preg_match('/(.+)' . $separator . '([0-9]+)$/', $string, $match); |
622 | 622 | |
623 | - return isset($match[ 2 ]) ? $match[ 1 ] . $separator . ($match[ 2 ] + 1) : $string . $separator . $first; |
|
623 | + return isset($match[2]) ? $match[1] . $separator . ($match[2] + 1) : $string . $separator . $first; |
|
624 | 624 | } |
625 | 625 | } |
626 | 626 | |
@@ -648,7 +648,7 @@ discard block |
||
648 | 648 | |
649 | 649 | $args = func_get_args(); |
650 | 650 | |
651 | - return $args[ ($i++ % count($args)) ]; |
|
651 | + return $args[($i++ % count($args))]; |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
@@ -784,8 +784,8 @@ discard block |
||
784 | 784 | function str_entities_to_ascii($string, $all = true) |
785 | 785 | { |
786 | 786 | if (preg_match_all('/\&#(\d+)\;/', $string, $matches)) { |
787 | - for ($i = 0, $s = count($matches[ 0 ]); $i < $s; $i++) { |
|
788 | - $digits = $matches[ 1 ][ $i ]; |
|
787 | + for ($i = 0, $s = count($matches[0]); $i < $s; $i++) { |
|
788 | + $digits = $matches[1][$i]; |
|
789 | 789 | $out = ''; |
790 | 790 | |
791 | 791 | if ($digits < 128) { |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | . chr(128 + ($digits % 64)); |
800 | 800 | } |
801 | 801 | |
802 | - $string = str_replace($matches[ 0 ][ $i ], $out, $string); |
|
802 | + $string = str_replace($matches[0][$i], $out, $string); |
|
803 | 803 | } |
804 | 804 | } |
805 | 805 | |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | { |
833 | 833 | $out = ''; |
834 | 834 | for ($i = 0, $s = strlen($string) - 1, $count = 1, $temp = []; $i <= $s; $i++) { |
835 | - $ordinal = ord($string[ $i ]); |
|
835 | + $ordinal = ord($string[$i]); |
|
836 | 836 | |
837 | 837 | if ($ordinal < 128) { |
838 | 838 | /* |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | $count = 1; |
845 | 845 | } |
846 | 846 | |
847 | - $out .= $string[ $i ]; |
|
847 | + $out .= $string[$i]; |
|
848 | 848 | } else { |
849 | 849 | if (count($temp) === 0) { |
850 | 850 | $count = ($ordinal < 224) ? 2 : 3; |
@@ -854,8 +854,8 @@ discard block |
||
854 | 854 | |
855 | 855 | if (count($temp) === $count) { |
856 | 856 | $number = ($count === 3) |
857 | - ? (($temp[ 0 ] % 16) * 4096) + (($temp[ 1 ] % 64) * 64) + ($temp[ 2 ] % 64) |
|
858 | - : (($temp[ 0 ] % 32) * 64) + ($temp[ 1 ] % 64); |
|
857 | + ? (($temp[0] % 16) * 4096) + (($temp[1] % 64) * 64) + ($temp[2] % 64) |
|
858 | + : (($temp[0] % 32) * 64) + ($temp[1] % 64); |
|
859 | 859 | |
860 | 860 | $out .= '&#' . $number . ';'; |
861 | 861 | $count = 1; |
@@ -1557,10 +1557,12 @@ |
||
1557 | 1557 | } |
1558 | 1558 | $range[] = $from->format($format); |
1559 | 1559 | |
1560 | - if (is_int($arg)) // Day intervals |
|
1560 | + if (is_int($arg)) { |
|
1561 | + // Day intervals |
|
1561 | 1562 | { |
1562 | 1563 | do { |
1563 | 1564 | $from->modify('+1 day'); |
1565 | + } |
|
1564 | 1566 | $range[] = $from->format($format); |
1565 | 1567 | } while (--$arg > 0); |
1566 | 1568 | } else // end date UNIX timestamp |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | if ($diff->$key) { |
286 | 286 | $value = $diff->$key . ' ' . $value . ($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : ''); |
287 | 287 | } else { |
288 | - unset($string[ $key ]); |
|
288 | + unset($string[$key]); |
|
289 | 289 | } |
290 | 290 | } |
291 | 291 | |
@@ -319,8 +319,8 @@ discard block |
||
319 | 319 | function dates_between($start_date, $end_date, $format = 'Y-m-d') |
320 | 320 | { |
321 | 321 | $day = 60 * 60 * 24; |
322 | - $start_date = (! is_numeric($start_date) ? strtotime($start_date) : $start_date); |
|
323 | - $end_date = (! is_numeric($end_date) ? strtotime($end_date) : $end_date); |
|
322 | + $start_date = ( ! is_numeric($start_date) ? strtotime($start_date) : $start_date); |
|
323 | + $end_date = ( ! is_numeric($end_date) ? strtotime($end_date) : $end_date); |
|
324 | 324 | |
325 | 325 | $days_diff = round( |
326 | 326 | ($end_date - $start_date) / $day |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $time_12 = date("h:i a", strtotime($hours)); |
377 | 377 | $time_24 = $hours; |
378 | 378 | if ($mode == 12) { |
379 | - $time[ $time_12 ] = $time_12; |
|
379 | + $time[$time_12] = $time_12; |
|
380 | 380 | } elseif ($mode == 24) { |
381 | - $time[ $time_24 ] = $time_24; |
|
381 | + $time[$time_24] = $time_24; |
|
382 | 382 | } |
383 | 383 | } |
384 | 384 | } |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | */ |
466 | 466 | function is_weekend($date) |
467 | 467 | { |
468 | - $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
468 | + $date = ( ! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
469 | 469 | $date = date('D', $date); |
470 | 470 | |
471 | 471 | if ($date == 'Sat' OR $date == 'Sun') { |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | */ |
490 | 490 | function is_weekday($date) |
491 | 491 | { |
492 | - $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
492 | + $date = ( ! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); |
|
493 | 493 | $date = date('D', $date); |
494 | 494 | |
495 | 495 | if ( ! in_array($date, ['Sat', 'Sun'])) { |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | */ |
516 | 516 | function get_age($birthday, $return = 'years') |
517 | 517 | { |
518 | - $birthday = (! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); |
|
518 | + $birthday = ( ! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); |
|
519 | 519 | |
520 | 520 | $birthday = new DateTime(date('Y-m-d', $birthday)); |
521 | 521 | $now = new DateTime(date('Y-m-d')); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | ]; |
531 | 531 | |
532 | 532 | if (array_key_exists($return, $available)) { |
533 | - return $interval->{$available[ $return ]}; |
|
533 | + return $interval->{$available[$return]}; |
|
534 | 534 | } elseif (isset($interval->{$return})) { |
535 | 535 | return $interval->{$return}; |
536 | 536 | } |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | } |
617 | 617 | foreach ($periods as $period => $seconds_in_period) { |
618 | 618 | if ($seconds >= $seconds_in_period) { |
619 | - $durations[ $period ] = floor($seconds / $seconds_in_period); |
|
620 | - $seconds -= $durations[ $period ] * $seconds_in_period; |
|
619 | + $durations[$period] = floor($seconds / $seconds_in_period); |
|
620 | + $seconds -= $durations[$period] * $seconds_in_period; |
|
621 | 621 | } |
622 | 622 | } |
623 | 623 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | */ |
673 | 673 | function add_time_duration($start_time, $duration, $return = 'time') |
674 | 674 | { |
675 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
675 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
676 | 676 | $duration = $duration * 60 * 60; // (x) hours * 60 minutes * 60 seconds |
677 | 677 | |
678 | 678 | $add_time = $start_time + $duration; |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | */ |
701 | 701 | function calculate_hours($start_time, $end_time, $return = 'time') |
702 | 702 | { |
703 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
704 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
703 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
704 | + $end_time = ( ! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
705 | 705 | |
706 | 706 | // Times Difference |
707 | 707 | $difference = $end_time - $start_time; |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | */ |
745 | 745 | function time_difference($start_time, $end_time, $return = 'array') |
746 | 746 | { |
747 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
748 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
747 | + $start_time = ( ! is_numeric($start_time) ? strtotime($start_time) : $start_time); |
|
748 | + $end_time = ( ! is_numeric($end_time) ? strtotime($end_time) : $end_time); |
|
749 | 749 | |
750 | 750 | // Times Difference |
751 | 751 | $difference = $end_time - $start_time; |
@@ -879,12 +879,12 @@ discard block |
||
879 | 879 | $seconds -= $minutes * 60; |
880 | 880 | } |
881 | 881 | |
882 | - $format[ 'days' ] = $days; |
|
883 | - $format[ 'years' ] = $years; |
|
884 | - $format[ 'months' ] = $months; |
|
885 | - $format[ 'hours' ] = $hours; |
|
886 | - $format[ 'minutes' ] = $minutes; |
|
887 | - $format[ 'seconds' ] = $seconds; |
|
882 | + $format['days'] = $days; |
|
883 | + $format['years'] = $years; |
|
884 | + $format['months'] = $months; |
|
885 | + $format['hours'] = $hours; |
|
886 | + $format['minutes'] = $minutes; |
|
887 | + $format['seconds'] = $seconds; |
|
888 | 888 | |
889 | 889 | return new \O2System\Spl\DataStructures\SplArrayObject($format); |
890 | 890 | } |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | |
1144 | 1144 | $days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; |
1145 | 1145 | |
1146 | - return $days_in_month[ $month - 1 ]; |
|
1146 | + return $days_in_month[$month - 1]; |
|
1147 | 1147 | } |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1317,9 +1317,9 @@ discard block |
||
1317 | 1317 | if (isset($ampm)) { |
1318 | 1318 | $ampm = strtolower($ampm); |
1319 | 1319 | |
1320 | - if ($ampm[ 0 ] === 'p' && $hour < 12) { |
|
1320 | + if ($ampm[0] === 'p' && $hour < 12) { |
|
1321 | 1321 | $hour += 12; |
1322 | - } elseif ($ampm[ 0 ] === 'a' && $hour === 12) { |
|
1322 | + } elseif ($ampm[0] === 'a' && $hour === 12) { |
|
1323 | 1323 | $hour = 0; |
1324 | 1324 | } |
1325 | 1325 | } |
@@ -1365,12 +1365,12 @@ discard block |
||
1365 | 1365 | |
1366 | 1366 | // Date Like: YYYYMMDD |
1367 | 1367 | if (preg_match('/^(\d{2})\d{2}(\d{4})$/i', $bad_date, $matches)) { |
1368 | - return date($format, strtotime($matches[ 1 ] . '/01/' . $matches[ 2 ])); |
|
1368 | + return date($format, strtotime($matches[1] . '/01/' . $matches[2])); |
|
1369 | 1369 | } |
1370 | 1370 | |
1371 | 1371 | // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) |
1372 | 1372 | if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) { |
1373 | - return date($format, strtotime($matches[ 3 ] . '-' . $matches[ 1 ] . '-' . $matches[ 2 ])); |
|
1373 | + return date($format, strtotime($matches[3] . '-' . $matches[1] . '-' . $matches[2])); |
|
1374 | 1374 | } |
1375 | 1375 | |
1376 | 1376 | // Any other kind of string, when converted into UNIX time, |
@@ -1450,7 +1450,7 @@ discard block |
||
1450 | 1450 | return $zones; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | - return isset($zones[ $timezone ]) ? $zones[ $timezone ] : 0; |
|
1453 | + return isset($zones[$timezone]) ? $zones[$timezone] : 0; |
|
1454 | 1454 | } |
1455 | 1455 | } |
1456 | 1456 | |
@@ -1537,7 +1537,7 @@ discard block |
||
1537 | 1537 | * the end date might actually be less than 24 hours away from the previously |
1538 | 1538 | * generated DateTime object, but either way - we have to append it manually. |
1539 | 1539 | */ |
1540 | - if ( ! is_int($arg) && $range[ count($range) - 1 ] !== $arg->format($format)) { |
|
1540 | + if ( ! is_int($arg) && $range[count($range) - 1] !== $arg->format($format)) { |
|
1541 | 1541 | $range[] = $arg->format($format); |
1542 | 1542 | } |
1543 | 1543 |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | $return = explode("\n", wordwrap(strrev($text), $col_length)); |
52 | 52 | |
53 | 53 | if (count($return) > $cols) { |
54 | - $return[ $cols - 1 ] .= " " . $return[ $cols ]; |
|
55 | - unset($return[ $cols ]); |
|
54 | + $return[$cols - 1] .= " " . $return[$cols]; |
|
55 | + unset($return[$cols]); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $return = array_map("strrev", $return); |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $return = wordwrap($return, $chars, "\n"); |
87 | 87 | preg_match("/(.+\n?){0,$lines}/", $return, $regs); |
88 | 88 | |
89 | - return $regs[ 0 ]; |
|
89 | + return $regs[0]; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | // ------------------------------------------------------------------------ |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | |
142 | 142 | preg_match('/^\s*+(?:\S++\s*+){1,' . (int)$limit . '}/', $str, $matches); |
143 | 143 | |
144 | - if (strlen($str) === strlen($matches[ 0 ])) { |
|
144 | + if (strlen($str) === strlen($matches[0])) { |
|
145 | 145 | $end_char = ''; |
146 | 146 | } |
147 | 147 | |
148 | - return rtrim($matches[ 0 ]) . $end_char; |
|
148 | + return rtrim($matches[0]) . $end_char; |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 | |
@@ -299,9 +299,9 @@ discard block |
||
299 | 299 | // strip the entire chunk and replace it with a marker. |
300 | 300 | $unwrap = []; |
301 | 301 | if (preg_match_all('|\{unwrap\}(.+?)\{/unwrap\}|s', $string, $matches)) { |
302 | - for ($i = 0, $c = count($matches[ 0 ]); $i < $c; $i++) { |
|
303 | - $unwrap[] = $matches[ 1 ][ $i ]; |
|
304 | - $string = str_replace($matches[ 0 ][ $i ], '{{unwrapped' . $i . '}}', $string); |
|
302 | + for ($i = 0, $c = count($matches[0]); $i < $c; $i++) { |
|
303 | + $unwrap[] = $matches[1][$i]; |
|
304 | + $string = str_replace($matches[0][$i], '{{unwrapped' . $i . '}}', $string); |
|
305 | 305 | } |
306 | 306 | } |
307 | 307 |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | { |
56 | 56 | preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $source_code, $matches); |
57 | 57 | |
58 | - return str_replace($matches[ 0 ], $matches[ 1 ], $source_code); |
|
58 | + return str_replace($matches[0], $matches[1], $source_code); |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | // ------------------------------------------------------------------------ |
@@ -106,46 +106,46 @@ discard block |
||
106 | 106 | if (strlen($allowed_tags) > 0) { |
107 | 107 | $k = explode('|', $allowed_tags); |
108 | 108 | for ($i = 0; $i < count($k); $i++) { |
109 | - $source_code = str_replace('<' . $k[ $i ], '[{(' . $k[ $i ], $source_code); |
|
110 | - $source_code = str_replace('</' . $k[ $i ], '[{(/' . $k[ $i ], $source_code); |
|
109 | + $source_code = str_replace('<' . $k[$i], '[{(' . $k[$i], $source_code); |
|
110 | + $source_code = str_replace('</' . $k[$i], '[{(/' . $k[$i], $source_code); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | //begin removal |
114 | 114 | //remove comment blocks |
115 | 115 | while (stripos($source_code, '<!--') > 0) { |
116 | - $pos[ 1 ] = stripos($source_code, '<!--'); |
|
117 | - $pos[ 2 ] = stripos($source_code, '-->', $pos[ 1 ]); |
|
118 | - $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 3; |
|
119 | - $x = substr($source_code, $pos[ 1 ], $len[ 1 ]); |
|
116 | + $pos[1] = stripos($source_code, '<!--'); |
|
117 | + $pos[2] = stripos($source_code, '-->', $pos[1]); |
|
118 | + $len[1] = $pos[2] - $pos[1] + 3; |
|
119 | + $x = substr($source_code, $pos[1], $len[1]); |
|
120 | 120 | $source_code = str_replace($x, '', $source_code); |
121 | 121 | } |
122 | 122 | //remove tags with content between them |
123 | 123 | if (strlen($disallowed_tags) > 0) { |
124 | 124 | $e = explode('|', $disallowed_tags); |
125 | 125 | for ($i = 0; $i < count($e); $i++) { |
126 | - while (stripos($source_code, '<' . $e[ $i ]) > 0) { |
|
127 | - $len[ 1 ] = strlen('<' . $e[ $i ]); |
|
128 | - $pos[ 1 ] = stripos($source_code, '<' . $e[ $i ]); |
|
129 | - $pos[ 2 ] = stripos($source_code, $e[ $i ] . '>', $pos[ 1 ] + $len[ 1 ]); |
|
130 | - $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ]; |
|
131 | - $x = substr($source_code, $pos[ 1 ], $len[ 2 ]); |
|
126 | + while (stripos($source_code, '<' . $e[$i]) > 0) { |
|
127 | + $len[1] = strlen('<' . $e[$i]); |
|
128 | + $pos[1] = stripos($source_code, '<' . $e[$i]); |
|
129 | + $pos[2] = stripos($source_code, $e[$i] . '>', $pos[1] + $len[1]); |
|
130 | + $len[2] = $pos[2] - $pos[1] + $len[1]; |
|
131 | + $x = substr($source_code, $pos[1], $len[2]); |
|
132 | 132 | $source_code = str_replace($x, '', $source_code); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | 136 | //remove remaining tags |
137 | 137 | while (stripos($source_code, '<') > 0) { |
138 | - $pos[ 1 ] = stripos($source_code, '<'); |
|
139 | - $pos[ 2 ] = stripos($source_code, '>', $pos[ 1 ]); |
|
140 | - $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1; |
|
141 | - $x = substr($source_code, $pos[ 1 ], $len[ 1 ]); |
|
138 | + $pos[1] = stripos($source_code, '<'); |
|
139 | + $pos[2] = stripos($source_code, '>', $pos[1]); |
|
140 | + $len[1] = $pos[2] - $pos[1] + 1; |
|
141 | + $x = substr($source_code, $pos[1], $len[1]); |
|
142 | 142 | $source_code = str_replace($x, '', $source_code); |
143 | 143 | } |
144 | 144 | //finalize keep tag |
145 | 145 | if (strlen($allowed_tags) > 0) { |
146 | 146 | for ($i = 0; $i < count($k); $i++) { |
147 | - $source_code = str_replace('[{(' . $k[ $i ], '<' . $k[ $i ], $source_code); |
|
148 | - $source_code = str_replace('[{(/' . $k[ $i ], '</' . $k[ $i ], $source_code); |
|
147 | + $source_code = str_replace('[{(' . $k[$i], '<' . $k[$i], $source_code); |
|
148 | + $source_code = str_replace('[{(/' . $k[$i], '</' . $k[$i], $source_code); |
|
149 | 149 | } |
150 | 150 | } |
151 | 151 |