@@ -26,7 +26,7 @@ |
||
26 | 26 | * @param mixed $t The text template |
27 | 27 | * @param mixed $v (default: null) The array of values exposed in template. |
28 | 28 | * @return string |
29 | - */ |
|
29 | + */ |
|
30 | 30 | public static function render($t,$v=null){ |
31 | 31 | if (empty($v)) return preg_replace('/{{[^}]+}}/','',$t); |
32 | 32 | for( // Init |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | * @param mixed $v (default: null) The array of values exposed in template. |
28 | 28 | * @return string |
29 | 29 | */ |
30 | - public static function render($t,$v=null){ |
|
31 | - if (empty($v)) return preg_replace('/{{[^}]+}}/','',$t); |
|
32 | - for( // Init |
|
30 | + public static function render($t, $v = null) { |
|
31 | + if (empty($v)) return preg_replace('/{{[^}]+}}/', '', $t); |
|
32 | + for ( // Init |
|
33 | 33 | $r = $ox = $x = false; |
34 | 34 | // While |
35 | - false !== ($x = $y = strpos($t,'{{',$x)); |
|
35 | + false !== ($x = $y = strpos($t, '{{', $x)); |
|
36 | 36 | // Do |
37 | - $r .= substr($t, $ox, $x-$ox), |
|
38 | - $c = substr($t, $x += 2, $l = ( $y = strpos($t,'}}', $x) ) - $x), |
|
37 | + $r .= substr($t, $ox, $x - $ox), |
|
38 | + $c = substr($t, $x += 2, $l = ($y = strpos($t, '}}', $x)) - $x), |
|
39 | 39 | $ox = $x += $l + 2, |
40 | - $r .= Object::fetch(trim($c),$v)?:'' |
|
40 | + $r .= Object::fetch(trim($c), $v) ?: '' |
|
41 | 41 | ); |
42 | - return $r===false ? $t : $r.substr($t,$ox); |
|
42 | + return $r === false ? $t : $r.substr($t, $ox); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * @param string $text The text to slugify |
55 | 55 | * @return string The slug. |
56 | 56 | */ |
57 | - public static function slugify($text){ |
|
57 | + public static function slugify($text) { |
|
58 | 58 | return preg_replace( |
59 | - ['(\s+)','([^a-z0-9-])i','(-+)'],['-','','-'], |
|
59 | + ['(\s+)', '([^a-z0-9-])i', '(-+)'], ['-', '', '-'], |
|
60 | 60 | strtolower(self::removeAccents($text))); |
61 | 61 | } |
62 | 62 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | * @param string $text The text to translit |
73 | 73 | * @return string The translited text |
74 | 74 | */ |
75 | - public static function removeAccents($text){ |
|
75 | + public static function removeAccents($text) { |
|
76 | 76 | static $diac; |
77 | 77 | return strtr( |
78 | 78 | utf8_decode($text), |
@@ -27,8 +27,10 @@ discard block |
||
27 | 27 | * @param mixed $v (default: null) The array of values exposed in template. |
28 | 28 | * @return string |
29 | 29 | */ |
30 | - public static function render($t,$v=null){ |
|
31 | - if (empty($v)) return preg_replace('/{{[^}]+}}/','',$t); |
|
30 | + public static function render($t,$v=null) { |
|
31 | + if (empty($v)) { |
|
32 | + return preg_replace('/{{[^}]+}}/','',$t); |
|
33 | + } |
|
32 | 34 | for( // Init |
33 | 35 | $r = $ox = $x = false; |
34 | 36 | // While |
@@ -54,7 +56,7 @@ discard block |
||
54 | 56 | * @param string $text The text to slugify |
55 | 57 | * @return string The slug. |
56 | 58 | */ |
57 | - public static function slugify($text){ |
|
59 | + public static function slugify($text) { |
|
58 | 60 | return preg_replace( |
59 | 61 | ['(\s+)','([^a-z0-9-])i','(-+)'],['-','','-'], |
60 | 62 | strtolower(self::removeAccents($text))); |
@@ -72,7 +74,7 @@ discard block |
||
72 | 74 | * @param string $text The text to translit |
73 | 75 | * @return string The translited text |
74 | 76 | */ |
75 | - public static function removeAccents($text){ |
|
77 | + public static function removeAccents($text) { |
|
76 | 78 | static $diac; |
77 | 79 | return strtr( |
78 | 80 | utf8_decode($text), |