@@ -19,7 +19,7 @@ |
||
| 19 | 19 | * @date 2008-10-23 |
| 20 | 20 | * @package Dwoo |
| 21 | 21 | */ |
| 22 | -function Dwoo_Plugin_wordwrap_compile(Dwoo_Compiler $compiler, $value, $length=80, $break="\n", $cut=false) |
|
| 22 | +function Dwoo_Plugin_wordwrap_compile(Dwoo_Compiler $compiler, $value, $length = 80, $break = "\n", $cut = false) |
|
| 23 | 23 | { |
| 24 | 24 | return 'wordwrap('.$value.','.$length.','.$break.','.$cut.')'; |
| 25 | 25 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) { |
| 33 | - $search[$i] = substr($search[$i], 0, -strlen($m[0])) . str_replace(array('e', ' '), '', $m[0]); |
|
| 33 | + $search[$i] = substr($search[$i], 0, -strlen($m[0])).str_replace(array('e', ' '), '', $m[0]); |
|
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
@@ -17,11 +17,11 @@ |
||
| 17 | 17 | * @date 2008-10-23 |
| 18 | 18 | * @package Dwoo |
| 19 | 19 | */ |
| 20 | -function Dwoo_Plugin_reverse(Dwoo_Core $dwoo, $value, $preserve_keys=false) |
|
| 20 | +function Dwoo_Plugin_reverse(Dwoo_Core $dwoo, $value, $preserve_keys = false) |
|
| 21 | 21 | { |
| 22 | 22 | if (is_array($value)) { |
| 23 | 23 | return array_reverse($value, $preserve_keys); |
| 24 | - } elseif(($charset=$dwoo->getCharset()) === 'iso-8859-1') { |
|
| 24 | + } elseif (($charset = $dwoo->getCharset()) === 'iso-8859-1') { |
|
| 25 | 25 | return strrev((string) $value); |
| 26 | 26 | } else { |
| 27 | 27 | $strlen = mb_strlen($value); |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | * @date 2008-10-23 |
| 28 | 28 | * @package Dwoo |
| 29 | 29 | */ |
| 30 | -function Dwoo_Plugin_whitespace_compile(Dwoo_Compiler $compiler, $value, $with=' ') |
|
| 30 | +function Dwoo_Plugin_whitespace_compile(Dwoo_Compiler $compiler, $value, $with = ' ') |
|
| 31 | 31 | { |
| 32 | 32 | return "preg_replace('#\s+#'.(strcasecmp(\$this->charset, 'utf-8')===0?'u':''), $with, $value)"; |
| 33 | 33 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @date 2009-07-18 |
| 21 | 21 | * @package Dwoo |
| 22 | 22 | */ |
| 23 | -function Dwoo_Plugin_truncate(Dwoo_Core $dwoo, $value, $length=80, $etc='...', $break=false, $middle=false) |
|
| 23 | +function Dwoo_Plugin_truncate(Dwoo_Core $dwoo, $value, $length = 80, $etc = '...', $break = false, $middle = false) |
|
| 24 | 24 | { |
| 25 | 25 | if ($length == 0) { |
| 26 | 26 | return ''; |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | return $value; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $length = max($length - strlen($etc), 0); |
|
| 37 | + $length = max($length-strlen($etc), 0); |
|
| 38 | 38 | if ($break === false && $middle === false) { |
| 39 | 39 | $value = preg_replace('#\s+(\S*)?$#', '', substr($value, 0, $length+1)); |
| 40 | 40 | } |
| 41 | 41 | if ($middle === false) { |
| 42 | - return substr($value, 0, $length) . $etc; |
|
| 42 | + return substr($value, 0, $length).$etc; |
|
| 43 | 43 | } |
| 44 | - return substr($value, 0, ceil($length/2)) . $etc . substr($value, -floor($length/2)); |
|
| 44 | + return substr($value, 0, ceil($length/2)).$etc.substr($value, -floor($length/2)); |
|
| 45 | 45 | } |
@@ -17,9 +17,9 @@ |
||
| 17 | 17 | * @date 2008-10-23 |
| 18 | 18 | * @package Dwoo |
| 19 | 19 | */ |
| 20 | -function Dwoo_Plugin_count_characters_compile(Dwoo_Compiler $compiler, $value, $count_spaces=false) |
|
| 20 | +function Dwoo_Plugin_count_characters_compile(Dwoo_Compiler $compiler, $value, $count_spaces = false) |
|
| 21 | 21 | { |
| 22 | - if ($count_spaces==='false') { |
|
| 22 | + if ($count_spaces === 'false') { |
|
| 23 | 23 | return 'preg_match_all(\'#[^\s\pZ]#u\', '.$value.', $tmp)'; |
| 24 | 24 | } else { |
| 25 | 25 | return 'mb_strlen('.$value.', $this->charset)'; |
@@ -17,19 +17,19 @@ |
||
| 17 | 17 | * @date 2009-07-18 |
| 18 | 18 | * @package Dwoo |
| 19 | 19 | */ |
| 20 | -function Dwoo_Plugin_capitalize(Dwoo_Core $dwoo, $value, $numwords=false) |
|
| 20 | +function Dwoo_Plugin_capitalize(Dwoo_Core $dwoo, $value, $numwords = false) |
|
| 21 | 21 | { |
| 22 | - if ($numwords || preg_match('#^[^0-9]+$#',$value)) |
|
| 22 | + if ($numwords || preg_match('#^[^0-9]+$#', $value)) |
|
| 23 | 23 | { |
| 24 | - return mb_convert_case((string) $value,MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 24 | + return mb_convert_case((string) $value, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 25 | 25 | } else { |
| 26 | 26 | $bits = explode(' ', (string) $value); |
| 27 | 27 | $out = ''; |
| 28 | 28 | while (list(,$v) = each($bits)) { |
| 29 | 29 | if (preg_match('#^[^0-9]+$#', $v)) { |
| 30 | - $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 30 | + $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset()); |
|
| 31 | 31 | } else { |
| 32 | - $out .= ' '.$v; |
|
| 32 | + $out .= ' '.$v; |
|
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | |
@@ -70,5 +70,5 @@ |
||
| 70 | 70 | // parse condition |
| 71 | 71 | $condition = Dwoo_Plugin_if::replaceKeywords($rest, $tokens, $compiler); |
| 72 | 72 | |
| 73 | - return '(('.implode(' ', $condition).') ? '.($trueResult===true ? implode(' ', $condition) : $trueResult).' : '.$falseResult.')'; |
|
| 73 | + return '(('.implode(' ', $condition).') ? '.($trueResult === true ? implode(' ', $condition) : $trueResult).' : '.$falseResult.')'; |
|
| 74 | 74 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (count($rest)) { |
| 62 | - $vars = $rest + $vars; |
|
| 62 | + $vars = $rest+$vars; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $clone = clone $dwoo; |