diff options
author | Vjacheslav Trushkin <arty@phpbb.com> | 2012-03-15 21:04:27 +0200 |
---|---|---|
committer | Vjacheslav Trushkin <arty@phpbb.com> | 2012-03-15 21:04:27 +0200 |
commit | c692e0d92da55944414d5f50accefdd96c2e31ee (patch) | |
tree | af0829171e76aadd7ea854c0955dfefb47d0a6d8 /phpBB/includes/style | |
parent | 8b7c2c3c6516fd4eb606054ca3822d8a7f977282 (diff) | |
download | forums-c692e0d92da55944414d5f50accefdd96c2e31ee.tar forums-c692e0d92da55944414d5f50accefdd96c2e31ee.tar.gz forums-c692e0d92da55944414d5f50accefdd96c2e31ee.tar.bz2 forums-c692e0d92da55944414d5f50accefdd96c2e31ee.tar.xz forums-c692e0d92da55944414d5f50accefdd96c2e31ee.zip |
[feature/merging-style-components] Changing path provider
Changing set_templates() to set_style() and removing second parameter, changing get_main_template_path() to get_main_style_path(), removing template_root_for_style(), updating docblocks
PHPBB3-10632
Diffstat (limited to 'phpBB/includes/style')
-rw-r--r-- | phpBB/includes/style/extension_path_provider.php | 45 | ||||
-rw-r--r-- | phpBB/includes/style/path_provider.php | 60 | ||||
-rw-r--r-- | phpBB/includes/style/path_provider_interface.php | 23 |
3 files changed, 45 insertions, 83 deletions
diff --git a/phpBB/includes/style/extension_path_provider.php b/phpBB/includes/style/extension_path_provider.php index 05dc5661f6..1fb6580ce1 100644 --- a/phpBB/includes/style/extension_path_provider.php +++ b/phpBB/includes/style/extension_path_provider.php @@ -16,26 +16,26 @@ if (!defined('IN_PHPBB')) } /** -* Provides a template locator with core template paths and extension template paths +* Provides a style resource locator with core style paths and extension style paths * -* Finds installed template paths and makes them available to the locator. +* Finds installed style paths and makes them available to the resource locator. * * @package phpBB3 */ class phpbb_style_extension_path_provider extends phpbb_extension_provider implements phpbb_style_path_provider_interface { /** - * Optional prefix for template paths searched within extensions. + * Optional prefix for style paths searched within extensions. * * Empty by default. Relative to the extension directory. As an example, it - * could be adm/ for admin templates. + * could be adm/ for admin style. * * @var string */ protected $ext_dir_prefix = ''; /** - * A provider of paths to be searched for templates + * A provider of paths to be searched for styles * @var phpbb_style_path_provider */ protected $base_path_provider; @@ -54,11 +54,11 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple } /** - * Sets a prefix for template paths searched within extensions. + * 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 template path, e.g. styles/bar/template/some.html. So it - * should not have a leading slash, but should have a trailing slash. + * 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 @@ -69,13 +69,13 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple } /** - * Finds template paths using the extension manager + * Finds style paths using the extension manager * - * Locates a path (e.g. styles/prosilver/template/) in all active extensions. - * Then appends the core template paths based in the current working + * 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 template paths + * @return array List of style paths */ public function find() { @@ -102,29 +102,24 @@ class phpbb_style_extension_path_provider extends phpbb_extension_provider imple } /** - * Overwrites the current template names and paths + * Overwrites the current style paths * - * @param array $templates An associative map from template names to paths. - * The first element is the main template. - * If the path is false, it will be generated from - * the supplied name. - * @param string $style_root_path The root directory for styles identified - * by name only. + * @param array $styles An array of style paths. The first element is the main style. * @return null */ - public function set_templates(array $templates, $style_root_path) + public function set_styles(array $styles) { - $this->base_path_provider->set_templates($templates, $style_root_path); + $this->base_path_provider->set_styles($styles); $this->items = null; } /** - * Retrieves the path to the main template passed into set_templates() + * Retrieves the path to the main style passed into set_styles() * - * @return string Main template path + * @return string Main style path */ - public function get_main_template_path() + public function get_main_style_path() { - return $this->base_path_provider->get_main_template_path(); + return $this->base_path_provider->get_main_style_path(); } } diff --git a/phpBB/includes/style/path_provider.php b/phpBB/includes/style/path_provider.php index 649797df41..c229af92ba 100644 --- a/phpBB/includes/style/path_provider.php +++ b/phpBB/includes/style/path_provider.php @@ -16,15 +16,15 @@ if (!defined('IN_PHPBB')) } /** -* Provides a template locator with paths +* Provides a style resource locator with paths * -* Finds installed template paths and makes them available to the locator. +* Finds installed style paths and makes them available to the resource locator. * * @package phpBB3 */ class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface { - protected $main_template_name = ''; + protected $main_style_name = ''; protected $paths = array(); /** @@ -38,62 +38,34 @@ class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_p } /** - * Overwrites the current template names and paths + * Overwrites the current style paths * - * The first element of the passed templates map, is considered the main - * template and can be retrieved through get_main_template_path(). + * The first element of the passed styles map, is considered the main + * style and can be retrieved through get_main_style_path(). * - * @param array $templates An associative map from template names to paths. - * The first element is the main template. - * If the path is false, it will be generated from - * the supplied name. - * @param string $style_root_path The root directory for styles identified - * by name only. + * @param array $styles An array of style paths. The first element is the main style. * @return null */ - public function set_templates(array $templates, $style_root_path) + public function set_styles(array $styles) { - $this->paths = array(); - - foreach ($templates as $name => $path) - { - if (!$path) - { - $path = $style_root_path . $this->template_root_for_style($name); - } - - $this->paths[] = $path; - } - - $this->main_template_path = $this->paths[0]; - } - - /** - * Retrieves the path to the main template passed into set_templates() - * - * @return string Main template path - */ - public function get_main_template_path() - { - return $this->main_template_path; + $this->paths = $styles; + $this->main_style_path = $this->paths[0]; } /** - * Converts a style name to relative (to board root or extension) path to - * the style's template files. + * Retrieves the path to the main style passed into set_styles() * - * @param $style_name string Style name - * @return string Path to style template files + * @return string Main style path */ - private function template_root_for_style($style_name) + public function get_main_style_path() { - return 'styles/' . $style_name . '/template'; + return $this->main_style_path; } /** - * Retrieve an iterator over all template paths + * Retrieve an iterator over all style paths * - * @return ArrayIterator An iterator for the array of template paths + * @return ArrayIterator An iterator for the array of style paths */ public function getIterator() { diff --git a/phpBB/includes/style/path_provider_interface.php b/phpBB/includes/style/path_provider_interface.php index e65c037dcc..7ae94e17f4 100644 --- a/phpBB/includes/style/path_provider_interface.php +++ b/phpBB/includes/style/path_provider_interface.php @@ -16,16 +16,16 @@ if (!defined('IN_PHPBB')) } /** -* Provides a template locator with paths +* Provides a style resource locator with paths * -* Finds installed template paths and makes them available to the locator. +* Finds installed style paths and makes them available to the resource locator. * * @package phpBB3 */ interface phpbb_style_path_provider_interface extends Traversable { /** - * Defines a prefix to use for template paths in extensions + * Defines a prefix to use for style paths in extensions * * @param string $ext_dir_prefix The prefix including trailing slash * @return null @@ -33,22 +33,17 @@ interface phpbb_style_path_provider_interface extends Traversable public function set_ext_dir_prefix($ext_dir_prefix); /** - * Overwrites the current template names and paths + * Overwrites the current style paths * - * @param array $templates An associative map from template names to paths. - * The first element is the main template. - * If the path is false, it will be generated from - * the supplied name. - * @param string $style_root_path The root directory for styles identified - * by name only. + * @param array $styles An array of style paths. The first element is the main style. * @return null */ - public function set_templates(array $templates, $style_root_path); + public function set_styles(array $styles); /** - * Retrieves the path to the main template passed into set_templates() + * Retrieves the path to the main style passed into set_styles() * - * @return string Main template path + * @return string Main style path */ - public function get_main_template_path(); + public function get_main_style_path(); } |