Completed
Push — developer ( f9e515...68a04b )
by Błażej
506:11 queued 468:51
created
libraries/Smarty/libs/plugins/modifier.truncate.php 2 patches
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -27,40 +27,40 @@
 block discarded – undo
27 27
  */
28 28
 function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
29 29
 {
30
-    if ($length == 0) {
31
-        return '';
32
-    }
30
+	if ($length == 0) {
31
+		return '';
32
+	}
33 33
 
34
-    if (Smarty::$_MBSTRING) {
35
-        if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
36
-            $length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
37
-            if (!$break_words && !$middle) {
38
-                $string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '',
39
-                                       mb_substr($string, 0, $length + 1, Smarty::$_CHARSET));
40
-            }
41
-            if (!$middle) {
42
-                return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
43
-            }
34
+	if (Smarty::$_MBSTRING) {
35
+		if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
36
+			$length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
37
+			if (!$break_words && !$middle) {
38
+				$string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '',
39
+									   mb_substr($string, 0, $length + 1, Smarty::$_CHARSET));
40
+			}
41
+			if (!$middle) {
42
+				return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
43
+			}
44 44
 
45
-            return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc .
46
-                   mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET);
47
-        }
45
+			return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc .
46
+				   mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET);
47
+		}
48 48
 
49
-        return $string;
50
-    }
49
+		return $string;
50
+	}
51 51
 
52
-    // no MBString fallback
53
-    if (isset($string[ $length ])) {
54
-        $length -= min($length, strlen($etc));
55
-        if (!$break_words && !$middle) {
56
-            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
57
-        }
58
-        if (!$middle) {
59
-            return substr($string, 0, $length) . $etc;
60
-        }
52
+	// no MBString fallback
53
+	if (isset($string[ $length ])) {
54
+		$length -= min($length, strlen($etc));
55
+		if (!$break_words && !$middle) {
56
+			$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
57
+		}
58
+		if (!$middle) {
59
+			return substr($string, 0, $length) . $etc;
60
+		}
61 61
 
62
-        return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2);
63
-    }
62
+		return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2);
63
+	}
64 64
 
65
-    return $string;
65
+	return $string;
66 66
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     }
51 51
 
52 52
     // no MBString fallback
53
-    if (isset($string[ $length ])) {
53
+    if (isset($string[$length])) {
54 54
         $length -= min($length, strlen($etc));
55 55
         if (!$break_words && !$middle) {
56 56
             $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.to_charset.php 2 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,13 +20,13 @@
 block discarded – undo
20 20
  */
21 21
 function smarty_modifiercompiler_to_charset($params)
22 22
 {
23
-    if (!Smarty::$_MBSTRING) {
24
-        return $params[ 0 ];
25
-    }
23
+	if (!Smarty::$_MBSTRING) {
24
+		return $params[ 0 ];
25
+	}
26 26
 
27
-    if (!isset($params[ 1 ])) {
28
-        $params[ 1 ] = '"ISO-8859-1"';
29
-    }
27
+	if (!isset($params[ 1 ])) {
28
+		$params[ 1 ] = '"ISO-8859-1"';
29
+	}
30 30
 
31
-    return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 1 ] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
31
+	return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 1 ] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
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
 function smarty_modifiercompiler_to_charset($params)
22 22
 {
23 23
     if (!Smarty::$_MBSTRING) {
24
-        return $params[ 0 ];
24
+        return $params[0];
25 25
     }
26 26
 
27
-    if (!isset($params[ 1 ])) {
28
-        $params[ 1 ] = '"ISO-8859-1"';
27
+    if (!isset($params[1])) {
28
+        $params[1] = '"ISO-8859-1"';
29 29
     }
30 30
 
31
-    return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 1 ] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
31
+    return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
32 32
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifiercompiler.unescape.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -20,31 +20,31 @@
 block discarded – undo
20 20
  */
21 21
 function smarty_modifiercompiler_unescape($params)
22 22
 {
23
-    if (!isset($params[ 1 ])) {
24
-        $params[ 1 ] = 'html';
25
-    }
26
-    if (!isset($params[ 2 ])) {
27
-        $params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
28
-    } else {
29
-        $params[ 2 ] = "'" . $params[ 2 ] . "'";
30
-    }
23
+	if (!isset($params[ 1 ])) {
24
+		$params[ 1 ] = 'html';
25
+	}
26
+	if (!isset($params[ 2 ])) {
27
+		$params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
28
+	} else {
29
+		$params[ 2 ] = "'" . $params[ 2 ] . "'";
30
+	}
31 31
 
32
-    switch (trim($params[ 1 ], '"\'')) {
33
-        case 'entity':
34
-        case 'htmlall':
35
-            if (Smarty::$_MBSTRING) {
36
-                return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
37
-            }
32
+	switch (trim($params[ 1 ], '"\'')) {
33
+		case 'entity':
34
+		case 'htmlall':
35
+			if (Smarty::$_MBSTRING) {
36
+				return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
37
+			}
38 38
 
39
-            return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
39
+			return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
40 40
 
41
-        case 'html':
42
-            return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
41
+		case 'html':
42
+			return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
43 43
 
44
-        case 'url':
45
-            return 'rawurldecode(' . $params[ 0 ] . ')';
44
+		case 'url':
45
+			return 'rawurldecode(' . $params[ 0 ] . ')';
46 46
 
47
-        default:
48
-            return $params[ 0 ];
49
-    }
47
+		default:
48
+			return $params[ 0 ];
49
+	}
50 50
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,31 +20,31 @@
 block discarded – undo
20 20
  */
21 21
 function smarty_modifiercompiler_unescape($params)
22 22
 {
23
-    if (!isset($params[ 1 ])) {
24
-        $params[ 1 ] = 'html';
23
+    if (!isset($params[1])) {
24
+        $params[1] = 'html';
25 25
     }
26
-    if (!isset($params[ 2 ])) {
27
-        $params[ 2 ] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
26
+    if (!isset($params[2])) {
27
+        $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
28 28
     } else {
29
-        $params[ 2 ] = "'" . $params[ 2 ] . "'";
29
+        $params[2] = "'" . $params[2] . "'";
30 30
     }
31 31
 
32
-    switch (trim($params[ 1 ], '"\'')) {
32
+    switch (trim($params[1], '"\'')) {
33 33
         case 'entity':
34 34
         case 'htmlall':
35 35
             if (Smarty::$_MBSTRING) {
36
-                return 'mb_convert_encoding(' . $params[ 0 ] . ', ' . $params[ 2 ] . ', \'HTML-ENTITIES\')';
36
+                return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
37 37
             }
38 38
 
39
-            return 'html_entity_decode(' . $params[ 0 ] . ', ENT_NOQUOTES, ' . $params[ 2 ] . ')';
39
+            return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
40 40
 
41 41
         case 'html':
42
-            return 'htmlspecialchars_decode(' . $params[ 0 ] . ', ENT_QUOTES)';
42
+            return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
43 43
 
44 44
         case 'url':
45
-            return 'rawurldecode(' . $params[ 0 ] . ')';
45
+            return 'rawurldecode(' . $params[0] . ')';
46 46
 
47 47
         default:
48
-            return $params[ 0 ];
48
+            return $params[0];
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifier.spacify.php 1 patch
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_modifier_spacify($string, $spacify_char = ' ')
24 24
 {
25
-    // well… what about charsets besides latin and UTF-8?
26
-    return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, - 1, PREG_SPLIT_NO_EMPTY));
25
+	// well… what about charsets besides latin and UTF-8?
26
+	return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, - 1, PREG_SPLIT_NO_EMPTY));
27 27
 }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/modifier.debug_print_var.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -24,89 +24,89 @@
 block discarded – undo
24 24
  */
25 25
 function smarty_modifier_debug_print_var($var, $max = 10, $length = 40, $depth = 0, $objects = array())
26 26
 {
27
-    $_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
28
-    switch (gettype($var)) {
29
-        case 'array' :
30
-            $results = '<b>Array (' . count($var) . ')</b>';
31
-            if ($depth == $max) {
32
-                break;
33
-            }
34
-            foreach ($var as $curr_key => $curr_val) {
35
-                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
36
-                            '</b> =&gt; ' .
37
-                            smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
38
-                $depth --;
39
-            }
40
-            break;
27
+	$_replace = array("\n" => '\n', "\r" => '\r', "\t" => '\t');
28
+	switch (gettype($var)) {
29
+		case 'array' :
30
+			$results = '<b>Array (' . count($var) . ')</b>';
31
+			if ($depth == $max) {
32
+				break;
33
+			}
34
+			foreach ($var as $curr_key => $curr_val) {
35
+				$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
36
+							'</b> =&gt; ' .
37
+							smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
38
+				$depth --;
39
+			}
40
+			break;
41 41
 
42
-        case 'object' :
43
-            $object_vars = get_object_vars($var);
44
-            $results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
45
-            if (in_array($var, $objects)) {
46
-                $results .= ' called recursive';
47
-                break;
48
-            }
49
-            if ($depth == $max) {
50
-                break;
51
-            }
52
-            $objects[] = $var;
53
-            foreach ($object_vars as $curr_key => $curr_val) {
54
-                $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
55
-                            '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
56
-                $depth --;
57
-            }
58
-            break;
42
+		case 'object' :
43
+			$object_vars = get_object_vars($var);
44
+			$results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
45
+			if (in_array($var, $objects)) {
46
+				$results .= ' called recursive';
47
+				break;
48
+			}
49
+			if ($depth == $max) {
50
+				break;
51
+			}
52
+			$objects[] = $var;
53
+			foreach ($object_vars as $curr_key => $curr_val) {
54
+				$results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
55
+							'</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
56
+				$depth --;
57
+			}
58
+			break;
59 59
 
60
-        case 'boolean' :
61
-        case 'NULL' :
62
-        case 'resource' :
63
-            if (true === $var) {
64
-                $results = 'true';
65
-            } elseif (false === $var) {
66
-                $results = 'false';
67
-            } elseif (null === $var) {
68
-                $results = 'null';
69
-            } else {
70
-                $results = htmlspecialchars((string) $var);
71
-            }
72
-            $results = '<i>' . $results . '</i>';
73
-            break;
60
+		case 'boolean' :
61
+		case 'NULL' :
62
+		case 'resource' :
63
+			if (true === $var) {
64
+				$results = 'true';
65
+			} elseif (false === $var) {
66
+				$results = 'false';
67
+			} elseif (null === $var) {
68
+				$results = 'null';
69
+			} else {
70
+				$results = htmlspecialchars((string) $var);
71
+			}
72
+			$results = '<i>' . $results . '</i>';
73
+			break;
74 74
 
75
-        case 'integer' :
76
-        case 'float' :
77
-            $results = htmlspecialchars((string) $var);
78
-            break;
75
+		case 'integer' :
76
+		case 'float' :
77
+			$results = htmlspecialchars((string) $var);
78
+			break;
79 79
 
80
-        case 'string' :
81
-            $results = strtr($var, $_replace);
82
-            if (Smarty::$_MBSTRING) {
83
-                if (mb_strlen($var, Smarty::$_CHARSET) > $length) {
84
-                    $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
85
-                }
86
-            } else {
87
-                if (isset($var[ $length ])) {
88
-                    $results = substr($var, 0, $length - 3) . '...';
89
-                }
90
-            }
80
+		case 'string' :
81
+			$results = strtr($var, $_replace);
82
+			if (Smarty::$_MBSTRING) {
83
+				if (mb_strlen($var, Smarty::$_CHARSET) > $length) {
84
+					$results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
85
+				}
86
+			} else {
87
+				if (isset($var[ $length ])) {
88
+					$results = substr($var, 0, $length - 3) . '...';
89
+				}
90
+			}
91 91
 
92
-            $results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
93
-            break;
92
+			$results = htmlspecialchars('"' . $results . '"', ENT_QUOTES, Smarty::$_CHARSET);
93
+			break;
94 94
 
95
-        case 'unknown type' :
96
-        default :
97
-            $results = strtr((string) $var, $_replace);
98
-            if (Smarty::$_MBSTRING) {
99
-                if (mb_strlen($results, Smarty::$_CHARSET) > $length) {
100
-                    $results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...';
101
-                }
102
-            } else {
103
-                if (strlen($results) > $length) {
104
-                    $results = substr($results, 0, $length - 3) . '...';
105
-                }
106
-            }
95
+		case 'unknown type' :
96
+		default :
97
+			$results = strtr((string) $var, $_replace);
98
+			if (Smarty::$_MBSTRING) {
99
+				if (mb_strlen($results, Smarty::$_CHARSET) > $length) {
100
+					$results = mb_substr($results, 0, $length - 3, Smarty::$_CHARSET) . '...';
101
+				}
102
+			} else {
103
+				if (strlen($results) > $length) {
104
+					$results = substr($results, 0, $length - 3) . '...';
105
+				}
106
+			}
107 107
 
108
-            $results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
109
-    }
108
+			$results = htmlspecialchars($results, ENT_QUOTES, Smarty::$_CHARSET);
109
+	}
110 110
 
111
-    return $results;
111
+	return $results;
112 112
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
                 $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b>' . strtr($curr_key, $_replace) .
36 36
                             '</b> =&gt; ' .
37 37
                             smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
38
-                $depth --;
38
+                $depth--;
39 39
             }
40 40
             break;
41 41
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             foreach ($object_vars as $curr_key => $curr_val) {
54 54
                 $results .= '<br>' . str_repeat('&nbsp;', $depth * 2) . '<b> -&gt;' . strtr($curr_key, $_replace) .
55 55
                             '</b> = ' . smarty_modifier_debug_print_var($curr_val, $max, $length, ++ $depth, $objects);
56
-                $depth --;
56
+                $depth--;
57 57
             }
58 58
             break;
59 59
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
                     $results = mb_substr($var, 0, $length - 3, Smarty::$_CHARSET) . '...';
85 85
                 }
86 86
             } else {
87
-                if (isset($var[ $length ])) {
87
+                if (isset($var[$length])) {
88 88
                     $results = substr($var, 0, $length - 3) . '...';
89 89
                 }
90 90
             }
Please login to merge, or discard this patch.
libraries/Smarty/libs/plugins/function.html_select_time.php 2 patches
Indentation   +330 added lines, -330 removed lines patch added patch discarded remove patch
@@ -33,334 +33,334 @@
 block discarded – undo
33 33
  */
34 34
 function smarty_function_html_select_time($params)
35 35
 {
36
-    $prefix = "Time_";
37
-    $field_array = null;
38
-    $field_separator = "\n";
39
-    $option_separator = "\n";
40
-    $time = null;
41
-
42
-    $display_hours = true;
43
-    $display_minutes = true;
44
-    $display_seconds = true;
45
-    $display_meridian = true;
46
-
47
-    $hour_format = '%02d';
48
-    $hour_value_format = '%02d';
49
-    $minute_format = '%02d';
50
-    $minute_value_format = '%02d';
51
-    $second_format = '%02d';
52
-    $second_value_format = '%02d';
53
-
54
-    $hour_size = null;
55
-    $minute_size = null;
56
-    $second_size = null;
57
-    $meridian_size = null;
58
-
59
-    $all_empty = null;
60
-    $hour_empty = null;
61
-    $minute_empty = null;
62
-    $second_empty = null;
63
-    $meridian_empty = null;
64
-
65
-    $all_id = null;
66
-    $hour_id = null;
67
-    $minute_id = null;
68
-    $second_id = null;
69
-    $meridian_id = null;
70
-
71
-    $use_24_hours = true;
72
-    $minute_interval = 1;
73
-    $second_interval = 1;
74
-
75
-    $extra_attrs = '';
76
-    $all_extra = null;
77
-    $hour_extra = null;
78
-    $minute_extra = null;
79
-    $second_extra = null;
80
-    $meridian_extra = null;
81
-
82
-    foreach ($params as $_key => $_value) {
83
-        switch ($_key) {
84
-            case 'time':
85
-                if (!is_array($_value) && $_value !== null) {
86
-                    $time = smarty_make_timestamp($_value);
87
-                }
88
-                break;
89
-
90
-            case 'prefix':
91
-            case 'field_array':
92
-
93
-            case 'field_separator':
94
-            case 'option_separator':
95
-
96
-            case 'all_extra':
97
-            case 'hour_extra':
98
-            case 'minute_extra':
99
-            case 'second_extra':
100
-            case 'meridian_extra':
101
-
102
-            case 'all_empty':
103
-            case 'hour_empty':
104
-            case 'minute_empty':
105
-            case 'second_empty':
106
-            case 'meridian_empty':
107
-
108
-            case 'all_id':
109
-            case 'hour_id':
110
-            case 'minute_id':
111
-            case 'second_id':
112
-            case 'meridian_id':
113
-
114
-            case 'hour_format':
115
-            case 'hour_value_format':
116
-            case 'minute_format':
117
-            case 'minute_value_format':
118
-            case 'second_format':
119
-            case 'second_value_format':
120
-                $$_key = (string) $_value;
121
-                break;
122
-
123
-            case 'display_hours':
124
-            case 'display_minutes':
125
-            case 'display_seconds':
126
-            case 'display_meridian':
127
-            case 'use_24_hours':
128
-                $$_key = (bool) $_value;
129
-                break;
130
-
131
-            case 'minute_interval':
132
-            case 'second_interval':
133
-
134
-            case 'hour_size':
135
-            case 'minute_size':
136
-            case 'second_size':
137
-            case 'meridian_size':
138
-                $$_key = (int) $_value;
139
-                break;
140
-
141
-            default:
142
-                if (!is_array($_value)) {
143
-                    $extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
144
-                } else {
145
-                    trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
146
-                }
147
-                break;
148
-        }
149
-    }
150
-
151
-    if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
152
-        if (isset($params[ 'time' ][ $prefix . 'Hour' ])) {
153
-            // $_REQUEST[$field_array] given
154
-            foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
155
-                $_variableName = '_' . strtolower($_elementName);
156
-                $$_variableName =
157
-                    isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
158
-                        date($_elementKey);
159
-            }
160
-            $_meridian =
161
-                isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
162
-                    '';
163
-            $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
164
-            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
165
-        } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) {
166
-            // $_REQUEST given
167
-            foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
168
-                $_variableName = '_' . strtolower($_elementName);
169
-                $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
170
-                    $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
171
-            }
172
-            $_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
173
-                (' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
174
-            $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
175
-            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
176
-        } else {
177
-            // no date found, use NOW
178
-            list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
179
-        }
180
-    } elseif ($time === null) {
181
-        if (array_key_exists('time', $params)) {
182
-            $_hour = $_minute = $_second = $time = null;
183
-        } else {
184
-            list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
185
-        }
186
-    } else {
187
-        list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
188
-    }
189
-
190
-    // generate hour <select>
191
-    if ($display_hours) {
192
-        $_html_hours = '';
193
-        $_extra = '';
194
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour');
195
-        if ($all_extra) {
196
-            $_extra .= ' ' . $all_extra;
197
-        }
198
-        if ($hour_extra) {
199
-            $_extra .= ' ' . $hour_extra;
200
-        }
201
-
202
-        $_html_hours = '<select name="' . $_name . '"';
203
-        if ($hour_id !== null || $all_id !== null) {
204
-            $_html_hours .= ' id="' .
205
-                            smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) :
206
-                                                                     ($all_id ? ($all_id . $_name) : $_name)) . '"';
207
-        }
208
-        if ($hour_size) {
209
-            $_html_hours .= ' size="' . $hour_size . '"';
210
-        }
211
-        $_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
212
-
213
-        if (isset($hour_empty) || isset($all_empty)) {
214
-            $_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
215
-                            $option_separator;
216
-        }
217
-
218
-        $start = $use_24_hours ? 0 : 1;
219
-        $end = $use_24_hours ? 23 : 12;
220
-        for ($i = $start; $i <= $end; $i ++) {
221
-            $_val = sprintf('%02d', $i);
222
-            $_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);
223
-            $_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
224
-
225
-            if (!$use_24_hours) {
226
-                $_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12);
227
-            }
228
-
229
-            $selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
230
-            $_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' .
231
-                            $_text . '</option>' . $option_separator;
232
-        }
233
-
234
-        $_html_hours .= '</select>';
235
-    }
236
-
237
-    // generate minute <select>
238
-    if ($display_minutes) {
239
-        $_html_minutes = '';
240
-        $_extra = '';
241
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');
242
-        if ($all_extra) {
243
-            $_extra .= ' ' . $all_extra;
244
-        }
245
-        if ($minute_extra) {
246
-            $_extra .= ' ' . $minute_extra;
247
-        }
248
-
249
-        $_html_minutes = '<select name="' . $_name . '"';
250
-        if ($minute_id !== null || $all_id !== null) {
251
-            $_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ?
252
-                                                                                 ($minute_id ? $minute_id : $_name) :
253
-                                                                                 ($all_id ? ($all_id . $_name) :
254
-                                                                                     $_name)) . '"';
255
-        }
256
-        if ($minute_size) {
257
-            $_html_minutes .= ' size="' . $minute_size . '"';
258
-        }
259
-        $_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
260
-
261
-        if (isset($minute_empty) || isset($all_empty)) {
262
-            $_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
263
-                              $option_separator;
264
-        }
265
-
266
-        $selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
267
-        for ($i = 0; $i <= 59; $i += $minute_interval) {
268
-            $_val = sprintf('%02d', $i);
269
-            $_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);
270
-            $_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);
271
-            $_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
272
-                              '>' . $_text . '</option>' . $option_separator;
273
-        }
274
-
275
-        $_html_minutes .= '</select>';
276
-    }
277
-
278
-    // generate second <select>
279
-    if ($display_seconds) {
280
-        $_html_seconds = '';
281
-        $_extra = '';
282
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');
283
-        if ($all_extra) {
284
-            $_extra .= ' ' . $all_extra;
285
-        }
286
-        if ($second_extra) {
287
-            $_extra .= ' ' . $second_extra;
288
-        }
289
-
290
-        $_html_seconds = '<select name="' . $_name . '"';
291
-        if ($second_id !== null || $all_id !== null) {
292
-            $_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ?
293
-                                                                                 ($second_id ? $second_id : $_name) :
294
-                                                                                 ($all_id ? ($all_id . $_name) :
295
-                                                                                     $_name)) . '"';
296
-        }
297
-        if ($second_size) {
298
-            $_html_seconds .= ' size="' . $second_size . '"';
299
-        }
300
-        $_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
301
-
302
-        if (isset($second_empty) || isset($all_empty)) {
303
-            $_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
304
-                              $option_separator;
305
-        }
306
-
307
-        $selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
308
-        for ($i = 0; $i <= 59; $i += $second_interval) {
309
-            $_val = sprintf('%02d', $i);
310
-            $_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);
311
-            $_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);
312
-            $_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
313
-                              '>' . $_text . '</option>' . $option_separator;
314
-        }
315
-
316
-        $_html_seconds .= '</select>';
317
-    }
318
-
319
-    // generate meridian <select>
320
-    if ($display_meridian && !$use_24_hours) {
321
-        $_html_meridian = '';
322
-        $_extra = '';
323
-        $_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian');
324
-        if ($all_extra) {
325
-            $_extra .= ' ' . $all_extra;
326
-        }
327
-        if ($meridian_extra) {
328
-            $_extra .= ' ' . $meridian_extra;
329
-        }
330
-
331
-        $_html_meridian = '<select name="' . $_name . '"';
332
-        if ($meridian_id !== null || $all_id !== null) {
333
-            $_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ?
334
-                                                                                  ($meridian_id ? $meridian_id :
335
-                                                                                      $_name) :
336
-                                                                                  ($all_id ? ($all_id . $_name) :
337
-                                                                                      $_name)) . '"';
338
-        }
339
-        if ($meridian_size) {
340
-            $_html_meridian .= ' size="' . $meridian_size . '"';
341
-        }
342
-        $_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
343
-
344
-        if (isset($meridian_empty) || isset($all_empty)) {
345
-            $_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
346
-                               '</option>' . $option_separator;
347
-        }
348
-
349
-        $_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
350
-                           '>AM</option>' . $option_separator . '<option value="pm"' .
351
-                           ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator .
352
-                           '</select>';
353
-    }
354
-
355
-    $_html = '';
356
-    foreach (array('_html_hours', '_html_minutes', '_html_seconds', '_html_meridian') as $k) {
357
-        if (isset($$k)) {
358
-            if ($_html) {
359
-                $_html .= $field_separator;
360
-            }
361
-            $_html .= $$k;
362
-        }
363
-    }
364
-
365
-    return $_html;
36
+	$prefix = "Time_";
37
+	$field_array = null;
38
+	$field_separator = "\n";
39
+	$option_separator = "\n";
40
+	$time = null;
41
+
42
+	$display_hours = true;
43
+	$display_minutes = true;
44
+	$display_seconds = true;
45
+	$display_meridian = true;
46
+
47
+	$hour_format = '%02d';
48
+	$hour_value_format = '%02d';
49
+	$minute_format = '%02d';
50
+	$minute_value_format = '%02d';
51
+	$second_format = '%02d';
52
+	$second_value_format = '%02d';
53
+
54
+	$hour_size = null;
55
+	$minute_size = null;
56
+	$second_size = null;
57
+	$meridian_size = null;
58
+
59
+	$all_empty = null;
60
+	$hour_empty = null;
61
+	$minute_empty = null;
62
+	$second_empty = null;
63
+	$meridian_empty = null;
64
+
65
+	$all_id = null;
66
+	$hour_id = null;
67
+	$minute_id = null;
68
+	$second_id = null;
69
+	$meridian_id = null;
70
+
71
+	$use_24_hours = true;
72
+	$minute_interval = 1;
73
+	$second_interval = 1;
74
+
75
+	$extra_attrs = '';
76
+	$all_extra = null;
77
+	$hour_extra = null;
78
+	$minute_extra = null;
79
+	$second_extra = null;
80
+	$meridian_extra = null;
81
+
82
+	foreach ($params as $_key => $_value) {
83
+		switch ($_key) {
84
+			case 'time':
85
+				if (!is_array($_value) && $_value !== null) {
86
+					$time = smarty_make_timestamp($_value);
87
+				}
88
+				break;
89
+
90
+			case 'prefix':
91
+			case 'field_array':
92
+
93
+			case 'field_separator':
94
+			case 'option_separator':
95
+
96
+			case 'all_extra':
97
+			case 'hour_extra':
98
+			case 'minute_extra':
99
+			case 'second_extra':
100
+			case 'meridian_extra':
101
+
102
+			case 'all_empty':
103
+			case 'hour_empty':
104
+			case 'minute_empty':
105
+			case 'second_empty':
106
+			case 'meridian_empty':
107
+
108
+			case 'all_id':
109
+			case 'hour_id':
110
+			case 'minute_id':
111
+			case 'second_id':
112
+			case 'meridian_id':
113
+
114
+			case 'hour_format':
115
+			case 'hour_value_format':
116
+			case 'minute_format':
117
+			case 'minute_value_format':
118
+			case 'second_format':
119
+			case 'second_value_format':
120
+				$$_key = (string) $_value;
121
+				break;
122
+
123
+			case 'display_hours':
124
+			case 'display_minutes':
125
+			case 'display_seconds':
126
+			case 'display_meridian':
127
+			case 'use_24_hours':
128
+				$$_key = (bool) $_value;
129
+				break;
130
+
131
+			case 'minute_interval':
132
+			case 'second_interval':
133
+
134
+			case 'hour_size':
135
+			case 'minute_size':
136
+			case 'second_size':
137
+			case 'meridian_size':
138
+				$$_key = (int) $_value;
139
+				break;
140
+
141
+			default:
142
+				if (!is_array($_value)) {
143
+					$extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
144
+				} else {
145
+					trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
146
+				}
147
+				break;
148
+		}
149
+	}
150
+
151
+	if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
152
+		if (isset($params[ 'time' ][ $prefix . 'Hour' ])) {
153
+			// $_REQUEST[$field_array] given
154
+			foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
155
+				$_variableName = '_' . strtolower($_elementName);
156
+				$$_variableName =
157
+					isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
158
+						date($_elementKey);
159
+			}
160
+			$_meridian =
161
+				isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
162
+					'';
163
+			$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
164
+			list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
165
+		} elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) {
166
+			// $_REQUEST given
167
+			foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
168
+				$_variableName = '_' . strtolower($_elementName);
169
+				$$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
170
+					$params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
171
+			}
172
+			$_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
173
+				(' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
174
+			$time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
175
+			list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
176
+		} else {
177
+			// no date found, use NOW
178
+			list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
179
+		}
180
+	} elseif ($time === null) {
181
+		if (array_key_exists('time', $params)) {
182
+			$_hour = $_minute = $_second = $time = null;
183
+		} else {
184
+			list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s'));
185
+		}
186
+	} else {
187
+		list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
188
+	}
189
+
190
+	// generate hour <select>
191
+	if ($display_hours) {
192
+		$_html_hours = '';
193
+		$_extra = '';
194
+		$_name = $field_array ? ($field_array . '[' . $prefix . 'Hour]') : ($prefix . 'Hour');
195
+		if ($all_extra) {
196
+			$_extra .= ' ' . $all_extra;
197
+		}
198
+		if ($hour_extra) {
199
+			$_extra .= ' ' . $hour_extra;
200
+		}
201
+
202
+		$_html_hours = '<select name="' . $_name . '"';
203
+		if ($hour_id !== null || $all_id !== null) {
204
+			$_html_hours .= ' id="' .
205
+							smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) :
206
+																	 ($all_id ? ($all_id . $_name) : $_name)) . '"';
207
+		}
208
+		if ($hour_size) {
209
+			$_html_hours .= ' size="' . $hour_size . '"';
210
+		}
211
+		$_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
212
+
213
+		if (isset($hour_empty) || isset($all_empty)) {
214
+			$_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' .
215
+							$option_separator;
216
+		}
217
+
218
+		$start = $use_24_hours ? 0 : 1;
219
+		$end = $use_24_hours ? 23 : 12;
220
+		for ($i = $start; $i <= $end; $i ++) {
221
+			$_val = sprintf('%02d', $i);
222
+			$_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);
223
+			$_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
224
+
225
+			if (!$use_24_hours) {
226
+				$_hour12 = $_hour == 0 ? 12 : ($_hour <= 12 ? $_hour : $_hour - 12);
227
+			}
228
+
229
+			$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
230
+			$_html_hours .= '<option value="' . $_value . '"' . ($selected ? ' selected="selected"' : '') . '>' .
231
+							$_text . '</option>' . $option_separator;
232
+		}
233
+
234
+		$_html_hours .= '</select>';
235
+	}
236
+
237
+	// generate minute <select>
238
+	if ($display_minutes) {
239
+		$_html_minutes = '';
240
+		$_extra = '';
241
+		$_name = $field_array ? ($field_array . '[' . $prefix . 'Minute]') : ($prefix . 'Minute');
242
+		if ($all_extra) {
243
+			$_extra .= ' ' . $all_extra;
244
+		}
245
+		if ($minute_extra) {
246
+			$_extra .= ' ' . $minute_extra;
247
+		}
248
+
249
+		$_html_minutes = '<select name="' . $_name . '"';
250
+		if ($minute_id !== null || $all_id !== null) {
251
+			$_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ?
252
+																				 ($minute_id ? $minute_id : $_name) :
253
+																				 ($all_id ? ($all_id . $_name) :
254
+																					 $_name)) . '"';
255
+		}
256
+		if ($minute_size) {
257
+			$_html_minutes .= ' size="' . $minute_size . '"';
258
+		}
259
+		$_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
260
+
261
+		if (isset($minute_empty) || isset($all_empty)) {
262
+			$_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' .
263
+							  $option_separator;
264
+		}
265
+
266
+		$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
267
+		for ($i = 0; $i <= 59; $i += $minute_interval) {
268
+			$_val = sprintf('%02d', $i);
269
+			$_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);
270
+			$_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);
271
+			$_html_minutes .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
272
+							  '>' . $_text . '</option>' . $option_separator;
273
+		}
274
+
275
+		$_html_minutes .= '</select>';
276
+	}
277
+
278
+	// generate second <select>
279
+	if ($display_seconds) {
280
+		$_html_seconds = '';
281
+		$_extra = '';
282
+		$_name = $field_array ? ($field_array . '[' . $prefix . 'Second]') : ($prefix . 'Second');
283
+		if ($all_extra) {
284
+			$_extra .= ' ' . $all_extra;
285
+		}
286
+		if ($second_extra) {
287
+			$_extra .= ' ' . $second_extra;
288
+		}
289
+
290
+		$_html_seconds = '<select name="' . $_name . '"';
291
+		if ($second_id !== null || $all_id !== null) {
292
+			$_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ?
293
+																				 ($second_id ? $second_id : $_name) :
294
+																				 ($all_id ? ($all_id . $_name) :
295
+																					 $_name)) . '"';
296
+		}
297
+		if ($second_size) {
298
+			$_html_seconds .= ' size="' . $second_size . '"';
299
+		}
300
+		$_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
301
+
302
+		if (isset($second_empty) || isset($all_empty)) {
303
+			$_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' .
304
+							  $option_separator;
305
+		}
306
+
307
+		$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
308
+		for ($i = 0; $i <= 59; $i += $second_interval) {
309
+			$_val = sprintf('%02d', $i);
310
+			$_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);
311
+			$_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);
312
+			$_html_seconds .= '<option value="' . $_value . '"' . ($selected === $i ? ' selected="selected"' : '') .
313
+							  '>' . $_text . '</option>' . $option_separator;
314
+		}
315
+
316
+		$_html_seconds .= '</select>';
317
+	}
318
+
319
+	// generate meridian <select>
320
+	if ($display_meridian && !$use_24_hours) {
321
+		$_html_meridian = '';
322
+		$_extra = '';
323
+		$_name = $field_array ? ($field_array . '[' . $prefix . 'Meridian]') : ($prefix . 'Meridian');
324
+		if ($all_extra) {
325
+			$_extra .= ' ' . $all_extra;
326
+		}
327
+		if ($meridian_extra) {
328
+			$_extra .= ' ' . $meridian_extra;
329
+		}
330
+
331
+		$_html_meridian = '<select name="' . $_name . '"';
332
+		if ($meridian_id !== null || $all_id !== null) {
333
+			$_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ?
334
+																				  ($meridian_id ? $meridian_id :
335
+																					  $_name) :
336
+																				  ($all_id ? ($all_id . $_name) :
337
+																					  $_name)) . '"';
338
+		}
339
+		if ($meridian_size) {
340
+			$_html_meridian .= ' size="' . $meridian_size . '"';
341
+		}
342
+		$_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
343
+
344
+		if (isset($meridian_empty) || isset($all_empty)) {
345
+			$_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) .
346
+							   '</option>' . $option_separator;
347
+		}
348
+
349
+		$_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') .
350
+						   '>AM</option>' . $option_separator . '<option value="pm"' .
351
+						   ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator .
352
+						   '</select>';
353
+	}
354
+
355
+	$_html = '';
356
+	foreach (array('_html_hours', '_html_minutes', '_html_seconds', '_html_meridian') as $k) {
357
+		if (isset($$k)) {
358
+			if ($_html) {
359
+				$_html .= $field_separator;
360
+			}
361
+			$_html .= $$k;
362
+		}
363
+	}
364
+
365
+	return $_html;
366 366
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -24 removed lines patch added patch discarded remove patch
@@ -148,29 +148,27 @@  discard block
 block discarded – undo
148 148
         }
149 149
     }
150 150
 
151
-    if (isset($params[ 'time' ]) && is_array($params[ 'time' ])) {
152
-        if (isset($params[ 'time' ][ $prefix . 'Hour' ])) {
151
+    if (isset($params['time']) && is_array($params['time'])) {
152
+        if (isset($params['time'][$prefix . 'Hour'])) {
153 153
             // $_REQUEST[$field_array] given
154 154
             foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
155 155
                 $_variableName = '_' . strtolower($_elementName);
156 156
                 $$_variableName =
157
-                    isset($params[ 'time' ][ $prefix . $_elementName ]) ? $params[ 'time' ][ $prefix . $_elementName ] :
158
-                        date($_elementKey);
157
+                    isset($params['time'][$prefix . $_elementName]) ? $params['time'][$prefix . $_elementName] : date($_elementKey);
159 158
             }
160 159
             $_meridian =
161
-                isset($params[ 'time' ][ $prefix . 'Meridian' ]) ? (' ' . $params[ 'time' ][ $prefix . 'Meridian' ]) :
162
-                    '';
160
+                isset($params['time'][$prefix . 'Meridian']) ? (' ' . $params['time'][$prefix . 'Meridian']) : '';
163 161
             $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
164 162
             list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
165
-        } elseif (isset($params[ 'time' ][ $field_array ][ $prefix . 'Hour' ])) {
163
+        } elseif (isset($params['time'][$field_array][$prefix . 'Hour'])) {
166 164
             // $_REQUEST given
167 165
             foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
168 166
                 $_variableName = '_' . strtolower($_elementName);
169
-                $$_variableName = isset($params[ 'time' ][ $field_array ][ $prefix . $_elementName ]) ?
170
-                    $params[ 'time' ][ $field_array ][ $prefix . $_elementName ] : date($_elementKey);
167
+                $$_variableName = isset($params['time'][$field_array][$prefix . $_elementName]) ?
168
+                    $params['time'][$field_array][$prefix . $_elementName] : date($_elementKey);
171 169
             }
172
-            $_meridian = isset($params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) ?
173
-                (' ' . $params[ 'time' ][ $field_array ][ $prefix . 'Meridian' ]) : '';
170
+            $_meridian = isset($params['time'][$field_array][$prefix . 'Meridian']) ?
171
+                (' ' . $params['time'][$field_array][$prefix . 'Meridian']) : '';
174 172
             $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
175 173
             list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
176 174
         } else {
@@ -202,8 +200,7 @@  discard block
 block discarded – undo
202 200
         $_html_hours = '<select name="' . $_name . '"';
203 201
         if ($hour_id !== null || $all_id !== null) {
204 202
             $_html_hours .= ' id="' .
205
-                            smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) :
206
-                                                                     ($all_id ? ($all_id . $_name) : $_name)) . '"';
203
+                            smarty_function_escape_special_chars($hour_id !== null ? ($hour_id ? $hour_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)) . '"';
207 204
         }
208 205
         if ($hour_size) {
209 206
             $_html_hours .= ' size="' . $hour_size . '"';
@@ -217,7 +214,7 @@  discard block
 block discarded – undo
217 214
 
218 215
         $start = $use_24_hours ? 0 : 1;
219 216
         $end = $use_24_hours ? 23 : 12;
220
-        for ($i = $start; $i <= $end; $i ++) {
217
+        for ($i = $start; $i <= $end; $i++) {
221 218
             $_val = sprintf('%02d', $i);
222 219
             $_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);
223 220
             $_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
@@ -249,9 +246,7 @@  discard block
 block discarded – undo
249 246
         $_html_minutes = '<select name="' . $_name . '"';
250 247
         if ($minute_id !== null || $all_id !== null) {
251 248
             $_html_minutes .= ' id="' . smarty_function_escape_special_chars($minute_id !== null ?
252
-                                                                                 ($minute_id ? $minute_id : $_name) :
253
-                                                                                 ($all_id ? ($all_id . $_name) :
254
-                                                                                     $_name)) . '"';
249
+                                                                                 ($minute_id ? $minute_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)) . '"';
255 250
         }
256 251
         if ($minute_size) {
257 252
             $_html_minutes .= ' size="' . $minute_size . '"';
@@ -290,9 +285,7 @@  discard block
 block discarded – undo
290 285
         $_html_seconds = '<select name="' . $_name . '"';
291 286
         if ($second_id !== null || $all_id !== null) {
292 287
             $_html_seconds .= ' id="' . smarty_function_escape_special_chars($second_id !== null ?
293
-                                                                                 ($second_id ? $second_id : $_name) :
294
-                                                                                 ($all_id ? ($all_id . $_name) :
295
-                                                                                     $_name)) . '"';
288
+                                                                                 ($second_id ? $second_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)) . '"';
296 289
         }
297 290
         if ($second_size) {
298 291
             $_html_seconds .= ' size="' . $second_size . '"';
@@ -331,10 +324,7 @@  discard block
 block discarded – undo
331 324
         $_html_meridian = '<select name="' . $_name . '"';
332 325
         if ($meridian_id !== null || $all_id !== null) {
333 326
             $_html_meridian .= ' id="' . smarty_function_escape_special_chars($meridian_id !== null ?
334
-                                                                                  ($meridian_id ? $meridian_id :
335
-                                                                                      $_name) :
336
-                                                                                  ($all_id ? ($all_id . $_name) :
337
-                                                                                      $_name)) . '"';
327
+                                                                                  ($meridian_id ? $meridian_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)) . '"';
338 328
         }
339 329
         if ($meridian_size) {
340 330
             $_html_meridian .= ' size="' . $meridian_size . '"';
Please login to merge, or discard this patch.
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.