예제 #1
0
/**
 * Return the rewrite rules class being used to interact with URLs.
 *
 * This function is abstracted to avoid global touches to the primary rewrite
 * rules class. bbPress supports WordPress's `$wp_rewrite` by default, but can
 * be filtered to support other configurations if needed.
 *
 * @since 2.5.8 bbPress (r5814)
 *
 * @return object
 */
function bbp_rewrite()
{
    return bbp_get_global_object('wp_rewrite', 'WP_Rewrite', (object) array('root' => '', 'pagination_base' => ''));
}
예제 #2
0
/**
 * Get the `$wp_roles` global without needing to declare it everywhere
 *
 * @since 2.2.0 bbPress (r4293)
 *
 * @return WP_Roles
 */
function bbp_get_wp_roles()
{
    // Try to get `$wp_roles`
    $retval = bbp_get_global_object('wp_roles', 'WP_Roles');
    // Set roles if not loaded
    if (is_null($retval)) {
        $retval = $GLOBALS['wp_roles'] = new WP_Roles();
    }
    return $retval;
}