| 1 |
<?php |
| 2 |
/** |
| 3 |
* General functions file for the plugin. |
| 4 |
* |
| 5 |
* @package Members |
| 6 |
* @subpackage Includes |
| 7 |
* @author The MemberPress Team |
| 8 |
* @copyright Copyright (c) 2009 - 2018, The MemberPress Team |
| 9 |
* @link https://members-plugin.com/ |
| 10 |
* @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 11 |
*/ |
| 12 |
if (!defined('ABSPATH')) { |
| 13 |
die('You are not allowed to call this page directly.'); |
| 14 |
} |
| 15 |
|
| 16 |
/** |
| 17 |
* Validates a value as a boolean. This way, strings such as "true" or "false" will be converted |
| 18 |
* to their correct boolean values. |
| 19 |
* |
| 20 |
* @since 1.0.0 |
| 21 |
* @access public |
| 22 |
* @param mixed $val |
| 23 |
* @return bool |
| 24 |
*/ |
| 25 |
function members_validate_boolean( $val ) { |
| 26 |
|
| 27 |
return filter_var( $val, FILTER_VALIDATE_BOOLEAN ); |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
* Helper function for sorting objects by priority. |
| 33 |
* |
| 34 |
* @since 2.0.0 |
| 35 |
* @access protected |
| 36 |
* @param object $a |
| 37 |
* @param object $b |
| 38 |
* @return int |
| 39 |
*/ |
| 40 |
function members_priority_sort( $a, $b ) { |
| 41 |
|
| 42 |
return $a->priority - $b->priority; |
| 43 |
} |
| 44 |
|