本文整理汇总了PHP中ot_options_id函数的典型用法代码示例。如果您正苦于以下问题:PHP ot_options_id函数的具体用法?PHP ot_options_id怎么用?PHP ot_options_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ot_options_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: thb_import_theme_options
function thb_import_theme_options()
{
$file = get_template_directory_uri() . "/inc/democontent/theme-options.txt";
$theme_options_txt = wp_remote_get($file);
$options = unserialize(ot_decode($theme_options_txt['body']));
/* get settings array */
$settings = get_option(ot_settings_id());
/* validate options */
foreach ($settings['settings'] as $setting) {
if (isset($options[$setting['id']])) {
$content = ot_stripslashes($options[$setting['id']]);
$options[$setting['id']] = ot_validate_setting($content, $setting['type'], $setting['id']);
}
}
/* update the option tree array */
update_option(ot_options_id(), $options);
$message = 'success';
}
开发者ID:adampdarcy,项目名称:paola,代码行数:18,代码来源:import.php
示例2: uncode_add_h5bp_htaccess
/**
* Add HTML5 Boilerplate's .htaccess via WordPress
*/
function uncode_add_h5bp_htaccess()
{
$options = get_option(ot_options_id());
$theme_opt = $options['_uncode_htaccess'];
$saved_opt = get_option("_uncode_htaccess_performace");
if ($theme_opt === 'on' && $saved_opt !== 'on' || $theme_opt === 'off' && $saved_opt === 'on') {
global $wp_rewrite;
$home_path = function_exists('get_home_path') ? get_home_path() : ABSPATH;
$htaccess_file = $home_path . '.htaccess';
$mod_rewrite_enabled = function_exists('got_mod_rewrite') ? got_mod_rewrite() : false;
if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() || is_writable($htaccess_file)) {
if ($mod_rewrite_enabled) {
$h5bp_rules = extract_from_markers($htaccess_file, 'HTML5 Boilerplate');
if ($h5bp_rules === array()) {
$filename = dirname(__FILE__) . '/h5bp-htaccess';
update_option("_uncode_htaccess_performace", $theme_opt);
return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', extract_from_markers($filename, 'HTML5 Boilerplate'));
} else {
if ($theme_opt === 'off') {
update_option("_uncode_htaccess_performace", $theme_opt);
return insert_with_markers($htaccess_file, 'HTML5 Boilerplate', '');
}
}
}
}
}
}
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:30,代码来源:performance.php
示例3: ot_get_option
function ot_get_option($option_id, $default = '')
{
/* get the saved options */
$options = get_option(ot_options_id());
/* look for the saved value */
if (isset($options[$option_id]) && '' != $options[$option_id]) {
return ot_wpml_filter($options, $option_id);
}
return $default;
}
开发者ID:ericsoncardosoweb,项目名称:agatha-wp,代码行数:10,代码来源:ot-functions.php
示例4: ot_type_export_data
/**
* Export Data option type.
*/
function ot_type_export_data()
{
/* format setting outer wrapper */
echo '<div class="format-setting type-textarea simple">';
/* get theme options data */
$data = get_option(ot_options_id());
$data = !empty($data) ? ot_encode(serialize($data)) : '';
echo '<div class="format-setting-inner">' . PHP_EOL;
echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>' . PHP_EOL;
echo '</div>' . PHP_EOL;
echo '</div>' . PHP_EOL;
}
开发者ID:mahdiyazdani,项目名称:vesta-lite-free-minimal-wordpress-blog-theme,代码行数:15,代码来源:inc-import-export-theme-options.php
示例5: get_option
function get_option($option_id, $default = false)
{
if (class_exists('OT_Loader') and function_exists('ot_options_id')) {
/* get the saved options */
$options = get_option(ot_options_id());
/* look for the saved value */
if (isset($options[$option_id]) && '' != $options[$option_id]) {
return $options[$option_id];
}
return $default;
}
return $default;
}
开发者ID:DaddyFool,项目名称:travelTest,代码行数:13,代码来源:class.shinetheme.php
示例6: ot_get_option
function ot_get_option($option_id, $default = '')
{
//temporary hack
if (!apply_filters('use_option_tree', true) && class_exists('HU_utils')) {
return HU_utils::$inst->hu_opt($option_id);
}
/* get the saved options */
$options = get_option(ot_options_id());
/* look for the saved value */
if (isset($options[$option_id]) && '' != $options[$option_id]) {
return ot_wpml_filter($options, $option_id);
}
return $default;
}
开发者ID:giorgioriccardi,项目名称:hueman,代码行数:14,代码来源:ot-functions.php
示例7: ot_type_export_data
function ot_type_export_data()
{
/* format setting outer wrapper */
echo '<div class="format-setting type-textarea simple has-desc">';
/* description */
echo '<div class="description">';
echo '<p>' . __('Export your Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>Import/export->Import</code> <strong>Theme Options</strong> textarea on another web site.', 'option-tree') . '</p>';
echo '</div>';
/* get theme options data */
$data = get_option(ot_options_id());
$data = !empty($data) ? ot_encode(serialize($data)) : '';
echo '<div class="format-setting-inner">';
echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>';
echo '</div>';
echo '</div>';
}
开发者ID:gigikir,项目名称:adebe,代码行数:16,代码来源:_core_ktz.php
示例8: get_option_tree
function get_option_tree($item_id = '', $options = '', $echo = false, $is_array = false, $offset = -1)
{
/* load saved options */
if (!$options) {
$options = get_option(ot_options_id());
}
/* no value return */
if (!isset($options[$item_id]) || empty($options[$item_id])) {
return;
}
/* set content value & strip slashes */
$content = option_tree_stripslashes($options[$item_id]);
/* is an array */
if ($is_array == true) {
/* saved as a comma seperated lists of values, explode into an array */
if (!is_array($content)) {
$content = explode(',', $content);
}
/* get an array value using an offset */
if (is_numeric($offset) && $offset >= 0) {
$content = $content[$offset];
} else {
if (!is_numeric($offset) && isset($content[$offset])) {
$content = $content[$offset];
}
}
/* not an array */
} else {
if ($is_array == false) {
/* saved as array, implode and return a comma seperated lists of values */
if (is_array($content)) {
$content = implode(',', $content);
}
/* This is fucked */
}
}
/* echo content */
if ($echo) {
echo $content;
}
return $content;
}
开发者ID:arawako,项目名称:hueman,代码行数:42,代码来源:ot-functions-deprecated.php
示例9: _get_custom_css
static function _get_custom_css()
{
$html = false;
/* grab a copy of the settings */
$settings = get_option(ot_settings_id());
$options = get_option(ot_options_id());
/* has settings */
if (isset($settings['settings'])) {
/* loop through sections and insert CSS when needed */
foreach ($settings['settings'] as $k => $setting) {
$allows = self::_options_allow_output();
if (!empty($allows) and in_array($setting['type'], $allows) and isset($setting['output']) and $setting['output']) {
if (isset($options[$setting['id']])) {
$html .= self::_get_output_item_css($setting, $options[$setting['id']]);
}
}
}
}
return $html;
}
开发者ID:DaddyFool,项目名称:travelTest,代码行数:20,代码来源:custom-css-output.php
示例10: ot_maybe_migrate_options
function ot_maybe_migrate_options()
{
// Filter the ID to migrate from
$options_id = apply_filters('ot_migrate_options_id', '');
// Attempt to migrate Theme Options
if (!empty($options_id) && get_option(ot_options_id()) === false && ot_options_id() !== $options_id) {
// Old options
$options = get_option($options_id);
// Migrate to new ID
update_option(ot_options_id(), $options);
}
}
开发者ID:ElectricEasel,项目名称:reflection,代码行数:12,代码来源:ot-functions-admin.php
示例11: compat_ot_import_from_files
function compat_ot_import_from_files()
{
/* file path & name without extention */
$ot_xml = '/option-tree/theme-options.xml';
$ot_data = '/option-tree/theme-options.txt';
$ot_layout = '/option-tree/layouts.txt';
/* XML file path - child theme first then parent */
if (is_readable(get_stylesheet_directory() . $ot_xml)) {
$xml_file = get_stylesheet_directory_uri() . $ot_xml;
} else {
if (is_readable(get_template_directory() . $ot_xml)) {
$xml_file = get_template_directory_uri() . $ot_xml;
}
}
/* Data file path - child theme first then parent */
if (is_readable(get_stylesheet_directory() . $ot_data)) {
$data_file = get_stylesheet_directory_uri() . $ot_data;
} else {
if (is_readable(get_template_directory() . $ot_data)) {
$data_file = get_template_directory_uri() . $ot_data;
}
}
/* Layout file path - child theme first then parent */
if (is_readable(get_stylesheet_directory() . $ot_layout)) {
$layout_file = get_stylesheet_directory_uri() . $ot_layout;
} else {
if (is_readable(get_template_directory() . $ot_layout)) {
$layout_file = get_template_directory_uri() . $ot_layout;
}
}
/* check for files */
$has_xml = isset($xml_file) ? true : false;
$has_data = isset($data_file) ? true : false;
$has_layout = isset($layout_file) ? true : false;
/* auto import XML file */
if ($has_xml == true && !get_option(ot_settings_id()) && class_exists('SimpleXMLElement')) {
$settings = ot_import_xml($xml_file);
if (isset($settings) && !empty($settings)) {
update_option(ot_settings_id(), $settings);
}
}
/* auto import Data file */
if ($has_data == true && !get_option(ot_options_id())) {
$get_data = wp_remote_get($data_file);
if (is_wp_error($get_data)) {
return false;
}
$rawdata = isset($get_data['body']) ? $get_data['body'] : '';
$options = unserialize(ot_decode($rawdata));
/* get settings array */
$settings = get_option(ot_settings_id());
/* has options */
if (is_array($options)) {
/* validate options */
if (is_array($settings)) {
foreach ($settings['settings'] as $setting) {
if (isset($options[$setting['id']])) {
$content = ot_stripslashes($options[$setting['id']]);
$options[$setting['id']] = ot_validate_setting($content, $setting['type'], $setting['id']);
}
}
}
/* update the option tree array */
update_option(ot_options_id(), $options);
}
}
/* auto import Layout file */
if ($has_layout == true && !get_option(ot_layouts_id())) {
$get_data = wp_remote_get($layout_file);
if (is_wp_error($get_data)) {
return false;
}
$rawdata = isset($get_data['body']) ? $get_data['body'] : '';
$layouts = unserialize(ot_decode($rawdata));
/* get settings array */
$settings = get_option(ot_settings_id());
/* has layouts */
if (is_array($layouts)) {
/* validate options */
if (is_array($settings)) {
foreach ($layouts as $key => $value) {
if ($key == 'active_layout') {
continue;
}
$options = unserialize(ot_decode($value));
foreach ($settings['settings'] as $setting) {
if (isset($options[$setting['id']])) {
$content = ot_stripslashes($options[$setting['id']]);
$options[$setting['id']] = ot_validate_setting($content, $setting['type'], $setting['id']);
}
}
$layouts[$key] = ot_encode(serialize($options));
}
}
/* update the option tree array */
if (isset($layouts['active_layout'])) {
update_option(ot_options_id(), unserialize(ot_decode($layouts[$layouts['active_layout']])));
}
/* update the option tree layouts array */
update_option(ot_layouts_id(), $layouts);
//.........这里部分代码省略.........
开发者ID:arawako,项目名称:hueman,代码行数:101,代码来源:ot-functions-compat.php
示例12: ot_options_id
<?php
/* =============================================================================
Include the Option-Tree Google Fonts Plugin
========================================================================== */
// load the ot-google-fonts plugin if the loader class is available
if (class_exists('OT_Loader')) {
global $ot_options;
$ot_options_id = ot_options_id();
$ot_options = get_option($ot_options_id);
// default fonts used in this theme, even though there are no google fonts
$default_theme_fonts = array('arial' => 'Arial, Helvetica, sans-serif', 'helvetica' => 'Helvetica, Arial, sans-serif', 'georgia' => 'Georgia, "Times New Roman", Times, serif', 'tahoma' => 'Tahoma, Geneva, sans-serif', 'times' => '"Times New Roman", Times, serif', 'trebuchet' => '"Trebuchet MS", Arial, Helvetica, sans-serif', 'verdana' => 'Verdana, Geneva, sans-serif');
defined('OT_FONT_DEFAULTS') or define('OT_FONT_DEFAULTS', serialize($default_theme_fonts));
defined('OT_FONT_API_KEY') or define('OT_FONT_API_KEY', 'AIzaSyBmzfJsfXkXP9PUvwfq53jA1l1YJNxBT4g');
// enter your own Google Font API key here
defined('OT_FONT_CACHE_INTERVAL') or define('OT_FONT_CACHE_INTERVAL', 0);
// Checking once a week for new Fonts. The time interval for the remote XML cache in the database (21600 seconds = 6 hours)
// get the OT-Google-Font plugin file
include_once get_template_directory() . '/option-tree-google-fonts/ot-google-fonts.php';
// get the google font array - build in ot-google-fonts.php
$google_font_array = ot_get_google_font(OT_FONT_API_KEY, OT_FONT_CACHE_INTERVAL);
// Now apply the fonts to the font dropdowns in theme options with the build in OptionTree hook
function ot_filter_recognized_font_families($array, $field_id)
{
global $google_font_array;
// loop through the cached google font array if available and append to default fonts
$font_array = array();
if ($google_font_array) {
foreach ($google_font_array as $index => $value) {
$font_array[$index] = $value['family'];
}
开发者ID:Brad--,项目名称:exigocorp,代码行数:31,代码来源:functions.php
示例13: set_demo_theme_options
public function set_demo_theme_options($file)
{
$response = wp_remote_get(esc_url_raw($file));
/* Will result in $api_response being an array of data,
parsed from the JSON response of the API listed above */
$data = wp_remote_retrieve_body($response);
// Have valid data?
// If no data or could not decode
if (empty($data)) {
wp_die(esc_html__('Theme options import data could not be read. Please try a different file.', 'radium'), '', array('back_link' => true));
}
/* textarea value */
$options = unserialize(base64_decode($data));
/* get settings array */
$settings = get_option(ot_settings_id());
/* has options */
if (is_array($options)) {
/* validate options */
if (is_array($settings)) {
foreach ($settings['settings'] as $setting) {
if (isset($options[$setting['id']])) {
$content = ot_stripslashes($options[$setting['id']]);
$options[$setting['id']] = ot_validate_setting($content, $setting['type'], $setting['id']);
}
}
}
/* update the option tree array */
update_option(ot_options_id(), $options);
/* execute the action hook and pass the theme options to it */
do_action('ot_after_theme_options_save', $options);
}
}
开发者ID:b0123498765,项目名称:fithealthyandwealthy,代码行数:32,代码来源:radium-importer.php
示例14: ot_split_shared_term
/**
* Update terms when a term gets split.
*
* @param int $term_id ID of the formerly shared term.
* @param int $new_term_id ID of the new term created for the $term_taxonomy_id.
* @param int $term_taxonomy_id ID for the term_taxonomy row affected by the split.
* @param string $taxonomy Taxonomy for the split term.
* @return void
*
* @access public
* @since 2.5.4
*/
function ot_split_shared_term($term_id, $new_term_id, $term_taxonomy_id, $taxonomy)
{
// Process the Theme Options
$settings = _ot_settings_potential_shared_terms();
$old_options = get_option(ot_options_id(), array());
$new_options = $old_options;
// Process the saved settings
if (!empty($settings) && !empty($old_options)) {
// Loop over the Theme Options
foreach ($settings as $option) {
if (!is_array($option['taxonomy'])) {
$option['taxonomy'] = explode(',', $option['taxonomy']);
}
if (!in_array($taxonomy, $option['taxonomy'])) {
continue;
}
// The option ID was found
if (array_key_exists($option['id'], $old_options) || isset($option['parent']) && array_key_exists($option['parent'], $old_options)) {
// This is a list item, we have to go deeper
if (isset($option['parent'])) {
// Loop over the array
foreach ($option['value'] as $key => $value) {
// The value is an array of IDs
if (is_array($value)) {
// Loop over the sub array
foreach ($value as $sub_key => $sub_value) {
if ($sub_value == $term_id) {
unset($new_options[$option['parent']][$key][$option['id']][$sub_key]);
$new_options[$option['parent']][$key][$option['id']][$new_term_id] = $new_term_id;
}
}
} else {
if ($value == $term_id) {
unset($new_options[$option['parent']][$key][$option['id']]);
$new_options[$option['parent']][$key][$option['id']] = $new_term_id;
}
}
}
} else {
// The value is an array of IDs
if (is_array($option['value'])) {
// Loop over the array
foreach ($option['value'] as $key => $value) {
// It's a single value, just replace it
if ($value == $term_id) {
unset($new_options[$option['id']][$key]);
$new_options[$option['id']][$new_term_id] = $new_term_id;
}
}
// It's a single value, just replace it
} else {
if ($option['value'] == $term_id) {
$new_options[$option['id']] = $new_term_id;
}
}
}
}
}
}
// Options need to be updated
if ($old_options !== $new_options) {
update_option(ot_options_id(), $new_options);
}
// Process the Meta Boxes
$meta_settings = _ot_meta_box_potential_shared_terms();
$option_types = array('category-checkbox', 'category-select', 'tag-checkbox', 'tag-select', 'taxonomy-checkbox', 'taxonomy-select');
if (!empty($meta_settings)) {
$old_meta = array();
foreach ($meta_settings as $option) {
if (!is_array($option['taxonomy'])) {
$option['taxonomy'] = explode(',', $option['taxonomy']);
}
if (!in_array($taxonomy, $option['taxonomy'])) {
continue;
}
if (isset($option['children'])) {
$post_ids = get_posts(array('fields' => 'ids', 'meta_key' => $option['id']));
if ($post_ids) {
foreach ($post_ids as $post_id) {
// Get the meta
$old_meta = get_post_meta($post_id, $option['id'], true);
$new_meta = $old_meta;
// Has a saved value
if (!empty($old_meta) && is_array($old_meta)) {
// Loop over the array
foreach ($old_meta as $key => $value) {
foreach ($value as $sub_key => $sub_value) {
if (in_array($sub_key, $option['children'])) {
//.........这里部分代码省略.........
开发者ID:skip405,项目名称:option-tree,代码行数:101,代码来源:ot-functions-admin.php
示例15: __construct
/**
* Constructor. Hooks all interactions to initialize the class.
*
* @since 0.0.2
*/
public function __construct()
{
self::$instance = $this;
$this->demo_files_path = apply_filters('radium_theme_importer_demo_files_path', $this->demo_files_path);
$this->theme_options_file = apply_filters('radium_theme_importer_theme_options_file', $this->demo_files_path . $this->theme_options_file_name);
$this->widgets = apply_filters('radium_theme_importer_widgets_file', $this->demo_files_path . $this->widgets_file_name);
$this->content_demo = apply_filters('radium_theme_importer_content_demo_file', $this->demo_files_path . $this->content_demo_file_name);
$this->imported_demos = get_option('radium_imported_demo');
if ($this->theme_options_framework == 'optiontree') {
$this->theme_option_name = ot_options_id();
}
if ($this->add_admin_menu) {
add_action('admin_menu', array($this, 'add_admin'));
}
add_filter('add_post_metadata', array($this, 'check_previous_meta'), 10, 5);
add_action('radium_import_end', array($this, 'after_wp_importer'));
}
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:22,代码来源:radium-importer.php
示例16: ot_insert_css_with_markers
function ot_insert_css_with_markers($field_id = '', $insertion = '', $meta = false)
{
/* missing $field_id or $insertion exit early */
if ('' == $field_id || '' == $insertion) {
return;
}
/* path to the dynamic.css file */
$filepath = get_stylesheet_directory() . '/dynamic.css';
/* allow filter on path */
$filepath = apply_filters('css_option_file_path', $filepath, $field_id);
/* grab a copy of the paths array */
$ot_css_file_paths = get_option('ot_css_file_paths', array());
/* set the path for this field */
$ot_css_file_paths[$field_id] = $filepath;
/* update the paths */
update_option('ot_css_file_paths', $ot_css_file_paths);
/* insert CSS into file */
if (file_exists($filepath)) {
$insertion = ot_normalize_css($insertion);
$regex = "/{{([a-zA-Z0-9\\_\\-\\#\\|\\=]+)}}/";
$marker = $field_id;
/* Match custom CSS */
preg_match_all($regex, $insertion, $matches);
/* Loop through CSS */
foreach ($matches[0] as $option) {
$value = '';
$option_id = str_replace(array('{{', '}}'), '', $option);
$option_array = explode('|', $option_id);
/* get the array value */
if ($meta) {
global $post;
$value = get_post_meta($post->ID, $option_array[0], true);
} else {
$options = get_option(ot_options_id());
if (isset($options[$option_array[0]])) {
$value = $options[$option_array[0]];
}
}
if (is_array($value)) {
if (!isset($option_array[1])) {
/* Measurement */
if (isset($value[0]) && isset($value[1])) {
/* set $value with measurement properties */
$value = $value[0] . $value[1];
/* typography */
} else {
if (ot_array_keys_exists($value, array('font-color', 'font-family', 'font-size', 'font-style', 'font-variant', 'font-weight', 'letter-spacing', 'line-height', 'text-decoration', 'text-transform'))) {
$font = array();
if (!empty($value['font-color'])) {
$font[] = "color: " . $value['font-color'] . ";";
}
if (!empty($value['font-family'])) {
foreach (ot_recognized_font_families($marker) as $key => $v) {
if ($key == $value['font-family']) {
$font[] = "font-family: " . $v . ";";
}
}
}
if (!empty($value['font-size'])) {
$font[] = "font-size: " . $value['font-size'] . ";";
}
if (!empty($value['font-style'])) {
$font[] = "font-style: " . $value['font-style'] . ";";
}
if (!empty($value['font-variant'])) {
$font[] = "font-variant: " . $value['font-variant'] . ";";
}
if (!empty($value['font-weight'])) {
$font[] = "font-weight: " . $value['font-weight'] . ";";
}
if (!empty($value['letter-spacing'])) {
$font[] = "letter-spacing: " . $value['letter-spacing'] . ";";
}
if (!empty($value['line-height'])) {
$font[] = "line-height: " . $value['line-height'] . ";";
}
if (!empty($value['text-decoration'])) {
$font[] = "text-decoration: " . $value['text-decoration'] . ";";
}
if (!empty($value['text-transform'])) {
$font[] = "text-transform: " . $value['text-transform'] . ";";
}
/* set $value with font properties or empty string */
$value = !empty($font) ? implode("\n", $font) : '';
/* background */
} else {
if (ot_array_keys_exists($value, array('background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position', 'background-size'))) {
$bg = array();
if (!empty($value['background-color'])) {
$bg[] = $value['background-color'];
}
if (!empty($value['background-image'])) {
$bg[] = 'url("' . $value['background-image'] . '")';
}
if (!empty($value['background-repeat'])) {
$bg[] = $value['background-repeat'];
}
if (!empty($value['background-attachment'])) {
$bg[] = $value['background-attachment'];
}
//.........这里部分代码省略.........
开发者ID:sekane81,项目名称:ratoninquietoweb,代码行数:101,代码来源:ot-functions-admin.php
示例17: rj_taxonomy_ot_save_settings
function rj_taxonomy_ot_save_settings()
{
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'rj-ot-taxonomy_metabox') {
rj_ot_admin_scriptss();
rj_ot_admin_styless();
wp_enqueue_script('rj_ot_taxonomy_script', plugin_dir_url(dirname(__FILE__)) . 'js/taxonomy-ot-metabox-ui-settings.js');
}
/* check and verify import settings nonce */
if (isset($_POST['option_tree_settings_nonce']) && wp_verify_nonce($_POST['option_tree_settings_nonce'], 'rj_option_tree_settings_form') && isset($_GET['page']) && $_GET['page'] == 'rj-ot-taxonomy_metabox') {
/* settings value */
$settings = isset($_POST[ot_settings_id()]) ? $_POST[ot_settings_id()] : '';
/* validate sections */
if (isset($settings['sections'])) {
/* fix numeric keys since drag & drop will change them */
$settings['sections'] = array_values($settings['sections']);
/* loop through sections */
foreach ($settings['sections'] as $k => $section) {
/* remove from array if missing values */
if (!isset($section['title']) && !isset($section['id']) || '' == $section['title'] && '' == $section['id']) {
unset($settings['sections'][$k]);
} else {
/* validate label */
if ('' != $section['title']) {
$settings['sections'][$k]['title'] = wp_kses_post($section['title']);
}
/* missing title set to unfiltered ID */
if (!isset($section['title']) || '' == $section['title']) {
$settings['sections'][$k]['title'] = wp_kses_post($section['id']);
/* missing ID set to title */
} else {
if (!isset($section['id']) || '' == $section['id']) {
$section['id'] = wp_kses_post($section['title']);
}
}
/* sanitize ID once everything has been checked first */
$settings['sections'][$k]['id'] = ot_sanitize_option_id(wp_kses_post($section['id']));
}
}
$settings['sections'] = ot_stripslashes($settings['sections']);
}
/* validate settings by looping over array as many times as it takes */
if (isset($settings['settings'])) {
$settings['settings'] = ot_validate_settings_array($settings['settings']);
}
/* validate contextual_help */
if (isset($settings['contextual_help']['content'])) {
/* fix numeric keys since drag & drop will change them */
$settings['contextual_help']['content'] = array_values($settings['contextual_help']['content']);
/* loop through content */
foreach ($settings['contextual_help']['content'] as $k => $content) {
/* remove from array if missing values */
if (!isset($content['title']) && !isset($content['id']) || '' == $content['title'] && '' == $content['id']) {
unset($settings['contextual_help']['content'][$k]);
} else {
/* validate label */
if ('' != $content['title']) {
$settings['contextual_help']['content'][$k]['title'] = wp_kses_post($content['title']);
}
/* missing title set to unfiltered ID */
if (!isset($content['title']) || '' == $content['title']) {
$settings['contextual_help']['content'][$k]['title'] = wp_kses_post($content['id']);
/* missing ID set to title */
} else {
if (!isset($content['id']) || '' == $content['id']) {
$content['id'] = wp_kses_post($content['title']);
}
}
/* sanitize ID once everything has been checked first */
$settings['contextual_help']['content'][$k]['id'] = ot_sanitize_option_id(wp_kses_post($content['id']));
}
/* validate textarea description */
if (isset($content['content'])) {
$settings['contextual_help']['content'][$k]['content'] = wp_kses_post($content['content']);
}
}
}
/* validate contextual_help sidebar */
if (isset($settings['contextual_help']['sidebar'])) {
$settings['contextual_help']['sidebar'] = wp_kses_post($settings['contextual_help']['sidebar']);
}
$settings['contextual_help'] = ot_stripslashes($settings['contextual_help']);
/* default message */
$message = 'failed';
/* is array: save & show success message */
if (is_array($settings)) {
/* WPML unregister ID's that have been removed */
if (function_exists('icl_unregister_string')) {
$current = get_option(ot_settings_id());
$options = get_option(ot_options_id());
if (isset($current['settings'])) {
/* Empty ID array */
$new_ids = array();
/* Build the WPML IDs array */
foreach ($settings['settings'] as $setting) {
if ($setting['id']) {
$new_ids[] = $setting['id'];
}
}
/* Remove missing IDs from WPML */
foreach ($current['settings'] as $current_setting) {
//.........这里部分代码省略.........
开发者ID:rajilesh,项目名称:optiontree-metabox-ui,代码行数:101,代码来源:taxonomy_meta_box.php
示例18: st_check_service_available
function st_check_service_available($post_type = false)
{
if ($post_type) {
if (function_exists('ot_options_id')) {
$option = get_option(ot_options_id());
$disable_list = isset($option['list_disabled_feature']) ? $option['list_disabled_feature'] : array();
if (!empty($disable_list)) {
foreach ($disable_list as $key) {
if ($key == $post_type) {
return false;
}
}
}
}
return true;
}
return false;
}
开发者ID:DaddyFool,项目名称:travelTest,代码行数:18,代码来源:st-hook-functions.php
示例19: set_demo_theme_options
public function set_demo_theme_options($file)
{
// Does the File exist?
if (file_exists($file)) {
// Get file contents and decode
$data = file_get_contents($file);
if ($this->theme_options_framework == 'radium') {
//radium framework
$data = unserialize(trim($data, '###'));
} elseif ($this->theme_options_framework == 'optiontree') {
//option tree import
$data = $this->optiontree_decode($data);
update_option(ot_options_id(), $data);
$this->flag_as_imported['options'] = true;
} else {
//other frameworks
//$data = json_decode( $data, true );
$data = maybe_unserialize($data);
}
// Only if there is data
if (!empty($data) || is_array($data)) {
// Hook before import
$data = apply_filters('radium_theme_import_theme_options', $data);
update_option($this->theme_option_name, $data);
$this->flag_as_imported['options'] = true;
}
do_action('radium_importer_after_theme_options_import', $this->active_import, $this->demo_files_path);
} else {
wp_die(__('Theme options Import file could not be found. Please try again.', 'radium'), '', array('back_link' => true));
}
}
开发者ID:phuthuytinhoc,项目名称:Demo1,代码行数:31,代码来源:radium-importer.php
示例20: demo_parse_css
/**
* Helper function to parse and return properly formated CSS.
*
* @param string $field_id ID of the option to retrieve.
* @param string $insertion The string to parse into CSS.
* @param boolean $meta Whether the ID is of a meta option or regular theme option.
* @return string
*
* @since 2.3.0
*/
function demo_parse_css($field_id = '', $insertion = '', $meta = false)
{
/* missing $field_id or $insertion exit early */
if ('' == $field_id || '' == $insertio
|
请发表评论