Completed
Push — master ( 24ce66...da2f36 )
by Adam
25:35
created
include/Smarty/plugins/function.html_select_date.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  */
38 38
 function smarty_function_html_select_date($params, &$smarty)
39 39
 {
40
-    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
41
-    require_once $smarty->_get_plugin_filepath('shared','make_timestamp');
42
-    require_once $smarty->_get_plugin_filepath('function','html_options');
40
+    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
41
+    require_once $smarty->_get_plugin_filepath('shared', 'make_timestamp');
42
+    require_once $smarty->_get_plugin_filepath('function', 'html_options');
43 43
     /* Default values. */
44 44
     $prefix          = "Date_";
45 45
     $start_year      = strftime("%Y");
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                 break;
125 125
 
126 126
             default:
127
-                if(!is_array($_value)) {
127
+                if (!is_array($_value)) {
128 128
                     $extra_attrs .= ' '.$_key.'="'.smarty_function_escape_special_chars($_value).'"';
129 129
                 } else {
130 130
                     $smarty->trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             // force start year to include given date if not explicitly set
169 169
             $start_year = $time[0];
170 170
         }
171
-        if($end_year < $time[0] && !isset($params['end_year'])) {
171
+        if ($end_year < $time[0] && !isset($params['end_year'])) {
172 172
             // force end year to include given date if not explicitly set
173 173
             $end_year = $time[0];
174 174
         }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
     	$field_separator_count++;
184 184
         $month_names = array();
185 185
         $month_values = array();
186
-        if(isset($month_empty)) {
186
+        if (isset($month_empty)) {
187 187
             $month_names[''] = $month_empty;
188 188
             $month_values[''] = '';
189 189
         }
@@ -193,21 +193,21 @@  discard block
 block discarded – undo
193 193
         }
194 194
 
195 195
         $month_result .= '<select name=';
196
-        if (null !== $field_array){
197
-            $month_result .= '"' . $field_array . '[' . $prefix . 'Month]"';
196
+        if (null !== $field_array) {
197
+            $month_result .= '"'.$field_array.'['.$prefix.'Month]"';
198 198
         } else {
199
-            $month_result .= '"' . $prefix . 'Month"';
199
+            $month_result .= '"'.$prefix.'Month"';
200 200
         }
201
-        if (null !== $month_size){
202
-            $month_result .= ' size="' . $month_size . '"';
201
+        if (null !== $month_size) {
202
+            $month_result .= ' size="'.$month_size.'"';
203 203
         }
204
-        if (null !== $month_extra){
205
-            $month_result .= ' ' . $month_extra;
204
+        if (null !== $month_extra) {
205
+            $month_result .= ' '.$month_extra;
206 206
         }
207
-        if (null !== $all_extra){
208
-            $month_result .= ' ' . $all_extra;
207
+        if (null !== $all_extra) {
208
+            $month_result .= ' '.$all_extra;
209 209
         }
210
-        $month_result .= $extra_attrs . '>'."\n";
210
+        $month_result .= $extra_attrs.'>'."\n";
211 211
 
212 212
         $month_result .= smarty_function_html_options(array('output'     => $month_names,
213 213
                                                             'values'     => $month_values,
@@ -230,21 +230,21 @@  discard block
 block discarded – undo
230 230
         }
231 231
 
232 232
         $day_result .= '<select name=';
233
-        if (null !== $field_array){
234
-            $day_result .= '"' . $field_array . '[' . $prefix . 'Day]"';
233
+        if (null !== $field_array) {
234
+            $day_result .= '"'.$field_array.'['.$prefix.'Day]"';
235 235
         } else {
236
-            $day_result .= '"' . $prefix . 'Day"';
236
+            $day_result .= '"'.$prefix.'Day"';
237 237
         }
238
-        if (null !== $day_size){
239
-            $day_result .= ' size="' . $day_size . '"';
238
+        if (null !== $day_size) {
239
+            $day_result .= ' size="'.$day_size.'"';
240 240
         }
241
-        if (null !== $all_extra){
242
-            $day_result .= ' ' . $all_extra;
241
+        if (null !== $all_extra) {
242
+            $day_result .= ' '.$all_extra;
243 243
         }
244
-        if (null !== $day_extra){
245
-            $day_result .= ' ' . $day_extra;
244
+        if (null !== $day_extra) {
245
+            $day_result .= ' '.$day_extra;
246 246
         }
247
-        $day_result .= $extra_attrs . '>'."\n";
247
+        $day_result .= $extra_attrs.'>'."\n";
248 248
         $day_result .= smarty_function_html_options(array('output'     => $days,
249 249
                                                           'values'     => $day_values,
250 250
                                                           'selected'   => $time[2],
@@ -255,18 +255,18 @@  discard block
 block discarded – undo
255 255
 
256 256
     if ($display_years) {
257 257
     	$field_separator_count++;
258
-        if (null !== $field_array){
259
-            $year_name = $field_array . '[' . $prefix . 'Year]';
258
+        if (null !== $field_array) {
259
+            $year_name = $field_array.'['.$prefix.'Year]';
260 260
         } else {
261
-            $year_name = $prefix . 'Year';
261
+            $year_name = $prefix.'Year';
262 262
         }
263 263
         if ($year_as_text) {
264
-            $year_result .= '<input type="text" name="' . $year_name . '" value="' . $time[0] . '" size="4" maxlength="4"';
265
-            if (null !== $all_extra){
266
-                $year_result .= ' ' . $all_extra;
264
+            $year_result .= '<input type="text" name="'.$year_name.'" value="'.$time[0].'" size="4" maxlength="4"';
265
+            if (null !== $all_extra) {
266
+                $year_result .= ' '.$all_extra;
267 267
             }
268
-            if (null !== $year_extra){
269
-                $year_result .= ' ' . $year_extra;
268
+            if (null !== $year_extra) {
269
+                $year_result .= ' '.$year_extra;
270 270
             }
271 271
             $year_result .= ' />';
272 272
         } else {
@@ -277,21 +277,21 @@  discard block
 block discarded – undo
277 277
                 sort($years, SORT_NUMERIC);
278 278
             }
279 279
             $yearvals = $years;
280
-            if(isset($year_empty)) {
280
+            if (isset($year_empty)) {
281 281
                 array_unshift($years, $year_empty);
282 282
                 array_unshift($yearvals, '');
283 283
             }
284
-            $year_result .= '<select name="' . $year_name . '"';
285
-            if (null !== $year_size){
286
-                $year_result .= ' size="' . $year_size . '"';
284
+            $year_result .= '<select name="'.$year_name.'"';
285
+            if (null !== $year_size) {
286
+                $year_result .= ' size="'.$year_size.'"';
287 287
             }
288
-            if (null !== $all_extra){
289
-                $year_result .= ' ' . $all_extra;
288
+            if (null !== $all_extra) {
289
+                $year_result .= ' '.$all_extra;
290 290
             }
291
-            if (null !== $year_extra){
292
-                $year_result .= ' ' . $year_extra;
291
+            if (null !== $year_extra) {
292
+                $year_result .= ' '.$year_extra;
293 293
             }
294
-            $year_result .= $extra_attrs . '>'."\n";
294
+            $year_result .= $extra_attrs.'>'."\n";
295 295
             $year_result .= smarty_function_html_options(array('output' => $years,
296 296
                                                                'values' => $yearvals,
297 297
                                                                'selected'   => $time[0],
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
     }
303 303
 
304 304
     // Loop thru the field_order field
305
-    for ($i = 0; $i <= 2; $i++){
305
+    for ($i = 0; $i <= 2; $i++) {
306 306
         $c = substr($field_order, $i, 1);
307
-        switch ($c){
307
+        switch ($c) {
308 308
             case 'D':
309 309
                 $html_result .= $day_result;
310 310
                 break;
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
                 break;
319 319
         }
320 320
         // Add the field seperator
321
-        if($i < $field_separator_count) {
321
+        if ($i < $field_separator_count) {
322 322
             $html_result .= $field_separator;
323 323
         }
324 324
     }
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.capitalize.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,12 +28,12 @@
 block discarded – undo
28 28
 {
29 29
     static $_uc_digits = false;
30 30
     
31
-    if(isset($uc_digits)) {
31
+    if (isset($uc_digits)) {
32 32
         $_uc_digits = $uc_digits;
33 33
         return;
34 34
     }
35 35
     
36
-    if(substr($string[0],0,1) != "'" && !preg_match("!\d!",$string[0]) || $_uc_digits)
36
+    if (substr($string[0], 0, 1) != "'" && !preg_match("!\d!", $string[0]) || $_uc_digits)
37 37
         return ucfirst($string[0]);
38 38
     else
39 39
         return $string[0];
Please login to merge, or discard this patch.
include/Smarty/plugins/function.counter.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
             'count'=>1
33 33
             );
34 34
     }
35
-    $counter =& $counters[$name];
35
+    $counter = & $counters[$name];
36 36
 
37 37
     if (isset($params['start'])) {
38 38
         $counter['start'] = $counter['count'] = (int)$params['start'];
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.truncate.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,12 +33,12 @@
 block discarded – undo
33 33
     if (strlen($string) > $length) {
34 34
         $length -= min($length, strlen($etc));
35 35
         if (!$break_words && !$middle) {
36
-            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
36
+            $string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
37 37
         }
38
-        if(!$middle) {
39
-            return substr($string, 0, $length) . $etc;
38
+        if (!$middle) {
39
+            return substr($string, 0, $length).$etc;
40 40
         } else {
41
-            return substr($string, 0, $length/2) . $etc . substr($string, -$length/2);
41
+            return substr($string, 0, $length / 2).$etc.substr($string, -$length / 2);
42 42
         }
43 43
     } else {
44 44
         return $string;
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_menu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 3
 /*********************************************************************************
4 4
  * SugarCRM Community Edition is a customer relationship management program developed by
5 5
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
     $root_options = array(
95 95
         "id" => array_key_exists('id', $params) ? $params['id'] : ""
96 96
     );
97
-    if(array_key_exists('htmlOptions', $params)) {
98
-        foreach($params['htmlOptions'] as $attr => $value) {
97
+    if (array_key_exists('htmlOptions', $params)) {
98
+        foreach ($params['htmlOptions'] as $attr => $value) {
99 99
             $root_options[$attr] = $value;
100 100
         }
101 101
     }
102 102
     $output = SugarHtml::createOpenTag("ul", $root_options);
103
-    foreach($params['items'] as $item) {
104
-        if(strpos($item['html'], "</") === 0) {
103
+    foreach ($params['items'] as $item) {
104
+        if (strpos($item['html'], "</") === 0) {
105 105
             $output .= $item['html'];
106 106
             continue;
107 107
         }
108 108
         $output .= SugarHtml::createOpenTag('li', !empty($params['itemOptions']) ? $params['itemOptions'] : array())
109 109
             .$item['html'];
110
-        if(isset($item['items']) && count($item['items'])) {
110
+        if (isset($item['items']) && count($item['items'])) {
111 111
             $output .= smarty_function_sugar_menu(array(
112 112
                 'items' => $item['items'],
113 113
                 'htmlOptions' => !empty($params['submenuHtmlOptions']) ? $params['submenuHtmlOptions'] : (!empty($item['submenuHtmlOptions']) ? $item['submenuHtmlOptions'] : array())
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.indent.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
  * @param string
21 21
  * @return string
22 22
  */
23
-function smarty_modifier_indent($string,$chars=4,$char=" ")
23
+function smarty_modifier_indent($string, $chars = 4, $char = " ")
24 24
 {
25
-    return preg_replace('!^!m',str_repeat($char,$chars),$string);
25
+    return preg_replace('!^!m', str_repeat($char, $chars), $string);
26 26
 }
27 27
 
28 28
 ?>
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.cat.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
  */
26 26
 function smarty_modifier_cat($string, $cat)
27 27
 {
28
-    return $string . $cat;
28
+    return $string.$cat;
29 29
 }
30 30
 
31 31
 /* vim: set expandtab: */
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.escape.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
             return rawurlencode($string);
36 36
 
37 37
         case 'urlpathinfo':
38
-            return str_replace('%2F','/',rawurlencode($string));
38
+            return str_replace('%2F', '/', rawurlencode($string));
39 39
             
40 40
         case 'quotes':
41 41
             // escape unescaped single quotes
@@ -44,41 +44,41 @@  discard block
 block discarded – undo
44 44
         case 'hex':
45 45
             // escape every character into hex
46 46
             $return = '';
47
-            for ($x=0; $x < strlen($string); $x++) {
48
-                $return .= '%' . bin2hex($string[$x]);
47
+            for ($x = 0; $x < strlen($string); $x++) {
48
+                $return .= '%'.bin2hex($string[$x]);
49 49
             }
50 50
             return $return;
51 51
             
52 52
         case 'hexentity':
53 53
             $return = '';
54
-            for ($x=0; $x < strlen($string); $x++) {
55
-                $return .= '&#x' . bin2hex($string[$x]) . ';';
54
+            for ($x = 0; $x < strlen($string); $x++) {
55
+                $return .= '&#x'.bin2hex($string[$x]).';';
56 56
             }
57 57
             return $return;
58 58
 
59 59
         case 'decentity':
60 60
             $return = '';
61
-            for ($x=0; $x < strlen($string); $x++) {
62
-                $return .= '&#' . ord($string[$x]) . ';';
61
+            for ($x = 0; $x < strlen($string); $x++) {
62
+                $return .= '&#'.ord($string[$x]).';';
63 63
             }
64 64
             return $return;
65 65
 
66 66
         case 'javascript':
67 67
             // escape quotes and backslashes, newlines, etc.
68
-            return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n','</'=>'<\/'));
68
+            return strtr($string, array('\\'=>'\\\\', "'"=>"\\'", '"'=>'\\"', "\r"=>'\\r', "\n"=>'\\n', '</'=>'<\/'));
69 69
             
70 70
         case 'mail':
71 71
             // safe way to display e-mail address on a web page
72
-            return str_replace(array('@', '.'),array(' [AT] ', ' [DOT] '), $string);
72
+            return str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
73 73
             
74 74
         case 'nonstd':
75 75
            // escape non-standard chars, such as ms document quotes
76 76
            $_res = '';
77
-           for($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
77
+           for ($_i = 0, $_len = strlen($string); $_i < $_len; $_i++) {
78 78
                $_ord = ord(substr($string, $_i, 1));
79 79
                // non-standard char, escape it
80
-               if($_ord >= 126){
81
-                   $_res .= '&#' . $_ord . ';';
80
+               if ($_ord >= 126) {
81
+                   $_res .= '&#'.$_ord.';';
82 82
                }
83 83
                else {
84 84
                    $_res .= substr($string, $_i, 1);
Please login to merge, or discard this patch.
include/Smarty/plugins/function.cycle.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
     $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;
52 52
             
53 53
     if (!in_array('values', array_keys($params))) {
54
-        if(!isset($cycle_vars[$name]['values'])) {
54
+        if (!isset($cycle_vars[$name]['values'])) {
55 55
             $smarty->trigger_error("cycle: missing 'values' parameter");
56 56
             return;
57 57
         }
58 58
     } else {
59
-        if(isset($cycle_vars[$name]['values'])
60
-            && $cycle_vars[$name]['values'] != $params['values'] ) {
59
+        if (isset($cycle_vars[$name]['values'])
60
+            && $cycle_vars[$name]['values'] != $params['values']) {
61 61
             $cycle_vars[$name]['index'] = 0;
62 62
         }
63 63
         $cycle_vars[$name]['values'] = $params['values'];
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         $cycle_vars[$name]['delimiter'] = ',';       
70 70
     }
71 71
     
72
-    if(is_array($cycle_vars[$name]['values'])) {
72
+    if (is_array($cycle_vars[$name]['values'])) {
73 73
         $cycle_array = $cycle_vars[$name]['values'];
74 74
     } else {
75
-        $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);
75
+        $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']);
76 76
     }
77 77
     
78
-    if(!isset($cycle_vars[$name]['index']) || $reset ) {
78
+    if (!isset($cycle_vars[$name]['index']) || $reset) {
79 79
         $cycle_vars[$name]['index'] = 0;
80 80
     }
81 81
     
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
         $smarty->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
85 85
     }
86 86
         
87
-    if($print) {
87
+    if ($print) {
88 88
         $retval = $cycle_array[$cycle_vars[$name]['index']];
89 89
     } else {
90 90
         $retval = null;
91 91
     }
92 92
 
93
-    if($advance) {
94
-        if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
93
+    if ($advance) {
94
+        if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) {
95 95
             $cycle_vars[$name]['index'] = 0;
96 96
         } else {
97 97
             $cycle_vars[$name]['index']++;
Please login to merge, or discard this patch.