@@ -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 | { |
@@ -74,8 +72,7 @@ discard block |
||
| 74 | 72 | |
| 75 | 73 | return; |
| 76 | 74 | trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR); |
| 77 | - } |
|
| 78 | - else |
|
| 75 | + } else |
|
| 79 | 76 | { |
| 80 | 77 | $this->template->files[$handle] = $this->template->files_inherit[$handle]; |
| 81 | 78 | } |
@@ -111,8 +108,7 @@ discard block |
||
| 111 | 108 | * the ones that exist in zend_language_scanner.l |
| 112 | 109 | * @access private |
| 113 | 110 | */ |
| 114 | - function remove_php_tags(&$code) |
|
| 115 | - { |
|
| 111 | + function remove_php_tags(&$code) { |
|
| 116 | 112 | // This matches the information gathered from the internal PHP lexer |
| 117 | 113 | $match = array( |
| 118 | 114 | '#<([\?%])=?.*?\1>#s', |
@@ -127,8 +123,7 @@ discard block |
||
| 127 | 123 | * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
| 128 | 124 | * @access private |
| 129 | 125 | */ |
| 130 | - function compile($code, $no_echo = false, $echo_var = '') |
|
| 131 | - { |
|
| 126 | + function compile($code, $no_echo = false, $echo_var = '') { |
|
| 132 | 127 | if ($echo_var) |
| 133 | 128 | { |
| 134 | 129 | global $$echo_var; |
@@ -231,15 +226,13 @@ discard block |
||
| 231 | 226 | $var = substr($temp, 2, -1); |
| 232 | 227 | //$file = $this->template->_tpldata['DEFINE']['.'][$var]; |
| 233 | 228 | $temp = "\$this->_tpldata['DEFINE']['.']['$var']"; |
| 234 | - } |
|
| 235 | - else |
|
| 229 | + } else |
|
| 236 | 230 | { |
| 237 | 231 | $var = substr($temp, 1, -1); |
| 238 | 232 | //$file = $this->template->_rootref[$var]; |
| 239 | 233 | $temp = "\$this->_rootref['$var']"; |
| 240 | 234 | } |
| 241 | - } |
|
| 242 | - else |
|
| 235 | + } else |
|
| 243 | 236 | { |
| 244 | 237 | $file = $temp; |
| 245 | 238 | } |
@@ -298,8 +291,7 @@ discard block |
||
| 298 | 291 | * Compile variables |
| 299 | 292 | * @access private |
| 300 | 293 | */ |
| 301 | - function compile_var_tags(&$text_blocks) |
|
| 302 | - { |
|
| 294 | + function compile_var_tags(&$text_blocks) { |
|
| 303 | 295 | // including $lang variable |
| 304 | 296 | // global $lang, $config; // NOT NEDEED - $lang now is global! |
| 305 | 297 | |
@@ -373,8 +365,7 @@ discard block |
||
| 373 | 365 | * Compile blocks |
| 374 | 366 | * @access private |
| 375 | 367 | */ |
| 376 | - function compile_tag_block($tag_args) |
|
| 377 | - { |
|
| 368 | + function compile_tag_block($tag_args) { |
|
| 378 | 369 | $no_nesting = false; |
| 379 | 370 | |
| 380 | 371 | // Is the designer wanting to call another loop in a loop? |
@@ -397,8 +388,7 @@ discard block |
||
| 397 | 388 | if ($match[2] < 0) |
| 398 | 389 | { |
| 399 | 390 | $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; |
| 400 | - } |
|
| 401 | - else |
|
| 391 | + } else |
|
| 402 | 392 | { |
| 403 | 393 | $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; |
| 404 | 394 | } |
@@ -406,17 +396,14 @@ discard block |
||
| 406 | 396 | if (strlen($match[3]) < 1 || $match[3] == -1) |
| 407 | 397 | { |
| 408 | 398 | $loop_end = '$_' . $tag_args . '_count'; |
| 409 | - } |
|
| 410 | - else if ($match[3] >= 0) |
|
| 399 | + } else if ($match[3] >= 0) |
|
| 411 | 400 | { |
| 412 | 401 | $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; |
| 413 | - } |
|
| 414 | - else //if ($match[3] < -1) |
|
| 402 | + } else //if ($match[3] < -1) |
|
| 415 | 403 | { |
| 416 | 404 | $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); |
| 417 | 405 | } |
| 418 | - } |
|
| 419 | - else |
|
| 406 | + } else |
|
| 420 | 407 | { |
| 421 | 408 | $loop_start = 0; |
| 422 | 409 | $loop_end = '$_' . $tag_args . '_count'; |
@@ -429,8 +416,7 @@ discard block |
||
| 429 | 416 | { |
| 430 | 417 | // We need to implode $no_nesting times from the end... |
| 431 | 418 | $block = array_slice($this->block_names, -$no_nesting); |
| 432 | - } |
|
| 433 | - else |
|
| 419 | + } else |
|
| 434 | 420 | { |
| 435 | 421 | $block = $this->block_names; |
| 436 | 422 | } |
@@ -440,8 +426,7 @@ discard block |
||
| 440 | 426 | // Block is not nested. |
| 441 | 427 | $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; |
| 442 | 428 | $varref = "\$this->_tpldata['$tag_args']"; |
| 443 | - } |
|
| 444 | - else |
|
| 429 | + } else |
|
| 445 | 430 | { |
| 446 | 431 | // This block is nested. |
| 447 | 432 | // Generate a namespace string for this block. |
@@ -480,8 +465,7 @@ discard block |
||
| 480 | 465 | * some adaptions for our block level methods |
| 481 | 466 | * @access private |
| 482 | 467 | */ |
| 483 | - function compile_tag_if($tag_args, $elseif) |
|
| 484 | - { |
|
| 468 | + function compile_tag_if($tag_args, $elseif) { |
|
| 485 | 469 | // Tokenize args for 'if' tag. |
| 486 | 470 | preg_match_all('/(?: |
| 487 | 471 | "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | |
@@ -589,8 +573,7 @@ discard block |
||
| 589 | 573 | if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs)) |
| 590 | 574 | { |
| 591 | 575 | $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] . '\']'); |
| 592 | - } |
|
| 593 | - else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 576 | + } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 594 | 577 | { |
| 595 | 578 | // Allow checking if loops are set with .loopname |
| 596 | 579 | // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example |
@@ -606,8 +589,7 @@ discard block |
||
| 606 | 589 | |
| 607 | 590 | // Add the block reference for the last child. |
| 608 | 591 | $varref .= "['" . $block . "']"; |
| 609 | - } |
|
| 610 | - else |
|
| 592 | + } else |
|
| 611 | 593 | { |
| 612 | 594 | $varref = '$this->_tpldata'; |
| 613 | 595 | |
@@ -615,8 +597,7 @@ discard block |
||
| 615 | 597 | $varref .= "['" . $blocks[0] . "']"; |
| 616 | 598 | } |
| 617 | 599 | $token = "(empty($varref) ? 0 : sizeof($varref))"; |
| 618 | - } |
|
| 619 | - else if (!empty($token)) |
|
| 600 | + } else if (!empty($token)) |
|
| 620 | 601 | { |
| 621 | 602 | $token = '(' . $token . ')'; |
| 622 | 603 | } |
@@ -637,8 +618,7 @@ discard block |
||
| 637 | 618 | * Compile DEFINE tags |
| 638 | 619 | * @access private |
| 639 | 620 | */ |
| 640 | - function compile_tag_define($tag_args, $op) |
|
| 641 | - { |
|
| 621 | + function compile_tag_define($tag_args, $op) { |
|
| 642 | 622 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
| 643 | 623 | |
| 644 | 624 | if (empty($match[2]) || (!isset($match[4]) && $op)) |
@@ -661,8 +641,7 @@ discard block |
||
| 661 | 641 | |
| 662 | 642 | // Now replace the php code |
| 663 | 643 | $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'"; |
| 664 | - } |
|
| 665 | - else |
|
| 644 | + } else |
|
| 666 | 645 | { |
| 667 | 646 | preg_match('#true|false|\.#i', $match[4], $type); |
| 668 | 647 | |
@@ -690,8 +669,7 @@ discard block |
||
| 690 | 669 | * Compile INCLUDE tag |
| 691 | 670 | * @access private |
| 692 | 671 | */ |
| 693 | - function compile_tag_include($tag_args) |
|
| 694 | - { |
|
| 672 | + function compile_tag_include($tag_args) { |
|
| 695 | 673 | // Process dynamic includes |
| 696 | 674 | if ($tag_args[0] == '$') |
| 697 | 675 | { |
@@ -705,8 +683,7 @@ discard block |
||
| 705 | 683 | * Compile INCLUDE_PHP tag |
| 706 | 684 | * @access private |
| 707 | 685 | */ |
| 708 | - function compile_tag_include_php($tag_args) |
|
| 709 | - { |
|
| 686 | + function compile_tag_include_php($tag_args) { |
|
| 710 | 687 | return "\$this->_php_include('$tag_args');"; |
| 711 | 688 | } |
| 712 | 689 | |
@@ -715,8 +692,7 @@ discard block |
||
| 715 | 692 | * This is from Smarty |
| 716 | 693 | * @access private |
| 717 | 694 | */ |
| 718 | - function _parse_is_expr($is_arg, $tokens) |
|
| 719 | - { |
|
| 695 | + function _parse_is_expr($is_arg, $tokens) { |
|
| 720 | 696 | $expr_end = 0; |
| 721 | 697 | $negate_expr = false; |
| 722 | 698 | |
@@ -724,8 +700,7 @@ discard block |
||
| 724 | 700 | { |
| 725 | 701 | $negate_expr = true; |
| 726 | 702 | $expr_type = array_shift($tokens); |
| 727 | - } |
|
| 728 | - else |
|
| 703 | + } else |
|
| 729 | 704 | { |
| 730 | 705 | $expr_type = $first_token; |
| 731 | 706 | } |
@@ -738,8 +713,7 @@ discard block |
||
| 738 | 713 | $expr_end++; |
| 739 | 714 | $expr_arg = $tokens[$expr_end++]; |
| 740 | 715 | $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; |
| 741 | - } |
|
| 742 | - else |
|
| 716 | + } else |
|
| 743 | 717 | { |
| 744 | 718 | $expr = "!($is_arg & 1)"; |
| 745 | 719 | } |
@@ -751,8 +725,7 @@ discard block |
||
| 751 | 725 | $expr_end++; |
| 752 | 726 | $expr_arg = $tokens[$expr_end++]; |
| 753 | 727 | $expr = "(($is_arg / $expr_arg) % $expr_arg)"; |
| 754 | - } |
|
| 755 | - else |
|
| 728 | + } else |
|
| 756 | 729 | { |
| 757 | 730 | $expr = "($is_arg & 1)"; |
| 758 | 731 | } |
@@ -791,8 +764,7 @@ discard block |
||
| 791 | 764 | * |
| 792 | 765 | * @return string |
| 793 | 766 | */ |
| 794 | - private function generate_block_varref($namespace, $varname, $defop = false) |
|
| 795 | - { |
|
| 767 | + private function generate_block_varref($namespace, $varname, $defop = false) { |
|
| 796 | 768 | // Strip the trailing period. |
| 797 | 769 | $namespace = substr($namespace, 0, -1); |
| 798 | 770 | |
@@ -815,8 +787,7 @@ discard block |
||
| 815 | 787 | * NOTE: does not expect a trailing "." on the blockname. |
| 816 | 788 | * @access private |
| 817 | 789 | */ |
| 818 | - function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
|
| 819 | - { |
|
| 790 | + function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) { |
|
| 820 | 791 | // Get an array of the blocks involved. |
| 821 | 792 | $blocks = explode('.', $blockname); |
| 822 | 793 | $blockcount = sizeof($blocks) - 1; |
@@ -838,12 +809,10 @@ discard block |
||
| 838 | 809 | $varref .= '[$_' . $blocks[$blockcount] . '_i]'; |
| 839 | 810 | } |
| 840 | 811 | return $varref; |
| 841 | - } |
|
| 842 | - else if ($include_last_iterator) |
|
| 812 | + } else if ($include_last_iterator) |
|
| 843 | 813 | { |
| 844 | 814 | return '$_'. $blocks[$blockcount] . '_val'; |
| 845 | - } |
|
| 846 | - else |
|
| 815 | + } else |
|
| 847 | 816 | { |
| 848 | 817 | return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
| 849 | 818 | } |
@@ -853,8 +822,7 @@ discard block |
||
| 853 | 822 | * Write compiled file to cache directory |
| 854 | 823 | * @access private |
| 855 | 824 | */ |
| 856 | - function compile_write($handle, $data) |
|
| 857 | - { |
|
| 825 | + function compile_write($handle, $data) { |
|
| 858 | 826 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
| 859 | 827 | |
| 860 | 828 | $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data); |
@@ -878,8 +846,7 @@ discard block |
||
| 878 | 846 | * Minifies template w/i PHP code by removing extra spaces |
| 879 | 847 | * @access private |
| 880 | 848 | */ |
| 881 | - function minify($html) |
|
| 882 | - { |
|
| 849 | + function minify($html) { |
|
| 883 | 850 | if(!SN::$config->tpl_minifier) |
| 884 | 851 | { |
| 885 | 852 | 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 => [ |