Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-40137 theme_clean: corrected lib.php function names

  • Loading branch information...
commit 6fa5e8658a97cc2dde8e00347e604947a57a8b7a 1 parent d3cf194
@samhemelryk samhemelryk authored
Showing with 68 additions and 7 deletions.
  1. +1 −1  theme/clean/config.php
  2. +67 −6 theme/clean/lib.php
View
2  theme/clean/config.php
@@ -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
73 theme/clean/lib.php
@@ -28,11 +28,20 @@
* @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)) {
@@ -40,13 +49,19 @@ function clean_process_css($css, $theme) {
} 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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.