aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_template.php
diff options
context:
space:
mode:
authorChris Smith <toonarmy@phpbb.com>2008-11-23 16:01:33 +0000
committerChris Smith <toonarmy@phpbb.com>2008-11-23 16:01:33 +0000
commitaa3a2f565b81e2571f04be156c57aaf3074a1738 (patch)
tree6c1be1e2391e2f59fb6595986342e1a6712ab003 /phpBB/includes/functions_template.php
parent3bd6984785b53834ff3c61cd3452308539be2314 (diff)
downloadforums-aa3a2f565b81e2571f04be156c57aaf3074a1738.tar
forums-aa3a2f565b81e2571f04be156c57aaf3074a1738.tar.gz
forums-aa3a2f565b81e2571f04be156c57aaf3074a1738.tar.bz2
forums-aa3a2f565b81e2571f04be156c57aaf3074a1738.tar.xz
forums-aa3a2f565b81e2571f04be156c57aaf3074a1738.zip
Why did I not do it this way to begin with :)
git-svn-id: file:///svn/phpbb/trunk@9097 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions_template.php')
-rw-r--r--phpBB/includes/functions_template.php70
1 files changed, 38 insertions, 32 deletions
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php
index d13ffc04a4..da11ff6e89 100644
--- a/phpBB/includes/functions_template.php
+++ b/phpBB/includes/functions_template.php
@@ -420,21 +420,24 @@ class template_filter extends php_user_filter
// S_ROW_COUNT is deceptive, it returns the current row number now the number of rows
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
- if ($varrefs[3] == 'S_ROW_NUM' || $varrefs[3] == 'S_ROW_COUNT')
+ switch ($varrefs[3])
{
- $token = "\$_${namespace}_i";
- }
- else if ($varrefs[3] == 'S_FIRST_ROW')
- {
- $token = "(\$_${namespace}_i == 0)";
- }
- else if ($varrefs[3] == 'S_LAST_ROW')
- {
- $token = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
- }
- else
- {
- $token = $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']';
+ case 'S_ROW_NUM':
+ case 'S_ROW_COUNT':
+ $token = "\$_${namespace}_i";
+ break;
+
+ case 'S_FIRST_ROW':
+ $token = "(\$_${namespace}_i == 0)";
+ break;
+
+ case 'S_LAST_ROW':
+ $token = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
+ break;
+
+ default:
+ $token = $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']';
+ break;
}
}
else
@@ -608,26 +611,29 @@ class template_filter extends php_user_filter
// S_ROW_COUNT is deceptive, it returns the current row number now the number of rows
// hence S_ROW_COUNT is deprecated in favour of S_ROW_NUM
- if ($varname == 'S_ROW_NUM' || $varname == 'S_ROW_COUNT')
+ switch ($varname)
{
- $varref = "\$_${namespace}_i";
- }
- else if ($varname == 'S_FIRST_ROW')
- {
- $varref = "(\$_${namespace}_i == 0)";
- }
- else if ($varname == 'S_LAST_ROW')
- {
- $varref = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
- }
- else
- {
- // Get a reference to the data block for this namespace.
- $varref = $this->generate_block_data_ref($namespace, true, $defop);
- // Prepend the necessary code to stick this in an echo line.
+ case 'S_ROW_NUM':
+ case 'S_ROW_COUNT':
+ $varref = "\$_${namespace}_i";
+ break;
+
+ case 'S_FIRST_ROW':
+ $varref = "(\$_${namespace}_i == 0)";
+ break;
- // Append the variable reference.
- $varref .= "['$varname']";
+ case 'S_LAST_ROW':
+ $varref = "(\$_${namespace}_i == \$_${namespace}_count - 1)";
+ break;
+
+ default:
+ // Get a reference to the data block for this namespace.
+ $varref = $this->generate_block_data_ref($namespace, true, $defop);
+ // Prepend the necessary code to stick this in an echo line.
+
+ // Append the variable reference.
+ $varref .= "['$varname']";
+ break;
}
$varref = ($echo) ? "<?php echo $varref; ?>" : ((isset($varref)) ? $varref : '');