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


PHP of_save_options函数代码示例

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


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

示例1: us_custom_styles

function us_custom_styles()
{
    global $of_options, $smof_data;
    // Resave theme custom CSS if the theme was updated
    $theme_version = us_get_main_theme_version();
    $last_custom_css_version = get_option('us_custom_css_version');
    if (empty($last_custom_css_version) or version_compare($last_custom_css_version, $theme_version, '<')) {
        $options_machine = new Options_Machine($of_options);
        $smof_data = array_merge($options_machine->Defaults, $smof_data);
        of_save_options($smof_data);
        us_save_styles($smof_data);
        update_option('us_custom_css_version', $theme_version);
    }
    $wp_upload_dir = wp_upload_dir();
    $styles_dir = $wp_upload_dir['basedir'] . '/us_custom_css';
    $styles_dir = str_replace('\\', '/', $styles_dir);
    $styles_file = $styles_dir . '/us_astra_custom_styles.css';
    if (file_exists($styles_file)) {
        wp_register_style('us_custom_css', $wp_upload_dir['baseurl'] . '/us_custom_css/us_astra_custom_styles.css', array(), '1', 'all');
        wp_enqueue_style('us_custom_css');
    } else {
        global $load_styles_directly;
        $load_styles_directly = true;
    }
    if (get_template_directory_uri() != get_stylesheet_directory_uri()) {
        wp_register_style('astra-style', get_stylesheet_directory_uri() . '/style.css', array(), '1', 'all');
        wp_enqueue_style('astra-style');
    }
}
开发者ID:syncopetwice,项目名称:STG,代码行数:29,代码来源:enqueue.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: 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

示例5: cs_set_options

 function cs_set_options($option)
 {
     of_save_options(unserialize(base64_decode($option)));
 }
开发者ID:daanbakker1995,项目名称:vanteun,代码行数:4,代码来源:cs_importer.php

示例6: optionsframework_machine


//.........这里部分代码省略.........
                         $s_step = '1';
                     } else {
                         $s_step = $value['step'];
                     }
                     if (!isset($value['edit'])) {
                         $s_edit = ' readonly="readonly"';
                     } else {
                         $s_edit = '';
                     }
                     if ($s_val == '') {
                         $s_val = $s_min;
                     }
                     //values
                     $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                     //html output
                     $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                     $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                     break;
                     //Switch option
                 //Switch option
                 case 'switch':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "s_fld ";
                     }
                     $cb_enabled = $cb_disabled = '';
                     //no errors, please
                     //Get selected
                     if ($smof_data[$value['id']] == 1) {
                         $cb_enabled = ' selected';
                         $cb_disabled = '';
                     } else {
                         $cb_enabled = '';
                         $cb_disabled = ' selected';
                     }
                     //Label ON
                     if (!isset($value['on'])) {
                         $on = "On";
                     } else {
                         $on = $value['on'];
                     }
                     //Label OFF
                     if (!isset($value['off'])) {
                         $off = "Off";
                     } else {
                         $off = $value['off'];
                     }
                     $output .= '<p class="switch-options">';
                     $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                     $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     $output .= '</p>';
                     break;
                     // Uploader 3.5
                 // Uploader 3.5
                 case "upload":
                 case "media":
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     $u_val = '';
                     if ($smof_data[$value['id']]) {
                         $u_val = stripslashes($smof_data[$value['id']]);
                     }
                     $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod']);
                     break;
             }
             do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
             if ($smof_output != "") {
                 $output .= $smof_output;
                 $smof_output = "";
             }
             //description of each option
             if ($value['type'] != 'heading') {
                 if (!isset($value['desc'])) {
                     $explain_value = '';
                 } else {
                     $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                 }
                 $output .= '</div>' . $explain_value . "\n";
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
         /* condition empty end */
     }
     if ($update_data == true) {
         of_save_options($smof_data);
     }
     $output .= '</div>';
     do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
     if ($smof_output != "") {
         $output .= $smof_output;
         $smof_output = "";
     }
     return array($output, $menu, $defaults);
 }
开发者ID:wwwonder,项目名称:editit,代码行数:101,代码来源:class.options_machine.php

示例7: 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

示例8: ajax_save_style

function ajax_save_style()
{
    if (!is_user_logged_in()) {
        die('You do not have sufficient permissions to do this action.');
    } else {
        if (!current_user_can('manage_options')) {
            wp_die(__('You do not have sufficient permissions to do this action.', 'wpdance'));
        } else {
            //TODO : check nonce & do font save
            if (empty($_POST) || !wp_verify_nonce($_POST['ajax_preview'], 'ajax_save_style')) {
                wp_die(__('Something goes wrong!Please login again', 'wpdance'));
            } else {
                // process form data
                $_default_font_arr = array("arial", "verdana", "trebuchet", "georgia", "times new roman", "tahoma", "palatino", "helvetica");
                global $wd_data;
                if (isset($_POST['@font_body']) && strlen(trim($_POST['@font_body'])) > 0) {
                    if (in_array(trim($_POST['@font_body']), $_default_font_arr)) {
                        $wd_data['wd_body_font1_googlefont_enable'] = 1;
                        $wd_data['wd_body_font1_family'] = wp_kses_data($_POST['@font_body']);
                    } else {
                        $wd_data['wd_body_font1_googlefont_enable'] = 0;
                        $wd_data['wd_body_font1_googlefont'] = wp_kses_data($_POST['@font_body']);
                    }
                }
                if (isset($_POST['@font_verticalmenu']) && strlen(trim($_POST['@font_verticalmenu'])) > 0) {
                    if (in_array(trim($_POST['@font_verticalmenu']), $_default_font_arr)) {
                        $wd_data['wd_vertical_menu_font_enable'] = 1;
                        $wd_data['wd_vertical_menu_family_font'] = wp_kses_data($_POST['@font_verticalmenu']);
                    } else {
                        $wd_data['wd_vertical_menu_font_enable'] = 0;
                        $wd_data['wd_vertical_menu_googlefont'] = wp_kses_data($_POST['@font_verticalmenu']);
                    }
                }
                if (isset($_POST['@font_heading']) && strlen(trim($_POST['@font_heading'])) > 0) {
                    if (in_array(trim($_POST['@font_heading']), $_default_font_arr)) {
                        $wd_data['wd_heading_font_googlefont_enable'] = 1;
                        $wd_data['wd_heading_fontfamily'] = wp_kses_data($_POST['@font_heading']);
                    } else {
                        $wd_data['wd_heading_font_googlefont_enable'] = 0;
                        $wd_data['wd_heading_font_googlefont'] = wp_kses_data($_POST['@font_heading']);
                    }
                }
                if (isset($_POST['@font_horizontalmenu']) && strlen(trim($_POST['@font_horizontalmenu'])) > 0) {
                    if (in_array(trim($_POST['@font_horizontalmenu']), $_default_font_arr)) {
                        $wd_data['wd_horizontal_menu_font_googlefont_enable'] = 1;
                        $wd_data['wd_menu_fontfamily'] = wp_kses_data($_POST['@font_horizontalmenu']);
                    } else {
                        $wd_data['wd_horizontal_menu_font_googlefont_enable'] = 0;
                        $wd_data['wd_menu_font_googlefont'] = wp_kses_data($_POST['@font_horizontalmenu']);
                    }
                }
                $wd_data['wd_layout_styles'] = strlen($_POST['wd_layout_styles']) > 0 ? wp_kses_data($_POST['wd_layout_styles']) : $wd_data['wd_layout_styles'];
                foreach ($_POST as $_key => $_value) {
                    if (strpos($_key, '@') == 0 && strpos($_key, '@') !== false) {
                        $_old_key = 'wd_' . substr($_key, 1, strlen($_key) - 1);
                        if (array_key_exists($_old_key, $wd_data)) {
                            $wd_data[$_old_key] = strlen($_POST[$_key]) > 0 ? wp_kses_data($_POST[$_key]) : $wd_data[$_old_key];
                        }
                    }
                }
                of_save_options($wd_data);
                wp_die("1");
            }
        }
    }
}
开发者ID:proj-2014,项目名称:vlan247-test-wp2,代码行数:66,代码来源:preview_mod.php

示例9: 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

示例10: migrate_theme_options

 public function migrate_theme_options()
 {
     // Getting Options
     global $smof_data, $of_options;
     if (!isset($of_options) or empty($of_options)) {
         // Forcing options to be loaded even before the main init
         remove_action('init', 'of_options');
         of_options();
     }
     $options_changed = FALSE;
     foreach ($this->translators as $version => $translator) {
         if (method_exists($translator, 'translate_theme_options')) {
             $options_changed = ($translator->translate_theme_options($smof_data) or $options_changed);
         }
     }
     if ($options_changed) {
         // Filling the missed options with default values
         $options_machine = new Options_Machine($of_options);
         $smof_data = array_merge($options_machine->Defaults, $smof_data);
         $smof_data['generate_css_file'] = FALSE;
         // Saving the changed options
         of_save_options($smof_data);
         //update_option( OPTIONS, $smof_data );
         us_save_styles($smof_data);
     }
 }
开发者ID:afquinterog,项目名称:zephyr,代码行数:26,代码来源:migration.php

示例11: optionsframework_machine


//.........这里部分代码省略.........
                        // Theme Customizer End
                    // Theme Customizer End
                    case 'customizer_end':
                        $output .= '</div></div></div>';
                        break;
                        // Toggle Start
                    // Toggle Start
                    case 'toggle_start':
                        $output .= '<div class="of-toggle-wrap f_st_custom_headers"><div class="of-toggle-heading">' . $value['name'] . '<i class="icon-plus"></i></div><div class="of-toggle-content">';
                        break;
                        // Toggle End
                    // Toggle End
                    case 'toggle_end':
                        $output .= '</div></div>';
                        break;
                        //Switch option
                    //Switch option
                    case 'switch':
                        if (!isset($smof_data[$value['id']])) {
                            $smof_data[$value['id']] = 0;
                        }
                        $fold = $fold_checkbox = '';
                        if (array_key_exists("folds", $value)) {
                            $fold = "s_fld ";
                            $fold_checkbox = "fld ";
                        }
                        $cb_enabled = $cb_disabled = '';
                        //no errors, please
                        //Get selected
                        if ($smof_data[$value['id']] == 1) {
                            $cb_enabled = ' selected';
                            $cb_disabled = '';
                        } else {
                            $cb_enabled = '';
                            $cb_disabled = ' selected';
                        }
                        //Label ON
                        if (!isset($value['on'])) {
                            $on = "On";
                        } else {
                            $on = $value['on'];
                        }
                        //Label OFF
                        if (!isset($value['off'])) {
                            $off = "Off";
                        } else {
                            $off = $value['off'];
                        }
                        //$output .= '<p class="switch-options">';
                        $output .= '<p>';
                        //						$output .= '<label class="'.$fold.'cb-enable'. $cb_enabled .'" data-id="'.$value['id'].'"><span>'. $on .'</span></label>';
                        //						$output .= '<label class="'.$fold.'cb-disable'. $cb_disabled .'" data-id="'.$value['id'].'"><span>'. $off .'</span></label>';
                        //$output .= '<input type="hidden" class="'.$fold.'checkbox of-input" name="'.$value['id'].'" id="'. $value['id'] .'" value="0"/>';
                        $output .= '<div class="toggle-checkbox"></div>';
                        $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold_checkbox . 'checkbox of-input main_checkbox hidden" data-dependency="' . $value['dep'] . '" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                        $output .= '</p>';
                        break;
                        // Uploader 3.5
                    // Uploader 3.5
                    case "upload":
                    case "media":
                        if (!isset($value['mod'])) {
                            $value['mod'] = '';
                        }
                        $u_val = '';
                        if ($smof_data[$value['id']]) {
                            $u_val = stripslashes($smof_data[$value['id']]);
                        }
                        $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod'], $value['dep']);
                        break;
                }
                do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
                if ($smof_output != "") {
                    $output .= $smof_output;
                    $smof_output = "";
                }
                //description of each option
                if ($value['type'] != 'heading' && $value['type'] != "toggle_start" && $value['type'] != "toggle_end" && $value['type'] != "customizer_tab" && $value['type'] != "customizer_start" && $value['type'] != "customizer_end") {
                    if (!isset($value['desc'])) {
                        $explain_value = '';
                    } else {
                        $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                    }
                    $output .= '</div>' . $explain_value . "\n";
                    $output .= '<div class="clear"> </div></div></div>' . "\n";
                }
            }
            /* condition empty end */
        }
        if ($update_data == true) {
            of_save_options($smof_data);
        }
        $output .= '</div>';
        do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
        if ($smof_output != "") {
            $output .= $smof_output;
            $smof_output = "";
        }
        return array($output, $menu, $defaults);
    }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:101,代码来源:class.options_machine.php

示例12: of_get_options

/**
 * Get options from the database and process them with the load filter hook.
 *
 * @author Jonah Dahlquist
 * @since 1.4.0
 * @return array
 */
function of_get_options($key = OPTIONS)
{
    $data = get_option($key);
    if (!$data && $key == OPTIONS && OPTIONS != OPTIONS_BASE) {
        $data = get_option(OPTIONS_BASE);
        if (is_admin()) {
            if ($data) {
                of_save_options($data);
            }
        }
    }
    $data = apply_filters('of_options_after_load', $data);
    return $data;
}
开发者ID:baden03,项目名称:access48,代码行数:21,代码来源:functions.admin.php

示例13: optionsframework_machine


//.........这里部分代码省略.........
                         $s_step = '1';
                     } else {
                         $s_step = $value['step'];
                     }
                     if (!isset($value['edit'])) {
                         $s_edit = ' readonly="readonly"';
                     } else {
                         $s_edit = '';
                     }
                     if ($s_val == '') {
                         $s_val = $s_min;
                     }
                     //values
                     $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                     //html output
                     $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                     $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                     break;
                     //Switch option
                 //Switch option
                 case 'switch':
                     if (!isset($smof_data[$value['id']])) {
                         $smof_data[$value['id']] = 0;
                     }
                     $fold = '';
                     if (array_key_exists("folds", $value)) {
                         $fold = "s_fld ";
                     }
                     $cb_enabled = $cb_disabled = '';
                     //no errors, please
                     //Get selected
                     if ($smof_data[$value['id']] == 1) {
                         $cb_enabled = ' selected';
                         $cb_disabled = '';
                     } else {
                         $cb_enabled = '';
                         $cb_disabled = ' selected';
                     }
                     //Label ON
                     if (!isset($value['on'])) {
                         $on = "On";
                     } else {
                         $on = $value['on'];
                     }
                     //Label OFF
                     if (!isset($value['off'])) {
                         $off = "Off";
                     } else {
                         $off = $value['off'];
                     }
                     $output .= '<p class="switch-options">';
                     $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                     $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                     $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                     $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                     $output .= '</p>';
                     break;
                     // Uploader 3.5
                 // Uploader 3.5
                 case "upload":
                 case "media":
                     if (!isset($value['mod'])) {
                         $value['mod'] = '';
                     }
                     $u_val = '';
                     if ($smof_data[$value['id']]) {
                         $u_val = stripslashes($smof_data[$value['id']]);
                     }
                     $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $u_val, $value['mod']);
                     break;
             }
             do_action('optionsframework_machine_loop', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
             if ($smof_output != "") {
                 $output .= $smof_output;
                 $smof_output = "";
             }
             //description of each option
             if ($value['type'] != 'heading') {
                 if (!isset($value['desc'])) {
                     $explain_value = '';
                 } else {
                     $explain_value = '<div class="explain">' . $value['desc'] . '</div>' . "\n";
                 }
                 $output .= '</div>' . $explain_value . "\n";
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
         /* condition empty end */
     }
     if ($update_data == true) {
         of_save_options($smof_data);
     }
     $output .= '</div>';
     do_action('optionsframework_machine_after', array('options' => $options, 'smof_data' => $smof_data, 'defaults' => $defaults, 'counter' => $counter, 'menu' => $menu, 'output' => $output, 'value' => $value));
     if ($smof_output != "") {
         $output .= $smof_output;
         $smof_output = "";
     }
     return array($output, $menu, $defaults);
 }
开发者ID:annegrundhoefer,项目名称:courtney,代码行数:101,代码来源:class.options_machine.php

示例14: demo_importer_save_hook

function demo_importer_save_hook($param)
{
    if (!class_exists('WP_Import')) {
        require file_require(get_template_directory() . '/framework/addons/wordpress-importer' . '/wordpress-importer.php');
    }
    /* File Paths */
    $options_file = file_require(get_template_directory_uri() . '/framework/addons/wordpress-importer/files/theme-options.txt', true);
    $options_file_path = file_require(dirname(__FILE__) . '/files/theme-options.txt');
    $nav_file = file_require(get_template_directory_uri() . '/framework/addons/wordpress-importer/files/navigation.xml', true);
    $nav_file_path = file_require(dirname(__FILE__) . '/files/navigation.xml', true);
    $widget_file = file_require(get_template_directory_uri() . '/framework/addons/wordpress-importer/files/widgets.txt', true);
    $widget_file_path = file_require(dirname(__FILE__) . '/files/widgets.txt', true);
    if (isset($param['template']) && !empty($param['template'])) {
        /* Import Selected Content */
        $data_file = file_require(dirname(__FILE__) . '/files/data/' . $param['template'] . '.xml');
        preg_match('/\\((.*?)\\)/', $param['template'], $slug_out);
        $home_slug = is_array($slug_out) && !empty($slug_out) ? $slug_out[0] : '';
        $home_slug = str_replace('$', '/', $home_slug);
        $home_slug = str_replace('(', '', $home_slug);
        $home_slug = str_replace(')', '', $home_slug);
        if (file_exists($data_file) && !empty($home_slug)) {
            $d = explode('/', $home_slug);
            $home_slug = isset($d[1]) ? $d[1] : $home_slug;
            $page_id_by_name = _get_page_by_name($home_slug);
            if ($page_id_by_name != '0') {
                wp_delete_post($page_id_by_name, true);
                $wp_import = new WP_Import();
                $wp_import->fetch_attachments = false;
                ob_start();
                set_time_limit(0);
                $wp_import->import($data_file);
                ob_end_clean();
                // Set Home Page
                update_option('show_on_front', 'page');
                update_option('page_on_front', $page_id_by_name);
            }
        }
        /*=== End Contents */
        /* Import Widgets */
        if (file_exists($widget_file_path)) {
            $get_widget_file = wp_remote_get($widget_file);
            $widget_body = $get_widget_file['body'];
            if (!empty($widget_body)) {
                require file_require(get_template_directory() . '/framework/addons/wordpress-importer' . '/widget-importer.php');
                if (base64_decode(trim($widget_body), true)) {
                    $data = unserialize(base64_decode(trim($widget_body)));
                } else {
                    $data = unserialize(trim($widget_body));
                }
                tt_widget_importer($data);
            }
        }
        /*=== End Widgets */
        /* Import Theme Option */
        if (isset($param['import_theme_options']) && $param['import_theme_options'] == '1') {
            if (file_exists($options_file_path)) {
                $get_options_file = wp_remote_get($options_file);
                $options_body = $get_options_file['body'];
                if (!empty($options_body)) {
                    $options_content = $options_body;
                    $smof_data = unserialize(base64_decode($options_content));
                    of_save_options($smof_data);
                    echo '<iframe src="' . admin_url() . 'admin-ajax.php?action=themeton_regenerate_css" style="width:0px;height:0px;visibility:hidden;"></iframe>';
                }
            }
        }
        /*=== End Theme Options */
        /* Revo Sliders */
        if (isset($param['import_revo_slider']) && $param['import_revo_slider'] == '1') {
            require file_require(get_template_directory() . '/framework/addons/wordpress-importer' . '/revo-importer.php');
            tt_revo_importer();
            if (class_exists('MSP_Importer')) {
                require file_require(get_template_directory() . '/framework/addons/wordpress-importer' . '/masterslide-import.php');
                $master_import = new MasterSliderImporter();
                $master_import->import_master_sliders();
            }
        }
        /*=== End Revo Sliders */
        /* Check Navigation Menu */
        $locations = get_theme_mod('nav_menu_locations');
        $menus = wp_get_nav_menus();
        $exist_nav = false;
        if (is_array($menus)) {
            foreach ($menus as $menu) {
                if ($menu->name == 'Main Menu') {
                    $locations['primary'] = $menu->term_id;
                    set_theme_mod('nav_menu_locations', $locations);
                    $exist_nav = true;
                }
            }
        }
        /* Import Main Contents */
        try {
            $main_file = file_require(dirname(__FILE__) . '/files/main-content.xml');
            if (file_exists($main_file) && !$exist_nav) {
                $wp_import = new WP_Import();
                $wp_import->fetch_attachments = false;
                ob_start();
                set_time_limit(0);
                $wp_import->import($main_file);
//.........这里部分代码省略.........
开发者ID:petersondrs,项目名称:tellura,代码行数:101,代码来源:config.php

示例15: us_demo_import_options

function us_demo_import_options()
{
    global $us_template_directory;
    $config = us_config('demo-import');
    //select which files to import
    $aviable_demos = array_keys($config);
    $demo_version = $aviable_demos[0];
    if (in_array($_POST['demo'], $aviable_demos)) {
        $demo_version = $_POST['demo'];
    }
    $smof_data = unserialize(base64_decode(file_get_contents($us_template_directory . '/demo-import/' . $demo_version . '-options.txt')));
    //100% safe - ignore theme check nag
    of_save_options($smof_data);
    us_save_styles($smof_data);
    wp_send_json_success();
}
开发者ID:afquinterog,项目名称:zephyr,代码行数:16,代码来源:demo-import.php


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