| @@ -97,14 +97,14 @@ discard block | ||
| 97 | 97 | public function optionPath($path) | 
| 98 | 98 |      { | 
| 99 | 99 | $path = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $path); | 
| 100 | - $path = PATH_ROOT . str_replace(PATH_ROOT, '', $path); | |
| 100 | + $path = PATH_ROOT.str_replace(PATH_ROOT, '', $path); | |
| 101 | 101 | |
| 102 | 102 |          if (pathinfo($path, PATHINFO_EXTENSION)) { | 
| 103 | 103 | $this->optionFilename(pathinfo($path, PATHINFO_FILENAME)); | 
| 104 | 104 | $path = dirname($path); | 
| 105 | 105 | } | 
| 106 | 106 | |
| 107 | - $this->optionPath = rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; | |
| 107 | + $this->optionPath = rtrim($path, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; | |
| 108 | 108 | } | 
| 109 | 109 | |
| 110 | 110 | // ------------------------------------------------------------------------ | 
| @@ -117,7 +117,7 @@ discard block | ||
| 117 | 117 | public function optionFilename($name) | 
| 118 | 118 |      { | 
| 119 | 119 |          $name = str_replace('.php', '', $name); | 
| 120 | - $this->optionFilename = prepare_filename($name) . '.php'; | |
| 120 | + $this->optionFilename = prepare_filename($name).'.php'; | |
| 121 | 121 | |
| 122 | 122 | $this->optionPath = empty($this->optionPath) ? modules()->current()->getRealPath() : $this->optionPath; | 
| 123 | 123 | } | 
| @@ -156,7 +156,7 @@ discard block | ||
| 156 | 156 | public function getPhpTemplateFile($filename) | 
| 157 | 157 |      { | 
| 158 | 158 | $directories = [ | 
| 159 | - PATH_FRAMEWORK . 'Config' . DIRECTORY_SEPARATOR . 'PhpTemplateFiles', | |
| 159 | + PATH_FRAMEWORK.'Config'.DIRECTORY_SEPARATOR.'PhpTemplateFiles', | |
| 160 | 160 | ]; | 
| 161 | 161 | |
| 162 | 162 | } | 
| @@ -114,7 +114,7 @@ discard block | ||
| 114 | 114 | public function addNamespace($namespace, $baseDirectory, $prepend = false) | 
| 115 | 115 |      { | 
| 116 | 116 | // normalize namespace prefix | 
| 117 | - $namespace = trim($namespace, '\\') . '\\'; | |
| 117 | + $namespace = trim($namespace, '\\').'\\'; | |
| 118 | 118 | |
| 119 | 119 |          if (empty($namespace) OR $namespace === '\\') { | 
| 120 | 120 | return; | 
| @@ -122,24 +122,24 @@ discard block | ||
| 122 | 122 | |
| 123 | 123 | // normalize the base directory with a trailing separator | 
| 124 | 124 | $baseDirectory = str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $baseDirectory); | 
| 125 | - $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; | |
| 125 | + $baseDirectory = rtrim($baseDirectory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; | |
| 126 | 126 | |
| 127 | 127 |          if (is_dir($baseDirectory)) { | 
| 128 | 128 | // initialize the namespace prefix array | 
| 129 | -            if (isset($this->namespaceDirs[ $namespace ]) === false) { | |
| 130 | - $this->namespaceDirs[ $namespace ] = []; | |
| 129 | +            if (isset($this->namespaceDirs[$namespace]) === false) { | |
| 130 | + $this->namespaceDirs[$namespace] = []; | |
| 131 | 131 | } | 
| 132 | 132 | |
| 133 | 133 | // retain the base directory for the namespace prefix | 
| 134 | -            if ( ! in_array($baseDirectory, $this->namespaceDirs[ $namespace ])) { | |
| 134 | +            if (!in_array($baseDirectory, $this->namespaceDirs[$namespace])) { | |
| 135 | 135 |                  if ($prepend) { | 
| 136 | - array_unshift($this->namespaceDirs[ $namespace ], $baseDirectory); | |
| 136 | + array_unshift($this->namespaceDirs[$namespace], $baseDirectory); | |
| 137 | 137 |                  } else { | 
| 138 | - array_push($this->namespaceDirs[ $namespace ], $baseDirectory); | |
| 138 | + array_push($this->namespaceDirs[$namespace], $baseDirectory); | |
| 139 | 139 | } | 
| 140 | 140 | } | 
| 141 | 141 | |
| 142 | - $this->namespaceDirsMap[ $baseDirectory ] = $namespace; | |
| 142 | + $this->namespaceDirsMap[$baseDirectory] = $namespace; | |
| 143 | 143 | |
| 144 | 144 | // Register Namespace Language | 
| 145 | 145 | language()->addFilePath($baseDirectory); | 
| @@ -148,8 +148,8 @@ discard block | ||
| 148 | 148 | output()->addFilePath($baseDirectory); | 
| 149 | 149 | |
| 150 | 150 | // Autoload Composer | 
| 151 | -            if (is_file($baseDirectory . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) { | |
| 152 | - require($baseDirectory . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'); | |
| 151 | +            if (is_file($baseDirectory.'vendor'.DIRECTORY_SEPARATOR.'autoload.php')) { | |
| 152 | + require($baseDirectory.'vendor'.DIRECTORY_SEPARATOR.'autoload.php'); | |
| 153 | 153 | } | 
| 154 | 154 | } | 
| 155 | 155 | } | 
| @@ -170,10 +170,10 @@ discard block | ||
| 170 | 170 | $dir = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $dir); | 
| 171 | 171 | |
| 172 | 172 | $dir = realpath($dir); | 
| 173 | - $dir = rtrim($dir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; | |
| 173 | + $dir = rtrim($dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; | |
| 174 | 174 | |
| 175 | 175 |          if (array_key_exists($dir, $this->namespaceDirsMap)) { | 
| 176 | - return $this->namespaceDirsMap[ $dir ]; | |
| 176 | + return $this->namespaceDirsMap[$dir]; | |
| 177 | 177 | } | 
| 178 | 178 | |
| 179 | 179 | return false; | 
| @@ -211,10 +211,10 @@ discard block | ||
| 211 | 211 | */ | 
| 212 | 212 | public function getNamespaceDirs($namespace) | 
| 213 | 213 |      { | 
| 214 | - $namespace = trim($namespace, '\\') . '\\'; | |
| 214 | + $namespace = trim($namespace, '\\').'\\'; | |
| 215 | 215 | |
| 216 | 216 |          if (array_key_exists($namespace, $this->namespaceDirs)) { | 
| 217 | - return $this->namespaceDirs[ $namespace ]; | |
| 217 | + return $this->namespaceDirs[$namespace]; | |
| 218 | 218 | } | 
| 219 | 219 | |
| 220 | 220 | return false; | 
| @@ -237,29 +237,29 @@ discard block | ||
| 237 | 237 | } | 
| 238 | 238 | |
| 239 | 239 |          if ($this->requireFile($helper)) { | 
| 240 | - $this->loadedHelpers[ pathinfo($helper, PATHINFO_FILENAME) ][] = $helper; | |
| 240 | + $this->loadedHelpers[pathinfo($helper, PATHINFO_FILENAME)][] = $helper; | |
| 241 | 241 | |
| 242 | 242 | return; | 
| 243 | 243 | } | 
| 244 | 244 | |
| 245 | 245 | $helperDirectories = [ | 
| 246 | - PATH_KERNEL . 'Helpers' . DIRECTORY_SEPARATOR, | |
| 247 | - PATH_FRAMEWORK . 'Helpers' . DIRECTORY_SEPARATOR, | |
| 248 | - PATH_APP . 'Helpers' . DIRECTORY_SEPARATOR, | |
| 246 | + PATH_KERNEL.'Helpers'.DIRECTORY_SEPARATOR, | |
| 247 | + PATH_FRAMEWORK.'Helpers'.DIRECTORY_SEPARATOR, | |
| 248 | + PATH_APP.'Helpers'.DIRECTORY_SEPARATOR, | |
| 249 | 249 | ]; | 
| 250 | 250 | |
| 251 | -        if ( ! array_key_exists($helper, $this->loadedHelpers)) { | |
| 252 | - $this->loadedHelpers[ $helper ] = []; | |
| 251 | +        if (!array_key_exists($helper, $this->loadedHelpers)) { | |
| 252 | + $this->loadedHelpers[$helper] = []; | |
| 253 | 253 | } | 
| 254 | 254 | |
| 255 | 255 |          foreach ($helperDirectories as $helperDirectory) { | 
| 256 | 256 | |
| 257 | - $helperFilePath = $helperDirectory . studlycase($helper) . '.php'; | |
| 257 | + $helperFilePath = $helperDirectory.studlycase($helper).'.php'; | |
| 258 | 258 | |
| 259 | -            if (in_array($helperFilePath, $this->loadedHelpers[ $helper ])) { | |
| 259 | +            if (in_array($helperFilePath, $this->loadedHelpers[$helper])) { | |
| 260 | 260 | continue; | 
| 261 | 261 |              } elseif ($this->requireFile($helperFilePath)) { | 
| 262 | - $this->loadedHelpers[ $helper ][] = $helperFilePath; | |
| 262 | + $this->loadedHelpers[$helper][] = $helperFilePath; | |
| 263 | 263 | } | 
| 264 | 264 | } | 
| 265 | 265 | } | 
| @@ -335,12 +335,12 @@ discard block | ||
| 335 | 335 | public function loadMappedFile($namespace, $relativeClass) | 
| 336 | 336 |      { | 
| 337 | 337 | // are there any base directories for this namespace prefix? | 
| 338 | -        if (isset($this->namespaceDirs[ $namespace ]) === false) { | |
| 338 | +        if (isset($this->namespaceDirs[$namespace]) === false) { | |
| 339 | 339 | return false; | 
| 340 | 340 | } | 
| 341 | 341 | |
| 342 | 342 | // look through base directories for this namespace prefix | 
| 343 | -        foreach ($this->namespaceDirs[ $namespace ] as $namespaceDirectory) { | |
| 343 | +        foreach ($this->namespaceDirs[$namespace] as $namespaceDirectory) { | |
| 344 | 344 | |
| 345 | 345 | // replace the namespace prefix with the base directory, | 
| 346 | 346 | // replace namespace separators with directory separators | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | */ | 
| 11 | 11 | // ------------------------------------------------------------------------ | 
| 12 | 12 | |
| 13 | -if ( ! function_exists('timestamp')) { | |
| 13 | +if (!function_exists('timestamp')) { | |
| 14 | 14 | /** | 
| 15 | 15 | * Timestamp | 
| 16 | 16 | * | 
| @@ -22,7 +22,7 @@ discard block | ||
| 22 | 22 | */ | 
| 23 | 23 | function timestamp($timestamp = null) | 
| 24 | 24 |      { | 
| 25 | -        if ( ! isset($timestamp) OR $timestamp === 'NOW') { | |
| 25 | +        if (!isset($timestamp) OR $timestamp === 'NOW') { | |
| 26 | 26 | $timestamp = now(); | 
| 27 | 27 |          } elseif (is_string($timestamp)) { | 
| 28 | 28 | $timestamp = strtotime($timestamp); | 
| @@ -33,7 +33,7 @@ discard block | ||
| 33 | 33 | } | 
| 34 | 34 | // ------------------------------------------------------------------------ | 
| 35 | 35 | |
| 36 | -if ( ! function_exists('unix_timestamp')) { | |
| 36 | +if (!function_exists('unix_timestamp')) { | |
| 37 | 37 | /** | 
| 38 | 38 | * Unix Timestamp | 
| 39 | 39 | * | 
| @@ -45,7 +45,7 @@ discard block | ||
| 45 | 45 | */ | 
| 46 | 46 | function unix_timestamp($timestamp = null) | 
| 47 | 47 |      { | 
| 48 | -        if ( ! isset($timestamp) OR $timestamp === 'NOW') { | |
| 48 | +        if (!isset($timestamp) OR $timestamp === 'NOW') { | |
| 49 | 49 | return now(); | 
| 50 | 50 |          } elseif (is_string($timestamp)) { | 
| 51 | 51 | return strtotime($timestamp); | 
| @@ -59,7 +59,7 @@ discard block | ||
| 59 | 59 | |
| 60 | 60 | // ------------------------------------------------------------------------ | 
| 61 | 61 | |
| 62 | -if ( ! function_exists('format_date')) { | |
| 62 | +if (!function_exists('format_date')) { | |
| 63 | 63 | /** | 
| 64 | 64 | * Day Date Time Functions | 
| 65 | 65 | * | 
| @@ -91,7 +91,7 @@ discard block | ||
| 91 | 91 | $output = $format; | 
| 92 | 92 | |
| 93 | 93 |          foreach ($date as $replace => $value) { | 
| 94 | -            $output = str_ireplace('%' . $replace, $value, $output); | |
| 94 | +            $output = str_ireplace('%'.$replace, $value, $output); | |
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 | return $output; | 
| @@ -99,7 +99,7 @@ discard block | ||
| 99 | 99 | } | 
| 100 | 100 | // ------------------------------------------------------------------------ | 
| 101 | 101 | |
| 102 | -if ( ! function_exists('parse_date')) { | |
| 102 | +if (!function_exists('parse_date')) { | |
| 103 | 103 | /** | 
| 104 | 104 | * Parse Date into Array | 
| 105 | 105 | * | 
| @@ -153,7 +153,7 @@ discard block | ||
| 153 | 153 | } | 
| 154 | 154 | // ------------------------------------------------------------------------ | 
| 155 | 155 | |
| 156 | -if ( ! function_exists('day_name')) { | |
| 156 | +if (!function_exists('day_name')) { | |
| 157 | 157 | /** | 
| 158 | 158 | * Day Name in Languages | 
| 159 | 159 | * | 
| @@ -176,12 +176,12 @@ discard block | ||
| 176 | 176 | |
| 177 | 177 |          language()->loadFile('calendar'); | 
| 178 | 178 | |
| 179 | -        return language()->getLine(strtoupper('CAL_' . date($type, $timestamp))); | |
| 179 | +        return language()->getLine(strtoupper('CAL_'.date($type, $timestamp))); | |
| 180 | 180 | } | 
| 181 | 181 | } | 
| 182 | 182 | // ------------------------------------------------------------------------ | 
| 183 | 183 | |
| 184 | -if ( ! function_exists('month_name')) { | |
| 184 | +if (!function_exists('month_name')) { | |
| 185 | 185 | /** | 
| 186 | 186 | * Month Name in Languages | 
| 187 | 187 | * | 
| @@ -203,12 +203,12 @@ discard block | ||
| 203 | 203 | ))); | 
| 204 | 204 |          language()->loadFile('calendar'); | 
| 205 | 205 | |
| 206 | -        return language()->getLine(strtoupper('CAL_' . date($type, $timestamp))); | |
| 206 | +        return language()->getLine(strtoupper('CAL_'.date($type, $timestamp))); | |
| 207 | 207 | } | 
| 208 | 208 | } | 
| 209 | 209 | // ------------------------------------------------------------------------ | 
| 210 | 210 | |
| 211 | -if ( ! function_exists('part_time')) { | |
| 211 | +if (!function_exists('part_time')) { | |
| 212 | 212 | /** | 
| 213 | 213 | * Part Time in Languages | 
| 214 | 214 | * | 
| @@ -254,7 +254,7 @@ discard block | ||
| 254 | 254 | } | 
| 255 | 255 | // ------------------------------------------------------------------------ | 
| 256 | 256 | |
| 257 | -if ( ! function_exists('string_time_elapsed')) { | |
| 257 | +if (!function_exists('string_time_elapsed')) { | |
| 258 | 258 | /** | 
| 259 | 259 | * Day Date Time in String Format | 
| 260 | 260 | * | 
| @@ -292,25 +292,25 @@ discard block | ||
| 292 | 292 | |
| 293 | 293 |          foreach ($string as $key => &$value) { | 
| 294 | 294 |              if ($diff->$key) { | 
| 295 | - $value = $diff->$key . ' ' . $value . ($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : ''); | |
| 295 | + $value = $diff->$key.' '.$value.($diff->$key > 1 && language()->getDefaultLocale() === 'en' ? 's' : ''); | |
| 296 | 296 |              } else { | 
| 297 | - unset($string[ $key ]); | |
| 297 | + unset($string[$key]); | |
| 298 | 298 | } | 
| 299 | 299 | } | 
| 300 | 300 | |
| 301 | -        if ( ! $full) { | |
| 301 | +        if (!$full) { | |
| 302 | 302 | $string = array_slice($string, 0, 1); | 
| 303 | 303 | } | 
| 304 | 304 | |
| 305 | 305 |          return $string ? implode(', ', | 
| 306 | -                $string) . ' ' . language()->getLine('DATE_AGO') : language()->getLine('DATE_JUST_NOW'); | |
| 306 | +                $string).' '.language()->getLine('DATE_AGO') : language()->getLine('DATE_JUST_NOW'); | |
| 307 | 307 | |
| 308 | 308 | } | 
| 309 | 309 | } | 
| 310 | 310 | |
| 311 | 311 | // ------------------------------------------------------------------------ | 
| 312 | 312 | |
| 313 | -if ( ! function_exists('dates_between')) { | |
| 313 | +if (!function_exists('dates_between')) { | |
| 314 | 314 | /** | 
| 315 | 315 | * Date Between | 
| 316 | 316 | * | 
| @@ -327,8 +327,8 @@ discard block | ||
| 327 | 327 | function dates_between($start_date, $end_date, $format = 'Y-m-d') | 
| 328 | 328 |      { | 
| 329 | 329 | $day = 60 * 60 * 24; | 
| 330 | - $start_date = (! is_numeric($start_date) ? strtotime($start_date) : $start_date); | |
| 331 | - $end_date = (! is_numeric($end_date) ? strtotime($end_date) : $end_date); | |
| 330 | + $start_date = (!is_numeric($start_date) ? strtotime($start_date) : $start_date); | |
| 331 | + $end_date = (!is_numeric($end_date) ? strtotime($end_date) : $end_date); | |
| 332 | 332 | |
| 333 | 333 | $days_diff = round( | 
| 334 | 334 | ($end_date - $start_date) / $day | 
| @@ -362,7 +362,7 @@ discard block | ||
| 362 | 362 | |
| 363 | 363 | // ------------------------------------------------------------------------ | 
| 364 | 364 | |
| 365 | -if ( ! function_exists('time_range')) { | |
| 365 | +if (!function_exists('time_range')) { | |
| 366 | 366 | /** | 
| 367 | 367 | * Time Range List | 
| 368 | 368 | * | 
| @@ -378,15 +378,15 @@ discard block | ||
| 378 | 378 | $time = []; | 
| 379 | 379 | $minutes = range(0, (60 - $step), $step); | 
| 380 | 380 |          for ($i = 0; $i <= 23; $i++) { | 
| 381 | - $hour = (strlen($i) == 1 ? '0' . $i : $i); | |
| 381 | + $hour = (strlen($i) == 1 ? '0'.$i : $i); | |
| 382 | 382 |              foreach ($minutes as $minute) { | 
| 383 | - $hours = $hour . ':' . (strlen($minute) == 1 ? '0' . $minute : $minute); | |
| 383 | + $hours = $hour.':'.(strlen($minute) == 1 ? '0'.$minute : $minute); | |
| 384 | 384 |                  $time_12 = date("h:i a", strtotime($hours)); | 
| 385 | 385 | $time_24 = $hours; | 
| 386 | 386 |                  if ($mode == 12) { | 
| 387 | - $time[ $time_12 ] = $time_12; | |
| 387 | + $time[$time_12] = $time_12; | |
| 388 | 388 |                  } elseif ($mode == 24) { | 
| 389 | - $time[ $time_24 ] = $time_24; | |
| 389 | + $time[$time_24] = $time_24; | |
| 390 | 390 | } | 
| 391 | 391 | } | 
| 392 | 392 | } | 
| @@ -397,7 +397,7 @@ discard block | ||
| 397 | 397 | |
| 398 | 398 | // ------------------------------------------------------------------------ | 
| 399 | 399 | |
| 400 | -if ( ! function_exists('calculate_days')) { | |
| 400 | +if (!function_exists('calculate_days')) { | |
| 401 | 401 | /** | 
| 402 | 402 | * calculate_days | 
| 403 | 403 | * | 
| @@ -415,8 +415,8 @@ discard block | ||
| 415 | 415 |          $end_date = (is_numeric($end_date) ? date('d-m-Y', $end_date) : $end_date); | 
| 416 | 416 |          $hour = (is_numeric($hour) ? date('h:i:s a', $hour) : $hour); | 
| 417 | 417 | |
| 418 | - $start_date = $start_date . ' ' . $hour; | |
| 419 | - $end_date = $end_date . ' ' . $hour; | |
| 418 | + $start_date = $start_date.' '.$hour; | |
| 419 | + $end_date = $end_date.' '.$hour; | |
| 420 | 420 | |
| 421 | 421 | $start_date = strtotime($start_date); | 
| 422 | 422 | $end_date = strtotime($end_date); | 
| @@ -429,7 +429,7 @@ discard block | ||
| 429 | 429 | } | 
| 430 | 430 | // ------------------------------------------------------------------------ | 
| 431 | 431 | |
| 432 | -if ( ! function_exists('calculate_weeks')) { | |
| 432 | +if (!function_exists('calculate_weeks')) { | |
| 433 | 433 | /** | 
| 434 | 434 | * calculate_weeks | 
| 435 | 435 | * | 
| @@ -447,8 +447,8 @@ discard block | ||
| 447 | 447 |          $end_date = (is_numeric($end_date) ? date('d-m-Y', $end_date) : $end_date); | 
| 448 | 448 |          $hour = (is_numeric($hour) ? date('h:i:s a', $hour) : $hour); | 
| 449 | 449 | |
| 450 | - $start_date = $start_date . ' ' . $hour; | |
| 451 | - $end_date = $end_date . ' ' . $hour; | |
| 450 | + $start_date = $start_date.' '.$hour; | |
| 451 | + $end_date = $end_date.' '.$hour; | |
| 452 | 452 | |
| 453 | 453 | $start_date = strtotime($start_date); | 
| 454 | 454 | $end_date = strtotime($end_date); | 
| @@ -461,7 +461,7 @@ discard block | ||
| 461 | 461 | } | 
| 462 | 462 | // ------------------------------------------------------------------------ | 
| 463 | 463 | |
| 464 | -if ( ! function_exists('is_weekend')) { | |
| 464 | +if (!function_exists('is_weekend')) { | |
| 465 | 465 | /** | 
| 466 | 466 | * Is Weekend | 
| 467 | 467 | * | 
| @@ -473,7 +473,7 @@ discard block | ||
| 473 | 473 | */ | 
| 474 | 474 | function is_weekend($date) | 
| 475 | 475 |      { | 
| 476 | -        $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); | |
| 476 | +        $date = (!is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); | |
| 477 | 477 |          $date = date('D', $date); | 
| 478 | 478 | |
| 479 | 479 |          if ($date == 'Sat' OR $date == 'Sun') { | 
| @@ -485,7 +485,7 @@ discard block | ||
| 485 | 485 | } | 
| 486 | 486 | // ------------------------------------------------------------------------ | 
| 487 | 487 | |
| 488 | -if ( ! function_exists('is_weekday')) { | |
| 488 | +if (!function_exists('is_weekday')) { | |
| 489 | 489 | /** | 
| 490 | 490 | * Is Week Day | 
| 491 | 491 | * | 
| @@ -497,10 +497,10 @@ discard block | ||
| 497 | 497 | */ | 
| 498 | 498 | function is_weekday($date) | 
| 499 | 499 |      { | 
| 500 | -        $date = (! is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); | |
| 500 | +        $date = (!is_numeric($date) ? strtotime(str_replace('/', '-', $date)) : $date); | |
| 501 | 501 |          $date = date('D', $date); | 
| 502 | 502 | |
| 503 | -        if ( ! in_array($date, ['Sat', 'Sun'])) { | |
| 503 | +        if (!in_array($date, ['Sat', 'Sun'])) { | |
| 504 | 504 | return true; | 
| 505 | 505 | } | 
| 506 | 506 | |
| @@ -509,7 +509,7 @@ discard block | ||
| 509 | 509 | } | 
| 510 | 510 | // ------------------------------------------------------------------------ | 
| 511 | 511 | |
| 512 | -if ( ! function_exists('get_age')) { | |
| 512 | +if (!function_exists('get_age')) { | |
| 513 | 513 | /** | 
| 514 | 514 | * Get Age | 
| 515 | 515 | * | 
| @@ -522,7 +522,7 @@ discard block | ||
| 522 | 522 | */ | 
| 523 | 523 | function get_age($birthday, $return = 'years') | 
| 524 | 524 |      { | 
| 525 | -        $birthday = (! is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); | |
| 525 | +        $birthday = (!is_numeric($birthday) ? strtotime(str_replace('/', '-', $birthday)) : $birthday); | |
| 526 | 526 | |
| 527 | 527 |          $birthday = new DateTime(date('Y-m-d', $birthday)); | 
| 528 | 528 |          $now = new DateTime(date('Y-m-d')); | 
| @@ -537,7 +537,7 @@ discard block | ||
| 537 | 537 | ]; | 
| 538 | 538 | |
| 539 | 539 |          if (array_key_exists($return, $available)) { | 
| 540 | -            return $interval->{$available[ $return ]}; | |
| 540 | +            return $interval->{$available[$return]}; | |
| 541 | 541 |          } elseif (isset($interval->{$return})) { | 
| 542 | 542 |              return $interval->{$return}; | 
| 543 | 543 | } | 
| @@ -547,7 +547,7 @@ discard block | ||
| 547 | 547 | } | 
| 548 | 548 | // ------------------------------------------------------------------------ | 
| 549 | 549 | |
| 550 | -if ( ! function_exists('get_tenure')) { | |
| 550 | +if (!function_exists('get_tenure')) { | |
| 551 | 551 | /** | 
| 552 | 552 | * get_tenure | 
| 553 | 553 | * | 
| @@ -573,15 +573,15 @@ discard block | ||
| 573 | 573 | $dateInterval = $date_start->diff($date_end); | 
| 574 | 574 | |
| 575 | 575 | return strtolower($dateInterval->format( | 
| 576 | -            '%y ' . language()->getLine('DATE_YEARS') . | |
| 577 | -            ' — %m ' . language()->getLine('DATE_MONTHS') . | |
| 578 | -            ' — %d ' . language()->getLine('DATE_DAYS'))); | |
| 576 | +            '%y '.language()->getLine('DATE_YEARS'). | |
| 577 | +            ' — %m '.language()->getLine('DATE_MONTHS'). | |
| 578 | +            ' — %d '.language()->getLine('DATE_DAYS'))); | |
| 579 | 579 | } | 
| 580 | 580 | } | 
| 581 | 581 | |
| 582 | 582 | // ------------------------------------------------------------------------ | 
| 583 | 583 | |
| 584 | -if ( ! function_exists('time_breakdown')) { | |
| 584 | +if (!function_exists('time_breakdown')) { | |
| 585 | 585 | /** | 
| 586 | 586 | * Time Breakdown | 
| 587 | 587 | * | 
| @@ -593,7 +593,7 @@ discard block | ||
| 593 | 593 | */ | 
| 594 | 594 | function time_breakdown($time) | 
| 595 | 595 |      { | 
| 596 | -        if ( ! is_numeric($time)) { | |
| 596 | +        if (!is_numeric($time)) { | |
| 597 | 597 | $time = strtotime($time); | 
| 598 | 598 | } | 
| 599 | 599 | $currentTime = time(); | 
| @@ -622,8 +622,8 @@ discard block | ||
| 622 | 622 | } | 
| 623 | 623 |              foreach ($periods as $period => $seconds_in_period) { | 
| 624 | 624 |                  if ($seconds >= $seconds_in_period) { | 
| 625 | - $durations[ $period ] = floor($seconds / $seconds_in_period); | |
| 626 | - $seconds -= $durations[ $period ] * $seconds_in_period; | |
| 625 | + $durations[$period] = floor($seconds / $seconds_in_period); | |
| 626 | + $seconds -= $durations[$period] * $seconds_in_period; | |
| 627 | 627 | } | 
| 628 | 628 | } | 
| 629 | 629 | } | 
| @@ -633,7 +633,7 @@ discard block | ||
| 633 | 633 | } | 
| 634 | 634 | // ------------------------------------------------------------------------ | 
| 635 | 635 | |
| 636 | -if ( ! function_exists('sec2hms')) { | |
| 636 | +if (!function_exists('sec2hms')) { | |
| 637 | 637 | /** | 
| 638 | 638 | * Second to Miliseconds | 
| 639 | 639 | * | 
| @@ -645,12 +645,12 @@ discard block | ||
| 645 | 645 |      { | 
| 646 | 646 | $str = ''; | 
| 647 | 647 | $hours = intval(intval($num_secs) / 3600); | 
| 648 | - $str .= $hours . ':'; | |
| 648 | + $str .= $hours.':'; | |
| 649 | 649 | $minutes = intval(((intval($num_secs) / 60) % 60)); | 
| 650 | 650 |          if ($minutes < 10) { | 
| 651 | 651 | $str .= '0'; | 
| 652 | 652 | } | 
| 653 | - $str .= $minutes . ':'; | |
| 653 | + $str .= $minutes.':'; | |
| 654 | 654 | $seconds = intval(intval(($num_secs % 60))); | 
| 655 | 655 |          if ($seconds < 10) { | 
| 656 | 656 | $str .= '0'; | 
| @@ -662,7 +662,7 @@ discard block | ||
| 662 | 662 | } | 
| 663 | 663 | // ------------------------------------------------------------------------ | 
| 664 | 664 | |
| 665 | -if ( ! function_exists('add_time_duration')) { | |
| 665 | +if (!function_exists('add_time_duration')) { | |
| 666 | 666 | /** | 
| 667 | 667 | * Add Time Duration | 
| 668 | 668 | * | 
| @@ -674,7 +674,7 @@ discard block | ||
| 674 | 674 | */ | 
| 675 | 675 | function add_time_duration($start_time, $duration, $return = 'time') | 
| 676 | 676 |      { | 
| 677 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); | |
| 677 | + $start_time = (!is_numeric($start_time) ? strtotime($start_time) : $start_time); | |
| 678 | 678 | $duration = $duration * 60 * 60; // (x) hours * 60 minutes * 60 seconds | 
| 679 | 679 | |
| 680 | 680 | $add_time = $start_time + $duration; | 
| @@ -688,7 +688,7 @@ discard block | ||
| 688 | 688 | } | 
| 689 | 689 | // ------------------------------------------------------------------------ | 
| 690 | 690 | |
| 691 | -if ( ! function_exists('calculate_hours')) { | |
| 691 | +if (!function_exists('calculate_hours')) { | |
| 692 | 692 | /** | 
| 693 | 693 | * Calculate Hours | 
| 694 | 694 | * | 
| @@ -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; | 
| @@ -719,10 +719,10 @@ discard block | ||
| 719 | 719 | $final_minutes = round($minutes); | 
| 720 | 720 | |
| 721 | 721 |          if ($return === 'time') { | 
| 722 | - $final_hours = ($final_hours < 10 ? '0' . $final_hours : $final_hours); | |
| 723 | - $final_minutes = ($final_minutes < 10 ? '0' . $final_minutes : $final_minutes); | |
| 722 | + $final_hours = ($final_hours < 10 ? '0'.$final_hours : $final_hours); | |
| 723 | + $final_minutes = ($final_minutes < 10 ? '0'.$final_minutes : $final_minutes); | |
| 724 | 724 | |
| 725 | - return $final_hours . ':' . $final_minutes; | |
| 725 | + return $final_hours.':'.$final_minutes; | |
| 726 | 726 |          } elseif ($return === 'hours') { | 
| 727 | 727 | return $final_hours + ($final_minutes / 60); | 
| 728 | 728 | } | 
| @@ -730,7 +730,7 @@ discard block | ||
| 730 | 730 | } | 
| 731 | 731 | // ------------------------------------------------------------------------ | 
| 732 | 732 | |
| 733 | -if ( ! function_exists('time_difference')) { | |
| 733 | +if (!function_exists('time_difference')) { | |
| 734 | 734 | /** | 
| 735 | 735 | * Time Difference | 
| 736 | 736 | * | 
| @@ -742,8 +742,8 @@ discard block | ||
| 742 | 742 | */ | 
| 743 | 743 | function time_difference($start_time, $end_time, $return = 'array') | 
| 744 | 744 |      { | 
| 745 | - $start_time = (! is_numeric($start_time) ? strtotime($start_time) : $start_time); | |
| 746 | - $end_time = (! is_numeric($end_time) ? strtotime($end_time) : $end_time); | |
| 745 | + $start_time = (!is_numeric($start_time) ? strtotime($start_time) : $start_time); | |
| 746 | + $end_time = (!is_numeric($end_time) ? strtotime($end_time) : $end_time); | |
| 747 | 747 | |
| 748 | 748 | // Times Difference | 
| 749 | 749 | $difference = $end_time - $start_time; | 
| @@ -758,7 +758,7 @@ discard block | ||
| 758 | 758 | } | 
| 759 | 759 | // ------------------------------------------------------------------------ | 
| 760 | 760 | |
| 761 | -if ( ! function_exists('weeks_in_month')) { | |
| 761 | +if (!function_exists('weeks_in_month')) { | |
| 762 | 762 | /** | 
| 763 | 763 | * @param null $month | 
| 764 | 764 | * @param null $year | 
| @@ -769,13 +769,13 @@ discard block | ||
| 769 | 769 |      { | 
| 770 | 770 | // Start Date in Month | 
| 771 | 771 | $start_date_month = mktime(0, 0, 0, $month, 1, $year); | 
| 772 | -        $start_week_month = (int)date('W', $start_date_month); | |
| 772 | +        $start_week_month = (int) date('W', $start_date_month); | |
| 773 | 773 | |
| 774 | 774 | $amount_day = days_in_month($month, $year); | 
| 775 | 775 | |
| 776 | 776 | // Finish Date in onth | 
| 777 | 777 | $finish_date_month = mktime(0, 0, 0, $month, $amount_day, $year); | 
| 778 | -        $finish_week_month = (int)date('W', $finish_date_month); | |
| 778 | +        $finish_week_month = (int) date('W', $finish_date_month); | |
| 779 | 779 | |
| 780 | 780 | $amount_week = $finish_week_month - $start_week_month + 1; | 
| 781 | 781 | |
| @@ -784,7 +784,7 @@ discard block | ||
| 784 | 784 | } | 
| 785 | 785 | // ------------------------------------------------------------------------ | 
| 786 | 786 | |
| 787 | -if ( ! function_exists('monday_of_week')) { | |
| 787 | +if (!function_exists('monday_of_week')) { | |
| 788 | 788 | /** | 
| 789 | 789 | * Monday of Week | 
| 790 | 790 | * | 
| @@ -809,7 +809,7 @@ discard block | ||
| 809 | 809 | } | 
| 810 | 810 | // ------------------------------------------------------------------------ | 
| 811 | 811 | |
| 812 | -if ( ! function_exists('week_number_of_month')) { | |
| 812 | +if (!function_exists('week_number_of_month')) { | |
| 813 | 813 | /** | 
| 814 | 814 | * Week Number of Month | 
| 815 | 815 | * | 
| @@ -826,11 +826,11 @@ discard block | ||
| 826 | 826 | |
| 827 | 827 | // Start Date in Month | 
| 828 | 828 | $start_date_month = mktime(0, 0, 0, $month, 1, $year); | 
| 829 | -        $start_week_month = (int)date('W', $start_date_month); | |
| 829 | +        $start_week_month = (int) date('W', $start_date_month); | |
| 830 | 830 | |
| 831 | 831 | // Date Search | 
| 832 | 832 | $date_search = mktime(0, 0, 0, $month, $date, $year); | 
| 833 | -        $date_week_search = (int)date('W', $date_search); | |
| 833 | +        $date_week_search = (int) date('W', $date_search); | |
| 834 | 834 | |
| 835 | 835 | $number_of_week = $date_week_search - $start_week_month + 1; | 
| 836 | 836 | |
| @@ -839,7 +839,7 @@ discard block | ||
| 839 | 839 | } | 
| 840 | 840 | // ------------------------------------------------------------------------ | 
| 841 | 841 | |
| 842 | -if ( ! function_exists('format_time')) { | |
| 842 | +if (!function_exists('format_time')) { | |
| 843 | 843 | /** | 
| 844 | 844 | * Format Time from seconds | 
| 845 | 845 | * | 
| @@ -868,12 +868,12 @@ discard block | ||
| 868 | 868 | $seconds -= $minutes * 60; | 
| 869 | 869 | } | 
| 870 | 870 | |
| 871 | - $format[ 'days' ] = $days; | |
| 872 | - $format[ 'years' ] = $years; | |
| 873 | - $format[ 'months' ] = $months; | |
| 874 | - $format[ 'hours' ] = $hours; | |
| 875 | - $format[ 'minutes' ] = $minutes; | |
| 876 | - $format[ 'seconds' ] = $seconds; | |
| 871 | + $format['days'] = $days; | |
| 872 | + $format['years'] = $years; | |
| 873 | + $format['months'] = $months; | |
| 874 | + $format['hours'] = $hours; | |
| 875 | + $format['minutes'] = $minutes; | |
| 876 | + $format['seconds'] = $seconds; | |
| 877 | 877 | |
| 878 | 878 | return new \O2System\Spl\DataStructures\SplArrayObject($format); | 
| 879 | 879 | } | 
| @@ -928,7 +928,7 @@ discard block | ||
| 928 | 928 | |
| 929 | 929 | // ------------------------------------------------------------------------ | 
| 930 | 930 | |
| 931 | -if ( ! function_exists('now')) { | |
| 931 | +if (!function_exists('now')) { | |
| 932 | 932 | /** | 
| 933 | 933 | * now | 
| 934 | 934 | * | 
| @@ -960,7 +960,7 @@ discard block | ||
| 960 | 960 | |
| 961 | 961 | // ------------------------------------------------------------------------ | 
| 962 | 962 | |
| 963 | -if ( ! function_exists('mdate')) { | |
| 963 | +if (!function_exists('mdate')) { | |
| 964 | 964 | /** | 
| 965 | 965 | * Convert MySQL Style Datecodes | 
| 966 | 966 | * | 
| @@ -998,7 +998,7 @@ discard block | ||
| 998 | 998 | |
| 999 | 999 | // ------------------------------------------------------------------------ | 
| 1000 | 1000 | |
| 1001 | -if ( ! function_exists('standard_date')) { | |
| 1001 | +if (!function_exists('standard_date')) { | |
| 1002 | 1002 | /** | 
| 1003 | 1003 | * Standard Date | 
| 1004 | 1004 | * | 
| @@ -1036,7 +1036,7 @@ discard block | ||
| 1036 | 1036 | |
| 1037 | 1037 | // ------------------------------------------------------------------------ | 
| 1038 | 1038 | |
| 1039 | -if ( ! function_exists('timespan')) { | |
| 1039 | +if (!function_exists('timespan')) { | |
| 1040 | 1040 | /** | 
| 1041 | 1041 | * Timespan | 
| 1042 | 1042 | * | 
| @@ -1063,7 +1063,7 @@ discard block | ||
| 1063 | 1063 | $years = floor($seconds / 31557600); | 
| 1064 | 1064 | |
| 1065 | 1065 |          if ($years > 0) { | 
| 1066 | - $str[] = $years . ' ' . language()->getLine($years > 1 ? 'DATE_YEARS' : 'DATE_YEAR'); | |
| 1066 | + $str[] = $years.' '.language()->getLine($years > 1 ? 'DATE_YEARS' : 'DATE_YEAR'); | |
| 1067 | 1067 | } | 
| 1068 | 1068 | |
| 1069 | 1069 | $seconds -= $years * 31557600; | 
| @@ -1071,7 +1071,7 @@ discard block | ||
| 1071 | 1071 | |
| 1072 | 1072 |          if (count($str) < $units && ($years > 0 OR $months > 0)) { | 
| 1073 | 1073 |              if ($months > 0) { | 
| 1074 | - $str[] = $months . ' ' . language()->getLine($months > 1 ? 'DATE_MONTHS' : 'DATE_MONTH'); | |
| 1074 | + $str[] = $months.' '.language()->getLine($months > 1 ? 'DATE_MONTHS' : 'DATE_MONTH'); | |
| 1075 | 1075 | } | 
| 1076 | 1076 | |
| 1077 | 1077 | $seconds -= $months * 2629743; | 
| @@ -1081,7 +1081,7 @@ discard block | ||
| 1081 | 1081 | |
| 1082 | 1082 |          if (count($str) < $units && ($years > 0 OR $months > 0 OR $weeks > 0)) { | 
| 1083 | 1083 |              if ($weeks > 0) { | 
| 1084 | - $str[] = $weeks . ' ' . language()->getLine($weeks > 1 ? 'DATE_WEEKS' : 'DATE_WEEK'); | |
| 1084 | + $str[] = $weeks.' '.language()->getLine($weeks > 1 ? 'DATE_WEEKS' : 'DATE_WEEK'); | |
| 1085 | 1085 | } | 
| 1086 | 1086 | |
| 1087 | 1087 | $seconds -= $weeks * 604800; | 
| @@ -1091,7 +1091,7 @@ discard block | ||
| 1091 | 1091 | |
| 1092 | 1092 |          if (count($str) < $units && ($months > 0 OR $weeks > 0 OR $days > 0)) { | 
| 1093 | 1093 |              if ($days > 0) { | 
| 1094 | - $str[] = $days . ' ' . language()->getLine($days > 1 ? 'DATE_DAYS' : 'DATE_DAY'); | |
| 1094 | + $str[] = $days.' '.language()->getLine($days > 1 ? 'DATE_DAYS' : 'DATE_DAY'); | |
| 1095 | 1095 | } | 
| 1096 | 1096 | |
| 1097 | 1097 | $seconds -= $days * 86400; | 
| @@ -1101,7 +1101,7 @@ discard block | ||
| 1101 | 1101 | |
| 1102 | 1102 |          if (count($str) < $units && ($days > 0 OR $hours > 0)) { | 
| 1103 | 1103 |              if ($hours > 0) { | 
| 1104 | - $str[] = $hours . ' ' . language()->getLine($hours > 1 ? 'DATE_HOURS' : 'DATE_HOUR'); | |
| 1104 | + $str[] = $hours.' '.language()->getLine($hours > 1 ? 'DATE_HOURS' : 'DATE_HOUR'); | |
| 1105 | 1105 | } | 
| 1106 | 1106 | |
| 1107 | 1107 | $seconds -= $hours * 3600; | 
| @@ -1111,14 +1111,14 @@ discard block | ||
| 1111 | 1111 | |
| 1112 | 1112 |          if (count($str) < $units && ($days > 0 OR $hours > 0 OR $minutes > 0)) { | 
| 1113 | 1113 |              if ($minutes > 0) { | 
| 1114 | - $str[] = $minutes . ' ' . language()->getLine($minutes > 1 ? 'DATE_MINUTES' : 'DATE_MINUTE'); | |
| 1114 | + $str[] = $minutes.' '.language()->getLine($minutes > 1 ? 'DATE_MINUTES' : 'DATE_MINUTE'); | |
| 1115 | 1115 | } | 
| 1116 | 1116 | |
| 1117 | 1117 | $seconds -= $minutes * 60; | 
| 1118 | 1118 | } | 
| 1119 | 1119 | |
| 1120 | 1120 |          if (count($str) === 0) { | 
| 1121 | - $str[] = $seconds . ' ' . language()->getLine($seconds > 1 ? 'DATE_SECONDS' : 'DATE_SECOND'); | |
| 1121 | + $str[] = $seconds.' '.language()->getLine($seconds > 1 ? 'DATE_SECONDS' : 'DATE_SECOND'); | |
| 1122 | 1122 | } | 
| 1123 | 1123 | |
| 1124 | 1124 |          return implode(', ', $str); | 
| @@ -1127,7 +1127,7 @@ discard block | ||
| 1127 | 1127 | |
| 1128 | 1128 | // ------------------------------------------------------------------------ | 
| 1129 | 1129 | |
| 1130 | -if ( ! function_exists('days_in_month')) { | |
| 1130 | +if (!function_exists('days_in_month')) { | |
| 1131 | 1131 | /** | 
| 1132 | 1132 | * Number of days in a month | 
| 1133 | 1133 | * | 
| @@ -1143,7 +1143,7 @@ discard block | ||
| 1143 | 1143 |      { | 
| 1144 | 1144 |          if ($month < 1 OR $month > 12) { | 
| 1145 | 1145 | return 0; | 
| 1146 | -        } elseif ( ! is_numeric($year) OR strlen($year) !== 4) { | |
| 1146 | +        } elseif (!is_numeric($year) OR strlen($year) !== 4) { | |
| 1147 | 1147 |              $year = date('Y'); | 
| 1148 | 1148 | } | 
| 1149 | 1149 | |
| @@ -1152,7 +1152,7 @@ discard block | ||
| 1152 | 1152 | } | 
| 1153 | 1153 | |
| 1154 | 1154 |          if ($year >= 1970) { | 
| 1155 | -            return (int)date('t', mktime(12, 0, 0, $month, 1, $year)); | |
| 1155 | +            return (int) date('t', mktime(12, 0, 0, $month, 1, $year)); | |
| 1156 | 1156 | } | 
| 1157 | 1157 | |
| 1158 | 1158 |          if ($month == 2) { | 
| @@ -1163,13 +1163,13 @@ discard block | ||
| 1163 | 1163 | |
| 1164 | 1164 | $days_in_month = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; | 
| 1165 | 1165 | |
| 1166 | - return $days_in_month[ $month - 1 ]; | |
| 1166 | + return $days_in_month[$month - 1]; | |
| 1167 | 1167 | } | 
| 1168 | 1168 | } | 
| 1169 | 1169 | |
| 1170 | 1170 | // ------------------------------------------------------------------------ | 
| 1171 | 1171 | |
| 1172 | -if ( ! function_exists('local_to_gmt')) { | |
| 1172 | +if (!function_exists('local_to_gmt')) { | |
| 1173 | 1173 | /** | 
| 1174 | 1174 | * Converts a local Unix timestamp to GMT | 
| 1175 | 1175 | * | 
| @@ -1196,7 +1196,7 @@ discard block | ||
| 1196 | 1196 | |
| 1197 | 1197 | // ------------------------------------------------------------------------ | 
| 1198 | 1198 | |
| 1199 | -if ( ! function_exists('gmt_to_local')) { | |
| 1199 | +if (!function_exists('gmt_to_local')) { | |
| 1200 | 1200 | /** | 
| 1201 | 1201 | * Converts GMT time to a localized value | 
| 1202 | 1202 | * | 
| @@ -1224,7 +1224,7 @@ discard block | ||
| 1224 | 1224 | |
| 1225 | 1225 | // ------------------------------------------------------------------------ | 
| 1226 | 1226 | |
| 1227 | -if ( ! function_exists('mysql_to_unix')) { | |
| 1227 | +if (!function_exists('mysql_to_unix')) { | |
| 1228 | 1228 | /** | 
| 1229 | 1229 | * Converts a MySQL Timestamp to Unix | 
| 1230 | 1230 | * | 
| @@ -1254,7 +1254,7 @@ discard block | ||
| 1254 | 1254 | |
| 1255 | 1255 | // ------------------------------------------------------------------------ | 
| 1256 | 1256 | |
| 1257 | -if ( ! function_exists('unix_to_human')) { | |
| 1257 | +if (!function_exists('unix_to_human')) { | |
| 1258 | 1258 | /** | 
| 1259 | 1259 | * Unix to "Human" | 
| 1260 | 1260 | * | 
| @@ -1268,20 +1268,20 @@ discard block | ||
| 1268 | 1268 | */ | 
| 1269 | 1269 | function unix_to_human($time = '', $seconds = false, $fmt = 'us') | 
| 1270 | 1270 |      { | 
| 1271 | -        $r = date('Y', $time) . '-' . date('m', $time) . '-' . date('d', $time) . ' '; | |
| 1271 | +        $r = date('Y', $time).'-'.date('m', $time).'-'.date('d', $time).' '; | |
| 1272 | 1272 | |
| 1273 | 1273 |          if ($fmt === 'us') { | 
| 1274 | -            $r .= date('h', $time) . ':' . date('i', $time); | |
| 1274 | +            $r .= date('h', $time).':'.date('i', $time); | |
| 1275 | 1275 |          } else { | 
| 1276 | -            $r .= date('H', $time) . ':' . date('i', $time); | |
| 1276 | +            $r .= date('H', $time).':'.date('i', $time); | |
| 1277 | 1277 | } | 
| 1278 | 1278 | |
| 1279 | 1279 |          if ($seconds) { | 
| 1280 | -            $r .= ':' . date('s', $time); | |
| 1280 | +            $r .= ':'.date('s', $time); | |
| 1281 | 1281 | } | 
| 1282 | 1282 | |
| 1283 | 1283 |          if ($fmt === 'us') { | 
| 1284 | -            return $r . ' ' . date('A', $time); | |
| 1284 | +            return $r.' '.date('A', $time); | |
| 1285 | 1285 | } | 
| 1286 | 1286 | |
| 1287 | 1287 | return $r; | 
| @@ -1290,7 +1290,7 @@ discard block | ||
| 1290 | 1290 | |
| 1291 | 1291 | // ------------------------------------------------------------------------ | 
| 1292 | 1292 | |
| 1293 | -if ( ! function_exists('human_to_unix')) { | |
| 1293 | +if (!function_exists('human_to_unix')) { | |
| 1294 | 1294 | /** | 
| 1295 | 1295 | * Convert "human" date to GMT | 
| 1296 | 1296 | * | 
| @@ -1308,7 +1308,7 @@ discard block | ||
| 1308 | 1308 | |
| 1309 | 1309 |          $date = preg_replace('/\040+/', ' ', trim($date)); | 
| 1310 | 1310 | |
| 1311 | - if ( ! preg_match( | |
| 1311 | + if (!preg_match( | |
| 1312 | 1312 |              '/^(\d{2}|\d{4})\-[0-9]{1,2}\-[0-9]{1,2}\s[0-9]{1,2}:[0-9]{1,2}(?::[0-9]{1,2})?(?:\s[AP]M)?$/i', | 
| 1313 | 1313 | $date | 
| 1314 | 1314 | ) | 
| @@ -1323,9 +1323,9 @@ discard block | ||
| 1323 | 1323 |          if (isset($ampm)) { | 
| 1324 | 1324 | $ampm = strtolower($ampm); | 
| 1325 | 1325 | |
| 1326 | -            if ($ampm[ 0 ] === 'p' && $hour < 12) { | |
| 1326 | +            if ($ampm[0] === 'p' && $hour < 12) { | |
| 1327 | 1327 | $hour += 12; | 
| 1328 | -            } elseif ($ampm[ 0 ] === 'a' && $hour === 12) { | |
| 1328 | +            } elseif ($ampm[0] === 'a' && $hour === 12) { | |
| 1329 | 1329 | $hour = 0; | 
| 1330 | 1330 | } | 
| 1331 | 1331 | } | 
| @@ -1336,7 +1336,7 @@ discard block | ||
| 1336 | 1336 | |
| 1337 | 1337 | // ------------------------------------------------------------------------ | 
| 1338 | 1338 | |
| 1339 | -if ( ! function_exists('nice_date')) { | |
| 1339 | +if (!function_exists('nice_date')) { | |
| 1340 | 1340 | /** | 
| 1341 | 1341 | * Turns many "reasonably-date-like" strings into something | 
| 1342 | 1342 | * that is actually useful. This only works for dates after unix epoch. | 
| @@ -1364,17 +1364,17 @@ discard block | ||
| 1364 | 1364 | $year = substr($bad_date, 2, 4); | 
| 1365 | 1365 | } | 
| 1366 | 1366 | |
| 1367 | - return date($format, strtotime($year . '-' . $month . '-01')); | |
| 1367 | + return date($format, strtotime($year.'-'.$month.'-01')); | |
| 1368 | 1368 | } | 
| 1369 | 1369 | |
| 1370 | 1370 | // Date Like: YYYYMMDD | 
| 1371 | 1371 |          if (preg_match('/^(\d{2})\d{2}(\d{4})$/i', $bad_date, $matches)) { | 
| 1372 | - return date($format, strtotime($matches[ 1 ] . '/01/' . $matches[ 2 ])); | |
| 1372 | + return date($format, strtotime($matches[1].'/01/'.$matches[2])); | |
| 1373 | 1373 | } | 
| 1374 | 1374 | |
| 1375 | 1375 | // Date Like: MM-DD-YYYY __or__ M-D-YYYY (or anything in between) | 
| 1376 | 1376 |          if (preg_match('/^(\d{1,2})-(\d{1,2})-(\d{4})$/i', $bad_date, $matches)) { | 
| 1377 | - return date($format, strtotime($matches[ 3 ] . '-' . $matches[ 1 ] . '-' . $matches[ 2 ])); | |
| 1377 | + return date($format, strtotime($matches[3].'-'.$matches[1].'-'.$matches[2])); | |
| 1378 | 1378 | } | 
| 1379 | 1379 | |
| 1380 | 1380 | // Any other kind of string, when converted into UNIX time, | 
| @@ -1391,7 +1391,7 @@ discard block | ||
| 1391 | 1391 | |
| 1392 | 1392 | // ------------------------------------------------------------------------ | 
| 1393 | 1393 | |
| 1394 | -if ( ! function_exists('timezones')) { | |
| 1394 | +if (!function_exists('timezones')) { | |
| 1395 | 1395 | /** | 
| 1396 | 1396 | * Timezones | 
| 1397 | 1397 | * | 
| @@ -1454,13 +1454,13 @@ discard block | ||
| 1454 | 1454 | return $zones; | 
| 1455 | 1455 | } | 
| 1456 | 1456 | |
| 1457 | - return isset($zones[ $tz ]) ? $zones[ $tz ] : 0; | |
| 1457 | + return isset($zones[$tz]) ? $zones[$tz] : 0; | |
| 1458 | 1458 | } | 
| 1459 | 1459 | } | 
| 1460 | 1460 | |
| 1461 | 1461 | // ------------------------------------------------------------------------ | 
| 1462 | 1462 | |
| 1463 | -if ( ! function_exists('date_range_unix')) { | |
| 1463 | +if (!function_exists('date_range_unix')) { | |
| 1464 | 1464 | /** | 
| 1465 | 1465 | * Date range | 
| 1466 | 1466 | * | 
| @@ -1483,11 +1483,11 @@ discard block | ||
| 1483 | 1483 | return false; | 
| 1484 | 1484 | } | 
| 1485 | 1485 | |
| 1486 | - $is_unix = ! ( ! $is_unix OR $is_unix === 'days'); | |
| 1486 | + $is_unix = !(!$is_unix OR $is_unix === 'days'); | |
| 1487 | 1487 | |
| 1488 | 1488 | // Validate input and try strtotime() on invalid timestamps/intervals, just in case | 
| 1489 | - if (( ! ctype_digit((string)$unix_start) && ($unix_start = @strtotime($unix_start)) === false) | |
| 1490 | - OR ( ! ctype_digit((string)$mixed) && ($is_unix === false OR ($mixed = @strtotime( | |
| 1489 | + if ((!ctype_digit((string) $unix_start) && ($unix_start = @strtotime($unix_start)) === false) | |
| 1490 | + OR (!ctype_digit((string) $mixed) && ($is_unix === false OR ($mixed = @strtotime( | |
| 1491 | 1491 | $mixed | 
| 1492 | 1492 | )) === false)) | 
| 1493 | 1493 | OR ($is_unix === true && $mixed < $unix_start) | 
| @@ -1525,7 +1525,7 @@ discard block | ||
| 1525 | 1525 | $arg = new DateTime(); | 
| 1526 | 1526 | $arg->setTimestamp($mixed); | 
| 1527 | 1527 |              } else { | 
| 1528 | - $arg = (int)$mixed; | |
| 1528 | + $arg = (int) $mixed; | |
| 1529 | 1529 | } | 
| 1530 | 1530 | |
| 1531 | 1531 |              $period = new DatePeriod($from, new DateInterval('P1D'), $arg); | 
| @@ -1538,7 +1538,7 @@ discard block | ||
| 1538 | 1538 | * the end date might actually be less than 24 hours away from the previously | 
| 1539 | 1539 | * generated DateTime object, but either way - we have to append it manually. | 
| 1540 | 1540 | */ | 
| 1541 | -            if ( ! is_int($arg) && $range[ count($range) - 1 ] !== $arg->format($format)) { | |
| 1541 | +            if (!is_int($arg) && $range[count($range) - 1] !== $arg->format($format)) { | |
| 1542 | 1542 | $range[] = $arg->format($format); | 
| 1543 | 1543 | } | 
| 1544 | 1544 | |
| @@ -1552,7 +1552,7 @@ discard block | ||
| 1552 | 1552 |              $arg->setDate(date('Y', $mixed), date('n', $mixed), date('j', $mixed)); | 
| 1553 | 1553 |              $arg->setTime(date('G', $mixed), date('i', $mixed), date('s', $mixed)); | 
| 1554 | 1554 |          } else { | 
| 1555 | - $arg = (int)$mixed; | |
| 1555 | + $arg = (int) $mixed; | |
| 1556 | 1556 | } | 
| 1557 | 1557 | $range[] = $from->format($format); | 
| 1558 | 1558 | |