Skip to content

Commit

Permalink
Make codechecker happier
Browse files Browse the repository at this point in the history
  • Loading branch information
abias committed Sep 22, 2023
1 parent 659f52c commit 3b386bd
Show file tree
Hide file tree
Showing 39 changed files with 671 additions and 669 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changes

### Unreleased

* 2023-09-22 - Make codechecker happier
* 2023-09-22 - Release: Make sure that Smart Menu SCSS does not affect installations which do not use smart menus, solves #380.
* 2023-09-22 - Bugfix: Smart menu items were being cut-off in responsive view (more menu), helps to solve #356.
* 2023-09-22 - Bugfix: Transition in second level in user menu was wrong, solves #397
Expand Down
4 changes: 2 additions & 2 deletions classes/admin_setting_configdatetime.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ public function get_setting() {

$datearr = getdate($result);

$data = array('h' => $datearr['hours'],
$data = ['h' => $datearr['hours'],
'm' => $datearr['minutes'],
'y' => $datearr['year'],
'M' => $datearr['mon'],
'd' => $datearr['mday']);
'd' => $datearr['mday'], ];
return $data;
}

Expand Down
12 changes: 6 additions & 6 deletions classes/form/flavour_edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function definition() {
$mform = $this->_form;

// Prepare yes-no option for multiple usage.
$yesnooption = array(false => get_string('no'), true => get_string('yes'));
$yesnooption = [false => get_string('no'), true => get_string('yes')];

// Add the flavour ID as hidden element.
$mform->addElement('hidden', 'id');
Expand Down Expand Up @@ -86,7 +86,7 @@ public function definition() {
'subdirs' => 0,
'maxfiles' => 1,
'accepted_types' => 'web_image',
'return_types' => FILE_INTERNAL
'return_types' => FILE_INTERNAL,
]);
$mform->addHelpButton('flavours_look_logo', 'flavourslogo', 'theme_boost_union');

Expand All @@ -96,7 +96,7 @@ public function definition() {
'subdirs' => 0,
'maxfiles' => 1,
'accepted_types' => 'web_image',
'return_types' => FILE_INTERNAL
'return_types' => FILE_INTERNAL,
]);
$mform->addHelpButton('flavours_look_logocompact', 'flavourslogocompact', 'theme_boost_union');

Expand All @@ -106,7 +106,7 @@ public function definition() {
'subdirs' => 0,
'maxfiles' => 1,
'accepted_types' => 'image',
'return_types' => FILE_INTERNAL
'return_types' => FILE_INTERNAL,
]);
$mform->addHelpButton('flavours_look_favicon', 'flavoursfavicon', 'theme_boost_union');

Expand All @@ -116,7 +116,7 @@ public function definition() {
'subdirs' => 0,
'maxfiles' => 1,
'accepted_types' => 'web_image',
'return_types' => FILE_INTERNAL
'return_types' => FILE_INTERNAL,
]);
$mform->addHelpButton('flavours_look_backgroundimage', 'flavoursbackgroundimage', 'theme_boost_union');

Expand All @@ -125,7 +125,7 @@ public function definition() {
// It will be appended to the stack of CSS code which is shipped to the browser.
// There is a follow-up issue on Github to add SCSS support.
// When this is realized, the widget's title string should be changed to 'theme_boost/rawscss'.
$mform->addElement('textarea', 'look_rawscss', get_string('flavourscustomcss', 'theme_boost_union'), array('rows' => 15));
$mform->addElement('textarea', 'look_rawscss', get_string('flavourscustomcss', 'theme_boost_union'), ['rows' => 15]);
$mform->setType('title', PARAM_TEXT);
$mform->addHelpButton('look_rawscss', 'flavourscustomcss', 'theme_boost_union');

Expand Down
54 changes: 27 additions & 27 deletions classes/form/smartmenu_edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public function definition() {
$location->setMultiple(true);

// Add mode as select element.
$modeoptions = array(
$modeoptions = [
smartmenu::MODE_SUBMENU => get_string('smartmenusmodesubmenu', 'theme_boost_union'),
smartmenu::MODE_INLINE => get_string('smartmenusmodeinline', 'theme_boost_union'),
);
];
$mform->addElement('select', 'mode', get_string('smartmenusmenumode', 'theme_boost_union'), $modeoptions);
$mform->setDefault('mode', smartmenu::MODE_SUBMENU);
$mform->setType('mode', PARAM_INT);
Expand All @@ -101,24 +101,24 @@ public function definition() {
$mform->addHelpButton('type', 'smartmenusmenutype', 'theme_boost_union');

// Add show description as select element.
$showdescriptionoptions = array(
$showdescriptionoptions = [
smartmenu::DESC_NEVER => get_string('smartmenusmenushowdescriptionnever', 'theme_boost_union'),
smartmenu::DESC_ABOVE => get_string('smartmenusmenushowdescriptionabove', 'theme_boost_union'),
smartmenu::DESC_BELOW => get_string('smartmenusmenushowdescriptionbelow', 'theme_boost_union'),
smartmenu::DESC_HELP => get_string('smartmenusmenushowdescriptionhelp', 'theme_boost_union')
);
smartmenu::DESC_HELP => get_string('smartmenusmenushowdescriptionhelp', 'theme_boost_union'),
];
$mform->addElement('select', 'showdesc', get_string('smartmenusmenushowdescription', 'theme_boost_union'),
$showdescriptionoptions);
$mform->setDefault('showdesc', smartmenu::DESC_NEVER);
$mform->setType('showdesc', PARAM_INT);
$mform->addHelpButton('showdesc', 'smartmenusmenushowdescription', 'theme_boost_union');

// Add more menu behavior as select element.
$moremenuoptions = array(
$moremenuoptions = [
smartmenu::MOREMENU_DONOTCHANGE => get_string('dontchange', 'theme_boost_union'),
smartmenu::MOREMENU_INTO => get_string('smartmenusmenumoremenubehaviorforceinto', 'theme_boost_union'),
smartmenu::MOREMENU_OUTSIDE => get_string('smartmenusmenumoremenubehaviorkeepoutside', 'theme_boost_union')
);
smartmenu::MOREMENU_OUTSIDE => get_string('smartmenusmenumoremenubehaviorkeepoutside', 'theme_boost_union'),
];
$mform->addElement('select', 'moremenubehavior', get_string('smartmenusmenumoremenubehavior', 'theme_boost_union'),
$moremenuoptions);
$mform->setDefault('moremenubehavior', smartmenu::MOREMENU_DONOTCHANGE);
Expand All @@ -131,29 +131,29 @@ public function definition() {
$mform->setType('cssclass', PARAM_TEXT);

// Add card size as select element.
$cardsizeoptions = array(
$cardsizeoptions = [
smartmenu::CARDSIZE_TINY => get_string('smartmenusmenucardsizetiny', 'theme_boost_union').' (50px)',
smartmenu::CARDSIZE_SMALL => get_string('smartmenusmenucardsizesmall', 'theme_boost_union').' (100px)',
smartmenu::CARDSIZE_MEDIUM => get_string('smartmenusmenucardsizemedium', 'theme_boost_union').' (150px)',
smartmenu::CARDSIZE_LARGE => get_string('smartmenusmenucardsizelarge', 'theme_boost_union').' (200px)'
);
smartmenu::CARDSIZE_LARGE => get_string('smartmenusmenucardsizelarge', 'theme_boost_union').' (200px)',
];
$mform->addElement('select', 'cardsize', get_string('smartmenusmenucardsize', 'theme_boost_union'), $cardsizeoptions);
$mform->setDefault('cardsize', smartmenu::CARDSIZE_TINY);
$mform->setType('cardsize', PARAM_INT);
$mform->hideIf('cardsize', 'type', 'neq', smartmenu::TYPE_CARD);
$mform->addHelpButton('cardsize', 'smartmenusmenucardsize', 'theme_boost_union');

// Add card form as select element.
$cardformoptions = array(
$cardformoptions = [
smartmenu::CARDFORM_SQUARE =>
get_string('smartmenusmenucardformsquare', 'theme_boost_union').' (1/1)',
smartmenu::CARDFORM_PORTRAIT =>
get_string('smartmenusmenucardformportrait', 'theme_boost_union').' (2/3)',
smartmenu::CARDFORM_LANDSCAPE =>
get_string('smartmenusmenucardformlandscape', 'theme_boost_union').' (3/2)',
smartmenu::CARDFORM_FULLWIDTH =>
get_string('smartmenusmenucardformfullwidth', 'theme_boost_union')
);
get_string('smartmenusmenucardformfullwidth', 'theme_boost_union'),
];
$mform->addElement('select', 'cardform',
get_string('smartmenusmenucardform', 'theme_boost_union'), $cardformoptions);
$mform->setDefault('cardform', smartmenu::CARDFORM_SQUARE);
Expand All @@ -162,12 +162,12 @@ public function definition() {
$mform->addHelpButton('cardform', 'smartmenusmenucardform', 'theme_boost_union');

// Add card overflow behaviour as select element.
$cardoverflowoptions = array(
$cardoverflowoptions = [
smartmenu::CARDOVERFLOWBEHAVIOUR_NOWRAP =>
get_string('smartmenusmenucardoverflowbehaviornowrap', 'theme_boost_union'),
smartmenu::CARDOVERFLOWBEHAVIOUR_WRAP =>
get_string('smartmenusmenucardoverflowbehaviorwrap', 'theme_boost_union')
);
get_string('smartmenusmenucardoverflowbehaviorwrap', 'theme_boost_union'),
];
$mform->addElement('select', 'cardoverflowbehavior',
get_string('smartmenusmenucardoverflowbehavior', 'theme_boost_union'), $cardoverflowoptions);
$mform->setDefault('cardoverflowbehaviour', smartmenu::CARDOVERFLOWBEHAVIOUR_NOWRAP);
Expand Down Expand Up @@ -196,10 +196,10 @@ public function definition() {
$mform->addHelpButton('roles', 'smartmenusbyrole', 'theme_boost_union');

// Add context as select element.
$rolecontext = array(
$rolecontext = [
smartmenu::ANYCONTEXT => get_string('any'),
smartmenu::SYSTEMCONTEXT => get_string('coresystem'),
);
];
$mform->addElement('select', 'rolecontext', get_string('smartmenusrolecontext', 'theme_boost_union'), $rolecontext);
$mform->setDefault('rolecontext', smartmenu::ANYCONTEXT);
$mform->setType('rolecontext', PARAM_INT);
Expand Down Expand Up @@ -228,10 +228,10 @@ public function definition() {
$mform->addHelpButton('cohorts', 'smartmenusbycohort', 'theme_boost_union');

// Add operator as select element.
$operatoroptions = array(
$operatoroptions = [
smartmenu::ANY => get_string('any'),
smartmenu::ALL => get_string('all'),
);
];
$mform->addElement('select', 'operator', get_string('smartmenusoperator', 'theme_boost_union'), $operatoroptions);
$mform->setDefault('operator', smartmenu::ANY);
$mform->setType('operator', PARAM_INT);
Expand All @@ -248,7 +248,7 @@ public function definition() {

// Add by language as autocomplete element.
$languagelist = get_string_manager()->get_list_of_translations();
$langoptions = array();
$langoptions = [];
foreach ($languagelist as $key => $lang) {
$langoptions[$key] = $lang;
}
Expand All @@ -268,23 +268,23 @@ public function definition() {

// Add from as datepicker element.
$mform->addElement('date_time_selector', 'start_date',
get_string('smartmenusbydatefrom', 'theme_boost_union'), array('optional' => true));
get_string('smartmenusbydatefrom', 'theme_boost_union'), ['optional' => true]);
$mform->addHelpButton('start_date', 'smartmenusbydatefrom', 'theme_boost_union');

// Add until as datepicker element.
$mform->addElement('date_time_selector', 'end_date',
get_string('smartmenusbydateuntil', 'theme_boost_union'), array('optional' => true));
get_string('smartmenusbydateuntil', 'theme_boost_union'), ['optional' => true]);
$mform->addHelpButton('end_date', 'smartmenusbydateuntil', 'theme_boost_union');

// Add the action buttons (as we have two buttons, we need a group).
$actionbuttons = array();
$actionclasses = array('class' => 'form-submit');
$actionbuttons = [];
$actionclasses = ['class' => 'form-submit'];
$actionbuttons[] = &$mform->createElement('submit', 'saveandreturn',
get_string('savechangesandreturn'), $actionclasses);
$actionbuttons[] = &$mform->createElement('submit', 'saveanddisplay',
get_string('smartmenussavechangesandconfigure', 'theme_boost_union'), $actionclasses);
$actionbuttons[] = &$mform->createElement('cancel');
$mform->addGroup($actionbuttons, 'actionbuttons', '', array(' '), false);
$mform->addGroup($actionbuttons, 'actionbuttons', '', [' '], false);
$mform->closeHeaderBefore('actionbuttons');
}

Expand Down
Loading

0 comments on commit 3b386bd

Please sign in to comment.