当前位置: 首页>>代码示例>>PHP>>正文


PHP ot_options_id函数代码示例

本文整理汇总了PHP中ot_options_id函数的典型用法代码示例。如果您正苦于以下问题:PHP ot_options_id函数的具体用法?PHP ot_options_id怎么用?PHP ot_options_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ot_options_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的ot_options_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。