本文整理汇总了PHP中optionsframework_option_name函数的典型用法代码示例。如果您正苦于以下问题:PHP optionsframework_option_name函数的具体用法?PHP optionsframework_option_name怎么用?PHP optionsframework_option_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了optionsframework_option_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: 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');
}
示例3: set_theme_option
/**
* Sets option defaults
*
* @since 1.7.0
*/
function set_theme_option()
{
// 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);
}
}
}
示例4: of_get_option
/**
* Get Option.
*
* Helper function to return the theme option value.
* If no value has been saved, it returns $default.
* Needed because options are saved as serialized strings.
*/
function of_get_option($name, $default = false)
{
$config = get_option(optionsframework_option_name());
if (!isset($config['id'])) {
return $default;
}
$options = get_option($config['id']);
if (isset($options[$name])) {
return $options[$name];
}
return $default;
}
示例5: get_option_name
/**
* Gets option name
*
* @since 1.9.0
*/
function get_option_name()
{
$name = '';
// Gets option name as defined in the theme
if (function_exists('optionsframework_option_name')) {
$name = optionsframework_option_name();
}
// Fallback
if ('' == $name) {
$name = get_option('stylesheet');
$name = preg_replace("/\\W/", "_", strtolower($name));
}
return apply_filters('options_framework_option_name', $name);
}
示例6: onetone_of_get_options
function onetone_of_get_options($default = false)
{
//$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED.'optionsframework');
// Gets the unique option id
//$option_name = $optionsframework_settings['id'];
$option_name = optionsframework_option_name();
if (get_option($option_name)) {
$options = get_option($option_name);
}
if (isset($options)) {
return $options;
} else {
return $default;
}
}
示例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';
// Require Markdown if not loaded
if (!function_exists('Markdown')) {
require_once dirname(__FILE__) . '/markdown.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');
}
示例8: of_get_option
function of_get_option($name, $default = false)
{
$option_name = '';
// Gets option name as defined in the theme
if (function_exists('optionsframework_option_name')) {
$option_name = optionsframework_option_name();
}
// Fallback option name
if ('' == $option_name) {
$option_name = get_option('stylesheet');
$option_name = preg_replace("/\\W/", "_", strtolower($option_name));
}
// Get option settings from database
$options = get_option($option_name);
if (isset($options[$name])) {
return $options[$name];
}
return $default;
}
示例9: onetone_of_get_options
function onetone_of_get_options($default = false)
{
//$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED.'optionsframework');
// Gets the unique option id
//$option_name = $optionsframework_settings['id'];
$option_name = optionsframework_option_name();
if (get_option($option_name)) {
$options = get_option($option_name);
} else {
$location = apply_filters('options_framework_location', array('includes/admin-options.php'));
if ($optionsfile = locate_template($location)) {
$maybe_options = (require_once $optionsfile);
if (is_array($maybe_options)) {
$options = $maybe_options;
} else {
if (function_exists('optionsframework_options')) {
$options = optionsframework_options();
}
}
}
$options = apply_filters('of_options', $options);
$config = $options;
foreach ((array) $config as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
$output[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
$options = $output;
}
if (isset($options)) {
return $options;
} else {
return $default;
}
}
示例10: 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);
}
}
$optionsframework_settings = get_option('optionsframework');
$saved_settings = get_option($optionsframework_settings['id']);
// If the option has no saved data, load the defaults
if (!$saved_settings) {
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');
}
示例11: 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');
}
示例12: 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');
}
示例13: cordillera_of_get_options
function cordillera_of_get_options($default = false)
{
// Gets the unique option id
$option_name = optionsframework_option_name();
if (get_option($option_name)) {
$options = get_option($option_name);
}
if (isset($options)) {
return $options;
} else {
return $default;
}
}
示例14: onetone_of_get_options
function onetone_of_get_options($default = false)
{
global $options_saved, $onetone_default_options;
$options_saved = false;
//$optionsframework_settings = get_option(ONETONE_OPTIONS_PREFIXED.'optionsframework');
$default_options = optionsframework_options();
foreach ((array) $default_options as $option) {
if (!isset($option['id'])) {
continue;
}
if (!isset($option['std'])) {
continue;
}
if (!isset($option['type'])) {
continue;
}
$onetone_default_options[$option['id']] = apply_filters('of_sanitize_' . $option['type'], $option['std'], $option);
}
// Gets the unique option id
//$option_name = $optionsframework_settings['id'];
$option_name = optionsframework_option_name();
if (get_option($option_name)) {
$options = get_option($option_name);
$options_saved = true;
} else {
$options = $onetone_default_options;
}
if (isset($options)) {
return $options;
} else {
return $default;
}
}
示例15: torch_of_get_options
function torch_of_get_options($default = FALSE)
{
// Gets the unique option id
$option_name = optionsframework_option_name();
if (get_option($option_name)) {
$options = get_option($option_name);
}
if (isset($options)) {
return $options;
} else {
return $default;
}
}