diff options
| author | David King <imkingdavid@gmail.com> | 2012-12-10 14:09:10 -0500 |
|---|---|---|
| committer | David King <imkingdavid@gmail.com> | 2012-12-10 14:09:10 -0500 |
| commit | a9db155c28aa4885c1eef70dffe037172222f91d (patch) | |
| tree | c8cf9c258b1acbc7fe3a2ff2825a5bdc52595f58 /phpBB/includes/style | |
| parent | eaa0319867783868a761c9ede5398d52351c38d5 (diff) | |
| parent | 0446886f91376c258df3729287824e505ff788b3 (diff) | |
| download | forums-a9db155c28aa4885c1eef70dffe037172222f91d.tar forums-a9db155c28aa4885c1eef70dffe037172222f91d.tar.gz forums-a9db155c28aa4885c1eef70dffe037172222f91d.tar.bz2 forums-a9db155c28aa4885c1eef70dffe037172222f91d.tar.xz forums-a9db155c28aa4885c1eef70dffe037172222f91d.zip | |
Merge remote-tracking branch 'p/feature/template-events' into develop
# By Oleg Pudeyev (36) and others
# Via Oleg Pudeyev
* p/feature/template-events: (47 commits)
[feature/template-events] Pass arguments in correct order.
[feature/template-events] Order extensions in mock extension manager.
[feature/template-events] Changes per imkingdavid's review.
[feature/template-events] Make style names private on template.
[feature/template-events] Test for event that is defined in parent style only.
[feature/template-events] Specify style names, add inheritance tests.
[feature/template-events] Normalize expected directory trees.
[feature/template-events] Allow dataset to be correctly selectable.
[feature/template-events] Dataset for template event testing with inheritance.
[feature/template-events] Use style names array in template filter.
[feature/template-events] Generate style names array in set_style.
[feature/template-events] Convert a single style name to array of them.
[feature/template-events] Chase dependency injection for template context.
[feature/template-events] Adjust template events test to use the dataset.
[feature/template-events] Create a dataset for template event tests.
[feature/template-events] Indentation fix.
[feature/template-events] Cosmetic changes.
[feature/template-events] Wording: wrongly -> improperly.
[feature/template-events] Indentation fix.
[feature/template-events] Rename template_name to style_name.
...
Diffstat (limited to 'phpBB/includes/style')
| -rw-r--r-- | phpBB/includes/style/style.php | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/phpBB/includes/style/style.php b/phpBB/includes/style/style.php index effd496fb9..1b2e756064 100644 --- a/phpBB/includes/style/style.php +++ b/phpBB/includes/style/style.php @@ -91,16 +91,22 @@ class phpbb_style { $style_path = $this->user->style['style_path']; $style_dirs = ($this->user->style['style_parent_id']) ? array_reverse(explode('/', $this->user->style['style_parent_tree'])) : array(); - $paths = array($this->get_style_path($style_path)); + + $names = array($style_path); foreach ($style_dirs as $dir) { - $paths[] = $this->get_style_path($dir); + $names[] = $dir; } + // Add 'all' path, used as last fallback path by events and extensions + //$names[] = 'all'; - // Add 'all' path, used as last fallback path by hooks and extensions - $paths[] = $this->get_style_path('all'); + $paths = array(); + foreach ($names as $name) + { + $paths[] = $this->get_style_path($name); + } - return $this->set_custom_style($style_path, $paths); + return $this->set_custom_style($style_path, $paths, $paths); } /** @@ -110,18 +116,27 @@ class phpbb_style * * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver" * @param array or string $paths Array of style paths, relative to current root directory + * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used. * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/). */ - public function set_custom_style($name, $paths, $template_path = false) + public function set_custom_style($name, $paths, $names = array(), $template_path = false) { if (is_string($paths)) { $paths = array($paths); } + if (empty($names)) + { + $names = array($name); + } + $this->names = $names; + $this->provider->set_styles($paths); $this->locator->set_paths($this->provider); + $this->template->set_style_names($names); + if ($template_path !== false) { $this->locator->set_template_path($template_path); |
