diff --git a/CHANGELOG.md b/CHANGELOG.md index a02a3e5..b98e14b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ All notable changes to this project will be documented in this file. - New setting to hide completed courses in {mycoursesmenu} list. - New {menudev} tag. - New {ifprofile_field_...}{/ifprofile_field_...} tags. +- New {supportname} tag. +- New {supportemail} tag. +- New {supportpage} tag. ### Updated - {coursesummary} can now include other FilterCodes. - {categorycards} titles now always display white. diff --git a/README.md b/README.md index 4134838..09065ef 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,10 @@ FilterCodes are meant to be entered as regular text in the Moodle WYSIWYG editor * {diskfreespace} : Display amount of free disk space for application folder. Infinite symbol will be displayed if greater than about 84,703.29 Yottabyte (YB) or failure to get size from operating system. * {diskfreespacedata} : Display amount of free disk space for moodledata folder. Infinite symbol will be displayed if greater than about 84,703.29 Yottabyte (YB) or failure to get size from operating system. * {wwwroot} : Root URL of the Moodle site. +* {supportname} : Support name as seen on Site Administration > Server > Support contact. +* {supportemail} : Support email address as seen on Site Administration > Server > Support contact. +* {supporturl} : Support page as seen on Site Administration > Server > Support contact. + ### UI Elements @@ -856,6 +860,9 @@ Create a Page on your Moodle site, preferably in a course, so that those tags wo * [{courseimage}] : {courseimage} * Number of participants in the course [{courseparticipantcount}] : {courseparticipantcount} * The base (root) URL of your Moodle site [{wwwroot}]: {wwwroot} +* Site support name [{supportname}]: {supportname} +* Site support email address [{supportemail}]: {supportemail} +* Site support web page [{supportpage}]: {supportpage} * WWW for Contact Form [{wwwcontactform}]: {wwwcontactform} * Page path [{pagepath}]: {pagepath} * This URL [{thisurl}]: {thisurl} diff --git a/filter.php b/filter.php index 53fb0f3..bc12a9f 100644 --- a/filter.php +++ b/filter.php @@ -669,6 +669,24 @@ function ($matches) use ($USER) { } } + // Tags starting with: {support...}. + if (stripos($text, '{support') !== false) { + // Tag: {supportname}. + if (stripos($text, '{supportname}') !== false) { + $replace['/\{supportname\}/i'] = $CFG->supportname; + } + + // Tag: {supportemail}. + if (stripos($text, '{supportemail}') !== false) { + $replace['/\{supportemail\}/i'] = $CFG->supportemail; + } + + // Tag: {supportpage}. + if (stripos($text, '{supportpage}') !== false) { + $replace['/\{supportpage\}/i'] = $CFG->supportpage; + } + } + if (get_config('filter_filtercodes', 'enable_scrape')) { // Must be enabled in FilterCodes settings. // Tag: {scrape url="" tag="" class="" id="" code=""}. if (stripos($text, '{scrape ') !== false) {