mirror of
https://github.com/catalyst/moodle-auth_outage.git
synced 2026-05-17 05:48:43 +02:00
Applying moodle coding standards.
This commit is contained in:
@@ -88,6 +88,7 @@ class infopage {
|
||||
/**
|
||||
* Generates and outputs the HTML for the info page.
|
||||
* @uses redirect
|
||||
* @SuppressWarnings(PHPMD.UnusedLocalVariable) $viewbag is used inside 'require'.
|
||||
*/
|
||||
public function output() {
|
||||
global $PAGE, $CFG, $OUTPUT;
|
||||
@@ -96,11 +97,6 @@ class infopage {
|
||||
redirect(new moodle_url('/'));
|
||||
}
|
||||
|
||||
$viewbag = [
|
||||
'admin' => is_siteadmin(),
|
||||
'outage' => $this->outage,
|
||||
];
|
||||
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_title($this->outage->get_title());
|
||||
$PAGE->set_heading($this->outage->get_title());
|
||||
@@ -110,6 +106,10 @@ class infopage {
|
||||
outagelib::inject();
|
||||
|
||||
echo $OUTPUT->header();
|
||||
$viewbag = [
|
||||
'admin' => is_siteadmin(),
|
||||
'outage' => $this->outage,
|
||||
];
|
||||
require($CFG->dirroot.'/auth/outage/views/info/content.php');
|
||||
|
||||
// Moodle 2.7 did not check for CLI mode, which was fixed later.
|
||||
|
||||
@@ -58,7 +58,8 @@ class maintenance_static_page {
|
||||
} else if (PHPUNIT_TEST) {
|
||||
$html = '<html></html>';
|
||||
} else {
|
||||
$data = maintenance_static_page_io::file_get_data($CFG->wwwroot.'/auth/outage/info.php?auth_outage_hide_warning=1&id='.$outage->id);
|
||||
$data = maintenance_static_page_io::file_get_data(
|
||||
$CFG->wwwroot.'/auth/outage/info.php?auth_outage_hide_warning=1&id='.$outage->id);
|
||||
$html = $data['contents'];
|
||||
}
|
||||
|
||||
|
||||
@@ -116,7 +116,6 @@ class maintenance_static_page_generator {
|
||||
private function update_link_stylesheet() {
|
||||
$links = $this->dom->getElementsByTagName('link');
|
||||
|
||||
/** @var DOMElement $link */
|
||||
foreach ($links as $link) {
|
||||
$rel = $link->getAttribute("rel");
|
||||
$href = $link->getAttribute("href");
|
||||
@@ -137,6 +136,7 @@ class maintenance_static_page_generator {
|
||||
/**
|
||||
* Checks for urls inside filename.
|
||||
* @param string $filename
|
||||
* @param string $baseref
|
||||
*/
|
||||
private function update_link_stylesheet_parse($filename, $baseref) {
|
||||
global $CFG;
|
||||
@@ -145,20 +145,20 @@ class maintenance_static_page_generator {
|
||||
if (!preg_match_all('#url\([\'"]?([^\'"\)]+)#', $contents, $matches)) {
|
||||
return;
|
||||
}
|
||||
foreach ($matches[1] as $original_url) {
|
||||
foreach ($matches[1] as $originalurl) {
|
||||
// Allow incomplete URLs in CSS, assume it is from moodle root.
|
||||
if (maintenance_static_page_io::is_url($original_url)) {
|
||||
$full_url = $original_url;
|
||||
} else if ($original_url[0] == '/') {
|
||||
$full_url = $CFG->wwwroot.$original_url;
|
||||
if (maintenance_static_page_io::is_url($originalurl)) {
|
||||
$fullurl = $originalurl;
|
||||
} else if ($originalurl[0] == '/') {
|
||||
$fullurl = $CFG->wwwroot.$originalurl;
|
||||
} else {
|
||||
$full_url = $baseref.'/'.$original_url;
|
||||
$fullurl = $baseref.'/'.$originalurl;
|
||||
}
|
||||
|
||||
$saved = $this->io->save_url_file($full_url);
|
||||
$saved = $this->io->save_url_file($fullurl);
|
||||
if (!is_null($saved)) {
|
||||
$final_url = $this->io->get_url_for_file($saved['url']);
|
||||
$contents = str_replace($original_url, $final_url, $contents);
|
||||
$finalurl = $this->io->get_url_for_file($saved['url']);
|
||||
$contents = str_replace($originalurl, $finalurl, $contents);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,6 @@ class maintenance_static_page_generator {
|
||||
private function update_link_favicon() {
|
||||
$links = $this->dom->getElementsByTagName('link');
|
||||
|
||||
/** @var DOMElement $link */
|
||||
foreach ($links as $link) {
|
||||
$rel = $link->getAttribute("rel");
|
||||
$href = $link->getAttribute("href");
|
||||
@@ -188,7 +187,6 @@ class maintenance_static_page_generator {
|
||||
private function update_images() {
|
||||
$links = $this->dom->getElementsByTagName('img');
|
||||
|
||||
/** @var DOMElement $link */
|
||||
foreach ($links as $link) {
|
||||
$src = $link->getAttribute("src");
|
||||
if ($src == '') {
|
||||
|
||||
Reference in New Issue
Block a user