From 3f850d346249e66e39f1e6646bfeb5e5f26b7150 Mon Sep 17 00:00:00 2001 From: Thomas Willingham Date: Tue, 1 Oct 2013 23:04:14 +0100 Subject: Do PCSS properly --- view/theme/redbasic/php/config.php | 173 ++++++-------------------------- view/theme/redbasic/php/style.php | 199 ++++++++++--------------------------- 2 files changed, 88 insertions(+), 284 deletions(-) (limited to 'view/theme/redbasic/php') diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index 4e7363362..2502bb675 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -1,164 +1,57 @@ "1.3", - "---" => "---", - "1.6" => "1.6", - "1.5" => "1.5", - "1.4" => "1.4", - "1.2" => "1.2", - "1.1" => "1.1", - ); - $font_sizes = array( - '12' => '12', - '14' => '14', - "---" => "---", - "16" => "16", - "15" => "15", - '13.5' => '13.5', - '13' => '13', - '12.5' => '12.5', - '12' => '12', - ); - $colours = array( - 'light' => 'light', - 'dark' => 'dark', - ); - - $colour_schemes = array( - 'redbasic' => 'redbasic', - 'fancyred' => 'fancyred', - 'dark' => 'dark', - ); - $shadows = array( - 'true' => 'Yes', - 'false' => 'No', - ); +function redbasic_form(&$a, $nav_colour, $background_colour, $background_image, $item_colour, $item_opacity, + $font_size, $font_colour, $radius) { - $navcolours = array ( + $nav_colours = array ( 'red' => 'red', 'black' => 'black', - ); - - $displaystyles = array ( - 'fancy' => 'fancy', - 'classic' => 'classic', - ); - - $linkcolours = array ( - 'blue' => 'blue', - 'red' => 'red', - ); - - $iconsets = array ( - 'default' => 'default', - ); - - $shinys = array ( - 'none' => 'none', - 'opaque' => 'opaque', - ); - if(feature_enabled(local_user(),'expert')) { + ); + $t = get_markup_template('theme_settings.tpl'); $o .= replace_macros($t, array( '$submit' => t('Submit'), '$baseurl' => $a->get_baseurl(), '$title' => t("Theme settings"), - '$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes), - '$line_height' => array('redbasic_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights), - '$colour' => array('redbasic_colour', t('Set colour scheme'), $colour, '', $colours), - '$shadow' => array('redbasic_shadow', t('Draw shadows'), $shadow, '', $shadows), - '$navcolour' => array('redbasic_navcolour', t('Navigation bar colour'), $navcolour, '', $navcolours), - '$displaystyle' => array('redbasic_displaystyle', t('Display style'), $displaystyle, '', $displaystyles), - '$linkcolour' => array('redbasic_linkcolour', t('Display colour of links - hex value, do not include the #'), $linkcolour, '', $linkcolours), - '$iconset' => array('redbasic_iconset', t('Icons'), $iconset, '', $iconsets), - '$shiny' => array('redbasic_shiny', t('Shiny style'), $shiny, '', $shinys), - '$radius' => array('redbasic_radius', t('Corner radius'), $radius, t('0-99 default: 5')), - ));} - - if(! feature_enabled(local_user(),'expert')) { - $t = get_markup_template('basic_theme_settings.tpl'); - $o .= replace_macros($t, array( - '$submit' => t('Submit'), - '$baseurl' => $a->get_baseurl(), - '$title' => t("Theme settings"), - '$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size, '', $font_sizes), - '$line_height' => array('redbasic_line_height', t('Set line-height for posts and comments'), $line_height, '', $line_heights), - '$colour_scheme' => array('redbasic_colour_scheme', t('Set colour scheme'), $colour_scheme, '', $colour_schemes), - ));} - + '$nav_colour' => array('redbasic_nav_colour', t('Navigation bar colour'), $nav_colour, '', $nav_colours), + '$background_colour' => array('redbasic_background_colour', t('Set the background colour'), $background_colour), + '$background_image' => array('redbasic_background_image', t('Set the background image'), $background_image), + '$item_colour' => array('redbasic_item_colour', t('Set the background colour of items'), $item_colour), + '$item_opacity' => array('redbasic_item_opacity', t('Set the opacity of items'), $item_opacity), + '$font_size' => array('redbasic_font_size', t('Set font-size for posts and comments'), $font_size), + '$font_colour' => array('redbasic_font_colour', t('Set font-colour for posts and comments'), $font_colour), + '$radius' => array('redbasic_radius', t('Set radius of corners'), $radius), + )); + return $o; } - diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php index 8643925d3..26990823a 100644 --- a/view/theme/redbasic/php/style.php +++ b/view/theme/redbasic/php/style.php @@ -1,159 +1,70 @@ $nav_bg_1, +'$nav_bg_2' => $nav_bg_2, +'$nav_bg_3' => $nav_bg_3, +'$nav_bg_4' => $nav_bg_4, +'$background_colour' => $background_colour, +'$background_image' => $background_image, +'$item_colour' => $item_colour, +'$item_opacity' => $item_opacity, +'$font_size' => $font_size, +'$font_colour' => $font_colour, +'$radius' => $radius +); + +echo str_replace(array_keys($options), array_values($options), $x); - if(($redbasic_font_size >= 8.0) && ($redbasic_font_size <= 20.0)) { - echo ".wall-item-content { font-size: ${redbasic_font_size}px;}\r\n"; - } - - if(($line_height >= 1.0) && ($line_height <= 2.0)) { - echo ".wall-item-content { line-height: $line_height; }\r\n"; - } - - -// Minimum value shadows - they shouldn't all be the same size; just get it working, clean up later. - if($shadows === "true") { - echo "code, blockquote, .wall-item-content-wrapper, .wall-item-content-wrapper.comment, .wall-item-content img, #profile-jot-perms, #profile-jot-submit, .tab, .tab.active, .settings-widget li, .wall-item-photo, .photo, .contact-block-img, .my-comment-photo, #posted-date-selector:hover, .contact-entry-photo img, .profile-match-photo img, #photo-photo img, .directory-photo-img, .photo-album-photo, .photo-top-photo, .group-selected, .nets-selected, .fileas-selected, .categories-selected { - box-shadow: 5px 5px 5px #111;}\r\n - - .tab.active, #jot-title, #jot-category, .comment-edit-text-empty, .comment-edit-text-full, iframe#profile-jot-text_ifr, #profile-jot-text { - box-shadow: 5px 5px 5px #666 inset;}\r\n"; - - } - -// Since every change would otherwise require five lines, it's simpler to just set a default and echo this without first checking if we've set it. - echo "nav {background-image: linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%); - background-image: -o-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%); - background-image: -moz-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%) !important; - background-image: -webkit-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%); - background-image: -ms-linear-gradient(bottom, #$nav_bg_1 26%, #$nav_bg_2 82%);}"; - - if($navcolour === false || $navcolour === 'red') { - echo "nav:hover {background-image: linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%); - background-image: -o-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%); - background-image: -moz-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%) !important; - background-image: -webkit-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%); - background-image: -ms-linear-gradient(bottom, #$nav_bg_3 26%, #$nav_bg_4 82%);}"; - } - -// This takes quite a lot of code, so we'll keep it in a separate file, and echo the lot. Devs still don't have to worry about - it's just overrides. -// Theme devs can play with it without facing scary PHP. - - if ($displaystyle === "fancy") - {if (file_exists('view/theme/' . current_theme() . '/css/fancy.css')) { - $fancy = (file_get_contents('view/theme/' . current_theme() . '/css/fancy.css')); - echo str_replace(array('$radius'),array($radius),$fancy); - } - } - -// Put the # here to force hex colours - if we don't, somebody is going to do something odd, using RGB and we're all going to be confused on the support forums -// until one of us works out what they've done. - - if ($linkcolour != false) { - echo "a, a:visited, a:link, .fakelink, .fakelink:visited, .fakelink:link {color: #$linkcolour;}\r\n"; - } - -// If you want a shiny that just sets a different colour, add an if $shiny != false and handle it as the linkcolour above. - - if ($shiny === 'opaque') { - echo "div.wall-item-content-wrapper.shiny {opacity: 1;}\r\n - .wall-item-content-wrapper {opacity: 0.8;}"; - } \ No newline at end of file +} -- cgit v1.2.3