aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorVjacheslav Trushkin <arty@phpbb.com>2012-03-15 13:13:21 +0200
committerVjacheslav Trushkin <arty@phpbb.com>2012-03-15 13:13:21 +0200
commit3997ffac2a2e6f422dcd5cd5bd076edee6fa91dd (patch)
tree2436f29908131c404dc3bcb094ba380bb65744c1 /phpBB
parent39944a08b9ea031dfc156f61ad0d8f4c594882e5 (diff)
downloadforums-3997ffac2a2e6f422dcd5cd5bd076edee6fa91dd.tar
forums-3997ffac2a2e6f422dcd5cd5bd076edee6fa91dd.tar.gz
forums-3997ffac2a2e6f422dcd5cd5bd076edee6fa91dd.tar.bz2
forums-3997ffac2a2e6f422dcd5cd5bd076edee6fa91dd.tar.xz
forums-3997ffac2a2e6f422dcd5cd5bd076edee6fa91dd.zip
[feature/merging-style-components] Creating style class
Creating phpbb_style class, changing template initialization to style initialization PHPBB3-10632
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/common.php6
-rw-r--r--phpBB/includes/bbcode.php9
-rw-r--r--phpBB/includes/functions_messenger.php6
-rw-r--r--phpBB/includes/style/style.php89
-rw-r--r--phpBB/install/index.php5
5 files changed, 101 insertions, 14 deletions
diff --git a/phpBB/common.php b/phpBB/common.php
index a38a986280..dd49b29528 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -120,9 +120,9 @@ set_config_count(null, null, null, $config);
// load extensions
$phpbb_extension_manager = new phpbb_extension_manager($db, EXT_TABLE, $phpbb_root_path, ".$phpEx", $cache->get_driver());
-$phpbb_style_locator = new phpbb_style_locator();
-$phpbb_style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
-$template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_locator, $phpbb_style_path_provider);
+// Initialize style
+$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager);
+$template = $style->template;
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index 61271545bd..3831cb03ad 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -132,12 +132,11 @@ class bbcode
{
$this->template_bitfield = new bitfield($user->theme['bbcode_bitfield']);
- $template_locator = new phpbb_style_locator();
- $template_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
- $template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $template_locator, $template_path_provider);
+ $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager);
+ $template = $style->template;
$template->set_template();
- $template_locator->set_filenames(array('bbcode.html' => 'bbcode.html'));
- $this->template_filename = $template_locator->get_source_file_for_handle('bbcode.html');
+ $template->set_filenames(array('bbcode.html' => 'bbcode.html'));
+ $this->template_filename = $style->locator->get_source_file_for_handle('bbcode.html');
}
$bbcode_ids = $rowset = $sql = array();
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 1fb5f15879..4e1ec160af 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -208,10 +208,9 @@ class messenger
// tpl_msg now holds a template object we can use to parse the template file
if (!isset($this->tpl_msg[$template_lang . $template_file]))
{
- $template_locator = new phpbb_style_locator();
- $template_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider());
- $this->tpl_msg[$template_lang . $template_file] = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $template_locator, $template_path_provider);
+ $this->tpl_msg[$template_lang . $template_file] = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager);
$tpl = &$this->tpl_msg[$template_lang . $template_file];
+ $tpl = $tpl->template;
$fallback_template_path = false;
@@ -237,6 +236,7 @@ class messenger
}
$this->tpl_obj = &$this->tpl_msg[$template_lang . $template_file];
+ $this->tpl_obj = $this->tpl_obj->template;
$this->vars = &$this->tpl_obj->_rootref;
$this->tpl_msg = '';
diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php
new file mode 100644
index 0000000000..217a70e237
--- /dev/null
+++ b/phpBB/includes/style/style.php
@@ -0,0 +1,89 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Base Style class.
+* @package phpBB3
+*/
+class phpbb_style
+{
+ /**
+ * @var phpbb_style_template Template class.
+ * Handles everything related to templates.
+ */
+ public $template;
+
+ /**
+ * @var string Path of the cache directory for the template
+ */
+ public $cachepath = '';
+
+ /**
+ * @var string phpBB root path
+ */
+ private $phpbb_root_path;
+
+ /**
+ * @var phpEx PHP file extension
+ */
+ private $phpEx;
+
+ /**
+ * @var phpbb_config phpBB config instance
+ */
+ private $config;
+
+ /**
+ * @var user current user
+ */
+ private $user;
+
+ /**
+ * Style resource locator
+ * @var phpbb_style_resource_locator
+ * This item is temporary public, until locate() function is implemented
+ */
+ public $locator;
+
+ /**
+ * Style path provider
+ * @var phpbb_style_path_provider
+ */
+ private $provider;
+
+ /**
+ * Constructor.
+ *
+ * @param string $phpbb_root_path phpBB root path
+ * @param user $user current user
+ * @param phpbb_extension_manager $phpbb_extension_manager extension manager. Set it to false if extension manager should not be used.
+ */
+ public function __construct($phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager = false)
+ {
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->phpEx = $phpEx;
+ $this->config = $config;
+ $this->user = $user;
+ $this->locator = new phpbb_style_locator();
+ $this->provider = new phpbb_style_path_provider();
+ if ($phpbb_extension_manager !== false)
+ {
+ $this->provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, $this->provider);
+ }
+ $this->template = new phpbb_style_template($this->phpbb_root_path, $this->phpEx, $this->config, $this->user, $this->locator, $this->provider);
+ }
+}
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index 9b0dde1009..7c6dd10d03 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -201,9 +201,8 @@ $config = new phpbb_config(array(
'load_tplcompile' => '1'
));
-$phpbb_style_locator = new phpbb_style_locator();
-$phpbb_style_path_provider = new phpbb_style_path_provider();
-$template = new phpbb_style_template($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_locator, $phpbb_style_path_provider);
+$style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, false);
+$template = $style->template;
$template->set_ext_dir_prefix('adm/');
$template->set_custom_template('../adm/style', 'admin');
$template->assign_var('T_ASSETS_PATH', '../assets');