diff --git a/CHANGES.md b/CHANGES.md index 5eee658bcc2..134a493e975 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/classes/admin_setting_configdatetime.php b/classes/admin_setting_configdatetime.php index 0afb7eee551..603c5b61fbc 100644 --- a/classes/admin_setting_configdatetime.php +++ b/classes/admin_setting_configdatetime.php @@ -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; } diff --git a/classes/form/flavour_edit_form.php b/classes/form/flavour_edit_form.php index 21dbc223753..e6d1a115e97 100644 --- a/classes/form/flavour_edit_form.php +++ b/classes/form/flavour_edit_form.php @@ -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'); @@ -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'); @@ -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'); @@ -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'); @@ -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'); @@ -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'); diff --git a/classes/form/smartmenu_edit_form.php b/classes/form/smartmenu_edit_form.php index 249280e33a4..33abae86f83 100644 --- a/classes/form/smartmenu_edit_form.php +++ b/classes/form/smartmenu_edit_form.php @@ -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); @@ -101,12 +101,12 @@ 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); @@ -114,11 +114,11 @@ public function definition() { $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); @@ -131,12 +131,12 @@ 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); @@ -144,7 +144,7 @@ public function definition() { $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 => @@ -152,8 +152,8 @@ public function definition() { 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); @@ -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); @@ -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); @@ -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); @@ -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; } @@ -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'); } diff --git a/classes/form/smartmenu_item_edit_form.php b/classes/form/smartmenu_item_edit_form.php index 750ba6b771c..988b52c2b03 100644 --- a/classes/form/smartmenu_item_edit_form.php +++ b/classes/form/smartmenu_item_edit_form.php @@ -98,10 +98,10 @@ public function definition() { $mform->addHelpButton('url', 'smartmenusmenuitemurl', 'theme_boost_union'); // Add mode as select element. - $modeoptions = array( + $modeoptions = [ smartmenu_item::MODE_INLINE => get_string('smartmenusmodeinline', 'theme_boost_union'), smartmenu_item::MODE_SUBMENU => get_string('smartmenusmodesubmenu', 'theme_boost_union'), - ); + ]; $mform->addElement('select', 'mode', get_string('smartmenusmenuitemmode', 'theme_boost_union'), $modeoptions); $mform->setDefault('mode', smartmenu_item::MODE_INLINE); $mform->setType('mode', PARAM_INT); @@ -131,14 +131,14 @@ public function definition() { $mform->addHelpButton('enrolmentrole', 'smartmenusdynamiccoursesenrolmentrole', 'theme_boost_union'); // Add completion status (for the dynamic courses menu item type) as autocomplete element. - $completionstatusoptions = array( + $completionstatusoptions = [ smartmenu_item::COMPLETION_ENROLLED => get_string('smartmenusdynamiccoursescompletionstatusenrolled', 'theme_boost_union'), smartmenu_item::COMPLETION_INPROGRESS => get_string('smartmenusdynamiccoursescompletionstatusinprogress', 'theme_boost_union'), smartmenu_item::COMPLETION_COMPLETED => get_string('smartmenusdynamiccoursescompletionstatuscompleted', 'theme_boost_union'), - ); + ]; $completionstatuswidget = $mform->addElement('autocomplete', 'completionstatus', get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union').': '. get_string('smartmenusdynamiccoursescompletionstatus', 'theme_boost_union'), $completionstatusoptions); @@ -148,14 +148,14 @@ public function definition() { $mform->addHelpButton('completionstatus', 'smartmenusdynamiccoursescompletionstatus', 'theme_boost_union'); // Add date range (for the dynamic courses menu item type) as autocomplete element. - $daterangeoptions = array( + $daterangeoptions = [ smartmenu_item::RANGE_PAST => get_string('smartmenusdynamiccoursesdaterangepast', 'theme_boost_union'), smartmenu_item::RANGE_PRESENT => get_string('smartmenusdynamiccoursesdaterangepresent', 'theme_boost_union'), smartmenu_item::RANGE_FUTURE => get_string('smartmenusdynamiccoursesdaterangefuture', 'theme_boost_union'), - ); + ]; $daterangewidget = $mform->addElement('autocomplete', 'daterange', get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union').': '. get_string('smartmenusdynamiccoursesdaterange', 'theme_boost_union'), $daterangeoptions); @@ -189,13 +189,13 @@ public function definition() { $PAGE->requires->js_call_amd('theme_boost_union/fontawesome-popover', 'init', ['#id_menuicon', $systemcontextid]); // Add title presentation and select element. - $displayoptions = array( + $displayoptions = [ smartmenu_item::DISPLAY_SHOWTITLEICON => get_string('smartmenusmenuitemdisplayoptionsshowtitleicon', 'theme_boost_union'), smartmenu_item::DISPLAY_HIDETITLE => get_string('smartmenusmenuitemdisplayoptionshidetitle', 'theme_boost_union'), smartmenu_item::DISPLAY_HIDETITLEMOBILE => - get_string('smartmenusmenuitemdisplayoptionshidetitlemobile', 'theme_boost_union') - ); + get_string('smartmenusmenuitemdisplayoptionshidetitlemobile', 'theme_boost_union'), + ]; $mform->addElement('select', 'display', get_string('smartmenusmenuitemdisplayoptions', 'theme_boost_union'), $displayoptions); $mform->setDefault('display', smartmenu_item::DISPLAY_SHOWTITLEICON); @@ -208,10 +208,10 @@ public function definition() { $mform->addHelpButton('tooltip', 'smartmenusmenuitemtooltip', 'theme_boost_union'); // Add link target as select element. - $targetoptions = array( + $targetoptions = [ smartmenu_item::TARGET_SAME => get_string('smartmenusmenuitemlinktargetsamewindow', 'theme_boost_union'), - smartmenu_item::TARGET_NEW => get_string('smartmenusmenuitemlinktargetnewtab', 'theme_boost_union') - ); + smartmenu_item::TARGET_NEW => get_string('smartmenusmenuitemlinktargetnewtab', 'theme_boost_union'), + ]; $mform->addElement('select', 'target', get_string('smartmenusmenuitemlinktarget', 'theme_boost_union'), $targetoptions); $mform->setDefault('target', smartmenu_item::TARGET_SAME); @@ -284,14 +284,14 @@ public function definition() { $mform->addHelpButton('image', 'smartmenusmenuitemcardimage', 'theme_boost_union'); // Add card text position as select element. - $textpositionoptions = array( + $textpositionoptions = [ smartmenu_item::POSITION_BELOW => get_string('smartmenusmenuitemtextpositionbelowimage', 'theme_boost_union'), smartmenu_item::POSITION_OVERLAYTOP => get_string('smartmenusmenuitemtextpositionoverlaytop', 'theme_boost_union'), smartmenu_item::POSITION_OVERLAYBOTTOM => - get_string('smartmenusmenuitemtextpositionoverlaybottom', 'theme_boost_union') - ); + get_string('smartmenusmenuitemtextpositionoverlaybottom', 'theme_boost_union'), + ]; $mform->addElement('select', 'textposition', get_string('smartmenusmenuitemtextposition', 'theme_boost_union'), $textpositionoptions); $mform->setDefault('textposition', smartmenu_item::POSITION_BELOW); @@ -332,10 +332,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); @@ -364,10 +364,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); @@ -384,7 +384,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; } @@ -404,12 +404,12 @@ 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. diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index dd40392933a..2f8347b7fdb 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -284,7 +284,7 @@ public function get_compact_logo_url($maxwidth = 300, $maxheight = 300) { * @param string|array $additionalclasses Any additional classes to give the body tag, * @return string */ - public function body_attributes($additionalclasses = array()) { + public function body_attributes($additionalclasses = []) { global $CFG; // Require local libraries. diff --git a/classes/output/navigation/primary.php b/classes/output/navigation/primary.php index f899ea2b630..19c2175c5d8 100644 --- a/classes/output/navigation/primary.php +++ b/classes/output/navigation/primary.php @@ -28,7 +28,7 @@ use renderer_base; use templatable; use custom_menu; -use \theme_boost_union\smartmenu; +use theme_boost_union\smartmenu; /** * Primary navigation renderable. @@ -147,7 +147,7 @@ public function export_for_template(?renderer_base $output = null): array { 'menubar' => isset($menubarmoremenu) ? $menubarmoremenu->export_for_template($output) : false, 'lang' => !isloggedin() || isguestuser() ? $languagemenu->export_for_template($output) : [], 'user' => $usermenu ?? [], - 'bottombar' => $bottombardata ?? false + 'bottombar' => $bottombardata ?? false, ]; } @@ -233,7 +233,7 @@ public function build_usermenus(&$usermenu, $menus) { 'title' => '####', 'itemtype' => 'divider', 'divider' => 1, - 'link' => '' + 'link' => '', ]; array_push($usermenu['items'], $divider); diff --git a/classes/smartmenu.php b/classes/smartmenu.php index ff338a22c75..d135bbf37a5 100644 --- a/classes/smartmenu.php +++ b/classes/smartmenu.php @@ -467,7 +467,7 @@ protected function get_cardform() { self::CARDFORM_SQUARE => 'square', self::CARDFORM_PORTRAIT => 'portrait', self::CARDFORM_LANDSCAPE => 'landscape', - self::CARDFORM_FULLWIDTH => 'fullwidth' + self::CARDFORM_FULLWIDTH => 'fullwidth', ]; return isset($options[$this->menu->cardform]) ? 'card-form-'.$options[$this->menu->cardform] : ''; @@ -484,7 +484,7 @@ protected function get_cardsize() { self::CARDSIZE_TINY => 'tiny', self::CARDSIZE_SMALL => 'small', self::CARDSIZE_MEDIUM => 'medium', - self::CARDSIZE_LARGE => 'large' + self::CARDSIZE_LARGE => 'large', ]; return isset($options[$this->menu->cardsize]) ? 'card-size-' . $options[$this->menu->cardsize] : ''; @@ -499,7 +499,7 @@ public function get_cardwrap() { $options = [ self::CARDOVERFLOWBEHAVIOUR_WRAP => 'wrap', - self::CARDOVERFLOWBEHAVIOUR_NOWRAP => 'no-wrap' + self::CARDOVERFLOWBEHAVIOUR_NOWRAP => 'no-wrap', ]; return isset($options[$this->menu->cardoverflowbehavior]) ? 'card-overflow-' . @@ -521,7 +521,7 @@ public function get_menu_items() { ORDER BY mi.sortorder ASC"; $params = [ - 'id' => $this->menu->id + 'id' => $this->menu->id, ]; $items = $DB->get_records_sql($sql, $params); @@ -602,7 +602,7 @@ public function build($resetcache=false) { 'card' => ($this->menu->type == self::TYPE_CARD) ? true : false, 'forceintomoremenu' => ($this->menu->moremenubehavior == self::MOREMENU_INTO) ? true : false, 'haschildren' => 0, - 'sort' => uniqid() // Support third level menu. + 'sort' => uniqid(), // Support third level menu. ]; // Add the description data to nodes. Inline mode menus not supports the menu. @@ -622,7 +622,7 @@ public function build($resetcache=false) { 'text' => $description, 'alt' => $alt, 'icon' => (new \pix_icon('help', $alt, 'core', ['class' => 'iconhelp']))->export_for_template($OUTPUT), - 'ltr' => !right_to_left() + 'ltr' => !right_to_left(), ]; $nodes->helpicon = $OUTPUT->render_from_template('core/help_icon', $data); } @@ -775,7 +775,7 @@ public static function update_menu_valuesformat($menu) { $menu->description = [ 'text' => $menu->description, - 'format' => $menu->description_format + 'format' => $menu->description_format, ]; // Decode the multiple option select elements values to array. $menu->location = json_decode($menu->location); @@ -816,12 +816,12 @@ public static function get_lastmenu() { */ public static function get_locations() { // List of locations where same menu can be used in multiple places. - $locations = array( + $locations = [ self::LOCATION_MAIN => get_string('smartmenusmenulocationmain', 'theme_boost_union'), self::LOCATION_MENU => get_string('smartmenusmenulocationmenu', 'theme_boost_union'), self::LOCATION_USER => get_string('smartmenusmenulocationuser', 'theme_boost_union'), - self::LOCATION_BOTTOM => get_string('smartmenusmenulocationbottom', 'theme_boost_union') - ); + self::LOCATION_BOTTOM => get_string('smartmenusmenulocationbottom', 'theme_boost_union'), + ]; return $locations; } @@ -843,10 +843,10 @@ public static function get_location($location) { * @return array An array with all available types, where key is the type id and value is the localized type name. */ public static function get_types() { - $types = array( + $types = [ self::TYPE_LIST => get_string('smartmenusmenutypelist', 'theme_boost_union'), - self::TYPE_CARD => get_string('smartmenusmenutypecard', 'theme_boost_union') - ); + self::TYPE_CARD => get_string('smartmenusmenutypecard', 'theme_boost_union'), + ]; return $types; } diff --git a/classes/smartmenu_item.php b/classes/smartmenu_item.php index 2ede3ba94ac..b8da4cf4191 100644 --- a/classes/smartmenu_item.php +++ b/classes/smartmenu_item.php @@ -31,7 +31,7 @@ use smartmenu_helper; use stdClass; use cache; -use \core_course\external\course_summary_exporter; +use core_course\external\course_summary_exporter; require_once($CFG->dirroot.'/theme/boost_union/smartmenus/menulib.php'); @@ -366,7 +366,7 @@ public function move_upward() { $sql = 'SELECT * FROM {theme_boost_union_menuitems} WHERE sortorder < :pos AND menu = :menu ORDER BY sortorder ASC'; $previtems = $DB->get_records_sql($sql, [ 'pos' => $currentposition, - 'menu' => $this->item->menu + 'menu' => $this->item->menu, ]); if (empty($previtems)) { @@ -378,12 +378,12 @@ public function move_upward() { // Update the menu position to upwards. $DB->set_field('theme_boost_union_menuitems', 'sortorder', $previtem->sortorder, [ 'id' => $this->id, - 'menu' => $this->item->menu + 'menu' => $this->item->menu, ]); // Set the prevmenu position to down. $DB->set_field('theme_boost_union_menuitems', 'sortorder', $currentposition, [ 'id' => $previtem->id, - 'menu' => $this->item->menu + 'menu' => $this->item->menu, ]); // Difference between two items is more than 1 then reorder the items. @@ -411,7 +411,7 @@ public function move_downward() { $sql = 'SELECT * FROM {theme_boost_union_menuitems} WHERE sortorder > :pos AND menu = :menu ORDER BY sortorder ASC'; $nextitems = $DB->get_records_sql($sql, [ 'pos' => $currentposition, - 'menu' => $this->item->menu + 'menu' => $this->item->menu, ]); if (empty($nextitems)) { @@ -422,12 +422,12 @@ public function move_downward() { // Update the menu position to down. $DB->set_field('theme_boost_union_menuitems', 'sortorder', $nextitem->sortorder, [ 'id' => $this->id, - 'menu' => $this->item->menu + 'menu' => $this->item->menu, ]); // Set the prevmenu position to up. $DB->set_field('theme_boost_union_menuitems', 'sortorder', $currentposition, [ 'id' => $nextitem->id, - 'menu' => $this->item->menu + 'menu' => $this->item->menu, ]); // Difference between two items is more than 1 then reorder the items. @@ -1046,7 +1046,7 @@ public function generate_node_data($title, $url, $key=null, $tooltip=null, 'itemimage' => $itemimage, 'itemtype' => 'link', 'link' => 1, - 'sort' => uniqid() // Support third level menu. + 'sort' => uniqid(), // Support third level menu. ]; if ($haschildren && !empty($children)) { @@ -1054,10 +1054,10 @@ public function generate_node_data($title, $url, $key=null, $tooltip=null, } if ($this->item->target == self::TARGET_NEW && $url != '') { - $data['attributes'] = array([ + $data['attributes'] = [[ 'name' => 'target', - 'value' => '__blank' - ]); + 'value' => '__blank', + ], ]; } if (preg_match("/^#+$/", format_string($title))) { @@ -1187,11 +1187,11 @@ public static function load_custom_field_config(&$mform) { * @return array|string An array of types if $type is null, or a string with the name of the specific type. */ public static function get_types(int $type=null) { - $types = array( + $types = [ self::TYPESTATIC => get_string('smartmenusmenuitemtypestatic', 'theme_boost_union'), self::TYPEHEADING => get_string('smartmenusmenuitemtypeheading', 'theme_boost_union'), self::TYPEDYNAMIC => get_string('smartmenusmenuitemtypedynamiccourses', 'theme_boost_union'), - ); + ]; return ($type !== null && isset($types[$type])) ? $types[$type] : $types; } @@ -1207,7 +1207,7 @@ public static function get_display_options(int $option=null) { $displayoptions = [ self::DISPLAY_SHOWTITLEICON => get_string('smartmenusmenuitemdisplayoptionsshowtitleicon', 'theme_boost_union'), self::DISPLAY_HIDETITLE => get_string('smartmenushidetitle', 'theme_boost_union'), - self::DISPLAY_HIDETITLEMOBILE => get_string('smartmenushidetitlemobile', 'theme_boost_union') + self::DISPLAY_HIDETITLEMOBILE => get_string('smartmenushidetitlemobile', 'theme_boost_union'), ]; return ($option !== null && isset($displayoptions[$option])) ? $displayoptions[$option] : $displayoptions; @@ -1277,7 +1277,7 @@ public static function manage_instance($formdata) { 'oldorder' => $oldrecord->sortorder, 'neworder' => $record->sortorder, 'item' => $formdata->id, - 'menuid' => $formdata->menu + 'menuid' => $formdata->menu, ]); } diff --git a/classes/table/flavours_overview.php b/classes/table/flavours_overview.php index a293de6421e..b8f9eea3d54 100644 --- a/classes/table/flavours_overview.php +++ b/classes/table/flavours_overview.php @@ -92,15 +92,15 @@ public function col_updown($data) { $updown = ''; // Get spacer icon. - $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'iconsmall')); + $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', ['class' => 'iconsmall']); // If there is more than one flavour and we do not handle the first (number 0) flavour. if ($this->count > 0) { // Add the up icon. $updown .= \html_writer::link($actionurl->out(false, - array('action' => 'up', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'up', 'id' => $data->id, 'sesskey' => sesskey()]), $OUTPUT->pix_icon('t/up', get_string('up'), 'moodle', - array('class' => 'iconsmall')), array('class' => 'sort-flavour-up-action')); + ['class' => 'iconsmall']), ['class' => 'sort-flavour-up-action']); // Otherwise, just add a spacer. } else { @@ -112,9 +112,9 @@ public function col_updown($data) { // Add the down icon. $updown .= ' '; $updown .= \html_writer::link($actionurl->out(false, - array('action' => 'down', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'down', 'id' => $data->id, 'sesskey' => sesskey()]), $OUTPUT->pix_icon('t/down', get_string('down'), 'moodle', - array('class' => 'iconsmall')), array('class' => 'sort-flavour-down-action')); + ['class' => 'iconsmall']), ['class' => 'sort-flavour-down-action']); // Otherwise, just add a spacer. } else { @@ -136,20 +136,20 @@ public function col_updown($data) { */ public function col_appliesto($data) { // Initialize the badges. - $badges = array(); + $badges = []; // If apply-to-categories is enabled, add a badge. if ($data->applytocategories == true) { $badges[] = \html_writer::tag('span', get_string('categories'), - array('class' => 'badge badge-primary')); + ['class' => 'badge badge-primary']); } // If apply-to-cohorts is enabled, add a badge. if ($data->applytocohorts == true) { $badges[] = \html_writer::tag('span', get_string('cohorts', 'cohort'), - array('class' => 'badge badge-primary')); + ['class' => 'badge badge-primary']); } // Implode and return the badges. @@ -168,33 +168,33 @@ public function col_actions($data) { global $OUTPUT; // Initialize actions. - $actions = array(); + $actions = []; // Preview. - $actions[] = array( - 'url' => new \moodle_url('/theme/boost_union/flavours/preview.php', array('id' => $data->id)), + $actions[] = [ + 'url' => new \moodle_url('/theme/boost_union/flavours/preview.php', ['id' => $data->id]), 'icon' => new \pix_icon('i/search', get_string('flavoursedit', 'theme_boost_union')), - 'attributes' => array('class' => 'action-preview') - ); + 'attributes' => ['class' => 'action-preview'], + ]; // Edit. - $actions[] = array( + $actions[] = [ 'url' => new \moodle_url('/theme/boost_union/flavours/edit.php', - array('action' => 'edit', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'edit', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/edit', get_string('flavoursedit', 'theme_boost_union')), - 'attributes' => array('class' => 'action-edit') - ); + 'attributes' => ['class' => 'action-edit'], + ]; // Delete. - $actions[] = array( + $actions[] = [ 'url' => new \moodle_url('/theme/boost_union/flavours/edit.php', - array('action' => 'delete', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'delete', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/delete', get_string('flavourspreview', 'theme_boost_union')), - 'attributes' => array('class' => 'action-delete') - ); + 'attributes' => ['class' => 'action-delete'], + ]; // Compose action icons for all actions. - $actionshtml = array(); + $actionshtml = []; foreach ($actions as $action) { $action['attributes']['role'] = 'button'; $actionshtml[] = $OUTPUT->action_icon( diff --git a/classes/table/smartmenus_items.php b/classes/table/smartmenus_items.php index b4e5b9e6d17..1295d3301c0 100644 --- a/classes/table/smartmenus_items.php +++ b/classes/table/smartmenus_items.php @@ -116,10 +116,10 @@ public function col_restrictions($data) { }); // Amend rule list. - $rules[] = array( + $rules[] = [ 'name' => get_string('smartmenusbyrole', 'theme_boost_union'), - 'value' => implode(' ', $rolenames) - ); + 'value' => implode(' ', $rolenames), + ]; } // If we have cohort restrictions. @@ -132,10 +132,10 @@ public function col_restrictions($data) { }); // Amend rule list. - $rules[] = array( + $rules[] = [ 'name' => get_string('smartmenusbycohort', 'theme_boost_union'), - 'value' => implode(' ', $cohortlist) - ); + 'value' => implode(' ', $cohortlist), + ]; } // If we have language restrictions. @@ -143,7 +143,7 @@ public function col_restrictions($data) { // Compose the rule list. $languages = json_decode($data->languages); $options = get_string_manager()->get_list_of_translations(); - $languagelist = array(); + $languagelist = []; foreach ($languages as $lang) { if (isset($options[$lang])) { $languagelist[] = \html_writer::tag('span', $options[$lang], ['class' => 'badge badge-primary']); @@ -151,10 +151,10 @@ public function col_restrictions($data) { } // Amend rule list. - $rules[] = array( + $rules[] = [ 'name' => get_string('smartmenusbylanguage', 'theme_boost_union'), - 'value' => implode(' ', $languagelist) - ); + 'value' => implode(' ', $languagelist), + ]; } // If we have date restrictions. @@ -176,10 +176,10 @@ public function col_restrictions($data) { }); // Amend rule list. - $rules[] = array( + $rules[] = [ 'name' => get_string('smartmenusbydate', 'theme_boost_union'), - 'value' => implode(' ', $datelist) - ); + 'value' => implode(' ', $datelist), + ]; } // Compose the restriction list. @@ -211,15 +211,15 @@ public function col_updown($data) { $updown = ''; // Get spacer icon. - $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'iconsmall')); + $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', ['class' => 'iconsmall']); // If there is more than one smart menu item and we do not handle the first (number 0) smart menu item. if ($this->count > 0) { // Add the up icon. $updown .= \html_writer::link($actionurl->out(false, - array('action' => 'up', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'up', 'id' => $data->id, 'sesskey' => sesskey()]), $OUTPUT->pix_icon('t/up', get_string('up'), 'moodle', - array('class' => 'iconsmall')), array('class' => 'sort-smartmenuitems-up-action')); + ['class' => 'iconsmall']), ['class' => 'sort-smartmenuitems-up-action']); // Otherwise, just add a spacer. } else { @@ -231,9 +231,9 @@ public function col_updown($data) { // Add the down icon. $updown .= ' '; $updown .= \html_writer::link($actionurl->out(false, - array('action' => 'down', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'down', 'id' => $data->id, 'sesskey' => sesskey()]), $OUTPUT->pix_icon('t/down', get_string('down'), 'moodle', - array('class' => 'iconsmall')), array('class' => 'sort-smartmenuitems-down-action')); + ['class' => 'iconsmall']), ['class' => 'sort-smartmenuitems-down-action']); // Otherwise, just add a spacer. } else { @@ -260,48 +260,48 @@ public function col_actions($data) { $actionurl = new \moodle_url('/theme/boost_union/smartmenus/items.php'); // Initialize actions. - $actions = array(); + $actions = []; // Show/Hide. if ($data->visible) { - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'hide', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'hide', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/hide', get_string('hide')), - 'attributes' => array('class' => 'action-hide') - ); + 'attributes' => ['class' => 'action-hide'], + ]; } else { - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'show', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'show', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/show', get_string('show')), - 'attributes' => array('class' => 'action-show') - ); + 'attributes' => ['class' => 'action-show'], + ]; } // Edit. - $actions[] = array( + $actions[] = [ 'url' => new \moodle_url('/theme/boost_union/smartmenus/edit_items.php', - array('id' => $data->id, 'sesskey' => sesskey())), + ['id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/edit', get_string('edit')), - 'attributes' => array('class' => 'action-edit') - ); + 'attributes' => ['class' => 'action-edit'], + ]; // Duplicate. - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'copy', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'copy', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/copy', get_string('smartmenusmenuitemduplicate', 'theme_boost_union')), - 'attributes' => array('class' => 'action-copy') - ); + 'attributes' => ['class' => 'action-copy'], + ]; // Delete. - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'delete', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'delete', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/delete', get_string('delete')), - 'attributes' => array('class' => 'action-delete'), - 'confirm' => new \confirm_action(get_string('smartmenusmenuitemdeleteconfirm', 'theme_boost_union')) - ); + 'attributes' => ['class' => 'action-delete'], + 'confirm' => new \confirm_action(get_string('smartmenusmenuitemdeleteconfirm', 'theme_boost_union')), + ]; // Compose action icons for all actions. - $actionshtml = array(); + $actionshtml = []; foreach ($actions as $action) { $action['attributes']['role'] = 'button'; $actionshtml[] = $OUTPUT->action_icon( @@ -331,7 +331,7 @@ public function query_db($pagesize, $useinitialsbar = true) { FROM {theme_boost_union_menuitems} t WHERE menu=:menuid ORDER BY sortorder'; - $sqlparams = array('menuid' => $this->menuid); + $sqlparams = ['menuid' => $this->menuid]; // Get records. $this->rawdata = $DB->get_recordset_sql($sql, $sqlparams); diff --git a/classes/table/smartmenus_menus.php b/classes/table/smartmenus_menus.php index 5e3851bf345..91a3cbbe563 100644 --- a/classes/table/smartmenus_menus.php +++ b/classes/table/smartmenus_menus.php @@ -124,15 +124,15 @@ public function col_updown($data) { $updown = ''; // Get spacer icon. - $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'iconsmall')); + $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', ['class' => 'iconsmall']); // If there is more than one smart menu and we do not handle the first (number 0) smart menu. if ($this->count > 0) { // Add the up icon. $updown .= \html_writer::link($actionurl->out(false, - array('action' => 'up', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'up', 'id' => $data->id, 'sesskey' => sesskey()]), $OUTPUT->pix_icon('t/up', get_string('up'), 'moodle', - array('class' => 'iconsmall')), array('class' => 'sort-smartmenus-up-action')); + ['class' => 'iconsmall']), ['class' => 'sort-smartmenus-up-action']); // Otherwise, just add a spacer. } else { @@ -144,9 +144,9 @@ public function col_updown($data) { // Add the down icon. $updown .= ' '; $updown .= \html_writer::link($actionurl->out(false, - array('action' => 'down', 'id' => $data->id, 'sesskey' => sesskey())), + ['action' => 'down', 'id' => $data->id, 'sesskey' => sesskey()]), $OUTPUT->pix_icon('t/down', get_string('down'), 'moodle', - array('class' => 'iconsmall')), array('class' => 'sort-smartmenus-down-action')); + ['class' => 'iconsmall']), ['class' => 'sort-smartmenus-down-action']); // Otherwise, just add a spacer. } else { @@ -173,54 +173,54 @@ public function col_actions($data) { $actionurl = new \moodle_url('/theme/boost_union/smartmenus/menus.php'); // Initialize actions. - $actions = array(); + $actions = []; // Show/Hide. if ($data->visible) { - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'hide', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'hide', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/hide', get_string('hide')), - 'attributes' => array('class' => 'action-hide') - ); + 'attributes' => ['class' => 'action-hide'], + ]; } else { - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'show', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'show', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/show', get_string('show')), - 'attributes' => array('class' => 'action-show') - ); + 'attributes' => ['class' => 'action-show'], + ]; } // Edit. - $actions[] = array( - 'url' => new \moodle_url('/theme/boost_union/smartmenus/edit.php', array('id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url('/theme/boost_union/smartmenus/edit.php', ['id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/edit', get_string('edit')), - 'attributes' => array('class' => 'action-edit') - ); + 'attributes' => ['class' => 'action-edit'], + ]; // Duplicate. - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'copy', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'copy', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/copy', get_string('smartmenusmenuduplicate', 'theme_boost_union')), - 'attributes' => array('class' => 'action-copy') - ); + 'attributes' => ['class' => 'action-copy'], + ]; // List items. - $actions[] = array( - 'url' => new \moodle_url('/theme/boost_union/smartmenus/items.php', array('menu' => $data->id)), + $actions[] = [ + 'url' => new \moodle_url('/theme/boost_union/smartmenus/items.php', ['menu' => $data->id]), 'icon' => new \pix_icon('e/bullet_list', get_string('list')), - 'attributes' => array('class' => 'action-list-items') - ); + 'attributes' => ['class' => 'action-list-items'], + ]; // Delete. - $actions[] = array( - 'url' => new \moodle_url($actionurl, array('action' => 'delete', 'id' => $data->id, 'sesskey' => sesskey())), + $actions[] = [ + 'url' => new \moodle_url($actionurl, ['action' => 'delete', 'id' => $data->id, 'sesskey' => sesskey()]), 'icon' => new \pix_icon('t/delete', get_string('delete')), - 'attributes' => array('class' => 'action-delete'), - 'confirm' => new \confirm_action(get_string('smartmenusmenudeleteconfirm', 'theme_boost_union')) - ); + 'attributes' => ['class' => 'action-delete'], + 'confirm' => new \confirm_action(get_string('smartmenusmenudeleteconfirm', 'theme_boost_union')), + ]; // Compose action icons for all actions. - $actionshtml = array(); + $actionshtml = []; foreach ($actions as $action) { $action['attributes']['role'] = 'button'; $actionshtml[] = $OUTPUT->action_icon( diff --git a/db/access.php b/db/access.php index 7bd4c7794a0..4f4f9869f31 100644 --- a/db/access.php +++ b/db/access.php @@ -24,305 +24,305 @@ defined('MOODLE_INTERNAL') || die(); -$capabilities = array( +$capabilities = [ // Ability to configure the theme as non-admin. - 'theme/boost_union:configure' => array( + 'theme/boost_union:configure' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_SYSTEM, - 'riskbitmask' => RISK_XSS | RISK_CONFIG - ), + 'riskbitmask' => RISK_XSS | RISK_CONFIG, + ], // Ability to see a hint for unrestricted self enrolment in a visible course. - 'theme/boost_union:viewhintcourseselfenrol' => array( + 'theme/boost_union:viewhintcourseselfenrol' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see a hint in a hidden course. - 'theme/boost_union:viewhintinhiddencourse' => array( + 'theme/boost_union:viewhintinhiddencourse' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the header block region. - 'theme/boost_union:viewregionheader' => array( + 'theme/boost_union:viewregionheader' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the header block region. - 'theme/boost_union:editregionheader' => array( + 'theme/boost_union:editregionheader' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the outsideleft block region. - 'theme/boost_union:viewregionoutsideleft' => array( + 'theme/boost_union:viewregionoutsideleft' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the outsideleft block region. - 'theme/boost_union:editregionoutsideleft' => array( + 'theme/boost_union:editregionoutsideleft' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the outsideright block region. - 'theme/boost_union:viewregionoutsideright' => array( + 'theme/boost_union:viewregionoutsideright' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the outsideright block region. - 'theme/boost_union:editregionoutsideright' => array( + 'theme/boost_union:editregionoutsideright' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the outsidetop block region. - 'theme/boost_union:viewregionoutsidetop' => array( + 'theme/boost_union:viewregionoutsidetop' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the outsidetop block region. - 'theme/boost_union:editregionoutsidetop' => array( + 'theme/boost_union:editregionoutsidetop' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the outsidebottom block region. - 'theme/boost_union:viewregionoutsidebottom' => array( + 'theme/boost_union:viewregionoutsidebottom' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the outsidebottom block region. - 'theme/boost_union:editregionoutsidebottom' => array( + 'theme/boost_union:editregionoutsidebottom' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the contentupper block region. - 'theme/boost_union:viewregioncontentupper' => array( + 'theme/boost_union:viewregioncontentupper' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the contentupper block region. - 'theme/boost_union:editregioncontentupper' => array( + 'theme/boost_union:editregioncontentupper' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the contentlower block region. - 'theme/boost_union:viewregioncontentlower' => array( + 'theme/boost_union:viewregioncontentlower' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the contentlower block region. - 'theme/boost_union:editregioncontentlower' => array( + 'theme/boost_union:editregioncontentlower' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the footerleft block region. - 'theme/boost_union:viewregionfooterleft' => array( + 'theme/boost_union:viewregionfooterleft' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the footerleft block region. - 'theme/boost_union:editregionfooterleft' => array( + 'theme/boost_union:editregionfooterleft' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the footerright block region. - 'theme/boost_union:viewregionfooterright' => array( + 'theme/boost_union:viewregionfooterright' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the footerright block region. - 'theme/boost_union:editregionfooterright' => array( + 'theme/boost_union:editregionfooterright' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the footercenter block region. - 'theme/boost_union:viewregionfootercenter' => array( + 'theme/boost_union:viewregionfootercenter' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the footercenter block region. - 'theme/boost_union:editregionfootercenter' => array( + 'theme/boost_union:editregionfootercenter' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the offcanvas left block region. - 'theme/boost_union:viewregionoffcanvasleft' => array( + 'theme/boost_union:viewregionoffcanvasleft' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the offcanvas left block region. - 'theme/boost_union:editregionoffcanvasleft' => array( + 'theme/boost_union:editregionoffcanvasleft' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the offcanvas right block region. - 'theme/boost_union:viewregionoffcanvasright' => array( + 'theme/boost_union:viewregionoffcanvasright' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the offcanvas right block region. - 'theme/boost_union:editregionoffcanvasright' => array( + 'theme/boost_union:editregionoffcanvasright' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to see the offcanvas center block region. - 'theme/boost_union:viewregionoffcanvascenter' => array( + 'theme/boost_union:viewregionoffcanvascenter' => [ 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'user' => CAP_ALLOW, 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), + 'manager' => CAP_ALLOW, + ], + ], // Ability to edit the offcanvas center block region. - 'theme/boost_union:editregionoffcanvascenter' => array( + 'theme/boost_union:editregionoffcanvascenter' => [ 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, - 'archetypes' => array( + 'archetypes' => [ 'teacher' => CAP_ALLOW, 'editingteacher' => CAP_ALLOW, - 'manager' => CAP_ALLOW - ), - ), -); + 'manager' => CAP_ALLOW, + ], + ], +]; diff --git a/db/caches.php b/db/caches.php index ade4a499572..50622dede8f 100644 --- a/db/caches.php +++ b/db/caches.php @@ -24,7 +24,7 @@ defined('MOODLE_INTERNAL') || die(); -$definitions = array( +$definitions = [ // This cache stores the flavours which apply to a particular user in his user session. // It is there to avoid that the flavour which applies has to be calculated on every page load. // The cache key is the page category ID (and 0 for all non-category pages). @@ -48,30 +48,30 @@ // 4. When a user is added to / removed from a category // -- (this is realized with an event observer which sets a user preference flag, followed by a check in // -- theme_boost_union_get_flavour_which_applies() which purges the cache for the affected user). - 'flavours' => array( + 'flavours' => [ 'mode' => cache_store::MODE_SESSION, 'simplekeys' => true, 'simpledata' => false, - 'invalidationevents' => array( + 'invalidationevents' => [ 'theme_boost_union_flavours_resorted', 'theme_boost_union_flavours_created', 'theme_boost_union_flavours_edited', 'theme_boost_union_flavours_deleted', - 'theme_boost_union_cohort_deleted' - ) - ), + 'theme_boost_union_cohort_deleted', + ], + ], // This cache stores the smart menus. - 'smartmenus' => array( + 'smartmenus' => [ 'mode' => cache_store::MODE_APPLICATION, 'simplekeys' => true, 'simpledata' => false, 'overrideclass' => '\theme_boost_union\cache\loader', - ), + ], // This cache stores the smart menus' menu items. - 'smartmenu_items' => array( + 'smartmenu_items' => [ 'mode' => cache_store::MODE_APPLICATION, 'simplekeys' => true, 'simpledata' => false, 'overrideclass' => '\theme_boost_union\cache\loader', - ) -); + ], +]; diff --git a/db/events.php b/db/events.php index 271bdce6c32..475ff990de8 100644 --- a/db/events.php +++ b/db/events.php @@ -24,62 +24,62 @@ defined('MOODLE_INTERNAL') || die(); -$observers = array( - array( +$observers = [ + [ 'eventname' => '\core\event\cohort_deleted', - 'callback' => '\theme_boost_union\eventobservers::cohort_deleted' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::cohort_deleted', + ], + [ 'eventname' => '\core\event\cohort_member_added', - 'callback' => '\theme_boost_union\eventobservers::cohort_member_added' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::cohort_member_added', + ], + [ 'eventname' => '\core\event\cohort_member_removed', - 'callback' => '\theme_boost_union\eventobservers::cohort_member_removed' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::cohort_member_removed', + ], + [ 'eventname' => 'core\event\role_assigned', - 'callback' => '\theme_boost_union\eventobservers::role_assigned' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::role_assigned', + ], + [ 'eventname' => 'core\event\role_deleted', - 'callback' => '\theme_boost_union\eventobservers::role_deleted' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::role_deleted', + ], + [ 'eventname' => 'core\event\role_unassigned', - 'callback' => '\theme_boost_union\eventobservers::role_unassigned' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::role_unassigned', + ], + [ 'eventname' => 'core\event\user_updated', - 'callback' => '\theme_boost_union\eventobservers::user_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::user_updated', + ], + [ 'eventname' => 'core\event\course_created', - 'callback' => '\theme_boost_union\eventobservers::course_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::course_updated', + ], + [ 'eventname' => 'core\event\course_completion_updated', - 'callback' => '\theme_boost_union\eventobservers::completion_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::completion_updated', + ], + [ 'eventname' => 'core\event\course_module_completion_updated', - 'callback' => '\theme_boost_union\eventobservers::completion_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::completion_updated', + ], + [ 'eventname' => 'core\event\course_updated', - 'callback' => '\theme_boost_union\eventobservers::course_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::course_updated', + ], + [ 'eventname' => 'core\event\course_deleted', - 'callback' => '\theme_boost_union\eventobservers::course_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::course_updated', + ], + [ 'eventname' => 'core\event\course_category_deleted', - 'callback' => '\theme_boost_union\eventobservers::category_updated' - ), - array( + 'callback' => '\theme_boost_union\eventobservers::category_updated', + ], + [ 'eventname' => 'core\event\course_category_updated', - 'callback' => '\theme_boost_union\eventobservers::category_updated' - ), + 'callback' => '\theme_boost_union\eventobservers::category_updated', + ], -); +]; diff --git a/db/upgrade.php b/db/upgrade.php index acd35b7336c..8719db12316 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -95,10 +95,10 @@ function xmldb_theme_boost_union_upgrade($oldversion) { $file = reset($files); // Create the filerecord with the modified information. - $filerecord = array( + $filerecord = [ 'component' => 'theme_boost_union', 'filearea' => $setting, - ); + ]; // Copy the logo file to Boost Union. $newfile = $fs->create_file_from_storedfile($filerecord, $file); diff --git a/flavours/edit.php b/flavours/edit.php index b9395badff5..8903fc5cf96 100644 --- a/flavours/edit.php +++ b/flavours/edit.php @@ -47,9 +47,9 @@ $PAGE->set_context($context); $PAGE->set_url(new moodle_url('/theme/boost_union/flavours/edit.php', ['action' => $action])); $PAGE->set_cacheable(false); -$PAGE->navbar->add(get_string('themes', 'core'), new moodle_url('/admin/category.php', array('category' => 'themes'))); +$PAGE->navbar->add(get_string('themes', 'core'), new moodle_url('/admin/category.php', ['category' => 'themes'])); $PAGE->navbar->add(get_string('pluginname', 'theme_boost_union'), new moodle_url('/admin/category.php', - array('category' => 'theme_boost_union'))); + ['category' => 'theme_boost_union'])); $PAGE->navbar->add(get_string('flavoursflavours', 'theme_boost_union'), new moodle_url('/theme/boost_union/flavours/overview.php')); switch ($action) { case 'create': @@ -119,7 +119,7 @@ $backgroundimagefilename = theme_boost_union_flavours_get_filename('look_backgroundimage', $id); // Update the database record to include the file names. - $updaterecord = $DB->get_record('theme_boost_union_flavours', array('id' => $id)); + $updaterecord = $DB->get_record('theme_boost_union_flavours', ['id' => $id]); $updaterecord->look_logo = $looklogofilename; $updaterecord->look_logocompact = $looklogocompactfilename; $updaterecord->look_favicon = $faviconfilename; @@ -158,7 +158,7 @@ $flavour = $DB->get_record('theme_boost_union_flavours', ['id' => $id], '*', MUST_EXIST); // Init form and pass the $flavour object to it. - $form = new \theme_boost_union\form\flavour_edit_form($PAGE->url, array('flavour' => $flavour)); + $form = new \theme_boost_union\form\flavour_edit_form($PAGE->url, ['flavour' => $flavour]); // If the form was submitted. if ($data = $form->get_data()) { @@ -193,7 +193,7 @@ $backgroundimagefilename = theme_boost_union_flavours_get_filename('look_backgroundimage', $id); // Update the database record to include the file names. - $updaterecord = $DB->get_record('theme_boost_union_flavours', array('id' => $id)); + $updaterecord = $DB->get_record('theme_boost_union_flavours', ['id' => $id]); $updaterecord->look_logo = $looklogofilename; $updaterecord->look_logocompact = $looklogocompactfilename; $updaterecord->look_favicon = $faviconfilename; @@ -243,7 +243,7 @@ // Gather the data for the form. $flavour->description = [ 'text' => $flavour->description, - 'format' => $flavour->description_format + 'format' => $flavour->description_format, ]; if (isset($flavour->applytocohorts_ids)) { $flavour->applytocohorts_ids = json_decode($flavour->applytocohorts_ids, true); @@ -267,7 +267,7 @@ $flavour = $DB->get_record('theme_boost_union_flavours', ['id' => $id], '*', MUST_EXIST); // Init form and pass the $flavour object to it. - $form = new \theme_boost_union\form\flavour_delete_form($PAGE->url, array('flavour' => $flavour)); + $form = new \theme_boost_union\form\flavour_delete_form($PAGE->url, ['flavour' => $flavour]); // If the form was submitted. if ($data = $form->get_data()) { diff --git a/flavours/flavourslib.php b/flavours/flavourslib.php index b8e5f94e3f9..398855dc6a9 100644 --- a/flavours/flavourslib.php +++ b/flavours/flavourslib.php @@ -60,7 +60,7 @@ function theme_boost_union_get_flavour_which_applies() { $previewflavourid = required_param('id', PARAM_INT); // Get and remember the given flavour. - $appliedflavour = $DB->get_record('theme_boost_union_flavours', array('id' => $previewflavourid)); + $appliedflavour = $DB->get_record('theme_boost_union_flavours', ['id' => $previewflavourid]); // Remember the fact that the flavour has been checked for subsequent runs of this function. $flavourchecked = true; @@ -122,7 +122,7 @@ function theme_boost_union_get_flavour_which_applies() { // Otherwise. } else { // Just remember an empty array to avoid breaking the following code. - $parentcategoryids = array(); + $parentcategoryids = []; } } @@ -134,7 +134,7 @@ function theme_boost_union_get_flavour_which_applies() { // Get all flavours from the DB. // The more flavours you have, the more this query will become heavier. // However, it is just called once per page category ID within a session, so we accept this for now. - $flavours = $DB->get_records('theme_boost_union_flavours', array(), 'sort ASC'); + $flavours = $DB->get_records('theme_boost_union_flavours', [], 'sort ASC'); // Iterate over the flavours. foreach ($flavours as $f) { @@ -297,7 +297,7 @@ function theme_boost_union_flavour_exists_for_cohort($cohortid) { global $DB; // Get the flavours which are configured to apply to (any) cohort. - $flavoursforcohorts = $DB->get_records('theme_boost_union_flavours', array('applytocohorts' => 1), '', 'applytocohorts_ids'); + $flavoursforcohorts = $DB->get_records('theme_boost_union_flavours', ['applytocohorts' => 1], '', 'applytocohorts_ids'); // Iterate over the flavours. foreach ($flavoursforcohorts as $f) { diff --git a/flavours/overview.php b/flavours/overview.php index 8cb96e7d3cc..681a378e812 100644 --- a/flavours/overview.php +++ b/flavours/overview.php @@ -62,13 +62,13 @@ switch ($action) { case 'up': // Move the flavour upwards. - $currentflavour = $DB->get_record('theme_boost_union_flavours', array('id' => $flavourid)); - $prevflavour = $DB->get_record('theme_boost_union_flavours', array('sort' => $currentflavour->sort - 1)); + $currentflavour = $DB->get_record('theme_boost_union_flavours', ['id' => $flavourid]); + $prevflavour = $DB->get_record('theme_boost_union_flavours', ['sort' => $currentflavour->sort - 1]); if ($prevflavour) { $DB->set_field('theme_boost_union_flavours', 'sort', $prevflavour->sort, - array('id' => $currentflavour->id)); + ['id' => $currentflavour->id]); $DB->set_field('theme_boost_union_flavours', 'sort', $currentflavour->sort, - array('id' => $prevflavour->id)); + ['id' => $prevflavour->id]); // Purge the flavours cache as the users might get other flavours which apply after the sorting. // We would have preferred using cache_helper::purge_by_definition, but this just purges the session cache @@ -78,13 +78,13 @@ break; case 'down': // Move the flavour downwards. - $currentflavour = $DB->get_record('theme_boost_union_flavours', array('id' => $flavourid)); - $nextflavour = $DB->get_record('theme_boost_union_flavours', array('sort' => $currentflavour->sort + 1)); + $currentflavour = $DB->get_record('theme_boost_union_flavours', ['id' => $flavourid]); + $nextflavour = $DB->get_record('theme_boost_union_flavours', ['sort' => $currentflavour->sort + 1]); if ($nextflavour) { $DB->set_field('theme_boost_union_flavours', 'sort', $nextflavour->sort, - array('id' => $currentflavour->id)); + ['id' => $currentflavour->id]); $DB->set_field('theme_boost_union_flavours', 'sort', $currentflavour->sort, - array('id' => $nextflavour->id)); + ['id' => $nextflavour->id]); // Purge the flavours cache as the users might get other flavours which apply after the sorting. // We would have preferred using cache_helper::purge_by_definition, but this just purges the session cache @@ -119,7 +119,7 @@ // Prepare 'Create flavours' button. $createbutton = $OUTPUT->box_start(); $createbutton .= $OUTPUT->single_button( - new \moodle_url('/theme/boost_union/flavours/edit.php', array('action' => 'create', 'sesskey' => sesskey())), + new \moodle_url('/theme/boost_union/flavours/edit.php', ['action' => 'create', 'sesskey' => sesskey()]), get_string('flavourscreateflavour', 'theme_boost_union'), 'get'); $createbutton .= $OUTPUT->box_end(); diff --git a/flavours/preview.php b/flavours/preview.php index 565d0df2fe1..164f35026b8 100644 --- a/flavours/preview.php +++ b/flavours/preview.php @@ -44,9 +44,9 @@ $PAGE->set_context($context); $PAGE->set_url(new moodle_url('/theme/boost_union/flavours/preview.php', ['id' => $flavourid])); $PAGE->set_cacheable(false); -$PAGE->navbar->add(get_string('themes', 'core'), new moodle_url('/admin/category.php', array('category' => 'themes'))); +$PAGE->navbar->add(get_string('themes', 'core'), new moodle_url('/admin/category.php', ['category' => 'themes'])); $PAGE->navbar->add(get_string('pluginname', 'theme_boost_union'), new moodle_url('/admin/category.php', - array('category' => 'theme_boost_union'))); + ['category' => 'theme_boost_union'])); $PAGE->navbar->add(get_string('flavoursflavours', 'theme_boost_union'), new moodle_url('/theme/boost_union/flavours/overview.php')); $PAGE->set_title(theme_boost_union_get_externaladminpage_title(get_string('flavourspreviewflavour', 'theme_boost_union'))); $PAGE->set_heading(get_string('flavourspreviewflavour', 'theme_boost_union')); diff --git a/flavours/styles.php b/flavours/styles.php index a2e3b3d345e..ec649c02407 100644 --- a/flavours/styles.php +++ b/flavours/styles.php @@ -55,7 +55,7 @@ // again and again. However, as the result is cached in the browser and the browser should not request // a flavour's CSS file again and again this should be ok for now. $flavour = $DB->get_record('theme_boost_union_flavours', - array('id' => $flavourid), 'look_rawscss, look_backgroundimage', MUST_EXIST); + ['id' => $flavourid], 'look_rawscss, look_backgroundimage', MUST_EXIST); // Catch the exception. } catch (\Exception $e) { diff --git a/form/element-colorpicker.php b/form/element-colorpicker.php index dd95bfe90a4..522892bc9ff 100644 --- a/form/element-colorpicker.php +++ b/form/element-colorpicker.php @@ -57,7 +57,7 @@ public function __construct($elementname=null, $elementlabel=null, $attributes=n if (empty($class)) { $class = ''; } - $this->updateAttributes(array('class' => $class.' theme_boost_union-form-colour-picker ')); + $this->updateAttributes(['class' => $class.' theme_boost_union-form-colour-picker ']); } /** diff --git a/layout/columns2.php b/layout/columns2.php index bd4ecc54431..8197e3d427c 100644 --- a/layout/columns2.php +++ b/layout/columns2.php @@ -104,7 +104,7 @@ 'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu), 'headercontent' => $headercontent, 'overflow' => $overflow, - 'addblockbutton' => $addblockbutton + 'addblockbutton' => $addblockbutton, ]; // Include the template content for the course related hints. diff --git a/layout/includes/advertisementtiles.php b/layout/includes/advertisementtiles.php index b1576a3f9e4..de2a7dad88f 100644 --- a/layout/includes/advertisementtiles.php +++ b/layout/includes/advertisementtiles.php @@ -32,7 +32,7 @@ $config = get_config('theme_boost_union'); // Initialize advertisement tiles data for templatecontext. -$advertisementtiles = array(); +$advertisementtiles = []; // Getting and setting the advertisement tiles position on the frontpage. switch ($config->{'tilefrontpageposition'}) { @@ -74,7 +74,7 @@ $title = format_string(trim($config->{'tile'.$i.'title'})); // Get and set the tile's content. - $formatoptions = array('noclean' => true); + $formatoptions = ['noclean' => true]; $content = format_text($config->{'tile'.$i.'content'}, FORMAT_HTML, $formatoptions); // Get and set the tile's link. diff --git a/layout/includes/blockregions.php b/layout/includes/blockregions.php index 48e07f1a0fe..1ebaa48e2bf 100644 --- a/layout/includes/blockregions.php +++ b/layout/includes/blockregions.php @@ -75,7 +75,7 @@ public function regionsdata() { $regionsdata[$name] = [ 'hasblocks' => (strpos($regionhtml, 'data-block=') !== false || !empty($blockbutton)), 'regionhtml' => $regionhtml, - 'addblockbutton' => $blockbutton + 'addblockbutton' => $blockbutton, ]; } return $regionsdata; @@ -127,7 +127,7 @@ public function countcolclass($regions, $regionsdata) { return [ 'count' => $regioncount, - 'class' => 'col-xl-'.(($regioncount > 0 ) ? round(12 / $regioncount) : '12' ) + 'class' => 'col-xl-'.(($regioncount > 0 ) ? round(12 / $regioncount) : '12' ), ]; } @@ -140,7 +140,7 @@ public function addoffcanvasdata(&$regionsdata) { $list = $this->countcolclass([ 'offcanvasleft', 'offcanvasright', - 'offcanvascenter'], $regionsdata); + 'offcanvascenter', ], $regionsdata); $regionsdata['offcanvas'] = [ 'hasblocks' => ($list['count'] > 0) ? true : false, @@ -157,7 +157,7 @@ public function addfooterdata(&$regionsdata) { $list = $this->countcolclass([ 'footerleft', 'footerright', - 'footercenter'], $regionsdata); + 'footercenter', ], $regionsdata); $regionsdata['footer'] = [ 'hasblocks' => ($list['count'] > 0) ? true : false, diff --git a/layout/includes/infobanners.php b/layout/includes/infobanners.php index c3be23871c5..12d4137d37e 100644 --- a/layout/includes/infobanners.php +++ b/layout/includes/infobanners.php @@ -31,7 +31,7 @@ $config = get_config('theme_boost_union'); // Initialize info banners data for templatecontext. -$infobanners = array(); +$infobanners = []; // Remember if we need the dismissible AMD module. $dismissibleamdneeded = false; @@ -42,7 +42,7 @@ if (theme_boost_union_infobanner_is_shown_on_page($i)) { // Gather this info banner's data. // Info banner content. - $formatoptions = array('noclean' => true, 'newlines' => false); + $formatoptions = ['noclean' => true, 'newlines' => false]; $contentsettingname = 'infobanner'.$i.'content'; $content = format_text($config->{$contentsettingname}, FORMAT_HTML, $formatoptions); diff --git a/layout/includes/staticpages.php b/layout/includes/staticpages.php index abbb27d8fde..8baa456251d 100644 --- a/layout/includes/staticpages.php +++ b/layout/includes/staticpages.php @@ -30,7 +30,7 @@ $config = get_config('theme_boost_union'); // The static pages to be supported. -$staticpages = array('aboutus', 'offers', 'imprint', 'contact', 'help', 'maintenance', 'page1', 'page2', 'page3'); +$staticpages = ['aboutus', 'offers', 'imprint', 'contact', 'help', 'maintenance', 'page1', 'page2', 'page3']; // Iterate over the static pages. foreach ($staticpages as $staticpage) { diff --git a/layout/login.php b/layout/login.php index 62e62e9ba80..d4a61682594 100644 --- a/layout/login.php +++ b/layout/login.php @@ -44,7 +44,7 @@ 'loginwrapperclass' => 'login-wrapper-'.get_config('theme_boost_union', 'loginformposition'), 'logincontainerclass' => (get_config('theme_boost_union', 'loginformtransparency') == THEME_BOOST_UNION_SETTING_SELECT_YES) ? - 'login-container-80t' : '' + 'login-container-80t' : '', ]; // Include the template content for the footnote. diff --git a/lib.php b/lib.php index beed3b60b05..34b5bf50792 100644 --- a/lib.php +++ b/lib.php @@ -172,7 +172,7 @@ function theme_boost_union_get_pre_scss($theme) { // Overwrite Boost core SCSS variables which are stored in a SCSS map and thus couldn't be added to $configurable above. // Set variables for the activity icon colors. - $activityiconcolors = array(); + $activityiconcolors = []; if (get_config('theme_boost_union', 'activityiconcoloradministration')) { $activityiconcolors[] = '"administration": '.get_config('theme_boost_union', 'activityiconcoloradministration'); } @@ -367,7 +367,7 @@ function theme_boost_union_get_precompiled_css() { * @param array $options * @return bool */ -function theme_boost_union_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = array()) { +function theme_boost_union_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options = []) { global $CFG; // Serve the (general) logo files or favicon file from the theme settings. @@ -565,7 +565,7 @@ function theme_boost_union_output_fragment_icons_list($args) { $icons[] = [ 'icon' => $faiconsystem->render_pix_icon($OUTPUT, $icon), 'value' => $iconkey, - 'label' => $icontxt + 'label' => $icontxt, ]; } diff --git a/locallib.php b/locallib.php index f4b362663a4..be24cd7413e 100644 --- a/locallib.php +++ b/locallib.php @@ -49,7 +49,7 @@ function theme_boost_union_get_course_related_hints() { && $COURSE->visible == false) { // Prepare template context. - $templatecontext = array('courseid' => $COURSE->id); + $templatecontext = ['courseid' => $COURSE->id]; // If the user has the capability to change the course settings, an additional link to the course settings is shown. if (has_capability('moodle/course:update', context_course::instance($COURSE->id))) { @@ -77,8 +77,8 @@ function theme_boost_union_get_course_related_hints() { require_once($CFG->dirroot . '/enrol/self/lib.php'); // Prepare template context. - $templatecontext = array('courseid' => $COURSE->id, - 'role' => role_get_name(get_guest_role())); + $templatecontext = ['courseid' => $COURSE->id, + 'role' => role_get_name(get_guest_role()), ]; // Search for an available self enrolment link in this course. $templatecontext['showselfenrollink'] = false; @@ -190,7 +190,7 @@ function theme_boost_union_get_course_related_hints() { ($selfenrolmentpossiblecurrently == true || $selfenrolmentpossiblefuture == true)) { // Prepare template context. - $templatecontext = array(); + $templatecontext = []; // Add the start of the hint t the template context // depending on the fact if enrolment is already possible currently or will be in the future. @@ -204,37 +204,37 @@ function theme_boost_union_get_course_related_hints() { foreach ($selfenrolinstances as $selfenrolinstanceid => $selfenrolinstanceobject) { // If the user has the capability to config self enrolments, enrich the instance name with the settings link. if (has_capability('enrol/self:config', \context_course::instance($COURSE->id))) { - $url = new moodle_url('/enrol/editinstance.php', array('courseid' => $COURSE->id, - 'id' => $selfenrolinstanceid, 'type' => 'self')); + $url = new moodle_url('/enrol/editinstance.php', ['courseid' => $COURSE->id, + 'id' => $selfenrolinstanceid, 'type' => 'self', ]); $selfenrolinstanceobject->name = html_writer::link($url, $selfenrolinstanceobject->name); } // Add the enrolment instance information to the template context depending on the instance configuration. if ($selfenrolinstanceobject->unrestrictedness == 'unlimited') { $templatecontext['selfenrolinstances'][] = get_string('showhintcourseselfenrolunlimited', 'theme_boost_union', - array('name' => $selfenrolinstanceobject->name)); + ['name' => $selfenrolinstanceobject->name]); } else if ($selfenrolinstanceobject->unrestrictedness == 'until') { $templatecontext['selfenrolinstances'][] = get_string('showhintcourseselfenroluntil', 'theme_boost_union', - array('name' => $selfenrolinstanceobject->name, - 'until' => userdate($selfenrolinstanceobject->enddate))); + ['name' => $selfenrolinstanceobject->name, + 'until' => userdate($selfenrolinstanceobject->enddate), ]); } else if ($selfenrolinstanceobject->unrestrictedness == 'from') { $templatecontext['selfenrolinstances'][] = get_string('showhintcourseselfenrolfrom', 'theme_boost_union', - array('name' => $selfenrolinstanceobject->name, - 'from' => userdate($selfenrolinstanceobject->startdate))); + ['name' => $selfenrolinstanceobject->name, + 'from' => userdate($selfenrolinstanceobject->startdate), ]); } else if ($selfenrolinstanceobject->unrestrictedness == 'since') { $templatecontext['selfenrolinstances'][] = get_string('showhintcourseselfenrolsince', 'theme_boost_union', - array('name' => $selfenrolinstanceobject->name, - 'since' => userdate($selfenrolinstanceobject->startdate))); + ['name' => $selfenrolinstanceobject->name, + 'since' => userdate($selfenrolinstanceobject->startdate), ]); } else if ($selfenrolinstanceobject->unrestrictedness == 'fromuntil') { $templatecontext['selfenrolinstances'][] = get_string('showhintcourseselfenrolfromuntil', 'theme_boost_union', - array('name' => $selfenrolinstanceobject->name, + ['name' => $selfenrolinstanceobject->name, 'until' => userdate($selfenrolinstanceobject->enddate), - 'from' => userdate($selfenrolinstanceobject->startdate))); + 'from' => userdate($selfenrolinstanceobject->startdate), ]); } else if ($selfenrolinstanceobject->unrestrictedness == 'sinceuntil') { $templatecontext['selfenrolinstances'][] = get_string('showhintcourseselfenrolsinceuntil', 'theme_boost_union', - array('name' => $selfenrolinstanceobject->name, + ['name' => $selfenrolinstanceobject->name, 'until' => userdate($selfenrolinstanceobject->enddate), - 'since' => userdate($selfenrolinstanceobject->startdate))); + 'since' => userdate($selfenrolinstanceobject->startdate), ]); } } @@ -261,14 +261,14 @@ function theme_boost_union_get_course_related_hints() { // Get the URL to switch back (normal role). $url = new moodle_url('/course/switchrole.php', - array('id' => $COURSE->id, + ['id' => $COURSE->id, 'sesskey' => sesskey(), 'switchrole' => 0, - 'returnurl' => $PAGE->url->out_as_local_url(false))); + 'returnurl' => $PAGE->url->out_as_local_url(false), ]); // Prepare template context. - $templatecontext = array('role' => $role, - 'url' => $url->out()); + $templatecontext = ['role' => $role, + 'url' => $url->out(), ]; // Render template and add it to HTML code. $html .= $OUTPUT->render_from_template('theme_boost_union/course-hint-switchedrole', $templatecontext); @@ -444,7 +444,7 @@ function theme_boost_union_infobanner_reset_visibility($no) { // Initialize variable for feedback messages. $somethingwentwrong = false; // Store coding exception. - $codingexception[] = array(); + $codingexception[] = []; foreach ($users as $user) { try { @@ -657,7 +657,7 @@ function theme_boost_union_get_loginbackgroundimage_text() { } // Return the text + text color that belongs to the randomly selected image. - return array(format_string(trim($settings[1])), $settings[2]); + return [format_string(trim($settings[1])), $settings[2]]; } } } @@ -692,17 +692,17 @@ function theme_boost_union_get_additionalresources_templatecontext() { $files = $fs->get_area_files($systemcontext->id, 'theme_boost_union', 'additionalresources', false, 'itemid', false); // Iterate over the files and fill the templatecontext of the file list. - $filesforcontext = array(); + $filesforcontext = []; foreach ($files as $af) { $urlpersistent = new moodle_url('/pluginfile.php/1/theme_boost_union/additionalresources/0/'.$af->get_filename()); $urlrevisioned = new moodle_url('/pluginfile.php/1/theme_boost_union/additionalresources/'.theme_get_revision(). '/'.$af->get_filename()); - $filesforcontext[] = array('filename' => $af->get_filename(), + $filesforcontext[] = ['filename' => $af->get_filename(), 'filetype' => $af->get_mimetype(), 'filesize' => display_size($af->get_filesize()), 'fileicon' => $OUTPUT->image_icon(file_file_icon($af, 64), get_mimetype_description($af)), 'fileurlpersistent' => $urlpersistent->out(), - 'fileurlrevisioned' => $urlrevisioned->out()); + 'fileurlrevisioned' => $urlrevisioned->out(), ]; } } @@ -739,7 +739,7 @@ function theme_boost_union_get_customfonts_templatecontext() { $webfonts = theme_boost_union_get_webfonts_extensions(); // Iterate over the files. - $filesforcontext = array(); + $filesforcontext = []; foreach ($files as $af) { // Get the filename. $filename = $af->get_filename(); @@ -754,8 +754,8 @@ function theme_boost_union_get_customfonts_templatecontext() { // Otherwise, fill the templatecontext of the file list. $urlpersistent = new moodle_url('/pluginfile.php/1/theme_boost_union/customfonts/0/'.$filename); - $filesforcontext[] = array('filename' => $filename, - 'fileurlpersistent' => $urlpersistent->out()); + $filesforcontext[] = ['filename' => $filename, + 'fileurlpersistent' => $urlpersistent->out(), ]; } } @@ -768,7 +768,7 @@ function theme_boost_union_get_customfonts_templatecontext() { * @return array */ function theme_boost_union_get_webfonts_extensions() { - return array('.eot', '.otf', '.svg', '.ttf', '.woff', '.woff2'); + return ['.eot', '.otf', '.svg', '.ttf', '.woff', '.woff2']; } /** @@ -794,38 +794,38 @@ function theme_boost_union_register_webfonts_filetypes() { // Our array of webfont file types to register. // As we want to keep things simple, we do not set a particular icon for these file types. // Likewise, we do not set any type groups or use descriptions from the language pack. - $webfonts = array( - 'eot' => array( + $webfonts = [ + 'eot' => [ 'extension' => 'eot', 'mimetype' => 'application/vnd.ms-fontobject', - 'coreicon' => 'unknown' - ), - 'otf' => array( + 'coreicon' => 'unknown', + ], + 'otf' => [ 'extension' => 'otf', 'mimetype' => 'font/otf', - 'coreicon' => 'unknown' - ), - 'svg' => array( + 'coreicon' => 'unknown', + ], + 'svg' => [ 'extension' => 'svg', 'mimetype' => 'image/svg+xml', - 'coreicon' => 'unknown' - ), - 'ttf' => array( + 'coreicon' => 'unknown', + ], + 'ttf' => [ 'extension' => 'ttf', 'mimetype' => 'font/ttf', - 'coreicon' => 'unknown' - ), - 'woff' => array( + 'coreicon' => 'unknown', + ], + 'woff' => [ 'extension' => 'woff', 'mimetype' => 'font/woff', - 'coreicon' => 'unknown' - ), - 'woff2' => array( + 'coreicon' => 'unknown', + ], + 'woff2' => [ 'extension' => 'woff2', 'mimetype' => 'font/woff2', - 'coreicon' => 'unknown' - ), - ); + 'coreicon' => 'unknown', + ], + ]; // First, get the list of currently registered file types. $currenttypes = core_filetypes::get_types(); @@ -865,11 +865,11 @@ function theme_boost_union_get_emailbrandinghtmlpreview() { } // Otherwise, compose mail text. - $mailtemplatecontext = array('body' => get_string('emailbrandinghtmldemobody', 'theme_boost_union')); + $mailtemplatecontext = ['body' => get_string('emailbrandinghtmldemobody', 'theme_boost_union')]; $mail = $OUTPUT->render_from_template('core/email_html', $mailtemplatecontext); // And compose mail preview. - $previewtemplatecontext = array('mail' => $mail); + $previewtemplatecontext = ['mail' => $mail]; $preview = $OUTPUT->render_from_template('theme_boost_union/emailpreview', $previewtemplatecontext); return $preview; @@ -896,12 +896,12 @@ function theme_boost_union_get_emailbrandingtextpreview() { } // Otherwise, compose mail text. - $mailtemplatecontext = array('body' => get_string('emailbrandingtextdemobody', 'theme_boost_union')); + $mailtemplatecontext = ['body' => get_string('emailbrandingtextdemobody', 'theme_boost_union')]; $mail = nl2br($OUTPUT->render_from_template('core/email_text', $mailtemplatecontext)); $mail = '
'.$mail.'
'; // And compose mail preview. - $previewtemplatecontext = array('mail' => $mail); + $previewtemplatecontext = ['mail' => $mail]; $preview = $OUTPUT->render_from_template('theme_boost_union/emailpreview', $previewtemplatecontext); return $preview; @@ -961,7 +961,7 @@ function theme_boost_union_add_flavourcss_to_page() { if ($flavour != null) { // Build the flavour CSS file URL. $flavourcssurl = new moodle_url('/theme/boost_union/flavours/styles.php', - array('id' => $flavour->id, 'rev' => theme_get_revision())); + ['id' => $flavour->id, 'rev' => theme_get_revision()]); // Add the CSS file to the page. $PAGE->requires->css($flavourcssurl); @@ -1032,7 +1032,7 @@ function theme_boost_union_set_mobilecss_url() { // This parameter isn't the theme revision as the theme cache is not cleared when this setting is stored. // It is just the time when the setting is saved. // This is the best we can do to make the Mobile app load the new styles when needed. - $mobilescssurl = new moodle_url('/theme/boost_union/mobile/styles.php', array('rev' => time())); + $mobilescssurl = new moodle_url('/theme/boost_union/mobile/styles.php', ['rev' => time()]); // Set the $CFG->mobilecssurl setting. set_config('mobilecssurl', $mobilescssurl->out()); @@ -1064,7 +1064,7 @@ function theme_boost_union_get_additional_regions($pageregions=[]) { 'outsidebottom' => 'outside-bottom', 'contentupper' => 'content-upper', 'contentlower' => 'content-lower', - 'header' => 'header' + 'header' => 'header', ]; return ($pageregions) ? array_intersect($regions, $pageregions) : $regions; @@ -1198,7 +1198,7 @@ function theme_boost_union_place_mod_icons() { $files = $fs->get_area_files($systemcontext->id, 'theme_boost_union', 'modicons', false, 'itemid', true); // Get installed activity plugins. - $modules = $DB->get_records('modules', array(), '', 'name'); + $modules = $DB->get_records('modules', [], '', 'name'); // Iterate over the files. foreach ($files as $file) { @@ -1277,10 +1277,10 @@ function theme_boost_union_get_modicon_templatecontext () { $files = $fs->get_area_files($systemcontext->id, 'theme_boost_union', 'modicons', false, 'filepath,filename', true); // Get installed activity plugins. - $modules = $DB->get_records('modules', array(), '', 'name'); + $modules = $DB->get_records('modules', [], '', 'name'); // Initialize template data. - $templatedata = array(); + $templatedata = []; // Iterate over the files. foreach ($files as $file) { diff --git a/renderers.php b/renderers.php index ef68fd0ab2e..a9f6079f7ab 100644 --- a/renderers.php +++ b/renderers.php @@ -49,10 +49,10 @@ public function h5p_alter_styles(&$styles, $libraries, $embedtype) { $h5pcssurl = new moodle_url('/theme/boost_union/h5p/styles.php'); // Add the CSS file path and a version (to support browser caching) to H5P. - $styles[] = (object) array( + $styles[] = (object) [ 'path' => $h5pcssurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; // If the local_och5pcore plugin is installed, add some more styles. if (file_exists($CFG->dirroot.'/local/och5pcore/version.php')) { @@ -60,17 +60,17 @@ public function h5p_alter_styles(&$styles, $libraries, $embedtype) { if (isset($libraries['H5P.InteractiveVideo']) && $libraries['H5P.InteractiveVideo']['majorVersion'] == '1') { // Adding H5PEditor css file. $h5peditoravurl = new moodle_url('/local/och5pcore/lib/style/H5PEditor.AV.css'); - $styles[] = (object) array( + $styles[] = (object) [ 'path' => $h5peditoravurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; // Adding opencast font css file. $ocfontsurl = new moodle_url('/local/och5pcore/lib/style/oc-fonts.css'); - $styles[] = (object) array( + $styles[] = (object) [ 'path' => $ocfontsurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; } } } @@ -91,17 +91,17 @@ public function h5p_alter_scripts(&$scripts, $libraries, $embedtype) { if (isset($libraries['H5P.InteractiveVideo']) && $libraries['H5P.InteractiveVideo']['majorVersion'] == '1') { // Adding LTI related script into scripts array. $h5prunltiurl = new moodle_url('/local/och5pcore/lib/js/H5PRunLTI.js'); - $scripts[] = (object) array( + $scripts[] = (object) [ 'path' => $h5prunltiurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; // Adding editor script to scripts array. $h5peditoravurl = new moodle_url('/local/och5pcore/lib/js/H5PEditor.AV.js'); - $scripts[] = (object) array( + $scripts[] = (object) [ 'path' => $h5peditoravurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; } } } @@ -138,10 +138,10 @@ public function hvp_alter_styles(&$styles, $libraries, $embedtype) { $h5pcssurl = new moodle_url('/theme/boost_union/h5p/styles.php'); // Add the CSS file path and a version (to support browser caching) to H5P. - $styles[] = (object)array( + $styles[] = (object)[ 'path' => $h5pcssurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; // If the local_och5p plugin is installed, add some more styles. if (file_exists($CFG->dirroot.'/local/och5p/version.php')) { @@ -149,17 +149,17 @@ public function hvp_alter_styles(&$styles, $libraries, $embedtype) { if (isset($libraries['H5P.InteractiveVideo']) && $libraries['H5P.InteractiveVideo']['majorVersion'] == '1') { // Adding H5PEditor css file. $h5peditoravurl = new moodle_url('/local/och5p/lib/style/H5PEditor.AV.css'); - $styles[] = (object) array( + $styles[] = (object) [ 'path' => $h5peditoravurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; // Adding opencast font css file. $ocfontsurl = new moodle_url('/local/och5p/lib/style/oc-fonts.css'); - $styles[] = (object) array( + $styles[] = (object) [ 'path' => $ocfontsurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; } } } @@ -180,17 +180,17 @@ public function hvp_alter_scripts(&$scripts, $libraries, $embedtype) { if (isset($libraries['H5P.InteractiveVideo']) && $libraries['H5P.InteractiveVideo']['majorVersion'] == '1') { // Adding LTI related script into scripts array. $h5prunltiurl = new moodle_url('/local/och5p/lib/js/H5PRunLTI.js'); - $scripts[] = (object) array( + $scripts[] = (object) [ 'path' => $h5prunltiurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; // Adding editor script to scripts array. $h5peditoravurl = new moodle_url('/local/och5p/lib/js/H5PEditor.AV.js'); - $scripts[] = (object) array( + $scripts[] = (object) [ 'path' => $h5peditoravurl->out(), 'version' => '?ver='.theme_get_revision(), - ); + ]; } } } diff --git a/settings.php b/settings.php index b617560b636..432a1e40712 100644 --- a/settings.php +++ b/settings.php @@ -22,8 +22,8 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -use \theme_boost_union\admin_setting_configdatetime; -use \theme_boost_union\admin_setting_configstoredfilealwayscallback; +use theme_boost_union\admin_setting_configdatetime; +use theme_boost_union\admin_setting_configstoredfilealwayscallback; defined('MOODLE_INTERNAL') || die(); @@ -106,8 +106,8 @@ // Prepare options array for select settings. // Due to MDL-58376, we will use binary select settings instead of checkbox settings throughout this theme. - $yesnooption = array(THEME_BOOST_UNION_SETTING_SELECT_YES => get_string('yes'), - THEME_BOOST_UNION_SETTING_SELECT_NO => get_string('no')); + $yesnooption = [THEME_BOOST_UNION_SETTING_SELECT_YES => get_string('yes'), + THEME_BOOST_UNION_SETTING_SELECT_NO => get_string('no'), ]; // Prepare regular expression for checking if the value is a percent number (from 0% to 100%) or a pixel number // (with 3 or 4 digits) or a viewport width number (from 0 to 100). @@ -156,7 +156,7 @@ $title = get_string('presetfiles', 'theme_boost', null, true); $description = get_string('presetfiles_desc', 'theme_boost', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0, - array('maxfiles' => 20, 'accepted_types' => array('.scss'))); + ['maxfiles' => 20, 'accepted_types' => ['.scss']]); $tab->add($setting); // Add tab to settings page. @@ -232,7 +232,7 @@ // Create logos heading. $name = 'theme_boost_union/logosheading'; $title = get_string('logosheading', 'theme_boost_union', null, true); - $notificationurl = new moodle_url('/admin/settings.php', array('section' => 'logos')); + $notificationurl = new moodle_url('/admin/settings.php', ['section' => 'logos']); $notification = new \core\output\notification(get_string('logosheading_desc', 'theme_boost_union', $notificationurl->out()), \core\output\notification::NOTIFY_INFO); $notification->set_show_closebutton(false); @@ -245,7 +245,7 @@ $title = get_string('logosetting', 'theme_boost_union', null, true); $description = get_string('logosetting_desc', 'theme_boost_union', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'logo', 0, - array('maxfiles' => 1, 'accepted_types' => 'web_image')); + ['maxfiles' => 1, 'accepted_types' => 'web_image']); $setting->set_updatedcallback('theme_reset_all_caches'); $tab->add($setting); @@ -254,14 +254,14 @@ $title = get_string('logocompactsetting', 'theme_boost_union', null, true); $description = get_string('logocompactsetting_desc', 'theme_boost_union', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'logocompact', 0, - array('maxfiles' => 1, 'accepted_types' => 'web_image')); + ['maxfiles' => 1, 'accepted_types' => 'web_image']); $setting->set_updatedcallback('theme_reset_all_caches'); $tab->add($setting); // Create favicon heading. $name = 'theme_boost_union/faviconheading'; $title = get_string('faviconheading', 'theme_boost_union', null, true); - $notificationurl = new moodle_url('/admin/settings.php', array('section' => 'logos')); + $notificationurl = new moodle_url('/admin/settings.php', ['section' => 'logos']); $notification = new \core\output\notification(get_string('faviconheading_desc', 'theme_boost_union', $notificationurl->out()), \core\output\notification::NOTIFY_INFO); $notification->set_show_closebutton(false); @@ -274,7 +274,7 @@ $title = get_string('faviconsetting', 'theme_boost_union', null, true); $description = get_string('faviconsetting_desc', 'theme_boost_union', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'favicon', 0, - array('maxfiles' => 1, 'accepted_types' => 'image')); + ['maxfiles' => 1, 'accepted_types' => 'image']); $setting->set_updatedcallback('theme_reset_all_caches'); $tab->add($setting); @@ -289,7 +289,7 @@ $title = get_string('backgroundimagesetting', 'theme_boost_union', null, true); $description = get_string('backgroundimagesetting_desc', 'theme_boost_union', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'backgroundimage', 0, - array('maxfiles' => 1, 'accepted_types' => 'web_image')); + ['maxfiles' => 1, 'accepted_types' => 'web_image']); $setting->set_updatedcallback('theme_reset_all_caches'); $tab->add($setting); @@ -355,7 +355,7 @@ $name = 'theme_boost_union/navbarcolor'; $title = get_string('navbarcolorsetting', 'theme_boost_union', null, true); $description = get_string('navbarcolorsetting_desc', 'theme_boost_union', null, true); - $navbarcoloroptions = array( + $navbarcoloroptions = [ THEME_BOOST_UNION_SETTING_NAVBARCOLOR_LIGHT => get_string('navbarcolorsetting_light', 'theme_boost_union'), THEME_BOOST_UNION_SETTING_NAVBARCOLOR_DARK => @@ -363,7 +363,7 @@ THEME_BOOST_UNION_SETTING_NAVBARCOLOR_PRIMARYLIGHT => get_string('navbarcolorsetting_primarylight', 'theme_boost_union'), THEME_BOOST_UNION_SETTING_NAVBARCOLOR_PRIMARYDARK => - get_string('navbarcolorsetting_primarydark', 'theme_boost_union')); + get_string('navbarcolorsetting_primarydark', 'theme_boost_union'), ]; $setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_NAVBARCOLOR_LIGHT, $navbarcoloroptions); $tab->add($setting); @@ -441,15 +441,15 @@ $tab->add($setting); // Prepare activity purposes. - $purposesoptions = array( + $purposesoptions = [ MOD_PURPOSE_ADMINISTRATION => get_string('activitypurposeadministration', 'theme_boost_union'), MOD_PURPOSE_ASSESSMENT => get_string('activitypurposeassessment', 'theme_boost_union'), MOD_PURPOSE_COLLABORATION => get_string('activitypurposecollaboration', 'theme_boost_union'), MOD_PURPOSE_COMMUNICATION => get_string('activitypurposecommunication', 'theme_boost_union'), MOD_PURPOSE_CONTENT => get_string('activitypurposecontent', 'theme_boost_union'), MOD_PURPOSE_INTERFACE => get_string('activitypurposeinterface', 'theme_boost_union'), - MOD_PURPOSE_OTHER => get_string('activitypurposeother', 'theme_boost_union') - ); + MOD_PURPOSE_OTHER => get_string('activitypurposeother', 'theme_boost_union'), + ]; // Get installed activity modules. $installedactivities = get_module_types_names(); // Iterate over all existing activities. @@ -494,7 +494,7 @@ // Use our enhanced implementation of admin_setting_configstoredfile to circumvent MDL-59082. // This can be changed back to admin_setting_configstoredfile as soon as MDL-59082 is fixed. $setting = new admin_setting_configstoredfilealwayscallback($name, $title, $description, 'modicons', 0, - array('maxfiles' => -1, 'subdirs' => 1, 'accepted_types' => ['.png', '.svg'])); + ['maxfiles' => -1, 'subdirs' => 1, 'accepted_types' => ['.png', '.svg']]); $setting->set_updatedcallback('theme_boost_union_place_mod_icons'); $tab->add($setting); $page->hide_if('theme_boost_union/modiconsfiles', 'theme_boost_union/modiconsenable', 'neq', @@ -512,7 +512,7 @@ $description = get_string('modiconlistsetting_desc', 'theme_boost_union', null, true); // Append the file list to the description. - $templatecontext = array('files' => theme_boost_union_get_modicon_templatecontext()); + $templatecontext = ['files' => theme_boost_union_get_modicon_templatecontext()]; $description .= $OUTPUT->render_from_template('theme_boost_union/settings-modicon-filelist', $templatecontext); // Finish the widget. @@ -539,7 +539,7 @@ $title = get_string('loginbackgroundimage', 'theme_boost_union', null, true); $description = get_string('loginbackgroundimage_desc', 'theme_boost_union', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'loginbackgroundimage', 0, - array('maxfiles' => 25, 'accepted_types' => 'web_image')); + ['maxfiles' => 25, 'accepted_types' => 'web_image']); $setting->set_updatedcallback('theme_reset_all_caches'); $tab->add($setting); @@ -560,10 +560,11 @@ $name = 'theme_boost_union/loginformposition'; $title = get_string('loginformpositionsetting', 'theme_boost_union', null, true); $description = get_string('loginformpositionsetting_desc', 'theme_boost_union', null, true); - $loginformoptions = array( + $loginformoptions = [ THEME_BOOST_UNION_SETTING_LOGINFORMPOS_CENTER => get_string('loginformpositionsetting_center', 'theme_boost_union'), THEME_BOOST_UNION_SETTING_LOGINFORMPOS_LEFT => get_string('loginformpositionsetting_left', 'theme_boost_union'), - THEME_BOOST_UNION_SETTING_LOGINFORMPOS_RIGHT => get_string('loginformpositionsetting_right', 'theme_boost_union')); + THEME_BOOST_UNION_SETTING_LOGINFORMPOS_RIGHT => + get_string('loginformpositionsetting_right', 'theme_boost_union'), ]; $setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_LOGINFORMPOS_CENTER, $loginformoptions); $tab->add($setting); @@ -601,7 +602,7 @@ $title = get_string('courseheaderimagefallback', 'theme_boost_union', null, true); $description = get_string('courseheaderimagefallback_desc', 'theme_boost_union', null, true); $setting = new admin_setting_configstoredfile($name, $title, $description, 'courseheaderimagefallback', 0, - array('maxfiles' => 1, 'accepted_types' => 'web_image')); + ['maxfiles' => 1, 'accepted_types' => 'web_image']); $tab->add($setting); $page->hide_if('theme_boost_union/courseheaderimagefallback', 'theme_boost_union/courseheaderimageenabled', 'neq', THEME_BOOST_UNION_SETTING_SELECT_YES); @@ -610,13 +611,13 @@ $name = 'theme_boost_union/courseheaderimagelayout'; $title = get_string('courseheaderimagelayout', 'theme_boost_union', null, true); $description = get_string('courseheaderimagelayout_desc', 'theme_boost_union', null, true); - $courseheaderimagelayoutoptions = array( + $courseheaderimagelayoutoptions = [ THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_STACKEDDARK => get_string('courseheaderimagelayoutstackeddark', 'theme_boost_union'), THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_STACKEDLIGHT => get_string('courseheaderimagelayoutstackedlight', 'theme_boost_union'), THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_HEADINGABOVE => - get_string('courseheaderimagelayoutheadingabove', 'theme_boost_union')); + get_string('courseheaderimagelayoutheadingabove', 'theme_boost_union'), ]; $setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_COURSEIMAGELAYOUT_HEADINGABOVE, $courseheaderimagelayoutoptions); $tab->add($setting); @@ -627,11 +628,11 @@ $name = 'theme_boost_union/courseheaderimageheight'; $title = get_string('courseheaderimageheight', 'theme_boost_union', null, true); $description = get_string('courseheaderimageheight_desc', 'theme_boost_union', null, true); - $courseheaderimageheightoptions = array( + $courseheaderimageheightoptions = [ THEME_BOOST_UNION_SETTING_HEIGHT_100PX => THEME_BOOST_UNION_SETTING_HEIGHT_100PX, THEME_BOOST_UNION_SETTING_HEIGHT_150PX => THEME_BOOST_UNION_SETTING_HEIGHT_150PX, THEME_BOOST_UNION_SETTING_HEIGHT_200PX => THEME_BOOST_UNION_SETTING_HEIGHT_200PX, - THEME_BOOST_UNION_SETTING_HEIGHT_250PX => THEME_BOOST_UNION_SETTING_HEIGHT_250PX); + THEME_BOOST_UNION_SETTING_HEIGHT_250PX => THEME_BOOST_UNION_SETTING_HEIGHT_250PX, ]; $setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_HEIGHT_150PX, $courseheaderimageheightoptions); $tab->add($setting); @@ -642,7 +643,7 @@ $name = 'theme_boost_union/courseheaderimageposition'; $title = get_string('courseheaderimageposition', 'theme_boost_union', null, true); $description = get_string('courseheaderimageposition_desc', 'theme_boost_union', null, true); - $courseheaderimagepositionoptions = array( + $courseheaderimagepositionoptions = [ THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_CENTER => THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_CENTER, THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_TOP => @@ -660,7 +661,7 @@ THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_CENTER => THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_CENTER, THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_BOTTOM => - THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_BOTTOM); + THEME_BOOST_UNION_SETTING_IMAGEPOSITION_RIGHT_BOTTOM, ]; $setting = new admin_setting_configselect($name, $title, $description, THEME_BOOST_UNION_SETTING_IMAGEPOSITION_CENTER_CENTER, $courseheaderimagepositionoptions); $tab->add($setting); @@ -694,9 +695,9 @@ $title = ''; $description = '

'.get_string('emailbrandinginstruction', 'theme_boost_union', null, true).'

'; $description .= '

'.get_string('emailbrandinginstruction0', 'theme_boost_union', null, true).'

'; - $emailbrandinginstructionli1url = new moodle_url('/admin/tool/customlang/index.php', array('lng' => $CFG->lang)); + $emailbrandinginstructionli1url = new moodle_url('/admin/tool/customlang/index.php', ['lng' => $CFG->lang]); $description .= '