From 44a82dd0837a4693b6a4a410c21c438f244094d3 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Wed, 24 Jul 2013 12:05:04 -0500 Subject: [ticket/11628] Remove style path provider No longer used since Twig was implemented. PHPBB3-11628 --- phpBB/config/services.yml | 11 --- phpBB/includes/bbcode.php | 3 +- phpBB/install/index.php | 4 +- phpBB/phpbb/style/extension_path_provider.php | 137 -------------------------- phpBB/phpbb/style/path_provider.php | 62 ------------ phpBB/phpbb/style/path_provider_interface.php | 42 -------- phpBB/phpbb/style/style.php | 25 +---- 7 files changed, 3 insertions(+), 281 deletions(-) delete mode 100644 phpBB/phpbb/style/extension_path_provider.php delete mode 100644 phpBB/phpbb/style/path_provider.php delete mode 100644 phpBB/phpbb/style/path_provider_interface.php (limited to 'phpBB') diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 4902f4b6f6..7acc44f24d 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -258,19 +258,8 @@ services: - %core.php_ext% - @config - @user - - @style.path_provider_ext - @template - style.path_provider_ext: - class: phpbb_style_extension_path_provider - arguments: - - @ext.manager - - @style.path_provider - - %core.root_path% - - style.path_provider: - class: phpbb_style_path_provider - template: class: phpbb_template_twig arguments: diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 4ce6f17d90..9b1939030a 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -132,9 +132,8 @@ class bbcode { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); - $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_path_provider, $template); + $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $template); $style->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index f924b05547..46660723ba 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -212,10 +212,8 @@ $config = new phpbb_config(array( 'load_tplcompile' => '1' )); -$phpbb_style_path_provider = new phpbb_style_path_provider(); $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context()); -$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_path_provider, $template); -$phpbb_style->set_ext_dir_prefix('adm/'); +$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $template); $phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), ''); $template->assign_var('T_ASSETS_PATH', '../assets'); $template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); diff --git a/phpBB/phpbb/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php deleted file mode 100644 index ec1d85f821..0000000000 --- a/phpBB/phpbb/style/extension_path_provider.php +++ /dev/null @@ -1,137 +0,0 @@ -base_path_provider = $base_path_provider; - $this->phpbb_root_path = $phpbb_root_path; - } - - /** - * Sets a prefix for style paths searched within extensions. - * - * The prefix is inserted between the extension's path e.g. ext/foo/ and - * the looked up style path, e.g. styles/bar/. So it should not have a - * leading slash, but should have a trailing slash. - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - $this->ext_dir_prefix = $ext_dir_prefix; - } - - /** - * Finds style paths using the extension manager - * - * Locates a path (e.g. styles/prosilver/) in all active extensions. - * Then appends the core style paths based in the current working - * directory. - * - * @return array List of style paths - */ - public function find() - { - $directories = array(); - - $finder = $this->extension_manager->get_finder(); - foreach ($this->base_path_provider as $key => $paths) - { - if ($key == 'style') - { - foreach ($paths as $path) - { - $directories['style'][] = $path; - if ($path && !phpbb_is_absolute($path)) - { - // Remove phpBB root path from the style path, - // so the finder is able to find extension styles, - // when the root path is not ./ - if (strpos($path, $this->phpbb_root_path) === 0) - { - $path = substr($path, strlen($this->phpbb_root_path)); - } - - $result = $finder->directory('/' . $this->ext_dir_prefix . $path) - ->get_directories(true, false, true); - foreach ($result as $ext => $ext_path) - { - // Make sure $ext_path has no ending slash - if (substr($ext_path, -1) === '/') - { - $ext_path = substr($ext_path, 0, -1); - } - $directories[$ext][] = $ext_path; - } - } - } - } - } - - return $directories; - } - - /** - * Overwrites the current style paths - * - * @param array $styles An array of style paths. The first element is the main style. - * @return null - */ - public function set_styles(array $styles) - { - $this->base_path_provider->set_styles($styles); - $this->items = null; - } -} diff --git a/phpBB/phpbb/style/path_provider.php b/phpBB/phpbb/style/path_provider.php deleted file mode 100644 index 731d682e88..0000000000 --- a/phpBB/phpbb/style/path_provider.php +++ /dev/null @@ -1,62 +0,0 @@ -paths = array('style' => $styles); - } - - /** - * Retrieve an iterator over all style paths - * - * @return ArrayIterator An iterator for the array of style paths - */ - public function getIterator() - { - return new ArrayIterator($this->paths); - } -} diff --git a/phpBB/phpbb/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php deleted file mode 100644 index 1a6153a4d3..0000000000 --- a/phpBB/phpbb/style/path_provider_interface.php +++ /dev/null @@ -1,42 +0,0 @@ -phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; $this->config = $config; $this->user = $user; - $this->provider = $provider; $this->template = $template; } @@ -121,8 +113,6 @@ class phpbb_style } } - $this->provider->set_styles($paths); - $new_paths = array(); foreach ($paths as $path) { @@ -158,8 +148,6 @@ class phpbb_style } $this->names = $names; - $this->provider->set_styles($paths); - $new_paths = array(); foreach ($paths as $path) { @@ -184,15 +172,4 @@ class phpbb_style { return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path; } - - /** - * Defines a prefix to use for style paths in extensions - * - * @param string $ext_dir_prefix The prefix including trailing slash - * @return null - */ - public function set_ext_dir_prefix($ext_dir_prefix) - { - $this->provider->set_ext_dir_prefix($ext_dir_prefix); - } } -- cgit v1.2.1