Skip to content

Commit

Permalink
Added new {supportname}, {supportemail}, {supportpage} tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed May 21, 2021
1 parent 1698884 commit b456377
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}
Expand Down
18 changes: 18 additions & 0 deletions filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b456377

Please sign in to comment.