コード例 #1
0
ファイル: lib.php プロジェクト: harshasunny/grade
function theme_essential_process_css($css, $theme)
{
    global $USER, $DB;
    // Set the theme width
    $pagewidth = theme_essential_get_setting('pagewidth');
    $css = theme_essential_set_pagewidth($css, $pagewidth);
    // Set the theme font
    $headingfont = theme_essential_get_setting('fontnameheading');
    $bodyfont = theme_essential_get_setting('fontnamebody');
    $css = theme_essential_set_headingfont($css, $headingfont);
    $css = theme_essential_set_bodyfont($css, $bodyfont);
    $css = theme_essential_set_fontfiles($css, 'heading', $headingfont);
    $css = theme_essential_set_fontfiles($css, 'body', $bodyfont);
    // Set the theme colour.
    $themecolor = theme_essential_get_setting('themecolor');
    $css = theme_essential_set_color($css, $themecolor, '[[setting:themecolor]]', '#30ADD1');
    // Set the theme text colour.
    $themetextcolor = theme_essential_get_setting('themetextcolor');
    $css = theme_essential_set_color($css, $themetextcolor, '[[setting:themetextcolor]]', '#047797');
    // Set the theme url colour.
    $themeurlcolor = theme_essential_get_setting('themeurlcolor');
    $css = theme_essential_set_color($css, $themeurlcolor, '[[setting:themeurlcolor]]', '#FF5034');
    // Set the theme hover colour.
    $themehovercolor = theme_essential_get_setting('themehovercolor');
    $css = theme_essential_set_color($css, $themehovercolor, '[[setting:themehovercolor]]', '#F32100');
    // Set the theme header text colour.
    $themetextcolor = theme_essential_get_setting('headertextcolor');
    $css = theme_essential_set_color($css, $themetextcolor, '[[setting:headertextcolor]]', '#217a94');
    // Set the theme icon colour.
    $themeiconcolor = theme_essential_get_setting('themeiconcolor');
    $css = theme_essential_set_color($css, $themeiconcolor, '[[setting:themeiconcolor]]', '#30ADD1');
    // Set the theme navigation colour.
    $themenavcolor = theme_essential_get_setting('themenavcolor');
    $css = theme_essential_set_color($css, $themenavcolor, '[[setting:themenavcolor]]', '#ffffff');
    // Set the footer colour.
    $footercolor = theme_essential_hex2rgba(theme_essential_get_setting('footercolor'), '0.95');
    $css = theme_essential_set_color($css, $footercolor, '[[setting:footercolor]]', '#555555');
    // Set the footer text color.
    $footertextcolor = theme_essential_get_setting('footertextcolor');
    $css = theme_essential_set_color($css, $footertextcolor, '[[setting:footertextcolor]]', '#bbbbbb');
    // Set the footer heading colour.
    $footerheadingcolor = theme_essential_get_setting('footerheadingcolor');
    $css = theme_essential_set_color($css, $footerheadingcolor, '[[setting:footerheadingcolor]]', '#cccccc');
    // Set the footer separator colour.
    $footersepcolor = theme_essential_get_setting('footersepcolor');
    $css = theme_essential_set_color($css, $footersepcolor, '[[setting:footersepcolor]]', '#313131');
    // Set the footer URL color.
    $footerurlcolor = theme_essential_get_setting('footerurlcolor');
    $css = theme_essential_set_color($css, $footerurlcolor, '[[setting:footerurlcolor]]', '#217a94');
    // Set the footer hover colour.
    $footerhovercolor = theme_essential_get_setting('footerhovercolor');
    $css = theme_essential_set_color($css, $footerhovercolor, '[[setting:footerhovercolor]]', '#30add1');
    // Set the slide background colour.
    $slidebgcolor = theme_essential_hex2rgba(theme_essential_get_setting('themecolor'), '.75');
    $css = theme_essential_set_color($css, $slidebgcolor, '[[setting:carouselcolor]]', '#30add1');
    // Set the slide active pip colour.
    $slidebgcolor = theme_essential_hex2rgba(theme_essential_get_setting('themecolor'), '.25');
    $css = theme_essential_set_color($css, $slidebgcolor, '[[setting:carouselactivecolor]]', '#30add1');
    // Set the slide header colour.
    $slideshowcolor = theme_essential_get_setting('slideshowcolor');
    $css = theme_essential_set_color($css, $slideshowcolor, '[[setting:slideshowcolor]]', '#30add1');
    // Set the slide header colour.
    $slideheadercolor = theme_essential_get_setting('slideheadercolor');
    $css = theme_essential_set_color($css, $slideheadercolor, '[[setting:slideheadercolor]]', '#30add1');
    // Set the slide text colour.
    $slidecolor = theme_essential_get_setting('slidecolor');
    $css = theme_essential_set_color($css, $slidecolor, '[[setting:slidecolor]]', '#ffffff');
    // Set the slide button colour.
    $slidebuttoncolor = theme_essential_get_setting('slidebuttoncolor');
    $css = theme_essential_set_color($css, $slidebuttoncolor, '[[setting:slidebuttoncolor]]', '#30add1');
    // Set the slide button hover colour.
    $slidebuttonhcolor = theme_essential_get_setting('slidebuttonhovercolor');
    $css = theme_essential_set_color($css, $slidebuttonhcolor, '[[setting:slidebuttonhovercolor]]', '#217a94');
    if (get_config('theme_essential', 'enablealternativethemecolors1') || get_config('theme_essential', 'enablealternativethemecolors2') || get_config('theme_essential', 'enablealternativethemecolors3')) {
        // Set theme alternative colours.
        $defaultcolors = array('#a430d1', '#d15430', '#5dd130');
        $defaulthovercolors = array('#9929c4', '#c44c29', '#53c429');
        foreach (range(1, 3) as $alternative) {
            $default = $defaultcolors[$alternative - 1];
            $defaulthover = $defaulthovercolors[$alternative - 1];
            $css = theme_essential_set_alternativecolor($css, 'color' . $alternative, theme_essential_get_setting('alternativethemehovercolor' . $alternative), $default);
            $css = theme_essential_set_alternativecolor($css, 'textcolor' . $alternative, theme_essential_get_setting('alternativethemetextcolor' . $alternative), $default);
            $css = theme_essential_set_alternativecolor($css, 'urlcolor' . $alternative, theme_essential_get_setting('alternativethemeurlcolor' . $alternative), $default);
            $css = theme_essential_set_alternativecolor($css, 'hovercolor' . $alternative, theme_essential_get_setting('alternativethemehovercolor' . $alternative), $defaulthover);
        }
    }
    // Set custom CSS.
    $customcss = theme_essential_get_setting('customcss');
    $css = theme_essential_set_customcss($css, $customcss);
    // Set the background image for the logo.
    $logo = $theme->setting_file_url('logo', 'logo');
    $css = theme_essential_set_logo($css, $logo);
    // Set the background image for the header.
    $headerbackground = $theme->setting_file_url('headerbackground', 'headerbackground');
    $css = theme_essential_set_headerbackground($css, $headerbackground);
    // Set the background image for the page.
    $pagebackground = $theme->setting_file_url('pagebackground', 'pagebackground');
    $css = theme_essential_set_pagebackground($css, $pagebackground);
    // Set the background style for the page.
    $pagebgstyle = theme_essential_get_setting('pagebackgroundstyle');
    $css = theme_essential_set_pagebackgroundstyle($css, $pagebgstyle);
    // Set Marketing Image Height.
    $marketingheight = theme_essential_get_setting('marketingheight');
    $css = theme_essential_set_marketingheight($css, $marketingheight);
    // Set Marketing Images.
    $setting = 'marketing1image';
    $marketingimage = $theme->setting_file_url($setting, $setting);
    $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);
    $setting = 'marketing2image';
    $marketingimage = $theme->setting_file_url($setting, $setting);
    $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);
    $setting = 'marketing3image';
    $marketingimage = $theme->setting_file_url($setting, $setting);
    $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);
    // Finally return processed CSS
    return $css;
}
コード例 #2
0
function theme_essential_process_css($css, $theme)
{
    if (!empty($theme->settings->pagewidth)) {
        $pagewidth = $theme->settings->pagewidth;
    } else {
        $pagewidth = null;
    }
    $css = essential_set_pagewidth($css, $pagewidth);
    // Set the Fonts.
    if ($theme->settings->fontselect == 1) {
        $headingfont = 'Oswald';
        $bodyfont = 'PT Sans';
        $bodysize = '13px';
        $bodyweight = '400';
    } else {
        if ($theme->settings->fontselect == 2) {
            $headingfont = 'Lobster';
            $bodyfont = 'Cabin';
            $bodysize = '13px';
            $bodyweight = '400';
        } else {
            if ($theme->settings->fontselect == 3) {
                $headingfont = 'Raelway';
                $bodyfont = 'Goudy Bookletter 1911';
                $bodysize = '13px';
                $bodyweight = '400';
            } else {
                if ($theme->settings->fontselect == 4) {
                    $headingfont = 'Allerta';
                    $bodyfont = 'Crimson Text';
                    $bodysize = '14px';
                    $bodyweight = '400';
                } else {
                    if ($theme->settings->fontselect == 5) {
                        $headingfont = 'Arvo';
                        $bodyfont = 'PT Sans';
                        $bodysize = '14px';
                        $bodyweight = '400';
                    } else {
                        if ($theme->settings->fontselect == 6) {
                            $headingfont = 'Dancing Script';
                            $bodyfont = 'Josefin Sans';
                            $bodysize = '13px';
                            $bodyweight = '400';
                        } else {
                            if ($theme->settings->fontselect == 7) {
                                $headingfont = 'Allan';
                                $bodyfont = 'Cardo';
                                $bodysize = '14px';
                                $bodyweight = '400';
                            } else {
                                if ($theme->settings->fontselect == 8) {
                                    $headingfont = 'Molengo';
                                    $bodyfont = 'Lekton';
                                    $bodysize = '13px';
                                    $bodyweight = '400';
                                } else {
                                    if ($theme->settings->fontselect == 9) {
                                        $headingfont = 'Droid Serif';
                                        $bodyfont = 'Droid Sans';
                                        $bodysize = '13px';
                                        $bodyweight = '400';
                                    } else {
                                        if ($theme->settings->fontselect == 10) {
                                            $headingfont = 'Corben';
                                            $bodyfont = 'Nobile';
                                            $bodysize = '12px';
                                            $bodyweight = '400';
                                        } else {
                                            if ($theme->settings->fontselect == 11) {
                                                $headingfont = 'Ubuntu';
                                                $bodyfont = 'Vollkorn';
                                                $bodysize = '14px';
                                                $bodyweight = '400';
                                            } else {
                                                if ($theme->settings->fontselect == 12) {
                                                    $headingfont = 'Bree Serif';
                                                    $bodyfont = 'Open Sans';
                                                    $bodysize = '13px';
                                                    $bodyweight = '400';
                                                } else {
                                                    if ($theme->settings->fontselect == 13) {
                                                        $headingfont = 'Bevan';
                                                        $bodyfont = 'Pontano Sans';
                                                        $bodysize = '13px';
                                                        $bodyweight = '400';
                                                    } else {
                                                        if ($theme->settings->fontselect == 14) {
                                                            $headingfont = 'Abril Fatface';
                                                            $bodyfont = 'Average';
                                                            $bodysize = '13px';
                                                            $bodyweight = '400';
                                                        } else {
                                                            if ($theme->settings->fontselect == 15) {
                                                                $headingfont = 'Playfair Display';
                                                                $bodyfont = 'Multi';
                                                                $bodysize = '13px';
                                                                $bodyweight = '400';
                                                            } else {
                                                                if ($theme->settings->fontselect == 16) {
                                                                    $headingfont = 'Sansita one';
                                                                    $bodyfont = 'Kameron';
                                                                    $bodysize = '13px';
                                                                    $bodyweight = '400';
                                                                } else {
                                                                    if ($theme->settings->fontselect == 17) {
                                                                        $headingfont = 'Istok Web';
                                                                        $bodyfont = 'Lora';
                                                                        $bodysize = '13px';
                                                                        $bodyweight = '400';
                                                                    } else {
                                                                        if ($theme->settings->fontselect == 18) {
                                                                            $headingfont = 'Pacifico';
                                                                            $bodyfont = 'Arimo';
                                                                            $bodysize = '13px';
                                                                            $bodyweight = '400';
                                                                        } else {
                                                                            if ($theme->settings->fontselect == 19) {
                                                                                $headingfont = 'Nixie One';
                                                                                $bodyfont = 'Ledger';
                                                                                $bodysize = '13px';
                                                                                $bodyweight = '400';
                                                                            } else {
                                                                                if ($theme->settings->fontselect == 20) {
                                                                                    $headingfont = 'Cantata One';
                                                                                    $bodyfont = 'Imprima';
                                                                                    $bodysize = '13px';
                                                                                    $bodyweight = '400';
                                                                                } else {
                                                                                    if ($theme->settings->fontselect == 21) {
                                                                                        $headingfont = 'Rancho';
                                                                                        $bodyfont = 'Gudea';
                                                                                        $bodysize = '13px';
                                                                                        $bodyweight = '400';
                                                                                    } else {
                                                                                        if ($theme->settings->fontselect == 22) {
                                                                                            $headingfont = 'Helvetica';
                                                                                            $bodyfont = 'Georgia';
                                                                                            $bodysize = '17px';
                                                                                            $bodyweight = '400';
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    $css = theme_essential_set_headingfont($css, $headingfont);
    $css = theme_essential_set_bodyfont($css, $bodyfont);
    $css = theme_essential_set_bodysize($css, $bodysize);
    $css = theme_essential_set_bodyweight($css, $bodyweight);
    // Set the theme color.
    if (!empty($theme->settings->themecolor)) {
        $themecolor = $theme->settings->themecolor;
    } else {
        $themecolor = null;
    }
    $css = theme_essential_set_themecolor($css, $themecolor);
    // Set the theme hover color.
    if (!empty($theme->settings->themehovercolor)) {
        $themehovercolor = $theme->settings->themehovercolor;
    } else {
        $themehovercolor = null;
    }
    $css = theme_essential_set_themehovercolor($css, $themehovercolor);
    // Set the footer color.
    if (!empty($theme->settings->footercolor)) {
        $footercolor = $theme->settings->footercolor;
    } else {
        $footercolor = null;
    }
    $css = theme_essential_set_footercolor($css, $footercolor);
    // Set the footer seperator color.
    if (!empty($theme->settings->footersepcolor)) {
        $footersepcolor = $theme->settings->footersepcolor;
    } else {
        $footersepcolor = null;
    }
    $css = theme_essential_set_footersepcolor($css, $footersepcolor);
    // Set the footer text color.
    if (!empty($theme->settings->footertextcolor)) {
        $footertextcolor = $theme->settings->footertextcolor;
    } else {
        $footertextcolor = null;
    }
    $css = theme_essential_set_footertextcolor($css, $footertextcolor);
    // Set the footer URL color.
    if (!empty($theme->settings->footerurlcolor)) {
        $footerurlcolor = $theme->settings->footerurlcolor;
    } else {
        $footerurlcolor = null;
    }
    $css = theme_essential_set_footerurlcolor($css, $footerurlcolor);
    // Set the footer hover color.
    if (!empty($theme->settings->footerhovercolor)) {
        $footerhovercolor = $theme->settings->footerhovercolor;
    } else {
        $footerhovercolor = null;
    }
    $css = theme_essential_set_footerhovercolor($css, $footerhovercolor);
    // Set the footer heading color.
    if (!empty($theme->settings->footerheadingcolor)) {
        $footerheadingcolor = $theme->settings->footerheadingcolor;
    } else {
        $footerheadingcolor = null;
    }
    $css = theme_essential_set_footerheadingcolor($css, $footerheadingcolor);
    // Set the slide header color.
    if (!empty($theme->settings->slideshowcolor)) {
        $slideshowcolor = $theme->settings->slideshowcolor;
    } else {
        $slideshowcolor = null;
    }
    $css = theme_essential_set_slideshowcolor($css, $slideshowcolor);
    // Set the slide header color.
    if (!empty($theme->settings->slideheadercolor)) {
        $slideheadercolor = $theme->settings->slideheadercolor;
    } else {
        $slideheadercolor = null;
    }
    $css = theme_essential_set_slideheadercolor($css, $slideheadercolor);
    // Set the slide text color.
    if (!empty($theme->settings->slidecolor)) {
        $slidecolor = $theme->settings->slidecolor;
    } else {
        $slidecolor = null;
    }
    $css = theme_essential_set_slidecolor($css, $slidecolor);
    // Set the slide button color.
    if (!empty($theme->settings->slidebuttoncolor)) {
        $slidebuttoncolor = $theme->settings->slidebuttoncolor;
    } else {
        $slidebuttoncolor = null;
    }
    $css = theme_essential_set_slidebuttoncolor($css, $slidebuttoncolor);
    // Set theme alternative colors.
    $defaultalternativethemecolors = array('#a430d1', '#d15430', '#5dd130');
    $defaultalternativethemehovercolors = array('#9929c4', '#c44c29', '#53c429');
    foreach (range(1, 3) as $alternativethemenumber) {
        $default = $defaultalternativethemecolors[$alternativethemenumber - 1];
        $defaulthover = $defaultalternativethemehovercolors[$alternativethemenumber - 1];
        $css = theme_essential_set_alternativecolor($css, 'color' . $alternativethemenumber, $theme->settings->{'alternativethemecolor' . $alternativethemenumber}, $default);
        $css = theme_essential_set_alternativecolor($css, 'hovercolor' . $alternativethemenumber, $theme->settings->{'alternativethemehovercolor' . $alternativethemenumber}, $defaulthover);
    }
    // Set the navbar seperator.
    if (!empty($theme->settings->navbarsep)) {
        $navbarsep = $theme->settings->navbarsep;
    } else {
        $navbarsep = '/';
    }
    $css = theme_essential_set_navbarsep($css, $navbarsep);
    //Get the editicons value from settings
    if (!empty($theme->settings->editicons)) {
        $editicons = $theme->settings->editicons;
    } else {
        $editicons = null;
    }
    $css = essential_set_editicons($css, $editicons);
    // Set custom CSS.
    if (!empty($theme->settings->customcss)) {
        $customcss = $theme->settings->customcss;
    } else {
        $customcss = null;
    }
    $css = essential_set_customcss($css, $customcss);
    // Set the background image for the logo.
    $logo = $theme->setting_file_url('logo', 'logo');
    $css = theme_essential_set_logo($css, $logo);
    // Set the background image for the page.
    $setting = 'pagebackground';
    $pagebackground = $theme->setting_file_url($setting, $setting);
    $css = theme_essential_set_pagebackground($css, $pagebackground, $setting);
    // Set the Defaut Category Icon.
    if (!empty($theme->settings->defaultcategoryicon)) {
        $defaultcategoryicon = $theme->settings->defaultcategoryicon;
    } else {
        $defaultcategoryicon = null;
    }
    $css = theme_essential_set_defaultcategoryicon($css, $defaultcategoryicon);
    // Set Category Icons.
    foreach (range(1, 20) as $categorynumber) {
        $categoryicon = $defaultcategoryicon;
        if (!empty($theme->settings->usecategoryicon)) {
            if (!empty($theme->settings->{'categoryicon' . $categorynumber})) {
                $categoryicon = $theme->settings->{'categoryicon' . $categorynumber};
            }
        }
        $css = theme_essential_set_categoryicon($css, $categoryicon, $categorynumber);
    }
    // Set Slide Images.
    $setting = 'slide1image';
    if (!empty($theme->settings->slide1image)) {
        $slideimage = $theme->setting_file_url($setting, $setting);
    } else {
        $slideimage = null;
    }
    $css = theme_essential_set_slideimage($css, $slideimage, $setting);
    $setting = 'slide2image';
    if (!empty($theme->settings->slide2image)) {
        $slideimage = $theme->setting_file_url($setting, $setting);
    } else {
        $slideimage = null;
    }
    $css = theme_essential_set_slideimage($css, $slideimage, $setting);
    $setting = 'slide3image';
    if (!empty($theme->settings->slide3image)) {
        $slideimage = $theme->setting_file_url($setting, $setting);
    } else {
        $slideimage = null;
    }
    $css = theme_essential_set_slideimage($css, $slideimage, $setting);
    $setting = 'slide4image';
    if (!empty($theme->settings->slide4image)) {
        $slideimage = $theme->setting_file_url($setting, $setting);
    } else {
        $slideimage = null;
    }
    $css = theme_essential_set_slideimage($css, $slideimage, $setting);
    // Set Marketing Image Height.
    if (!empty($theme->settings->marketingheight)) {
        $marketingheight = $theme->settings->marketingheight;
    } else {
        $marketingheight = null;
    }
    $css = theme_essential_set_marketingheight($css, $marketingheight);
    // Set Marketing Images.
    $setting = 'marketing1image';
    if (!empty($theme->settings->marketing1image)) {
        $marketingimage = $theme->setting_file_url($setting, $setting);
    } else {
        $marketingimage = null;
    }
    $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);
    $setting = 'marketing2image';
    if (!empty($theme->settings->marketing2image)) {
        $marketingimage = $theme->setting_file_url($setting, $setting);
    } else {
        $marketingimage = null;
    }
    $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);
    $setting = 'marketing3image';
    if (!empty($theme->settings->marketing3image)) {
        $marketingimage = $theme->setting_file_url($setting, $setting);
    } else {
        $marketingimage = null;
    }
    $css = theme_essential_set_marketingimage($css, $marketingimage, $setting);
    // Set the font path.
    $css = theme_essential_set_fontwww($css);
    return $css;
}