Merge remote-tracking branch 'cyberalien/ticket/10616' into develop-olympus

* cyberalien/ticket/10616:
  [ticket/10616] Add template inheritance to exported template
  [ticket/10616] Ignore template inheritance that points to self
  [ticket/10616] Add template inheritance to default styles
This commit is contained in:
Igor Wiedler 2012-02-07 16:53:47 +01:00
commit 3feeb382c5
4 changed files with 22 additions and 9 deletions

View file

@ -99,11 +99,11 @@ parse_css_file = {PARSE_CSS_FILE}
$this->template_cfg .= ' $this->template_cfg .= '
# Some configuration options # Some configuration options
# # Template inheritance
# You can use this function to inherit templates from another template. # See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/
# The template of the given name has to be installed. # Set value to empty or this template name to ignore template inheritance.
# Templates cannot inherit from inheriting templates. inherit_from = {INHERIT_FROM}
#'; ';
$this->imageset_keys = array( $this->imageset_keys = array(
'logos' => array( 'logos' => array(
@ -2047,9 +2047,7 @@ parse_css_file = {PARSE_CSS_FILE}
// Export template core code // Export template core code
if ($mode == 'template' || $inc_template) if ($mode == 'template' || $inc_template)
{ {
$template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version']), $this->template_cfg); $use_template_name = $style_row['template_name'];
$use_template_name = '';
// Add the inherit from variable, depending on it's use... // Add the inherit from variable, depending on it's use...
if ($style_row['template_inherits_id']) if ($style_row['template_inherits_id'])
@ -2063,7 +2061,8 @@ parse_css_file = {PARSE_CSS_FILE}
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
$template_cfg .= ($use_template_name) ? "\ninherit_from = $use_template_name" : "\n#inherit_from = "; $template_cfg = str_replace(array('{MODE}', '{NAME}', '{COPYRIGHT}', '{VERSION}', '{INHERIT_FROM}'), array($mode, $style_row['template_name'], $style_row['template_copyright'], $config['version'], $use_template_name), $this->template_cfg);
$template_cfg .= "\n\nbbcode_bitfield = {$style_row['bbcode_bitfield']}"; $template_cfg .= "\n\nbbcode_bitfield = {$style_row['bbcode_bitfield']}";
$data[] = array( $data[] = array(

View file

@ -3322,6 +3322,11 @@ function parse_cfg_file($filename, $lines = false)
$parsed_items[$key] = $value; $parsed_items[$key] = $value;
} }
if (isset($parsed_items['inherit_from']) && isset($parsed_items['name']) && $parsed_items['inherit_from'] == $parsed_items['name'])
{
unset($parsed_items['inherit_from']);
}
return $parsed_items; return $parsed_items;
} }

View file

@ -23,3 +23,8 @@ version = 3.0.10
# Defining a different template bitfield # Defining a different template bitfield
template_bitfield = lNg= template_bitfield = lNg=
# Template inheritance
# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/
# Set value to empty to ignore template inheritance
inherit_from = prosilver

View file

@ -21,3 +21,7 @@ name = subsilver2
copyright = © phpBB Group, 2003 copyright = © phpBB Group, 2003
version = 3.0.10 version = 3.0.10
# Template inheritance
# See http://blog.phpbb.com/2008/07/31/templating-just-got-easier/
# Set value to empty to ignore template inheritance
inherit_from = subsilver2