Completed
Push — developer ( 7f46f3...3f66fa )
by Błażej
134:52 queued 72:56
created
libraries/Smarty/libs/plugins/block.textformat.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -35,78 +35,78 @@
 block discarded – undo
35 35
  */
36 36
 function smarty_block_textformat($params, $content, $template, &$repeat)
37 37
 {
38
-    if (is_null($content)) {
39
-        return;
40
-    }
38
+	if (is_null($content)) {
39
+		return;
40
+	}
41 41
 
42
-    $style = null;
43
-    $indent = 0;
44
-    $indent_first = 0;
45
-    $indent_char = ' ';
46
-    $wrap = 80;
47
-    $wrap_char = "\n";
48
-    $wrap_cut = false;
49
-    $assign = null;
42
+	$style = null;
43
+	$indent = 0;
44
+	$indent_first = 0;
45
+	$indent_char = ' ';
46
+	$wrap = 80;
47
+	$wrap_char = "\n";
48
+	$wrap_cut = false;
49
+	$assign = null;
50 50
 
51
-    foreach ($params as $_key => $_val) {
52
-        switch ($_key) {
53
-            case 'style':
54
-            case 'indent_char':
55
-            case 'wrap_char':
56
-            case 'assign':
57
-                $$_key = (string) $_val;
58
-                break;
51
+	foreach ($params as $_key => $_val) {
52
+		switch ($_key) {
53
+			case 'style':
54
+			case 'indent_char':
55
+			case 'wrap_char':
56
+			case 'assign':
57
+				$$_key = (string) $_val;
58
+				break;
59 59
 
60
-            case 'indent':
61
-            case 'indent_first':
62
-            case 'wrap':
63
-                $$_key = (int) $_val;
64
-                break;
60
+			case 'indent':
61
+			case 'indent_first':
62
+			case 'wrap':
63
+				$$_key = (int) $_val;
64
+				break;
65 65
 
66
-            case 'wrap_cut':
67
-                $$_key = (bool) $_val;
68
-                break;
66
+			case 'wrap_cut':
67
+				$$_key = (bool) $_val;
68
+				break;
69 69
 
70
-            default:
71
-                trigger_error("textformat: unknown attribute '$_key'");
72
-        }
73
-    }
70
+			default:
71
+				trigger_error("textformat: unknown attribute '$_key'");
72
+		}
73
+	}
74 74
 
75
-    if ($style == 'email') {
76
-        $wrap = 72;
77
-    }
78
-    // split into paragraphs
79
-    $_paragraphs = preg_split('![\r\n]{2}!', $content);
75
+	if ($style == 'email') {
76
+		$wrap = 72;
77
+	}
78
+	// split into paragraphs
79
+	$_paragraphs = preg_split('![\r\n]{2}!', $content);
80 80
 
81
-    foreach ($_paragraphs as &$_paragraph) {
82
-        if (!$_paragraph) {
83
-            continue;
84
-        }
85
-        // convert mult. spaces & special chars to single space
86
-        $_paragraph =
87
-            preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
88
-                         array(' ', ''), $_paragraph);
89
-        // indent first line
90
-        if ($indent_first > 0) {
91
-            $_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
92
-        }
93
-        // wordwrap sentences
94
-        if (Smarty::$_MBSTRING) {
95
-            require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
96
-            $_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
97
-        } else {
98
-            $_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
99
-        }
100
-        // indent lines
101
-        if ($indent > 0) {
102
-            $_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
103
-        }
104
-    }
105
-    $_output = implode($wrap_char . $wrap_char, $_paragraphs);
81
+	foreach ($_paragraphs as &$_paragraph) {
82
+		if (!$_paragraph) {
83
+			continue;
84
+		}
85
+		// convert mult. spaces & special chars to single space
86
+		$_paragraph =
87
+			preg_replace(array('!\s+!' . Smarty::$_UTF8_MODIFIER, '!(^\s+)|(\s+$)!' . Smarty::$_UTF8_MODIFIER),
88
+						 array(' ', ''), $_paragraph);
89
+		// indent first line
90
+		if ($indent_first > 0) {
91
+			$_paragraph = str_repeat($indent_char, $indent_first) . $_paragraph;
92
+		}
93
+		// wordwrap sentences
94
+		if (Smarty::$_MBSTRING) {
95
+			require_once(SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php');
96
+			$_paragraph = smarty_mb_wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
97
+		} else {
98
+			$_paragraph = wordwrap($_paragraph, $wrap - $indent, $wrap_char, $wrap_cut);
99
+		}
100
+		// indent lines
101
+		if ($indent > 0) {
102
+			$_paragraph = preg_replace('!^!m', str_repeat($indent_char, $indent), $_paragraph);
103
+		}
104
+	}
105
+	$_output = implode($wrap_char . $wrap_char, $_paragraphs);
106 106
 
107
-    if ($assign) {
108
-        $template->assign($assign, $_output);
109
-    } else {
110
-        return $_output;
111
-    }
107
+	if ($assign) {
108
+		$template->assign($assign, $_output);
109
+	} else {
110
+		return $_output;
111
+	}
112 112
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.count_paragraphs.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,6 +22,6 @@
 block discarded – undo
22 22
  */
23 23
 function smarty_modifiercompiler_count_paragraphs($params)
24 24
 {
25
-    // count \r or \n characters
26
-    return '(preg_match_all(\'#[\r\n]+#\', ' . $params[ 0 ] . ', $tmp)+1)';
25
+	// count \r or \n characters
26
+	return '(preg_match_all(\'#[\r\n]+#\', ' . $params[ 0 ] . ', $tmp)+1)';
27 27
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,5 +23,5 @@
 block discarded – undo
23 23
 function smarty_modifiercompiler_count_paragraphs($params)
24 24
 {
25 25
     // count \r or \n characters
26
-    return '(preg_match_all(\'#[\r\n]+#\', ' . $params[ 0 ] . ', $tmp)+1)';
26
+    return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
27 27
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.count_words.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 function smarty_modifiercompiler_count_words($params)
23 23
 {
24
-    if (Smarty::$_MBSTRING) {
25
-        // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
26
-        // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
27
-        return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
28
-               $params[ 0 ] . ', $tmp)';
29
-    }
30
-    // no MBString fallback
31
-    return 'str_word_count(' . $params[ 0 ] . ')';
24
+	if (Smarty::$_MBSTRING) {
25
+		// return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
26
+		// expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
27
+		return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
28
+			   $params[ 0 ] . ', $tmp)';
29
+	}
30
+	// no MBString fallback
31
+	return 'str_word_count(' . $params[ 0 ] . ')';
32 32
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@
 block discarded – undo
25 25
         // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
26 26
         // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
27 27
         return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' .
28
-               $params[ 0 ] . ', $tmp)';
28
+               $params[0] . ', $tmp)';
29 29
     }
30 30
     // no MBString fallback
31
-    return 'str_word_count(' . $params[ 0 ] . ')';
31
+    return 'str_word_count(' . $params[0] . ')';
32 32
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/shared.make_timestamp.php 1 patch
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -18,28 +18,28 @@
 block discarded – undo
18 18
  */
19 19
 function smarty_make_timestamp($string)
20 20
 {
21
-    if (empty($string)) {
22
-        // use "now":
23
-        return time();
24
-    } elseif ($string instanceof DateTime ||
25
-              (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
26
-    ) {
27
-        return (int) $string->format('U'); // PHP 5.2 BC
28
-    } elseif (strlen($string) == 14 && ctype_digit($string)) {
29
-        // it is mysql timestamp format of YYYYMMDDHHMMSS?
30
-        return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2),
31
-                      substr($string, 6, 2), substr($string, 0, 4));
32
-    } elseif (is_numeric($string)) {
33
-        // it is a numeric string, we handle it as timestamp
34
-        return (int) $string;
35
-    } else {
36
-        // strtotime should handle it
37
-        $time = strtotime($string);
38
-        if ($time == - 1 || $time === false) {
39
-            // strtotime() was not able to parse $string, use "now":
40
-            return time();
41
-        }
21
+	if (empty($string)) {
22
+		// use "now":
23
+		return time();
24
+	} elseif ($string instanceof DateTime ||
25
+			  (interface_exists('DateTimeInterface', false) && $string instanceof DateTimeInterface)
26
+	) {
27
+		return (int) $string->format('U'); // PHP 5.2 BC
28
+	} elseif (strlen($string) == 14 && ctype_digit($string)) {
29
+		// it is mysql timestamp format of YYYYMMDDHHMMSS?
30
+		return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2), substr($string, 4, 2),
31
+					  substr($string, 6, 2), substr($string, 0, 4));
32
+	} elseif (is_numeric($string)) {
33
+		// it is a numeric string, we handle it as timestamp
34
+		return (int) $string;
35
+	} else {
36
+		// strtotime should handle it
37
+		$time = strtotime($string);
38
+		if ($time == - 1 || $time === false) {
39
+			// strtotime() was not able to parse $string, use "now":
40
+			return time();
41
+		}
42 42
 
43
-        return $time;
44
-    }
43
+		return $time;
44
+	}
45 45
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_image.php 2 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -38,124 +38,124 @@
 block discarded – undo
38 38
  */
39 39
 function smarty_function_html_image($params, $template)
40 40
 {
41
-    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
42
-
43
-    $alt = '';
44
-    $file = '';
45
-    $height = '';
46
-    $width = '';
47
-    $extra = '';
48
-    $prefix = '';
49
-    $suffix = '';
50
-    $path_prefix = '';
51
-    $basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : '';
52
-    foreach ($params as $_key => $_val) {
53
-        switch ($_key) {
54
-            case 'file':
55
-            case 'height':
56
-            case 'width':
57
-            case 'dpi':
58
-            case 'path_prefix':
59
-            case 'basedir':
60
-                $$_key = $_val;
61
-                break;
62
-
63
-            case 'alt':
64
-                if (!is_array($_val)) {
65
-                    $$_key = smarty_function_escape_special_chars($_val);
66
-                } else {
67
-                    throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
68
-                }
69
-                break;
70
-
71
-            case 'link':
72
-            case 'href':
73
-                $prefix = '<a href="' . $_val . '">';
74
-                $suffix = '</a>';
75
-                break;
76
-
77
-            default:
78
-                if (!is_array($_val)) {
79
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
80
-                } else {
81
-                    throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
82
-                }
83
-                break;
84
-        }
85
-    }
86
-
87
-    if (empty($file)) {
88
-        trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
89
-
90
-        return;
91
-    }
92
-
93
-    if ($file[ 0 ] == '/') {
94
-        $_image_path = $basedir . $file;
95
-    } else {
96
-        $_image_path = $file;
97
-    }
98
-
99
-    // strip file protocol
100
-    if (stripos($params[ 'file' ], 'file://') === 0) {
101
-        $params[ 'file' ] = substr($params[ 'file' ], 7);
102
-    }
103
-
104
-    $protocol = strpos($params[ 'file' ], '://');
105
-    if ($protocol !== false) {
106
-        $protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
107
-    }
108
-
109
-    if (isset($template->smarty->security_policy)) {
110
-        if ($protocol) {
111
-            // remote resource (or php stream, …)
112
-            if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
113
-                return;
114
-            }
115
-        } else {
116
-            // local file
117
-            if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
118
-                return;
119
-            }
120
-        }
121
-    }
122
-
123
-    if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) {
124
-        if (!$_image_data = @getimagesize($_image_path)) {
125
-            if (!file_exists($_image_path)) {
126
-                trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
127
-
128
-                return;
129
-            } elseif (!is_readable($_image_path)) {
130
-                trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
131
-
132
-                return;
133
-            } else {
134
-                trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
135
-
136
-                return;
137
-            }
138
-        }
139
-
140
-        if (!isset($params[ 'width' ])) {
141
-            $width = $_image_data[ 0 ];
142
-        }
143
-        if (!isset($params[ 'height' ])) {
144
-            $height = $_image_data[ 1 ];
145
-        }
146
-    }
147
-
148
-    if (isset($params[ 'dpi' ])) {
149
-        if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) {
150
-            $dpi_default = 72;
151
-        } else {
152
-            $dpi_default = 96;
153
-        }
154
-        $_resize = $dpi_default / $params[ 'dpi' ];
155
-        $width = round($width * $_resize);
156
-        $height = round($height * $_resize);
157
-    }
158
-
159
-    return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' .
160
-           $height . '"' . $extra . ' />' . $suffix;
41
+	require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
42
+
43
+	$alt = '';
44
+	$file = '';
45
+	$height = '';
46
+	$width = '';
47
+	$extra = '';
48
+	$prefix = '';
49
+	$suffix = '';
50
+	$path_prefix = '';
51
+	$basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : '';
52
+	foreach ($params as $_key => $_val) {
53
+		switch ($_key) {
54
+			case 'file':
55
+			case 'height':
56
+			case 'width':
57
+			case 'dpi':
58
+			case 'path_prefix':
59
+			case 'basedir':
60
+				$$_key = $_val;
61
+				break;
62
+
63
+			case 'alt':
64
+				if (!is_array($_val)) {
65
+					$$_key = smarty_function_escape_special_chars($_val);
66
+				} else {
67
+					throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
68
+				}
69
+				break;
70
+
71
+			case 'link':
72
+			case 'href':
73
+				$prefix = '<a href="' . $_val . '">';
74
+				$suffix = '</a>';
75
+				break;
76
+
77
+			default:
78
+				if (!is_array($_val)) {
79
+					$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
80
+				} else {
81
+					throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
82
+				}
83
+				break;
84
+		}
85
+	}
86
+
87
+	if (empty($file)) {
88
+		trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
89
+
90
+		return;
91
+	}
92
+
93
+	if ($file[ 0 ] == '/') {
94
+		$_image_path = $basedir . $file;
95
+	} else {
96
+		$_image_path = $file;
97
+	}
98
+
99
+	// strip file protocol
100
+	if (stripos($params[ 'file' ], 'file://') === 0) {
101
+		$params[ 'file' ] = substr($params[ 'file' ], 7);
102
+	}
103
+
104
+	$protocol = strpos($params[ 'file' ], '://');
105
+	if ($protocol !== false) {
106
+		$protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
107
+	}
108
+
109
+	if (isset($template->smarty->security_policy)) {
110
+		if ($protocol) {
111
+			// remote resource (or php stream, …)
112
+			if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
113
+				return;
114
+			}
115
+		} else {
116
+			// local file
117
+			if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
118
+				return;
119
+			}
120
+		}
121
+	}
122
+
123
+	if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) {
124
+		if (!$_image_data = @getimagesize($_image_path)) {
125
+			if (!file_exists($_image_path)) {
126
+				trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
127
+
128
+				return;
129
+			} elseif (!is_readable($_image_path)) {
130
+				trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
131
+
132
+				return;
133
+			} else {
134
+				trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
135
+
136
+				return;
137
+			}
138
+		}
139
+
140
+		if (!isset($params[ 'width' ])) {
141
+			$width = $_image_data[ 0 ];
142
+		}
143
+		if (!isset($params[ 'height' ])) {
144
+			$height = $_image_data[ 1 ];
145
+		}
146
+	}
147
+
148
+	if (isset($params[ 'dpi' ])) {
149
+		if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) {
150
+			$dpi_default = 72;
151
+		} else {
152
+			$dpi_default = 96;
153
+		}
154
+		$_resize = $dpi_default / $params[ 'dpi' ];
155
+		$width = round($width * $_resize);
156
+		$height = round($height * $_resize);
157
+	}
158
+
159
+	return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' .
160
+		   $height . '"' . $extra . ' />' . $suffix;
161 161
 }
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
     $prefix = '';
49 49
     $suffix = '';
50 50
     $path_prefix = '';
51
-    $basedir = isset($_SERVER[ 'DOCUMENT_ROOT' ]) ? $_SERVER[ 'DOCUMENT_ROOT' ] : '';
51
+    $basedir = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '';
52 52
     foreach ($params as $_key => $_val) {
53 53
         switch ($_key) {
54 54
             case 'file':
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
                 if (!is_array($_val)) {
65 65
                     $$_key = smarty_function_escape_special_chars($_val);
66 66
                 } else {
67
-                    throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
67
+                    throw new SmartyException("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
68 68
                 }
69 69
                 break;
70 70
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
                 if (!is_array($_val)) {
79 79
                     $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
80 80
                 } else {
81
-                    throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
81
+                    throw new SmartyException("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
82 82
                 }
83 83
                 break;
84 84
         }
@@ -90,26 +90,26 @@  discard block
 block discarded – undo
90 90
         return;
91 91
     }
92 92
 
93
-    if ($file[ 0 ] == '/') {
93
+    if ($file[0] == '/') {
94 94
         $_image_path = $basedir . $file;
95 95
     } else {
96 96
         $_image_path = $file;
97 97
     }
98 98
 
99 99
     // strip file protocol
100
-    if (stripos($params[ 'file' ], 'file://') === 0) {
101
-        $params[ 'file' ] = substr($params[ 'file' ], 7);
100
+    if (stripos($params['file'], 'file://') === 0) {
101
+        $params['file'] = substr($params['file'], 7);
102 102
     }
103 103
 
104
-    $protocol = strpos($params[ 'file' ], '://');
104
+    $protocol = strpos($params['file'], '://');
105 105
     if ($protocol !== false) {
106
-        $protocol = strtolower(substr($params[ 'file' ], 0, $protocol));
106
+        $protocol = strtolower(substr($params['file'], 0, $protocol));
107 107
     }
108 108
 
109 109
     if (isset($template->smarty->security_policy)) {
110 110
         if ($protocol) {
111 111
             // remote resource (or php stream, …)
112
-            if (!$template->smarty->security_policy->isTrustedUri($params[ 'file' ])) {
112
+            if (!$template->smarty->security_policy->isTrustedUri($params['file'])) {
113 113
                 return;
114 114
             }
115 115
         } else {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         }
121 121
     }
122 122
 
123
-    if (!isset($params[ 'width' ]) || !isset($params[ 'height' ])) {
123
+    if (!isset($params['width']) || !isset($params['height'])) {
124 124
         if (!$_image_data = @getimagesize($_image_path)) {
125 125
             if (!file_exists($_image_path)) {
126 126
                 trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
@@ -137,21 +137,21 @@  discard block
 block discarded – undo
137 137
             }
138 138
         }
139 139
 
140
-        if (!isset($params[ 'width' ])) {
141
-            $width = $_image_data[ 0 ];
140
+        if (!isset($params['width'])) {
141
+            $width = $_image_data[0];
142 142
         }
143
-        if (!isset($params[ 'height' ])) {
144
-            $height = $_image_data[ 1 ];
143
+        if (!isset($params['height'])) {
144
+            $height = $_image_data[1];
145 145
         }
146 146
     }
147 147
 
148
-    if (isset($params[ 'dpi' ])) {
149
-        if (strstr($_SERVER[ 'HTTP_USER_AGENT' ], 'Mac')) {
148
+    if (isset($params['dpi'])) {
149
+        if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mac')) {
150 150
             $dpi_default = 72;
151 151
         } else {
152 152
             $dpi_default = 96;
153 153
         }
154
-        $_resize = $dpi_default / $params[ 'dpi' ];
154
+        $_resize = $dpi_default / $params['dpi'];
155 155
         $width = round($width * $_resize);
156 156
         $height = round($height * $_resize);
157 157
     }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifier.capitalize.php 2 patches
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -23,53 +23,53 @@  discard block
 block discarded – undo
23 23
  */
24 24
 function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
25 25
 {
26
-    if (Smarty::$_MBSTRING) {
27
-        if ($lc_rest) {
28
-            // uppercase (including hyphenated words)
29
-            $upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
30
-        } else {
31
-            // uppercase word breaks
32
-            $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
33
-                                                  'smarty_mod_cap_mbconvert_cb', $string);
34
-        }
35
-        // check uc_digits case
36
-        if (!$uc_digits) {
37
-            if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
38
-                               PREG_OFFSET_CAPTURE)) {
39
-                foreach ($matches[ 1 ] as $match) {
40
-                    $upper_string =
41
-                        substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ],
42
-                                       strlen($match[ 0 ]));
43
-                }
44
-            }
45
-        }
46
-        $upper_string =
47
-            preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb',
48
-                                  $upper_string);
49
-        return $upper_string;
50
-    }
26
+	if (Smarty::$_MBSTRING) {
27
+		if ($lc_rest) {
28
+			// uppercase (including hyphenated words)
29
+			$upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
30
+		} else {
31
+			// uppercase word breaks
32
+			$upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER,
33
+												  'smarty_mod_cap_mbconvert_cb', $string);
34
+		}
35
+		// check uc_digits case
36
+		if (!$uc_digits) {
37
+			if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
38
+							   PREG_OFFSET_CAPTURE)) {
39
+				foreach ($matches[ 1 ] as $match) {
40
+					$upper_string =
41
+						substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ],
42
+									   strlen($match[ 0 ]));
43
+				}
44
+			}
45
+		}
46
+		$upper_string =
47
+			preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb',
48
+								  $upper_string);
49
+		return $upper_string;
50
+	}
51 51
 
52
-    // lowercase first
53
-    if ($lc_rest) {
54
-        $string = strtolower($string);
55
-    }
56
-    // uppercase (including hyphenated words)
57
-    $upper_string =
58
-        preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb',
59
-                              $string);
60
-    // check uc_digits case
61
-    if (!$uc_digits) {
62
-        if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
63
-                           PREG_OFFSET_CAPTURE)) {
64
-            foreach ($matches[ 1 ] as $match) {
65
-                $upper_string =
66
-                    substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
67
-            }
68
-        }
69
-    }
70
-    $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb',
71
-                                          $upper_string);
72
-    return $upper_string;
52
+	// lowercase first
53
+	if ($lc_rest) {
54
+		$string = strtolower($string);
55
+	}
56
+	// uppercase (including hyphenated words)
57
+	$upper_string =
58
+		preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb',
59
+							  $string);
60
+	// check uc_digits case
61
+	if (!$uc_digits) {
62
+		if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
63
+						   PREG_OFFSET_CAPTURE)) {
64
+			foreach ($matches[ 1 ] as $match) {
65
+				$upper_string =
66
+					substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
67
+			}
68
+		}
69
+	}
70
+	$upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb',
71
+										  $upper_string);
72
+	return $upper_string;
73 73
 }
74 74
 
75 75
 /* 
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function smarty_mod_cap_mbconvert_cb($matches)
84 84
 {
85
-    return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
85
+	return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
86 86
 }
87 87
 
88 88
 function smarty_mod_cap_mbconvert2_cb($matches)
89 89
 {
90
-    return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
90
+	return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
91 91
 }
92 92
 
93 93
 function smarty_mod_cap_ucfirst_cb($matches)
94 94
 {
95
-    return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
95
+	return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
96 96
 }
97 97
 
98 98
 function smarty_mod_cap_ucfirst2_cb($matches)
99 99
 {
100
-    return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));
100
+	return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));
101 101
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,10 +36,10 @@  discard block
 block discarded – undo
36 36
         if (!$uc_digits) {
37 37
             if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
38 38
                                PREG_OFFSET_CAPTURE)) {
39
-                foreach ($matches[ 1 ] as $match) {
39
+                foreach ($matches[1] as $match) {
40 40
                     $upper_string =
41
-                        substr_replace($upper_string, mb_strtolower($match[ 0 ], Smarty::$_CHARSET), $match[ 1 ],
42
-                                       strlen($match[ 0 ]));
41
+                        substr_replace($upper_string, mb_strtolower($match[0], Smarty::$_CHARSET), $match[1],
42
+                                       strlen($match[0]));
43 43
                 }
44 44
             }
45 45
         }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     if (!$uc_digits) {
62 62
         if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches,
63 63
                            PREG_OFFSET_CAPTURE)) {
64
-            foreach ($matches[ 1 ] as $match) {
64
+            foreach ($matches[1] as $match) {
65 65
                 $upper_string =
66
-                    substr_replace($upper_string, strtolower($match[ 0 ]), $match[ 1 ], strlen($match[ 0 ]));
66
+                    substr_replace($upper_string, strtolower($match[0]), $match[1], strlen($match[0]));
67 67
             }
68 68
         }
69 69
     }
@@ -82,20 +82,20 @@  discard block
 block discarded – undo
82 82
  */
83 83
 function smarty_mod_cap_mbconvert_cb($matches)
84 84
 {
85
-    return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 2 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
85
+    return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[2]), MB_CASE_UPPER, Smarty::$_CHARSET);
86 86
 }
87 87
 
88 88
 function smarty_mod_cap_mbconvert2_cb($matches)
89 89
 {
90
-    return stripslashes($matches[ 1 ]) . mb_convert_case(stripslashes($matches[ 3 ]), MB_CASE_UPPER, Smarty::$_CHARSET);
90
+    return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[3]), MB_CASE_UPPER, Smarty::$_CHARSET);
91 91
 }
92 92
 
93 93
 function smarty_mod_cap_ucfirst_cb($matches)
94 94
 {
95
-    return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 2 ]));
95
+    return stripslashes($matches[1]) . ucfirst(stripslashes($matches[2]));
96 96
 }
97 97
 
98 98
 function smarty_mod_cap_ucfirst2_cb($matches)
99 99
 {
100
-    return stripslashes($matches[ 1 ]) . ucfirst(stripslashes($matches[ 3 ]));
100
+    return stripslashes($matches[1]) . ucfirst(stripslashes($matches[3]));
101 101
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.count_characters.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 function smarty_modifiercompiler_count_characters($params)
23 23
 {
24
-    if (!isset($params[ 1 ]) || $params[ 1 ] != 'true') {
25
-        return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
26
-    }
27
-    if (Smarty::$_MBSTRING) {
28
-        return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
29
-    }
30
-    // no MBString fallback
31
-    return 'strlen(' . $params[ 0 ] . ')';
24
+	if (!isset($params[ 1 ]) || $params[ 1 ] != 'true') {
25
+		return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
26
+	}
27
+	if (Smarty::$_MBSTRING) {
28
+		return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
29
+	}
30
+	// no MBString fallback
31
+	return 'strlen(' . $params[ 0 ] . ')';
32 32
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@
 block discarded – undo
21 21
  */
22 22
 function smarty_modifiercompiler_count_characters($params)
23 23
 {
24
-    if (!isset($params[ 1 ]) || $params[ 1 ] != 'true') {
25
-        return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[ 0 ] . ', $tmp)';
24
+    if (!isset($params[1]) || $params[1] != 'true') {
25
+        return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
26 26
     }
27 27
     if (Smarty::$_MBSTRING) {
28
-        return 'mb_strlen(' . $params[ 0 ] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
28
+        return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
29 29
     }
30 30
     // no MBString fallback
31
-    return 'strlen(' . $params[ 0 ] . ')';
31
+    return 'strlen(' . $params[0] . ')';
32 32
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.mailto.php 2 patches
Indentation   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -50,103 +50,103 @@
 block discarded – undo
50 50
  */
51 51
 function smarty_function_mailto($params)
52 52
 {
53
-    static $_allowed_encoding =
54
-        array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
55
-    $extra = '';
56
-
57
-    if (empty($params[ 'address' ])) {
58
-        trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
59
-
60
-        return;
61
-    } else {
62
-        $address = $params[ 'address' ];
63
-    }
64
-
65
-    $text = $address;
66
-    // netscape and mozilla do not decode %40 (@) in BCC field (bug?)
67
-    // so, don't encode it.
68
-    $search = array('%40', '%2C');
69
-    $replace = array('@', ',');
70
-    $mail_parms = array();
71
-    foreach ($params as $var => $value) {
72
-        switch ($var) {
73
-            case 'cc':
74
-            case 'bcc':
75
-            case 'followupto':
76
-                if (!empty($value)) {
77
-                    $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
78
-                }
79
-                break;
80
-
81
-            case 'subject':
82
-            case 'newsgroups':
83
-                $mail_parms[] = $var . '=' . rawurlencode($value);
84
-                break;
85
-
86
-            case 'extra':
87
-            case 'text':
88
-                $$var = $value;
89
-
90
-            default:
91
-        }
92
-    }
93
-
94
-    if ($mail_parms) {
95
-        $address .= '?' . join('&', $mail_parms);
96
-    }
97
-
98
-    $encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
99
-    if (!isset($_allowed_encoding[ $encode ])) {
100
-        trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
101
-                      E_USER_WARNING);
102
-
103
-        return;
104
-    }
105
-    if ($encode == 'javascript') {
106
-        $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
107
-
108
-        $js_encode = '';
109
-        for ($x = 0, $_length = strlen($string); $x < $_length; $x ++) {
110
-            $js_encode .= '%' . bin2hex($string[ $x ]);
111
-        }
112
-
113
-        return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>';
114
-    } elseif ($encode == 'javascript_charcode') {
115
-        $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
116
-
117
-        for ($x = 0, $y = strlen($string); $x < $y; $x ++) {
118
-            $ord[] = ord($string[ $x ]);
119
-        }
120
-
121
-        $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" .
122
-                implode(',', $ord) . "))" . "}\n" . "</script>\n";
123
-
124
-        return $_ret;
125
-    } elseif ($encode == 'hex') {
126
-        preg_match('!^(.*)(\?.*)$!', $address, $match);
127
-        if (!empty($match[ 2 ])) {
128
-            trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
129
-
130
-            return;
131
-        }
132
-        $address_encode = '';
133
-        for ($x = 0, $_length = strlen($address); $x < $_length; $x ++) {
134
-            if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) {
135
-                $address_encode .= '%' . bin2hex($address[ $x ]);
136
-            } else {
137
-                $address_encode .= $address[ $x ];
138
-            }
139
-        }
140
-        $text_encode = '';
141
-        for ($x = 0, $_length = strlen($text); $x < $_length; $x ++) {
142
-            $text_encode .= '&#x' . bin2hex($text[ $x ]) . ';';
143
-        }
144
-
145
-        $mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
146
-
147
-        return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
148
-    } else {
149
-        // no encoding
150
-        return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
151
-    }
53
+	static $_allowed_encoding =
54
+		array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
55
+	$extra = '';
56
+
57
+	if (empty($params[ 'address' ])) {
58
+		trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
59
+
60
+		return;
61
+	} else {
62
+		$address = $params[ 'address' ];
63
+	}
64
+
65
+	$text = $address;
66
+	// netscape and mozilla do not decode %40 (@) in BCC field (bug?)
67
+	// so, don't encode it.
68
+	$search = array('%40', '%2C');
69
+	$replace = array('@', ',');
70
+	$mail_parms = array();
71
+	foreach ($params as $var => $value) {
72
+		switch ($var) {
73
+			case 'cc':
74
+			case 'bcc':
75
+			case 'followupto':
76
+				if (!empty($value)) {
77
+					$mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
78
+				}
79
+				break;
80
+
81
+			case 'subject':
82
+			case 'newsgroups':
83
+				$mail_parms[] = $var . '=' . rawurlencode($value);
84
+				break;
85
+
86
+			case 'extra':
87
+			case 'text':
88
+				$$var = $value;
89
+
90
+			default:
91
+		}
92
+	}
93
+
94
+	if ($mail_parms) {
95
+		$address .= '?' . join('&', $mail_parms);
96
+	}
97
+
98
+	$encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
99
+	if (!isset($_allowed_encoding[ $encode ])) {
100
+		trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
101
+					  E_USER_WARNING);
102
+
103
+		return;
104
+	}
105
+	if ($encode == 'javascript') {
106
+		$string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
107
+
108
+		$js_encode = '';
109
+		for ($x = 0, $_length = strlen($string); $x < $_length; $x ++) {
110
+			$js_encode .= '%' . bin2hex($string[ $x ]);
111
+		}
112
+
113
+		return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>';
114
+	} elseif ($encode == 'javascript_charcode') {
115
+		$string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
116
+
117
+		for ($x = 0, $y = strlen($string); $x < $y; $x ++) {
118
+			$ord[] = ord($string[ $x ]);
119
+		}
120
+
121
+		$_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" .
122
+				implode(',', $ord) . "))" . "}\n" . "</script>\n";
123
+
124
+		return $_ret;
125
+	} elseif ($encode == 'hex') {
126
+		preg_match('!^(.*)(\?.*)$!', $address, $match);
127
+		if (!empty($match[ 2 ])) {
128
+			trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
129
+
130
+			return;
131
+		}
132
+		$address_encode = '';
133
+		for ($x = 0, $_length = strlen($address); $x < $_length; $x ++) {
134
+			if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) {
135
+				$address_encode .= '%' . bin2hex($address[ $x ]);
136
+			} else {
137
+				$address_encode .= $address[ $x ];
138
+			}
139
+		}
140
+		$text_encode = '';
141
+		for ($x = 0, $_length = strlen($text); $x < $_length; $x ++) {
142
+			$text_encode .= '&#x' . bin2hex($text[ $x ]) . ';';
143
+		}
144
+
145
+		$mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
146
+
147
+		return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
148
+	} else {
149
+		// no encoding
150
+		return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
151
+	}
152 152
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
         array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
55 55
     $extra = '';
56 56
 
57
-    if (empty($params[ 'address' ])) {
57
+    if (empty($params['address'])) {
58 58
         trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
59 59
 
60 60
         return;
61 61
     } else {
62
-        $address = $params[ 'address' ];
62
+        $address = $params['address'];
63 63
     }
64 64
 
65 65
     $text = $address;
@@ -95,8 +95,8 @@  discard block
 block discarded – undo
95 95
         $address .= '?' . join('&', $mail_parms);
96 96
     }
97 97
 
98
-    $encode = (empty($params[ 'encode' ])) ? 'none' : $params[ 'encode' ];
99
-    if (!isset($_allowed_encoding[ $encode ])) {
98
+    $encode = (empty($params['encode'])) ? 'none' : $params['encode'];
99
+    if (!isset($_allowed_encoding[$encode])) {
100 100
         trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex",
101 101
                       E_USER_WARNING);
102 102
 
@@ -106,16 +106,16 @@  discard block
 block discarded – undo
106 106
         $string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
107 107
 
108 108
         $js_encode = '';
109
-        for ($x = 0, $_length = strlen($string); $x < $_length; $x ++) {
110
-            $js_encode .= '%' . bin2hex($string[ $x ]);
109
+        for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
110
+            $js_encode .= '%' . bin2hex($string[$x]);
111 111
         }
112 112
 
113 113
         return '<script type="text/javascript">eval(unescape(\'' . $js_encode . '\'))</script>';
114 114
     } elseif ($encode == 'javascript_charcode') {
115 115
         $string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
116 116
 
117
-        for ($x = 0, $y = strlen($string); $x < $y; $x ++) {
118
-            $ord[] = ord($string[ $x ]);
117
+        for ($x = 0, $y = strlen($string); $x < $y; $x++) {
118
+            $ord[] = ord($string[$x]);
119 119
         }
120 120
 
121 121
         $_ret = "<script type=\"text/javascript\" language=\"javascript\">\n" . "{document.write(String.fromCharCode(" .
@@ -124,22 +124,22 @@  discard block
 block discarded – undo
124 124
         return $_ret;
125 125
     } elseif ($encode == 'hex') {
126 126
         preg_match('!^(.*)(\?.*)$!', $address, $match);
127
-        if (!empty($match[ 2 ])) {
127
+        if (!empty($match[2])) {
128 128
             trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
129 129
 
130 130
             return;
131 131
         }
132 132
         $address_encode = '';
133
-        for ($x = 0, $_length = strlen($address); $x < $_length; $x ++) {
134
-            if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[ $x ])) {
135
-                $address_encode .= '%' . bin2hex($address[ $x ]);
133
+        for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {
134
+            if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[$x])) {
135
+                $address_encode .= '%' . bin2hex($address[$x]);
136 136
             } else {
137
-                $address_encode .= $address[ $x ];
137
+                $address_encode .= $address[$x];
138 138
             }
139 139
         }
140 140
         $text_encode = '';
141
-        for ($x = 0, $_length = strlen($text); $x < $_length; $x ++) {
142
-            $text_encode .= '&#x' . bin2hex($text[ $x ]) . ';';
141
+        for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {
142
+            $text_encode .= '&#x' . bin2hex($text[$x]) . ';';
143 143
         }
144 144
 
145 145
         $mailto = "&#109;&#97;&#105;&#108;&#116;&#111;&#58;";
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_checkboxes.php 2 patches
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -45,205 +45,205 @@
 block discarded – undo
45 45
  */
46 46
 function smarty_function_html_checkboxes($params, $template)
47 47
 {
48
-    require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
-
50
-    $name = 'checkbox';
51
-    $values = null;
52
-    $options = null;
53
-    $selected = array();
54
-    $separator = '';
55
-    $escape = true;
56
-    $labels = true;
57
-    $label_ids = false;
58
-    $output = null;
59
-
60
-    $extra = '';
61
-
62
-    foreach ($params as $_key => $_val) {
63
-        switch ($_key) {
64
-            case 'name':
65
-            case 'separator':
66
-                $$_key = (string) $_val;
67
-                break;
68
-
69
-            case 'escape':
70
-            case 'labels':
71
-            case 'label_ids':
72
-                $$_key = (bool) $_val;
73
-                break;
74
-
75
-            case 'options':
76
-                $$_key = (array) $_val;
77
-                break;
78
-
79
-            case 'values':
80
-            case 'output':
81
-                $$_key = array_values((array) $_val);
82
-                break;
83
-
84
-            case 'checked':
85
-            case 'selected':
86
-                if (is_array($_val)) {
87
-                    $selected = array();
88
-                    foreach ($_val as $_sel) {
89
-                        if (is_object($_sel)) {
90
-                            if (method_exists($_sel, "__toString")) {
91
-                                $_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
92
-                            } else {
93
-                                trigger_error("html_checkboxes: selected attribute contains an object of class '" .
94
-                                              get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
95
-                                continue;
96
-                            }
97
-                        } else {
98
-                            $_sel = smarty_function_escape_special_chars((string) $_sel);
99
-                        }
100
-                        $selected[ $_sel ] = true;
101
-                    }
102
-                } elseif (is_object($_val)) {
103
-                    if (method_exists($_val, "__toString")) {
104
-                        $selected = smarty_function_escape_special_chars((string) $_val->__toString());
105
-                    } else {
106
-                        trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) .
107
-                                      "' without __toString() method", E_USER_NOTICE);
108
-                    }
109
-                } else {
110
-                    $selected = smarty_function_escape_special_chars((string) $_val);
111
-                }
112
-                break;
113
-
114
-            case 'checkboxes':
115
-                trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
116
-                              E_USER_WARNING);
117
-                $options = (array) $_val;
118
-                break;
119
-
120
-            case 'assign':
121
-                break;
122
-
123
-            case 'strict':
124
-                break;
125
-
126
-            case 'disabled':
127
-            case 'readonly':
128
-                if (!empty($params[ 'strict' ])) {
129
-                    if (!is_scalar($_val)) {
130
-                        trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
131
-                                      E_USER_NOTICE);
132
-                    }
133
-
134
-                    if ($_val === true || $_val === $_key) {
135
-                        $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
136
-                    }
137
-
138
-                    break;
139
-                }
140
-            // omit break; to fall through!
141
-
142
-            default:
143
-                if (!is_array($_val)) {
144
-                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
145
-                } else {
146
-                    trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
147
-                }
148
-                break;
149
-        }
150
-    }
151
-
152
-    if (!isset($options) && !isset($values)) {
153
-        return '';
154
-    } /* raise error here? */
155
-
156
-    $_html_result = array();
157
-
158
-    if (isset($options)) {
159
-        foreach ($options as $_key => $_val) {
160
-            $_html_result[] =
161
-                smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
162
-                                                       $label_ids, $escape);
163
-        }
164
-    } else {
165
-        foreach ($values as $_i => $_key) {
166
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
167
-            $_html_result[] =
168
-                smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
169
-                                                       $label_ids, $escape);
170
-        }
171
-    }
172
-
173
-    if (!empty($params[ 'assign' ])) {
174
-        $template->assign($params[ 'assign' ], $_html_result);
175
-    } else {
176
-        return implode("\n", $_html_result);
177
-    }
48
+	require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
49
+
50
+	$name = 'checkbox';
51
+	$values = null;
52
+	$options = null;
53
+	$selected = array();
54
+	$separator = '';
55
+	$escape = true;
56
+	$labels = true;
57
+	$label_ids = false;
58
+	$output = null;
59
+
60
+	$extra = '';
61
+
62
+	foreach ($params as $_key => $_val) {
63
+		switch ($_key) {
64
+			case 'name':
65
+			case 'separator':
66
+				$$_key = (string) $_val;
67
+				break;
68
+
69
+			case 'escape':
70
+			case 'labels':
71
+			case 'label_ids':
72
+				$$_key = (bool) $_val;
73
+				break;
74
+
75
+			case 'options':
76
+				$$_key = (array) $_val;
77
+				break;
78
+
79
+			case 'values':
80
+			case 'output':
81
+				$$_key = array_values((array) $_val);
82
+				break;
83
+
84
+			case 'checked':
85
+			case 'selected':
86
+				if (is_array($_val)) {
87
+					$selected = array();
88
+					foreach ($_val as $_sel) {
89
+						if (is_object($_sel)) {
90
+							if (method_exists($_sel, "__toString")) {
91
+								$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
92
+							} else {
93
+								trigger_error("html_checkboxes: selected attribute contains an object of class '" .
94
+											  get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
95
+								continue;
96
+							}
97
+						} else {
98
+							$_sel = smarty_function_escape_special_chars((string) $_sel);
99
+						}
100
+						$selected[ $_sel ] = true;
101
+					}
102
+				} elseif (is_object($_val)) {
103
+					if (method_exists($_val, "__toString")) {
104
+						$selected = smarty_function_escape_special_chars((string) $_val->__toString());
105
+					} else {
106
+						trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) .
107
+									  "' without __toString() method", E_USER_NOTICE);
108
+					}
109
+				} else {
110
+					$selected = smarty_function_escape_special_chars((string) $_val);
111
+				}
112
+				break;
113
+
114
+			case 'checkboxes':
115
+				trigger_error('html_checkboxes: the use of the "checkboxes" attribute is deprecated, use "options" instead',
116
+							  E_USER_WARNING);
117
+				$options = (array) $_val;
118
+				break;
119
+
120
+			case 'assign':
121
+				break;
122
+
123
+			case 'strict':
124
+				break;
125
+
126
+			case 'disabled':
127
+			case 'readonly':
128
+				if (!empty($params[ 'strict' ])) {
129
+					if (!is_scalar($_val)) {
130
+						trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
131
+									  E_USER_NOTICE);
132
+					}
133
+
134
+					if ($_val === true || $_val === $_key) {
135
+						$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
136
+					}
137
+
138
+					break;
139
+				}
140
+			// omit break; to fall through!
141
+
142
+			default:
143
+				if (!is_array($_val)) {
144
+					$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
145
+				} else {
146
+					trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
147
+				}
148
+				break;
149
+		}
150
+	}
151
+
152
+	if (!isset($options) && !isset($values)) {
153
+		return '';
154
+	} /* raise error here? */
155
+
156
+	$_html_result = array();
157
+
158
+	if (isset($options)) {
159
+		foreach ($options as $_key => $_val) {
160
+			$_html_result[] =
161
+				smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
162
+													   $label_ids, $escape);
163
+		}
164
+	} else {
165
+		foreach ($values as $_i => $_key) {
166
+			$_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
167
+			$_html_result[] =
168
+				smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
169
+													   $label_ids, $escape);
170
+		}
171
+	}
172
+
173
+	if (!empty($params[ 'assign' ])) {
174
+		$template->assign($params[ 'assign' ], $_html_result);
175
+	} else {
176
+		return implode("\n", $_html_result);
177
+	}
178 178
 }
179 179
 
180 180
 function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels,
181
-                                                $label_ids, $escape = true)
181
+												$label_ids, $escape = true)
182 182
 {
183
-    $_output = '';
184
-
185
-    if (is_object($value)) {
186
-        if (method_exists($value, "__toString")) {
187
-            $value = (string) $value->__toString();
188
-        } else {
189
-            trigger_error("html_options: value is an object of class '" . get_class($value) .
190
-                          "' without __toString() method", E_USER_NOTICE);
191
-
192
-            return '';
193
-        }
194
-    } else {
195
-        $value = (string) $value;
196
-    }
197
-
198
-    if (is_object($output)) {
199
-        if (method_exists($output, "__toString")) {
200
-            $output = (string) $output->__toString();
201
-        } else {
202
-            trigger_error("html_options: output is an object of class '" . get_class($output) .
203
-                          "' without __toString() method", E_USER_NOTICE);
204
-
205
-            return '';
206
-        }
207
-    } else {
208
-        $output = (string) $output;
209
-    }
210
-
211
-    if ($labels) {
212
-        if ($label_ids) {
213
-            $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
214
-                                                                     $name . '_' . $value));
215
-            $_output .= '<label for="' . $_id . '">';
216
-        } else {
217
-            $_output .= '<label>';
218
-        }
219
-    }
220
-
221
-    $name = smarty_function_escape_special_chars($name);
222
-    $value = smarty_function_escape_special_chars($value);
223
-    if ($escape) {
224
-        $output = smarty_function_escape_special_chars($output);
225
-    }
226
-
227
-    $_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
228
-
229
-    if ($labels && $label_ids) {
230
-        $_output .= ' id="' . $_id . '"';
231
-    }
232
-
233
-    if (is_array($selected)) {
234
-        if (isset($selected[ $value ])) {
235
-            $_output .= ' checked="checked"';
236
-        }
237
-    } elseif ($value === $selected) {
238
-        $_output .= ' checked="checked"';
239
-    }
240
-
241
-    $_output .= $extra . ' />' . $output;
242
-    if ($labels) {
243
-        $_output .= '</label>';
244
-    }
245
-
246
-    $_output .= $separator;
247
-
248
-    return $_output;
183
+	$_output = '';
184
+
185
+	if (is_object($value)) {
186
+		if (method_exists($value, "__toString")) {
187
+			$value = (string) $value->__toString();
188
+		} else {
189
+			trigger_error("html_options: value is an object of class '" . get_class($value) .
190
+						  "' without __toString() method", E_USER_NOTICE);
191
+
192
+			return '';
193
+		}
194
+	} else {
195
+		$value = (string) $value;
196
+	}
197
+
198
+	if (is_object($output)) {
199
+		if (method_exists($output, "__toString")) {
200
+			$output = (string) $output->__toString();
201
+		} else {
202
+			trigger_error("html_options: output is an object of class '" . get_class($output) .
203
+						  "' without __toString() method", E_USER_NOTICE);
204
+
205
+			return '';
206
+		}
207
+	} else {
208
+		$output = (string) $output;
209
+	}
210
+
211
+	if ($labels) {
212
+		if ($label_ids) {
213
+			$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_',
214
+																	 $name . '_' . $value));
215
+			$_output .= '<label for="' . $_id . '">';
216
+		} else {
217
+			$_output .= '<label>';
218
+		}
219
+	}
220
+
221
+	$name = smarty_function_escape_special_chars($name);
222
+	$value = smarty_function_escape_special_chars($value);
223
+	if ($escape) {
224
+		$output = smarty_function_escape_special_chars($output);
225
+	}
226
+
227
+	$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
228
+
229
+	if ($labels && $label_ids) {
230
+		$_output .= ' id="' . $_id . '"';
231
+	}
232
+
233
+	if (is_array($selected)) {
234
+		if (isset($selected[ $value ])) {
235
+			$_output .= ' checked="checked"';
236
+		}
237
+	} elseif ($value === $selected) {
238
+		$_output .= ' checked="checked"';
239
+	}
240
+
241
+	$_output .= $extra . ' />' . $output;
242
+	if ($labels) {
243
+		$_output .= '</label>';
244
+	}
245
+
246
+	$_output .= $separator;
247
+
248
+	return $_output;
249 249
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
                         } else {
98 98
                             $_sel = smarty_function_escape_special_chars((string) $_sel);
99 99
                         }
100
-                        $selected[ $_sel ] = true;
100
+                        $selected[$_sel] = true;
101 101
                     }
102 102
                 } elseif (is_object($_val)) {
103 103
                     if (method_exists($_val, "__toString")) {
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 
126 126
             case 'disabled':
127 127
             case 'readonly':
128
-                if (!empty($params[ 'strict' ])) {
128
+                if (!empty($params['strict'])) {
129 129
                     if (!is_scalar($_val)) {
130 130
                         trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute",
131 131
                                       E_USER_NOTICE);
@@ -163,15 +163,15 @@  discard block
 block discarded – undo
163 163
         }
164 164
     } else {
165 165
         foreach ($values as $_i => $_key) {
166
-            $_val = isset($output[ $_i ]) ? $output[ $_i ] : '';
166
+            $_val = isset($output[$_i]) ? $output[$_i] : '';
167 167
             $_html_result[] =
168 168
                 smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels,
169 169
                                                        $label_ids, $escape);
170 170
         }
171 171
     }
172 172
 
173
-    if (!empty($params[ 'assign' ])) {
174
-        $template->assign($params[ 'assign' ], $_html_result);
173
+    if (!empty($params['assign'])) {
174
+        $template->assign($params['assign'], $_html_result);
175 175
     } else {
176 176
         return implode("\n", $_html_result);
177 177
     }
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     }
232 232
 
233 233
     if (is_array($selected)) {
234
-        if (isset($selected[ $value ])) {
234
+        if (isset($selected[$value])) {
235 235
             $_output .= ' checked="checked"';
236 236
         }
237 237
     } elseif ($value === $selected) {
Please login to merge, or discard this patch.