Merge remote-tracking branch 'upstream/develop-ascraeus' into ticket/12594

This commit is contained in:
Yuriy Rusko 2014-05-28 01:02:39 +02:00
commit 2a42aee8ac
10 changed files with 85 additions and 12 deletions

View file

@ -54,7 +54,13 @@ $module_id = request_var('i', '');
$mode = request_var('mode', '');
// Set custom style for admin area
$template->set_custom_style('adm', $phpbb_admin_path . 'style');
$template->set_custom_style(array(
array(
'name' => 'adm',
'ext_path' => 'adm/style/',
),
), $phpbb_admin_path . 'style');
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');

View file

@ -56,6 +56,7 @@
<fieldset>
<legend>{L_GROUP_OPTIONS_SAVE}</legend>
<!-- EVENT acp_group_options_before -->
<!-- IF S_USER_FOUNDER -->
<dl>
<dt><label for="group_founder_manage">{L_GROUP_FOUNDER_MANAGE}{L_COLON}</label><br /><span>{L_GROUP_FOUNDER_MANAGE_EXPLAIN}</span></dt>
@ -78,6 +79,7 @@
<dt><label for="group_receive_pm">{L_GROUP_RECEIVE_PM}{L_COLON}</label><br /><span>{L_GROUP_RECEIVE_PM_EXPLAIN}</span></dt>
<dd><input name="group_receive_pm" type="checkbox" value="1" class="radio" id="group_receive_pm"{GROUP_RECEIVE_PM} /></dd>
</dl>
<!-- EVENT acp_group_options_after -->
</fieldset>
<fieldset>

View file

@ -22,6 +22,18 @@ acp_forums_normal_settings_append
* Since: 3.1.0-a1
* Purpose: Add settings to forums
acp_group_options_before
===
* Location: adm/style/acp_groups.html
* Since: 3.1.0-b4
* Purpose: Add addtional options to group settings (before GROUP_FOUNDER_MANAGE)
acp_group_options_after
===
* Location: adm/style/acp_groups.html
* Since: 3.1.0-b4
* Purpose: Add addtional options to group settings (after GROUP_RECEIVE_PM)
acp_main_actions_append
===
* Location: adm/style/acp_main.html

View file

@ -255,7 +255,12 @@ class messenger
}
}
$this->set_template_paths($template_lang . '_email', $template_paths);
$this->set_template_paths(array(
array(
'name' => $template_lang . '_email',
'ext_path' => 'language/' . $template_lang . '/email'
),
), $template_paths);
$this->template->set_filenames(array(
'body' => $template_file . '.txt',

View file

@ -584,7 +584,12 @@ class p_master
if (is_dir($module_style_dir))
{
$template->set_custom_style('adm', array($module_style_dir, $phpbb_admin_path . 'style'));
$template->set_custom_style(array(
array(
'name' => 'adm',
'ext_path' => 'adm/style/',
),
), array($module_style_dir, $phpbb_admin_path . 'style'));
}
}

View file

@ -254,7 +254,12 @@ $phpbb_path_helper = $phpbb_container->get('path_helper');
$template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context());
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
$template->set_custom_style('adm', $paths);
$template->set_custom_style(array(
array(
'name' => 'adm',
'ext_path' => 'adm/style/',
),
), $paths);
$path = array_shift($paths);

View file

@ -145,7 +145,12 @@ class install_update extends module
// Set custom template again. ;)
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
$template->set_custom_style('adm', $paths);
$template->set_custom_style(array(
array(
'name' => 'adm',
'ext_path' => 'adm/style/',
),
), $paths);
$template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'],

View file

@ -214,9 +214,13 @@ class twig extends \phpbb\template\base
*
* Note: Templates are still compiled to phpBB's cache directory.
*
* @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions.
* @param string|array or string $paths Array of style paths, relative to current root directory
* @return phpbb_template $this
* @param string|array $names Array of names (or detailed names) or string of name of template(s) in inheritance tree order, used by extensions.
* E.g. array(
* 'name' => 'adm',
* 'ext_path' => 'adm/style/',
* )
* @param string|array of string $paths Array of style paths, relative to current root directory
* @return \phpbb\template\template $this
*/
public function set_custom_style($names, $paths)
{
@ -237,10 +241,26 @@ class twig extends \phpbb\template\base
$namespace = str_replace('/', '_', $ext_namespace);
$paths = array();
foreach ($names as $style_name)
foreach ($names as $template_dir)
{
$ext_style_path = $ext_path . 'styles/' . $style_name . '/';
if (is_array($template_dir))
{
if (isset($template_dir['ext_path']))
{
$ext_style_template_path = $ext_path . $template_dir['ext_path'];
$ext_style_path = dirname($ext_style_template_path);
}
else
{
$ext_style_path = $ext_path . 'styles/' . $template_dir['name'] . '/';
$ext_style_template_path = $ext_style_path . 'template/';
}
}
else
{
$ext_style_path = $ext_path . 'styles/' . $template_dir . '/';
$ext_style_template_path = $ext_style_path . 'template/';
}
if (is_dir($ext_style_template_path))
{

View file

@ -251,7 +251,7 @@ class version_helper
$info = json_decode($info, true);
if (empty($info['stable']) || empty($info['unstable']))
if (empty($info['stable']) && empty($info['unstable']))
{
$this->user->add_lang('acp/common');
@ -267,6 +267,9 @@ class version_helper
}
}
$info['stable'] = (empty($info['stable'])) ? array() : $info['stable'];
$info['unstable'] = (empty($info['unstable'])) ? $info['stable'] : $info['unstable'];
$this->cache->put($cache_file, $info, 86400); // 24 hours
}

View file

@ -185,6 +185,11 @@ class phpbb_version_helper_test extends phpbb_test_case
),
),
),
array(
'1.1.0',
array(),
array(),
),
);
}
@ -290,6 +295,11 @@ class phpbb_version_helper_test extends phpbb_test_case
),
'1.1.0-a2',
),
array(
'1.1.0',
array(),
null,
),
);
}