MDL-44207 theme_nimble: unified @package use and improved coding style

This commit is contained in:
Sam Hemelryk
2014-02-17 11:20:46 +13:00
parent 692d247a3a
commit 6a0bb481ac
4 changed files with 110 additions and 12 deletions
+22
View File
@@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The frontpage layout.
*
* @package theme_nimble
* @copyright 2010 Patrick Malley
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$hasheading = ($PAGE->heading);
$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
+22
View File
@@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* The default layout.
*
* @package theme_nimble
* @copyright 2010 Patrick Malley
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$hasheading = ($PAGE->heading);
$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
+44 -12
View File
@@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file contains functions specific to the needs of the Nimble theme.
*
* @package theme_nimble
* @copyright 2010 Patrick Malley
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Makes our changes to the CSS
@@ -9,7 +31,7 @@
*/
function nimble_process_css($css, $theme) {
// Set the link color
// Set the link color.
if (!empty($theme->settings->linkcolor)) {
$linkcolor = $theme->settings->linkcolor;
} else {
@@ -17,33 +39,32 @@ function nimble_process_css($css, $theme) {
}
$css = nimble_set_linkcolor($css, $linkcolor);
// Set the link hover color
// Set the link hover color.
if (!empty($theme->settings->linkhover)) {
$linkhover = $theme->settings->linkhover;
} else {
$linkhover = null;
}
$css = nimble_set_linkhover($css, $linkhover);
// Set the background color
// Set the background color.
if (!empty($theme->settings->backgroundcolor)) {
$backgroundcolor = $theme->settings->backgroundcolor;
} else {
$backgroundcolor = null;
}
$css = nimble_set_backgroundcolor($css, $backgroundcolor);
// Return the CSS
// Return the CSS.
return $css;
}
/**
* Sets the link color variable in CSS
*
* @param string $css
* @param string $linkcolor
* @return string
*/
function nimble_set_linkcolor($css, $linkcolor) {
$tag = '[[setting:linkcolor]]';
@@ -55,6 +76,13 @@ function nimble_set_linkcolor($css, $linkcolor) {
return $css;
}
/**
* Sets the link hover colour in CSS.
*
* @param string $css
* @param string $linkhover
* @return string
*/
function nimble_set_linkhover($css, $linkhover) {
$tag = '[[setting:linkhover]]';
$replacement = $linkhover;
@@ -65,7 +93,12 @@ function nimble_set_linkhover($css, $linkhover) {
return $css;
}
/**
* Sets the background colour in CSS.
* @param string $css
* @param string $backgroundcolor
* @return string
*/
function nimble_set_backgroundcolor($css, $backgroundcolor) {
$tag = '[[setting:backgroundcolor]]';
$replacement = $backgroundcolor;
@@ -74,5 +107,4 @@ function nimble_set_backgroundcolor($css, $backgroundcolor) {
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
}
+22
View File
@@ -1,4 +1,26 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Settings for the Nimble theme.
*
* @package theme_nimble
* @copyright 2010 Patrick Malley
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;