[feature/template-engine] Disposed of underscores in property names.

PHPBB3-9726
This commit is contained in:
Oleg Pudeyev 2011-05-11 09:04:07 -04:00
parent 97d2a6527e
commit 169c4377e9
2 changed files with 32 additions and 32 deletions

View file

@ -37,7 +37,7 @@ class phpbb_template
* Stores template data used during template rendering. * Stores template data used during template rendering.
* @access private * @access private
*/ */
private $_context; private $context;
/** /**
* @var string Root dir for template. * @var string Root dir for template.
@ -95,7 +95,7 @@ class phpbb_template
trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
} }
$this->_context = new phpbb_template_context(); $this->context = new phpbb_template_context();
return true; return true;
} }
@ -135,7 +135,7 @@ class phpbb_template
$this->orig_tpl_inherits_id = false; $this->orig_tpl_inherits_id = false;
} }
$this->_context = new phpbb_template_context(); $this->context = new phpbb_template_context();
return true; return true;
} }
@ -173,7 +173,7 @@ class phpbb_template
*/ */
public function destroy() public function destroy()
{ {
$this->_context->clear(); $this->context->clear();
} }
/** /**
@ -183,7 +183,7 @@ class phpbb_template
*/ */
public function destroy_block_vars($blockname) public function destroy_block_vars($blockname)
{ {
$this->_context->destroy_block_vars($blockname); $this->context->destroy_block_vars($blockname);
} }
/** /**
@ -205,7 +205,7 @@ class phpbb_template
if ($renderer) if ($renderer)
{ {
$renderer->render($this->_context, $this->get_lang()); $renderer->render($this->context, $this->get_lang());
return true; return true;
} }
else else
@ -439,7 +439,7 @@ class phpbb_template
*/ */
public function assign_var($varname, $varval) public function assign_var($varname, $varval)
{ {
$this->_context->assign_var($varname, $varval); $this->context->assign_var($varname, $varval);
} }
// Docstring is copied from phpbb_template_context method with the same name. // Docstring is copied from phpbb_template_context method with the same name.
@ -451,7 +451,7 @@ class phpbb_template
*/ */
public function assign_block_vars($blockname, array $vararray) public function assign_block_vars($blockname, array $vararray)
{ {
return $this->_context->assign_block_vars($blockname, $vararray); return $this->context->assign_block_vars($blockname, $vararray);
} }
// Docstring is copied from phpbb_template_context method with the same name. // Docstring is copied from phpbb_template_context method with the same name.
@ -485,7 +485,7 @@ class phpbb_template
*/ */
public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
{ {
return $this->_context->alter_block_array($blockname, $vararray, $key, $mode); return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
} }
/** /**
@ -509,7 +509,7 @@ class phpbb_template
if ($renderer) if ($renderer)
{ {
$renderer->render($this->_context, $this->get_lang()); $renderer->render($this->context, $this->get_lang());
} }
else else
{ {

View file

@ -26,17 +26,17 @@ class phpbb_template_context
/** /**
* variable that holds all the data we'll be substituting into * variable that holds all the data we'll be substituting into
* the compiled templates. Takes form: * the compiled templates. Takes form:
* --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value * --> $this->tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
* if it's a root-level variable, it'll be like this: * if it's a root-level variable, it'll be like this:
* --> $this->_tpldata[.][0][varname] == value * --> $this->tpldata[.][0][varname] == value
* @var array * @var array
*/ */
private $_tpldata = array('.' => array(0 => array())); private $tpldata = array('.' => array(0 => array()));
/** /**
* @var array Reference to template->_tpldata['.'][0] * @var array Reference to template->tpldata['.'][0]
*/ */
private $_rootref; private $rootref;
public function __construct() public function __construct()
{ {
@ -49,8 +49,8 @@ class phpbb_template_context
*/ */
public function clear() public function clear()
{ {
$this->_tpldata = array('.' => array(0 => array())); $this->tpldata = array('.' => array(0 => array()));
$this->_rootref = &$this->_tpldata['.'][0]; $this->rootref = &$this->tpldata['.'][0];
} }
/** /**
@ -61,19 +61,19 @@ class phpbb_template_context
*/ */
public function assign_var($varname, $varval) public function assign_var($varname, $varval)
{ {
$this->_rootref[$varname] = $varval; $this->rootref[$varname] = $varval;
return true; return true;
} }
public function get_data_ref() public function get_data_ref()
{ {
return $this->_tpldata; return $this->tpldata;
} }
public function get_root_ref() public function get_root_ref()
{ {
return $this->_rootref; return $this->rootref;
} }
/** /**
@ -90,7 +90,7 @@ class phpbb_template_context
$blocks = explode('.', $blockname); $blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1; $blockcount = sizeof($blocks) - 1;
$str = &$this->_tpldata; $str = &$this->tpldata;
for ($i = 0; $i < $blockcount; $i++) for ($i = 0; $i < $blockcount; $i++)
{ {
$str = &$str[$blocks[$i]]; $str = &$str[$blocks[$i]];
@ -122,7 +122,7 @@ class phpbb_template_context
else else
{ {
// Top-level block. // Top-level block.
$s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; $s_row_count = (isset($this->tpldata[$blockname])) ? sizeof($this->tpldata[$blockname]) : 0;
$vararray['S_ROW_COUNT'] = $s_row_count; $vararray['S_ROW_COUNT'] = $s_row_count;
// Assign S_FIRST_ROW // Assign S_FIRST_ROW
@ -135,11 +135,11 @@ class phpbb_template_context
$vararray['S_LAST_ROW'] = true; $vararray['S_LAST_ROW'] = true;
if ($s_row_count > 0) if ($s_row_count > 0)
{ {
unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']); unset($this->tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
} }
// Add a new iteration to this block with the variable assignments we were given. // Add a new iteration to this block with the variable assignments we were given.
$this->_tpldata[$blockname][] = $vararray; $this->tpldata[$blockname][] = $vararray;
} }
return true; return true;
@ -181,7 +181,7 @@ class phpbb_template_context
$blocks = explode('.', $blockname); $blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1; $blockcount = sizeof($blocks) - 1;
$block = &$this->_tpldata; $block = &$this->tpldata;
for ($i = 0; $i < $blockcount; $i++) for ($i = 0; $i < $blockcount; $i++)
{ {
if (($pos = strpos($blocks[$i], '[')) !== false) if (($pos = strpos($blocks[$i], '[')) !== false)
@ -211,7 +211,7 @@ class phpbb_template_context
else else
{ {
// Top-level block. // Top-level block.
$block = &$this->_tpldata[$blockname]; $block = &$this->tpldata[$blockname];
} }
// Change key to zero (change first position) if false and to last position if true // Change key to zero (change first position) if false and to last position if true
@ -247,15 +247,15 @@ class phpbb_template_context
if ($mode == 'insert') if ($mode == 'insert')
{ {
// Make sure we are not exceeding the last iteration // Make sure we are not exceeding the last iteration
if ($key >= sizeof($this->_tpldata[$blockname])) if ($key >= sizeof($this->tpldata[$blockname]))
{ {
$key = sizeof($this->_tpldata[$blockname]); $key = sizeof($this->tpldata[$blockname]);
unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); unset($this->tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
$vararray['S_LAST_ROW'] = true; $vararray['S_LAST_ROW'] = true;
} }
else if ($key === 0) else if ($key === 0)
{ {
unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); unset($this->tpldata[$blockname][0]['S_FIRST_ROW']);
$vararray['S_FIRST_ROW'] = true; $vararray['S_FIRST_ROW'] = true;
} }
@ -300,7 +300,7 @@ class phpbb_template_context
$blocks = explode('.', $blockname); $blocks = explode('.', $blockname);
$blockcount = sizeof($blocks) - 1; $blockcount = sizeof($blocks) - 1;
$str = &$this->_tpldata; $str = &$this->tpldata;
for ($i = 0; $i < $blockcount; $i++) for ($i = 0; $i < $blockcount; $i++)
{ {
$str = &$str[$blocks[$i]]; $str = &$str[$blocks[$i]];
@ -312,7 +312,7 @@ class phpbb_template_context
else else
{ {
// Top-level block. // Top-level block.
unset($this->_tpldata[$blockname]); unset($this->tpldata[$blockname]);
} }
return true; return true;