Completed
Branch 1.2 (459185)
by David
04:06
created
lib/plugins/builtin/blocks/loop.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,16 +40,16 @@  discard block
 block discarded – undo
40 40
  */
41 41
 class Dwoo_Plugin_loop extends Dwoo_Block_Plugin implements Dwoo_ICompilable_Block, Dwoo_IElseable
42 42
 {
43
-	public static $cnt=0;
43
+	public static $cnt = 0;
44 44
 
45
-	public function init($from, $name='default')
45
+	public function init($from, $name = 'default')
46 46
 	{
47 47
 	}
48 48
 
49 49
 	public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
50 50
 	{
51 51
 		// get block params and save the current template pointer to use it in the postProcessing method
52
-		$currentBlock =& $compiler->getCurrentBlock();
52
+		$currentBlock = & $compiler->getCurrentBlock();
53 53
 		$currentBlock['params']['tplPointer'] = $compiler->getPointer();
54 54
 
55 55
 		return '';
@@ -83,17 +83,17 @@  discard block
 block discarded – undo
83 83
 		$cnt = self::$cnt++;
84 84
 
85 85
 		// builds pre processing output
86
-		$pre = Dwoo_Compiler::PHP_OPEN . "\n".'$_loop'.$cnt.'_data = '.$src.';';
86
+		$pre = Dwoo_Compiler::PHP_OPEN."\n".'$_loop'.$cnt.'_data = '.$src.';';
87 87
 		// adds foreach properties
88 88
 		if ($usesAny) {
89 89
 			$pre .= "\n".'$this->globals["loop"]['.$name.'] = array'."\n(";
90
-			if ($usesIndex) $pre .="\n\t".'"index"		=> 0,';
91
-			if ($usesIteration) $pre .="\n\t".'"iteration"		=> 1,';
92
-			if ($usesFirst) $pre .="\n\t".'"first"		=> null,';
93
-			if ($usesLast) $pre .="\n\t".'"last"		=> null,';
94
-			if ($usesShow) $pre .="\n\t".'"show"		=> $this->isTraversable($_loop'.$cnt.'_data, true),';
95
-			if ($usesTotal) $pre .="\n\t".'"total"		=> $this->count($_loop'.$cnt.'_data),';
96
-			$pre.="\n);\n".'$_loop'.$cnt.'_glob =& $this->globals["loop"]['.$name.'];';
90
+			if ($usesIndex) $pre .= "\n\t".'"index"		=> 0,';
91
+			if ($usesIteration) $pre .= "\n\t".'"iteration"		=> 1,';
92
+			if ($usesFirst) $pre .= "\n\t".'"first"		=> null,';
93
+			if ($usesLast) $pre .= "\n\t".'"last"		=> null,';
94
+			if ($usesShow) $pre .= "\n\t".'"show"		=> $this->isTraversable($_loop'.$cnt.'_data, true),';
95
+			if ($usesTotal) $pre .= "\n\t".'"total"		=> $this->count($_loop'.$cnt.'_data),';
96
+			$pre .= "\n);\n".'$_loop'.$cnt.'_glob =& $this->globals["loop"]['.$name.'];';
97 97
 		}
98 98
 		// checks if the loop must be looped
99 99
 		$pre .= "\n".'if ($this->isTraversable($_loop'.$cnt.'_data'.(isset($params['hasElse']) ? ', true' : '').') == true)'."\n{";
@@ -106,23 +106,23 @@  discard block
 block discarded – undo
106 106
 		if ($usesLast) {
107 107
 			$pre .= "\n\t\t".'$_loop'.$cnt.'_glob["last"] = (string) ($_loop'.$cnt.'_glob["iteration"] === $_loop'.$cnt.'_glob["total"]);';
108 108
 		}
109
-		$pre .= "\n\t\t".'$_loop'.$cnt.'_scope = $this->setScope(array("-loop-"));' . "\n/* -- loop start output */\n".Dwoo_Compiler::PHP_CLOSE;
109
+		$pre .= "\n\t\t".'$_loop'.$cnt.'_scope = $this->setScope(array("-loop-"));'."\n/* -- loop start output */\n".Dwoo_Compiler::PHP_CLOSE;
110 110
 
111 111
 		// build post processing output and cache it
112
-		$post = Dwoo_Compiler::PHP_OPEN . "\n".'/* -- loop end output */'."\n\t\t".'$this->setScope($_loop'.$cnt.'_scope, true);';
112
+		$post = Dwoo_Compiler::PHP_OPEN."\n".'/* -- loop end output */'."\n\t\t".'$this->setScope($_loop'.$cnt.'_scope, true);';
113 113
 		// update properties
114 114
 		if ($usesIndex) {
115
-			$post.="\n\t\t".'$_loop'.$cnt.'_glob["index"]+=1;';
115
+			$post .= "\n\t\t".'$_loop'.$cnt.'_glob["index"]+=1;';
116 116
 		}
117 117
 		if ($usesIteration) {
118
-			$post.="\n\t\t".'$_loop'.$cnt.'_glob["iteration"]+=1;';
118
+			$post .= "\n\t\t".'$_loop'.$cnt.'_glob["iteration"]+=1;';
119 119
 		}
120 120
 		// end loop
121
-		$post .= "\n\t}\n}\n" . Dwoo_Compiler::PHP_CLOSE;
121
+		$post .= "\n\t}\n}\n".Dwoo_Compiler::PHP_CLOSE;
122 122
 		if (isset($params['hasElse'])) {
123 123
 			$post .= $params['hasElse'];
124 124
 		}
125 125
 
126
-		return $pre . $content . $post;
126
+		return $pre.$content.$post;
127 127
 	}
128 128
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/blocks/withelse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 
23 23
 	public static function preProcessing(Dwoo_Compiler $compiler, array $params, $prepend, $append, $type)
24 24
 	{
25
-		$with =& $compiler->findBlock('with', true);
25
+		$with = & $compiler->findBlock('with', true);
26 26
 
27 27
 		$params['initialized'] = true;
28 28
 		$compiler->injectBlock($type, $params);
@@ -36,8 +36,8 @@  discard block
 block discarded – undo
36 36
 			return '';
37 37
 		}
38 38
 
39
-		$block =& $compiler->getCurrentBlock();
40
-		$block['params']['hasElse'] = Dwoo_Compiler::PHP_OPEN."else {\n".Dwoo_Compiler::PHP_CLOSE . $content . Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE;
39
+		$block = & $compiler->getCurrentBlock();
40
+		$block['params']['hasElse'] = Dwoo_Compiler::PHP_OPEN."else {\n".Dwoo_Compiler::PHP_CLOSE.$content.Dwoo_Compiler::PHP_OPEN."\n}".Dwoo_Compiler::PHP_CLOSE;
41 41
 		return '';
42 42
 	}
43 43
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/helper.array.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
  * @date       2008-10-23
24 24
  * @package    Dwoo
25 25
  */
26
-function Dwoo_Plugin_array_compile(Dwoo_Compiler $compiler, array $rest=array())
26
+function Dwoo_Plugin_array_compile(Dwoo_Compiler $compiler, array $rest = array())
27 27
 {
28 28
 	$out = array();
29 29
 	foreach ($rest as $key => $value) {
Please login to merge, or discard this patch.
lib/plugins/builtin/filters/html_format.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -66,19 +66,19 @@  discard block
 block discarded – undo
66 66
 	protected static function tagDispatcher($input)
67 67
 	{
68 68
 		// textarea, pre, code tags and comments are to be left alone to avoid any non-wanted whitespace inside them so it just outputs them as they were
69
-		if (substr($input[1],0,9) == "<textarea" || substr($input[1],0,4) == "<pre" || substr($input[1],0,5) == "<code" || substr($input[1],0,4) == "<!--" || substr($input[1],0,9) == "<![CDATA[") {
70
-			return $input[1] . $input[3];
69
+		if (substr($input[1], 0, 9) == "<textarea" || substr($input[1], 0, 4) == "<pre" || substr($input[1], 0, 5) == "<code" || substr($input[1], 0, 4) == "<!--" || substr($input[1], 0, 9) == "<![CDATA[") {
70
+			return $input[1].$input[3];
71 71
 		}
72 72
 		// closing textarea, code and pre tags and self-closed tags (i.e. <br />) are printed as singleTags because we didn't use openTag for the formers and the latter is a single tag
73
-		if (substr($input[1],0,10) == "</textarea" || substr($input[1],0,5) == "</pre" || substr($input[1],0,6) == "</code" || substr($input[1],-2) == "/>") {
74
-			return self::singleTag($input[1],$input[3],$input[2]);
73
+		if (substr($input[1], 0, 10) == "</textarea" || substr($input[1], 0, 5) == "</pre" || substr($input[1], 0, 6) == "</code" || substr($input[1], -2) == "/>") {
74
+			return self::singleTag($input[1], $input[3], $input[2]);
75 75
 		}
76 76
 		// it's the closing tag
77
-		if ($input[0][1]=="/"){
78
-			return self::closeTag($input[1],$input[3],$input[2]);
77
+		if ($input[0][1] == "/") {
78
+			return self::closeTag($input[1], $input[3], $input[2]);
79 79
 		}
80 80
 		// opening tag
81
-		return self::openTag($input[1],$input[3],$input[2]);
81
+		return self::openTag($input[1], $input[3], $input[2]);
82 82
 	}
83 83
 
84 84
 	/**
@@ -89,22 +89,22 @@  discard block
 block discarded – undo
89 89
 	 * @param string $whitespace white space between the tag and the additional data
90 90
 	 * @return string
91 91
 	 */
92
-	protected static function openTag($tag,$add,$whitespace)
92
+	protected static function openTag($tag, $add, $whitespace)
93 93
 	{
94
-		$tabs = str_pad('',self::$tabCount++,"\t");
94
+		$tabs = str_pad('', self::$tabCount++, "\t");
95 95
 
96 96
 		if (preg_match('#^<(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)(?: [^>]*|)>#', $tag)) {
97 97
 			// if it's one of those tag it's inline so it does not require a leading line break
98
-			$result = $tag . $whitespace . str_replace("\n","\n".$tabs,$add);
99
-		} elseif (substr($tag,0,9) == '<!DOCTYPE') {
98
+			$result = $tag.$whitespace.str_replace("\n", "\n".$tabs, $add);
99
+		} elseif (substr($tag, 0, 9) == '<!DOCTYPE') {
100 100
 			// it's the doctype declaration so no line break here either
101
-			$result = $tabs . $tag;
101
+			$result = $tabs.$tag;
102 102
 		} else {
103 103
 			// normal block tag
104
-			$result = "\n".$tabs . $tag;
104
+			$result = "\n".$tabs.$tag;
105 105
 
106 106
 			if (!empty($add)) {
107
-				$result .= "\n".$tabs."\t".str_replace("\n","\n\t".$tabs,$add);
107
+				$result .= "\n".$tabs."\t".str_replace("\n", "\n\t".$tabs, $add);
108 108
 			}
109 109
 		}
110 110
 
@@ -121,18 +121,18 @@  discard block
 block discarded – undo
121 121
 	 * @param string $whitespace white space between the tag and the additional data
122 122
 	 * @return string
123 123
 	 */
124
-	protected static function closeTag($tag,$add,$whitespace)
124
+	protected static function closeTag($tag, $add, $whitespace)
125 125
 	{
126
-		$tabs = str_pad('',--self::$tabCount,"\t");
126
+		$tabs = str_pad('', --self::$tabCount, "\t");
127 127
 
128 128
 		// if it's one of those tag it's inline so it does not require a leading line break
129 129
 		if (preg_match('#^</(a|label|option|textarea|h1|h2|h3|h4|h5|h6|strong|b|em|i|abbr|acronym|cite|span|sub|sup|u|s|title)>#', $tag)) {
130
-			$result = $tag . $whitespace . str_replace("\n","\n".$tabs,$add);
130
+			$result = $tag.$whitespace.str_replace("\n", "\n".$tabs, $add);
131 131
 		} else {
132 132
 			$result = "\n".$tabs.$tag;
133 133
 
134 134
 			if (!empty($add)) {
135
-				$result .= "\n".$tabs."\t".str_replace("\n","\n\t".$tabs,$add);
135
+				$result .= "\n".$tabs."\t".str_replace("\n", "\n\t".$tabs, $add);
136 136
 			}
137 137
 		}
138 138
 
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 * @param string $add additional data (anything before the following tag)
149 149
 	 * @return string
150 150
 	 */
151
-	protected static function singleTag($tag,$add,$whitespace)
151
+	protected static function singleTag($tag, $add, $whitespace)
152 152
 	{
153
-		$tabs = str_pad('',self::$tabCount,"\t");
153
+		$tabs = str_pad('', self::$tabCount, "\t");
154 154
 
155 155
 		// if it's img, br it's inline so it does not require a leading line break
156 156
 		// if it's a closing textarea, code or pre tag, it does not require a leading line break either or it creates whitespace at the end of those blocks
@@ -158,13 +158,13 @@  discard block
 block discarded – undo
158 158
 			$result = $tag.$whitespace;
159 159
 
160 160
 			if (!empty($add)) {
161
-				$result .= str_replace("\n","\n".$tabs,$add);
161
+				$result .= str_replace("\n", "\n".$tabs, $add);
162 162
 			}
163 163
 		} else {
164 164
 			$result = "\n".$tabs.$tag;
165 165
 
166 166
 			if (!empty($add)) {
167
-				$result .= "\n".$tabs.str_replace("\n","\n".$tabs,$add);
167
+				$result .= "\n".$tabs.str_replace("\n", "\n".$tabs, $add);
168 168
 			}
169 169
 		}
170 170
 
Please login to merge, or discard this patch.
lib/plugins/builtin/processors/pre.smarty_compat.php 1 patch
Spacing   +4 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,14 +21,13 @@  discard block
 block discarded – undo
21 21
 	{
22 22
 		list($l, $r) = $this->compiler->getDelimiters();
23 23
 
24
-		$rl = preg_quote($l,'/');
25
-		$rr = preg_quote($r,'/');
24
+		$rl = preg_quote($l, '/');
25
+		$rr = preg_quote($r, '/');
26 26
 		$sectionParam = '(?:(name|loop|start|step|max|show)\s*=\s*(\S+))?\s*';
27 27
 		$input = preg_replace_callback('/'.$rl.'\s*section '.str_repeat($sectionParam, 6).'\s*'.$rr.'(.+?)(?:'.$rl.'\s*sectionelse\s*'.$rr.'(.+?))?'.$rl.'\s*\/section\s*'.$rr.'/is', array($this, 'convertSection'), $input);
28 28
 		$input = str_replace('$smarty.section.', '$smarty.for.', $input);
29 29
 
30
-		$smarty = array
31
-		(
30
+		$smarty = array(
32 31
 			'/'.$rl.'\s*ldelim\s*'.$rr.'/',
33 32
 			'/'.$rl.'\s*rdelim\s*'.$rr.'/',
34 33
 			'/'.$rl.'\s*\$smarty\.ldelim\s*'.$rr.'/',
@@ -40,8 +39,7 @@  discard block
 block discarded – undo
40 39
 			'/'.$rl.'\s*sectionelse\s*'.$rr.'/',
41 40
 		);
42 41
 
43
-		$dwoo = array
44
-		(
42
+		$dwoo = array(
45 43
 			'\\'.$l,
46 44
 			$r,
47 45
 			'\\'.$l,
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/date_format.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
  * @date       2008-12-24
19 19
  * @package    Dwoo
20 20
  */
21
-function Dwoo_Plugin_date_format(Dwoo_Core $dwoo, $value, $format='%b %e, %Y', $default=null)
21
+function Dwoo_Plugin_date_format(Dwoo_Core $dwoo, $value, $format = '%b %e, %Y', $default = null)
22 22
 {
23 23
 	if (!empty($value)) {
24 24
 		// convert if it's not a valid unix timestamp
25
-		if (preg_match('#^-?\d{1,10}$#', $value)===0) {
25
+		if (preg_match('#^-?\d{1,10}$#', $value) === 0) {
26 26
 			$value = strtotime($value);
27 27
 		}
28 28
 	} elseif (!empty($default)) {
29 29
 		// convert if it's not a valid unix timestamp
30
-		if (preg_match('#^-?\d{1,10}$#', $default)===0) {
30
+		if (preg_match('#^-?\d{1,10}$#', $default) === 0) {
31 31
 			$value = strtotime($default);
32 32
 		} else {
33 33
 			$value = $default;
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 
39 39
 	// Credits for that windows compat block to Monte Ohrt who made smarty's date_format plugin
40 40
 	if (DIRECTORY_SEPARATOR == '\\') {
41
-		$_win_from = array('%D',       '%h', '%n', '%r',          '%R',    '%t', '%T');
41
+		$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
42 42
 		$_win_to   = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
43 43
 		if (strpos($format, '%e') !== false) {
44 44
 			$_win_from[] = '%e';
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/dump.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 		$out .= $this->export($var, $scope);
54 54
 
55
-		return $out .'</div></div>';
55
+		return $out.'</div></div>';
56 56
 	}
57 57
 
58 58
 	protected function export($var, $scope)
@@ -60,8 +60,8 @@  discard block
 block discarded – undo
60 60
 		$out = '';
61 61
 		foreach ($var as $i=>$v) {
62 62
 			if (is_array($v) || (is_object($v) && $v instanceof Iterator)) {
63
-				$out .= $i.' ('.(is_array($v) ? 'array':'object: '.get_class($v)).')';
64
-				if ($v===$scope) {
63
+				$out .= $i.' ('.(is_array($v) ? 'array' : 'object: '.get_class($v)).')';
64
+				if ($v === $scope) {
65 65
 					$out .= ' (current scope):<div style="background:#ccc;padding-left:20px;">'.$this->export($v, $scope).'</div>';
66 66
 				} else {
67 67
 					$out .= ':<div style="padding-left:20px;">'.$this->export($v, $scope).'</div>';
@@ -91,14 +91,14 @@  discard block
 block discarded – undo
91 91
 	protected function exportObj($i, $obj)
92 92
 	{
93 93
 		if (array_search($obj, $this->outputObjects, true) !== false) {
94
-			return $i . ' [recursion, skipped]<br />';
94
+			return $i.' [recursion, skipped]<br />';
95 95
 		}
96 96
 
97 97
 		$this->outputObjects[] = $obj;
98 98
 
99 99
 		$list = (array) $obj;
100 100
 
101
-		$protectedLength = strlen(get_class($obj)) + 2;
101
+		$protectedLength = strlen(get_class($obj))+2;
102 102
 
103 103
 		$out = array();
104 104
 
@@ -116,17 +116,17 @@  discard block
 block discarded – undo
116 116
 
117 117
 				$params = array();
118 118
 				foreach ($method->getParameters() as $param) {
119
-					$params[] = ($param->isPassedByReference() ? '&':'') . '$'.$param->getName() . ($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : '');
119
+					$params[] = ($param->isPassedByReference() ? '&' : '').'$'.$param->getName().($param->isOptional() ? ' = '.var_export($param->getDefaultValue(), true) : '');
120 120
 				}
121 121
 
122
-				$out['method'] .= '(method) ' . $method->getName() .'('.implode(', ', $params).')<br />';
122
+				$out['method'] .= '(method) '.$method->getName().'('.implode(', ', $params).')<br />';
123 123
 			}
124 124
 		}
125 125
 
126 126
 		foreach ($list as $attributeName => $attributeValue) {
127
-			if(property_exists($obj, $attributeName)) {
127
+			if (property_exists($obj, $attributeName)) {
128 128
 				$key = 'public';
129
-			} elseif(substr($attributeName, 0, 3) === "\0*\0") {
129
+			} elseif (substr($attributeName, 0, 3) === "\0*\0") {
130 130
 				$key = 'protected';
131 131
 				$attributeName = substr($attributeName, 3);
132 132
 			} else {
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 			}
151 151
 		}
152 152
 
153
-		$return = $i . '<br /><div style="padding-left:20px;">';
153
+		$return = $i.'<br /><div style="padding-left:20px;">';
154 154
 
155 155
 		if (!empty($out['method'])) {
156 156
 			$return .= $out['method'];
@@ -168,6 +168,6 @@  discard block
 block discarded – undo
168 168
 			$return .= $out['private'];
169 169
 		}
170 170
 
171
-		return $return . '</div>';
171
+		return $return.'</div>';
172 172
 	}
173 173
 }
174 174
\ No newline at end of file
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/spacify.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
  * @date       2008-10-23
18 18
  * @package    Dwoo
19 19
  */
20
-function Dwoo_Plugin_spacify_compile(Dwoo_Compiler $compiler, $value, $space_char=' ')
20
+function Dwoo_Plugin_spacify_compile(Dwoo_Compiler $compiler, $value, $space_char = ' ')
21 21
 {
22 22
 	return 'implode('.$space_char.', str_split('.$value.', 1))';
23 23
 }
Please login to merge, or discard this patch.
lib/plugins/builtin/functions/escape.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
  * @date       2008-10-23
19 19
  * @package    Dwoo
20 20
  */
21
-function Dwoo_Plugin_escape(Dwoo_Core $dwoo, $value='', $format='html', $charset=null)
21
+function Dwoo_Plugin_escape(Dwoo_Core $dwoo, $value = '', $format = 'html', $charset = null)
22 22
 {
23 23
 	if ($charset === null) {
24 24
 		$charset = $dwoo->getCharset();
25 25
 	}
26 26
 
27
-	switch($format)
27
+	switch ($format)
28 28
 	{
29 29
 
30 30
 	case 'html':
@@ -40,18 +40,18 @@  discard block
 block discarded – undo
40 40
 	case 'hex':
41 41
 		$out = '';
42 42
 		$cnt = strlen((string) $value);
43
-		for ($i=0; $i < $cnt; $i++) {
44
-			$out .= '%' . bin2hex((string) $value[$i]);
43
+		for ($i = 0; $i < $cnt; $i++) {
44
+			$out .= '%'.bin2hex((string) $value[$i]);
45 45
 		}
46 46
 		return $out;
47 47
 	case 'hexentity':
48 48
 		$out = '';
49 49
 		$cnt = strlen((string) $value);
50
-		for ($i=0; $i < $cnt; $i++)
51
-			$out .= '&#x' . bin2hex((string) $value[$i]) . ';';
50
+		for ($i = 0; $i < $cnt; $i++)
51
+			$out .= '&#x'.bin2hex((string) $value[$i]).';';
52 52
 		return $out;
53 53
 	case 'javascript':
54
-		return strtr((string) $value, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
54
+		return strtr((string) $value, array('\\'=>'\\\\', "'"=>"\\'", '"'=>'\\"', "\r"=>'\\r', "\n"=>'\\n', '</'=>'<\/'));
55 55
 	case 'mail':
56 56
 		return str_replace(array('@', '.'), array('&nbsp;(AT)&nbsp;', '&nbsp;(DOT)&nbsp;'), (string) $value);
57 57
 	default:
Please login to merge, or discard this patch.