Esempio n. 1
0
function optionsframework_init()
{
    // Include the required files
    require_once dirname(__FILE__) . '/options-interface.php';
    require_once dirname(__FILE__) . '/options-medialibrary-uploader.php';
    // Loads the options array from the theme
    if ($optionsfile = locate_template(array('options.php'))) {
        require_once $optionsfile;
    } else {
        if (file_exists(dirname(__FILE__) . '/options.php')) {
            require_once dirname(__FILE__) . '/options.php';
        }
    }
    $optionsframework_settings = get_option('optionsframework');
    // Updates the unique option id in the database if it has changed
    optionsframework_option_name();
    // Gets the unique id, returning a default if it isn't defined
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    // If the option has no saved data, load the defaults
    if (!get_option($option_name)) {
        optionsframework_setdefaults();
    }
    // Registers the settings fields and callback
    register_setting('optionsframework', $option_name, 'optionsframework_validate');
    // Change the capability required to save the 'optionsframework' options group.
    add_filter('option_page_capability_optionsframework', 'optionsframework_page_capability');
}
Esempio n. 2
0
}
/* If the user can't edit theme options, no use running this plugin */
add_action('init', 'optionsframework_rolescheck');
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_head', 'optionsframework_mlu_css' );
        //add_action( 'admin_head', 'optionsframework_mlu_js' );
    }
}
/* Loads the file for option sanitization */
add_action('init', 'optionsframework_load_sanitization');
function optionsframework_load_sanitization()
{
    require_once get_template_directory() . '/themeOptions/admin/options-sanitize.php';
}
/*
 * Creates the settings in the database by looping through the array
 * we supplied in options.php.  This is a neat way to do it since
 * we won't have to save settings for headers, descriptions, or arguments.
 *
 * Read more about the Settings API in the WordPress codex:
 * http://codex.wordpress.org/Settings_API
 *
 */
function optionsframework_init()
Esempio n. 3
0
function optionsframework_init()
{
    // Include the required files
    require_once dirname(__FILE__) . '/featured-listing.php';
    require_once dirname(__FILE__) . '/options-interface.php';
    require_once dirname(__FILE__) . '/options-medialibrary-uploader.php';
    if ($optionsfile = locate_template(array('options.php'))) {
        require_once $optionsfile;
    } else {
        if (file_exists(dirname(__FILE__) . '/options.php')) {
            require_once dirname(__FILE__) . '/options.php';
        }
    }
    do_action('optionsframework_after_options_load');
    $optionsframework_settings = get_option('optionsframework');
    // Updates the unique option id in the database if it has changed
    optionsframework_option_name();
    // Gets the unique id, returning a default if it isn't defined
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    // If the option has no saved data, load the defaults
    if (!get_option($option_name)) {
        optionsframework_setdefaults();
    }
    // Registers the settings fields and callback
    register_setting('optionsframework', $option_name, 'optionsframework_validate');
}
function optionsframework_init()
{
    // Include the required files
    require_once dirname(__FILE__) . '/options-interface.php';
    require_once dirname(__FILE__) . '/options-media-uploader.php';
    // Loads the options array from the theme
    if ($optionsfile = locate_template(array('options.php'))) {
        require_once $optionsfile;
    } else {
        if (file_exists(dirname(__FILE__) . '/options.php')) {
            require_once dirname(__FILE__) . '/options.php';
        }
    }
    // Load settings
    $optionsframework_settings = get_option('optionsframework');
    // Update routine
    // This code can be removed if you're starting a new project
    // and don't have legacy users to support
    if ($optionsframework_settings && !isset($optionsframework_settings['version'])) {
        require_once dirname(__FILE__) . '/upgrade.php';
        optionsframework_upgrade_routine();
    }
    // Updates the unique option id in the database if it has changed
    optionsframework_option_name();
    // Gets the unique id, returning a default if it isn't defined
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'options_framework_theme';
    }
    // If the option has no saved data, load the defaults
    if (!get_option($option_name)) {
        optionsframework_setdefaults();
    }
    // Registers the settings fields and callback
    register_setting('optionsframework', $option_name, 'optionsframework_validate');
    // Change the capability required to save the 'optionsframework' options group.
    add_filter('option_page_capability_optionsframework', 'optionsframework_page_capability');
}
function optionsframework_init()
{
    // Include the required files
    require_once dirname(__FILE__) . '/options-sanitize.php';
    require_once dirname(__FILE__) . '/options-interface.php';
    require_once dirname(__FILE__) . '/options-medialibrary-uploader.php';
    // Loads the options array from the theme
    if ($optionsfile = locate_template(array('options.php'))) {
        $optionsfile = locate_template($location);
    } else {
        if (file_exists(dirname(__FILE__) . '/options.php')) {
            require_once dirname(__FILE__) . '/options.php';
        }
    }
    $optionsframework_settings = get_option('optionsframework');
    // Updates the unique option id in the database if it has changed
    optionsframework_option_name();
    // Gets the unique id, returning a default if it isn't defined
    $option_name = $optionsframework_settings['id'];
    // Set the option defaults in case they have changed
    optionsframework_setdefaults();
    // Registers the settings fields and callback
    register_setting('optionsframework', $option_name, 'optionsframework_validate');
}
Esempio n. 6
0
function hs_optionsframework_init()
{
    // Include the required files
    require_once dirname(__FILE__) . '/options-interface.php';
    require_once dirname(__FILE__) . '/options-medialibrary-uploader.php';
    // Loads the options array from the theme
    if ($optionsfile = locate_template(array('options.php'))) {
        require_once $optionsfile;
    } else {
        if (file_exists(dirname(__FILE__) . '/options.php')) {
            require_once dirname(__FILE__) . '/options.php';
        }
    }
    $optionsframework_settings = get_option('optionsframework');
    // Updates the unique option id in the database if it has changed
    optionsframework_option_name();
    // Gets the unique id, returning a default if it isn't defined
    if (isset($optionsframework_settings['id'])) {
        $option_name = $optionsframework_settings['id'];
    } else {
        $option_name = 'optionsframework';
    }
    // If the option has no saved data, load the defaults
    if (!get_option($option_name)) {
        optionsframework_setdefaults();
    }
    // Registers the settings fields and callback
    if (!isset($_POST['OptionsFramework-backup-import'])) {
        register_setting('optionsframework', $option_name, 'optionsframework_validate');
    }
    if (isset($_GET['buckupsuccess']) && $_GET['buckupsuccess'] == 'true') {
        add_settings_error('options-framework', 'save_options', __('All options are restored successfully.', HS_CURRENT_THEME), 'updated fade');
    }
    // Registers the settings fields and callback
    register_setting('optionsframework', $option_name, 'optionsframework_validate');
    // Change the capability required to save the 'optionsframework' options group.
    add_filter('option_page_capability_optionsframework', 'optionsframework_page_capability');
}
Esempio n. 7
-1
function optionsframework_init()
{
    // Include the required files
    require_once dirname(__FILE__) . '/options-interface.php';
    require_once dirname(__FILE__) . '/options-media-uploader.php';
    // Optionally Loads the options file from the theme
    $location = apply_filters('options_framework_location', array('options.php'));
    $optionsfile = locate_template($location);
    // Load settings
    $optionsframework_settings = get_option('optionsframework');
    // Updates the unique option id in the database if it has changed
    if (function_exists('optionsframework_option_name')) {
        optionsframework_option_name();
    } elseif (has_action('optionsframework_option_name')) {
        do_action('optionsframework_option_name');
    } else {
        $default_themename = get_option('stylesheet');
        $default_themename = preg_replace("/\\W/", "_", strtolower($default_themename));
        $default_themename = 'optionsframework_' . $default_themename;
        if (isset($optionsframework_settings['id'])) {
            if ($optionsframework_settings['id'] == $default_themename) {
                // All good, using default theme id
            } else {
                $optionsframework_settings['id'] = $default_themename;
                update_option('optionsframework', $optionsframework_settings);
            }
        } else {
            $optionsframework_settings['id'] = $default_themename;
            update_option('optionsframework', $optionsframework_settings);
        }
    }
    // If the option has no saved data, load the defaults
    if (!get_option($optionsframework_settings['id'])) {
        optionsframework_setdefaults();
    }
    // Registers the settings fields and callback
    register_setting('optionsframework', $optionsframework_settings['id'], 'optionsframework_validate');
    // Change the capability required to save the 'optionsframework' options group.
    add_filter('option_page_capability_optionsframework', 'optionsframework_page_capability');
}