From: Meik S. <acy...@ph...> - 2009-08-30 11:15:41
|
Author: acydburn Date: Sun Aug 30 12:15:24 2009 New Revision: 10064 Log: Revert INC/DEC feature. It is not consistent with the other template variables - bad idea. ;) We will get to it though... but not now. Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html branches/phpBB-3_0_0/phpBB/includes/functions_template.php Modified: branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html (original) --- branches/phpBB-3_0_0/phpBB/docs/CHANGELOG.html Sun Aug 30 12:15:24 2009 *************** *** 282,288 **** <li>[Feature] Separate PM Reply and PM Reply to all in prosilver.</li> <li>[Feature] Place debug notices during captcha rendering in the error log - useful for debugging output already started errors.</li> <li>[Feature] Ability to define constant PHPBB_USE_BOARD_URL_PATH to use board url for images/avatars/ranks/imageset...</li> - <li>[Feature] Added INC/DEC command to template syntax, applicable to DEFINES and normal template variables, including loops.</li> <li>[Feature] Added function to generate email-hash. (Bug #49195)</li> </ul> --- 282,287 ---- Modified: branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html ============================================================================== *** branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html (original) --- branches/phpBB-3_0_0/phpBB/docs/coding-guidelines.html Sun Aug 30 12:15:24 2009 *************** *** 1176,1182 **** <span class="comment"><!-- DEFINE $SOME_VAR = 'my_file.html' --></span> <span class="comment"><!-- INCLUDE {$SOME_VAR} --></span> </pre></div> ! <p>Also added in <strong>3.0.6</strong> is the ability to increment or decrement a variable on use. This can be used for instances like tabindexes, where the amount of entries is not statically known. The INC (for incrementing) and DEC (for decrementing) commands will print the <strong>current</strong> state of a defined var and then increment/decrement it by one (postincrement/postdecrement).</p> --- 1176,1182 ---- <span class="comment"><!-- DEFINE $SOME_VAR = 'my_file.html' --></span> <span class="comment"><!-- INCLUDE {$SOME_VAR} --></span> </pre></div> ! <!-- no longer added in 3.0.6 <p>Also added in <strong>3.0.6</strong> is the ability to increment or decrement a variable on use. This can be used for instances like tabindexes, where the amount of entries is not statically known. The INC (for incrementing) and DEC (for decrementing) commands will print the <strong>current</strong> state of a defined var and then increment/decrement it by one (postincrement/postdecrement).</p> *************** *** 1187,1193 **** <span class="comment">{$SOME_VAR}</span> Result: 2<br /> </pre></div> ! <h4>PHP</h4> <p>A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:</p> --- 1187,1193 ---- <span class="comment">{$SOME_VAR}</span> Result: 2<br /> </pre></div> ! //--> <h4>PHP</h4> <p>A contentious decision has seen the ability to include PHP within the template introduced. This is achieved by enclosing the PHP within relevant tags:</p> Modified: branches/phpBB-3_0_0/phpBB/includes/functions_template.php ============================================================================== *** branches/phpBB-3_0_0/phpBB/includes/functions_template.php (original) --- branches/phpBB-3_0_0/phpBB/includes/functions_template.php Sun Aug 30 12:15:24 2009 *************** *** 191,204 **** $compile_blocks[] = '<?php ' . $this->compile_tag_define($block_val[2], false) . ' ?>'; break; - case 'INC': - $compile_blocks[] = '<?php ' . $this->compile_tag_counter($block_val[2], '++') . ' ?>'; - break; - - case 'DEC': - $compile_blocks[] = '<?php ' . $this->compile_tag_counter($block_val[2], '--') . ' ?>'; - break; - case 'INCLUDE': $temp = array_shift($include_blocks); --- 191,196 ---- *************** *** 634,661 **** return (($match[1]) ? $this->generate_block_data_ref(substr($match[1], 0, -1), true, true) . '[\'' . $match[2] . '\']' : '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $match[2] . '\']') . ' = ' . $match[4] . ';'; } - - /** - * Compile INC/DEC tags - * INC/DEC tags support defined template variables as well as normal template variables - * @access private - */ - function compile_tag_counter($tag_args, $operation = '++') - { - preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Z])([A-Z0-9\-_]+)#s', $tag_args, $varrefs); - - if (empty($varrefs[0])) - { - return ''; - } - - // Build token - $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] . '\']'); - - // Increase or decrease token ;) - return "echo {$token}{$operation};"; - } - /** * Compile INCLUDE tag * @access private --- 626,631 ---- |