Completed
Push — develop ( 0c0e51 )
by Adam
26:01 queued 12:43
created
include/Smarty/plugins/function.sugar_action_menu.php 1 patch
Spacing   +17 added lines, -17 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.
@@ -122,41 +122,41 @@  discard block
 block discarded – undo
122 122
 {
123 123
     global $sugar_config;
124 124
 
125
-    if( !empty($params['params']) ) {
125
+    if (!empty($params['params'])) {
126 126
         $addition_params = $params['params'];
127 127
         unset($params['params']);
128 128
         $params = array_merge_recursive($params, $addition_params);
129 129
     }
130 130
     $flat = isset($params['flat']) ? $params['flat'] : (isset($sugar_config['enable_action_menu']) ? !$sugar_config['enable_action_menu'] : false);
131 131
     //if buttons have not implemented, it returns empty string;
132
-    if(empty($params['buttons']))
132
+    if (empty($params['buttons']))
133 133
         return '';
134 134
 
135
-    if(is_array($params['buttons']) && !$flat) {
135
+    if (is_array($params['buttons']) && !$flat) {
136 136
 
137 137
         $menus = array(
138 138
             'html' => array_shift($params['buttons']),
139 139
             'items' => array()
140 140
         );
141 141
 
142
-        foreach($params['buttons'] as $item) {
143
-            if(is_array($item)) {
142
+        foreach ($params['buttons'] as $item) {
143
+            if (is_array($item)) {
144 144
                 $sub = array();
145 145
                 $sub_first = array_shift($item);
146
-                foreach($item as $subitem) {
146
+                foreach ($item as $subitem) {
147 147
                     $sub[] = array(
148 148
                         'html' => $subitem
149 149
                     );
150 150
                 }
151
-                array_push($menus['items'],array(
151
+                array_push($menus['items'], array(
152 152
                     'html' => $sub_first,
153 153
                     'items' => $sub,
154 154
                     'submenuHtmlOptions' => array(
155 155
                         'class' => 'subnav-sub'
156 156
                     )
157 157
                 ));
158
-            } else if(strlen($item)) {
159
-                array_push($menus['items'],array(
158
+            } else if (strlen($item)) {
159
+                array_push($menus['items'], array(
160 160
                    'html' => $item
161 161
                 ));
162 162
             }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         $action_menu = array(
165 165
             'id' => !empty($params['id']) ? (is_array($params['id']) ? $params['id'][0] : $params['id']) : '',
166 166
             'htmlOptions' => array(
167
-                'class' => !empty($params['class']) && strpos($params['class'], 'clickMenu') !== false  ? $params['class'] : 'clickMenu '. (!empty($params['class']) ? $params['class'] : ''),
167
+                'class' => !empty($params['class']) && strpos($params['class'], 'clickMenu') !== false ? $params['class'] : 'clickMenu '.(!empty($params['class']) ? $params['class'] : ''),
168 168
             ),
169 169
             'itemOptions' => array(
170 170
                 'class' => (count($menus['items']) == 0) ? 'single' : 'sugar_action_button'
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
     }
188 188
 
189 189
     if (is_array($params['buttons'])) {
190
-        return '<div class="action_buttons">' . implode_r(' ', $params['buttons'], true).'<div class="clear"></div></div>';
191
-    } else if(is_array($params)) {
192
-        return '<div class="action_buttons">' . implode_r(' ', $params, true).'<div class="clear"></div></div>';
190
+        return '<div class="action_buttons">'.implode_r(' ', $params['buttons'], true).'<div class="clear"></div></div>';
191
+    } else if (is_array($params)) {
192
+        return '<div class="action_buttons">'.implode_r(' ', $params, true).'<div class="clear"></div></div>';
193 193
     }
194 194
 
195 195
     return $params['buttons'];
@@ -197,11 +197,11 @@  discard block
 block discarded – undo
197 197
 
198 198
 function implode_r($glue, $pieces, $extract_first_item = false) {
199 199
     $result = array_shift($pieces);
200
-    if(is_array($result)) {
200
+    if (is_array($result)) {
201 201
         $result = implode_r($glue, $result);
202 202
     }
203
-    foreach($pieces as $item) {
204
-        if(is_array($item)) {
203
+    foreach ($pieces as $item) {
204
+        if (is_array($item)) {
205 205
             $result .= empty($extract_first_item) ? implode_r($glue, $item) : $glue.$item[0];
206 206
         } else {
207 207
             $result .= $glue.$item;
Please login to merge, or discard this patch.
include/Smarty/plugins/function.math.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -28,30 +28,30 @@  discard block
 block discarded – undo
28 28
     }
29 29
 
30 30
     // strip out backticks, not necessary for math
31
-    $equation = str_replace('`','',$params['equation']);
31
+    $equation = str_replace('`', '', $params['equation']);
32 32
 
33 33
     // make sure parenthesis are balanced
34
-    if (substr_count($equation,"(") != substr_count($equation,")")) {
34
+    if (substr_count($equation, "(") != substr_count($equation, ")")) {
35 35
         $smarty->trigger_error("math: unbalanced parenthesis");
36 36
         return;
37 37
     }
38 38
 
39 39
     // match all vars in equation, make sure all are passed
40
-    preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
41
-    $allowed_funcs = array('int','abs','ceil','cos','exp','floor','log','log10',
42
-                           'max','min','pi','pow','rand','round','sin','sqrt','srand','tan');
40
+    preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!", $equation, $match);
41
+    $allowed_funcs = array('int', 'abs', 'ceil', 'cos', 'exp', 'floor', 'log', 'log10',
42
+                           'max', 'min', 'pi', 'pow', 'rand', 'round', 'sin', 'sqrt', 'srand', 'tan');
43 43
     
44
-    foreach($match[1] as $curr_var) {
44
+    foreach ($match[1] as $curr_var) {
45 45
         if ($curr_var && !in_array($curr_var, array_keys($params)) && !in_array($curr_var, $allowed_funcs)) {
46 46
             $smarty->trigger_error("math: function call $curr_var not allowed");
47 47
             return;
48 48
         }
49 49
     }
50 50
 
51
-    foreach($params as $key => $val) {
51
+    foreach ($params as $key => $val) {
52 52
         if ($key != "equation" && $key != "format" && $key != "assign") {
53 53
             // make sure value is not empty
54
-            if (strlen($val)==0) {
54
+            if (strlen($val) == 0) {
55 55
                 $smarty->trigger_error("math: parameter $key is empty");
56 56
                 return;
57 57
             }
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
         if (empty($params['assign'])) {
70 70
             return $smarty_math_result;
71 71
         } else {
72
-            $smarty->assign($params['assign'],$smarty_math_result);
72
+            $smarty->assign($params['assign'], $smarty_math_result);
73 73
         }
74 74
     } else {
75
-        if (empty($params['assign'])){
76
-            printf($params['format'],$smarty_math_result);
75
+        if (empty($params['assign'])) {
76
+            printf($params['format'], $smarty_math_result);
77 77
         } else {
78
-            $smarty->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
78
+            $smarty->assign($params['assign'], sprintf($params['format'], $smarty_math_result));
79 79
         }
80 80
     }
81 81
 }
Please login to merge, or discard this patch.
include/Smarty/plugins/function.ext_includes.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,15 +43,15 @@
 block discarded – undo
43 43
 
44 44
 function smarty_function_ext_includes($params, &$smarty)
45 45
 {
46
-	$ret = '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/ext-all.css") . '" />'
47
-		 . '<link rel="stylesheet" type="text/css" href="' . getJSPath("themes/default/ext/resources/css/xtheme-gray.css") . '" />';
46
+	$ret = '<link rel="stylesheet" type="text/css" href="'.getJSPath("themes/default/ext/resources/css/ext-all.css").'" />'
47
+		 . '<link rel="stylesheet" type="text/css" href="'.getJSPath("themes/default/ext/resources/css/xtheme-gray.css").'" />';
48 48
 		 
49 49
 	global $theme;
50 50
 	if (is_dir("themes/$theme/ext/resources/css")) {
51 51
 			$cssDir = opendir("themes/$theme/ext/resources/css");
52 52
 			while (($file = readdir($cssDir)) !== false) {
53 53
 				if (strcasecmp(substr($file, -4), '.css' == 0)) {
54
-            		$ret .= "<link rel='stylesheet' type='text/css' href='" . getJSPath("themes/$theme/ext/resources/css/$file") . "' />";
54
+            		$ret .= "<link rel='stylesheet' type='text/css' href='".getJSPath("themes/$theme/ext/resources/css/$file")."' />";
55 55
 				}
56 56
         	}
57 57
 	}
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_field.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -55,33 +55,33 @@  discard block
 block discarded – undo
55 55
 function smarty_function_sugar_field($params, &$smarty)
56 56
 {
57 57
     if (!isset($params['vardef']) || !isset($params['displayType']) || !isset($params['parentFieldArray'])) {
58
-        if(!isset($params['vardef']))
58
+        if (!isset($params['vardef']))
59 59
             $smarty->trigger_error("sugar_field: missing 'vardef' parameter");
60
-        if(!isset($params['displayType']))  
60
+        if (!isset($params['displayType']))  
61 61
             $smarty->trigger_error("sugar_field: missing 'displayType' parameter");
62
-        if(!isset($params['parentFieldArray']))  
62
+        if (!isset($params['parentFieldArray']))  
63 63
             $smarty->trigger_error("sugar_field: missing 'parentFieldArray' parameter");
64 64
                              
65 65
         return;
66 66
     }
67 67
 
68 68
     static $sfh;
69
-    if(!isset($sfh)) $sfh = new SugarFieldHandler();
69
+    if (!isset($sfh)) $sfh = new SugarFieldHandler();
70 70
     
71
-    if(!isset($params['displayParams'])) $displayParams = array();
71
+    if (!isset($params['displayParams'])) $displayParams = array();
72 72
     else $displayParams = $params['displayParams'];
73 73
     
74
-    if(isset($params['labelSpan'])) $displayParams['labelSpan'] = $params['labelSpan'];
74
+    if (isset($params['labelSpan'])) $displayParams['labelSpan'] = $params['labelSpan'];
75 75
     else $displayParams['labelSpan'] = null;
76
-    if(isset($params['fieldSpan'])) $displayParams['fieldSpan'] = $params['fieldSpan'];
76
+    if (isset($params['fieldSpan'])) $displayParams['fieldSpan'] = $params['fieldSpan'];
77 77
     else $displayParams['fieldSpan'] = null;
78 78
 
79
-    if(isset($params['typeOverride'])) { // override the type in the vardef?
79
+    if (isset($params['typeOverride'])) { // override the type in the vardef?
80 80
         $params['vardef']['type'] = $params['typeOverride']; 
81 81
     }
82
-    if(isset($params['formName'])) $displayParams['formName'] = $params['formName'];
82
+    if (isset($params['formName'])) $displayParams['formName'] = $params['formName'];
83 83
     
84
-    if(isset($params['field'])) {
84
+    if (isset($params['field'])) {
85 85
         $params['vardef']['name'] = $params['field'];
86 86
     }
87 87
    
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
         $displayParams['call_back_function'] = $params['call_back_function'];
90 90
     }
91 91
     
92
-    if(isset($params['skipClearButton'])) {
92
+    if (isset($params['skipClearButton'])) {
93 93
         $displayParams['skipClearButton'] = $params['skipClearButton'];
94 94
     }
95 95
     
96
-    if(isset($params['idName'])) {
96
+    if (isset($params['idName'])) {
97 97
         $displayParams['idName'] = $params['idName'];
98 98
     }
99 99
     
100
-    if(isset($params['accesskey'])) {
100
+    if (isset($params['accesskey'])) {
101 101
         $displayParams['accesskey'] = $params['accesskey'];
102 102
     }
103 103
 
Please login to merge, or discard this patch.
include/Smarty/plugins/shared.escape_special_chars.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@
 block discarded – undo
18 18
  */
19 19
 function smarty_function_escape_special_chars($string)
20 20
 {
21
-    if(!is_array($string)) {
21
+    if (!is_array($string)) {
22 22
         $string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
23 23
         $string = htmlspecialchars($string);
24
-        $string = str_replace(array('%%%SMARTY_START%%%','%%%SMARTY_END%%%'), array('&',';'), $string);
24
+        $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
25 25
     }
26 26
     return $string;
27 27
 }
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.date_format.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
         return;
39 39
     }
40 40
     if (DIRECTORY_SEPARATOR == '\\') {
41
-        $_win_from = array('%D',       '%h', '%n', '%r',          '%R',    '%t', '%T');
41
+        $_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
42 42
         $_win_to   = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
43 43
         if (strpos($format, '%e') !== false) {
44 44
             $_win_from[] = '%e';
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_help.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -71,16 +71,16 @@
 block discarded – undo
71 71
  */
72 72
 function smarty_function_sugar_help($params, &$smarty)
73 73
 {
74
-    $text = str_replace("'","\'",htmlspecialchars($params['text']));
74
+    $text = str_replace("'", "\'", htmlspecialchars($params['text']));
75 75
 	//append any additional parameters.
76
-	$click  = "return SUGAR.util.showHelpTips(this,'$text'";
76
+	$click = "return SUGAR.util.showHelpTips(this,'$text'";
77 77
 
78
-	if (count( $params) > 1){
78
+	if (count($params) > 1) {
79 79
 
80
-			$click .=",'".$params['myPos']."','".$params['atPos']."'";
80
+			$click .= ",'".$params['myPos']."','".$params['atPos']."'";
81 81
 	}
82 82
     $helpImage = SugarThemeRegistry::current()->getImageURL('helpInline.png');
83
-	$click .= " );" ;
83
+	$click .= " );";
84 84
     $alt_tag = $GLOBALS['app_strings']['LBL_ALT_INFO'];
85 85
     return <<<EOHTML
86 86
 <img border="0"
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.default_date_value.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@
 block discarded – undo
150 150
 */
151 151
 
152 152
 
153
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
153
+if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
154 154
 /*********************************************************************************
155 155
  * SugarCRM Community Edition is a customer relationship management program developed by
156 156
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_getwebpath.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
  */
46 46
 function smarty_function_sugar_getwebpath($params, &$smarty)
47 47
 {
48
-	if(!isset($params['file'])) {
49
-		   $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'file');
48
+	if (!isset($params['file'])) {
49
+		   $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'file');
50 50
 	} 
51 51
  	return getWebPath($params['file']);
52 52
 }
Please login to merge, or discard this patch.