Skip to content

Commit

Permalink
Code checker.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed May 9, 2023
1 parent 41f1139 commit 9540d2e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
4 changes: 2 additions & 2 deletions classes/admin_setting_configselect.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ class admin_setting_configselect extends \admin_setting_configselect {
* @return string XHTML field and wrapping div
*/
public function output_html($data, $query='') {
if (!$this->load_choices() or empty($this->choices)) {
if (!$this->load_choices() || empty($this->choices)) {
return '';
}

$current = $this->get_setting();
if (is_null($current)) {
// First run.
$default = $this->get_defaultsetting();
if ((!is_null($default)) and (empty($data))) {
if ((!is_null($default)) && (empty($data))) {
$data = $default;
}
}
Expand Down
16 changes: 8 additions & 8 deletions classes/output/core_renderer_toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function render_page() {
if (!empty($this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
if (in_array('drawer', $this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
$drawerblockshtml = $this->blocks('drawer');
$hasdrawerblocks = ((strpos($drawerblockshtml, 'data-block=') !== false) or ($this->page->user_is_editing()));
$hasdrawerblocks = ((strpos($drawerblockshtml, 'data-block=') !== false) || ($this->page->user_is_editing()));

$data->drawerblocks = $drawerblockshtml;
$data->hasdrawerblocks = $hasdrawerblocks;
Expand All @@ -80,39 +80,39 @@ public function render_page() {

if (in_array('poster', $this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
$posterblockshtml = $this->blocks('poster');
$hasposterblocks = ((strpos($posterblockshtml, 'data-block=') !== false) or ($this->page->user_is_editing()));
$hasposterblocks = ((strpos($posterblockshtml, 'data-block=') !== false) || ($this->page->user_is_editing()));

$data->posterblocks = $posterblockshtml;
$data->hasposterblocks = $hasposterblocks;
}

if (in_array('marketing', $this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
$hblockshtml = $this->hblocks('marketing');
$hashblocks = ((strpos($hblockshtml, 'data-block=') !== false) or ($this->page->user_is_editing()));
$hashblocks = ((strpos($hblockshtml, 'data-block=') !== false) || ($this->page->user_is_editing()));

$data->hblocks = $hblockshtml;
$data->hashblocks = $hashblocks;
}

if (in_array('side-pre', $this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
$preblockshtml = $this->blocks('side-pre');
$haspreblocks = ((strpos($preblockshtml, 'data-block=') !== false) or ($this->page->user_is_editing()));
$haspreblocks = ((strpos($preblockshtml, 'data-block=') !== false) || ($this->page->user_is_editing()));

$data->sidepreblocks = $preblockshtml;
$data->haspreblocks = $haspreblocks;
}

if (in_array('side-post', $this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
$postblockshtml = $this->blocks('side-post');
$haspostblocks = ((strpos($postblockshtml, 'data-block=') !== false) or ($this->page->user_is_editing()));
$haspostblocks = ((strpos($postblockshtml, 'data-block=') !== false) || ($this->page->user_is_editing()));

$data->sidepostblocks = $postblockshtml;
$data->haspostblocks = $haspostblocks;
}

if (in_array('courseend', $this->page->theme->layouts[$this->page->pagelayout]['regions'])) {
$ceblockshtml = $this->hblocks('courseend');
$hasceblocks = ((strpos($ceblockshtml, 'data-block=') !== false) or ($this->page->user_is_editing()));
$hasceblocks = ((strpos($ceblockshtml, 'data-block=') !== false) || ($this->page->user_is_editing()));

$data->ceblocks = $ceblockshtml;
$data->hasceblocks = $hasceblocks;
Expand Down Expand Up @@ -958,7 +958,7 @@ public function render_lang_menu() {
return '';
}

if ($this->page->course != SITEID and !empty($this->page->course->lang)) {
if ($this->page->course != SITEID && !empty($this->page->course->lang)) {
// Do not show lang menu if language forced.
return '';
}
Expand Down Expand Up @@ -1004,7 +1004,7 @@ public function primary_menu() {
$fav = $toolbox->get_setting('fav');
$nodisplaymycourses = ($toolbox->get_setting('displaymycourses') < 2);

// See lib/classes/navigation/output/primary.php
// See lib/classes/navigation/output/primary.php.
$menudata = [];
foreach ($this->page->primarynav->children as $node) {
switch ($node->key) {
Expand Down
2 changes: 1 addition & 1 deletion classes/the_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ private static function find_theme_location($themename) {

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
$dir = "$CFG->dirroot/theme/$themename";
} 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")) {
$dir = "$CFG->themedir/$themename";
} else {
throw new \coding_exception('Unable to find the \''.$themename.'\' theme!');
Expand Down
2 changes: 1 addition & 1 deletion lang/en/theme_foundation.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
$string['backtotop'] = 'Back to top';

// Settings.
// Information
// Information.
$string['informationheading'] = 'Information';

$string['themechanges'] = 'Changes';
Expand Down
2 changes: 2 additions & 0 deletions logout.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* Only works when Foundaion is not installed in $CFG->themedir.
*/

defined('MOODLE_INTERNAL') || die;

require_once('../../config.php');

$PAGE->set_url('/theme/foundation/logout.php');
Expand Down

0 comments on commit 9540d2e

Please sign in to comment.