當前位置: 首頁>>代碼示例>>PHP>>正文


PHP of_get_options函數代碼示例

本文整理匯總了PHP中of_get_options函數的典型用法代碼示例。如果您正苦於以下問題:PHP of_get_options函數的具體用法?PHP of_get_options怎麽用?PHP of_get_options使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了of_get_options函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: check_for_update

 function check_for_update($transient)
 {
     global $wp_filesystem;
     $smof_data = of_get_options();
     if (empty($transient->checked)) {
         return $transient;
     }
     $request_args = array('id' => $this->theme_id, 'slug' => $this->theme_slug, 'version' => $transient->checked[$this->theme_slug]);
     if ($this->api_url == 'http://updates.theme-fusion.com/avada-theme.php') {
         $request_args['item_code'] = '2833226';
         $request_args['envato_username'] = $smof_data['tf_username'];
         $request_args['api_key'] = $smof_data['tf_api'];
     }
     $filename = trailingslashit(get_template_directory()) . 'log.txt';
     $request_string = $this->prepare_request('theme_update', $request_args);
     $raw_response = wp_remote_post($this->api_url, $request_string);
     $response = null;
     if (!is_wp_error($raw_response) && $raw_response['response']['code'] == 200) {
         $response = json_decode($raw_response['body'], true);
     }
     if (!empty($response)) {
         // Feed the update data into WP updater
         $transient->response[$this->theme_slug] = $response;
     }
     /*$handle = fopen($filename, 'a');
       fwrite($handle, json_encode($request_string));
       fwrite($handle, json_encode($raw_response));*/
     return $transient;
 }
開發者ID:IDOAgency,項目名稱:PAHClinic,代碼行數:29,代碼來源:class-updater.php

示例2: of_option_setup

/**
 * Add default options upon activation else DB does not exist
 *
 * DEPRECATED, Class_options_machine now does this on load to ensure all values are set
 *
 * @since 1.0.0
 */
function of_option_setup()
{
    global $of_options, $options_machine;
    $options_machine = new bresponZive_themepacific_Options_Machine($of_options);
    if (!of_get_options()) {
        of_save_options($options_machine->Defaults);
    }
}
開發者ID:KirBozhko,項目名稱:apk4fun.loc,代碼行數:15,代碼來源:functions.admin.php

示例3: of_option_setup

/**
 * Add default options upon activation else DB does not exist
 *
 * @since 1.0.0
 */
function of_option_setup()
{
    global $of_options, $options_machine;
    $options_machine = new Options_Machine($of_options);
    if (!of_get_options()) {
        of_save_options($options_machine->Defaults);
    }
}
開發者ID:jolay,項目名稱:maga2.0,代碼行數:13,代碼來源:functions.admin.php

示例4: cupid_generate_less

/**
 * Created by PhpStorm.
 * User: duonglh
 * Date: 8/23/14
 * Time: 3:01 PM
 */
function cupid_generate_less()
{
    require_once 'Less.php';
    $cupid_data = of_get_options();
    try {
        $primary_color = $cupid_data['primary-color'];
        $secondary_color = $cupid_data['secondary-color'];
        $button_color = $cupid_data['button-color'];
        $bullet_color = $cupid_data['bullet-color'];
        $icon_box_color = $cupid_data['icon-box-color'];
        $site_logo_url = $cupid_data['site-logo'];
        $site_logo_white_url = $cupid_data['site-logo-white'];
        $site_logo_url = str_replace(THEME_URL, '', $site_logo_url);
        $site_logo_white_url = str_replace(THEME_URL, '', $site_logo_white_url);
        $css = '@primary_color:' . $primary_color . ';';
        $css .= '@secondary_color:' . $secondary_color . ';';
        $css .= '@button_color:' . $button_color . ';';
        $css .= '@bullet_color:' . $bullet_color . ';';
        $css .= '@icon_box_color:' . $icon_box_color . ';';
        $css .= "@logo_url : '" . $site_logo_url . "';@logo_white_url : '" . $site_logo_white_url . "';";
        $css .= '@theme_url:"' . THEME_URL . '";';
        $style = $css;
        require_once ABSPATH . 'wp-admin/includes/file.php';
        require_once THEME_DIR . "lib/inc-generate-less/custom-css.php";
        $custom_css = cupid_custom_css();
        WP_Filesystem();
        global $wp_filesystem;
        $options = array('compress' => true);
        $parser = new Less_Parser($options);
        $parser->parse($css);
        $parser->parseFile(THEME_DIR . 'assets/css/less/style.less');
        $parser->parse($custom_css);
        $css = $parser->getCss();
        if (!$wp_filesystem->put_contents(THEME_DIR . "style.min.css", $css, FS_CHMOD_FILE)) {
            echo __('Could not save file', 'cupid');
            return '0';
        }
        /*$theme_info = $wp_filesystem->get_contents( THEME_DIR . "theme-info.txt" );
                $parser = new Less_Parser();
                $parser->parse($style);
                $parser->parseFile(THEME_DIR . 'assets/css/less/style.less',THEME_URL);
                $style = $parser->getCss();
        		$parser->parse($custom_css);
                $style = $theme_info . "\n" . $style;
                $style = str_replace("\r\n","\n", $style);
                $wp_filesystem->put_contents( THEME_DIR.   "style.css", $style, FS_CHMOD_FILE);*/
        return '1';
    } catch (Exception $e) {
        echo 'Caught exception: ', $e->getMessage(), "\n";
        return '0';
    }
}
開發者ID:adwleg,項目名稱:site,代碼行數:58,代碼來源:generate-less.php

示例5: cupid_setup_options

function cupid_setup_options()
{
    // reset Theme options
    global $of_options, $options_machine;
    $smof_data = of_get_options();
    if (!isset($smof_data) || !array_key_exists('smof_init', $smof_data) || empty($smof_data['smof_init'])) {
        $options_machine = new Options_Machine($of_options);
        of_save_options($options_machine->Defaults);
    }
    // generate less to css
    require get_template_directory() . '/lib/inc-generate-less/generate-less.php';
    cupid_generate_less();
}
開發者ID:adwleg,項目名稱:site,代碼行數:13,代碼來源:theme-setup.php

示例6: of_option_setup

/**
 * Add default options upon activation else DB does not exist
 *
 * @since 1.0.0
 */
function of_option_setup()
{
    global $of_options, $options_machine, $smof_data;
    do_action('of_option_setup_before', array('of_options' => $of_options, 'options_machine' => $options_machine, 'smof_data' => $smof_data));
    $options_machine = new Options_Machine($of_options);
    if (empty($smof_data) || !isset($smof_data['smof_init'])) {
        // Let's set the values if the theme's already been active
        of_save_options($options_machine->Defaults);
        of_save_options(date('r'), 'smof_init');
        $smof_data = of_get_options();
        $data = $smof_data;
    }
    do_action('of_option_setup_after', array('of_options' => $of_options, 'options_machine' => $options_machine, 'smof_data' => $smof_data));
}
開發者ID:jin-2,項目名稱:wp-content,代碼行數:19,代碼來源:functions.admin.php

示例7: of_option_setup

/**
 * Add default options upon activation else DB does not exist
 *
 * @since 1.0.0
 */
function of_option_setup()
{
    global $of_options, $options_machine, $sitepress;
    $options_machine = new Options_Machine($of_options);
    $defaults = $options_machine->Defaults;
    if (ishyoboy_wpml_plugin_active()) {
        $languages = icl_get_languages('skip_missing=0&orderby=code');
        $return = '';
        if (!empty($languages)) {
            $smof_wpml_default_lng = '';
            if (is_object($sitepress)) {
                $smof_wpml_default_lng = $sitepress->get_default_language();
            }
            foreach ($languages as $l) {
                if ($smof_wpml_default_lng == $l['language_code']) {
                    // DEFAULT LANGUAGE
                    if (!of_get_options()) {
                        of_save_options($defaults);
                        ishyoboy_generate_options_css($defaults, GENERATEDCSS_BASE, '');
                    }
                } else {
                    // OTHER LANGUAGES
                    $options = OPTIONS_BASE . '_' . $l['language_code'];
                    if (!of_get_options($options)) {
                        of_save_options($defaults, $options);
                        ishyoboy_generate_options_css($defaults, GENERATEDCSS_BASE . '_' . $l['language_code'], '_' . $l['language_code']);
                    }
                }
            }
        } else {
            // DEFAULT LANGUAGE
            if (!of_get_options()) {
                of_save_options($defaults);
                ishyoboy_generate_options_css($defaults);
            }
        }
    } else {
        // JUST ONE LANGUAGE VERSION
        if (!of_get_options()) {
            of_save_options($defaults);
            ishyoboy_generate_options_css($defaults);
        }
    }
}
開發者ID:baden03,項目名稱:access48,代碼行數:49,代碼來源:functions.admin.php

示例8: of_options

 function of_options()
 {
     $data = of_get_options();
     global $ts_all_fonts;
     if (defined('TS_ALL_FONTS')) {
         $ts_all_fonts = TS_ALL_FONTS;
     } elseif (function_exists('ts_essentials_all_fonts')) {
         $ts_all_fonts = ts_essentials_all_fonts(true);
     } elseif (function_exists('ts_all_fonts')) {
         $ts_all_fonts = ts_all_fonts(true);
     } else {
         $ts_all_fonts = array();
     }
     //Access the WordPress Categories via an Array
     $of_categories = array();
     $of_categories_obj = get_categories('hide_empty=0');
     foreach ($of_categories_obj as $of_cat) {
         $of_categories[$of_cat->cat_ID] = $of_cat->cat_name;
     }
     $_of_categories = $of_categories;
     $categories_tmp = array_unshift($of_categories, __("Select a category:", 'ThemeStockyard'));
     //Access the WordPress Pages via an Array
     $of_pages = array();
     $of_pages_obj = get_pages('sort_column=post_parent,menu_order');
     foreach ($of_pages_obj as $of_page) {
         $of_pages[$of_page->ID] = $of_page->post_name;
     }
     $of_pages_tmp = array_unshift($of_pages, __("Select a page:", 'ThemeStockyard'));
     //Testing
     $of_options_select = array("one", "two", "three", "four", "five");
     $of_options_radio = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
     //Sample Homepage blocks for the layout manager (sorter)
     $of_options_homepage_blocks = array("disabled" => array("placebo" => "placebo", "block_one" => "Block One", "block_two" => "Block Two", "block_three" => "Block Three"), "enabled" => array("placebo" => "placebo", "block_four" => "Block Four"));
     //Background Images Reader
     $bg_images_path = get_stylesheet_directory() . '/images/bg/';
     // change this to where you store your bg images
     $bg_images_url = get_template_directory_uri() . '/images/bg/';
     // change this to where you store your bg images
     $bg_images = array();
     if (is_dir($bg_images_path)) {
         if ($bg_images_dir = opendir($bg_images_path)) {
             while (($bg_images_file = readdir($bg_images_dir)) !== false) {
                 if (stristr($bg_images_file, ".png") !== false || stristr($bg_images_file, ".jpg") !== false) {
                     $bg_images[] = $bg_images_url . $bg_images_file;
                 }
             }
         }
     }
     /*-----------------------------------------------------------------------------------*/
     /* TO DO: Add options/functions that use these */
     /*-----------------------------------------------------------------------------------*/
     //More Options
     $uploads_arr = wp_upload_dir();
     $all_uploads_path = $uploads_arr['path'];
     $all_uploads = get_option('of_uploads');
     $other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
     $body_attachment = array("scroll", "fixed");
     $body_repeat = array("no-repeat", "repeat-x", "repeat-y", "repeat");
     $body_pos = array("top left", "top center", "top right", "center left", "center center", "center right", "bottom left", "bottom center", "bottom right");
     $css_shadow_entries = array('min' => '-10', 'max' => '10');
     // Image Alignment radio box
     $of_options_thumb_align = array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center");
     // Image Links to Options
     $of_options_image_link_to = array("image" => "The Image", "post" => "The Post");
     /*-----------------------------------------------------------------------------------*/
     /* The Options Array */
     /*-----------------------------------------------------------------------------------*/
     // Set the Options Array
     global $of_options;
     $of_options = array();
     /***
        General Settings
        ***/
     $of_options[] = array("name" => __("General Settings", 'ThemeStockyard'), "type" => "heading");
     $of_options[] = array("name" => __('Enable "Smooth Page Scrolling"', 'ThemeStockyard'), "desc" => __("Makes scrolling a bit smoother.<br/><strong>Default:</strong> Off", 'ThemeStockyard'), "id" => "smooth_page_scroll", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => __("Enable Inline CSS", 'ThemeStockyard'), "desc" => __("Only enable this setting as a last resort if styling options (typography, colors, backgrounds, etc) are not updating correctly.", 'ThemeStockyard'), "id" => "enable_inline_css", "std" => 0, "type" => "switch");
     $of_options[] = array("name" => __("Custom CSS", 'ThemeStockyard'), "desc" => __("Paste any custom CSS you have right here.", 'ThemeStockyard'), "id" => "custom_css", "std" => "", "type" => "textarea");
     $of_options[] = array("name" => __("Custom Favicon", 'ThemeStockyard'), "desc" => __("Upload a 16px x 16px Png/Gif image that will represent your website's favicon.", 'ThemeStockyard'), "id" => "custom_favicon", "std" => "", "type" => "upload");
     $of_options[] = array("name" => __("Apple iPhone Icon Upload", 'ThemeStockyard'), "desc" => __("Icon for Apple iPhone (57px x 57px)", 'ThemeStockyard'), "id" => "iphone_icon", "std" => "", "type" => "upload");
     $of_options[] = array("name" => __("Apple iPhone Retina Icon Upload", 'ThemeStockyard'), "desc" => __("Icon for Apple iPhone Retina Version (114px x 114px)", 'ThemeStockyard'), "id" => "iphone_icon_retina", "std" => "", "type" => "upload");
     $of_options[] = array("name" => __("Apple iPad Icon Upload", 'ThemeStockyard'), "desc" => __("Icon for Apple iPhone (72px x 72px)", 'ThemeStockyard'), "id" => "ipad_icon", "std" => "", "type" => "upload");
     $of_options[] = array("name" => __("Apple iPad Retina Icon Upload", 'ThemeStockyard'), "desc" => __("Icon for Apple iPad Retina Version (144px x 144px)", 'ThemeStockyard'), "id" => "ipad_icon_retina", "std" => "", "type" => "upload");
     $of_options[] = array("name" => __("Custom RSS URL", 'ThemeStockyard'), "desc" => __("Paste your FeedBurner (or other) URL here.", 'ThemeStockyard'), "id" => "rss_url", "std" => "", "type" => "text");
     // Social Links
     $of_options[] = array("name" => __("Social Links", 'ThemeStockyard'), "type" => "heading");
     $of_options[] = array("name" => __("Social Links", 'ThemeStockyard'), "desc" => __('These social links/icons are used in the header and as the defaults for the <strong>(TS) Social Links</strong> widget.', 'ThemeStockyard'), "id" => "social_links_options_info", "std" => '', "icon" => true, "type" => "info");
     $of_options[] = array("name" => '', "desc" => __("<strong>Facebook</strong>", 'ThemeStockyard'), "id" => "social_url_facebook", "std" => '#', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Twitter</strong>", 'ThemeStockyard'), "id" => "social_url_twitter", "std" => '#', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Pinterest</strong>", 'ThemeStockyard'), "id" => "social_url_pinterest", "std" => '#', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Google+</strong>", 'ThemeStockyard'), "id" => "social_url_google_plus", "std" => '#', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Github</strong>", 'ThemeStockyard'), "id" => "social_url_github", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>LinkedIn</strong>", 'ThemeStockyard'), "id" => "social_url_linkedin", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Instagram</strong>", 'ThemeStockyard'), "id" => "social_url_instagram", "std" => '#', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Flickr</strong>", 'ThemeStockyard'), "id" => "social_url_flickr", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Youtube</strong>", 'ThemeStockyard'), "id" => "social_url_youtube", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Vimeo</strong>", 'ThemeStockyard'), "id" => "social_url_vimeo", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>VK</strong>", 'ThemeStockyard'), "id" => "social_url_vk", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Tumblr</strong>", 'ThemeStockyard'), "id" => "social_url_tumblr", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Behance</strong>", 'ThemeStockyard'), "id" => "social_url_behance", "std" => '', "type" => "text");
     $of_options[] = array("name" => '', "desc" => __("<strong>Dribbble</strong>", 'ThemeStockyard'), "id" => "social_url_dribbble", "std" => '', "type" => "text");
//.........這裏部分代碼省略.........
開發者ID:sekane81,項目名稱:ratoninquietoweb,代碼行數:101,代碼來源:functions.options.php

示例9: wd_of_option_setup

function wd_of_option_setup()
{
    global $of_options, $options_machine;
    $wd_data = of_get_options();
    $options_machine = new Options_Machine($of_options);
    $wd_data = wd_array_atts($options_machine->Defaults, $wd_data);
    wd_of_save_options($wd_data);
}
開發者ID:mynein,項目名稱:myne,代碼行數:8,代碼來源:functions.admin.php

示例10: set_theme_mod

        }
        set_theme_mod($key, $data);
    } else {
        // Update all values in $data
        foreach ($data as $k => $v) {
            if (!isset($smof_data[$k]) || $smof_data[$k] != $v) {
                // Only write to the DB when we need to
                set_theme_mod($k, $v);
            } else {
                if (is_array($v)) {
                    foreach ($v as $key => $val) {
                        if ($key != $k && $v[$key] == $val) {
                            set_theme_mod($k, $v);
                            break;
                        }
                    }
                }
            }
        }
    }
    do_action('of_save_options_after', array('key' => $key, 'data' => $data));
}
/**
 * For use in themes
 *
 * @since forever
 */
$data = of_get_options();
if (!isset($smof_details)) {
    $smof_details = array();
}
開發者ID:gurpreet-grazitti,項目名稱:Demisto,代碼行數:31,代碼來源:functions.admin.php

示例11: optionsframework_slider_function

 /**
  * Drag and drop slides manager
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return string
  */
 public static function optionsframework_slider_function($id, $std, $oldorder, $order, $int)
 {
     $smof_data = of_get_options();
     $smof_data = of_get_options();
     $slider = '';
     $slide = array();
     $slide = $smof_data[$id];
     if (isset($slide[$oldorder])) {
         $val = $slide[$oldorder];
     } else {
         $val = $std;
     }
     //initialize all vars
     $slidevars = array('title', 'url', 'link', 'description');
     foreach ($slidevars as $slidevar) {
         if (!isset($val[$slidevar])) {
             $val[$slidevar] = '';
         }
     }
     //begin slider interface
     if (!empty($val['title'])) {
         $slider .= '<li><div class="slide_header"><strong>' . stripslashes($val['title']) . '</strong>';
     } else {
         $slider .= '<li><div class="slide_header"><strong>Slide ' . $order . '</strong>';
     }
     $slider .= '<input type="hidden" class="slide of-input order" name="' . $id . '[' . $order . '][order]" id="' . $id . '_' . $order . '_slide_order" value="' . $order . '" />';
     $slider .= '<a class="slide_edit_button" href="#">Edit</a></div>';
     $slider .= '<div class="slide_body">';
     $slider .= '<label>Title</label>';
     $slider .= '<input class="slide of-input of-slider-title" name="' . $id . '[' . $order . '][title]" id="' . $id . '_' . $order . '_slide_title" value="' . stripslashes($val['title']) . '" />';
     $slider .= '<label>Image URL</label>';
     $slider .= '<input class="slide of-input" name="' . $id . '[' . $order . '][url]" id="' . $id . '_' . $order . '_slide_url" value="' . $val['url'] . '" />';
     $slider .= '<div class="upload_button_div"><span class="button media_upload_button" id="' . $id . '_' . $order . '" rel="' . $int . '">Upload</span>';
     if (!empty($val['url'])) {
         $hide = '';
     } else {
         $hide = 'hide';
     }
     $slider .= '<span class="button mlu_remove_button ' . $hide . '" id="reset_' . $id . '_' . $order . '" title="' . $id . '_' . $order . '">Remove</span>';
     $slider .= '</div>' . "\n";
     $slider .= '<div class="screenshot">';
     if (!empty($val['url'])) {
         $slider .= '<a class="of-uploaded-image" href="' . $val['url'] . '">';
         $slider .= '<img class="of-option-image" id="image_' . $id . '_' . $order . '" src="' . $val['url'] . '" alt="" />';
         $slider .= '</a>';
     }
     $slider .= '</div>';
     $slider .= '<label>Link URL (optional)</label>';
     $slider .= '<input class="slide of-input" name="' . $id . '[' . $order . '][link]" id="' . $id . '_' . $order . '_slide_link" value="' . $val['link'] . '" />';
     $slider .= '<label>Description (optional)</label>';
     $slider .= '<textarea class="slide of-input" name="' . $id . '[' . $order . '][description]" id="' . $id . '_' . $order . '_slide_description" cols="8" rows="8">' . stripslashes($val['description']) . '</textarea>';
     $slider .= '<a class="slide_delete_button" href="#">Delete</a>';
     $slider .= '<div class="clear"></div>' . "\n";
     $slider .= '</div>';
     $slider .= '</li>';
     return $slider;
 }
開發者ID:m-godefroid76,項目名稱:devrestofactory,代碼行數:67,代碼來源:class.options_machine.php

示例12: ts_of_option_setup

function ts_of_option_setup()
{
    global $of_options, $options_machine;
    $ts_data = of_get_options();
    $options_machine = new Options_Machine($of_options);
    $ts_data = ts_array_atts($options_machine->Defaults, $ts_data);
    ts_of_save_options($ts_data);
}
開發者ID:ericsoncardosoweb,項目名稱:dallia,代碼行數:8,代碼來源:functions.admin.php

示例13: of_ajax_callback

/**
 * Ajax Save Options
 *
 * @uses get_option()
 *
 * @since 1.0.0
 */
function of_ajax_callback()
{
    global $options_machine, $of_options;
    $nonce = $_POST['security'];
    if (!wp_verify_nonce($nonce, 'of_ajax_nonce')) {
        die('-1');
    }
    //get options array from db
    $all = of_get_options();
    $save_type = $_POST['type'];
    //echo $_POST['data'];
    //Uploads
    if ($save_type == 'upload') {
        $clickedID = $_POST['data'];
        // Acts as the name
        $filename = $_FILES[$clickedID];
        $filename['name'] = preg_replace('/[^a-zA-Z0-9._\\-]/', '', $filename['name']);
        $override['test_form'] = false;
        $override['action'] = 'wp_handle_upload';
        $uploaded_file = wp_handle_upload($filename, $override);
        $upload_tracking[] = $clickedID;
        //update $options array w/ image URL
        $upload_image = $all;
        //preserve current data
        $upload_image[$clickedID] = $uploaded_file['url'];
        of_save_options($upload_image);
        if (!empty($uploaded_file['error'])) {
            echo 'Upload Error: ' . $uploaded_file['error'];
        } else {
            echo $uploaded_file['url'];
        }
        // Is the Response
    } elseif ($save_type == 'image_reset') {
        $id = $_POST['data'];
        // Acts as the name
        $delete_image = $all;
        //preserve rest of data
        $delete_image[$id] = '';
        //update array key with empty value
        of_save_options($delete_image);
    } elseif ($save_type == 'backup_options') {
        $backup = $all;
        $backup['backup_log'] = date('r');
        of_save_options($backup, BACKUPS);
        die('1');
    } elseif ($save_type == 'restore_options') {
        $smof_data = get_option(BACKUPS);
        update_option(OPTIONS, $smof_data);
        of_save_options($smof_data);
        die('1');
    } elseif ($save_type == 'import_options') {
        $smof_data = unserialize(base64_decode($smof_data));
        //100% safe - ignore theme check nag
        of_save_options($smof_data);
        die('1');
    } elseif ($save_type == 'save') {
        wp_parse_str(stripslashes($_POST['data']), $smof_data);
        unset($smof_data['security']);
        unset($smof_data['of_save']);
        of_save_options($smof_data);
        die('1');
    } elseif ($save_type == 'reset') {
        $theme_name = 'wp-consilium' . get_option('cs-body-class', '');
        $option_json = get_template_directory_uri() . '/admin/sample/' . $theme_name . '/option.txt';
        $option_json = wp_remote_get($option_json);
        $option_data = $option_json['body'];
        of_save_options(unserialize(base64_decode($option_data)));
        die('1');
        //options reset
    } elseif ($save_type == 'of_add_params') {
        $current_option = of_get_options();
        $current_option = of_get_options();
        $default = $options_machine->Defaults;
        foreach ($default as $k => $option) {
            if (isset($current_option[$k])) {
                $default[$k] = $current_option[$k];
            }
        }
        of_save_options($default);
        die('1');
        //options reset
    }
    die;
}
開發者ID:daanbakker1995,項目名稱:vanteun,代碼行數:91,代碼來源:functions.interface.php

示例14: of_options

 function of_options()
 {
     $data = of_get_options();
     global $ts_all_fonts;
     if (defined('TS_ALL_FONTS')) {
         $ts_all_fonts = TS_ALL_FONTS;
     } elseif (function_exists('ts_essentials_all_fonts')) {
         $ts_all_fonts = ts_essentials_all_fonts(true);
     } elseif (function_exists('ts_all_fonts')) {
         $ts_all_fonts = ts_all_fonts(true);
     } else {
         $ts_all_fonts = array();
     }
     //Access the WordPress Categories via an Array
     $of_categories = array();
     $of_categories_obj = get_categories('hide_empty=0');
     foreach ($of_categories_obj as $of_cat) {
         $of_categories[$of_cat->cat_ID] = $of_cat->cat_name;
     }
     $_of_categories = $of_categories;
     $categories_tmp = array_unshift($of_categories, __("Select a category:", 'ThemeStockyard'));
     //Access the WordPress Pages via an Array
     $of_pages = array();
     $of_pages_obj = get_pages('sort_column=post_parent,menu_order');
     foreach ($of_pages_obj as $of_page) {
         $of_pages[$of_page->ID] = $of_page->post_name;
     }
     $of_pages_tmp = array_unshift($of_pages, __("Select a page:", 'ThemeStockyard'));
     //Testing
     $of_options_select = array("one", "two", "three", "four", "five");
     $of_options_radio = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
     //Sample Homepage blocks for the layout manager (sorter)
     $of_options_homepage_blocks = array("disabled" => array("placebo" => "placebo", "block_one" => "Block One", "block_two" => "Block Two", "block_three" => "Block Three"), "enabled" => array("placebo" => "placebo", "block_four" => "Block Four"));
     //Background Images Reader
     $bg_images_path = get_stylesheet_directory() . '/images/bg/';
     // change this to where you store your bg images
     $bg_images_url = get_template_directory_uri() . '/images/bg/';
     // change this to where you store your bg images
     $bg_images = array();
     if (is_dir($bg_images_path)) {
         if ($bg_images_dir = opendir($bg_images_path)) {
             while (($bg_images_file = readdir($bg_images_dir)) !== false) {
                 if (stristr($bg_images_file, ".png") !== false || stristr($bg_images_file, ".jpg") !== false) {
                     $bg_images[] = $bg_images_url . $bg_images_file;
                 }
             }
         }
     }
     /*-----------------------------------------------------------------------------------*/
     /* TO DO: Add options/functions that use these */
     /*-----------------------------------------------------------------------------------*/
     //More Options
     $uploads_arr = wp_upload_dir();
     $all_uploads_path = $uploads_arr['path'];
     $all_uploads = get_option('of_uploads');
     $other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20");
     $body_attachment = array("scroll", "fixed");
     $body_repeat = array("no-repeat", "repeat-x", "repeat-y", "repeat");
     $body_pos = array("top left", "top center", "top right", "center left", "center center", "center right", "bottom left", "bottom center", "bottom right");
     $css_shadow_entries = array('min' => '-10', 'max' => '10');
     // Image Alignment radio box
     $of_options_thumb_align = array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center");
     // Image Links to Options
     $of_options_image_link_to = array("image" => "The Image", "post" => "The Post");
     /*-----------------------------------------------------------------------------------*/
     /* The Options Array */
     /*-----------------------------------------------------------------------------------*/
     // Set the Options Array
     global $of_options;
     $of_options = array();
     /***
        General Settings
        ***/
     $of_options[] = array("name" => __("Example Section", 'ThemeStockyard'), "type" => "heading");
     $of_options[] = array("name" => __("Example Information Area", 'ThemeStockyard'), "desc" => __('This is a place to put more details describing the following options.', 'ThemeStockyard'), "id" => "example_information_area", "type" => "info");
     $of_options[] = array("name" => __('Example Switch Option"', 'ThemeStockyard'), "desc" => __("Easy to toggle", 'ThemeStockyard'), "id" => "example_switch", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => __("Example Upload", 'ThemeStockyard'), "desc" => __("Upload a file here", 'ThemeStockyard'), "id" => "example_upload", "std" => "", "type" => "upload");
     $of_options[] = array("name" => __("Example Media", 'ThemeStockyard'), "desc" => __("Upload a file here", 'ThemeStockyard'), "id" => "example_media", "std" => '', "type" => "media");
     $of_options[] = array("name" => __("Example Textarea", 'ThemeStockyard'), "desc" => __("Add content here", 'ThemeStockyard'), "id" => "example_textarea", "std" => "", "type" => "textarea", "options" => array("rows" => '5'));
     $of_options[] = array("name" => __("Example Text Box", 'ThemeStockyard'), "desc" => __("Add content here", 'ThemeStockyard'), "id" => "example_text_box", "std" => "", "type" => "text");
     $of_options[] = array("name" => __("Example Small Text", 'ThemeStockyard'), "desc" => '', "id" => "example_small_text", "std" => "320", "type" => "text", 'class' => 'small-text');
     $of_options[] = array("name" => __('Example Select', 'ThemeStockyard'), "desc" => '', "id" => "example_select", "std" => 'yes', "type" => "select", "options" => array('yes' => __('Yes', 'ThemeStockyard'), 'social' => __('Only the social icons', 'ThemeStockyard'), 'no' => __('No', 'ThemeStockyard')));
     $url = defined('TS_ESSENTIALS_ADMIN_URI') ? TS_ESSENTIALS_ADMIN_URI . 'assets/images/' : '/path_to_images/';
     $of_options[] = array("name" => __("Example Images", 'ThemeStockyard'), "id" => "example_images", "std" => "footer2", "type" => "images", "options" => array('footer1' => $url . 'footer-1.png', 'footer2' => $url . 'footer-2.png', 'footer3' => $url . 'footer-3.png', 'footer4' => $url . 'footer-4.png', 'footer5' => $url . 'footer-5.png', 'footer6' => $url . 'footer-6.png', 'footer7' => $url . 'footer-7.png', 'footer8' => $url . 'footer-8.png'));
     $of_options[] = array("name" => __("Example Checkbox", 'ThemeStockyard'), "desc" => '', "id" => "example_checkbox", "std" => 1, "type" => "checkbox");
     $of_options[] = array("name" => __("Example Radio", 'ThemeStockyard'), "desc" => '', "id" => "example_radio", "std" => 'no', "type" => "radio", "options" => array('yes' => __('Yes', 'ThemeStockyard'), 'no' => __('No', 'ThemeStockyard')));
     $of_options[] = array("name" => __('Example Multi-select', 'ThemeStockyard'), "desc" => '', "id" => "example_multiselect", "std" => "", "type" => "multiselect", 'options' => $_of_categories);
     $of_options[] = array("name" => __("Example Multi-check", 'ThemeStockyard'), "desc" => '', "id" => "example_multicheck", "std" => array('option1', 'option2', 'option3'), "type" => "multicheck", 'keyAsValue' => true, "options" => array('option1' => __('Option 1', 'ThemeStockyard'), 'option2' => __('Option 2', 'ThemeStockyard'), 'option3' => __('Option 3', 'ThemeStockyard')));
     $of_options[] = array("name" => __('Example Slider UI', 'ThemeStockyard'), "desc" => '', "id" => "example_slider_ui", "std" => "95", "min" => "1", "step" => "1", "max" => "100", "type" => "sliderui");
     // Typography
     $of_options[] = array("name" => __("Typography", 'ThemeStockyard'), "type" => "heading", "class" => "mt10");
     $of_options[] = array("name" => __("Example Google Fonts", 'ThemeStockyard'), "desc" => '', "id" => "example_fonts", "std" => "Libre Baskerville", "type" => "select_google_font", "options" => $ts_all_fonts, "preview" => array("text" => '0123456789 Grumpy wizards make toxic brew for the evil Queen and Jack.', "size" => '30px'));
     $of_options[] = array("name" => __("Example Font Style", 'ThemeStockyard'), "desc" => '', "id" => "example_font_style", "std" => array('size' => '36px', 'style' => 'normal'), "type" => "typography", "class" => "w345");
     // Colors
     $of_options[] = array("name" => __("Colors", 'ThemeStockyard'), "type" => "heading");
     $of_options[] = array("name" => __("Example color", 'ThemeStockyard'), "desc" => '', "id" => "example_color", "std" => "#000", "type" => "color");
     // Backup Options
     $of_options[] = array("name" => __("Backup Options", 'ThemeStockyard'), "type" => "heading", "class" => "mt10");
     $of_options[] = array("name" => __("Backup and Restore Options", 'ThemeStockyard'), "id" => "of_backup", "std" => "", "type" => "backup", "desc" => __('You can use the two buttons below to backup your current options, and then restore it back at a later time. This is useful if you want to experiment on the options but would like to keep the old settings in case you need it back.', 'ThemeStockyard'));
     $of_options[] = array("name" => __("Transfer Theme Options Data", 'ThemeStockyard'), "id" => "of_transfer", "std" => "", "type" => "transfer", "desc" => __('You can tranfer the saved options data between different installs by copying the text inside the text box. To import data from another install, replace the data in the text box with the one from another install and click "Import Options".', 'ThemeStockyard'));
//.........這裏部分代碼省略.........
開發者ID:dqishmirian,項目名稱:jrrny,代碼行數:101,代碼來源:functions.options.php

示例15: array

	</div>
	<!-- end: pagination -->
	<?php 
    // Deprecated (the above function displays pagination)
    /*
    if(false):
    
    		posts_nav_link();
    
    	endif;
    */
}
// Get SMOF data
$data_cached = array();
$smof_filters = array();
$data = function_exists('of_get_options') ? of_get_options() : array();
$data_iteration_count = 0;
function get_data($var = '', $default = '')
{
    global $data, $data_cached, $data_iteration_count;
    $data_iteration_count++;
    if (!function_exists('of_get_options')) {
        return null;
    }
    if (isset($data_cached[$var])) {
        return apply_filters("get_data_{$var}", $data_cached[$var]);
    }
    if (!empty($var) && isset($data[$var])) {
        if (empty($data[$var]) && $default) {
            $data[$var] = $default;
        }
開發者ID:adrienlementheour,項目名稱:AliceRouat,代碼行數:31,代碼來源:laborator_functions.php


注:本文中的of_get_options函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。