@@ -43,79 +43,79 @@ |
||
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 | } |
@@ -91,7 +91,7 @@ discard block |
||
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 |
||
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]), '"'); |
@@ -1,5 +1,5 @@ discard block |
||
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. |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | require_once('include/MySugar/MySugar.php'); |
43 | 43 | |
44 | 44 | // build dashlet cache file if not found |
45 | -if(!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) { |
|
45 | +if (!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) { |
|
46 | 46 | require_once('include/Dashlets/DashletCacheBuilder.php'); |
47 | 47 | |
48 | 48 | $dc = new DashletCacheBuilder(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | |
61 | 61 | $hasUserPreferences = (!isset($pages) || empty($pages) || !isset($dashlets) || empty($dashlets)) ? false : true; |
62 | 62 | |
63 | -if(!$hasUserPreferences){ |
|
63 | +if (!$hasUserPreferences) { |
|
64 | 64 | $dashlets = array(); |
65 | 65 | |
66 | 66 | //list of preferences to move over and to where |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $old_columns = $current_user->getPreference('columns', 'home'); |
86 | 86 | $old_dashlets = $current_user->getPreference('dashlets', 'home'); |
87 | 87 | |
88 | - if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)){ |
|
88 | + if (isset($old_columns) && !empty($old_columns) && isset($old_dashlets) && !empty($old_dashlets)) { |
|
89 | 89 | $columns = $old_columns; |
90 | 90 | $dashlets = $old_dashlets; |
91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $current_user->setPreference('columns', $old_columns, 0, 'home'); |
96 | 96 | $current_user->setPreference('dashlets', $old_dashlets, 0, 'home'); |
97 | 97 | } |
98 | - else{ |
|
98 | + else { |
|
99 | 99 | // This is here to get Sugar dashlets added above the rest |
100 | 100 | $dashlets[create_guid()] = array('className' => 'iFrameDashlet', |
101 | 101 | 'module' => 'Home', |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'height' => 315, |
107 | 107 | )); |
108 | 108 | |
109 | - $dashlets[create_guid()] = array ('className' => 'SugarFeedDashlet', |
|
109 | + $dashlets[create_guid()] = array('className' => 'SugarFeedDashlet', |
|
110 | 110 | 'module' => 'SugarFeed', |
111 | 111 | 'forceColumn' => 1, |
112 | 112 | 'fileLocation' => $dashletsFiles['SugarFeedDashlet']['file'], |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | 'height' => 315, |
122 | 122 | )); |
123 | 123 | |
124 | - foreach($defaultDashlets as $dashletName=>$module){ |
|
124 | + foreach ($defaultDashlets as $dashletName=>$module) { |
|
125 | 125 | // clint - fixes bug #20398 |
126 | 126 | // only display dashlets that are from visibile modules and that the user has permission to list |
127 | 127 | $myDashlet = new MySugar($module); |
128 | 128 | $displayDashlet = $myDashlet->checkDashletDisplay(); |
129 | - if (isset($dashletsFiles[$dashletName]) && $displayDashlet){ |
|
129 | + if (isset($dashletsFiles[$dashletName]) && $displayDashlet) { |
|
130 | 130 | $options = array(); |
131 | - $prefsforthisdashlet = array_keys($prefstomove,$dashletName); |
|
132 | - foreach ( $prefsforthisdashlet as $pref ) { |
|
131 | + $prefsforthisdashlet = array_keys($prefstomove, $dashletName); |
|
132 | + foreach ($prefsforthisdashlet as $pref) { |
|
133 | 133 | $options[$pref] = $current_user->getPreference($pref); |
134 | 134 | } |
135 | 135 | $dashlets[create_guid()] = array('className' => $dashletName, |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | $columns[1]['width'] = '40%'; |
150 | 150 | $columns[1]['dashlets'] = array(); |
151 | 151 | |
152 | - foreach($dashlets as $guid=>$dashlet) { |
|
153 | - if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid); |
|
152 | + foreach ($dashlets as $guid=>$dashlet) { |
|
153 | + if ($dashlet['forceColumn'] == 0) array_push($columns[0]['dashlets'], $guid); |
|
154 | 154 | else array_push($columns[1]['dashlets'], $guid); |
155 | 155 | $count++; |
156 | 156 | } |
@@ -165,29 +165,29 @@ discard block |
||
165 | 165 | // handles upgrading from versions that had the 'Dashboard' module; move those items over to the Home page |
166 | 166 | $pagesDashboard = $current_user->getPreference('pages', 'Dashboard'); |
167 | 167 | $dashletsDashboard = $current_user->getPreference('dashlets', 'Dashboard'); |
168 | -if ( !empty($pagesDashboard) ) { |
|
168 | +if (!empty($pagesDashboard)) { |
|
169 | 169 | // move dashlets from the dashboard to be at the end of the home screen dashlets |
170 | - foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn ) { |
|
171 | - foreach ($dashboardColumn['dashlets'] as $dashletItem ) { |
|
170 | + foreach ($pagesDashboard[0]['columns'] as $dashboardColumnKey => $dashboardColumn) { |
|
171 | + foreach ($dashboardColumn['dashlets'] as $dashletItem) { |
|
172 | 172 | $pages[0]['columns'][$dashboardColumnKey]['dashlets'][] = $dashletItem; |
173 | 173 | } |
174 | 174 | } |
175 | - $pages = array_merge($pages,$pagesDashboard); |
|
175 | + $pages = array_merge($pages, $pagesDashboard); |
|
176 | 176 | $current_user->setPreference('pages', $pages, 0, 'Home'); |
177 | 177 | } |
178 | -if ( !empty($dashletsDashboard) ) { |
|
179 | - $dashlets = array_merge($dashlets,$dashletsDashboard); |
|
178 | +if (!empty($dashletsDashboard)) { |
|
179 | + $dashlets = array_merge($dashlets, $dashletsDashboard); |
|
180 | 180 | $current_user->setPreference('dashlets', $dashlets, 0, 'Home'); |
181 | 181 | } |
182 | -if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) |
|
182 | +if (!empty($pagesDashboard) || !empty($dashletsDashboard)) |
|
183 | 183 | $current_user->resetPreferences('Dashboard'); |
184 | 184 | |
185 | -if (empty($pages)){ |
|
185 | +if (empty($pages)) { |
|
186 | 186 | $pages = array(); |
187 | 187 | $pageIndex = 0; |
188 | 188 | $pages[0]['columns'] = $columns; |
189 | 189 | $pages[0]['numColumns'] = '2'; |
190 | - $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar" |
|
190 | + $pages[0]['pageTitleLabel'] = 'LBL_HOME_PAGE_1_NAME'; // "My Sugar" |
|
191 | 191 | $pageIndex++; |
192 | 192 | $current_user->setPreference('pages', $pages, 0, 'Home'); |
193 | 193 | $activePage = 0; |
@@ -206,32 +206,32 @@ discard block |
||
206 | 206 | $dashletIds = array(); // collect ids to pass to javascript |
207 | 207 | $display = array(); |
208 | 208 | |
209 | -foreach($pages[$activePage]['columns'] as $colNum => $column) { |
|
210 | - if ($colNum == $numCols){ |
|
209 | +foreach ($pages[$activePage]['columns'] as $colNum => $column) { |
|
210 | + if ($colNum == $numCols) { |
|
211 | 211 | break; |
212 | 212 | } |
213 | 213 | $display[$colNum]['width'] = $column['width']; |
214 | 214 | $display[$colNum]['dashlets'] = array(); |
215 | - foreach($column['dashlets'] as $num => $id) { |
|
215 | + foreach ($column['dashlets'] as $num => $id) { |
|
216 | 216 | // clint - fixes bug #20398 |
217 | 217 | // only display dashlets that are from visibile modules and that the user has permission to list |
218 | - if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) { |
|
218 | + if (!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) { |
|
219 | 219 | $module = 'Home'; |
220 | - if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) |
|
220 | + if (!empty($dashletsFiles[$dashlets[$id]['className']]['module'])) |
|
221 | 221 | $module = $dashletsFiles[$dashlets[$id]['className']]['module']; |
222 | 222 | // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case |
223 | 223 | // of the Report Chart dashlets. |
224 | - elseif ( !empty($dashlets[$id]['module']) ) |
|
224 | + elseif (!empty($dashlets[$id]['module'])) |
|
225 | 225 | $module = $dashlets[$id]['module']; |
226 | 226 | |
227 | 227 | $myDashlet = new MySugar($module); |
228 | 228 | |
229 | - if($myDashlet->checkDashletDisplay()) { |
|
229 | + if ($myDashlet->checkDashletDisplay()) { |
|
230 | 230 | require_once($dashlets[$id]['fileLocation']); |
231 | 231 | $dashlet = new $dashlets[$id]['className']($id, (isset($dashlets[$id]['options']) ? $dashlets[$id]['options'] : array())); |
232 | 232 | // Need to add support to dynamically display/hide dashlets |
233 | 233 | // If it has a method 'shouldDisplay' we will call it to see if we should display it or not |
234 | - if (method_exists($dashlet,'shouldDisplay')) { |
|
234 | + if (method_exists($dashlet, 'shouldDisplay')) { |
|
235 | 235 | if (!$dashlet->shouldDisplay()) { |
236 | 236 | // This dashlet doesn't want us to show it, skip it. |
237 | 237 | continue; |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | $dashlets = $current_user->getPreference('dashlets', 'Home'); // Using hardcoded 'Home' because DynamicAction.php $_REQUEST['module'] value is always Home |
244 | 244 | $lvsParams = array(); |
245 | - if(!empty($dashlets[$id]['sort_options'])){ |
|
245 | + if (!empty($dashlets[$id]['sort_options'])) { |
|
246 | 246 | $lvsParams = $dashlets[$id]['sort_options']; |
247 | 247 | } |
248 | 248 | |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | $display[$colNum]['dashlets'][$id]['display'] = $dashlet->display(); |
252 | 252 | $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader(); |
253 | 253 | $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter(); |
254 | - if($dashlet->hasScript) { |
|
254 | + if ($dashlet->hasScript) { |
|
255 | 255 | $display[$colNum]['dashlets'][$id]['script'] = $dashlet->displayScript(); |
256 | 256 | } |
257 | - } catch (Exception $ex) { |
|
257 | + }catch (Exception $ex) { |
|
258 | 258 | $display[$colNum]['dashlets'][$id]['display'] = $ex->getMessage(); |
259 | 259 | $display[$colNum]['dashlets'][$id]['displayHeader'] = $dashlet->getHeader(); |
260 | 260 | $display[$colNum]['dashlets'][$id]['displayFooter'] = $dashlet->getFooter(); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | $_SESSION['current_tab'] = $activePage; |
268 | 268 | |
269 | 269 | |
270 | -if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true); |
|
270 | +if (!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true); |
|
271 | 271 | |
272 | 272 | |
273 | 273 | $sugar_smarty->assign('sugarVersion', $sugar_version); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | $sugar_smarty->assign('maxCount', empty($sugar_config['max_dashlets_homepage']) ? 15 : $sugar_config['max_dashlets_homepage']); |
279 | 279 | $sugar_smarty->assign('dashletCount', $count); |
280 | -$sugar_smarty->assign('dashletIds', '["' . implode('","', $dashletIds) . '"]'); |
|
280 | +$sugar_smarty->assign('dashletIds', '["'.implode('","', $dashletIds).'"]'); |
|
281 | 281 | $sugar_smarty->assign('columns', $display); |
282 | 282 | |
283 | 283 | global $theme; |
@@ -1,5 +1,7 @@ discard block |
||
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. |
@@ -94,8 +96,7 @@ discard block |
||
94 | 96 | $old_dashlets = array(); |
95 | 97 | $current_user->setPreference('columns', $old_columns, 0, 'home'); |
96 | 98 | $current_user->setPreference('dashlets', $old_dashlets, 0, 'home'); |
97 | - } |
|
98 | - else{ |
|
99 | + } else{ |
|
99 | 100 | // This is here to get Sugar dashlets added above the rest |
100 | 101 | $dashlets[create_guid()] = array('className' => 'iFrameDashlet', |
101 | 102 | 'module' => 'Home', |
@@ -150,8 +151,11 @@ discard block |
||
150 | 151 | $columns[1]['dashlets'] = array(); |
151 | 152 | |
152 | 153 | foreach($dashlets as $guid=>$dashlet) { |
153 | - if( $dashlet['forceColumn'] == 0 ) array_push($columns[0]['dashlets'], $guid); |
|
154 | - else array_push($columns[1]['dashlets'], $guid); |
|
154 | + if( $dashlet['forceColumn'] == 0 ) { |
|
155 | + array_push($columns[0]['dashlets'], $guid); |
|
156 | + } else { |
|
157 | + array_push($columns[1]['dashlets'], $guid); |
|
158 | + } |
|
155 | 159 | $count++; |
156 | 160 | } |
157 | 161 | } |
@@ -179,8 +183,9 @@ discard block |
||
179 | 183 | $dashlets = array_merge($dashlets,$dashletsDashboard); |
180 | 184 | $current_user->setPreference('dashlets', $dashlets, 0, 'Home'); |
181 | 185 | } |
182 | -if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) |
|
186 | +if ( !empty($pagesDashboard) || !empty($dashletsDashboard) ) { |
|
183 | 187 | $current_user->resetPreferences('Dashboard'); |
188 | +} |
|
184 | 189 | |
185 | 190 | if (empty($pages)){ |
186 | 191 | $pages = array(); |
@@ -217,12 +222,14 @@ discard block |
||
217 | 222 | // only display dashlets that are from visibile modules and that the user has permission to list |
218 | 223 | if(!empty($id) && isset($dashlets[$id]) && is_file($dashlets[$id]['fileLocation'])) { |
219 | 224 | $module = 'Home'; |
220 | - if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) |
|
221 | - $module = $dashletsFiles[$dashlets[$id]['className']]['module']; |
|
225 | + if ( !empty($dashletsFiles[$dashlets[$id]['className']]['module']) ) { |
|
226 | + $module = $dashletsFiles[$dashlets[$id]['className']]['module']; |
|
227 | + } |
|
222 | 228 | // Bug 24772 - Look into the user preference for the module the dashlet is a part of in case |
223 | 229 | // of the Report Chart dashlets. |
224 | - elseif ( !empty($dashlets[$id]['module']) ) |
|
225 | - $module = $dashlets[$id]['module']; |
|
230 | + elseif ( !empty($dashlets[$id]['module']) ) { |
|
231 | + $module = $dashlets[$id]['module']; |
|
232 | + } |
|
226 | 233 | |
227 | 234 | $myDashlet = new MySugar($module); |
228 | 235 | |
@@ -267,7 +274,9 @@ discard block |
||
267 | 274 | $_SESSION['current_tab'] = $activePage; |
268 | 275 | |
269 | 276 | |
270 | -if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) $sugar_smarty->assign('lock_homepage', true); |
|
277 | +if(!empty($sugar_config['lock_homepage']) && $sugar_config['lock_homepage'] == true) { |
|
278 | + $sugar_smarty->assign('lock_homepage', true); |
|
279 | +} |
|
271 | 280 | |
272 | 281 | |
273 | 282 | $sugar_smarty->assign('sugarVersion', $sugar_version); |
@@ -37,7 +37,7 @@ |
||
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 |
@@ -37,11 +37,11 @@ |
||
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 |
@@ -21,9 +21,9 @@ |
||
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 | ?> |
@@ -29,7 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -68,15 +68,18 @@ discard block |
||
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 |
||
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); |
@@ -2,6 +2,6 @@ |
||
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 |
@@ -40,7 +40,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -100,15 +100,18 @@ discard block |
||
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 |
||
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; |
@@ -130,18 +130,18 @@ |
||
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"'; |
@@ -53,28 +53,28 @@ |
||
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 | ?> |
@@ -54,25 +54,25 @@ |
||
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']); |
@@ -54,26 +54,33 @@ |
||
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 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | { |
29 | 29 | if ($smarty->debugging) { |
30 | 30 | $_params = array(); |
31 | - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); |
|
31 | + require_once(SMARTY_CORE_DIR.'core.get_microtime.php'); |
|
32 | 32 | $_debug_start_time = smarty_core_get_microtime($_params, $smarty); |
33 | 33 | } |
34 | 34 | |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | 'resource_base_path' => $smarty->config_dir, |
60 | 60 | 'get_source' => false); |
61 | 61 | $smarty->_parse_resource_name($_params); |
62 | - $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
|
62 | + $_file_path = $_params['resource_type'].':'.$_params['resource_name']; |
|
63 | 63 | if (isset($_section)) |
64 | 64 | $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
65 | 65 | else |
66 | 66 | $_compile_file = $smarty->_get_compile_path($_file_path); |
67 | 67 | |
68 | - if($smarty->force_compile || !file_exists($_compile_file)) { |
|
68 | + if ($smarty->force_compile || !file_exists($_compile_file)) { |
|
69 | 69 | $_compile = true; |
70 | 70 | } elseif ($smarty->compile_check) { |
71 | 71 | $_params = array('resource_name' => $_file, |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $_compile = false; |
78 | 78 | } |
79 | 79 | |
80 | - if($_compile) { |
|
80 | + if ($_compile) { |
|
81 | 81 | // compile config file |
82 | - if(!is_object($smarty->_conf_obj)) { |
|
83 | - require_once SMARTY_DIR . $smarty->config_class . '.class.php'; |
|
82 | + if (!is_object($smarty->_conf_obj)) { |
|
83 | + require_once SMARTY_DIR.$smarty->config_class.'.class.php'; |
|
84 | 84 | $smarty->_conf_obj = new $smarty->config_class(); |
85 | 85 | $smarty->_conf_obj->overwrite = $smarty->config_overwrite; |
86 | 86 | $smarty->_conf_obj->booleanize = $smarty->config_booleanize; |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | $smarty->_conf_obj->set_file_contents($_file, $_params['source_content']); |
98 | 98 | $_config_vars = array_merge($smarty->_conf_obj->get($_file), |
99 | 99 | $smarty->_conf_obj->get($_file, $_section)); |
100 | - if(function_exists('var_export')) { |
|
101 | - $_output = '<?php $_config_vars = ' . var_export($_config_vars, true) . '; ?>'; |
|
100 | + if (function_exists('var_export')) { |
|
101 | + $_output = '<?php $_config_vars = '.var_export($_config_vars, true).'; ?>'; |
|
102 | 102 | } else { |
103 | - $_output = '<?php $_config_vars = unserialize(\'' . strtr(serialize($_config_vars),array('\''=>'\\\'', '\\'=>'\\\\')) . '\'); ?>'; |
|
103 | + $_output = '<?php $_config_vars = unserialize(\''.strtr(serialize($_config_vars), array('\''=>'\\\'', '\\'=>'\\\\')).'\'); ?>'; |
|
104 | 104 | } |
105 | 105 | $_params = (array('compile_path' => $_compile_file, 'compiled_content' => $_output, 'resource_timestamp' => $_params['resource_timestamp'])); |
106 | - require_once(SMARTY_CORE_DIR . 'core.write_compiled_resource.php'); |
|
106 | + require_once(SMARTY_CORE_DIR.'core.write_compiled_resource.php'); |
|
107 | 107 | smarty_core_write_compiled_resource($_params, $smarty); |
108 | 108 | } else { |
109 | 109 | include($_compile_file); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | if ($smarty->debugging) { |
130 | 130 | $_params = array(); |
131 | - require_once(SMARTY_CORE_DIR . 'core.get_microtime.php'); |
|
131 | + require_once(SMARTY_CORE_DIR.'core.get_microtime.php'); |
|
132 | 132 | $smarty->_smarty_debug_info[] = array('type' => 'config', |
133 | 133 | 'filename' => $_file.' ['.$_section.'] '.$_scope, |
134 | 134 | 'depth' => $smarty->_inclusion_depth, |
@@ -60,10 +60,11 @@ |
||
60 | 60 | 'get_source' => false); |
61 | 61 | $smarty->_parse_resource_name($_params); |
62 | 62 | $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
63 | - if (isset($_section)) |
|
64 | - $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
|
65 | - else |
|
66 | - $_compile_file = $smarty->_get_compile_path($_file_path); |
|
63 | + if (isset($_section)) { |
|
64 | + $_compile_file = $smarty->_get_compile_path($_file_path.'|'.$_section); |
|
65 | + } else { |
|
66 | + $_compile_file = $smarty->_get_compile_path($_file_path); |
|
67 | + } |
|
67 | 68 | |
68 | 69 | if($smarty->force_compile || !file_exists($_compile_file)) { |
69 | 70 | $_compile = true; |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | $_params = array('resource_name' => $_file, |
59 | - 'resource_base_path' => $smarty->config_dir, |
|
60 | - 'get_source' => false); |
|
59 | + 'resource_base_path' => $smarty->config_dir, |
|
60 | + 'get_source' => false); |
|
61 | 61 | $smarty->_parse_resource_name($_params); |
62 | 62 | $_file_path = $_params['resource_type'] . ':' . $_params['resource_name']; |
63 | 63 | if (isset($_section)) |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | $_compile = true; |
70 | 70 | } elseif ($smarty->compile_check) { |
71 | 71 | $_params = array('resource_name' => $_file, |
72 | - 'resource_base_path' => $smarty->config_dir, |
|
73 | - 'get_source' => false); |
|
72 | + 'resource_base_path' => $smarty->config_dir, |
|
73 | + 'get_source' => false); |
|
74 | 74 | $_compile = $smarty->_fetch_resource_info($_params) && |
75 | 75 | $_params['resource_timestamp'] > filemtime($_compile_file); |
76 | 76 | } else { |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | $_params = array('resource_name' => $_file, |
92 | - 'resource_base_path' => $smarty->config_dir, |
|
93 | - $_params['get_source'] = true); |
|
92 | + 'resource_base_path' => $smarty->config_dir, |
|
93 | + $_params['get_source'] = true); |
|
94 | 94 | if (!$smarty->_fetch_resource_info($_params)) { |
95 | 95 | return; |
96 | 96 | } |