@@ -15,7 +15,7 @@ |
||
| 15 | 15 | * |
| 16 | 16 | * @package Buddy |
| 17 | 17 | */ |
| 18 | -class BuddyModel extends \Entity\KeyedModel{ |
|
| 18 | +class BuddyModel extends \Entity\KeyedModel { |
|
| 19 | 19 | /** |
| 20 | 20 | * Name of table for this entity |
| 21 | 21 | * |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * @property string $playerName |
| 22 | 22 | * @property string $playerNameAndCoordinates |
| 23 | 23 | */ |
| 24 | -class BuddyParams extends ContainerPlus { |
|
| 24 | +class BuddyParams extends ContainerPlus { |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * BuddyParams constructor. |
@@ -16,8 +16,7 @@ discard block |
||
| 16 | 16 | * Base Template class. |
| 17 | 17 | * @package phpBB3 |
| 18 | 18 | */ |
| 19 | -class template |
|
| 20 | -{ |
|
| 19 | +class template { |
|
| 21 | 20 | /** variable that holds all the data we'll be substituting into |
| 22 | 21 | * the compiled templates. Takes form: |
| 23 | 22 | * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
@@ -57,8 +56,7 @@ discard block |
||
| 57 | 56 | * Set template location |
| 58 | 57 | * @access public |
| 59 | 58 | */ |
| 60 | - public function set_template() |
|
| 61 | - { |
|
| 59 | + public function set_template() { |
|
| 62 | 60 | global $phpbb_root_path, $user; |
| 63 | 61 | |
| 64 | 62 | if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template')) |
@@ -83,8 +81,7 @@ discard block |
||
| 83 | 81 | { |
| 84 | 82 | $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template'; |
| 85 | 83 | } |
| 86 | - } |
|
| 87 | - else |
|
| 84 | + } else |
|
| 88 | 85 | { |
| 89 | 86 | trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); |
| 90 | 87 | } |
@@ -98,8 +95,7 @@ discard block |
||
| 98 | 95 | * Set custom template location (able to use directory outside of phpBB) |
| 99 | 96 | * @access public |
| 100 | 97 | */ |
| 101 | - public function set_custom_template($template_path, $template_name, $fallback_template_path = false) |
|
| 102 | - { |
|
| 98 | + public function set_custom_template($template_path, $template_name, $fallback_template_path = false) { |
|
| 103 | 99 | global $phpbb_root_path, $user; |
| 104 | 100 | |
| 105 | 101 | // Make sure $template_path has no ending slash |
@@ -120,8 +116,7 @@ discard block |
||
| 120 | 116 | |
| 121 | 117 | $this->inherit_root = $fallback_template_path; |
| 122 | 118 | $this->orig_tpl_inherits_id = true; |
| 123 | - } |
|
| 124 | - else |
|
| 119 | + } else |
|
| 125 | 120 | { |
| 126 | 121 | $this->orig_tpl_inherits_id = false; |
| 127 | 122 | } |
@@ -140,8 +135,7 @@ discard block |
||
| 140 | 135 | * should be a hash of handle => filename pairs. |
| 141 | 136 | * @access public |
| 142 | 137 | */ |
| 143 | - public function set_filenames($filename_array) |
|
| 144 | - { |
|
| 138 | + public function set_filenames($filename_array) { |
|
| 145 | 139 | if (!is_array($filename_array)) |
| 146 | 140 | { |
| 147 | 141 | return false; |
@@ -169,8 +163,7 @@ discard block |
||
| 169 | 163 | * Destroy template data set |
| 170 | 164 | * @access public |
| 171 | 165 | */ |
| 172 | - public function destroy() |
|
| 173 | - { |
|
| 166 | + public function destroy() { |
|
| 174 | 167 | $this->_tpldata = array('.' => array(0 => array())); |
| 175 | 168 | $this->_rootref = &$this->_tpldata['.'][0]; |
| 176 | 169 | } |
@@ -179,8 +172,7 @@ discard block |
||
| 179 | 172 | * Reset/empty complete block |
| 180 | 173 | * @access public |
| 181 | 174 | */ |
| 182 | - public function destroy_block_vars($blockname) |
|
| 183 | - { |
|
| 175 | + public function destroy_block_vars($blockname) { |
|
| 184 | 176 | if (strpos($blockname, '.') !== false) |
| 185 | 177 | { |
| 186 | 178 | // Nested block. |
@@ -195,8 +187,7 @@ discard block |
||
| 195 | 187 | } |
| 196 | 188 | |
| 197 | 189 | unset($str[$blocks[$blockcount]]); |
| 198 | - } |
|
| 199 | - else |
|
| 190 | + } else |
|
| 200 | 191 | { |
| 201 | 192 | // Top-level block. |
| 202 | 193 | unset($this->_tpldata[$blockname]); |
@@ -209,8 +200,7 @@ discard block |
||
| 209 | 200 | * Display handle |
| 210 | 201 | * @access public |
| 211 | 202 | */ |
| 212 | - public function display($handle, $include_once = true) |
|
| 213 | - { |
|
| 203 | + public function display($handle, $include_once = true) { |
|
| 214 | 204 | global $phpbb_hook; |
| 215 | 205 | |
| 216 | 206 | if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once)) |
@@ -232,8 +222,7 @@ discard block |
||
| 232 | 222 | if ($filename = $this->_tpl_load($handle)) |
| 233 | 223 | { |
| 234 | 224 | ($include_once) ? include_once($filename) : include($filename); |
| 235 | - } |
|
| 236 | - else |
|
| 225 | + } else |
|
| 237 | 226 | { |
| 238 | 227 | eval(' ?>' . $this->compiled_code[$handle] . '<?php '); |
| 239 | 228 | } |
@@ -245,8 +234,7 @@ discard block |
||
| 245 | 234 | * Display the handle and assign the output to a template variable or return the compiled result. |
| 246 | 235 | * @access public |
| 247 | 236 | */ |
| 248 | - public function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
|
| 249 | - { |
|
| 237 | + public function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) { |
|
| 250 | 238 | ob_start(); |
| 251 | 239 | $this->display($handle, $include_once); |
| 252 | 240 | $contents = ob_get_clean(); |
@@ -265,8 +253,7 @@ discard block |
||
| 265 | 253 | * Load a compiled template if possible, if not, recompile it |
| 266 | 254 | * @access private |
| 267 | 255 | */ |
| 268 | - public function _tpl_load(&$handle) |
|
| 269 | - { |
|
| 256 | + public function _tpl_load(&$handle) { |
|
| 270 | 257 | global $user; |
| 271 | 258 | |
| 272 | 259 | if (!isset($this->filename[$handle])) |
@@ -287,8 +274,7 @@ discard block |
||
| 287 | 274 | if (!file_exists($filename) || @filesize($filename) === 0) |
| 288 | 275 | { |
| 289 | 276 | $recompile = true; |
| 290 | - } |
|
| 291 | - else if (classSupernova::$config->load_tplcompile) |
|
| 277 | + } else if (classSupernova::$config->load_tplcompile) |
|
| 292 | 278 | { |
| 293 | 279 | // No way around it: we need to check inheritance here |
| 294 | 280 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -376,15 +362,13 @@ discard block |
||
| 376 | 362 | $this->files[$row['template_filename']] = $file; |
| 377 | 363 | $this->files_inherit[$row['template_filename']] = $file; |
| 378 | 364 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 379 | - } |
|
| 380 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 365 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 381 | 366 | { |
| 382 | 367 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
| 383 | 368 | $force_reload = true; |
| 384 | 369 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 385 | 370 | } |
| 386 | - } |
|
| 387 | - else |
|
| 371 | + } else |
|
| 388 | 372 | { |
| 389 | 373 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
| 390 | 374 | } |
@@ -394,8 +378,7 @@ discard block |
||
| 394 | 378 | if ($row['template_filename'] == $this->filename[$handle]) |
| 395 | 379 | { |
| 396 | 380 | $compile->_tpl_load_file($handle, true); |
| 397 | - } |
|
| 398 | - else |
|
| 381 | + } else |
|
| 399 | 382 | { |
| 400 | 383 | $this->files[$row['template_filename']] = $file; |
| 401 | 384 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -410,8 +393,7 @@ discard block |
||
| 410 | 393 | { |
| 411 | 394 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
| 412 | 395 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
| 413 | - } |
|
| 414 | - else |
|
| 396 | + } else |
|
| 415 | 397 | { |
| 416 | 398 | // Only bother compiling if it doesn't already exist |
| 417 | 399 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -422,8 +404,7 @@ discard block |
||
| 422 | 404 | } |
| 423 | 405 | } |
| 424 | 406 | } |
| 425 | - } |
|
| 426 | - else |
|
| 407 | + } else |
|
| 427 | 408 | { |
| 428 | 409 | $file = $this->root . '/' . $row['template_filename']; |
| 429 | 410 | |
@@ -450,8 +431,7 @@ discard block |
||
| 450 | 431 | * Assign key variable pairs from an array |
| 451 | 432 | * @access public |
| 452 | 433 | */ |
| 453 | - public function assign_vars($vararray) |
|
| 454 | - { |
|
| 434 | + public function assign_vars($vararray) { |
|
| 455 | 435 | foreach ($vararray as $key => $val) |
| 456 | 436 | { |
| 457 | 437 | $this->_rootref[$key] = $val; |
@@ -464,8 +444,7 @@ discard block |
||
| 464 | 444 | * Assign a single variable to a single key |
| 465 | 445 | * @access public |
| 466 | 446 | */ |
| 467 | - public function assign_var($varname, $varval) |
|
| 468 | - { |
|
| 447 | + public function assign_var($varname, $varval) { |
|
| 469 | 448 | $this->_rootref[$varname] = $varval; |
| 470 | 449 | |
| 471 | 450 | return true; |
@@ -475,8 +454,7 @@ discard block |
||
| 475 | 454 | * Assign key variable pairs from an array to a specified block |
| 476 | 455 | * @access public |
| 477 | 456 | */ |
| 478 | - public function assign_block_vars($blockname, $vararray) |
|
| 479 | - { |
|
| 457 | + public function assign_block_vars($blockname, $vararray) { |
|
| 480 | 458 | if (strpos($blockname, '.') !== false) |
| 481 | 459 | { |
| 482 | 460 | // Nested block. |
@@ -511,8 +489,7 @@ discard block |
||
| 511 | 489 | // We're adding a new iteration to this block with the given |
| 512 | 490 | // variable assignments. |
| 513 | 491 | $str[$blocks[$blockcount]][] = $vararray; |
| 514 | - } |
|
| 515 | - else |
|
| 492 | + } else |
|
| 516 | 493 | { |
| 517 | 494 | // Top-level block. |
| 518 | 495 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -566,8 +543,7 @@ discard block |
||
| 566 | 543 | * @return bool false on error, true on success |
| 567 | 544 | * @access public |
| 568 | 545 | */ |
| 569 | - public function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
|
| 570 | - { |
|
| 546 | + public function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') { |
|
| 571 | 547 | if (strpos($blockname, '.') !== false) |
| 572 | 548 | { |
| 573 | 549 | // Nested blocks are not supported |
@@ -612,8 +588,7 @@ discard block |
||
| 612 | 588 | $key = sizeof($this->_tpldata[$blockname]); |
| 613 | 589 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
| 614 | 590 | $vararray['S_LAST_ROW'] = true; |
| 615 | - } |
|
| 616 | - else if ($key === 0) |
|
| 591 | + } else if ($key === 0) |
|
| 617 | 592 | { |
| 618 | 593 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
| 619 | 594 | $vararray['S_FIRST_ROW'] = true; |
@@ -652,8 +627,7 @@ discard block |
||
| 652 | 627 | * Include a separate template |
| 653 | 628 | * @access private |
| 654 | 629 | */ |
| 655 | - public function _tpl_include($filename, $include = true) |
|
| 656 | - { |
|
| 630 | + public function _tpl_include($filename, $include = true) { |
|
| 657 | 631 | $handle = $filename; |
| 658 | 632 | $this->filename[$handle] = $filename; |
| 659 | 633 | $this->files[$handle] = $this->root . '/' . $filename; |
@@ -681,8 +655,7 @@ discard block |
||
| 681 | 655 | * Include a php-file |
| 682 | 656 | * @access private |
| 683 | 657 | */ |
| 684 | - public function _php_include($filename) |
|
| 685 | - { |
|
| 658 | + public function _php_include($filename) { |
|
| 686 | 659 | global $phpbb_root_path; |
| 687 | 660 | |
| 688 | 661 | $file = $phpbb_root_path . $filename; |
@@ -700,8 +673,7 @@ discard block |
||
| 700 | 673 | * Assign key variable pairs from an array with block support |
| 701 | 674 | * @access public |
| 702 | 675 | */ |
| 703 | - public function assign_recursive($values, $name = '') |
|
| 704 | - { |
|
| 676 | + public function assign_recursive($values, $name = '') { |
|
| 705 | 677 | if(isset($values['.'])) |
| 706 | 678 | { |
| 707 | 679 | $values_extra = $values['.']; |
@@ -711,8 +683,7 @@ discard block |
||
| 711 | 683 | if(!$name) |
| 712 | 684 | { |
| 713 | 685 | $this->assign_vars($values); |
| 714 | - } |
|
| 715 | - else |
|
| 686 | + } else |
|
| 716 | 687 | { |
| 717 | 688 | $this->assign_block_vars($name, $values); |
| 718 | 689 | } |
@@ -35,8 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @package phpBB3 |
| 37 | 37 | */ |
| 38 | -class template_compile |
|
| 39 | -{ |
|
| 38 | +class template_compile { |
|
| 40 | 39 | var $template; |
| 41 | 40 | |
| 42 | 41 | // Various storage arrays |
@@ -46,8 +45,7 @@ discard block |
||
| 46 | 45 | /** |
| 47 | 46 | * constuctor |
| 48 | 47 | */ |
| 49 | - public function template_compile(&$template) |
|
| 50 | - { |
|
| 48 | + public function template_compile(&$template) { |
|
| 51 | 49 | $this->template = &$template; |
| 52 | 50 | } |
| 53 | 51 | |
@@ -55,8 +53,7 @@ discard block |
||
| 55 | 53 | * Load template source from file |
| 56 | 54 | * @access private |
| 57 | 55 | */ |
| 58 | - public function _tpl_load_file($handle, $store_in_db = false) |
|
| 59 | - { |
|
| 56 | + public function _tpl_load_file($handle, $store_in_db = false) { |
|
| 60 | 57 | // Try and open template for read |
| 61 | 58 | if (!file_exists($this->template->files[$handle])) |
| 62 | 59 | { |
@@ -64,8 +61,7 @@ discard block |
||
| 64 | 61 | { |
| 65 | 62 | return; |
| 66 | 63 | trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR); |
| 67 | - } |
|
| 68 | - else |
|
| 64 | + } else |
|
| 69 | 65 | { |
| 70 | 66 | $this->template->files[$handle] = $this->template->files_inherit[$handle]; |
| 71 | 67 | } |
@@ -101,8 +97,7 @@ discard block |
||
| 101 | 97 | * the ones that exist in zend_language_scanner.l |
| 102 | 98 | * @access private |
| 103 | 99 | */ |
| 104 | - public function remove_php_tags(&$code) |
|
| 105 | - { |
|
| 100 | + public function remove_php_tags(&$code) { |
|
| 106 | 101 | // This matches the information gathered from the internal PHP lexer |
| 107 | 102 | $match = array( |
| 108 | 103 | '#<([\?%])=?.*?\1>#s', |
@@ -117,8 +112,7 @@ discard block |
||
| 117 | 112 | * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
| 118 | 113 | * @access private |
| 119 | 114 | */ |
| 120 | - public function compile($code, $no_echo = false, $echo_var = '') |
|
| 121 | - { |
|
| 115 | + public function compile($code, $no_echo = false, $echo_var = '') { |
|
| 122 | 116 | if ($echo_var) |
| 123 | 117 | { |
| 124 | 118 | global $$echo_var; |
@@ -221,15 +215,13 @@ discard block |
||
| 221 | 215 | $var = substr($temp, 2, -1); |
| 222 | 216 | //$file = $this->template->_tpldata['DEFINE']['.'][$var]; |
| 223 | 217 | $temp = "\$this->_tpldata['DEFINE']['.']['$var']"; |
| 224 | - } |
|
| 225 | - else |
|
| 218 | + } else |
|
| 226 | 219 | { |
| 227 | 220 | $var = substr($temp, 1, -1); |
| 228 | 221 | //$file = $this->template->_rootref[$var]; |
| 229 | 222 | $temp = "\$this->_rootref['$var']"; |
| 230 | 223 | } |
| 231 | - } |
|
| 232 | - else |
|
| 224 | + } else |
|
| 233 | 225 | { |
| 234 | 226 | $file = $temp; |
| 235 | 227 | } |
@@ -288,8 +280,7 @@ discard block |
||
| 288 | 280 | * Compile variables |
| 289 | 281 | * @access private |
| 290 | 282 | */ |
| 291 | - public function compile_var_tags(&$text_blocks) |
|
| 292 | - { |
|
| 283 | + public function compile_var_tags(&$text_blocks) { |
|
| 293 | 284 | // change template varrefs into PHP varrefs |
| 294 | 285 | $varrefs = array(); |
| 295 | 286 | |
@@ -350,8 +341,7 @@ discard block |
||
| 350 | 341 | * Compile blocks |
| 351 | 342 | * @access private |
| 352 | 343 | */ |
| 353 | - public function compile_tag_block($tag_args) |
|
| 354 | - { |
|
| 344 | + public function compile_tag_block($tag_args) { |
|
| 355 | 345 | $no_nesting = false; |
| 356 | 346 | |
| 357 | 347 | // Is the designer wanting to call another loop in a loop? |
@@ -374,8 +364,7 @@ discard block |
||
| 374 | 364 | if ($match[2] < 0) |
| 375 | 365 | { |
| 376 | 366 | $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; |
| 377 | - } |
|
| 378 | - else |
|
| 367 | + } else |
|
| 379 | 368 | { |
| 380 | 369 | $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; |
| 381 | 370 | } |
@@ -383,17 +372,14 @@ discard block |
||
| 383 | 372 | if (strlen($match[3]) < 1 || $match[3] == -1) |
| 384 | 373 | { |
| 385 | 374 | $loop_end = '$_' . $tag_args . '_count'; |
| 386 | - } |
|
| 387 | - else if ($match[3] >= 0) |
|
| 375 | + } else if ($match[3] >= 0) |
|
| 388 | 376 | { |
| 389 | 377 | $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; |
| 390 | - } |
|
| 391 | - else //if ($match[3] < -1) |
|
| 378 | + } else //if ($match[3] < -1) |
|
| 392 | 379 | { |
| 393 | 380 | $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); |
| 394 | 381 | } |
| 395 | - } |
|
| 396 | - else |
|
| 382 | + } else |
|
| 397 | 383 | { |
| 398 | 384 | $loop_start = 0; |
| 399 | 385 | $loop_end = '$_' . $tag_args . '_count'; |
@@ -406,8 +392,7 @@ discard block |
||
| 406 | 392 | { |
| 407 | 393 | // We need to implode $no_nesting times from the end... |
| 408 | 394 | $block = array_slice($this->block_names, -$no_nesting); |
| 409 | - } |
|
| 410 | - else |
|
| 395 | + } else |
|
| 411 | 396 | { |
| 412 | 397 | $block = $this->block_names; |
| 413 | 398 | } |
@@ -417,8 +402,7 @@ discard block |
||
| 417 | 402 | // Block is not nested. |
| 418 | 403 | $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; |
| 419 | 404 | $varref = "\$this->_tpldata['$tag_args']"; |
| 420 | - } |
|
| 421 | - else |
|
| 405 | + } else |
|
| 422 | 406 | { |
| 423 | 407 | // This block is nested. |
| 424 | 408 | // Generate a namespace string for this block. |
@@ -457,8 +441,7 @@ discard block |
||
| 457 | 441 | * some adaptions for our block level methods |
| 458 | 442 | * @access private |
| 459 | 443 | */ |
| 460 | - public function compile_tag_if($tag_args, $elseif) |
|
| 461 | - { |
|
| 444 | + public function compile_tag_if($tag_args, $elseif) { |
|
| 462 | 445 | // Tokenize args for 'if' tag. |
| 463 | 446 | preg_match_all('/(?: |
| 464 | 447 | "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | |
@@ -566,8 +549,7 @@ discard block |
||
| 566 | 549 | if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs)) |
| 567 | 550 | { |
| 568 | 551 | $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] . '\']'); |
| 569 | - } |
|
| 570 | - else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 552 | + } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 571 | 553 | { |
| 572 | 554 | // Allow checking if loops are set with .loopname |
| 573 | 555 | // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example |
@@ -583,8 +565,7 @@ discard block |
||
| 583 | 565 | |
| 584 | 566 | // Add the block reference for the last child. |
| 585 | 567 | $varref .= "['" . $block . "']"; |
| 586 | - } |
|
| 587 | - else |
|
| 568 | + } else |
|
| 588 | 569 | { |
| 589 | 570 | $varref = '$this->_tpldata'; |
| 590 | 571 | |
@@ -592,8 +573,7 @@ discard block |
||
| 592 | 573 | $varref .= "['" . $blocks[0] . "']"; |
| 593 | 574 | } |
| 594 | 575 | $token = "sizeof($varref)"; |
| 595 | - } |
|
| 596 | - else if (!empty($token)) |
|
| 576 | + } else if (!empty($token)) |
|
| 597 | 577 | { |
| 598 | 578 | $token = '(' . $token . ')'; |
| 599 | 579 | } |
@@ -614,8 +594,7 @@ discard block |
||
| 614 | 594 | * Compile DEFINE tags |
| 615 | 595 | * @access private |
| 616 | 596 | */ |
| 617 | - public function compile_tag_define($tag_args, $op) |
|
| 618 | - { |
|
| 597 | + public function compile_tag_define($tag_args, $op) { |
|
| 619 | 598 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
| 620 | 599 | |
| 621 | 600 | if (empty($match[2]) || (!isset($match[4]) && $op)) |
@@ -638,8 +617,7 @@ discard block |
||
| 638 | 617 | |
| 639 | 618 | // Now replace the php code |
| 640 | 619 | $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'"; |
| 641 | - } |
|
| 642 | - else |
|
| 620 | + } else |
|
| 643 | 621 | { |
| 644 | 622 | preg_match('#true|false|\.#i', $match[4], $type); |
| 645 | 623 | |
@@ -667,8 +645,7 @@ discard block |
||
| 667 | 645 | * Compile INCLUDE tag |
| 668 | 646 | * @access private |
| 669 | 647 | */ |
| 670 | - public function compile_tag_include($tag_args) |
|
| 671 | - { |
|
| 648 | + public function compile_tag_include($tag_args) { |
|
| 672 | 649 | // Process dynamic includes |
| 673 | 650 | if ($tag_args[0] == '$') |
| 674 | 651 | { |
@@ -682,8 +659,7 @@ discard block |
||
| 682 | 659 | * Compile INCLUDE_PHP tag |
| 683 | 660 | * @access private |
| 684 | 661 | */ |
| 685 | - public function compile_tag_include_php($tag_args) |
|
| 686 | - { |
|
| 662 | + public function compile_tag_include_php($tag_args) { |
|
| 687 | 663 | return "\$this->_php_include('$tag_args');"; |
| 688 | 664 | } |
| 689 | 665 | |
@@ -692,8 +668,7 @@ discard block |
||
| 692 | 668 | * This is from Smarty |
| 693 | 669 | * @access private |
| 694 | 670 | */ |
| 695 | - public function _parse_is_expr($is_arg, $tokens) |
|
| 696 | - { |
|
| 671 | + public function _parse_is_expr($is_arg, $tokens) { |
|
| 697 | 672 | $expr_end = 0; |
| 698 | 673 | $negate_expr = false; |
| 699 | 674 | |
@@ -701,8 +676,7 @@ discard block |
||
| 701 | 676 | { |
| 702 | 677 | $negate_expr = true; |
| 703 | 678 | $expr_type = array_shift($tokens); |
| 704 | - } |
|
| 705 | - else |
|
| 679 | + } else |
|
| 706 | 680 | { |
| 707 | 681 | $expr_type = $first_token; |
| 708 | 682 | } |
@@ -716,8 +690,7 @@ discard block |
||
| 716 | 690 | $expr_end++; |
| 717 | 691 | $expr_arg = $tokens[$expr_end++]; |
| 718 | 692 | $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; |
| 719 | - } |
|
| 720 | - else |
|
| 693 | + } else |
|
| 721 | 694 | { |
| 722 | 695 | $expr = "!($is_arg & 1)"; |
| 723 | 696 | } |
@@ -729,8 +702,7 @@ discard block |
||
| 729 | 702 | $expr_end++; |
| 730 | 703 | $expr_arg = $tokens[$expr_end++]; |
| 731 | 704 | $expr = "(($is_arg / $expr_arg) % $expr_arg)"; |
| 732 | - } |
|
| 733 | - else |
|
| 705 | + } else |
|
| 734 | 706 | { |
| 735 | 707 | $expr = "($is_arg & 1)"; |
| 736 | 708 | } |
@@ -764,8 +736,7 @@ discard block |
||
| 764 | 736 | * NOTE: expects a trailing "." on the namespace. |
| 765 | 737 | * @access private |
| 766 | 738 | */ |
| 767 | - public function generate_block_varref($namespace, $varname, $echo = true, $defop = false) |
|
| 768 | - { |
|
| 739 | + public function generate_block_varref($namespace, $varname, $echo = true, $defop = false) { |
|
| 769 | 740 | // Strip the trailing period. |
| 770 | 741 | $namespace = substr($namespace, 0, -1); |
| 771 | 742 | |
@@ -789,8 +760,7 @@ discard block |
||
| 789 | 760 | * NOTE: does not expect a trailing "." on the blockname. |
| 790 | 761 | * @access private |
| 791 | 762 | */ |
| 792 | - public function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
|
| 793 | - { |
|
| 763 | + public function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) { |
|
| 794 | 764 | // Get an array of the blocks involved. |
| 795 | 765 | $blocks = explode('.', $blockname); |
| 796 | 766 | $blockcount = sizeof($blocks) - 1; |
@@ -812,12 +782,10 @@ discard block |
||
| 812 | 782 | $varref .= '[$_' . $blocks[$blockcount] . '_i]'; |
| 813 | 783 | } |
| 814 | 784 | return $varref; |
| 815 | - } |
|
| 816 | - else if ($include_last_iterator) |
|
| 785 | + } else if ($include_last_iterator) |
|
| 817 | 786 | { |
| 818 | 787 | return '$_'. $blocks[$blockcount] . '_val'; |
| 819 | - } |
|
| 820 | - else |
|
| 788 | + } else |
|
| 821 | 789 | { |
| 822 | 790 | return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
| 823 | 791 | } |
@@ -827,8 +795,7 @@ discard block |
||
| 827 | 795 | * Write compiled file to cache directory |
| 828 | 796 | * @access private |
| 829 | 797 | */ |
| 830 | - public function compile_write($handle, $data) |
|
| 831 | - { |
|
| 798 | + public function compile_write($handle, $data) { |
|
| 832 | 799 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
| 833 | 800 | |
| 834 | 801 | $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data); |
@@ -851,8 +818,7 @@ discard block |
||
| 851 | 818 | /** |
| 852 | 819 | * Minifies template w/i PHP code by removing extra spaces |
| 853 | 820 | */ |
| 854 | - private function minify($html) |
|
| 855 | - { |
|
| 821 | + private function minify($html) { |
|
| 856 | 822 | if(!classSupernova::$config->tpl_minifier) |
| 857 | 823 | { |
| 858 | 824 | return $html; |
@@ -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 | * |
@@ -31,8 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @author Fabien Potencier |
| 33 | 33 | */ |
| 34 | -class Container implements \ArrayAccess |
|
| 35 | -{ |
|
| 34 | +class Container implements \ArrayAccess { |
|
| 36 | 35 | private $values = array(); |
| 37 | 36 | private $factories; |
| 38 | 37 | private $protected; |
@@ -47,8 +46,7 @@ discard block |
||
| 47 | 46 | * |
| 48 | 47 | * @param array $values The parameters or objects. |
| 49 | 48 | */ |
| 50 | - public function __construct(array $values = array()) |
|
| 51 | - { |
|
| 49 | + public function __construct(array $values = array()) { |
|
| 52 | 50 | $this->factories = new \SplObjectStorage(); |
| 53 | 51 | $this->protected = new \SplObjectStorage(); |
| 54 | 52 | |
@@ -71,8 +69,7 @@ discard block |
||
| 71 | 69 | * |
| 72 | 70 | * @throws \RuntimeException Prevent override of a frozen service |
| 73 | 71 | */ |
| 74 | - public function offsetSet($id, $value) |
|
| 75 | - { |
|
| 72 | + public function offsetSet($id, $value) { |
|
| 76 | 73 | if (isset($this->frozen[$id])) { |
| 77 | 74 | throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); |
| 78 | 75 | } |
@@ -90,8 +87,7 @@ discard block |
||
| 90 | 87 | * |
| 91 | 88 | * @throws \InvalidArgumentException if the identifier is not defined |
| 92 | 89 | */ |
| 93 | - public function offsetGet($id) |
|
| 94 | - { |
|
| 90 | + public function offsetGet($id) { |
|
| 95 | 91 | if (!isset($this->keys[$id])) { |
| 96 | 92 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
| 97 | 93 | } |
@@ -125,8 +121,7 @@ discard block |
||
| 125 | 121 | * |
| 126 | 122 | * @return bool |
| 127 | 123 | */ |
| 128 | - public function offsetExists($id) |
|
| 129 | - { |
|
| 124 | + public function offsetExists($id) { |
|
| 130 | 125 | return isset($this->keys[$id]); |
| 131 | 126 | } |
| 132 | 127 | |
@@ -135,8 +130,7 @@ discard block |
||
| 135 | 130 | * |
| 136 | 131 | * @param string $id The unique identifier for the parameter or object |
| 137 | 132 | */ |
| 138 | - public function offsetUnset($id) |
|
| 139 | - { |
|
| 133 | + public function offsetUnset($id) { |
|
| 140 | 134 | if (isset($this->keys[$id])) { |
| 141 | 135 | if (is_object($this->values[$id])) { |
| 142 | 136 | unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); |
@@ -155,8 +149,7 @@ discard block |
||
| 155 | 149 | * |
| 156 | 150 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
| 157 | 151 | */ |
| 158 | - public function factory($callable) |
|
| 159 | - { |
|
| 152 | + public function factory($callable) { |
|
| 160 | 153 | if (!method_exists($callable, '__invoke')) { |
| 161 | 154 | throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); |
| 162 | 155 | } |
@@ -177,8 +170,7 @@ discard block |
||
| 177 | 170 | * |
| 178 | 171 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
| 179 | 172 | */ |
| 180 | - public function protect($callable) |
|
| 181 | - { |
|
| 173 | + public function protect($callable) { |
|
| 182 | 174 | if (!method_exists($callable, '__invoke')) { |
| 183 | 175 | throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); |
| 184 | 176 | } |
@@ -197,8 +189,7 @@ discard block |
||
| 197 | 189 | * |
| 198 | 190 | * @throws \InvalidArgumentException if the identifier is not defined |
| 199 | 191 | */ |
| 200 | - public function raw($id) |
|
| 201 | - { |
|
| 192 | + public function raw($id) { |
|
| 202 | 193 | if (!isset($this->keys[$id])) { |
| 203 | 194 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
| 204 | 195 | } |
@@ -223,8 +214,7 @@ discard block |
||
| 223 | 214 | * |
| 224 | 215 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
| 225 | 216 | */ |
| 226 | - public function extend($id, $callable) |
|
| 227 | - { |
|
| 217 | + public function extend($id, $callable) { |
|
| 228 | 218 | if (!isset($this->keys[$id])) { |
| 229 | 219 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
| 230 | 220 | } |
@@ -256,8 +246,7 @@ discard block |
||
| 256 | 246 | * |
| 257 | 247 | * @return array An array of value names |
| 258 | 248 | */ |
| 259 | - public function keys() |
|
| 260 | - { |
|
| 249 | + public function keys() { |
|
| 261 | 250 | return array_keys($this->values); |
| 262 | 251 | } |
| 263 | 252 | |
@@ -269,8 +258,7 @@ discard block |
||
| 269 | 258 | * |
| 270 | 259 | * @return static |
| 271 | 260 | */ |
| 272 | - public function register(ServiceProviderInterface $provider, array $values = array()) |
|
| 273 | - { |
|
| 261 | + public function register(ServiceProviderInterface $provider, array $values = array()) { |
|
| 274 | 262 | $provider->register($this); |
| 275 | 263 | |
| 276 | 264 | foreach ($values as $key => $value) { |