MDL-82183 core: Coding style fixes for core\output

This commit is contained in:
Andrew Nicols
2024-06-26 23:00:33 +08:00
parent ff0fd2764a
commit 9043dc75bf
95 changed files with 2181 additions and 1759 deletions
+13 -10
View File
@@ -59,7 +59,6 @@ function theme_get_revision() {
} else {
return $CFG->themerev;
}
} else {
return -1;
}
@@ -99,11 +98,11 @@ function theme_get_next_revision() {
global $CFG;
$next = time();
if (isset($CFG->themerev) and $next <= $CFG->themerev and $CFG->themerev - $next < 60*60) {
if (isset($CFG->themerev) && ($next <= $CFG->themerev) && (($CFG->themerev - $next) < 60 * 60)) {
// This resolves problems when reset is requested repeatedly within 1s,
// the < 1h condition prevents accidental switching to future dates
// because we might not recover from it.
$next = $CFG->themerev+1;
$next = $CFG->themerev + 1;
}
return $next;
@@ -120,7 +119,7 @@ function theme_get_next_sub_revision_for_theme($themename) {
$next = time();
$current = theme_get_sub_revision_for_theme($themename);
if ($next <= $current and $current - $next < 60 * 60) {
if ($next <= $current && $current - $next < 60 * 60) {
// This resolves problems when reset is requested repeatedly within 1s,
// the < 1h condition prevents accidental switching to future dates
// because we might not recover from it.
@@ -160,7 +159,7 @@ function theme_get_config_file_path($themename) {
if (file_exists("{$CFG->dirroot}/theme/{$themename}/config.php")) {
return "{$CFG->dirroot}/theme/{$themename}/config.php";
} else if (!empty($CFG->themedir) and file_exists("{$CFG->themedir}/{$themename}/config.php")) {
} else if (!empty($CFG->themedir) && file_exists("{$CFG->themedir}/{$themename}/config.php")) {
return "{$CFG->themedir}/{$themename}/config.php";
} else {
return null;
@@ -191,8 +190,12 @@ function theme_get_css_filename($themename, $globalrevision, $themerevision, $di
* @param bool $cache Should the generated files be stored in local cache.
* @return array The built theme content in a multi-dimensional array of name => direction => content
*/
function theme_build_css_for_themes($themeconfigs = [], $directions = ['rtl', 'ltr'],
$cache = true, $mtraceprogress = false): array {
function theme_build_css_for_themes(
$themeconfigs = [],
$directions = ['rtl', 'ltr'],
$cache = true,
$mtraceprogress = false
): array {
global $CFG;
if (empty($themeconfigs)) {
@@ -344,7 +347,7 @@ function template_reset_all_caches() {
global $CFG;
$next = time();
if (isset($CFG->templaterev) and $next <= $CFG->templaterev and $CFG->templaterev - $next < 60 * 60) {
if (isset($CFG->templaterev) && $next <= $CFG->templaterev && $CFG->templaterev - $next < 60 * 60) {
// This resolves problems when reset is requested repeatedly within 1s,
// the < 1h condition prevents accidental switching to future dates
// because we might not recover from it.
@@ -361,11 +364,11 @@ function js_reset_all_caches() {
global $CFG;
$next = time();
if (isset($CFG->jsrev) and $next <= $CFG->jsrev and $CFG->jsrev - $next < 60*60) {
if (isset($CFG->jsrev) && $next <= $CFG->jsrev && $CFG->jsrev - $next < 60 * 60) {
// This resolves problems when reset is requested repeatedly within 1s,
// the < 1h condition prevents accidental switching to future dates
// because we might not recover from it.
$next = $CFG->jsrev+1;
$next = $CFG->jsrev + 1;
}
set_config('jsrev', $next);