コード例 #1
0
 /**
  * Reset the custom logo if the current logo is deleted in the media manager.
  *
  * @since 4.5.0
  * @access public
  *
  * @param int $post_id Post ID.
  */
 public function delete_attachment_data($post_id)
 {
     $custom_logo_id = get_theme_mod('custom_logo');
     if ($custom_logo_id && $custom_logo_id == $post_id) {
         remove_theme_mod('custom_logo');
     }
 }
コード例 #2
0
ファイル: tweaks.php プロジェクト: sergey-h/naman2
 /**
  * Main Sanitization callback
  */
 function admin_sanitize($options)
 {
     // Get the option array and for each one save as a theme_mod
     if (is_array($options) && !empty($options)) {
         foreach ($options as $key => $value) {
             if (!empty($value)) {
                 set_theme_mod($key, $value);
             } else {
                 remove_theme_mod($key, $value);
             }
         }
     }
     // Save checkboxes
     $checkboxes = array('minify_js', 'remove_scripts_version', 'cleanup_head', 'image_resizing', 'remove_posttype_slugs', 'post_series_enable', 'custom_404_enable', 'custom_admin_login_enable', 'custom_css_enable', 'widget_areas_enable', 'skins_enable', 'visual_composer_theme_mode', 'extend_visual_composer', 'favicons_enable', 'trim_custom_excerpts');
     // Add post type settings to checkboxes array
     $post_types = wpex_theme_post_types();
     foreach ($post_types as $post_type) {
         $checkboxes[] = $post_type . '_enable';
     }
     // Loop through all options and check if isset and if so save mod
     foreach ($checkboxes as $checkbox) {
         // Set theme mod to on
         if (isset($options[$checkbox])) {
             set_theme_mod($checkbox, true);
         } else {
             set_theme_mod($checkbox, false);
         }
     }
     // Display notice after saving
     add_settings_error('wpex_tweaks_notices', esc_attr('settings_updated'), __('Settings saved.', 'wpex'), 'updated');
     // Remove options, everything should live in the theme mods
     $options = '';
     return $options;
 }
コード例 #3
0
ファイル: header.php プロジェクト: 64kbytes/stayinba
 function update()
 {
     // Manage the uploaded picture
     if (!empty($_FILES['image_upload']['name']) and !empty($_FILES['image_upload']['size'])) {
         move_uploaded_file($_FILES['image_upload']['tmp_name'], K2_HEADERS_PATH . $_FILES['image_upload']['name']);
         if (isset($_POST['upload_activate'])) {
             update_option('k2header_picture', $_FILES['image_upload']['name']);
         }
     }
     if (!empty($_POST['k2'])) {
         // Random Image
         if (isset($_POST['k2']['imagerandomfeature'])) {
             update_option('k2imagerandomfeature', '1');
         } else {
             update_option('k2imagerandomfeature', '0');
         }
         // Header Image
         if (isset($_POST['k2']['header_picture'])) {
             update_option('k2header_picture', $_POST['k2']['header_picture']);
             // Update Custom Image Header
             if (function_exists('set_theme_mod')) {
                 if (empty($_POST['k2']['header_picture'])) {
                     remove_theme_mod('header_image');
                 } else {
                     set_theme_mod('header_image', get_k2info('headers_url') . get_option('k2header_picture'));
                 }
             }
         }
     }
 }
コード例 #4
0
 public function web_dorado_theme_update_and_get_options_general_settings()
 {
     if (isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "general_page") {
         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
             foreach ($this->options_generalsettings as $value) {
                 if (isset($_REQUEST[$value['var_name']])) {
                     $sanitize_type = 'exclusive_do_nothing';
                     if (isset($value['sanitize_type']) && $value['sanitize_type']) {
                         $sanitize_type = $value['sanitize_type'];
                     }
                     set_theme_mod($value['id'], $sanitize_type($_REQUEST[$value['var_name']]));
                 } else {
                     remove_theme_mod($value['id']);
                 }
             }
             header("Location: admin.php?page=web_dorado_theme&controller=general_page&saved=true");
             die;
         } else {
             if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset') {
                 foreach ($this->options_generalsettings as $value) {
                     remove_theme_mod($value['id']);
                 }
                 header("Location: admin.php?page=web_dorado_theme&controller=general_page&reset=true");
                 die;
             }
         }
     }
 }
コード例 #5
0
function set_top_menu_on_import()
{
    $menu_seted = get_option('menus_seted');
    if (false == $menu_seted) {
        $menu_seted = 0;
    }
    if (2 >= get_option('menus_seted')) {
        $menus = get_terms('nav_menu');
        $menu_seted++;
        $save = array();
        foreach ($menus as $menu) {
            if ($menu->name == 'Shop menu') {
                $save['shop_menu'] = $menu->term_id;
            } elseif ($menu->name == 'Header Menu') {
                $save['header_menu'] = $menu->term_id;
            } elseif ($menu->name == 'Footer Menu') {
                $save['footer_menu'] = $menu->term_id;
            }
        }
        if ($save) {
            remove_theme_mod('nav_menu_locations');
            set_theme_mod('nav_menu_locations', array_map('absint', $save));
        }
        update_option('menus_seted', $menu_seted);
    }
}
コード例 #6
0
 /**
  * TODO Document!
  */
 function pagelines_theme_clear_update_transient()
 {
     delete_transient(EXTEND_UPDATE);
     remove_action('admin_notices', array(&$this, 'pagelines_theme_update_nag'));
     delete_transient('pagelines_sections_cache');
     remove_theme_mod('pending_updates');
 }
コード例 #7
0
ファイル: home_page.php プロジェクト: jhersonn20/www
 public function web_dorado_theme_update_and_get_options_home()
 {
     if (isset($_GET['page']) && $_GET['page'] == "web_dorado_theme" && isset($_GET['controller']) && $_GET['controller'] == "home_page") {
         if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
             foreach ($this->options_homepage as $value) {
                 if (isset($_REQUEST[$value['var_name']])) {
                     set_theme_mod($value['id'], $_REQUEST[$value['var_name']]);
                 }
             }
             foreach ($this->options_homepage as $value) {
                 if (isset($_REQUEST[$value['var_name']])) {
                     set_theme_mod($value['id'], $_REQUEST[$value['var_name']]);
                 } else {
                     remove_theme_mod($value['id']);
                 }
             }
             header("Location: themes.php?page=web_dorado_theme&controller=home_page&saved=true");
             die;
         } else {
             if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'reset') {
                 foreach ($this->options_homepage as $value) {
                     remove_theme_mod($value['id']);
                 }
                 header("Location: themes.php?page=web_dorado_theme&controller=home_page&reset=true");
                 die;
             }
         }
     }
 }
コード例 #8
0
 private static function listen()
 {
     if ($key = filter_input(INPUT_GET, self::PURGE_QUERY_VAR)) {
         $response = new stdClass();
         if ($key === self::get_purge_key()) {
             delete_transient(EXTEND_UPDATE);
             delete_transient('pagelines_extend_themes');
             delete_transient('pagelines_extend_sections');
             delete_transient('pagelines_extend_plugins');
             delete_transient('pagelines_extend_integrations');
             delete_transient('pagelines_sections_cache');
             remove_theme_mod('available_updates');
             remove_theme_mod('pending_updates');
             do_action('extend_flush');
             $response->status = 'success';
             $response->message = 'Cache purged.';
             $status_code = 200;
         } else {
             $response->status = 'fail';
             $response->message = 'Invalid key.';
             $status_code = 422;
         }
         if (!headers_sent()) {
             nocache_headers();
             @header("Content-type: application/json");
             status_header($status_code);
             echo json_encode($response);
             exit;
         } else {
             wp_die($response->message, $response->status, array('response' => $status_code));
         }
         // silence
     }
 }
コード例 #9
0
ファイル: slider_page.php プロジェクト: roundtopdog/wordpress
 private function web_dorado_theme_update_slider()
 {
     $image_list = '';
     $image_href = '';
     $image_title = '';
     $image_textarea = '';
     $image_link = '';
     $ct_pause_on_hover = '';
     $ct_hide_slider = '';
     if (isset($_POST['ct_pause_on_hover'])) {
         $ct_pause_on_hover = $_POST['ct_pause_on_hover'];
     }
     if (isset($_POST['ct_hide_slider'])) {
         $ct_hide_slider = $_POST['ct_hide_slider'];
     }
     if (isset($_GET['saved']) && $_GET['saved'] == 'saved') {
         for ($i = 0; $i < 200; $i++) {
             if (isset($_POST['ct_image_link_' . $i])) {
                 $image_link .= $_POST['ct_image_link_' . $i] . ';;;;';
             }
             if (isset($_POST['ct_image_href_' . $i])) {
                 $image_href .= $_POST['ct_image_href_' . $i] . ';;;;';
             }
             if (isset($_POST['ct_image_title_' . $i])) {
                 $image_title .= $_POST['ct_image_title_' . $i] . ';;;;';
             }
             if (isset($_POST['ct_image_textarea_' . $i])) {
                 $image_textarea .= $_POST['ct_image_textarea_' . $i] . ';;;;';
             }
         }
         set_theme_mod('web_busines_image_link', $image_link);
         set_theme_mod('web_busines_image_href', $image_href);
         set_theme_mod('web_busines_image_textarea', $image_textarea);
         set_theme_mod('web_busines_image_title', $image_title);
         set_theme_mod('ct_slider_height', $_POST['ct_slider_height']);
         set_theme_mod('ct_pause_time', $_POST['ct_pause_time']);
         set_theme_mod('ct_anim_speed', $_POST['ct_anim_speed']);
         set_theme_mod('ct_effect', $_POST['ct_effect']);
         set_theme_mod('ct_pause_on_hover', $ct_pause_on_hover);
         set_theme_mod('ct_hide_slider', $ct_hide_slider);
         set_theme_mod('ct_slider_title_position', $_POST['ct_slider_title_position']);
         set_theme_mod('ct_slider_description_position', $_POST['ct_slider_description_position']);
     }
     if (isset($_GET['reset']) && $_GET['reset'] == 'reset') {
         remove_theme_mod('web_busines_image_link');
         remove_theme_mod('web_busines_image_href');
         remove_theme_mod('web_busines_image_title');
         remove_theme_mod('web_busines_image_textarea');
         remove_theme_mod('ct_slider_height');
         remove_theme_mod('ct_pause_time');
         remove_theme_mod('ct_anim_speed');
         remove_theme_mod('ct_effect');
         remove_theme_mod('ct_pause_on_hover');
         remove_theme_mod('ct_hide_slider');
         remove_theme_mod('ct_slider_title_position');
         remove_theme_mod('ct_slider_description_position');
     }
 }
コード例 #10
0
ファイル: skins-admin.php プロジェクト: iq007/MadScape
 /**
  * Sanitization callback
  */
 public function sanitize($options)
 {
     $skin = !empty($options) ? $options : 'base';
     if ('base' == $skin) {
         remove_theme_mod('theme_skin');
     } else {
         set_theme_mod('theme_skin', $skin);
     }
     $options = '';
 }
コード例 #11
0
ファイル: legacy.php プロジェクト: pradeep-web/brandt
/**
 * Transfer theme data into new settings
 */
function siteorigin_panels_transfer_home_page()
{
    if (get_option('siteorigin_panels_home_page', false) === false && get_theme_mod('panels_home_page', false) !== false) {
        // Transfer settings from theme mods into settings
        update_option('siteorigin_panels_home_page', get_theme_mod('panels_home_page', false));
        update_option('siteorigin_panels_home_page_enabled', get_theme_mod('panels_home_page_enabled', false));
        // Remove the theme mod data
        remove_theme_mod('panels_home_page');
        remove_theme_mod('panels_home_page_enabled');
    }
}
コード例 #12
0
 function flush_caches()
 {
     delete_transient(EXTEND_UPDATE);
     delete_transient('pagelines_extend_themes');
     delete_transient('pagelines_extend_sections');
     delete_transient('pagelines_extend_plugins');
     delete_transient('pagelines_extend_integrations');
     delete_transient('pagelines_sections_cache');
     remove_theme_mod('available_updates');
     remove_theme_mod('pending_updates');
 }
コード例 #13
0
/**
 * Set / remove theme mods to suit this theme after activation
 * @return void
 */
function g_set_theme_mods()
{
    // Reset certain theme settings from the db
    remove_theme_mod('sd_header_layout');
    remove_theme_mod('sd_button_flat');
    remove_theme_mod('sd_button_shadows');
    remove_theme_mod('sd_button_background_style');
    remove_theme_mod('sd_button_rounded');
    remove_theme_mod('sd_button_size');
    remove_theme_mod('storefront_footer_background_color');
}
コード例 #14
0
/**
 * Helper function to remove custom theme mods
 *
 * @since  1.0.0
 *
 * @param string
 * @return mixed $default
 */
function customizer_library_remove_theme_mods()
{
    $customizer_library = Customizer_Library::Instance();
    $options = $customizer_library->get_options();
    if ($options) {
        foreach ($options as $option) {
            if (isset($option['id'])) {
                remove_theme_mod($option['id']);
            }
        }
    }
}
コード例 #15
0
/**
 * Set / remove theme mods to suit this theme after activation
 * @return void
 */
function boutique_set_theme_mods()
{
    // Reset the homepage template product toggles / titles
    remove_theme_mod('swc_homepage_recent');
    remove_theme_mod('swc_homepage_recent_products_title');
    remove_theme_mod('swc_homepage_featured');
    remove_theme_mod('swc_homepage_featured_products_title');
    remove_theme_mod('swc_homepage_top_rated');
    remove_theme_mod('swc_homepage_top_rated_products_title');
    remove_theme_mod('swc_homepage_on_sale');
    remove_theme_mod('swc_homepage_on_sale_products_title');
}
コード例 #16
0
 protected function import_skin_from_file($file)
 {
     $content = $this->get_file_contents($file);
     $options = @unserialize(base64_decode($content));
     foreach ((array) $options as $key => $val) {
         set_theme_mod($key, $val);
     }
     $mods = get_theme_mods();
     foreach ($mods as $mod_key => $mod_valud) {
         if ('nav_menu_locations' != $mod_key && !isset($options[$mod_key])) {
             remove_theme_mod($mod_key);
         }
     }
 }
コード例 #17
0
 public function reset_customizer()
 {
     $settings = $this->wp_customize->settings();
     // remove theme_mod settings registered in customizer
     foreach ($settings as $setting) {
         if ('theme_mod' == $setting->type) {
             remove_theme_mod($setting->id);
         }
         if ('option' == $setting->type) {
             global $igthemes_option;
             delete_option($igthemes_option);
         }
     }
 }
コード例 #18
0
/**
 * Set / remove theme mods to suit this theme after activation
 * @return void
 */
function p_set_theme_mods()
{
    // Reset certain theme settings from the db
    remove_theme_mod('sd_header_layout');
    remove_theme_mod('sd_button_flat');
    remove_theme_mod('sd_button_shadows');
    remove_theme_mod('sd_button_background_style');
    remove_theme_mod('sd_button_rounded');
    remove_theme_mod('sd_button_size');
    remove_theme_mod('storefront_footer_background_color');
    remove_theme_mod('sd_content_background_color');
    // Set the content background color on activation
    set_theme_mod('sd_content_background_color', '#fff');
}
コード例 #19
0
 static function toggleSave()
 {
     $key = isset($_POST['option']) && $_POST['option'] ? $_POST['option'] : exit;
     if (get_theme_mod($key)) {
         remove_theme_mod($key);
         $value = 0;
         $message = __('Successful disabled option!', 'myThemes');
     } else {
         set_theme_mod($key, 1);
         $value = 1;
         $message = __('Successful enabled option!', 'myThemes');
     }
     echo str_replace('"', "'", json_encode(array('message' => $message, 'label' => ahtml::getLogicButtonValue(array('value' => $value)), 'value' => $value, 'nofade' => 0)));
     exit;
 }
コード例 #20
0
/**
 * Set / remove theme mods to suit this theme after activation
 * @return void
 */
function boutique_set_theme_mods()
{
    // Reset the homepage template product toggles / titles
    remove_theme_mod('swc_homepage_recent');
    remove_theme_mod('swc_homepage_recent_products_title');
    remove_theme_mod('swc_homepage_featured');
    remove_theme_mod('swc_homepage_featured_products_title');
    remove_theme_mod('swc_homepage_top_rated');
    remove_theme_mod('swc_homepage_top_rated_products_title');
    remove_theme_mod('swc_homepage_on_sale');
    remove_theme_mod('swc_homepage_on_sale_products_title');
    remove_theme_mod('sph_layout');
    remove_theme_mod('sph_hero_full_height');
    remove_theme_mod('sd_header_layout');
    remove_theme_mod('sd_header_sticky');
}
コード例 #21
0
ファイル: custom-404.php プロジェクト: sergey-h/naman
 /**
  * Sanitization callback
  */
 public function sanitize($options)
 {
     // Set options to theme mods
     if (isset($options['redirect'])) {
         set_theme_mod('error_page_redirect', true);
     } else {
         remove_theme_mod('error_page_redirect');
     }
     set_theme_mod('error_page_title', $options['title']);
     set_theme_mod('error_page_text', $options['text']);
     // Add notice
     add_settings_error('wpex_custom_error_page_notices', esc_attr('settings_updated'), __('Settings saved.', 'wpex'), 'updated');
     // Set options to nothing since we are storing in the theme mods
     $options = '';
     return $options;
 }
コード例 #22
0
/**
 * Set / remove theme mods to suit this theme after activation
 * @return void
 */
function deli_set_theme_mods()
{
    // Reset certain theme settings from the db
    remove_theme_mod('sd_header_layout');
    remove_theme_mod('sd_fixed_width');
    // Content frame
    remove_theme_mod('sd_button_flat');
    remove_theme_mod('sd_button_shadows');
    remove_theme_mod('sd_button_background_style');
    remove_theme_mod('sd_button_rounded');
    remove_theme_mod('sd_button_size');
    remove_theme_mod('storefront_footer_background_color');
    // Set the content background color on activation
    set_theme_mod('sd_content_background_color', '#f9f9f9');
    // Set the product column setting in the WooCommerce customiser extension
    set_theme_mod('swc_product_columns', 4);
}
コード例 #23
0
 /**
  * Sanitization callback
  *
  * @since 2.0.0
  */
 public function sanitize($options)
 {
     // Set theme mods
     if (isset($options['enable'])) {
         set_theme_mod('under_construction', true);
     } else {
         remove_theme_mod('under_construction');
     }
     if (isset($options['content_id'])) {
         set_theme_mod('under_construction_page_id', $options['content_id']);
     }
     // Add notice
     add_settings_error('wpex_custom_under_construction_notices', esc_attr('settings_updated'), __('Settings saved.', 'wpex'), 'updated');
     // Set options to nothing since we are storing in the theme mods
     $options = '';
     return $options;
 }
コード例 #24
0
 /**
  * Overwrites the `update()` method so we can save some extra data.
  *
  * @since  3.0.0
  * @access public
  * @param  string  $value
  * @return string
  */
 protected function update($value)
 {
     if ($value) {
         $post_id = attachment_url_to_postid($value);
         if ($post_id) {
             $image = wp_get_attachment_image_src($post_id);
             if ($image) {
                 // Set up a custom array of data to save.
                 $data = array('url' => esc_url_raw($image[0]), 'width' => absint($image[1]), 'height' => absint($image[2]), 'id' => absint($post_id));
                 set_theme_mod("{$this->id_data['base']}_data", $data);
             }
         }
     }
     // No media? Remove the data mod.
     if (empty($value) || empty($post_id) || empty($image)) {
         remove_theme_mod("{$this->id_data['base']}_data");
     }
     // Let's send this back up and let the parent class do its thing.
     return parent::update($value);
 }
コード例 #25
0
ファイル: legacy.php プロジェクト: alextkd/fdsmc
/**
 * Transfer theme data into new settings
 */
function siteorigin_panels_transfer_home_page()
{
    if (get_option('siteorigin_panels_home_page', false) === false && get_theme_mod('panels_home_page', false) !== false) {
        // Transfer settings from theme mods into settings
        update_option('siteorigin_panels_home_page', get_theme_mod('panels_home_page', false));
        update_option('siteorigin_panels_home_page_enabled', get_theme_mod('panels_home_page_enabled', false));
        // Remove the theme mod data
        remove_theme_mod('panels_home_page');
        remove_theme_mod('panels_home_page_enabled');
    }
    // Transfer the home page setting to a page
    if (!get_option('siteorigin_panels_home_page_id') && get_option('siteorigin_panels_home_page') && siteorigin_panels_setting('home-page')) {
        // Lets create a new page
        $page_id = wp_insert_post(array('post_title' => __('Home', 'siteorigin-panels'), 'post_status' => get_option('siteorigin_panels_home_page_enabled') ? 'publish' : 'draft', 'post_type' => 'page', 'comment_status' => 'closed'));
        update_post_meta($page_id, 'panels_data', get_option('siteorigin_panels_home_page'));
        update_post_meta($page_id, '_wp_page_template', siteorigin_panels_setting('home-template'));
        update_option('siteorigin_panels_home_page_id', $page_id);
        if (get_option('siteorigin_panels_home_page_enabled')) {
            // Lets make this page the home page
            update_option('show_on_front', 'page');
            update_option('page_on_front', $page_id);
        }
    }
}
コード例 #26
0
 /**
  * Execute custom header modification.
  *
  * @since 2.6.0
  */
 function take_action()
 {
     if (!current_user_can('edit_theme_options')) {
         return;
     }
     if (empty($_POST)) {
         return;
     }
     $this->updated = true;
     if (isset($_POST['resetheader'])) {
         check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
         remove_theme_mod('header_image');
         return;
     }
     if (isset($_POST['resettext'])) {
         check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
         remove_theme_mod('header_textcolor');
         return;
     }
     if (isset($_POST['removeheader'])) {
         check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
         set_theme_mod('header_image', 'remove-header');
         return;
     }
     if (isset($_POST['text-color'])) {
         check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
         $_POST['text-color'] = str_replace('#', '', $_POST['text-color']);
         if ('blank' == $_POST['text-color']) {
             set_theme_mod('header_textcolor', 'blank');
         } else {
             $color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);
             if (strlen($color) == 6 || strlen($color) == 3) {
                 set_theme_mod('header_textcolor', $color);
             }
         }
     }
     if (isset($_POST['default-header'])) {
         check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
         if ('random-default-image' == $_POST['default-header']) {
             set_theme_mod('header_image', 'random-default-image');
         } elseif ('random-uploaded-image' == $_POST['default-header']) {
             set_theme_mod('header_image', 'random-uploaded-image');
         } else {
             $this->process_default_headers();
             $uploaded = get_uploaded_header_images();
             if (isset($uploaded[$_POST['default-header']])) {
                 set_theme_mod('header_image', esc_url($uploaded[$_POST['default-header']]['url']));
             } elseif (isset($this->default_headers[$_POST['default-header']])) {
                 set_theme_mod('header_image', esc_url($this->default_headers[$_POST['default-header']]['url']));
             }
         }
     }
 }
コード例 #27
0
ファイル: theme.php プロジェクト: radman/noobyo-blog
/**
 * Checks an attachment being deleted to see if it's a header or background image.
 *
 * If true it removes the theme modification which would be pointing at the deleted
 * attachment
 *
 * @access private
 * @since 3.0.0
 * @param int $id the attachment id
 */
function _delete_attachment_theme_mod($id)
{
    $attachment_image = wp_get_attachment_url($id);
    $header_image = get_header_image();
    $background_image = get_background_image();
    if ($header_image && $header_image == $attachment_image) {
        remove_theme_mod('header_image');
    }
    if ($background_image && $background_image == $attachment_image) {
        remove_theme_mod('background_image');
    }
}
コード例 #28
0
 function of_options()
 {
     //Access the WordPress Categories via an Array
     $of_categories = $of_categories_pure = 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_pure = $of_categories;
     $categories_tmp = array_unshift($of_categories, "Select a category:");
     //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:");
     //Stylesheets Reader
     $alt_stylesheet_path = LAYOUT_PATH;
     $alt_stylesheets = array();
     if (is_dir($alt_stylesheet_path)) {
         if ($alt_stylesheet_dir = opendir($alt_stylesheet_path)) {
             while (($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false) {
                 if (stristr($alt_stylesheet_file, ".css") !== false) {
                     $alt_stylesheets[] = $alt_stylesheet_file;
                 }
             }
         }
     }
     //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;
                 }
             }
         }
     }
     include_once file_require(ADMIN_PATH . 'functions/google-fonts.php');
     $google_fonts = get_google_webfonts();
     $google_webfonts["default"] = "Default (Helvetica, Arial, sans-serif)";
     foreach ($google_fonts as $font) {
         $google_webfonts[$font['family']] = $font['family'];
     }
     /* ----------------------------------------------------------------------------------- */
     /* 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");
     $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");
     // 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 */
     /* ----------------------------------------------------------------------------------- */
     global $of_options, $tt_social_icons, $tt_sidebars;
     $of_options = array();
     $url = ADMIN_IMAGES;
     /* General settings
      ***********************************************************************/
     $of_options[] = array("name" => "General Settings", "type" => "heading");
     $of_options[] = array("name" => "CSS Tips!", "std" => "<div style='font-size:14px;'>Please visit the <a target='_blank' href='" . admin_url() . "customize.php'>Site Customize</a> page and change your site's <strong>Logo</strong>, <strong>Color scheme</strong> and <strong>Font options</strong> . And if you don't want to use those changes any more, you should reset them with following options and turn theme back to default.</div>", "icon" => true, "type" => "info");
     $of_options[] = array("name" => "Tracking Code", "desc" => "Add your <a href='http://analytics.google.com' target='_blank'>Google Analytics</a> or other tracking code here. This will be added into the footer of your site.", "id" => "site_analytics", "std" => "", "type" => "textarea");
     $of_options[] = array("name" => "Remove Heart Likes", "desc" => "If you don't need any heart/like section on post and widget section, please turn this option ON.", "id" => "remove_heart", "std" => 0, "type" => "switch");
     /* Page builder settings 
      ***********************************************************************/
     $of_options[] = array("name" => "Page Builder", "type" => "info", "std" => "<h3>Page Builder</h3>");
     $of_options[] = array("name" => "", "desc" => "For Posts", "id" => "pb_posts", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "", "desc" => "For Pages", "id" => "pb_pages", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "", "desc" => "For Portfolio", "id" => "pb_port", "std" => 1, "type" => "switch");
     /*
     $of_options[] = array("name" => "For all other post types",
         "desc" => "Controls page builder range on your custom post types.",
         "id" => "pb_other",
         "std" => 0,
         "type" => "switch"
     );
     */
     /* Top Bar settings 
      ***********************************************************************/
     $of_options[] = array("name" => "Top Bar", "type" => "heading");
     $topBarOptions = array('none' => 'Select Item', 'text1' => 'Text 1', 'text2' => 'Text 2', 'shop' => 'Shop cart', 'lang' => 'Language widget of WPML', 'social' => 'Social icons', 'login' => 'Login link', 'menu' => 'Custom menu');
     $of_options[] = array("name" => "Enable Top Bar", "desc" => "", "id" => "top_bar", "std" => 1, "folds" => 1, "type" => "switch");
     $of_options[] = array("name" => "Top Bar (Left)", "desc" => "Please add elements here and order them with mouse drag & drop.", "id" => "top_bar_left_select", "std" => '', "fold" => "top_bar", "type" => "select", "multiple" => false, "options" => $topBarOptions);
     $of_options[] = array("name" => "Top Bar (Left)", "desc" => "", "id" => "top_bar_left", "std" => "text1", "type" => "text");
     $of_options[] = array("name" => "Top Bar (Right)", "desc" => "Please add elements here and order them with mouse drag & drop.", "id" => "top_bar_right_select", "std" => '', "fold" => "top_bar", "type" => "select", "multiple" => false, "options" => $topBarOptions);
     $of_options[] = array("name" => "Top Bar (Right)", "desc" => "", "id" => "top_bar_right", "std" => "login,social,shop", "type" => "text");
     $of_options[] = array("name" => "Text content 1", "desc" => "Please add text content for your top bar.", "id" => "top_bar_text1", "std" => 'Hey there! Welcome to the new site :)', "fold" => "top_bar", "type" => "textarea");
     $of_options[] = array("name" => "Text content 2", "desc" => "Please add text content for your top bar.", "id" => "top_bar_text2", "std" => 'text', "fold" => "top_bar", "type" => "textarea");
     $of_options[] = array("name" => "Social Profiles on Top Bar", "id" => "social_addresses", "fold" => "top_bar", "std" => "<h3>Social Profiles on Top Bar</h3>", "type" => "info");
     foreach ($tt_social_icons as $id => $value) {
         $of_options[] = array("name" => "", "desc" => ucfirst($id) . " address", "id" => "social_" . $id, "fold" => "top_bar", "std" => "", "type" => "text");
     }
     $of_options[] = array("name" => "social_tip", "std" => "<h3 style='margin: 0 0 10px'>Add Custom Social Profile</h3>\n                Here I've added some popular socials. If your familiar social site doesn't have here, you can extend those as following.\n                <p> Please open up the <em>framework/common-functions.php</em> file from theme directory and find <strong>tt_social_icons</strong> array which locates at the top of the file.\n                This is a very popular array that saves social list for above options and widget socials too. So now we need to extend it with our new socials same as their structure (as Name and Icon code). You should find a proper icon for your new social from <a href='http://fortawesome.github.io/Font-Awesome/cheatsheet/' target='_blank'>FontAwesome library</a>.\n                </p>\n                <p>Also you can <strong>reorder</strong> those there.</p>", "icon" => true, "type" => "info");
     /* Post options
      ***********************************************************************/
     $of_options[] = array("name" => "Post And Page", "type" => "heading");
     $of_options[] = array("name" => "Post Options", "std" => "<h3>Post Options</h3>", "type" => "info");
     $of_options[] = array("name" => "Post Format in Single", "desc" => "If you turned this option OFF, post format content won't show on single post pages.", "id" => "show_post_format", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "Related Posts", "desc" => "Related posts on bottom of post content in single post page.", "id" => "related_posts", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "Author box on Posts", "desc" => "", "id" => "post_author", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "Comment on Posts", "desc" => "WordPress has its own way to disable comments in a Post. But you should turn this option OFF if you want to remove comments for all your posts.", "id" => "post_comment", "std" => 1, "type" => "switch");
     /* Page settings
      ***********************************************************************/
     $of_options[] = array("name" => "Page Options", "std" => "<h3>Page Options</h3>", "type" => "info");
     $of_options[] = array("name" => "Author box on Pages", "desc" => "", "id" => "page_author", "std" => 0, "type" => "switch");
     $of_options[] = array("name" => "Comment on Pages", "desc" => "WordPress has its own way to disable comments in a Page. But you should turn this option OFF if you want to remove comments for all your pages.", "id" => "page_comment", "std" => 1, "type" => "switch");
     /* Portfolio
      ***********************************************************************/
     $of_options[] = array("name" => "Portfolio Options", "type" => "heading");
     $of_options[] = array("name" => "Portfolio Slug", "type" => "text", "id" => "portfolio_slug", "desc" => "Portfolio slug that should be show at url for portfolio single items.", "std" => "portfolio-item");
     $of_options[] = array("name" => "Portfolio Columns", "desc" => "Item column on Taxonomy / Category page. You can select 2, 3 and 4 columns layout.", "id" => "portfolio_layout", "std" => "grid3", "type" => "images", "options" => array('grid2' => $url . 'blog-grid2.png', 'grid3' => $url . 'blog-grid3.png', 'grid4' => $url . 'blog-grid4.png'));
     $sidebar_layouts = array('right' => $url . '2cr.png', 'left' => $url . '2cl.png', 'full' => $url . '1col.png');
     $of_options[] = array("name" => "Portolio Sidebar Type", "desc" => "", "id" => "portfolio_sidebar_type", "std" => "full", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Portfolio Sidebar", "desc" => "", "id" => "portfolio_sidebar", "std" => "portfolio-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "Single Layout", "desc" => "", "id" => "portfolio_single_layout", "std" => "full", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Single Sidebar", "desc" => "", "id" => "portfolio_single_sidebar", "std" => "portfolio-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "Comment on Portfolio item page", "desc" => "WordPress has its own way to disable comments in a Page. But you should turn this option OFF if you want to remove comments for all your pages.", "id" => "port_comment", "std" => 0, "type" => "switch");
     $of_options[] = array("name" => "Portfolio Next Prev Links at Top", "desc" => "You can turn off <a href='http://d.pr/i/SK3g' target='_blank'>Next Preview and Main page links</a> at right bottom on single portfolio page.", "id" => "port_next_prev_links", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "Main Portfolio Page", "desc" => "A page which shows when click on View all button from single portfolio item.", "id" => "portfolio_page", "std" => "", "type" => "select", "options" => $of_pages);
     $of_options[] = array("name" => "Portfolio Related Posts at Bottom", "desc" => "Portfolio Related Posts at bottom of your portfolio item page.", "id" => "port_related", "std" => 1, "type" => "switch");
     /* Archive and Category layout
      ***********************************************************************/
     $of_options[] = array("name" => "Archive Category Tags", "type" => "heading");
     $of_options[] = array("name" => "", "std" => "<h3>Category Layout</h3>", "type" => "info");
     $loop_layouts = array('regular' => $url . 'blog-regular.png', 'grid2' => $url . 'blog-grid2.png', 'grid3' => $url . 'blog-grid3.png', 'grid4' => $url . 'blog-grid4.png', 'masonry2' => $url . 'blog-masonry2.png', 'masonry3' => $url . 'blog-masonry3.png', 'masonry4' => $url . 'blog-masonry4.png');
     $of_options[] = array("name" => "", "desc" => "", "id" => "category_layout", "std" => "regular", "type" => "images", "options" => $loop_layouts);
     $of_options[] = array("name" => "Category Sidebar Type", "desc" => "", "id" => "category_sidebar_type", "std" => "right", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Category Sidebar", "desc" => "", "id" => "category_sidebar", "std" => "blog-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "", "std" => "<h3>Archive Layout</h3>", "type" => "info");
     $of_options[] = array("name" => "Archive Layout", "desc" => "", "id" => "archive_layout", "std" => "regular", "type" => "images", "options" => $loop_layouts);
     $of_options[] = array("name" => "Archive Sidebar Type", "desc" => "", "id" => "archive_sidebar_type", "std" => "right", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Archive Sidebar", "desc" => "", "id" => "archive_sidebar", "std" => "blog-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "", "std" => "<h3>Tag Layout</h3>", "type" => "info");
     $of_options[] = array("name" => "Tag Layout", "desc" => "", "id" => "tag_layout", "std" => "regular", "type" => "images", "options" => $loop_layouts);
     $of_options[] = array("name" => "Tag Sidebar Type", "desc" => "", "id" => "tag_sidebar_type", "std" => "right", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Tag Sidebar", "desc" => "", "id" => "tag_sidebar", "std" => "blog-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "", "std" => "<h3>Search Result Layout</h3>", "type" => "info");
     $of_options[] = array("name" => "", "desc" => "", "id" => "search_layout", "std" => "regular", "type" => "images", "options" => $loop_layouts);
     $of_options[] = array("name" => "Search Sidebar Type", "desc" => "", "id" => "search_sidebar_type", "std" => "right", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Search Sidebar", "desc" => "", "id" => "search_sidebar", "std" => "blog-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "", "std" => "<h3>Author Page Layout</h3>", "type" => "info");
     $of_options[] = array("name" => "", "desc" => "", "id" => "author_layout", "std" => "regular", "type" => "images", "options" => $loop_layouts);
     $of_options[] = array("name" => "Sidebar Type on Author Page", "desc" => "", "id" => "author_sidebar_type", "std" => "right", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Author Sidebar", "desc" => "", "id" => "author_sidebar", "std" => "blog-sidebar", "type" => "select", "options" => $tt_sidebars);
     /* WooCommerce Options
      ***********************************************************************/
     $of_options[] = array("name" => "WooCommerce", "type" => "heading");
     $of_options[] = array("name" => "WooCommerce Page Layout", "desc" => "", "id" => "woo_layout", "std" => "full", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "WooCommerce Sidebar", "desc" => "", "id" => "woo_sidebar", "std" => "woocommerce-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "Product Single Layout", "desc" => "", "id" => "product_layout", "std" => "right", "type" => "images", "options" => $sidebar_layouts);
     $of_options[] = array("name" => "Product Single Sidebar", "desc" => "", "id" => "product_sidebar", "std" => "woocommerce-sidebar", "type" => "select", "options" => $tt_sidebars);
     $of_options[] = array("name" => "Product Overlay Transition", "desc" => "Choose whether you would like the product overlay transition to be enabled.", "id" => "woo_overlay", "std" => 1, "type" => "switch");
     /* Social Options
      ***********************************************************************/
     $of_options[] = array("name" => "Share and Socials", "type" => "heading");
     $share_buttons = array("facebook" => "Facebook", "twitter" => "Twitter", "googleplus" => "Google+", "pinterest" => "Pinterest", 'email' => 'Email');
     $of_options[] = array("name" => "Share Buttons", "desc" => "", "id" => "share_buttons", "std" => array('facebook', 'twitter', 'googleplus', 'pinterest', 'email'), "type" => "multicheck", "options" => $share_buttons);
     $share_visibility = array("share_posts" => "On Posts", "share_pages" => "On Pages", "share_port" => "On Portfolio entries");
     $of_options[] = array("name" => "Visibility of Share Buttons", "desc" => "", "id" => "share_visibility", "std" => 1, "type" => "multicheck", "options" => $share_visibility);
     /* Sidebar Options
      ***********************************************************************/
     $of_options[] = array("name" => "Custom Sidebar", "type" => "heading");
     $of_options[] = array("name" => "Custom sidebar", "desc" => "You can create unlimited siderbars for your site. You should add widgets on <strong>Appearance=><a href='widgets.php'>Widgets</a></strong> after you have added new sidebar here.", "id" => "custom_sidebar", "type" => "sidebar", "std" => "");
     /* Footer Options
      ***********************************************************************/
     $of_options[] = array("name" => "Footer Options", "type" => "heading");
     $of_options[] = array("name" => "Enable Footer", "desc" => "", "id" => "footer", "std" => 1, "type" => "switch");
     $of_options[] = array("name" => "Footer Layout", "desc" => "Those are general footer layouts. If you need more creative footer area there, you should select Footer layout #1 and add your layout content there. It is possible to add page layout shortcode in here with text widget.", "id" => "footer_layout", "std" => "6", "type" => "images", "options" => array('1' => $url . 'footer1.png', '2' => $url . 'footer2.png', '3' => $url . 'footer3.png', '4' => $url . 'footer4.png', '5' => $url . 'footer5.png', '6' => $url . 'footer6.png'));
     $of_options[] = array("name" => "Footer Background Image", "desc" => "Select a background image or pattern.", "id" => "footer_bg_image", "std" => "", "type" => "media");
     $of_options[] = array("name" => "", "desc" => "Repeat", "id" => "footer_bg_repeat", "std" => "", "type" => "select", "options" => $body_repeat);
     $of_options[] = array("name" => "", "desc" => "Position", "id" => "footer_bg_position", "std" => "", "type" => "select", "options" => $body_pos);
     $of_options[] = array("name" => "", "desc" => "Fixed or Scroll", "id" => "footer_bg_fixed", "std" => "scroll", "type" => "select", "options" => array('scroll', 'fixed'));
     /* Footer Bar options
      ***********************************************************************/
     $of_options[] = array("name" => "Footer Bar", "type" => "heading");
     $of_options[] = array("name" => "Footer Bar", "desc" => "", "id" => "sub_footer", "std" => 1, "folds" => 1, "type" => "switch");
     $footerBarOptions = array('none' => 'Select item', 'text1' => 'Text 1', 'text2' => 'Text 2', 'lang' => 'Language widget', 'social' => 'Social icons', 'menu' => 'Custom menu');
     $of_options[] = array("name" => "Footer Bar (Left)", "desc" => "Please add elements here and order them with mouse drag & drop.", "id" => "sub_footer_left_select", "std" => 'text1', "fold" => "sub_footer", "type" => "select", "options" => $footerBarOptions);
     $of_options[] = array("name" => "Footer Bar (Left)", "desc" => "", "id" => "sub_footer_left", "std" => "text1", "type" => "text");
     $of_options[] = array("name" => "Footer Bar (Right)", "desc" => "Please add elements here and order them with mouse drag & drop.", "id" => "sub_footer_right_select", "std" => '', "fold" => "sub_footer", "type" => "select", "options" => $footerBarOptions);
     $of_options[] = array("name" => "Footer Bar (Right)", "desc" => "", "id" => "sub_footer_right", "std" => "text2", "type" => "text");
     $of_options[] = array("name" => "Footer Text 1", "desc" => "", "id" => "footer_bar_text1", "fold" => "sub_footer", "std" => "Powered by WordPress. Developed by <a href='http://themeton.com'>ThemeTon</a>.", "type" => "textarea");
     $of_options[] = array("name" => "Footer Text 2", "desc" => "", "id" => "footer_bar_text2", "fold" => "sub_footer", "std" => "Copyright &copy; 2014.", "type" => "textarea");
     $of_options[] = array("name" => "", "std" => "<h3>Social Profiles on Sub Footer Bar</h3>", "type" => "info");
     $of_options[] = array("name" => "", "desc" => "", "id" => "social_addresses_f", "fold" => "sub_footer", "std" => "", "type" => "");
     foreach ($tt_social_icons as $id => $value) {
         $of_options[] = array("name" => "", "desc" => ucfirst($id) . " address", "id" => "footer_social_" . $id, "fold" => "sub_footer", "std" => "", "type" => "text");
     }
     /* CUSTOM CSS
      ***********************************************************************/
     $of_options[] = array("name" => "LESS", "type" => "heading");
     /* Restore theme options */
     $less_theme_variables_opt = get_theme_mod("less_theme_variables");
     $tmp_arr = array();
     if (!empty($less_theme_variables_opt)) {
         $tmp = unserialize(base64_decode($less_theme_variables_opt));
         if (is_array($tmp)) {
             $tmp_arr = $tmp;
         }
     }
     if (count($tmp_arr) < 1 && get_theme_mod('less-brand-primary') != "") {
         $lessvars = get_less_variables();
         $restored_vars = array();
         foreach ($lessvars as $opt) {
             if ($opt['variable'] != 'less-heading') {
                 $vl = get_theme_mod('less-' . $opt['variable']);
                 remove_theme_mod('less-' . $opt['variable']);
                 $val = $opt['value'];
                 if (!empty($vl) && $vl != $opt['value']) {
                     $val = $vl;
                 }
                 $restored_vars = array_merge($restored_vars, array($opt['variable'] => $val));
             }
         }
         // Save LESS Variables
         if (!empty($restored_vars)) {
             $encoded_str = base64_encode(serialize($restored_vars));
             set_theme_mod("less_theme_variables", $encoded_str);
         }
     } elseif (count($tmp_arr) < 1) {
         $less_vars = array();
         $less_options = get_less_variables();
         foreach ($less_options as $opt) {
             if ($opt['variable'] != 'less-heading' && !empty($opt['variable']) && !empty($opt['value'])) {
                 $less_vars = array_merge($less_vars, array($opt['variable'] => $opt['value']));
             }
             $encoded_str = base64_encode(serialize($less_vars));
             set_theme_mod("less_theme_variables", $encoded_str);
         }
     }
     /* Reformating Theme Option Less Editor */
     $less_content_data = get_less_editor_content($less_theme_variables_opt);
     if (isset($smof_data['less_editor'])) {
         $smof_data['less_editor'] = $less_content_data;
     }
     set_theme_mod('less_editor', $less_content_data);
     $of_options[] = array("name" => "LESS Editor", "desc" => "LESS Code Editor", "id" => "less_editor", "std" => $less_content_data, "type" => "textarea");
     /* CUSTOM CSS
      ***********************************************************************/
     $of_options[] = array("name" => "Custom CSS", "type" => "heading");
     $of_options[] = array("name" => "CSS Tips!", "std" => "<h3 style=\"margin: 0 0 10px;\">Tips, Before customizing</h3>\n                Control everything is impossible with options. Therefore we have to use custom styling for our sites if we have deep changes. \n                You can make your changes in css files but it doesn't safe and probably you lose those for next version updates of the theme. Then I suggest you to use following options. It is a safe place :)\n\n                <p>If you don't have enough experience with CSS and selectors, you should visit following links\n                <ul style='margin-left:20px'>\n                    <li> - Learn about <a href='http://www.w3schools.com/cssref/css_selectors.asp' target='_blank'>CSS selectors</a></li>\n                    <li> - Learn about <a href='http://net.tutsplus.com/tutorials/html-css-techniques/the-30-css-selectors-you-must-memorize/' target='_blank'>CSS selectors</a> by Jeffrey Way</li>\n                    <li> - How to use <a href='http://www.youtube.com/watch?v=nOEw9iiopwI' target='_blank'>Chrome Inspector</a></li>\n                    <li> - How to use <a href='http://www.youtube.com/watch?v=3KdNRZS-uSg' target='_blank'>Mozilla Firebug</a> for editing css</li>\n                </ul>\n                </p>", "icon" => true, "type" => "info");
     $of_options[] = array("name" => "Custom CSS (General)", "desc" => "", "id" => "custom_css", "std" => "", "type" => "textarea");
     $of_options[] = array("name" => "For Tablets", "desc" => "Screen width between 768px and 985px", "id" => "tablet_css", "std" => "", "type" => "textarea");
     $of_options[] = array("name" => "For Wide Phones", "desc" => "Screen width between 480px and 767px", "id" => "wide_phone_css", "std" => "", "type" => "textarea");
     $of_options[] = array("name" => "For Phone", "desc" => "Screen width up to 479px", "id" => "phone_css", "std" => "", "type" => "textarea");
     /* Backup and Restore
      ***********************************************************************/
     $of_options[] = array("name" => "Backup Options", "type" => "heading");
     $of_options[] = array("name" => "Backup and Restore Options", "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.');
     $of_options[] = array("name" => "Transfer Theme Options Data", "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".');
 }
コード例 #29
0
ファイル: theme.php プロジェクト: ptahdunbar/wp-cli
 /**
  * Remove theme mod(s).
  *
  * ## OPTIONS
  *
  * [<mod>...]
  * : One or more mods to remove.
  *
  * [--all]
  * : Remove all theme mods
  *
  * ## EXAMPLES
  *
  *     wp theme mod remove --all
  *     wp theme mod remove background_color
  *     wp theme mod remove background_color header_textcolor
  */
 public function remove($args = array(), $assoc_args = array())
 {
     if (!isset($assoc_args['all']) && empty($args)) {
         WP_CLI::error("You must specify at least one mod or use --all.");
     }
     if (isset($assoc_args['all']) && $assoc_args['all']) {
         remove_theme_mods();
         WP_CLI::success('Theme mods removed.');
         return;
     }
     foreach ($args as $mod) {
         remove_theme_mod($mod);
     }
     WP_CLI::success(sprintf('%d mods removed.', count($args)));
 }
コード例 #30
0
function retrieve_widgets($theme_changed = false)
{
    global $wp_registered_widget_updates, $wp_registered_sidebars, $sidebars_widgets, $wp_registered_widgets;
    $registered_sidebar_keys = array_keys($wp_registered_sidebars);
    $orphaned = 0;
    $old_sidebars_widgets = get_theme_mod('sidebars_widgets');
    if (is_array($old_sidebars_widgets)) {
        // time() that sidebars were stored is in $old_sidebars_widgets['time']
        $_sidebars_widgets = $old_sidebars_widgets['data'];
        remove_theme_mod('sidebars_widgets');
        foreach ($_sidebars_widgets as $sidebar => $widgets) {
            if ('wp_inactive_widgets' == $sidebar || 'orphaned_widgets' == substr($sidebar, 0, 16)) {
                continue;
            }
            if (!in_array($sidebar, $registered_sidebar_keys)) {
                $_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $widgets;
                unset($_sidebars_widgets[$sidebar]);
            }
        }
    } else {
        if (empty($sidebars_widgets)) {
            return;
        }
        unset($sidebars_widgets['array_version']);
        $old = array_keys($sidebars_widgets);
        sort($old);
        sort($registered_sidebar_keys);
        if ($old == $registered_sidebar_keys) {
            return;
        }
        $_sidebars_widgets = array('wp_inactive_widgets' => !empty($sidebars_widgets['wp_inactive_widgets']) ? $sidebars_widgets['wp_inactive_widgets'] : array());
        unset($sidebars_widgets['wp_inactive_widgets']);
        foreach ($wp_registered_sidebars as $id => $settings) {
            if ($theme_changed) {
                $_sidebars_widgets[$id] = array_shift($sidebars_widgets);
            } else {
                // no theme change, grab only sidebars that are currently registered
                if (isset($sidebars_widgets[$id])) {
                    $_sidebars_widgets[$id] = $sidebars_widgets[$id];
                    unset($sidebars_widgets[$id]);
                }
            }
        }
        foreach ($sidebars_widgets as $val) {
            if (is_array($val) && !empty($val)) {
                $_sidebars_widgets['orphaned_widgets_' . ++$orphaned] = $val;
            }
        }
    }
    // discard invalid, theme-specific widgets from sidebars
    $shown_widgets = array();
    foreach ($_sidebars_widgets as $sidebar => $widgets) {
        if (!is_array($widgets)) {
            continue;
        }
        $_widgets = array();
        foreach ($widgets as $widget) {
            if (isset($wp_registered_widgets[$widget])) {
                $_widgets[] = $widget;
            }
        }
        $_sidebars_widgets[$sidebar] = $_widgets;
        $shown_widgets = array_merge($shown_widgets, $_widgets);
    }
    $sidebars_widgets = $_sidebars_widgets;
    unset($_sidebars_widgets, $_widgets);
    // find hidden/lost multi-widget instances
    $lost_widgets = array();
    foreach ($wp_registered_widgets as $key => $val) {
        if (in_array($key, $shown_widgets, true)) {
            continue;
        }
        $number = preg_replace('/.+?-([0-9]+)$/', '$1', $key);
        if (2 > (int) $number) {
            continue;
        }
        $lost_widgets[] = $key;
    }
    $sidebars_widgets['wp_inactive_widgets'] = array_merge($lost_widgets, (array) $sidebars_widgets['wp_inactive_widgets']);
    wp_set_sidebars_widgets($sidebars_widgets);
    return $sidebars_widgets;
}