Completed
Push — develop ( 695bbe )
by Adam
37:32 queued 21:39
created
include/Dashlets/DashletGenericChart.php 3 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
      */
140 140
     public function setRefreshIcon()
141 141
     {
142
-    	$additionalTitle = '';
142
+        $additionalTitle = '';
143 143
         if($this->isRefreshable)
144 144
 
145 145
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
     public function displayScript()
166 166
     {
167 167
 
168
-		require_once('include/SugarCharts/SugarChartFactory.php');
169
-		$sugarChart = SugarChartFactory::getInstance();
170
-		return $sugarChart->getDashletScript($this->id);
168
+        require_once('include/SugarCharts/SugarChartFactory.php');
169
+        $sugarChart = SugarChartFactory::getInstance();
170
+        return $sugarChart->getDashletScript($this->id);
171 171
 
172 172
     }
173 173
 
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
         $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown);
273 273
         
274 274
         if($this->isAutoRefreshable()) {
275
-       		$this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276
-			$this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277
-			$this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278
-			$this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279
-		}
275
+                $this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276
+            $this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277
+            $this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278
+            $this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279
+        }
280 280
 
281 281
         return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
282 282
     }
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             $dashletOffset = 0;
340 340
             $module = $_REQUEST['module'];
341 341
             if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
342
-            	$dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
342
+                $dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
343 343
             }
344 344
         }
345 345
 
Please login to merge, or discard this patch.
Braces   +59 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -121,10 +123,12 @@  discard block
 block discarded – undo
121 123
         // load language files
122 124
         $this->loadLanguage($classname, 'modules/Charts/Dashlets/');
123 125
 
124
-        if ( empty($options['title']) )
125
-            $this->title = $this->dashletStrings['LBL_TITLE'];
126
-        if ( isset($options['autoRefresh']) )
127
-            $this->autoRefresh = $options['autoRefresh'];
126
+        if ( empty($options['title']) ) {
127
+                    $this->title = $this->dashletStrings['LBL_TITLE'];
128
+        }
129
+        if ( isset($options['autoRefresh']) ) {
130
+                    $this->autoRefresh = $options['autoRefresh'];
131
+        }
128 132
 
129 133
         $this->layoutManager = new LayoutManager();
130 134
         $this->layoutManager->setAttribute('context', 'Report');
@@ -140,8 +144,8 @@  discard block
 block discarded – undo
140 144
     public function setRefreshIcon()
141 145
     {
142 146
     	$additionalTitle = '';
143
-        if($this->isRefreshable)
144
-
147
+        if($this->isRefreshable) {
148
+        
145 149
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
146 150
                 . $this->id
147 151
                 . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->'
@@ -154,6 +158,7 @@  discard block
 block discarded – undo
154 158
                     translate('LBL_DASHLET_REFRESH', 'Home')
155 159
                 )
156 160
                 . '</a>';
161
+        }
157 162
         return $additionalTitle;
158 163
     }
159 164
 
@@ -200,25 +205,32 @@  discard block
 block discarded – undo
200 205
 
201 206
         $options = array();
202 207
 
203
-        foreach($req as $name => $value)
204
-            if(!is_array($value)) $req[$name] = trim($value);
208
+        foreach($req as $name => $value) {
209
+                    if(!is_array($value)) $req[$name] = trim($value);
210
+        }
205 211
 
206 212
         foreach($this->_searchFields as $name => $params) {
207 213
             $widgetDef = $params;
208
-            if ( isset($this->getSeedBean()->field_defs[$name]) )
209
-                $widgetDef = $this->getSeedBean()->field_defs[$name];
210
-            if ( $widgetDef['type'] == 'date')           // special case date types
214
+            if ( isset($this->getSeedBean()->field_defs[$name]) ) {
215
+                            $widgetDef = $this->getSeedBean()->field_defs[$name];
216
+            }
217
+            if ( $widgetDef['type'] == 'date') {
218
+                // special case date types
211 219
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
212
-            elseif ( $widgetDef['type'] == 'time')       // special case time types
220
+            } elseif ( $widgetDef['type'] == 'time') {
221
+                // special case time types
213 222
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
214
-            elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
223
+            } elseif ( $widgetDef['type'] == 'datepicker') {
224
+                // special case datepicker types
215 225
                 $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
216
-            elseif (!empty($req[$widgetDef['name']]))
217
-                $options[$widgetDef['name']] = $req[$widgetDef['name']];
226
+            } elseif (!empty($req[$widgetDef['name']])) {
227
+                            $options[$widgetDef['name']] = $req[$widgetDef['name']];
228
+            }
218 229
         }
219 230
 
220
-        if (!empty($req['dashletTitle']))
221
-            $options['title'] = $req['dashletTitle'];
231
+        if (!empty($req['dashletTitle'])) {
232
+                    $options['title'] = $req['dashletTitle'];
233
+        }
222 234
 
223 235
         $options['autoRefresh'] = empty($req['autoRefresh']) ? '0' : $req['autoRefresh'];
224 236
 
@@ -241,19 +253,24 @@  discard block
 block discarded – undo
241 253
                     $currentSearchFields[$name] = array();
242 254
 
243 255
                     $widgetDef = $params;
244
-                    if ( isset($this->getSeedBean()->field_defs[$name]) )
245
-                        $widgetDef = $this->getSeedBean()->field_defs[$name];
256
+                    if ( isset($this->getSeedBean()->field_defs[$name]) ) {
257
+                                            $widgetDef = $this->getSeedBean()->field_defs[$name];
258
+                    }
246 259
 
247
-                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
260
+                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') {
261
+                        $widgetDef['remove_blank'] = true;
262
+                    }
263
+                    // remove the blank option for the dropdown
248 264
 
249
-                    if ( empty($widgetDef['input_name0']) )
250
-                        $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
265
+                    if ( empty($widgetDef['input_name0']) ) {
266
+                                            $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
267
+                    }
251 268
                     $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
252
-                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
253
-                        $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
269
+                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] ) {
270
+                                            $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
271
+                    }
254 272
                     $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
255
-                }
256
-                else { // ability to create spacers in input fields
273
+                } else { // ability to create spacers in input fields
257 274
                     $currentSearchFields['blank' + $count]['label'] = '';
258 275
                     $currentSearchFields['blank' + $count]['input'] = '';
259 276
                     $count++;
@@ -289,8 +306,9 @@  discard block
 block discarded – undo
289 306
      */
290 307
     protected function getSeedBean()
291 308
     {
292
-        if ( !($this->_seedBean instanceof SugarBean) )
293
-            $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
309
+        if ( !($this->_seedBean instanceof SugarBean) ) {
310
+                    $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
311
+        }
294 312
 
295 313
         return $this->_seedBean;
296 314
     }
@@ -412,9 +430,14 @@  discard block
 block discarded – undo
412 430
         }
413 431
 
414 432
         //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank.
415
-        if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank.
433
+        if(isset($sortby1[0]) && $sortby1[0]==array()) {
434
+            unset($sortby1[0]);
435
+        }
436
+        //the beginning of month after search is blank.
416 437
 
417
-        if($ifsort2==false) $sortby2=array(0);
438
+        if($ifsort2==false) {
439
+            $sortby2=array(0);
440
+        }
418 441
 
419 442
         if($keycolname2!=null) {
420 443
             $sortby2 = array();
@@ -438,7 +461,9 @@  discard block
 block discarded – undo
438 461
 
439 462
         foreach($sortby1 as $sort1) {
440 463
             foreach($sortby2 as $sort2) {
441
-                if($ifsort2) $a=0;
464
+                if($ifsort2) {
465
+                    $a=0;
466
+                }
442 467
                 foreach($data_set as $key => $value){
443 468
                     if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) {
444 469
                         if($translate1) {
@@ -461,15 +486,13 @@  discard block
 block discarded – undo
461 486
                     if($translate1) {
462 487
                         $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1];
463 488
                         $val[$keycolname1.'_dom_option'] = $sort1;
464
-                    }
465
-                    else {
489
+                    } else {
466 490
                         $val[$keycolname1] = $sort1;
467 491
                     }
468 492
                     if($translate2) {
469 493
                         $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2];
470 494
                         $val[$keycolname2.'_dom_option'] = $sort2;
471
-                    }
472
-                    elseif($keycolname2!=null) {
495
+                    } elseif($keycolname2!=null) {
473 496
                         $val[$keycolname2] = $sort2;
474 497
                     }
475 498
                     array_push($data, $val);
Please login to merge, or discard this patch.
Spacing   +67 added lines, -67 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.
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @see Dashlet::$isRefreshable
61 61
      */
62
-    public $isRefreshable  = true;
62
+    public $isRefreshable = true;
63 63
 
64 64
     /**
65 65
      * location of smarty template file for configuring
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
     {
106 106
         parent::__construct($id);
107 107
 
108
-        if ( isset($options) ) {
109
-            foreach ( $options as $key => $value ) {
108
+        if (isset($options)) {
109
+            foreach ($options as $key => $value) {
110 110
                 $this->$key = $value;
111 111
             }
112 112
         }
113 113
 
114 114
         // load searchfields
115 115
         $classname = get_class($this);
116
-        if ( is_file("modules/Charts/Dashlets/$classname/$classname.data.php") ) {
116
+        if (is_file("modules/Charts/Dashlets/$classname/$classname.data.php")) {
117 117
             require("modules/Charts/Dashlets/$classname/$classname.data.php");
118 118
             $this->_searchFields = $dashletData[$classname]['searchFields'];
119 119
         }
@@ -121,16 +121,16 @@  discard block
 block discarded – undo
121 121
         // load language files
122 122
         $this->loadLanguage($classname, 'modules/Charts/Dashlets/');
123 123
 
124
-        if ( empty($options['title']) )
124
+        if (empty($options['title']))
125 125
             $this->title = $this->dashletStrings['LBL_TITLE'];
126
-        if ( isset($options['autoRefresh']) )
126
+        if (isset($options['autoRefresh']))
127 127
             $this->autoRefresh = $options['autoRefresh'];
128 128
 
129 129
         $this->layoutManager = new LayoutManager();
130 130
         $this->layoutManager->setAttribute('context', 'Report');
131 131
         // fake a reporter object here just to pass along the db type used in many widgets.
132 132
         // this should be taken out when sugarwidgets change
133
-        $temp = (object) array('db' => &$GLOBALS['db'], 'report_def_str' => '');
133
+        $temp = (object)array('db' => &$GLOBALS['db'], 'report_def_str' => '');
134 134
         $this->layoutManager->setAttributePtr('reporter', $temp);
135 135
     }
136 136
 
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
     public function setRefreshIcon()
141 141
     {
142 142
     	$additionalTitle = '';
143
-        if($this->isRefreshable)
143
+        if ($this->isRefreshable)
144 144
 
145 145
             $additionalTitle .= '<a href="#" onclick="SUGAR.mySugar.retrieveDashlet(\''
146 146
                 . $this->id
147 147
                 . '\',\'predefined_chart\'); return false;"><!--not_in_theme!-->'
148 148
                 . SugarThemeRegistry::current()->getImage(
149 149
                     'dashlet-header-refresh',
150
-                    'border="0" align="absmiddle" title="'. translate('LBL_DASHLET_REFRESH', 'Home') . '"',
150
+                    'border="0" align="absmiddle" title="'.translate('LBL_DASHLET_REFRESH', 'Home').'"',
151 151
                     null,
152 152
                     null,
153 153
                     '.gif',
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     protected function getConfigureSmartyInstance()
179 179
     {
180
-        if ( !($this->_configureSS instanceof Sugar_Smarty) ) {
180
+        if (!($this->_configureSS instanceof Sugar_Smarty)) {
181 181
 
182 182
             $this->_configureSS = new Sugar_Smarty();
183 183
         }
@@ -200,18 +200,18 @@  discard block
 block discarded – undo
200 200
 
201 201
         $options = array();
202 202
 
203
-        foreach($req as $name => $value)
204
-            if(!is_array($value)) $req[$name] = trim($value);
203
+        foreach ($req as $name => $value)
204
+            if (!is_array($value)) $req[$name] = trim($value);
205 205
 
206
-        foreach($this->_searchFields as $name => $params) {
206
+        foreach ($this->_searchFields as $name => $params) {
207 207
             $widgetDef = $params;
208
-            if ( isset($this->getSeedBean()->field_defs[$name]) )
208
+            if (isset($this->getSeedBean()->field_defs[$name]))
209 209
                 $widgetDef = $this->getSeedBean()->field_defs[$name];
210
-            if ( $widgetDef['type'] == 'date')           // special case date types
210
+            if ($widgetDef['type'] == 'date')           // special case date types
211 211
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
212
-            elseif ( $widgetDef['type'] == 'time')       // special case time types
212
+            elseif ($widgetDef['type'] == 'time')       // special case time types
213 213
                 $options[$widgetDef['name']] = $timedate->swap_formats($req['type_'.$widgetDef['name']], $timedate->get_time_format(), $timedate->dbTimeFormat);
214
-            elseif ( $widgetDef['type'] == 'datepicker') // special case datepicker types
214
+            elseif ($widgetDef['type'] == 'datepicker') // special case datepicker types
215 215
                 $options[$widgetDef['name']] = $timedate->swap_formats($req[$widgetDef['name']], $timedate->get_date_format(), $timedate->dbDayFormat);
216 216
             elseif (!empty($req[$widgetDef['name']]))
217 217
                 $options[$widgetDef['name']] = $req[$widgetDef['name']];
@@ -234,36 +234,36 @@  discard block
 block discarded – undo
234 234
     {
235 235
         $currentSearchFields = array();
236 236
 
237
-        if ( is_array($this->_searchFields) ) {
238
-            foreach($this->_searchFields as $name=>$params) {
239
-                if(!empty($name)) {
237
+        if (is_array($this->_searchFields)) {
238
+            foreach ($this->_searchFields as $name=>$params) {
239
+                if (!empty($name)) {
240 240
                     $name = strtolower($name);
241 241
                     $currentSearchFields[$name] = array();
242 242
 
243 243
                     $widgetDef = $params;
244
-                    if ( isset($this->getSeedBean()->field_defs[$name]) )
244
+                    if (isset($this->getSeedBean()->field_defs[$name]))
245 245
                         $widgetDef = $this->getSeedBean()->field_defs[$name];
246 246
 
247
-                    if($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
247
+                    if ($widgetDef['type'] == 'enum' || $widgetDef['type'] == 'singleenum') $widgetDef['remove_blank'] = true; // remove the blank option for the dropdown
248 248
 
249
-                    if ( empty($widgetDef['input_name0']) )
249
+                    if (empty($widgetDef['input_name0']))
250 250
                         $widgetDef['input_name0'] = empty($this->$name) ? '' : $this->$name;
251 251
                     $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], $this->getSeedBean()->module_dir);
252
-                    if ( $currentSearchFields[$name]['label'] == $widgetDef['vname'] )
252
+                    if ($currentSearchFields[$name]['label'] == $widgetDef['vname'])
253 253
                         $currentSearchFields[$name]['label'] = translate($widgetDef['vname'], 'Charts');
254 254
                     $currentSearchFields[$name]['input'] = $this->layoutManager->widgetDisplayInput($widgetDef, true, (empty($this->$name) ? '' : $this->$name));
255 255
                 }
256 256
                 else { // ability to create spacers in input fields
257
-                    $currentSearchFields['blank' + $count]['label'] = '';
258
-                    $currentSearchFields['blank' + $count]['input'] = '';
257
+                    $currentSearchFields['blank' +$count]['label'] = '';
258
+                    $currentSearchFields['blank' +$count]['input'] = '';
259 259
                     $count++;
260 260
                 }
261 261
             }
262 262
         }
263 263
         $this->currentSearchFields = $currentSearchFields;
264
-        $this->getConfigureSmartyInstance()->assign('title',translate('LBL_TITLE','Charts'));
265
-        $this->getConfigureSmartyInstance()->assign('save',$GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
266
-        $this->getConfigureSmartyInstance()->assign('clear',$GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']);
264
+        $this->getConfigureSmartyInstance()->assign('title', translate('LBL_TITLE', 'Charts'));
265
+        $this->getConfigureSmartyInstance()->assign('save', $GLOBALS['app_strings']['LBL_SAVE_BUTTON_LABEL']);
266
+        $this->getConfigureSmartyInstance()->assign('clear', $GLOBALS['app_strings']['LBL_CLEAR_BUTTON_LABEL']);
267 267
         $this->getConfigureSmartyInstance()->assign('id', $this->id);
268 268
         $this->getConfigureSmartyInstance()->assign('searchFields', $this->currentSearchFields);
269 269
         $this->getConfigureSmartyInstance()->assign('dashletTitle', $this->title);
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
         $this->getConfigureSmartyInstance()->assign('module', $_REQUEST['module']);
272 272
         $this->getConfigureSmartyInstance()->assign('showClearButton', $this->isConfigPanelClearShown);
273 273
 
274
-        if($this->isAutoRefreshable()) {
274
+        if ($this->isAutoRefreshable()) {
275 275
        		$this->getConfigureSmartyInstance()->assign('isRefreshable', true);
276 276
 			$this->getConfigureSmartyInstance()->assign('autoRefresh', $GLOBALS['app_strings']['LBL_DASHLET_CONFIGURE_AUTOREFRESH']);
277 277
 			$this->getConfigureSmartyInstance()->assign('autoRefreshOptions', $this->getAutoRefreshOptions());
278 278
 			$this->getConfigureSmartyInstance()->assign('autoRefreshSelect', $this->autoRefresh);
279 279
 		}
280 280
 
281
-        return parent::displayOptions() . $this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
281
+        return parent::displayOptions().$this->getConfigureSmartyInstance()->fetch($this->_configureTpl);
282 282
     }
283 283
 
284 284
     /**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
      */
290 290
     protected function getSeedBean()
291 291
     {
292
-        if ( !($this->_seedBean instanceof SugarBean) )
292
+        if (!($this->_seedBean instanceof SugarBean))
293 293
             $this->_seedBean = SugarModule::get($this->_seedName)->loadBean();
294 294
 
295 295
         return $this->_seedBean;
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
      */
323 323
     public function display()
324 324
     {
325
-        return parent::display() . $this->processAutoRefresh();
325
+        return parent::display().$this->processAutoRefresh();
326 326
     }
327 327
 
328 328
     /**
@@ -335,28 +335,28 @@  discard block
 block discarded – undo
335 335
     {
336 336
         global $sugar_config;
337 337
 
338
-        if ( empty($dashletOffset) ) {
338
+        if (empty($dashletOffset)) {
339 339
             $dashletOffset = 0;
340 340
             $module = $_REQUEST['module'];
341
-            if(isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
341
+            if (isset($_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'])) {
342 342
             	$dashletOffset = $_REQUEST[$module.'2_'.strtoupper($this->getSeedBean()->object_name).'_offset'];
343 343
             }
344 344
         }
345 345
 
346
-        if ( !$this->isRefreshable ) {
346
+        if (!$this->isRefreshable) {
347 347
             return '';
348 348
         }
349
-        if ( !empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1 ) {
349
+        if (!empty($sugar_config['dashlet_auto_refresh_min']) && $sugar_config['dashlet_auto_refresh_min'] == -1) {
350 350
             return '';
351 351
         }
352 352
         $autoRefreshSS = new Sugar_Smarty();
353 353
         $autoRefreshSS->assign('dashletOffset', $dashletOffset);
354 354
         $autoRefreshSS->assign('dashletId', $this->id);
355
-        $autoRefreshSS->assign('strippedDashletId', str_replace("-","",$this->id)); //javascript doesn't like "-" in function names
355
+        $autoRefreshSS->assign('strippedDashletId', str_replace("-", "", $this->id)); //javascript doesn't like "-" in function names
356 356
         $autoRefreshSS->assign('dashletRefreshInterval', $this->getAutoRefresh());
357 357
         $autoRefreshSS->assign('url', "predefined_chart");
358 358
         $tpl = 'include/Dashlets/DashletGenericAutoRefresh.tpl';
359
-        if ( $_REQUEST['action'] == "DynamicAction" ) {
359
+        if ($_REQUEST['action'] == "DynamicAction") {
360 360
             $tpl = 'include/Dashlets/DashletGenericAutoRefreshDynamic.tpl';
361 361
         }
362 362
 
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 
373 373
         $row = $db->fetchByAssoc($result);
374 374
 
375
-        while ($row != null){
375
+        while ($row != null) {
376 376
             $dataSet[] = $row;
377 377
             $row = $db->fetchByAssoc($result);
378 378
         }
@@ -392,19 +392,19 @@  discard block
 block discarded – undo
392 392
     bool $ifsort2                 Whether to sort by the second column or just translate the second column.
393 393
      * @return        The sorted and translated data.
394 394
      */
395
-    function sortData($data_set, $keycolname1=null, $translate1=false, $keycolname2=null, $translate2=false, $ifsort2=false) {
395
+    function sortData($data_set, $keycolname1 = null, $translate1 = false, $keycolname2 = null, $translate2 = false, $ifsort2 = false) {
396 396
         //You can set whether the columns need to be translated or sorted. It the column needn't to be translated, the sorting must be done in SQL, this function will not do the sorting.
397 397
         global $app_list_strings;
398 398
         $sortby1[] = array();
399 399
         foreach ($data_set as $row) {
400
-            $sortby1[]  = $row[$keycolname1];
400
+            $sortby1[] = $row[$keycolname1];
401 401
         }
402 402
         $sortby1 = array_unique($sortby1);
403 403
         //The data is from the database, the sorting should be done in the sql. So I will not do the sort here.
404
-        if($translate1) {
404
+        if ($translate1) {
405 405
             $temp_sortby1 = array();
406
-            foreach(array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) {
407
-                if(in_array($sortby1_value, $sortby1)) {
406
+            foreach (array_keys($app_list_strings[$keycolname1.'_dom']) as $sortby1_value) {
407
+                if (in_array($sortby1_value, $sortby1)) {
408 408
                     $temp_sortby1[] = $sortby1_value;
409 409
                 }
410 410
             }
@@ -412,21 +412,21 @@  discard block
 block discarded – undo
412 412
         }
413 413
 
414 414
         //if(isset($sortby1[0]) && $sortby1[0]=='') unset($sortby1[0]);//the beginning of lead_source_dom is blank.
415
-        if(isset($sortby1[0]) && $sortby1[0]==array()) unset($sortby1[0]);//the beginning of month after search is blank.
415
+        if (isset($sortby1[0]) && $sortby1[0] == array()) unset($sortby1[0]); //the beginning of month after search is blank.
416 416
 
417
-        if($ifsort2==false) $sortby2=array(0);
417
+        if ($ifsort2 == false) $sortby2 = array(0);
418 418
 
419
-        if($keycolname2!=null) {
419
+        if ($keycolname2 != null) {
420 420
             $sortby2 = array();
421 421
             foreach ($data_set as $row) {
422
-                $sortby2[]  = $row[$keycolname2];
422
+                $sortby2[] = $row[$keycolname2];
423 423
             }
424 424
             //The data is from the database, the sorting should be done in the sql. So I will not do the sort here.
425 425
             $sortby2 = array_unique($sortby2);
426
-            if($translate2) {
426
+            if ($translate2) {
427 427
                 $temp_sortby2 = array();
428
-                foreach(array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) {
429
-                    if(in_array($sortby2_value, $sortby2)) {
428
+                foreach (array_keys($app_list_strings[$keycolname2.'_dom']) as $sortby2_value) {
429
+                    if (in_array($sortby2_value, $sortby2)) {
430 430
                         $temp_sortby2[] = $sortby2_value;
431 431
                     }
432 432
                 }
@@ -434,42 +434,42 @@  discard block
 block discarded – undo
434 434
             }
435 435
         }
436 436
 
437
-        $data=array();
437
+        $data = array();
438 438
 
439
-        foreach($sortby1 as $sort1) {
440
-            foreach($sortby2 as $sort2) {
441
-                if($ifsort2) $a=0;
442
-                foreach($data_set as $key => $value){
443
-                    if($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2]== $sort2)) {
444
-                        if($translate1) {
439
+        foreach ($sortby1 as $sort1) {
440
+            foreach ($sortby2 as $sort2) {
441
+                if ($ifsort2) $a = 0;
442
+                foreach ($data_set as $key => $value) {
443
+                    if ($value[$keycolname1] == $sort1 && (!$ifsort2 || $value[$keycolname2] == $sort2)) {
444
+                        if ($translate1) {
445 445
                             $value[$keycolname1.'_dom_option'] = $value[$keycolname1];
446 446
                             $value[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$value[$keycolname1]];
447 447
                         }
448
-                        if($translate2) {
448
+                        if ($translate2) {
449 449
                             $value[$keycolname2.'_dom_option'] = $value[$keycolname2];
450 450
                             $value[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$value[$keycolname2]];
451 451
                         }
452 452
                         array_push($data, $value);
453 453
                         unset($data_set[$key]);
454
-                        $a=1;
454
+                        $a = 1;
455 455
                     }
456 456
                 }
457
-                if($ifsort2 && $a==0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0.
458
-                    $val=array();
457
+                if ($ifsort2 && $a == 0) {//Add 0 for sorting by the second column, if the first row doesn't have a certain col, it will fill the column with 0.
458
+                    $val = array();
459 459
                     $val['total'] = 0;
460 460
                     $val['count'] = 0;
461
-                    if($translate1) {
461
+                    if ($translate1) {
462 462
                         $val[$keycolname1] = $app_list_strings[$keycolname1.'_dom'][$sort1];
463 463
                         $val[$keycolname1.'_dom_option'] = $sort1;
464 464
                     }
465 465
                     else {
466 466
                         $val[$keycolname1] = $sort1;
467 467
                     }
468
-                    if($translate2) {
468
+                    if ($translate2) {
469 469
                         $val[$keycolname2] = $app_list_strings[$keycolname2.'_dom'][$sort2];
470 470
                         $val[$keycolname2.'_dom_option'] = $sort2;
471 471
                     }
472
-                    elseif($keycolname2!=null) {
472
+                    elseif ($keycolname2 != null) {
473 473
                         $val[$keycolname2] = $sort2;
474 474
                     }
475 475
                     array_push($data, $val);
Please login to merge, or discard this patch.
include/Dashlets/DashletCacheBuilder.php 2 patches
Spacing   +7 added lines, -7 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.
@@ -64,28 +64,28 @@  discard block
 block discarded – undo
64 64
         $cacheDir = create_cache_directory('dashlets/');
65 65
         $allDashlets = array_merge($dashletFiles, $dashletFilesCustom);
66 66
         $dashletFiles = array();
67
-        foreach($allDashlets as $num => $file) {
68
-            if(substr_count($file, '.meta') == 0) { // ignore meta data files
67
+        foreach ($allDashlets as $num => $file) {
68
+            if (substr_count($file, '.meta') == 0) { // ignore meta data files
69 69
                 $class = substr($file, strrpos($file, '/') + 1, -4);
70 70
                 $dashletFiles[$class] = array();
71 71
                 $dashletFiles[$class]['file'] = $file;
72 72
                 $dashletFiles[$class]['class'] = $class;
73
-                if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
73
+                if (is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
74 74
                     $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
75 75
                     require($dashletFiles[$class]['meta']);
76
-                    if ( isset($dashletMeta[$class]['module']) )
76
+                    if (isset($dashletMeta[$class]['module']))
77 77
                         $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
78 78
                 }
79 79
                 
80 80
                 $filesInDirectory = array();
81 81
                 getFiles($filesInDirectory, substr($file, 0, strrpos($file, '/')), '/^.*\/Dashlets\/[^\.]*\.icon\.(jpg|jpeg|gif|png)$/i');
82
-                if(!empty($filesInDirectory)) {
82
+                if (!empty($filesInDirectory)) {
83 83
                     $dashletFiles[$class]['icon'] = $filesInDirectory[0]; // take the first icon we see
84 84
                 }
85 85
             }
86 86
         }
87 87
         
88
-        write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir . 'dashlets.php');
88
+        write_array_to_file('dashletsFiles', $dashletFiles, $cacheDir.'dashlets.php');
89 89
     }
90 90
 }
91 91
 ?>
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
2
+if(!defined('sugarEntry') || !sugarEntry) {
3
+    die('Not A Valid Entry Point');
4
+}
3 5
 /*********************************************************************************
4 6
  * SugarCRM Community Edition is a customer relationship management program developed by
5 7
  * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
                 if(is_file(preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file))) { // is there an associated meta data file?
74 76
                     $dashletFiles[$class]['meta'] = preg_replace('/(.*\/.*)(\.php)/Uis', '$1.meta$2', $file);
75 77
                     require($dashletFiles[$class]['meta']);
76
-                    if ( isset($dashletMeta[$class]['module']) )
77
-                        $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
78
+                    if ( isset($dashletMeta[$class]['module']) ) {
79
+                                            $dashletFiles[$class]['module'] = $dashletMeta[$class]['module'];
80
+                    }
78 81
                 }
79 82
                 
80 83
                 $filesInDirectory = array();
Please login to merge, or discard this patch.
include/Dashlets/DashletRssFeedTitle.php 2 patches
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -43,79 +43,79 @@
 block discarded – undo
43 43
  * Created: Sep 12, 2011
44 44
  */
45 45
 class DashletRssFeedTitle {
46
-	public $defaultEncoding = "UTF-8";
47
-	public $readBytes = 8192;
48
-	public $url;
49
-	public $cut = 70;
50
-	public $contents = "";
51
-	public $title = "";
52
-	public $endWith = "...";
53
-	public $xmlEncoding = false;
54
-	public $fileOpen = false;
46
+    public $defaultEncoding = "UTF-8";
47
+    public $readBytes = 8192;
48
+    public $url;
49
+    public $cut = 70;
50
+    public $contents = "";
51
+    public $title = "";
52
+    public $endWith = "...";
53
+    public $xmlEncoding = false;
54
+    public $fileOpen = false;
55 55
 
56
-	public function __construct($url) {
57
-		$this->url = $url;
58
-	}
56
+    public function __construct($url) {
57
+        $this->url = $url;
58
+    }
59 59
 
60
-	public function generateTitle() {
61
-		if ($this->readFeed()) {
62
-			$this->getTitle();
63
-			if (!empty($this->title)) {
64
-				$this->convertEncoding();
65
-				$this->cutLength();
66
-			}
67
-		}
68
-		return $this->title;
69
-	}
60
+    public function generateTitle() {
61
+        if ($this->readFeed()) {
62
+            $this->getTitle();
63
+            if (!empty($this->title)) {
64
+                $this->convertEncoding();
65
+                $this->cutLength();
66
+            }
67
+        }
68
+        return $this->title;
69
+    }
70 70
 
71
-	/**
72
-	 * @todo use curl with waiting timeout instead of fopen
73
-	 */
74
-	public function readFeed() {
75
-		if ($this->url) {
71
+    /**
72
+     * @todo use curl with waiting timeout instead of fopen
73
+     */
74
+    public function readFeed() {
75
+        if ($this->url) {
76 76
                     if (!in_array(strtolower(parse_url($this->url, PHP_URL_SCHEME)), array("http", "https"), true)) {
77 77
                         return false;
78 78
                     }
79
-			$fileOpen = @fopen($this->url, 'r');
80
-			if ($fileOpen) {
81
-				$this->fileOpen = true;
82
-				$this->contents = fread($fileOpen, $this->readBytes);
83
-				fclose($fileOpen);
84
-				return true;
85
-			}
86
-		}
87
-		return false;
88
-	}
79
+            $fileOpen = @fopen($this->url, 'r');
80
+            if ($fileOpen) {
81
+                $this->fileOpen = true;
82
+                $this->contents = fread($fileOpen, $this->readBytes);
83
+                fclose($fileOpen);
84
+                return true;
85
+            }
86
+        }
87
+        return false;
88
+    }
89 89
 
90
-	/**
91
-	 *
92
-	 */
93
-	public function getTitle() {
94
-		$matches = array ();
95
-		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96
-		if (isset($matches[0])) {
97
-			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
98
-		}
99
-	}
90
+    /**
91
+     *
92
+     */
93
+    public function getTitle() {
94
+        $matches = array ();
95
+        preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96
+        if (isset($matches[0])) {
97
+            $this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
98
+        }
99
+    }
100 100
 
101
-	public function cutLength() {
102
-		if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
-			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
104
-		}
105
-	}
101
+    public function cutLength() {
102
+        if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
+            $this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
104
+        }
105
+    }
106 106
 
107
-	private function _identifyXmlEncoding() {
108
-		$matches = array ();
109
-		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110
-		if (isset($matches[0])) {
111
-			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
112
-		}
113
-	}
107
+    private function _identifyXmlEncoding() {
108
+        $matches = array ();
109
+        preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110
+        if (isset($matches[0])) {
111
+            $this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
112
+        }
113
+    }
114 114
 
115
-	public function convertEncoding() {
116
-		$this->_identifyXmlEncoding();
117
-		if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) {
118
-			$this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title);
119
-		}
120
-	}
115
+    public function convertEncoding() {
116
+        $this->_identifyXmlEncoding();
117
+        if ($this->xmlEncoding && $this->xmlEncoding != $this->defaultEncoding) {
118
+            $this->title = iconv($this->xmlEncoding, $this->defaultEncoding, $this->title);
119
+        }
120
+    }
121 121
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 *
92 92
 	 */
93 93
 	public function getTitle() {
94
-		$matches = array ();
94
+		$matches = array();
95 95
 		preg_match("/<title>.*?<\/title>/i", $this->contents, $matches);
96 96
 		if (isset($matches[0])) {
97 97
 			$this->title = str_replace(array('<![CDATA[', '<title>', '</title>', ']]>'), '', $matches[0]);
@@ -100,12 +100,12 @@  discard block
 block discarded – undo
100 100
 
101 101
 	public function cutLength() {
102 102
 		if (mb_strlen(trim($this->title), $this->defaultEncoding) > $this->cut) {
103
-			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding) . $this->endWith;
103
+			$this->title = mb_substr($this->title, 0, $this->cut, $this->defaultEncoding).$this->endWith;
104 104
 		}
105 105
 	}
106 106
 
107 107
 	private function _identifyXmlEncoding() {
108
-		$matches = array ();
108
+		$matches = array();
109 109
 		preg_match('/encoding\=*\".*?\"/', $this->contents, $matches);
110 110
 		if (isset($matches[0])) {
111 111
 			$this->xmlEncoding = trim(str_replace('encoding="', '"', $matches[0]), '"');
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_number_format.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 function smarty_function_sugar_number_format($params, &$smarty) {
38 38
     global $locale;
39 39
     
40
-	if(!isset($params['var']) || $params['var'] === '') {  
40
+    if(!isset($params['var']) || $params['var'] === '') {  
41 41
         return '';
42 42
     } 
43 43
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@
 block discarded – undo
37 37
 function smarty_function_sugar_number_format($params, &$smarty) {
38 38
     global $locale;
39 39
     
40
-	if(!isset($params['var']) || $params['var'] === '') {  
40
+	if (!isset($params['var']) || $params['var'] === '') {  
41 41
         return '';
42 42
     } 
43 43
 
44
-    if ( !isset($params['precision']) ) {
44
+    if (!isset($params['precision'])) {
45 45
         $params['precision'] = $locale->getPrecedentPreference('default_currency_significant_digits');
46 46
     }
47 47
 
Please login to merge, or discard this patch.
include/Smarty/plugins/modifier.wordwrap.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@
 block discarded – undo
21 21
  * @param boolean
22 22
  * @return string
23 23
  */
24
-function smarty_modifier_wordwrap($string,$length=80,$break="\n",$cut=false)
24
+function smarty_modifier_wordwrap($string, $length = 80, $break = "\n", $cut = false)
25 25
 {
26
-    return wordwrap($string,$length,$break,$cut);
26
+    return wordwrap($string, $length, $break, $cut);
27 27
 }
28 28
 
29 29
 ?>
Please login to merge, or discard this patch.
include/Smarty/plugins/function.html_options.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function smarty_function_html_options($params, &$smarty)
31 31
 {
32
-    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
32
+    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
33 33
     
34 34
     $name = null;
35 35
     $values = null;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     
40 40
     $extra = '';
41 41
     
42
-    foreach($params as $_key => $_val) {
43
-        switch($_key) {
42
+    foreach ($params as $_key => $_val) {
43
+        switch ($_key) {
44 44
             case 'name':
45 45
                 $$_key = (string)$_val;
46 46
                 break;
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
                 break;
60 60
                 
61 61
             default:
62
-                if(!is_array($_val)) {
62
+                if (!is_array($_val)) {
63 63
                     $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
64 64
                 } else {
65 65
                     $smarty->trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 
88 88
     }
89 89
 
90
-    if(!empty($name)) {
91
-        $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
90
+    if (!empty($name)) {
91
+        $_html_result = '<select name="'.$name.'"'.$extra.'>'."\n".$_html_result.'</select>'."\n";
92 92
     }
93 93
 
94 94
     return $_html_result;
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 }
97 97
 
98 98
 function smarty_function_html_options_optoutput($key, $value, $selected) {
99
-    if(!is_array($value)) {
100
-        $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
101
-            smarty_function_escape_special_chars($key) . '"';
99
+    if (!is_array($value)) {
100
+        $_html_result = '<option label="'.smarty_function_escape_special_chars($value).'" value="'.
101
+            smarty_function_escape_special_chars($key).'"';
102 102
         if (in_array((string)$key, $selected))
103 103
             $_html_result .= ' selected="selected"';
104
-        $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
104
+        $_html_result .= '>'.smarty_function_escape_special_chars($value).'</option>'."\n";
105 105
     } else {
106 106
         $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
107 107
     }
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 }
110 110
 
111 111
 function smarty_function_html_options_optgroup($key, $values, $selected) {
112
-    $optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
112
+    $optgroup_html = '<optgroup label="'.smarty_function_escape_special_chars($key).'">'."\n";
113 113
     foreach ($values as $key => $value) {
114 114
         $optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected);
115 115
     }
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -68,15 +68,18 @@  discard block
 block discarded – undo
68 68
         }
69 69
     }
70 70
 
71
-    if (!isset($options) && !isset($values))
72
-        return ''; /* raise error here? */
71
+    if (!isset($options) && !isset($values)) {
72
+            return '';
73
+    }
74
+    /* raise error here? */
73 75
 
74 76
     $_html_result = '';
75 77
 
76 78
     if (isset($options)) {
77 79
         
78
-        foreach ($options as $_key=>$_val)
79
-            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
80
+        foreach ($options as $_key=>$_val) {
81
+                    $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
82
+        }
80 83
 
81 84
     } else {
82 85
         
@@ -99,8 +102,9 @@  discard block
 block discarded – undo
99 102
     if(!is_array($value)) {
100 103
         $_html_result = '<option label="' . smarty_function_escape_special_chars($value) . '" value="' .
101 104
             smarty_function_escape_special_chars($key) . '"';
102
-        if (in_array((string)$key, $selected))
103
-            $_html_result .= ' selected="selected"';
105
+        if (in_array((string)$key, $selected)) {
106
+                    $_html_result .= ' selected="selected"';
107
+        }
104 108
         $_html_result .= '>' . smarty_function_escape_special_chars($value) . '</option>' . "\n";
105 109
     } else {
106 110
         $_html_result = smarty_function_html_options_optgroup($key, $value, $selected);
Please login to merge, or discard this patch.
include/Smarty/plugins/block.nocache.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 //implements Smarty 3 style {nocache}{/nocache} block to prevent caching of a section of a template.
3 3
 //remove this upon upgrade to Smarty 3
4 4
 function smarty_block_nocache($param, $content, &$smarty) {
5
-   return $content;
5
+    return $content;
6 6
 } 
7 7
 ?>
8 8
\ No newline at end of file
Please login to merge, or discard this patch.
include/Smarty/plugins/function.html_radios.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
  */
41 41
 function smarty_function_html_radios($params, &$smarty)
42 42
 {
43
-    require_once $smarty->_get_plugin_filepath('shared','escape_special_chars');
43
+    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
44 44
    
45 45
     $name = 'radio';
46 46
     $values = null;
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     $output = null;
53 53
     $extra = '';
54 54
 
55
-    foreach($params as $_key => $_val) {
56
-        switch($_key) {
55
+    foreach ($params as $_key => $_val) {
56
+        switch ($_key) {
57 57
             case 'name':
58 58
             case 'separator':
59 59
                 $$_key = (string)$_val;
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
 
62 62
             case 'checked':
63 63
             case 'selected':
64
-                if(is_array($_val)) {
65
-                    $smarty->trigger_error('html_radios: the "' . $_key . '" attribute cannot be an array', E_USER_WARNING);
64
+                if (is_array($_val)) {
65
+                    $smarty->trigger_error('html_radios: the "'.$_key.'" attribute cannot be an array', E_USER_WARNING);
66 66
                 } else {
67 67
                     $selected = (string)$_val;
68 68
                 }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 break;
92 92
 
93 93
             default:
94
-                if(!is_array($_val)) {
94
+                if (!is_array($_val)) {
95 95
                     $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
96 96
                 } else {
97 97
                     $smarty->trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
@@ -119,10 +119,10 @@  discard block
 block discarded – undo
119 119
 
120 120
     }
121 121
 
122
-    if(!empty($params['assign'])) {
122
+    if (!empty($params['assign'])) {
123 123
         $smarty->assign($params['assign'], $_html_result);
124 124
     } else {
125
-        return implode("\n",$_html_result);
125
+        return implode("\n", $_html_result);
126 126
     }
127 127
 
128 128
 }
@@ -130,25 +130,25 @@  discard block
 block discarded – undo
130 130
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
131 131
     $_output = '';
132 132
     if ($labels) {
133
-      if($label_ids) {
134
-          $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
135
-          $_output .= '<label for="' . $_id . '">';
133
+      if ($label_ids) {
134
+          $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name.'_'.$value));
135
+          $_output .= '<label for="'.$_id.'">';
136 136
       } else {
137 137
           $_output .= '<label>';           
138 138
       }
139 139
    }
140 140
    $_output .= '<input type="radio" name="'
141
-        . smarty_function_escape_special_chars($name) . '" value="'
142
-        . smarty_function_escape_special_chars($value) . '"';
141
+        . smarty_function_escape_special_chars($name).'" value="'
142
+        . smarty_function_escape_special_chars($value).'"';
143 143
 
144
-   if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
144
+   if ($labels && $label_ids) $_output .= ' id="'.$_id.'"';
145 145
 
146
-    if ((string)$value==$selected) {
146
+    if ((string)$value == $selected) {
147 147
         $_output .= ' checked="checked"';
148 148
     }
149
-    $_output .= $extra . ' />' . $output;
149
+    $_output .= $extra.' />'.$output;
150 150
     if ($labels) $_output .= '</label>';
151
-    $_output .=  $separator;
151
+    $_output .= $separator;
152 152
 
153 153
     return $_output;
154 154
 }
Please login to merge, or discard this patch.
Braces   +13 added lines, -6 removed lines patch added patch discarded remove patch
@@ -100,15 +100,18 @@  discard block
 block discarded – undo
100 100
         }
101 101
     }
102 102
 
103
-    if (!isset($options) && !isset($values))
104
-        return ''; /* raise error here? */
103
+    if (!isset($options) && !isset($values)) {
104
+            return '';
105
+    }
106
+    /* raise error here? */
105 107
 
106 108
     $_html_result = array();
107 109
 
108 110
     if (isset($options)) {
109 111
 
110
-        foreach ($options as $_key=>$_val)
111
-            $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
112
+        foreach ($options as $_key=>$_val) {
113
+                    $_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids);
114
+        }
112 115
 
113 116
     } else {
114 117
 
@@ -141,13 +144,17 @@  discard block
 block discarded – undo
141 144
         . smarty_function_escape_special_chars($name) . '" value="'
142 145
         . smarty_function_escape_special_chars($value) . '"';
143 146
 
144
-   if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
147
+   if ($labels && $label_ids) {
148
+       $_output .= ' id="' . $_id . '"';
149
+   }
145 150
 
146 151
     if ((string)$value==$selected) {
147 152
         $_output .= ' checked="checked"';
148 153
     }
149 154
     $_output .= $extra . ' />' . $output;
150
-    if ($labels) $_output .= '</label>';
155
+    if ($labels) {
156
+        $_output .= '</label>';
157
+    }
151 158
     $_output .=  $separator;
152 159
 
153 160
     return $_output;
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -130,18 +130,18 @@
 block discarded – undo
130 130
 function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids) {
131 131
     $_output = '';
132 132
     if ($labels) {
133
-      if($label_ids) {
134
-          $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
135
-          $_output .= '<label for="' . $_id . '">';
136
-      } else {
137
-          $_output .= '<label>';           
138
-      }
139
-   }
140
-   $_output .= '<input type="radio" name="'
133
+        if($label_ids) {
134
+            $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value));
135
+            $_output .= '<label for="' . $_id . '">';
136
+        } else {
137
+            $_output .= '<label>';           
138
+        }
139
+    }
140
+    $_output .= '<input type="radio" name="'
141 141
         . smarty_function_escape_special_chars($name) . '" value="'
142 142
         . smarty_function_escape_special_chars($value) . '"';
143 143
 
144
-   if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
144
+    if ($labels && $label_ids) $_output .= ' id="' . $_id . '"';
145 145
 
146 146
     if ((string)$value==$selected) {
147 147
         $_output .= ' checked="checked"';
Please login to merge, or discard this patch.
include/Smarty/plugins/function.sugar_getimage.php 3 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -53,28 +53,28 @@
 block discarded – undo
53 53
 
54 54
 function smarty_function_sugar_getimage($params, &$smarty) {
55 55
 
56
-	// error checking for required parameters
57
-	if(!isset($params['name'])) 
58
-		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
56
+    // error checking for required parameters
57
+    if(!isset($params['name'])) 
58
+        $smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
59 59
 
60
-	// temp hack to deprecate the use of other_attributes
61
-	if(isset($params['other_attributes']))
62
-		$params['attr'] = $params['other_attributes'];
60
+    // temp hack to deprecate the use of other_attributes
61
+    if(isset($params['other_attributes']))
62
+        $params['attr'] = $params['other_attributes'];
63 63
 
64
-	// set defaults
65
-	if(!isset($params['attr']))
66
-		$params['attr'] = '';
67
-	if(!isset($params['width']))
68
-		$params['width'] = null;
69
-	if(!isset($params['height']))
70
-		$params['height'] = null;
71
-	if(!isset($params['alt'])) 
72
-		$params['alt'] = '';
64
+    // set defaults
65
+    if(!isset($params['attr']))
66
+        $params['attr'] = '';
67
+    if(!isset($params['width']))
68
+        $params['width'] = null;
69
+    if(!isset($params['height']))
70
+        $params['height'] = null;
71
+    if(!isset($params['alt'])) 
72
+        $params['alt'] = '';
73 73
 
74
-	// deprecated ?
75
-	if(!isset($params['ext']))
76
-		$params['ext'] = null;
74
+    // deprecated ?
75
+    if(!isset($params['ext']))
76
+        $params['ext'] = null;
77 77
 
78
-	return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
78
+    return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
79 79
 }
80 80
 ?>
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -54,25 +54,25 @@
 block discarded – undo
54 54
 function smarty_function_sugar_getimage($params, &$smarty) {
55 55
 
56 56
 	// error checking for required parameters
57
-	if(!isset($params['name'])) 
58
-		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
57
+	if (!isset($params['name'])) 
58
+		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'].'name');
59 59
 
60 60
 	// temp hack to deprecate the use of other_attributes
61
-	if(isset($params['other_attributes']))
61
+	if (isset($params['other_attributes']))
62 62
 		$params['attr'] = $params['other_attributes'];
63 63
 
64 64
 	// set defaults
65
-	if(!isset($params['attr']))
65
+	if (!isset($params['attr']))
66 66
 		$params['attr'] = '';
67
-	if(!isset($params['width']))
67
+	if (!isset($params['width']))
68 68
 		$params['width'] = null;
69
-	if(!isset($params['height']))
69
+	if (!isset($params['height']))
70 70
 		$params['height'] = null;
71
-	if(!isset($params['alt'])) 
71
+	if (!isset($params['alt'])) 
72 72
 		$params['alt'] = '';
73 73
 
74 74
 	// deprecated ?
75
-	if(!isset($params['ext']))
75
+	if (!isset($params['ext']))
76 76
 		$params['ext'] = null;
77 77
 
78 78
 	return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -54,26 +54,33 @@
 block discarded – undo
54 54
 function smarty_function_sugar_getimage($params, &$smarty) {
55 55
 
56 56
 	// error checking for required parameters
57
-	if(!isset($params['name'])) 
58
-		$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
57
+	if(!isset($params['name'])) {
58
+			$smarty->trigger_error($GLOBALS['app_strings']['ERR_MISSING_REQUIRED_FIELDS'] . 'name');
59
+	}
59 60
 
60 61
 	// temp hack to deprecate the use of other_attributes
61
-	if(isset($params['other_attributes']))
62
-		$params['attr'] = $params['other_attributes'];
62
+	if(isset($params['other_attributes'])) {
63
+			$params['attr'] = $params['other_attributes'];
64
+	}
63 65
 
64 66
 	// set defaults
65
-	if(!isset($params['attr']))
66
-		$params['attr'] = '';
67
-	if(!isset($params['width']))
68
-		$params['width'] = null;
69
-	if(!isset($params['height']))
70
-		$params['height'] = null;
71
-	if(!isset($params['alt'])) 
72
-		$params['alt'] = '';
67
+	if(!isset($params['attr'])) {
68
+			$params['attr'] = '';
69
+	}
70
+	if(!isset($params['width'])) {
71
+			$params['width'] = null;
72
+	}
73
+	if(!isset($params['height'])) {
74
+			$params['height'] = null;
75
+	}
76
+	if(!isset($params['alt'])) {
77
+			$params['alt'] = '';
78
+	}
73 79
 
74 80
 	// deprecated ?
75
-	if(!isset($params['ext']))
76
-		$params['ext'] = null;
81
+	if(!isset($params['ext'])) {
82
+			$params['ext'] = null;
83
+	}
77 84
 
78 85
 	return SugarThemeRegistry::current()->getImage($params['name'], $params['attr'], $params['width'], $params['height'], $params['ext'], $params['alt']);	
79 86
 }
Please login to merge, or discard this patch.