aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_module.php
diff options
context:
space:
mode:
authorNathaniel Guse <nathaniel.guse@gmail.com>2013-07-04 13:49:56 -0500
committerNathaniel Guse <nathaniel.guse@gmail.com>2013-07-04 13:49:56 -0500
commit24be21636656bf636738449488da3810e489b4a7 (patch)
treedf207e60f97109c1e2974a1c07cd49fd3408a562 /phpBB/includes/functions_module.php
parent8cf6dbd95035f71ea8cff0f2f8d834b91b243429 (diff)
downloadforums-24be21636656bf636738449488da3810e489b4a7.tar
forums-24be21636656bf636738449488da3810e489b4a7.tar.gz
forums-24be21636656bf636738449488da3810e489b4a7.tar.bz2
forums-24be21636656bf636738449488da3810e489b4a7.tar.xz
forums-24be21636656bf636738449488da3810e489b4a7.zip
[feature/twig] Attempt to automatically set style dir for ext modules
Extension authors can change it themselves if necessary PHPBB3-11598
Diffstat (limited to 'phpBB/includes/functions_module.php')
-rw-r--r--phpBB/includes/functions_module.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 0d387ace6d..5a8ac276cd 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -455,7 +455,7 @@ class p_master
*/
function load_active($mode = false, $module_url = false, $execute_module = true)
{
- global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user;
+ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $style;
$module_path = $this->include_path . $this->p_class;
$icat = request_var('icat', '');
@@ -491,6 +491,24 @@ class p_master
$this->module = new $class_name($this);
+ /*
+ * If this is an extension module, we'll try to automatically set
+ * the style paths for the extension (the ext author can change them
+ * if necessary).
+ */
+ $module_dir = explode('_', get_class($this->module));
+
+ // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
+ if (!is_null($this->style) && isset($module_dir[3]) && $module_dir[1] === 'ext')
+ {
+ $module_style_dir = 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/styles';
+
+ if (is_dir($module_style_dir))
+ {
+ $style->set_style(array($module_style_dir, 'styles'));
+ }
+ }
+
// We pre-define the action parameter we are using all over the place
if (defined('IN_ADMIN'))
{