function optionsframework_rolescheck() { if (current_user_can('edit_theme_options')) { // If the user can edit theme options, let the fun begin! add_action('admin_menu', 'optionsframework_add_page'); add_action('admin_init', 'optionsframework_init'); add_action('admin_init', 'optionsframework_mlu_init'); optionsframework_load_options(); } elseif (current_user_can('edit_posts') || current_user_can('edit_pages')) { require_once dirname(__FILE__) . '/options-medialibrary-uploader.php'; add_action('admin_init', 'optionsframework_mlu_init'); } }
function optionsframework_get_page_options($page_slug) { return optionsframework_load_options(optionsframework_get_options_files($page_slug)); }
/** * Wrapper for optionsframework_options() * * Allows for manipulating or setting options via 'of_options' filter * For example: * * <code> * add_filter('of_options', function($options) { * $options[] = array( * 'name' => 'Input Text Mini', * 'desc' => 'A mini text input field.', * 'id' => 'example_text_mini', * 'std' => 'Default', * 'class' => 'mini', * 'type' => 'text' * ); * * return $options; * }); * </code> * * Also allows for setting options via a return statement in the * options.php file. For example (in options.php): * * <code> * return array(...); * </code> * * @return array (by reference) */ function &_optionsframework_options() { $options = optionsframework_load_options(optionsframework_get_options_files()); // Allow setting/manipulating options via filters $options = apply_filters('of_options', $options); return $options; }