@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | 'START_NAME' => $planetrow['name'], |
28 | 28 | ); |
29 | 29 | |
30 | - if(!empty($TargetPlanet)) { |
|
30 | + if (!empty($TargetPlanet)) { |
|
31 | 31 | $template_route += array( |
32 | 32 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
33 | 33 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | $template->assign_block_vars('fleets', $template_route); |
39 | 39 | |
40 | 40 | $sn_groups_fleet = sn_get_groups('fleet'); |
41 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
42 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
41 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
42 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
43 | 43 | // $ship_base_data = get_ship_data($ship_id, $user); |
44 | 44 | $template->assign_block_vars('fleets.ships', array( |
45 | 45 | 'ID' => $ship_id, |
@@ -57,11 +57,10 @@ discard block |
||
57 | 57 | $fleet_capacity += get_unit_param($Ship, P_CAPACITY) * $Count; |
58 | 58 | } |
59 | 59 | |
60 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
61 | - (isset($missiontype[MT_HOLD]) ? 12 : 0); |
|
62 | - if($max_duration) { |
|
60 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : (isset($missiontype[MT_HOLD]) ? 12 : 0); |
|
61 | + if ($max_duration) { |
|
63 | 62 | $config_game_speed_expedition = ($target_mission == MT_EXPLORE && $config->game_speed_expedition ? $config->game_speed_expedition : 1); |
64 | - for($i = 1; $i <= $max_duration; $i++) { |
|
63 | + for ($i = 1; $i <= $max_duration; $i++) { |
|
65 | 64 | $template->assign_block_vars('duration', array( |
66 | 65 | 'ID' => $i, |
67 | 66 | 'TIME' => pretty_time(ceil($i * 3600 / $config_game_speed_expedition)), |
@@ -80,7 +79,7 @@ discard block |
||
80 | 79 | // $TableTitle = uni_render_planet_full($planetrow) . ' => ' . uni_render_planet_full($temp); |
81 | 80 | |
82 | 81 | $sn_group_resources = sn_get_groups('resources'); |
83 | - for($i = 0; $i<3; $i++) { |
|
82 | + for ($i = 0; $i < 3; $i++) { |
|
84 | 83 | $amount = $planetrow[$sn_group_resources[$i]] - ($i == 2 ? $consumption : 0); |
85 | 84 | $template->assign_block_vars('resources', array( |
86 | 85 | 'ID' => $i, |
@@ -90,7 +89,7 @@ discard block |
||
90 | 89 | )); |
91 | 90 | } |
92 | 91 | |
93 | - if(is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
92 | + if (is_object($captainModule = moduleCaptain()) && ($captain = $captainModule->unit_captain_get($planetrow['id'])) && $captain['unit_location_type'] == LOC_PLANET) { |
|
94 | 93 | $template->assign_vars(array( |
95 | 94 | 'CAPTAIN_ID' => $captain['unit_id'], |
96 | 95 | 'CAPTAIN_LEVEL' => $captain['captain_level'], |
@@ -112,9 +111,9 @@ discard block |
||
112 | 111 | |
113 | 112 | |
114 | 113 | 'speedallsmin' => sys_get_param_float('speedallsmin'), |
115 | - 'speed' => sys_get_param_int('speed') , |
|
114 | + 'speed' => sys_get_param_int('speed'), |
|
116 | 115 | |
117 | - 'fleet_group' => sys_get_param_id('fleet_group') , |
|
116 | + 'fleet_group' => sys_get_param_id('fleet_group'), |
|
118 | 117 | 'acs_target_mr' => sys_get_param_str('acs_target_mr'), |
119 | 118 | |
120 | 119 | 'MAX_DURATION' => $max_duration, |
@@ -68,8 +68,7 @@ |
||
68 | 68 | $galaxy = isset($vector[$prefix . 'galaxy']) ? intval($vector[$prefix . 'galaxy']) : 0; |
69 | 69 | $system = isset($vector[$prefix . 'system']) ? intval($vector[$prefix . 'system']) : 0; |
70 | 70 | $planet = isset($vector[$prefix . 'planet']) ? intval($vector[$prefix . 'planet']) : 0; |
71 | - $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : |
|
72 | - (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
71 | + $planet_type = isset($vector[$prefix . 'planet_type']) ? intval($vector[$prefix . 'planet_type']) : (isset($vector[$prefix . 'type']) ? intval($vector[$prefix . 'type']) : 0); |
|
73 | 72 | $planet_type = $planet_type == PT_DEBRIS ? PT_PLANET : $planet_type; |
74 | 73 | |
75 | 74 | return DBStaticPlanet::db_planet_by_gspt_safe($galaxy, $system, $planet, $planet_type, $for_update, $fields); |
@@ -8,8 +8,8 @@ |
||
8 | 8 | const MOON_MIN_SIZE = 1100; |
9 | 9 | const MOON_MAX_SIZE = 8999; |
10 | 10 | |
11 | - const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon |
|
12 | - const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon |
|
11 | + const MOON_DEBRIS_MIN = 1000000; // Minimum amount of debris to span a moon |
|
12 | + const MOON_CHANCE_MIN_PERCENT = 1; // Minimum chance to span a moon |
|
13 | 13 | const MOON_CHANCE_MAX_PERCENT = 30; // Maximum chance to span a moon |
14 | 14 | |
15 | 15 | /** |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use DBAL\OldDbChangeSet; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
6 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) { |
|
7 | 7 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | 'rpg_cost' => $rpg_cost, |
16 | 16 | )); |
17 | 17 | |
18 | -if(is_array($shipList)) { |
|
19 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
18 | +if (is_array($shipList)) { |
|
19 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) { |
|
20 | 20 | $intError = MARKET_NO_DM; |
21 | 21 | } |
22 | 22 | |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | $qry = array(); |
34 | 34 | $total = array(); |
35 | 35 | $db_changeset = array(); |
36 | - foreach($shipList as $shipID => &$shipCount) { |
|
36 | + foreach ($shipList as $shipID => &$shipCount) { |
|
37 | 37 | $shipCount = ceil(floatval($shipCount)); |
38 | - if(!$shipCount) { |
|
38 | + if (!$shipCount) { |
|
39 | 39 | continue; |
40 | 40 | } |
41 | 41 | |
42 | - if($shipCount < 0) { |
|
42 | + if ($shipCount < 0) { |
|
43 | 43 | $debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307); |
44 | 44 | $intError = MARKET_NEGATIVE_SHIPS; |
45 | 45 | break; |
46 | 46 | } |
47 | 47 | |
48 | - if($mode == MARKET_SCRAPPER) { |
|
48 | + if ($mode == MARKET_SCRAPPER) { |
|
49 | 49 | $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
50 | - } elseif($mode == MARKET_STOCKMAN) { |
|
50 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
51 | 51 | $amount = $stock[$shipID]; |
52 | 52 | } |
53 | 53 | |
54 | - if($amount < $shipCount) { |
|
54 | + if ($amount < $shipCount) { |
|
55 | 55 | $intError = $error_no_stock; |
56 | 56 | break; |
57 | 57 | } |
58 | 58 | |
59 | - if(!in_array($shipID, sn_get_groups('fleet'))) { |
|
59 | + if (!in_array($shipID, sn_get_groups('fleet'))) { |
|
60 | 60 | $debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306); |
61 | 61 | $intError = MARKET_NOT_A_SHIP; |
62 | 62 | break; |
@@ -72,16 +72,16 @@ discard block |
||
72 | 72 | $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier)); |
73 | 73 | $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier)); |
74 | 74 | |
75 | - foreach($resTemp as $resID => $resCount) { |
|
75 | + foreach ($resTemp as $resID => $resCount) { |
|
76 | 76 | $total[$resID] += $resCount; |
77 | 77 | } |
78 | 78 | |
79 | 79 | $message .= "<li>{$lang['tech'][$shipID]}: " . HelperString::numberFloorAndFormat($shipCount); |
80 | 80 | } |
81 | 81 | |
82 | - if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
83 | - foreach($total as $resID => $resCount) { |
|
84 | - if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
82 | + if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) { |
|
83 | + foreach ($total as $resID => $resCount) { |
|
84 | + if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) { |
|
85 | 85 | $intError = MARKET_NO_RESOURCES; |
86 | 86 | $debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301); |
87 | 87 | break; |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | |
92 | 92 | $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError; |
93 | 93 | |
94 | - if($intError == MARKET_DEAL) { |
|
94 | + if ($intError == MARKET_DEAL) { |
|
95 | 95 | $message .= '</ul>' . $lang["eco_mrk_{$submode}_res"] . '<ul>'; |
96 | - foreach($total as $resID => $resCount) { |
|
97 | - if(!$resCount) { |
|
96 | + foreach ($total as $resID => $resCount) { |
|
97 | + if (!$resCount) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | |
@@ -128,38 +128,38 @@ discard block |
||
128 | 128 | 'MESSAGE' => $lang['eco_mrk_errors'][$intError], |
129 | 129 | )); |
130 | 130 | |
131 | - foreach($shipList as $shipID => $shipCount) { |
|
131 | + foreach ($shipList as $shipID => $shipCount) { |
|
132 | 132 | $data['ships'][$shipID] = max(0, intval($shipCount)); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | } |
136 | 136 | $message = ''; |
137 | 137 | |
138 | -if(!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
139 | - $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, sn_get_groups('fleet')))); |
|
138 | +if (!$config->eco_stockman_fleet && $config->eco_stockman_fleet_populate) { |
|
139 | + $config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, sn_get_groups('fleet')))); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | tpl_set_resource_info($template, $planetrow, array()); |
143 | 143 | |
144 | -if(!$array) { |
|
144 | +if (!$array) { |
|
145 | 145 | $array = array(); |
146 | 146 | } |
147 | 147 | |
148 | 148 | $group_fleet = sn_get_groups('fleet'); |
149 | -foreach($array as $key => $value) { |
|
150 | - if($mode == MARKET_SCRAPPER) { |
|
149 | +foreach ($array as $key => $value) { |
|
150 | + if ($mode == MARKET_SCRAPPER) { |
|
151 | 151 | $shipID = $value; |
152 | 152 | $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)]; |
153 | - } elseif($mode == MARKET_STOCKMAN) { |
|
153 | + } elseif ($mode == MARKET_STOCKMAN) { |
|
154 | 154 | $shipID = $key; |
155 | 155 | $amount = $value; |
156 | 156 | } |
157 | 157 | |
158 | - if(!in_array($shipID, $group_fleet)) { |
|
158 | + if (!in_array($shipID, $group_fleet)) { |
|
159 | 159 | continue; |
160 | 160 | } |
161 | 161 | |
162 | - if($amount > 0) { |
|
162 | + if ($amount > 0) { |
|
163 | 163 | $build_data = eco_get_build_data($user, $planetrow, $shipID); |
164 | 164 | $template->assign_block_vars('ships', array( |
165 | 165 | 'ID' => $shipID, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
22 | - if(!empty($paramList)) { |
|
22 | + if (!empty($paramList)) { |
|
23 | 23 | $strParams = implode('&', $paramList); |
24 | 24 | } |
25 | 25 |
@@ -32,8 +32,7 @@ |
||
32 | 32 | * @author Fabien Potencier |
33 | 33 | * @author Dominik Zogg |
34 | 34 | */ |
35 | -interface ServiceProviderInterface |
|
36 | -{ |
|
35 | +interface ServiceProviderInterface { |
|
37 | 36 | /** |
38 | 37 | * Registers services on the given container. |
39 | 38 | * |
@@ -239,7 +239,7 @@ |
||
239 | 239 | |
240 | 240 | $factory = $this->values[$id]; |
241 | 241 | |
242 | - $extended = function ($c) use ($callable, $factory) { |
|
242 | + $extended = function($c) use ($callable, $factory) { |
|
243 | 243 | return $callable($factory($c), $c); |
244 | 244 | }; |
245 | 245 |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | * |
48 | 48 | * @param array $values The parameters or objects. |
49 | 49 | */ |
50 | - public function __construct(array $values = array()) |
|
51 | - { |
|
50 | + public function __construct(array $values = array()) { |
|
52 | 51 | $this->factories = new \SplObjectStorage(); |
53 | 52 | $this->protected = new \SplObjectStorage(); |
54 | 53 | |
@@ -71,8 +70,7 @@ discard block |
||
71 | 70 | * |
72 | 71 | * @throws \RuntimeException Prevent override of a frozen service |
73 | 72 | */ |
74 | - public function offsetSet($id, $value) |
|
75 | - { |
|
73 | + public function offsetSet($id, $value) { |
|
76 | 74 | if (isset($this->frozen[$id])) { |
77 | 75 | throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); |
78 | 76 | } |
@@ -90,8 +88,7 @@ discard block |
||
90 | 88 | * |
91 | 89 | * @throws \InvalidArgumentException if the identifier is not defined |
92 | 90 | */ |
93 | - public function offsetGet($id) |
|
94 | - { |
|
91 | + public function offsetGet($id) { |
|
95 | 92 | if (!isset($this->keys[$id])) { |
96 | 93 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
97 | 94 | } |
@@ -125,8 +122,7 @@ discard block |
||
125 | 122 | * |
126 | 123 | * @return bool |
127 | 124 | */ |
128 | - public function offsetExists($id) |
|
129 | - { |
|
125 | + public function offsetExists($id) { |
|
130 | 126 | return isset($this->keys[$id]); |
131 | 127 | } |
132 | 128 | |
@@ -135,8 +131,7 @@ discard block |
||
135 | 131 | * |
136 | 132 | * @param string $id The unique identifier for the parameter or object |
137 | 133 | */ |
138 | - public function offsetUnset($id) |
|
139 | - { |
|
134 | + public function offsetUnset($id) { |
|
140 | 135 | if (isset($this->keys[$id])) { |
141 | 136 | if (is_object($this->values[$id])) { |
142 | 137 | unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); |
@@ -155,8 +150,7 @@ discard block |
||
155 | 150 | * |
156 | 151 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
157 | 152 | */ |
158 | - public function factory($callable) |
|
159 | - { |
|
153 | + public function factory($callable) { |
|
160 | 154 | if (!method_exists($callable, '__invoke')) { |
161 | 155 | throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); |
162 | 156 | } |
@@ -177,8 +171,7 @@ discard block |
||
177 | 171 | * |
178 | 172 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
179 | 173 | */ |
180 | - public function protect($callable) |
|
181 | - { |
|
174 | + public function protect($callable) { |
|
182 | 175 | if (!method_exists($callable, '__invoke')) { |
183 | 176 | throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); |
184 | 177 | } |
@@ -197,8 +190,7 @@ discard block |
||
197 | 190 | * |
198 | 191 | * @throws \InvalidArgumentException if the identifier is not defined |
199 | 192 | */ |
200 | - public function raw($id) |
|
201 | - { |
|
193 | + public function raw($id) { |
|
202 | 194 | if (!isset($this->keys[$id])) { |
203 | 195 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
204 | 196 | } |
@@ -223,8 +215,7 @@ discard block |
||
223 | 215 | * |
224 | 216 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
225 | 217 | */ |
226 | - public function extend($id, $callable) |
|
227 | - { |
|
218 | + public function extend($id, $callable) { |
|
228 | 219 | if (!isset($this->keys[$id])) { |
229 | 220 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
230 | 221 | } |
@@ -256,8 +247,7 @@ discard block |
||
256 | 247 | * |
257 | 248 | * @return array An array of value names |
258 | 249 | */ |
259 | - public function keys() |
|
260 | - { |
|
250 | + public function keys() { |
|
261 | 251 | return array_keys($this->values); |
262 | 252 | } |
263 | 253 | |
@@ -269,8 +259,7 @@ discard block |
||
269 | 259 | * |
270 | 260 | * @return static |
271 | 261 | */ |
272 | - public function register(ServiceProviderInterface $provider, array $values = array()) |
|
273 | - { |
|
262 | + public function register(ServiceProviderInterface $provider, array $values = array()) { |
|
274 | 263 | $provider->register($this); |
275 | 264 | |
276 | 265 | foreach ($values as $key => $value) { |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * Load template source from file |
|
59 | - * @access private |
|
60 | - */ |
|
58 | + * Load template source from file |
|
59 | + * @access private |
|
60 | + */ |
|
61 | 61 | function _tpl_load_file($handle, $store_in_db = false) |
62 | 62 | { |
63 | 63 | // Try and open template for read |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
104 | - * the ones that exist in zend_language_scanner.l |
|
105 | - * @access private |
|
106 | - */ |
|
103 | + * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
104 | + * the ones that exist in zend_language_scanner.l |
|
105 | + * @access private |
|
106 | + */ |
|
107 | 107 | function remove_php_tags(&$code) |
108 | 108 | { |
109 | 109 | // This matches the information gathered from the internal PHP lexer |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | - * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
121 | - * @access private |
|
122 | - */ |
|
120 | + * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
121 | + * @access private |
|
122 | + */ |
|
123 | 123 | function compile($code, $no_echo = false, $echo_var = '') |
124 | 124 | { |
125 | 125 | if ($echo_var) |
@@ -288,9 +288,9 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
291 | - * Compile variables |
|
292 | - * @access private |
|
293 | - */ |
|
291 | + * Compile variables |
|
292 | + * @access private |
|
293 | + */ |
|
294 | 294 | function compile_var_tags(&$text_blocks) |
295 | 295 | { |
296 | 296 | // including $lang variable |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
366 | - * Compile blocks |
|
367 | - * @access private |
|
368 | - */ |
|
366 | + * Compile blocks |
|
367 | + * @access private |
|
368 | + */ |
|
369 | 369 | function compile_tag_block($tag_args) |
370 | 370 | { |
371 | 371 | $no_nesting = false; |
@@ -451,14 +451,14 @@ discard block |
||
451 | 451 | $tag_template_php .= 'if ($_' . $tag_args . '_count) {'; |
452 | 452 | |
453 | 453 | /** |
454 | - * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory |
|
455 | - * <code> |
|
456 | - * if (!$offset) |
|
457 | - * { |
|
458 | - * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
459 | - * } |
|
460 | - * </code> |
|
461 | - */ |
|
454 | + * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory |
|
455 | + * <code> |
|
456 | + * if (!$offset) |
|
457 | + * { |
|
458 | + * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
459 | + * } |
|
460 | + * </code> |
|
461 | + */ |
|
462 | 462 | |
463 | 463 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
464 | 464 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
@@ -469,10 +469,10 @@ discard block |
||
469 | 469 | } |
470 | 470 | |
471 | 471 | /** |
472 | - * Compile IF tags - much of this is from Smarty with |
|
473 | - * some adaptions for our block level methods |
|
474 | - * @access private |
|
475 | - */ |
|
472 | + * Compile IF tags - much of this is from Smarty with |
|
473 | + * some adaptions for our block level methods |
|
474 | + * @access private |
|
475 | + */ |
|
476 | 476 | function compile_tag_if($tag_args, $elseif) |
477 | 477 | { |
478 | 478 | // Tokenize args for 'if' tag. |
@@ -627,9 +627,9 @@ discard block |
||
627 | 627 | } |
628 | 628 | |
629 | 629 | /** |
630 | - * Compile DEFINE tags |
|
631 | - * @access private |
|
632 | - */ |
|
630 | + * Compile DEFINE tags |
|
631 | + * @access private |
|
632 | + */ |
|
633 | 633 | function compile_tag_define($tag_args, $op) |
634 | 634 | { |
635 | 635 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
@@ -680,9 +680,9 @@ discard block |
||
680 | 680 | } |
681 | 681 | |
682 | 682 | /** |
683 | - * Compile INCLUDE tag |
|
684 | - * @access private |
|
685 | - */ |
|
683 | + * Compile INCLUDE tag |
|
684 | + * @access private |
|
685 | + */ |
|
686 | 686 | function compile_tag_include($tag_args) |
687 | 687 | { |
688 | 688 | // Process dynamic includes |
@@ -695,19 +695,19 @@ discard block |
||
695 | 695 | } |
696 | 696 | |
697 | 697 | /** |
698 | - * Compile INCLUDE_PHP tag |
|
699 | - * @access private |
|
700 | - */ |
|
698 | + * Compile INCLUDE_PHP tag |
|
699 | + * @access private |
|
700 | + */ |
|
701 | 701 | function compile_tag_include_php($tag_args) |
702 | 702 | { |
703 | 703 | return "\$this->_php_include('$tag_args');"; |
704 | 704 | } |
705 | 705 | |
706 | 706 | /** |
707 | - * parse expression |
|
708 | - * This is from Smarty |
|
709 | - * @access private |
|
710 | - */ |
|
707 | + * parse expression |
|
708 | + * This is from Smarty |
|
709 | + * @access private |
|
710 | + */ |
|
711 | 711 | function _parse_is_expr($is_arg, $tokens) |
712 | 712 | { |
713 | 713 | $expr_end = 0; |
@@ -800,14 +800,14 @@ discard block |
||
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
803 | - * Generates a reference to the array of data values for the given |
|
804 | - * (possibly nested) block namespace. This is a string of the form: |
|
805 | - * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
806 | - * |
|
807 | - * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
808 | - * NOTE: does not expect a trailing "." on the blockname. |
|
809 | - * @access private |
|
810 | - */ |
|
803 | + * Generates a reference to the array of data values for the given |
|
804 | + * (possibly nested) block namespace. This is a string of the form: |
|
805 | + * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
806 | + * |
|
807 | + * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
808 | + * NOTE: does not expect a trailing "." on the blockname. |
|
809 | + * @access private |
|
810 | + */ |
|
811 | 811 | function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
812 | 812 | { |
813 | 813 | // Get an array of the blocks involved. |
@@ -843,9 +843,9 @@ discard block |
||
843 | 843 | } |
844 | 844 | |
845 | 845 | /** |
846 | - * Write compiled file to cache directory |
|
847 | - * @access private |
|
848 | - */ |
|
846 | + * Write compiled file to cache directory |
|
847 | + * @access private |
|
848 | + */ |
|
849 | 849 | function compile_write($handle, $data) |
850 | 850 | { |
851 | 851 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
@@ -868,9 +868,9 @@ discard block |
||
868 | 868 | |
869 | 869 | // Gorlum's minifier BOF |
870 | 870 | /** |
871 | - * Minifies template w/i PHP code by removing extra spaces |
|
872 | - * @access private |
|
873 | - */ |
|
871 | + * Minifies template w/i PHP code by removing extra spaces |
|
872 | + * @access private |
|
873 | + */ |
|
874 | 874 | function minify($html) |
875 | 875 | { |
876 | 876 | if(!SN::$config->tpl_minifier) |
@@ -141,9 +141,9 @@ discard block |
||
141 | 141 | |
142 | 142 | preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches); |
143 | 143 | $include_blocks = $matches[1]; |
144 | - if($include_blocks) |
|
144 | + if ($include_blocks) |
|
145 | 145 | { |
146 | - foreach($include_blocks as &$included_file) |
|
146 | + foreach ($include_blocks as &$included_file) |
|
147 | 147 | { |
148 | 148 | $included_file .= '.tpl.html'; |
149 | 149 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $varname = $var_val[3]; |
309 | 309 | $new = $this->generate_block_varref($namespace, $varname, $var_val[2]); |
310 | 310 | |
311 | - if(!empty($var_val[4])) { |
|
311 | + if (!empty($var_val[4])) { |
|
312 | 312 | $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template); |
313 | 313 | } |
314 | 314 | |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | |
463 | 463 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
464 | 464 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
465 | - $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
466 | - $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
465 | + $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
466 | + $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
467 | 467 | |
468 | 468 | return $tag_template_php; |
469 | 469 | } |
@@ -567,10 +567,10 @@ discard block |
||
567 | 567 | break; |
568 | 568 | |
569 | 569 | case 'is': |
570 | - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; |
|
570 | + $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; |
|
571 | 571 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
572 | 572 | |
573 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
573 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
574 | 574 | |
575 | 575 | array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); |
576 | 576 | |
@@ -834,11 +834,11 @@ discard block |
||
834 | 834 | } |
835 | 835 | else if ($include_last_iterator) |
836 | 836 | { |
837 | - return '$_'. $blocks[$blockcount] . '_val'; |
|
837 | + return '$_' . $blocks[$blockcount] . '_val'; |
|
838 | 838 | } |
839 | 839 | else |
840 | 840 | { |
841 | - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
|
841 | + return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']'; |
|
842 | 842 | } |
843 | 843 | } |
844 | 844 | |
@@ -855,7 +855,7 @@ discard block |
||
855 | 855 | if ($fp = @fopen($filename, 'wb')) |
856 | 856 | { |
857 | 857 | @flock($fp, LOCK_EX); |
858 | - @fwrite ($fp, $data); |
|
858 | + @fwrite($fp, $data); |
|
859 | 859 | @flock($fp, LOCK_UN); |
860 | 860 | @fclose($fp); |
861 | 861 | |
@@ -873,7 +873,7 @@ discard block |
||
873 | 873 | */ |
874 | 874 | function minify($html) |
875 | 875 | { |
876 | - if(!SN::$config->tpl_minifier) |
|
876 | + if (!SN::$config->tpl_minifier) |
|
877 | 877 | { |
878 | 878 | return $html; |
879 | 879 | } |
@@ -885,14 +885,14 @@ discard block |
||
885 | 885 | //$html = preg_replace('/[\r\n\t]+/', ' ', $html); |
886 | 886 | $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags |
887 | 887 | $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space |
888 | - if(!empty($pre[0])) |
|
888 | + if (!empty($pre[0])) |
|
889 | 889 | { |
890 | - foreach($pre[0] as $tag) |
|
890 | + foreach ($pre[0] as $tag) |
|
891 | 891 | { |
892 | 892 | $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside |
893 | 893 | $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one |
894 | 894 | $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one |
895 | - $html = preg_replace('/#pre#/', $tag, $html,1); |
|
895 | + $html = preg_replace('/#pre#/', $tag, $html, 1); |
|
896 | 896 | } |
897 | 897 | } |
898 | 898 |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @package phpBB3 |
39 | 39 | */ |
40 | -class template_compile |
|
41 | -{ |
|
40 | +class template_compile { |
|
42 | 41 | var $template; |
43 | 42 | |
44 | 43 | // Various storage arrays |
@@ -58,8 +57,7 @@ discard block |
||
58 | 57 | * Load template source from file |
59 | 58 | * @access private |
60 | 59 | */ |
61 | - function _tpl_load_file($handle, $store_in_db = false) |
|
62 | - { |
|
60 | + function _tpl_load_file($handle, $store_in_db = false) { |
|
63 | 61 | // Try and open template for read |
64 | 62 | if (!file_exists($this->template->files[$handle])) |
65 | 63 | { |
@@ -69,8 +67,7 @@ discard block |
||
69 | 67 | |
70 | 68 | return; |
71 | 69 | trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR); |
72 | - } |
|
73 | - else |
|
70 | + } else |
|
74 | 71 | { |
75 | 72 | $this->template->files[$handle] = $this->template->files_inherit[$handle]; |
76 | 73 | } |
@@ -106,8 +103,7 @@ discard block |
||
106 | 103 | * the ones that exist in zend_language_scanner.l |
107 | 104 | * @access private |
108 | 105 | */ |
109 | - function remove_php_tags(&$code) |
|
110 | - { |
|
106 | + function remove_php_tags(&$code) { |
|
111 | 107 | // This matches the information gathered from the internal PHP lexer |
112 | 108 | $match = array( |
113 | 109 | '#<([\?%])=?.*?\1>#s', |
@@ -122,8 +118,7 @@ discard block |
||
122 | 118 | * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
123 | 119 | * @access private |
124 | 120 | */ |
125 | - function compile($code, $no_echo = false, $echo_var = '') |
|
126 | - { |
|
121 | + function compile($code, $no_echo = false, $echo_var = '') { |
|
127 | 122 | if ($echo_var) |
128 | 123 | { |
129 | 124 | global $$echo_var; |
@@ -226,15 +221,13 @@ discard block |
||
226 | 221 | $var = substr($temp, 2, -1); |
227 | 222 | //$file = $this->template->_tpldata['DEFINE']['.'][$var]; |
228 | 223 | $temp = "\$this->_tpldata['DEFINE']['.']['$var']"; |
229 | - } |
|
230 | - else |
|
224 | + } else |
|
231 | 225 | { |
232 | 226 | $var = substr($temp, 1, -1); |
233 | 227 | //$file = $this->template->_rootref[$var]; |
234 | 228 | $temp = "\$this->_rootref['$var']"; |
235 | 229 | } |
236 | - } |
|
237 | - else |
|
230 | + } else |
|
238 | 231 | { |
239 | 232 | $file = $temp; |
240 | 233 | } |
@@ -293,8 +286,7 @@ discard block |
||
293 | 286 | * Compile variables |
294 | 287 | * @access private |
295 | 288 | */ |
296 | - function compile_var_tags(&$text_blocks) |
|
297 | - { |
|
289 | + function compile_var_tags(&$text_blocks) { |
|
298 | 290 | // including $lang variable |
299 | 291 | // global $lang, $config; // NOT NEDEED - $lang now is global! |
300 | 292 | |
@@ -368,8 +360,7 @@ discard block |
||
368 | 360 | * Compile blocks |
369 | 361 | * @access private |
370 | 362 | */ |
371 | - function compile_tag_block($tag_args) |
|
372 | - { |
|
363 | + function compile_tag_block($tag_args) { |
|
373 | 364 | $no_nesting = false; |
374 | 365 | |
375 | 366 | // Is the designer wanting to call another loop in a loop? |
@@ -392,8 +383,7 @@ discard block |
||
392 | 383 | if ($match[2] < 0) |
393 | 384 | { |
394 | 385 | $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; |
395 | - } |
|
396 | - else |
|
386 | + } else |
|
397 | 387 | { |
398 | 388 | $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; |
399 | 389 | } |
@@ -401,17 +391,14 @@ discard block |
||
401 | 391 | if (strlen($match[3]) < 1 || $match[3] == -1) |
402 | 392 | { |
403 | 393 | $loop_end = '$_' . $tag_args . '_count'; |
404 | - } |
|
405 | - else if ($match[3] >= 0) |
|
394 | + } else if ($match[3] >= 0) |
|
406 | 395 | { |
407 | 396 | $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; |
408 | - } |
|
409 | - else //if ($match[3] < -1) |
|
397 | + } else //if ($match[3] < -1) |
|
410 | 398 | { |
411 | 399 | $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); |
412 | 400 | } |
413 | - } |
|
414 | - else |
|
401 | + } else |
|
415 | 402 | { |
416 | 403 | $loop_start = 0; |
417 | 404 | $loop_end = '$_' . $tag_args . '_count'; |
@@ -424,8 +411,7 @@ discard block |
||
424 | 411 | { |
425 | 412 | // We need to implode $no_nesting times from the end... |
426 | 413 | $block = array_slice($this->block_names, -$no_nesting); |
427 | - } |
|
428 | - else |
|
414 | + } else |
|
429 | 415 | { |
430 | 416 | $block = $this->block_names; |
431 | 417 | } |
@@ -435,8 +421,7 @@ discard block |
||
435 | 421 | // Block is not nested. |
436 | 422 | $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; |
437 | 423 | $varref = "\$this->_tpldata['$tag_args']"; |
438 | - } |
|
439 | - else |
|
424 | + } else |
|
440 | 425 | { |
441 | 426 | // This block is nested. |
442 | 427 | // Generate a namespace string for this block. |
@@ -475,8 +460,7 @@ discard block |
||
475 | 460 | * some adaptions for our block level methods |
476 | 461 | * @access private |
477 | 462 | */ |
478 | - function compile_tag_if($tag_args, $elseif) |
|
479 | - { |
|
463 | + function compile_tag_if($tag_args, $elseif) { |
|
480 | 464 | // Tokenize args for 'if' tag. |
481 | 465 | preg_match_all('/(?: |
482 | 466 | "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | |
@@ -584,8 +568,7 @@ discard block |
||
584 | 568 | if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs)) |
585 | 569 | { |
586 | 570 | $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); |
587 | - } |
|
588 | - else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
571 | + } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
589 | 572 | { |
590 | 573 | // Allow checking if loops are set with .loopname |
591 | 574 | // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example |
@@ -601,8 +584,7 @@ discard block |
||
601 | 584 | |
602 | 585 | // Add the block reference for the last child. |
603 | 586 | $varref .= "['" . $block . "']"; |
604 | - } |
|
605 | - else |
|
587 | + } else |
|
606 | 588 | { |
607 | 589 | $varref = '$this->_tpldata'; |
608 | 590 | |
@@ -610,8 +592,7 @@ discard block |
||
610 | 592 | $varref .= "['" . $blocks[0] . "']"; |
611 | 593 | } |
612 | 594 | $token = "sizeof($varref)"; |
613 | - } |
|
614 | - else if (!empty($token)) |
|
595 | + } else if (!empty($token)) |
|
615 | 596 | { |
616 | 597 | $token = '(' . $token . ')'; |
617 | 598 | } |
@@ -632,8 +613,7 @@ discard block |
||
632 | 613 | * Compile DEFINE tags |
633 | 614 | * @access private |
634 | 615 | */ |
635 | - function compile_tag_define($tag_args, $op) |
|
636 | - { |
|
616 | + function compile_tag_define($tag_args, $op) { |
|
637 | 617 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
638 | 618 | |
639 | 619 | if (empty($match[2]) || (!isset($match[4]) && $op)) |
@@ -656,8 +636,7 @@ discard block |
||
656 | 636 | |
657 | 637 | // Now replace the php code |
658 | 638 | $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'"; |
659 | - } |
|
660 | - else |
|
639 | + } else |
|
661 | 640 | { |
662 | 641 | preg_match('#true|false|\.#i', $match[4], $type); |
663 | 642 | |
@@ -685,8 +664,7 @@ discard block |
||
685 | 664 | * Compile INCLUDE tag |
686 | 665 | * @access private |
687 | 666 | */ |
688 | - function compile_tag_include($tag_args) |
|
689 | - { |
|
667 | + function compile_tag_include($tag_args) { |
|
690 | 668 | // Process dynamic includes |
691 | 669 | if ($tag_args[0] == '$') |
692 | 670 | { |
@@ -700,8 +678,7 @@ discard block |
||
700 | 678 | * Compile INCLUDE_PHP tag |
701 | 679 | * @access private |
702 | 680 | */ |
703 | - function compile_tag_include_php($tag_args) |
|
704 | - { |
|
681 | + function compile_tag_include_php($tag_args) { |
|
705 | 682 | return "\$this->_php_include('$tag_args');"; |
706 | 683 | } |
707 | 684 | |
@@ -710,8 +687,7 @@ discard block |
||
710 | 687 | * This is from Smarty |
711 | 688 | * @access private |
712 | 689 | */ |
713 | - function _parse_is_expr($is_arg, $tokens) |
|
714 | - { |
|
690 | + function _parse_is_expr($is_arg, $tokens) { |
|
715 | 691 | $expr_end = 0; |
716 | 692 | $negate_expr = false; |
717 | 693 | |
@@ -719,8 +695,7 @@ discard block |
||
719 | 695 | { |
720 | 696 | $negate_expr = true; |
721 | 697 | $expr_type = array_shift($tokens); |
722 | - } |
|
723 | - else |
|
698 | + } else |
|
724 | 699 | { |
725 | 700 | $expr_type = $first_token; |
726 | 701 | } |
@@ -733,8 +708,7 @@ discard block |
||
733 | 708 | $expr_end++; |
734 | 709 | $expr_arg = $tokens[$expr_end++]; |
735 | 710 | $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; |
736 | - } |
|
737 | - else |
|
711 | + } else |
|
738 | 712 | { |
739 | 713 | $expr = "!($is_arg & 1)"; |
740 | 714 | } |
@@ -746,8 +720,7 @@ discard block |
||
746 | 720 | $expr_end++; |
747 | 721 | $expr_arg = $tokens[$expr_end++]; |
748 | 722 | $expr = "(($is_arg / $expr_arg) % $expr_arg)"; |
749 | - } |
|
750 | - else |
|
723 | + } else |
|
751 | 724 | { |
752 | 725 | $expr = "($is_arg & 1)"; |
753 | 726 | } |
@@ -786,8 +759,7 @@ discard block |
||
786 | 759 | * |
787 | 760 | * @return string |
788 | 761 | */ |
789 | - private function generate_block_varref($namespace, $varname, $defop = false) |
|
790 | - { |
|
762 | + private function generate_block_varref($namespace, $varname, $defop = false) { |
|
791 | 763 | // Strip the trailing period. |
792 | 764 | $namespace = substr($namespace, 0, -1); |
793 | 765 | |
@@ -810,8 +782,7 @@ discard block |
||
810 | 782 | * NOTE: does not expect a trailing "." on the blockname. |
811 | 783 | * @access private |
812 | 784 | */ |
813 | - function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
|
814 | - { |
|
785 | + function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) { |
|
815 | 786 | // Get an array of the blocks involved. |
816 | 787 | $blocks = explode('.', $blockname); |
817 | 788 | $blockcount = sizeof($blocks) - 1; |
@@ -833,12 +804,10 @@ discard block |
||
833 | 804 | $varref .= '[$_' . $blocks[$blockcount] . '_i]'; |
834 | 805 | } |
835 | 806 | return $varref; |
836 | - } |
|
837 | - else if ($include_last_iterator) |
|
807 | + } else if ($include_last_iterator) |
|
838 | 808 | { |
839 | 809 | return '$_'. $blocks[$blockcount] . '_val'; |
840 | - } |
|
841 | - else |
|
810 | + } else |
|
842 | 811 | { |
843 | 812 | return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
844 | 813 | } |
@@ -848,8 +817,7 @@ discard block |
||
848 | 817 | * Write compiled file to cache directory |
849 | 818 | * @access private |
850 | 819 | */ |
851 | - function compile_write($handle, $data) |
|
852 | - { |
|
820 | + function compile_write($handle, $data) { |
|
853 | 821 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
854 | 822 | |
855 | 823 | $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data); |
@@ -873,8 +841,7 @@ discard block |
||
873 | 841 | * Minifies template w/i PHP code by removing extra spaces |
874 | 842 | * @access private |
875 | 843 | */ |
876 | - function minify($html) |
|
877 | - { |
|
844 | + function minify($html) { |
|
878 | 845 | if(!SN::$config->tpl_minifier) |
879 | 846 | { |
880 | 847 | return $html; |
@@ -29,19 +29,19 @@ |
||
29 | 29 | 'ID' => self::PAGE_SORT_BY_RANK, |
30 | 30 | 'HTML_ID' => 'byTotalRank', |
31 | 31 | 'HTML_NAME' => '{ byTotalRank }', |
32 | - 'SQL_SORT' => ['u.total_rank',], |
|
32 | + 'SQL_SORT' => ['u.total_rank', ], |
|
33 | 33 | ], |
34 | 34 | self::PAGE_SORT_BY_ID => [ |
35 | 35 | 'ID' => self::PAGE_SORT_BY_ID, |
36 | 36 | 'HTML_ID' => 'byId', |
37 | 37 | 'HTML_NAME' => '{ byId }', |
38 | - 'SQL_SORT' => ['u.id',], |
|
38 | + 'SQL_SORT' => ['u.id', ], |
|
39 | 39 | ], |
40 | 40 | self::PAGE_SORT_BY_NAME => [ |
41 | 41 | 'ID' => self::PAGE_SORT_BY_NAME, |
42 | 42 | 'HTML_ID' => 'byName', |
43 | 43 | 'HTML_NAME' => '{ byName }', |
44 | - 'SQL_SORT' => ['u.username',], |
|
44 | + 'SQL_SORT' => ['u.username', ], |
|
45 | 45 | ], |
46 | 46 | |
47 | 47 | self::PAGE_SORT_BY_POINTS => [ |