Permalink
Browse files

Merge branch 'wip-MDL-40137-m25' of git://github.com/samhemelryk/mood…

…le into MOODLE_25_STABLE
  • Loading branch information...
2 parents 3d19b18 + 6fa5e86 commit 5e069cbd969540ce5c1100f515c1a9d657b5dc58 @stronk7 stronk7 committed Jun 17, 2013
Showing with 68 additions and 7 deletions.
  1. +1 −1 theme/clean/config.php
  2. +67 −6 theme/clean/lib.php
View
@@ -54,7 +54,7 @@
);
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
-$THEME->csspostprocess = 'clean_process_css';
+$THEME->csspostprocess = 'theme_clean_process_css';
$THEME->blockrtlmanipulations = array(
'side-pre' => 'side-post',
View
@@ -28,25 +28,40 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-function clean_process_css($css, $theme) {
+/**
+ * Parses CSS before it is cached.
+ *
+ * This function can make alterations and replace patterns within the CSS.
+ *
+ * @param string $css The CSS
+ * @param theme_config $theme The theme config object.
+ * @return string The parsed CSS The parsed CSS.
+ */
+function theme_clean_process_css($css, $theme) {
// Set the background image for the logo.
$logo = $theme->setting_file_url('logo', 'logo');
- $css = clean_set_logo($css, $logo);
+ $css = theme_clean_set_logo($css, $logo);
// Set custom CSS.
if (!empty($theme->settings->customcss)) {
$customcss = $theme->settings->customcss;
} else {
$customcss = null;
}
- $css = clean_set_customcss($css, $customcss);
+ $css = theme_clean_set_customcss($css, $customcss);
return $css;
}
-function clean_set_logo($css, $logo) {
- global $OUTPUT;
+/**
+ * Adds the logo to CSS.
+ *
+ * @param string $css The CSS.
+ * @param string $logo The URL of the logo.
+ * @return string The parsed CSS
+ */
+function theme_clean_set_logo($css, $logo) {
$tag = '[[setting:logo]]';
$replacement = $logo;
if (is_null($replacement)) {
@@ -58,6 +73,18 @@ function clean_set_logo($css, $logo) {
return $css;
}
+/**
+ * Serves any files associated with the theme settings.
+ *
+ * @param stdClass $course
+ * @param stdClass $cm
+ * @param context $context
+ * @param string $filearea
+ * @param array $args
+ * @param bool $forcedownload
+ * @param array $options
+ * @return bool
+ */
function theme_clean_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) {
if ($context->contextlevel == CONTEXT_SYSTEM and $filearea === 'logo') {
$theme = theme_config::load('clean');
@@ -67,7 +94,14 @@ function theme_clean_pluginfile($course, $cm, $context, $filearea, $args, $force
}
}
-function clean_set_customcss($css, $customcss) {
+/**
+ * Adds any custom CSS to the CSS before it is cached.
+ *
+ * @param string $css The original CSS.
+ * @param string $customcss The custom CSS to add.
+ * @return string The CSS which now contains our custom CSS.
+ */
+function theme_clean_set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;
if (is_null($replacement)) {
@@ -110,4 +144,31 @@ function theme_clean_get_html_for_settings(renderer_base $output, moodle_page $p
}
return $return;
+}
+
+/**
+ * Deprecated: Please call theme_clean_process_css instead.
+ * @deprecated since 2.5.1
+ */
+function clean_process_css($css, $theme) {
+ debugging('Please call theme_'.__FUNCTION__.' instead of '.__FUNCTION__, DEBUG_DEVELOPER);
+ return theme_clean_process_css($css, $theme);
+}
+
+/**
+ * Deprecated: Please call theme_clean_set_logo instead.
+ * @deprecated since 2.5.1
+ */
+function clean_set_logo($css, $logo) {
+ debugging('Please call theme_'.__FUNCTION__.' instead of '.__FUNCTION__, DEBUG_DEVELOPER);
+ return theme_clean_set_logo($css, $logo);
+}
+
+/**
+ * Deprecated: Please call theme_clean_set_customcss instead.
+ * @deprecated since 2.5.1
+ */
+function clean_set_customcss($css, $customcss) {
+ debugging('Please call theme_'.__FUNCTION__.' instead of '.__FUNCTION__, DEBUG_DEVELOPER);
+ return theme_clean_set_customcss($css, $customcss);
}

0 comments on commit 5e069cb

Please sign in to comment.