@@ -21,5 +21,5 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | function Dwoo_Plugin_upper_compile(Dwoo_Compiler $compiler, $value) |
| 23 | 23 | { |
| 24 | - return 'mb_strtoupper((string) '.$value.', $this->charset)'; |
|
| 24 | + return 'mb_strtoupper((string) '.$value.', $this->charset)'; |
|
| 25 | 25 | } |
@@ -19,5 +19,5 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | function Dwoo_Plugin_eol_compile(Dwoo_Compiler $compiler) |
| 21 | 21 | { |
| 22 | - return 'PHP_EOL'; |
|
| 22 | + return 'PHP_EOL'; |
|
| 23 | 23 | } |
@@ -21,5 +21,5 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | function Dwoo_Plugin_count_words_compile(Dwoo_Compiler $compiler, $value) |
| 23 | 23 | { |
| 24 | - return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', '.$value.', $tmp)'; |
|
| 24 | + return 'preg_match_all(strcasecmp($this->charset, \'utf-8\')===0 ? \'#[\w\pL]+#u\' : \'#\w+#\', '.$value.', $tmp)'; |
|
| 25 | 25 | } |
@@ -22,5 +22,5 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | function Dwoo_Plugin_string_format_compile(Dwoo_Compiler $compiler, $value, $format) |
| 24 | 24 | { |
| 25 | - return 'sprintf('.$format.','.$value.')'; |
|
| 25 | + return 'sprintf('.$format.','.$value.')'; |
|
| 26 | 26 | } |
@@ -21,5 +21,5 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | function Dwoo_Plugin_cat_compile(Dwoo_Compiler $compiler, $value, array $rest) |
| 23 | 23 | { |
| 24 | - return '('.$value.').('.implode(').(', $rest).')'; |
|
| 24 | + return '('.$value.').('.implode(').(', $rest).')'; |
|
| 25 | 25 | } |
@@ -22,32 +22,32 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | function Dwoo_Plugin_fetch(Dwoo_Core $dwoo, $file, $assign = null) |
| 24 | 24 | { |
| 25 | - if ($file === '') { |
|
| 26 | - return ''; |
|
| 27 | - } |
|
| 25 | + if ($file === '') { |
|
| 26 | + return ''; |
|
| 27 | + } |
|
| 28 | 28 | |
| 29 | - if ($policy = $dwoo->getSecurityPolicy()) { |
|
| 30 | - while (true) { |
|
| 31 | - if (preg_match('{^([a-z]+?)://}i', $file)) { |
|
| 32 | - $dwoo->triggerError('The security policy prevents you to read files from external sources.', E_USER_WARNING); |
|
| 33 | - } |
|
| 29 | + if ($policy = $dwoo->getSecurityPolicy()) { |
|
| 30 | + while (true) { |
|
| 31 | + if (preg_match('{^([a-z]+?)://}i', $file)) { |
|
| 32 | + $dwoo->triggerError('The security policy prevents you to read files from external sources.', E_USER_WARNING); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - $file = realpath($file); |
|
| 36 | - $dirs = $policy->getAllowedDirectories(); |
|
| 37 | - foreach ($dirs as $dir => $dummy) { |
|
| 38 | - if (strpos($file, $dir) === 0) { |
|
| 39 | - break 2; |
|
| 40 | - } |
|
| 41 | - } |
|
| 42 | - $dwoo->triggerError('The security policy prevents you to read <em>'.$file.'</em>', E_USER_WARNING); |
|
| 43 | - } |
|
| 44 | - } |
|
| 45 | - $file = str_replace(array("\t", "\n", "\r"), array('\\t', '\\n', '\\r'), $file); |
|
| 35 | + $file = realpath($file); |
|
| 36 | + $dirs = $policy->getAllowedDirectories(); |
|
| 37 | + foreach ($dirs as $dir => $dummy) { |
|
| 38 | + if (strpos($file, $dir) === 0) { |
|
| 39 | + break 2; |
|
| 40 | + } |
|
| 41 | + } |
|
| 42 | + $dwoo->triggerError('The security policy prevents you to read <em>'.$file.'</em>', E_USER_WARNING); |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | + $file = str_replace(array("\t", "\n", "\r"), array('\\t', '\\n', '\\r'), $file); |
|
| 46 | 46 | |
| 47 | - $out = file_get_contents($file); |
|
| 47 | + $out = file_get_contents($file); |
|
| 48 | 48 | |
| 49 | - if ($assign === null) { |
|
| 50 | - return $out; |
|
| 51 | - } |
|
| 52 | - $dwoo->assignInScope($out, $assign); |
|
| 49 | + if ($assign === null) { |
|
| 50 | + return $out; |
|
| 51 | + } |
|
| 52 | + $dwoo->assignInScope($out, $assign); |
|
| 53 | 53 | } |
@@ -23,36 +23,36 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | function Dwoo_Plugin_date_format(Dwoo_Core $dwoo, $value, $format = '%b %e, %Y', $default = null) |
| 25 | 25 | { |
| 26 | - if (!empty($value)) { |
|
| 27 | - // convert if it's not a valid unix timestamp |
|
| 28 | - if (preg_match('#^-?\d{1,10}$#', $value) === 0) { |
|
| 29 | - $value = strtotime($value); |
|
| 30 | - } |
|
| 31 | - } elseif (!empty($default)) { |
|
| 32 | - // convert if it's not a valid unix timestamp |
|
| 33 | - if (preg_match('#^-?\d{1,10}$#', $default) === 0) { |
|
| 34 | - $value = strtotime($default); |
|
| 35 | - } else { |
|
| 36 | - $value = $default; |
|
| 37 | - } |
|
| 38 | - } else { |
|
| 39 | - return ''; |
|
| 40 | - } |
|
| 26 | + if (!empty($value)) { |
|
| 27 | + // convert if it's not a valid unix timestamp |
|
| 28 | + if (preg_match('#^-?\d{1,10}$#', $value) === 0) { |
|
| 29 | + $value = strtotime($value); |
|
| 30 | + } |
|
| 31 | + } elseif (!empty($default)) { |
|
| 32 | + // convert if it's not a valid unix timestamp |
|
| 33 | + if (preg_match('#^-?\d{1,10}$#', $default) === 0) { |
|
| 34 | + $value = strtotime($default); |
|
| 35 | + } else { |
|
| 36 | + $value = $default; |
|
| 37 | + } |
|
| 38 | + } else { |
|
| 39 | + return ''; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin |
|
| 43 | - if (DIRECTORY_SEPARATOR == '\\') { |
|
| 44 | - $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
| 45 | - $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); |
|
| 46 | - if (strpos($format, '%e') !== false) { |
|
| 47 | - $_win_from[] = '%e'; |
|
| 48 | - $_win_to[] = sprintf('%\' 2d', date('j', $value)); |
|
| 49 | - } |
|
| 50 | - if (strpos($format, '%l') !== false) { |
|
| 51 | - $_win_from[] = '%l'; |
|
| 52 | - $_win_to[] = sprintf('%\' 2d', date('h', $value)); |
|
| 53 | - } |
|
| 54 | - $format = str_replace($_win_from, $_win_to, $format); |
|
| 55 | - } |
|
| 42 | + // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin |
|
| 43 | + if (DIRECTORY_SEPARATOR == '\\') { |
|
| 44 | + $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
| 45 | + $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); |
|
| 46 | + if (strpos($format, '%e') !== false) { |
|
| 47 | + $_win_from[] = '%e'; |
|
| 48 | + $_win_to[] = sprintf('%\' 2d', date('j', $value)); |
|
| 49 | + } |
|
| 50 | + if (strpos($format, '%l') !== false) { |
|
| 51 | + $_win_from[] = '%l'; |
|
| 52 | + $_win_to[] = sprintf('%\' 2d', date('h', $value)); |
|
| 53 | + } |
|
| 54 | + $format = str_replace($_win_from, $_win_to, $format); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - return strftime($format, $value); |
|
| 57 | + return strftime($format, $value); |
|
| 58 | 58 | } |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | |
| 42 | 42 | // Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin |
| 43 | 43 | if (DIRECTORY_SEPARATOR == '\\') { |
| 44 | - $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
| 44 | + $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T'); |
|
| 45 | 45 | $_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S'); |
| 46 | 46 | if (strpos($format, '%e') !== false) { |
| 47 | 47 | $_win_from[] = '%e'; |
@@ -22,156 +22,156 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | class Dwoo_Plugin_dump extends Dwoo_Plugin |
| 24 | 24 | { |
| 25 | - protected $outputObjects; |
|
| 26 | - protected $outputMethods; |
|
| 27 | - |
|
| 28 | - public function process($var = '$', $show_methods = false) |
|
| 29 | - { |
|
| 30 | - $this->outputMethods = $show_methods; |
|
| 31 | - if ($var === '$') { |
|
| 32 | - $var = $this->dwoo->getData(); |
|
| 33 | - $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">data'; |
|
| 34 | - } else { |
|
| 35 | - $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">dump'; |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - $this->outputObjects = array(); |
|
| 39 | - |
|
| 40 | - if (!is_array($var)) { |
|
| 41 | - if (is_object($var)) { |
|
| 42 | - return $this->exportObj('', $var); |
|
| 43 | - } else { |
|
| 44 | - return $this->exportVar('', $var); |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - $scope = $this->dwoo->getScope(); |
|
| 49 | - |
|
| 50 | - if ($var === $scope) { |
|
| 51 | - $out .= ' (current scope): <div style="background:#ccc;">'; |
|
| 52 | - } else { |
|
| 53 | - $out .= ':<div style="padding-left:20px;">'; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - $out .= $this->export($var, $scope); |
|
| 57 | - |
|
| 58 | - return $out.'</div></div>'; |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - protected function export($var, $scope) |
|
| 62 | - { |
|
| 63 | - $out = ''; |
|
| 64 | - foreach ($var as $i => $v) { |
|
| 65 | - if (is_array($v) || (is_object($v) && $v instanceof Iterator)) { |
|
| 66 | - $out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')'; |
|
| 67 | - if ($v === $scope) { |
|
| 68 | - $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>'; |
|
| 69 | - } else { |
|
| 70 | - $out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>'; |
|
| 71 | - } |
|
| 72 | - } elseif (is_object($v)) { |
|
| 73 | - $out .= $this->exportObj($i.' (object: '.get_class($v).'):', $v); |
|
| 74 | - } else { |
|
| 75 | - $out .= $this->exportVar($i.' = ', $v); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - return $out; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - protected function exportVar($i, $v) |
|
| 83 | - { |
|
| 84 | - if (is_string($v) || is_bool($v) || is_numeric($v)) { |
|
| 85 | - return $i.htmlentities(var_export($v, true)).'<br />'; |
|
| 86 | - } elseif (is_null($v)) { |
|
| 87 | - return $i.'null<br />'; |
|
| 88 | - } elseif (is_resource($v)) { |
|
| 89 | - return $i.'resource('.get_resource_type($v).')<br />'; |
|
| 90 | - } else { |
|
| 91 | - return $i.htmlentities(var_export($v, true)).'<br />'; |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - protected function exportObj($i, $obj) |
|
| 96 | - { |
|
| 97 | - if (array_search($obj, $this->outputObjects, true) !== false) { |
|
| 98 | - return $i.' [recursion, skipped]<br />'; |
|
| 99 | - } |
|
| 100 | - |
|
| 101 | - $this->outputObjects[] = $obj; |
|
| 102 | - |
|
| 103 | - $list = (array) $obj; |
|
| 104 | - |
|
| 105 | - $protectedLength = strlen(get_class($obj)) + 2; |
|
| 106 | - |
|
| 107 | - $out = array(); |
|
| 108 | - |
|
| 109 | - if ($this->outputMethods) { |
|
| 110 | - $ref = new ReflectionObject($obj); |
|
| 111 | - |
|
| 112 | - foreach ($ref->getMethods() as $method) { |
|
| 113 | - if (!$method->isPublic()) { |
|
| 114 | - continue; |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - if (empty($out['method'])) { |
|
| 118 | - $out['method'] = ''; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - $params = array(); |
|
| 122 | - foreach ($method->getParameters() as $param) { |
|
| 123 | - $params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : ''); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - $out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />'; |
|
| 127 | - } |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - foreach ($list as $attributeName => $attributeValue) { |
|
| 131 | - if (property_exists($obj, $attributeName)) { |
|
| 132 | - $key = 'public'; |
|
| 133 | - } elseif (substr($attributeName, 0, 3) === "\0*\0") { |
|
| 134 | - $key = 'protected'; |
|
| 135 | - $attributeName = substr($attributeName, 3); |
|
| 136 | - } else { |
|
| 137 | - $key = 'private'; |
|
| 138 | - $attributeName = substr($attributeName, $protectedLength); |
|
| 139 | - } |
|
| 140 | - |
|
| 141 | - if (empty($out[$key])) { |
|
| 142 | - $out[$key] = ''; |
|
| 143 | - } |
|
| 144 | - |
|
| 145 | - $out[$key] .= '('.$key.') '; |
|
| 146 | - |
|
| 147 | - if (is_array($attributeValue)) { |
|
| 148 | - $out[$key] .= $attributeName.' (array):<br /> |
|
| 25 | + protected $outputObjects; |
|
| 26 | + protected $outputMethods; |
|
| 27 | + |
|
| 28 | + public function process($var = '$', $show_methods = false) |
|
| 29 | + { |
|
| 30 | + $this->outputMethods = $show_methods; |
|
| 31 | + if ($var === '$') { |
|
| 32 | + $var = $this->dwoo->getData(); |
|
| 33 | + $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">data'; |
|
| 34 | + } else { |
|
| 35 | + $out = '<div style="background:#aaa; padding:5px; margin:5px; color:#000;">dump'; |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + $this->outputObjects = array(); |
|
| 39 | + |
|
| 40 | + if (!is_array($var)) { |
|
| 41 | + if (is_object($var)) { |
|
| 42 | + return $this->exportObj('', $var); |
|
| 43 | + } else { |
|
| 44 | + return $this->exportVar('', $var); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + $scope = $this->dwoo->getScope(); |
|
| 49 | + |
|
| 50 | + if ($var === $scope) { |
|
| 51 | + $out .= ' (current scope): <div style="background:#ccc;">'; |
|
| 52 | + } else { |
|
| 53 | + $out .= ':<div style="padding-left:20px;">'; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + $out .= $this->export($var, $scope); |
|
| 57 | + |
|
| 58 | + return $out.'</div></div>'; |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + protected function export($var, $scope) |
|
| 62 | + { |
|
| 63 | + $out = ''; |
|
| 64 | + foreach ($var as $i => $v) { |
|
| 65 | + if (is_array($v) || (is_object($v) && $v instanceof Iterator)) { |
|
| 66 | + $out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')'; |
|
| 67 | + if ($v === $scope) { |
|
| 68 | + $out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>'; |
|
| 69 | + } else { |
|
| 70 | + $out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>'; |
|
| 71 | + } |
|
| 72 | + } elseif (is_object($v)) { |
|
| 73 | + $out .= $this->exportObj($i.' (object: '.get_class($v).'):', $v); |
|
| 74 | + } else { |
|
| 75 | + $out .= $this->exportVar($i.' = ', $v); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + return $out; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + protected function exportVar($i, $v) |
|
| 83 | + { |
|
| 84 | + if (is_string($v) || is_bool($v) || is_numeric($v)) { |
|
| 85 | + return $i.htmlentities(var_export($v, true)).'<br />'; |
|
| 86 | + } elseif (is_null($v)) { |
|
| 87 | + return $i.'null<br />'; |
|
| 88 | + } elseif (is_resource($v)) { |
|
| 89 | + return $i.'resource('.get_resource_type($v).')<br />'; |
|
| 90 | + } else { |
|
| 91 | + return $i.htmlentities(var_export($v, true)).'<br />'; |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + protected function exportObj($i, $obj) |
|
| 96 | + { |
|
| 97 | + if (array_search($obj, $this->outputObjects, true) !== false) { |
|
| 98 | + return $i.' [recursion, skipped]<br />'; |
|
| 99 | + } |
|
| 100 | + |
|
| 101 | + $this->outputObjects[] = $obj; |
|
| 102 | + |
|
| 103 | + $list = (array) $obj; |
|
| 104 | + |
|
| 105 | + $protectedLength = strlen(get_class($obj)) + 2; |
|
| 106 | + |
|
| 107 | + $out = array(); |
|
| 108 | + |
|
| 109 | + if ($this->outputMethods) { |
|
| 110 | + $ref = new ReflectionObject($obj); |
|
| 111 | + |
|
| 112 | + foreach ($ref->getMethods() as $method) { |
|
| 113 | + if (!$method->isPublic()) { |
|
| 114 | + continue; |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + if (empty($out['method'])) { |
|
| 118 | + $out['method'] = ''; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + $params = array(); |
|
| 122 | + foreach ($method->getParameters() as $param) { |
|
| 123 | + $params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : ''); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + $out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />'; |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + foreach ($list as $attributeName => $attributeValue) { |
|
| 131 | + if (property_exists($obj, $attributeName)) { |
|
| 132 | + $key = 'public'; |
|
| 133 | + } elseif (substr($attributeName, 0, 3) === "\0*\0") { |
|
| 134 | + $key = 'protected'; |
|
| 135 | + $attributeName = substr($attributeName, 3); |
|
| 136 | + } else { |
|
| 137 | + $key = 'private'; |
|
| 138 | + $attributeName = substr($attributeName, $protectedLength); |
|
| 139 | + } |
|
| 140 | + |
|
| 141 | + if (empty($out[$key])) { |
|
| 142 | + $out[$key] = ''; |
|
| 143 | + } |
|
| 144 | + |
|
| 145 | + $out[$key] .= '('.$key.') '; |
|
| 146 | + |
|
| 147 | + if (is_array($attributeValue)) { |
|
| 148 | + $out[$key] .= $attributeName.' (array):<br /> |
|
| 149 | 149 | <div style="padding-left:20px;">'.$this->export($attributeValue, false).'</div>'; |
| 150 | - } elseif (is_object($attributeValue)) { |
|
| 151 | - $out[$key] .= $this->exportObj($attributeName.' (object: '.get_class($attributeValue).'):', $attributeValue); |
|
| 152 | - } else { |
|
| 153 | - $out[$key] .= $this->exportVar($attributeName.' = ', $attributeValue); |
|
| 154 | - } |
|
| 155 | - } |
|
| 150 | + } elseif (is_object($attributeValue)) { |
|
| 151 | + $out[$key] .= $this->exportObj($attributeName.' (object: '.get_class($attributeValue).'):', $attributeValue); |
|
| 152 | + } else { |
|
| 153 | + $out[$key] .= $this->exportVar($attributeName.' = ', $attributeValue); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | 156 | |
| 157 | - $return = $i.'<br /><div style="padding-left:20px;">'; |
|
| 157 | + $return = $i.'<br /><div style="padding-left:20px;">'; |
|
| 158 | 158 | |
| 159 | - if (!empty($out['method'])) { |
|
| 160 | - $return .= $out['method']; |
|
| 161 | - } |
|
| 159 | + if (!empty($out['method'])) { |
|
| 160 | + $return .= $out['method']; |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - if (!empty($out['public'])) { |
|
| 164 | - $return .= $out['public']; |
|
| 165 | - } |
|
| 163 | + if (!empty($out['public'])) { |
|
| 164 | + $return .= $out['public']; |
|
| 165 | + } |
|
| 166 | 166 | |
| 167 | - if (!empty($out['protected'])) { |
|
| 168 | - $return .= $out['protected']; |
|
| 169 | - } |
|
| 167 | + if (!empty($out['protected'])) { |
|
| 168 | + $return .= $out['protected']; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - if (!empty($out['private'])) { |
|
| 172 | - $return .= $out['private']; |
|
| 173 | - } |
|
| 171 | + if (!empty($out['private'])) { |
|
| 172 | + $return .= $out['private']; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - return $return.'</div>'; |
|
| 176 | - } |
|
| 175 | + return $return.'</div>'; |
|
| 176 | + } |
|
| 177 | 177 | } |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | |
| 103 | 103 | $list = (array) $obj; |
| 104 | 104 | |
| 105 | - $protectedLength = strlen(get_class($obj)) + 2; |
|
| 105 | + $protectedLength = strlen(get_class($obj))+2; |
|
| 106 | 106 | |
| 107 | 107 | $out = array(); |
| 108 | 108 | |
@@ -23,19 +23,19 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | function Dwoo_Plugin_regex_replace(Dwoo_Core $dwoo, $value, $search, $replace) |
| 25 | 25 | { |
| 26 | - $search = (array) $search; |
|
| 27 | - $cnt = count($search); |
|
| 26 | + $search = (array) $search; |
|
| 27 | + $cnt = count($search); |
|
| 28 | 28 | |
| 29 | - for ($i = 0; $i < $cnt; ++$i) { |
|
| 30 | - // Credits for this to Monte Ohrt who made smarty's regex_replace modifier |
|
| 31 | - if (($pos = strpos($search[$i], "\0")) !== false) { |
|
| 32 | - $search[$i] = substr($search[$i], 0, $pos); |
|
| 33 | - } |
|
| 29 | + for ($i = 0; $i < $cnt; ++$i) { |
|
| 30 | + // Credits for this to Monte Ohrt who made smarty's regex_replace modifier |
|
| 31 | + if (($pos = strpos($search[$i], "\0")) !== false) { |
|
| 32 | + $search[$i] = substr($search[$i], 0, $pos); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) { |
|
| 36 | - $search[$i] = substr($search[$i], 0, -strlen($m[0])).str_replace(array('e', ' '), '', $m[0]); |
|
| 37 | - } |
|
| 38 | - } |
|
| 35 | + if (preg_match('#[a-z\s]+$#is', $search[$i], $m) && (strpos($m[0], 'e') !== false)) { |
|
| 36 | + $search[$i] = substr($search[$i], 0, -strlen($m[0])).str_replace(array('e', ' '), '', $m[0]); |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - return preg_replace($search, $replace, $value); |
|
| 40 | + return preg_replace($search, $replace, $value); |
|
| 41 | 41 | } |