@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function boot() |
| 44 | 44 | { |
| 45 | - $this->app->singleton('time_diff_translator', function ($app) { |
|
| 45 | + $this->app->singleton('time_diff_translator', function($app) { |
|
| 46 | 46 | $loader = $app->make('translation.loader'); |
| 47 | 47 | $locale = $app->config->get('app.locale'); |
| 48 | 48 | $translator = $app->make(TimeDiffTranslator::class, [$loader, $locale]); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | $stringLoaderFunc = $stringLoader->getFunctions(); |
| 137 | 137 | |
| 138 | 138 | return [ |
| 139 | - 'template_from_string' => function ($template) use ($twig, $stringLoaderFunc) { |
|
| 139 | + 'template_from_string' => function($template) use ($twig, $stringLoaderFunc) { |
|
| 140 | 140 | $callable = $stringLoaderFunc[0]->getCallable(); |
| 141 | 141 | return $callable($twig, $template); |
| 142 | 142 | } |
@@ -156,11 +156,11 @@ discard block |
||
| 156 | 156 | $textFilters = $textExtension->getFilters(); |
| 157 | 157 | |
| 158 | 158 | return [ |
| 159 | - 'truncate' => function ($value, $length = 30, $preserve = false, $separator = '...') use ($twig, $textFilters) { |
|
| 159 | + 'truncate' => function($value, $length = 30, $preserve = false, $separator = '...') use ($twig, $textFilters) { |
|
| 160 | 160 | $callable = $textFilters[0]->getCallable(); |
| 161 | 161 | return $callable($twig, $value, $length, $preserve, $separator); |
| 162 | 162 | }, |
| 163 | - 'wordwrap' => function ($value, $length = 80, $separator = "\n", $preserve = false) use ($twig, $textFilters) { |
|
| 163 | + 'wordwrap' => function($value, $length = 80, $separator = "\n", $preserve = false) use ($twig, $textFilters) { |
|
| 164 | 164 | $callable = $textFilters[1]->getCallable(); |
| 165 | 165 | return $callable($twig, $value, $length, $separator, $preserve); |
| 166 | 166 | } |
@@ -180,15 +180,15 @@ discard block |
||
| 180 | 180 | $intlFilters = $intlExtension->getFilters(); |
| 181 | 181 | |
| 182 | 182 | return [ |
| 183 | - 'localizeddate' => function ($date, $dateFormat = 'medium', $timeFormat = 'medium', $locale = null, $timezone = null, $format = null) use ($twig, $intlFilters) { |
|
| 183 | + 'localizeddate' => function($date, $dateFormat = 'medium', $timeFormat = 'medium', $locale = null, $timezone = null, $format = null) use ($twig, $intlFilters) { |
|
| 184 | 184 | $callable = $intlFilters[0]->getCallable(); |
| 185 | 185 | return $callable($twig, $date, $dateFormat, $timeFormat, $locale, $timezone, $format); |
| 186 | 186 | }, |
| 187 | - 'localizednumber' => function ($number, $style = 'decimal', $type = 'default', $locale = null) use ($twig, $intlFilters) { |
|
| 187 | + 'localizednumber' => function($number, $style = 'decimal', $type = 'default', $locale = null) use ($twig, $intlFilters) { |
|
| 188 | 188 | $callable = $intlFilters[1]->getCallable(); |
| 189 | 189 | return $callable($number, $style, $type, $locale); |
| 190 | 190 | }, |
| 191 | - 'localizedcurrency' => function ($number, $currency = null, $locale = null) use ($twig, $intlFilters) { |
|
| 191 | + 'localizedcurrency' => function($number, $currency = null, $locale = null) use ($twig, $intlFilters) { |
|
| 192 | 192 | $callable = $intlFilters[2]->getCallable(); |
| 193 | 193 | return $callable($number, $currency, $locale); |
| 194 | 194 | } |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $arrayFilters = $arrayExtension->getFilters(); |
| 207 | 207 | |
| 208 | 208 | return [ |
| 209 | - 'shuffle' => function ($array) use ($arrayFilters) { |
|
| 209 | + 'shuffle' => function($array) use ($arrayFilters) { |
|
| 210 | 210 | $callable = $arrayFilters[0]->getCallable(); |
| 211 | 211 | return $callable($array); |
| 212 | 212 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $timeFilters = $timeExtension->getFilters(); |
| 228 | 228 | |
| 229 | 229 | return [ |
| 230 | - 'time_diff' => function ($date, $now = null) use ($twig, $timeFilters) { |
|
| 230 | + 'time_diff' => function($date, $now = null) use ($twig, $timeFilters) { |
|
| 231 | 231 | $callable = $timeFilters[0]->getCallable(); |
| 232 | 232 | return $callable($twig, $date, $now); |
| 233 | 233 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | $filters = $extension->getFilters(); |
| 246 | 246 | |
| 247 | 247 | return [ |
| 248 | - 'sortbyfield' => function ($array, $sort_by = null, $direction = 'asc') use ($filters) { |
|
| 248 | + 'sortbyfield' => function($array, $sort_by = null, $direction = 'asc') use ($filters) { |
|
| 249 | 249 | $callable = $filters[0]->getCallable(); |
| 250 | 250 | return $callable($array, $sort_by, $direction); |
| 251 | 251 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | private function getMailFilters() |
| 261 | 261 | { |
| 262 | 262 | return [ |
| 263 | - 'mailto' => function ($string, $link = true, $protected = true, $text = null, $class = "") { |
|
| 263 | + 'mailto' => function($string, $link = true, $protected = true, $text = null, $class = "") { |
|
| 264 | 264 | return $this->hideEmail($string, $link, $protected, $text, $class); |
| 265 | 265 | } |
| 266 | 266 | ]; |
@@ -274,53 +274,53 @@ discard block |
||
| 274 | 274 | private function getPhpFunctions() |
| 275 | 275 | { |
| 276 | 276 | return [ |
| 277 | - 'strftime' => function ($time, $format = '%d.%m.%Y %H:%M:%S') { |
|
| 277 | + 'strftime' => function($time, $format = '%d.%m.%Y %H:%M:%S') { |
|
| 278 | 278 | $timeObj = new Carbon($time); |
| 279 | 279 | return strftime($format, $timeObj->getTimestamp()); |
| 280 | 280 | }, |
| 281 | - 'uppercase' => function ($string) { |
|
| 281 | + 'uppercase' => function($string) { |
|
| 282 | 282 | return mb_convert_case($string, MB_CASE_UPPER, "UTF-8"); |
| 283 | 283 | }, |
| 284 | - 'lowercase' => function ($string) { |
|
| 284 | + 'lowercase' => function($string) { |
|
| 285 | 285 | return mb_convert_case($string, MB_CASE_LOWER, "UTF-8"); |
| 286 | 286 | }, |
| 287 | - 'ucfirst' => function ($string) { |
|
| 287 | + 'ucfirst' => function($string) { |
|
| 288 | 288 | return mb_convert_case($string, MB_CASE_TITLE, "UTF-8"); |
| 289 | 289 | }, |
| 290 | - 'lcfirst' => function ($string) { |
|
| 290 | + 'lcfirst' => function($string) { |
|
| 291 | 291 | return lcfirst($string); |
| 292 | 292 | }, |
| 293 | - 'ltrim' => function ($string, $charlist = " \t\n\r\0\x0B") { |
|
| 293 | + 'ltrim' => function($string, $charlist = " \t\n\r\0\x0B") { |
|
| 294 | 294 | return ltrim($string, $charlist); |
| 295 | 295 | }, |
| 296 | - 'rtrim' => function ($string, $charlist = " \t\n\r\0\x0B") { |
|
| 296 | + 'rtrim' => function($string, $charlist = " \t\n\r\0\x0B") { |
|
| 297 | 297 | return rtrim($string, $charlist); |
| 298 | 298 | }, |
| 299 | - 'str_repeat' => function ($string, $multiplier = 1) { |
|
| 299 | + 'str_repeat' => function($string, $multiplier = 1) { |
|
| 300 | 300 | return str_repeat($string, $multiplier); |
| 301 | 301 | }, |
| 302 | - 'plural' => function ($string, $count = 2) { |
|
| 302 | + 'plural' => function($string, $count = 2) { |
|
| 303 | 303 | return str_plural($string, $count); |
| 304 | 304 | }, |
| 305 | - 'strpad' => function ($string, $pad_length, $pad_string = ' ') { |
|
| 305 | + 'strpad' => function($string, $pad_length, $pad_string = ' ') { |
|
| 306 | 306 | return str_pad($string, $pad_length, $pad_string, $pad_type = STR_PAD_BOTH); |
| 307 | 307 | }, |
| 308 | - 'leftpad' => function ($string, $pad_length, $pad_string = ' ') { |
|
| 308 | + 'leftpad' => function($string, $pad_length, $pad_string = ' ') { |
|
| 309 | 309 | return str_pad($string, $pad_length, $pad_string, $pad_type = STR_PAD_LEFT); |
| 310 | 310 | }, |
| 311 | - 'rightpad' => function ($string, $pad_length, $pad_string = ' ') { |
|
| 311 | + 'rightpad' => function($string, $pad_length, $pad_string = ' ') { |
|
| 312 | 312 | return str_pad($string, $pad_length, $pad_string, $pad_type = STR_PAD_RIGHT); |
| 313 | 313 | }, |
| 314 | - 'rtl' => function ($string) { |
|
| 314 | + 'rtl' => function($string) { |
|
| 315 | 315 | return strrev($string); |
| 316 | 316 | }, |
| 317 | - 'str_replace' => function ($string, $search, $replace) { |
|
| 317 | + 'str_replace' => function($string, $search, $replace) { |
|
| 318 | 318 | return str_replace($search, $replace, $string); |
| 319 | 319 | }, |
| 320 | - 'strip_tags' => function ($string, $allow = '') { |
|
| 320 | + 'strip_tags' => function($string, $allow = '') { |
|
| 321 | 321 | return strip_tags($string, $allow); |
| 322 | 322 | }, |
| 323 | - 'var_dump' => function ($expression) { |
|
| 323 | + 'var_dump' => function($expression) { |
|
| 324 | 324 | ob_start(); |
| 325 | 325 | var_dump($expression); |
| 326 | 326 | $result = ob_get_clean(); |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | private function getConfigFunction() |
| 339 | 339 | { |
| 340 | 340 | return [ |
| 341 | - 'config' => function ($key = null, $default = null) { |
|
| 341 | + 'config' => function($key = null, $default = null) { |
|
| 342 | 342 | return config($key, $default); |
| 343 | 343 | }, |
| 344 | 344 | ]; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | private function getEnvFunction() |
| 353 | 353 | { |
| 354 | 354 | return [ |
| 355 | - 'env' => function ($key, $default = null) { |
|
| 355 | + 'env' => function($key, $default = null) { |
|
| 356 | 356 | return env($key, $default); |
| 357 | 357 | }, |
| 358 | 358 | ]; |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | private function getSessionFunction() |
| 367 | 367 | { |
| 368 | 368 | return [ |
| 369 | - 'session' => function ($key = null) { |
|
| 369 | + 'session' => function($key = null) { |
|
| 370 | 370 | return session($key); |
| 371 | 371 | }, |
| 372 | 372 | ]; |
@@ -381,9 +381,9 @@ discard block |
||
| 381 | 381 | private function getRedirectFunction() |
| 382 | 382 | { |
| 383 | 383 | return [ |
| 384 | - 'redirect' => function ($url) { |
|
| 384 | + 'redirect' => function($url) { |
|
| 385 | 385 | |
| 386 | - if(empty($url)) { |
|
| 386 | + if (empty($url)) { |
|
| 387 | 387 | return; |
| 388 | 388 | } |
| 389 | 389 | |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | private function getTransFunction() |
| 401 | 401 | { |
| 402 | 402 | return [ |
| 403 | - 'trans' => function ($key = null, $parameters = []) { |
|
| 403 | + 'trans' => function($key = null, $parameters = []) { |
|
| 404 | 404 | return trans($key, $parameters); |
| 405 | 405 | }, |
| 406 | 406 | ]; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | private function getVarDumpFunction() |
| 415 | 415 | { |
| 416 | 416 | return [ |
| 417 | - 'var_dump' => function ($expression) { |
|
| 417 | + 'var_dump' => function($expression) { |
|
| 418 | 418 | ob_start(); |
| 419 | 419 | var_dump($expression); |
| 420 | 420 | $result = ob_get_clean(); |
@@ -448,32 +448,32 @@ discard block |
||
| 448 | 448 | |
| 449 | 449 | // if we want just unprotected link |
| 450 | 450 | if (!$protected) { |
| 451 | - return $link ? '<a href="mailto:' . $email . '">' . $linkText . '</a>' : $linkText; |
|
| 451 | + return $link ? '<a href="mailto:'.$email.'">'.$linkText.'</a>' : $linkText; |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | // turn on protection |
| 455 | 455 | $character_set = '+-.0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz'; |
| 456 | 456 | $key = str_shuffle($character_set); |
| 457 | 457 | $cipher_text = ''; |
| 458 | - $id = 'e' . rand(1, 999999999); |
|
| 458 | + $id = 'e'.rand(1, 999999999); |
|
| 459 | 459 | for ($i = 0; $i < strlen($email); $i += 1) { |
| 460 | 460 | $cipher_text .= $key[strpos($character_set, $email[$i])]; |
| 461 | 461 | } |
| 462 | - $script = 'var a="' . $key . '";var b=a.split("").sort().join("");var c="' . $cipher_text . '";var d=""; var cl="'.$class.'";'; |
|
| 462 | + $script = 'var a="'.$key.'";var b=a.split("").sort().join("");var c="'.$cipher_text.'";var d=""; var cl="'.$class.'";'; |
|
| 463 | 463 | $script .= 'for(var e=0;e<c.length;e++)d+=b.charAt(a.indexOf(c.charAt(e)));'; |
| 464 | 464 | $script .= 'var y = d;'; |
| 465 | 465 | if ($text !== null) { |
| 466 | 466 | $script .= 'var y = "'.$text.'";'; |
| 467 | 467 | } |
| 468 | 468 | if ($link) { |
| 469 | - $script .= 'document.getElementById("' . $id . '").innerHTML="<a class=\""+cl+"\" href=\\"mailto:"+d+"\\">"+y+"</a>"'; |
|
| 469 | + $script .= 'document.getElementById("'.$id.'").innerHTML="<a class=\""+cl+"\" href=\\"mailto:"+d+"\\">"+y+"</a>"'; |
|
| 470 | 470 | } else { |
| 471 | - $script .= 'document.getElementById("' . $id . '").innerHTML=y'; |
|
| 471 | + $script .= 'document.getElementById("'.$id.'").innerHTML=y'; |
|
| 472 | 472 | } |
| 473 | - $script = "eval(\"" . str_replace(array("\\", '"'), array("\\\\", '\"'), $script) . "\")"; |
|
| 474 | - $script = '<script type="text/javascript">/*<![CDATA[*/' . $script . '/*]]>*/</script>'; |
|
| 473 | + $script = "eval(\"".str_replace(array("\\", '"'), array("\\\\", '\"'), $script)."\")"; |
|
| 474 | + $script = '<script type="text/javascript">/*<![CDATA[*/'.$script.'/*]]>*/</script>'; |
|
| 475 | 475 | |
| 476 | - return '<span id="' . $id . '">[javascript protected email address]</span>' . $script; |
|
| 476 | + return '<span id="'.$id.'">[javascript protected email address]</span>'.$script; |
|
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | /** |
@@ -488,15 +488,15 @@ discard block |
||
| 488 | 488 | private function getFileRevision() |
| 489 | 489 | { |
| 490 | 490 | return [ |
| 491 | - 'revision' => function ($filename, $format = null) { |
|
| 491 | + 'revision' => function($filename, $format = null) { |
|
| 492 | 492 | // Remove http/web address from the file name if there is one to load it locally |
| 493 | 493 | $prefix = url('/'); |
| 494 | - $filename_ = trim(preg_replace('/^' . preg_quote($prefix, '/') . '/', '', $filename), '/'); |
|
| 494 | + $filename_ = trim(preg_replace('/^'.preg_quote($prefix, '/').'/', '', $filename), '/'); |
|
| 495 | 495 | if (file_exists($filename_)) { |
| 496 | 496 | $timestamp = filemtime($filename_); |
| 497 | 497 | $prepend = ($format) ? date($format, $timestamp) : $timestamp; |
| 498 | 498 | |
| 499 | - return $filename . "?" . $prepend; |
|
| 499 | + return $filename."?".$prepend; |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | return $filename; |