本文整理汇总了PHP中optionsframework_setdefaults函数的典型用法代码示例。如果您正苦于以下问题:PHP optionsframework_setdefaults函数的具体用法?PHP optionsframework_setdefaults怎么用?PHP optionsframework_setdefaults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了optionsframework_setdefaults函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: optionsframework_init
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');
}
示例2: optionsframework_init
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');
}
示例3: optionsframework_init
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');
}
示例4: optionsframework_init
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');
}
示例5: hs_optionsframework_init
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');
}
示例6: optionsframework_rolescheck
}
/* 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()
示例7: optionsframework_init
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');
}