/**
  * Set the role_slugs global
  *
  * @since 1.0.0
  *
  * @uses ba_eas_get_editable_roles() To get an array of editable_roles.
  * @uses get_option() To get the custom role slugs array.
  * @uses wp_parse_args() To merge our custom role slugs array with the default role slugs.
  */
 public function set_role_slugs()
 {
     // Get editable_roles array
     $editable_roles = ba_eas_get_editable_roles();
     // Merge system roles with any customizations we may have
     $roles = wp_parse_args(get_option('_ba_eas_role_slugs', array()), $editable_roles);
     // Set the slugs global
     $this->role_slugs = $roles;
 }
/**
 * Sanitize the custom Role-Based Author Base slugs.
 *
 * @since 1.0.0
 *
 * @uses sanitize_title() To sanitize the slug.
 * @uses ba_eas_get_editable_roles() To get the editable roles.
 * @uses get_option() To get the role slugs array.
 * @uses wp_parse_args() To parse the role slugs.
 * @uses ba_eas() BA_Edit_Author_Slug object.
 */
function ba_eas_admin_setting_sanitize_callback_role_slugs($role_slugs = array())
{
    // Sanitize the slugs passed via POST
    foreach ($role_slugs as $role => $role_slug) {
        $slug = sanitize_title($role_slug['slug']);
        $editable_roles = ba_eas_get_editable_roles();
        $role_slugs[$role]['slug'] = empty($slug) ? $editable_roles[$role]['slug'] : $slug;
    }
    /*
     * Merge our new settings with what's stored in the db.
     * This is needed because the editable_roles filter may
     * mean that lower level admins don't have access to all roles.
     * This could lead to lower level admins stamping out customizations
     * that only a higher level admin can, and has already, set.
     */
    $role_slugs = wp_parse_args($role_slugs, get_option('_ba_eas_role_slugs', array()));
    // Set BA_Edit_Author_Slug::role_slugs for later use
    ba_eas()->role_slugs = $role_slugs;
    return $role_slugs;
}