This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// EmailMoodleAdmin is free software: you can redistribute it and/or modify | |
// it under the terms of the GNU General Public License as published by | |
// the Free Software Foundation, either version 3 of the License, or | |
// (at your option) any later version. | |
// | |
// EmailMoodleAdmin is distributed in the hope that it will be useful, | |
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// GNU General Public License for more details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enables smooth page scrolling for in-page links | |
* Usage: Just add this to your web page and it will automatically be applied. | |
* | |
* @Copyright 2016-2017 TNG Consulting Inc. GPLv3+ license. | |
*/ | |
jQuery( document ).ready(function() { | |
// Scroll to the in-page id. # alone takes you back to the top of the page. | |
jQuery(document).on('click', 'a[href^="#"]', function(e) { | |
// Get the target element id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Enables scrolling to a class instead of an ID for applications like Moodle that use YUI. | |
* YUI often litters your HTML code adding what appears to be random ID's for every element. This means that you can't | |
* actually use ID's in your HTML, and hence, cannot create in-page links. This solves that problem. | |
* Usage: | |
* 1) Add this code to your web page. | |
* 2) Add a class called goto-WhatEverYouWant such as class="goto-section5" to an element. | |
* 3) When you load the page, any classes starting with goto- will become an ID for that element. | |
* This will enable you to create in-page links such as <a href="#section5">Section 5</a> | |
* Consider combining this with the optional smooth scrolling Gist for a nice touch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Get a list of all roles in WordPress and return them as an array. | |
* @return array of roles. | |
*/ | |
function getRolesArray() { | |
global $wp_roles; | |
foreach($wp_roles->roles as $key => $role) { | |
$roles[] = $key; | |
} | |
return $roles; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Get a list of all categories in WordPress and return them as an array. | |
*/ | |
function getCategoriesArray() { | |
// Retrieve object containing all of the categories. | |
$cats = get_categories(); | |
// Convert the object into a simple array containing a list of categories. | |
$categories[] = ''; |
NewerOlder