Skip to content

Commit

Permalink
Filter helper functions
Browse files Browse the repository at this point in the history
return true, false, null, zero, '', []
  • Loading branch information
ozh committed May 3, 2015
1 parent 1b9b9de commit c76f600
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2197,6 +2197,78 @@ function yourls_return_if_not_empty_string( $val ) {
return( $val !== '' );
}

/**
* Returns true.
*
* Useful for returning true to filters easily.
*
* @since 1.7.1
* @return bool True.
*/
function yourls_return_true() {
return true;
}

/**
* Returns false.
*
* Useful for returning false to filters easily.
*
* @since 1.7.1
* @return bool False.
*/
function yourls_return_false() {
return false;
}

/**
* Returns 0.
*
* Useful for returning 0 to filters easily.
*
* @since 1.7.1
* @return int 0.
*/
function yourls_return_zero() {
return 0;
}

/**
* Returns an empty array.
*
* Useful for returning an empty array to filters easily.
*
* @since 1.7.1
* @return array Empty array.
*/
function yourls_return_empty_array() {
return array();
}

/**
* Returns null.
*
* Useful for returning null to filters easily.
*
* @since 1.7.1
* @return null Null value.
*/
function yourls_return_null() {
return null;
}

/**
* Returns an empty string.
*
* Useful for returning an empty string to filters easily.
*
* @since 1.7.1
* @return string Empty string.
*/
function yourls_return_empty_string() {
return '';
}

/**
* Add a message to the debug log
*
Expand Down

0 comments on commit c76f600

Please sign in to comment.