From 131c78ed5466bc8d5cc3a6a146e23029b2389730 Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Tue, 24 Jun 2003 23:22:51 +0000 Subject: [PATCH] more twiddling and playing git-svn-id: file:///svn/phpbb/trunk@4172 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/admin_styles.php | 207 ++++++++++++++++++++++++++++++------- 1 file changed, 172 insertions(+), 35 deletions(-) diff --git a/phpBB/adm/admin_styles.php b/phpBB/adm/admin_styles.php index 953052f207..513921b1cd 100644 --- a/phpBB/adm/admin_styles.php +++ b/phpBB/adm/admin_styles.php @@ -332,6 +332,8 @@ switch ($mode) + + case 'themes': $theme_id = (isset($_REQUEST['id'])) ? $_REQUEST['id'] : ''; @@ -365,21 +367,37 @@ switch ($mode) } $user->lang = array_merge($user->lang, array( - 'SELECT_CLASS' => 'Select class', + 'SELECT_CLASS' => 'Select class', - 'style_cat_general' => 'General classes', - 'style_cat_bbcode' => 'BBCode classes', - 'style_body' => 'Body', - 'style_p' => 'Paragraphs', - 'style_th' => 'Table Header Cell', - 'style_td' => 'Table Data Cell', - 'style_postdetails' => 'Post Information', - 'style_postbody' => 'Post text', - 'style_gen' => 'General Text', - 'style_genmed' => 'Medium Text', - 'style_gensmall' => 'Small Text', - 'style_copyright' => 'Copyright Text', + 'style_cat_text' => 'Text classes', + 'style_body' => 'Body', + 'style_p' => 'Paragraphs', + 'style_h1' => 'Header 1', + 'style_h2' => 'Header 2', + 'style_h3' => 'Header 3', + 'style_postdetails' => 'Post Information', + 'style_postbody' => 'Post Text', + 'style_postauthor' => 'Post Author', + + 'style_topictitle' => 'Topic titles', + 'style_topicauthor' => 'Topic Author', + 'style_topicdetails' => 'Topic Details', + + 'style_gen' => 'General Text', + 'style_genmed' => 'Medium Text', + 'style_gensmall' => 'Small Text', + + 'style_copyright' => 'Copyright Text', + + + 'style_cat_tables' => 'Table classes', + 'style_cat' => 'Category Header Cell', + 'style_cattitle' => 'Category Header Text', + 'style_th' => 'Table Header Cell', + 'style_td' => 'Table Data Cell', + + 'style_cat_bbcode' => 'BBCode classes', 'style_b' => 'Bold', 'style_u' => 'Underline', 'style_i' => 'Italics', @@ -398,16 +416,28 @@ switch ($mode) )); $base_classes = array( - 'general' => array( + 'text' => array( 'body', - 'p', - 'th', - 'td', + 'p', + 'h1', + 'h2', + 'h3', + 'gen', + 'genmed', + 'gensmall', + 'topictitle', + 'topicauthor', + 'topicdetails', 'postdetails', 'postbody', - 'gen', - 'gensmall', + 'postauthor', 'copyright' + ), + 'tables' => array( + 'th', + 'td', + 'cat', + 'cattitle', ), 'bbcode' => array( 'b', @@ -438,6 +468,78 @@ switch ($mode) } } + if (!empty($class)) + { + //TEMP + if (!($fp = fopen($phpbb_root_path . 'templates/' . $theme_data['css_external'], 'rb'))) + { + die("ERROR"); + } + $stylesheet = fread($fp, filesize($phpbb_root_path . 'templates/' . $theme_data['css_external'])); + fclose($fp); + $stylesheet = str_replace(array("\t", "\n"), " ", $stylesheet); + + + if (preg_match('#^.*?' . $class . ' {(.*?)}#m', $stylesheet, $matches)) + { + $stylesheet = &$matches[1]; + + $match_elements = array( + 'colors' => array('background-color', 'color', 'border-color', + ), + 'sizes' => array('font-size', 'line-height', 'border-width', + ), + 'images' => array('background-image', + ), + 'repeat' => array('background-repeat', + ), + 'other' => array('font-weight', 'font-family', 'font-style', 'text-decoration', 'border-style', + ), + ); + + foreach ($match_elements as $type => $match_ary) + { + foreach ($match_ary as $match) + { + $$match = ''; + $var = str_replace('-', '', $match); + + if (preg_match('#\b' . $match . ': (.*?);#s', $stylesheet, $matches)) + { + switch ($type) + { + case 'colors': + $$var = trim($matches[1]); + break; + + case 'sizes': + if (preg_match('#(.*?)(px|%|em|pt)#', $matches[1], $matches)) + { + ${$var . 'units'} = trim($matches[2]); + } + $$var = trim($matches[1]); + break; + + case 'images': + if (preg_match('#url\(\'(.*?)\'\)#', $matches[1], $matches)) + { + $$var = trim($matches[1]); + } + break; + + case 'repeat': + $$var = trim($matches[1]); + break; + + default: + $$var = trim($matches[1]); + } + } + } + } + } + } + // Grab list of potential images for class backgrounds $imglist = filelist($phpbb_root_path . 'templates'); @@ -446,7 +548,7 @@ switch ($mode) { $img = substr($img['path'], 1) . (($img['path'] != '') ? '/' : '') . $img['file']; - // $selected = ' selected="selected"'; + $selected = (preg_match('#templates/' . preg_quote($img) . '#', $backgroundimage)) ? ' selected="selected"' : ''; $bg_imglist .= ''; } $bg_imglist = '' . $bg_imglist; @@ -490,8 +592,8 @@ function swatch(field) Background - Color:
This is a hex-triplet of the form RRGGBB - [ Web-safe Colour Swatch ] + Color:
This is a hex-triplet of the form RRGGBB
Web-safe Colour Swatch
+
 
Image: @@ -499,53 +601,88 @@ function swatch(field) Repeat background: - + Text - Color:
This is a hex-triplet of the form RRGGBB - [ Web-safe Colour Swatch ] + Color:
This is a hex-triplet of the form RRGGBB
Web-safe Colour Swatch
+
 
Font:
You can specify multiple fonts seperated by commas - + Size: - + Bold: - lang['YES']; ?>   lang['NO']; ?> + /> lang['YES']; ?>   /> lang['NO']; ?> Italic: - lang['YES']; ?>   lang['NO']; ?> + /> lang['YES']; ?>   /> lang['NO']; ?> Underline: - lang['YES']; ?>   lang['NO']; ?> + /> lang['YES']; ?>   /> lang['NO']; ?> Line spacing: - + Borders - Color:
This is a hex-triplet of the form RRGGBB - [ Web-safe Colour Swatch ] + Color:
This is a hex-triplet of the form RRGGBB
Web-safe Colour Swatch
+
 
Width: - + Style: - +