[feature/template-engine] Use template engine class in bbcode class.

PHPBB3-9726
This commit is contained in:
Oleg Pudeyev 2011-08-07 19:26:28 -04:00
parent db257956aa
commit df46a576e9
2 changed files with 19 additions and 17 deletions

View file

@ -128,28 +128,17 @@ class bbcode
*/ */
function bbcode_cache_init() function bbcode_cache_init()
{ {
global $phpbb_root_path, $template, $user; global $phpbb_root_path, $phpEx, $template, $config, $user;
if (empty($this->template_filename)) if (empty($this->template_filename))
{ {
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']); $this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/bbcode.html';
if (!@file_exists($this->template_filename)) $template = new phpbb_template($phpbb_root_path, $phpEx, $config, $user);
{ $template->set_template();
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) $locator = $template->_get_locator();
{ $locator->set_filenames(array('bbcode.html' => 'bbcode.html'));
$this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/bbcode.html'; $this->template_filename = $locator->get_source_file_for_handle('bbcode.html');
if (!@file_exists($this->template_filename))
{
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
}
}
else
{
trigger_error('The file ' . $this->template_filename . ' is missing.', E_USER_ERROR);
}
}
} }
$bbcode_ids = $rowset = $sql = array(); $bbcode_ids = $rowset = $sql = array();

View file

@ -493,4 +493,17 @@ class phpbb_template
} }
include($file); include($file);
} }
/**
* Retrieves the template locator object.
*
* This function is public for the benefit of bbcode implementation.
* It should not be considered part of template class's public API.
*
* @return phpbb_template_locator Template locator for this template
*/
public function _get_locator()
{
return $this->locator;
}
} }