Test Failed
Branch trunk (c9c94d)
by SuperNova.WS
10:03 queued 05:45
created
classes/template_compile.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     global $config;
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
   }
291 291
 
292 292
   /**
293
-  * Compile variables
294
-  * @access private
295
-  */
293
+   * Compile variables
294
+   * @access private
295
+   */
296 296
   function compile_var_tags(&$text_blocks)
297 297
   {
298 298
     // including $lang variable
@@ -359,9 +359,9 @@  discard block
 block discarded – undo
359 359
   }
360 360
 
361 361
   /**
362
-  * Compile blocks
363
-  * @access private
364
-  */
362
+   * Compile blocks
363
+   * @access private
364
+   */
365 365
   function compile_tag_block($tag_args)
366 366
   {
367 367
     $no_nesting = false;
@@ -447,14 +447,14 @@  discard block
 block discarded – undo
447 447
     $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
448 448
 
449 449
     /**
450
-    * 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
451
-    * <code>
452
-    * if (!$offset)
453
-    * {
454
-    *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
455
-    * }
456
-    * </code>
457
-    */
450
+     * 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
451
+     * <code>
452
+     * if (!$offset)
453
+     * {
454
+     *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
455
+     * }
456
+     * </code>
457
+     */
458 458
 
459 459
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
460 460
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
@@ -465,10 +465,10 @@  discard block
 block discarded – undo
465 465
   }
466 466
 
467 467
   /**
468
-  * Compile IF tags - much of this is from Smarty with
469
-  * some adaptions for our block level methods
470
-  * @access private
471
-  */
468
+   * Compile IF tags - much of this is from Smarty with
469
+   * some adaptions for our block level methods
470
+   * @access private
471
+   */
472 472
   function compile_tag_if($tag_args, $elseif)
473 473
   {
474 474
     // Tokenize args for 'if' tag.
@@ -623,9 +623,9 @@  discard block
 block discarded – undo
623 623
   }
624 624
 
625 625
   /**
626
-  * Compile DEFINE tags
627
-  * @access private
628
-  */
626
+   * Compile DEFINE tags
627
+   * @access private
628
+   */
629 629
   function compile_tag_define($tag_args, $op)
630 630
   {
631 631
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
@@ -676,9 +676,9 @@  discard block
 block discarded – undo
676 676
   }
677 677
 
678 678
   /**
679
-  * Compile INCLUDE tag
680
-  * @access private
681
-  */
679
+   * Compile INCLUDE tag
680
+   * @access private
681
+   */
682 682
   function compile_tag_include($tag_args)
683 683
   {
684 684
     // Process dynamic includes
@@ -691,19 +691,19 @@  discard block
 block discarded – undo
691 691
   }
692 692
 
693 693
   /**
694
-  * Compile INCLUDE_PHP tag
695
-  * @access private
696
-  */
694
+   * Compile INCLUDE_PHP tag
695
+   * @access private
696
+   */
697 697
   function compile_tag_include_php($tag_args)
698 698
   {
699 699
     return "\$this->_php_include('$tag_args');";
700 700
   }
701 701
 
702 702
   /**
703
-  * parse expression
704
-  * This is from Smarty
705
-  * @access private
706
-  */
703
+   * parse expression
704
+   * This is from Smarty
705
+   * @access private
706
+   */
707 707
   function _parse_is_expr($is_arg, $tokens)
708 708
   {
709 709
     $expr_end = 0;
@@ -768,13 +768,13 @@  discard block
 block discarded – undo
768 768
   }
769 769
 
770 770
   /**
771
-  * Generates a reference to the given variable inside the given (possibly nested)
772
-  * block namespace. This is a string of the form:
773
-  * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
774
-  * It's ready to be inserted into an "echo" line in one of the templates.
775
-  * NOTE: expects a trailing "." on the namespace.
776
-  * @access private
777
-  */
771
+   * Generates a reference to the given variable inside the given (possibly nested)
772
+   * block namespace. This is a string of the form:
773
+   * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
774
+   * It's ready to be inserted into an "echo" line in one of the templates.
775
+   * NOTE: expects a trailing "." on the namespace.
776
+   * @access private
777
+   */
778 778
   function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
779 779
   {
780 780
     // Strip the trailing period.
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
   }
793 793
 
794 794
   /**
795
-  * Generates a reference to the array of data values for the given
796
-  * (possibly nested) block namespace. This is a string of the form:
797
-  * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
798
-  *
799
-  * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
800
-  * NOTE: does not expect a trailing "." on the blockname.
801
-  * @access private
802
-  */
795
+   * Generates a reference to the array of data values for the given
796
+   * (possibly nested) block namespace. This is a string of the form:
797
+   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
798
+   *
799
+   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
800
+   * NOTE: does not expect a trailing "." on the blockname.
801
+   * @access private
802
+   */
803 803
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
804 804
   {
805 805
     // Get an array of the blocks involved.
@@ -835,9 +835,9 @@  discard block
 block discarded – undo
835 835
   }
836 836
 
837 837
   /**
838
-  * Write compiled file to cache directory
839
-  * @access private
840
-  */
838
+   * Write compiled file to cache directory
839
+   * @access private
840
+   */
841 841
   function compile_write($handle, $data)
842 842
   {
843 843
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
@@ -860,9 +860,9 @@  discard block
 block discarded – undo
860 860
 
861 861
   // Gorlum's minifier BOF
862 862
   /**
863
-  * Minifies template w/i PHP code by removing extra spaces
864
-  * @access private
865
-  */
863
+   * Minifies template w/i PHP code by removing extra spaces
864
+   * @access private
865
+   */
866 866
   function minify($html)
867 867
   {
868 868
     global $config;
Please login to merge, or discard this patch.
classes/template.php 1 patch
Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 class template
26 26
 {
27 27
   /** variable that holds all the data we'll be substituting into
28
-  * the compiled templates. Takes form:
29
-  * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
30
-  * if it's a root-level variable, it'll be like this:
31
-  * --> $this->_tpldata[.][0][varname] == value
32
-  */
28
+   * the compiled templates. Takes form:
29
+   * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
30
+   * if it's a root-level variable, it'll be like this:
31
+   * --> $this->_tpldata[.][0][varname] == value
32
+   */
33 33
   var $_tpldata = array('.' => array(0 => array()));
34 34
   var $_rootref;
35 35
 //  var $_block_counter = array();
@@ -79,9 +79,9 @@  discard block
 block discarded – undo
79 79
   }
80 80
 
81 81
   /**
82
-  * Set template location
83
-  * @access public
84
-  */
82
+   * Set template location
83
+   * @access public
84
+   */
85 85
   function set_template()
86 86
   {
87 87
     global $user;
@@ -120,9 +120,9 @@  discard block
 block discarded – undo
120 120
   }
121 121
 
122 122
   /**
123
-  * Set custom template location (able to use directory outside of phpBB)
124
-  * @access public
125
-  */
123
+   * Set custom template location (able to use directory outside of phpBB)
124
+   * @access public
125
+   */
126 126
   function set_custom_template($template_path, $template_name, $fallback_template_path = false)
127 127
   {
128 128
     global $user;
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
   }
162 162
 
163 163
   /**
164
-  * Sets the template filenames for handles. $filename_array
165
-  * should be a hash of handle => filename pairs.
166
-  * @access public
167
-  */
164
+   * Sets the template filenames for handles. $filename_array
165
+   * should be a hash of handle => filename pairs.
166
+   * @access public
167
+   */
168 168
   function set_filenames($filename_array)
169 169
   {
170 170
     if (!is_array($filename_array))
@@ -191,9 +191,9 @@  discard block
 block discarded – undo
191 191
   }
192 192
 
193 193
   /**
194
-  * Destroy template data set
195
-  * @access public
196
-  */
194
+   * Destroy template data set
195
+   * @access public
196
+   */
197 197
   function destroy()
198 198
   {
199 199
     $this->_tpldata = array('.' => array(0 => array()));
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
   }
202 202
 
203 203
   /**
204
-  * Reset/empty complete block
205
-  * @access public
206
-  */
204
+   * Reset/empty complete block
205
+   * @access public
206
+   */
207 207
   function destroy_block_vars($blockname)
208 208
   {
209 209
     if (strpos($blockname, '.') !== false)
@@ -231,14 +231,14 @@  discard block
 block discarded – undo
231 231
   }
232 232
 
233 233
   /**
234
-  * Display handle
235
-  * @access public
236
-  */
234
+   * Display handle
235
+   * @access public
236
+   */
237 237
   function display($handle, $include_once = true)
238 238
   {
239 239
     global $phpbb_hook,
240 240
           // This is used for accessing from compiled templates via include
241
-           $user, $lang, $config;
241
+            $user, $lang, $config;
242 242
 
243 243
     if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
244 244
     {
@@ -270,9 +270,9 @@  discard block
 block discarded – undo
270 270
   }
271 271
 
272 272
   /**
273
-  * Display the handle and assign the output to a template variable or return the compiled result.
274
-  * @access public
275
-  */
273
+   * Display the handle and assign the output to a template variable or return the compiled result.
274
+   * @access public
275
+   */
276 276
   function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
277 277
   {
278 278
     ob_start();
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
   }
291 291
 
292 292
   /**
293
-  * Load a compiled template if possible, if not, recompile it
294
-  * @access private
295
-  */
293
+   * Load a compiled template if possible, if not, recompile it
294
+   * @access private
295
+   */
296 296
   function _tpl_load(&$handle)
297 297
   {
298 298
     global $user, $config;
@@ -470,9 +470,9 @@  discard block
 block discarded – undo
470 470
   }
471 471
 
472 472
   /**
473
-  * Assign key variable pairs from an array
474
-  * @access public
475
-  */
473
+   * Assign key variable pairs from an array
474
+   * @access public
475
+   */
476 476
   function assign_vars($vararray)
477 477
   {
478 478
     foreach ($vararray as $key => $val)
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
   }
485 485
 
486 486
   /**
487
-  * Assign a single variable to a single key
488
-  * @access public
489
-  */
487
+   * Assign a single variable to a single key
488
+   * @access public
489
+   */
490 490
   function assign_var($varname, $varval)
491 491
   {
492 492
     $this->_rootref[$varname] = $varval;
@@ -495,9 +495,9 @@  discard block
 block discarded – undo
495 495
   }
496 496
 
497 497
   /**
498
-  * Assign key variable pairs from an array to a specified block
499
-  * @access public
500
-  */
498
+   * Assign key variable pairs from an array to a specified block
499
+   * @access public
500
+   */
501 501
   function assign_block_vars($blockname, $vararray)
502 502
   {
503 503
     if (strpos($blockname, '.') !== false)
@@ -562,33 +562,33 @@  discard block
 block discarded – undo
562 562
   }
563 563
 
564 564
   /**
565
-  * Change already assigned key variable pair (one-dimensional - single loop entry)
566
-  *
567
-  * An example of how to use this function:
568
-  * {@example alter_block_array.php}
569
-  *
570
-  * @param  string  $blockname  the blockname, for example 'loop'
571
-  * @param  array $vararray the var array to insert/add or merge
572
-  * @param  mixed $key    Key to search for
573
-  *
574
-  * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
575
-  *
576
-  * int: Position [the position to change or insert at directly given]
577
-  *
578
-  * If key is false the position is set to 0
579
-  * If key is true the position is set to the last entry
580
-  *
581
-  * @param  string  $mode   Mode to execute (valid modes are 'insert' and 'change')
582
-  *
583
-  * If insert, the vararray is inserted at the given position (position counting from zero).
584
-  * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
585
-  *
586
-  * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
587
-  * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
588
-  *
589
-  * @return bool false on error, true on success
590
-  * @access public
591
-  */
565
+   * Change already assigned key variable pair (one-dimensional - single loop entry)
566
+   *
567
+   * An example of how to use this function:
568
+   * {@example alter_block_array.php}
569
+   *
570
+   * @param  string  $blockname  the blockname, for example 'loop'
571
+   * @param  array $vararray the var array to insert/add or merge
572
+   * @param  mixed $key    Key to search for
573
+   *
574
+   * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
575
+   *
576
+   * int: Position [the position to change or insert at directly given]
577
+   *
578
+   * If key is false the position is set to 0
579
+   * If key is true the position is set to the last entry
580
+   *
581
+   * @param  string  $mode   Mode to execute (valid modes are 'insert' and 'change')
582
+   *
583
+   * If insert, the vararray is inserted at the given position (position counting from zero).
584
+   * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
585
+   *
586
+   * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
587
+   * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
588
+   *
589
+   * @return bool false on error, true on success
590
+   * @access public
591
+   */
592 592
   function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
593 593
   {
594 594
     if (strpos($blockname, '.') !== false)
@@ -672,9 +672,9 @@  discard block
 block discarded – undo
672 672
   }
673 673
 
674 674
   /**
675
-  * Include a separate template
676
-  * @access private
677
-  */
675
+   * Include a separate template
676
+   * @access private
677
+   */
678 678
   function _tpl_include($filename, $include = true)
679 679
   {
680 680
     global $lang, $config;
@@ -703,9 +703,9 @@  discard block
 block discarded – undo
703 703
   }
704 704
 
705 705
   /**
706
-  * Include a php-file
707
-  * @access private
708
-  */
706
+   * Include a php-file
707
+   * @access private
708
+   */
709 709
   function _php_include($filename)
710 710
   {
711 711
     $file = $this->rootPhysical . $filename;
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
720 720
   }
721 721
 
722 722
   /**
723
-  * Assign key variable pairs from an array with block support
724
-  * @access public
725
-  */
723
+   * Assign key variable pairs from an array with block support
724
+   * @access public
725
+   */
726 726
   function assign_recursive($values, $name = '')
727 727
   {
728 728
     if(isset($values['.']))
Please login to merge, or discard this patch.
includes/vars.php 1 patch
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -189,62 +189,62 @@  discard block
 block discarded – undo
189 189
   );
190 190
 
191 191
 $sn_message_class_list = array(
192
-   MSG_TYPE_NEW => array(
193
-     'name' => 'new_message',
194
-     'switchable' => false,
195
-     'email' => false,
196
-   ),
197
-   MSG_TYPE_ADMIN => array(
198
-     'name' => 'msg_admin',
199
-     'switchable' => false,
200
-     'email' => true,
201
-   ),
202
-   MSG_TYPE_PLAYER => array(
203
-     'name' => 'mnl_joueur',
204
-     'switchable' => false,
205
-     'email' => true,
206
-   ),
207
-   MSG_TYPE_ALLIANCE => array(
208
-     'name' => 'mnl_alliance',
209
-     'switchable' => false,
210
-     'email' => true,
211
-   ),
212
-   MSG_TYPE_SPY => array(
213
-     'name' => 'mnl_spy',
214
-     'switchable' => true,
215
-     'email' => true,
216
-   ),
217
-   MSG_TYPE_COMBAT => array(
218
-     'name' => 'mnl_attaque',
219
-     'switchable' => true,
220
-     'email' => true,
221
-   ),
222
-   MSG_TYPE_TRANSPORT => array(
223
-     'name' => 'mnl_transport',
224
-     'switchable' => true,
225
-     'email' => true,
226
-   ),
227
-   MSG_TYPE_RECYCLE => array(
228
-     'name' => 'mnl_exploit',
229
-     'switchable' => true,
230
-     'email' => true,
231
-   ),
232
-   MSG_TYPE_EXPLORE => array(
233
-     'name' => 'mnl_expedition',
234
-     'switchable' => true,
235
-     'email' => true,
236
-   ),
237
-   //     97 => 'mnl_general',
238
-   MSG_TYPE_QUE => array(
239
-     'name' => 'mnl_buildlist',
240
-     'switchable' => true,
241
-     'email' => true,
242
-   ),
243
-   MSG_TYPE_OUTBOX => array(
244
-     'name' => 'mnl_outbox',
245
-     'switchable' => false,
246
-     'email' => false,
247
-   ),
192
+    MSG_TYPE_NEW => array(
193
+      'name' => 'new_message',
194
+      'switchable' => false,
195
+      'email' => false,
196
+    ),
197
+    MSG_TYPE_ADMIN => array(
198
+      'name' => 'msg_admin',
199
+      'switchable' => false,
200
+      'email' => true,
201
+    ),
202
+    MSG_TYPE_PLAYER => array(
203
+      'name' => 'mnl_joueur',
204
+      'switchable' => false,
205
+      'email' => true,
206
+    ),
207
+    MSG_TYPE_ALLIANCE => array(
208
+      'name' => 'mnl_alliance',
209
+      'switchable' => false,
210
+      'email' => true,
211
+    ),
212
+    MSG_TYPE_SPY => array(
213
+      'name' => 'mnl_spy',
214
+      'switchable' => true,
215
+      'email' => true,
216
+    ),
217
+    MSG_TYPE_COMBAT => array(
218
+      'name' => 'mnl_attaque',
219
+      'switchable' => true,
220
+      'email' => true,
221
+    ),
222
+    MSG_TYPE_TRANSPORT => array(
223
+      'name' => 'mnl_transport',
224
+      'switchable' => true,
225
+      'email' => true,
226
+    ),
227
+    MSG_TYPE_RECYCLE => array(
228
+      'name' => 'mnl_exploit',
229
+      'switchable' => true,
230
+      'email' => true,
231
+    ),
232
+    MSG_TYPE_EXPLORE => array(
233
+      'name' => 'mnl_expedition',
234
+      'switchable' => true,
235
+      'email' => true,
236
+    ),
237
+    //     97 => 'mnl_general',
238
+    MSG_TYPE_QUE => array(
239
+      'name' => 'mnl_buildlist',
240
+      'switchable' => true,
241
+      'email' => true,
242
+    ),
243
+    MSG_TYPE_OUTBOX => array(
244
+      'name' => 'mnl_outbox',
245
+      'switchable' => false,
246
+      'email' => false,
247
+    ),
248 248
 );
249 249
 
250 250
 $sn_message_groups = array(
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
       SHIP_HUGE_DEATH_STAR => SHIP_HUGE_DEATH_STAR, SHIP_HUGE_SUPERNOVA => SHIP_HUGE_SUPERNOVA,
1097 1097
       SHIP_CARGO_SMALL => SHIP_CARGO_SMALL, SHIP_CARGO_BIG => SHIP_CARGO_BIG, SHIP_CARGO_SUPER => SHIP_CARGO_SUPER, SHIP_CARGO_HYPER => SHIP_CARGO_HYPER,
1098 1098
       SHIP_RECYCLER => SHIP_RECYCLER, SHIP_COLONIZER => SHIP_COLONIZER, SHIP_SPY => SHIP_SPY, SHIP_SATTELITE_SOLAR => SHIP_SATTELITE_SOLAR
1099
-     ),
1099
+      ),
1100 1100
     // Defensive building list
1101 1101
     'defense'   => array (UNIT_DEF_TURRET_MISSILE => UNIT_DEF_TURRET_MISSILE, UNIT_DEF_TURRET_LASER_SMALL => UNIT_DEF_TURRET_LASER_SMALL,
1102 1102
                           UNIT_DEF_TURRET_LASER_BIG => UNIT_DEF_TURRET_LASER_BIG, UNIT_DEF_TURRET_GAUSS => UNIT_DEF_TURRET_GAUSS,
Please login to merge, or discard this patch.