/**
  * Export Data option type.
  */
 function ot_type_export_data()
 {
     /* format setting outer wrapper */
     echo '<div class="format-setting type-textarea simple">';
     /* get theme options data */
     $data = get_option(ot_options_id());
     $data = !empty($data) ? ot_encode(serialize($data)) : '';
     echo '<div class="format-setting-inner">' . PHP_EOL;
     echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>' . PHP_EOL;
     echo '</div>' . PHP_EOL;
     echo '</div>' . PHP_EOL;
 }
Пример #2
0
 function ot_type_export_data()
 {
     /* format setting outer wrapper */
     echo '<div class="format-setting type-textarea simple has-desc">';
     /* description */
     echo '<div class="description">';
     echo '<p>' . __('Export your Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>Import/export->Import</code> <strong>Theme Options</strong> textarea on another web site.', 'option-tree') . '</p>';
     echo '</div>';
     /* get theme options data */
     $data = get_option(ot_options_id());
     $data = !empty($data) ? ot_encode(serialize($data)) : '';
     echo '<div class="format-setting-inner">';
     echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>';
     echo '</div>';
     echo '</div>';
 }
 function ot_type_export_data()
 {
     /* format setting outer wrapper */
     echo '<div class="format-setting type-textarea simple has-desc">';
     /* description */
     echo '<div class="description">';
     echo '<p>' . __('Export your Theme Options data by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> <strong>Theme Options</strong> textarea on another web site.', 'themecountry') . '</p>';
     echo '</div>';
     /* get theme options data */
     $data = get_option('option_tree');
     $data = !empty($data) ? ot_encode(serialize($data)) : '';
     echo '<div class="format-setting-inner">';
     echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea tc-export-data">' . $data . '</textarea>';
     echo '<span id="btn-copy-theme-data" data-clipboard-target="export_data" class="option-tree-ui-button button button-primary right">Copy Data</span>';
     echo '</div>';
     echo '</div>';
 }
 /**
  * Loads the content for each page
  *
  * @return    string
  *
  * @access    public
  * @since     2.0
  */
 public function display_page()
 {
     $screen = get_current_screen();
     /* loop through settings */
     foreach ((array) $this->options as $option) {
         /* loop through pages */
         foreach ((array) $this->get_pages($option) as $page) {
             /* verify page */
             if (!isset($page['hidden_page']) && $screen->id == $this->page_hook[$page['id']]) {
                 $show_buttons = isset($page['show_buttons']) && $page['show_buttons'] == false ? false : true;
                 /* update active layout content */
                 if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
                     $layouts = get_option('option_tree_layouts');
                     /* has active layout */
                     if (isset($layouts['active_layout'])) {
                         $option_tree = get_option($option['id']);
                         $layouts[$layouts['active_layout']] = ot_encode(serialize($option_tree));
                         update_option('option_tree_layouts', $layouts);
                     }
                 }
                 echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
                 screen_icon(isset($page['screen_icon']) ? $page['screen_icon'] : 'options-general');
                 echo '<h2>' . $page['page_title'] . '</h2>';
                 echo ot_alert_message($page);
                 settings_errors('option-tree');
                 /* Header */
                 echo '<div id="option-tree-header-wrap">';
                 echo '<ul id="option-tree-header">';
                 echo '<li id="option-tree-logo"><a href="http://wordpress.org/extend/plugins/option-tree/" target="_blank">OptionTree</a></li>';
                 echo '<li id="option-tree-version"><span>Version ' . OT_VERSION . '</span></li>';
                 echo '</ul>';
                 /* layouts form */
                 if ($page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true) {
                     ot_theme_options_layouts_form();
                 }
                 echo '</div>';
                 /* remove forms on the custom settings pages */
                 if ($show_buttons) {
                     echo '<form action="options.php" method="post" id="option-tree-settings-api">';
                     settings_fields($option['id']);
                 } else {
                     echo '<div id="option-tree-settings-api">';
                 }
                 /* Sub Header */
                 echo '<div id="option-tree-sub-header">';
                 if ($show_buttons) {
                     echo '<button class="option-tree-ui-button blue right">' . $page['button_text'] . '</button>';
                 }
                 echo '</div>';
                 /* Navigation */
                 echo '<div class="ui-tabs">';
                 /* check for sections */
                 if (isset($page['sections']) && count($page['sections']) > 0) {
                     echo '<ul class="ui-tabs-nav">';
                     /* loop through page sections */
                     foreach ((array) $page['sections'] as $section) {
                         echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
                     }
                     echo '</ul>';
                 }
                 /* sections */
                 echo '<div id="poststuff" class="metabox-holder">';
                 echo '<div id="post-body">';
                 echo '<div id="post-body-content">';
                 $this->do_settings_sections($_GET['page']);
                 echo '</div>';
                 echo '</div>';
                 echo '</div>';
                 echo '<div class="clear"></div>';
                 echo '</div>';
                 /* buttons */
                 if ($show_buttons) {
                     echo '<div class="option-tree-ui-buttons">';
                     echo '<button class="option-tree-ui-button blue right">' . $page['button_text'] . '</button>';
                     echo '</div>';
                 }
                 echo $show_buttons ? '</form>' : '</div>';
                 /* reset button */
                 if ($show_buttons) {
                     echo '<form method="post" action="' . str_replace('&settings-updated=true', '', $_SERVER["REQUEST_URI"]) . '">';
                     /* form nonce */
                     wp_nonce_field('option_tree_reset_form', 'option_tree_reset_nonce');
                     echo '<input type="hidden" name="action" value="reset" />';
                     echo '<button type="submit" class="option-tree-ui-button red left reset-settings" title="' . __('Reset Options', 'option-tree') . '">' . __('Reset Options', 'option-tree') . '</button>';
                     echo '</form>';
                 }
                 echo '</div>';
             }
         }
     }
     return false;
 }
 function ot_type_social_links($args = array())
 {
     /* turns arguments array into variables */
     extract($args);
     /* Load the default social links */
     if (empty($field_value) && apply_filters('ot_type_social_links_load_defaults', true, $field_id)) {
         $field_value = apply_filters('ot_type_social_links_defaults', array(array('name' => __('Facebook', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Twitter', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Google+', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('LinkedIn', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Pinterest', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Youtube', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Dribbble', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Github', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Forrst', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Digg', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Delicious', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Tumblr', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Skype', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('SoundCloud', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Vimeo', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('Flickr', 'option-tree'), 'title' => '', 'href' => ''), array('name' => __('VK.com', 'option-tree'), 'title' => '', 'href' => '')), $field_id);
     }
     /* verify a description */
     $has_desc = $field_desc ? true : false;
     /* format setting outer wrapper */
     echo '<div class="format-setting type-social-list-item ' . ($has_desc ? 'has-desc' : 'no-desc') . '">';
     /* description */
     echo $has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : '';
     /* format setting inner wrapper */
     echo '<div class="format-setting-inner">';
     /* pass the settings array arround */
     echo '<input type="hidden" name="' . esc_attr($field_id) . '_settings_array" id="' . esc_attr($field_id) . '_settings_array" value="' . ot_encode(serialize($field_settings)) . '" />';
     /** 
      * settings pages have array wrappers like 'option_tree'.
      * So we need that value to create a proper array to save to.
      * This is only for NON metabox settings.
      */
     if (!isset($get_option)) {
         $get_option = '';
     }
     /* build list items */
     echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($field_id) . '" data-id="' . esc_attr($post_id) . '" data-get-option="' . esc_attr($get_option) . '" data-type="' . esc_attr($type) . '">';
     if (is_array($field_value) && !empty($field_value)) {
         foreach ($field_value as $key => $link) {
             echo '<li class="ui-state-default list-list-item">';
             ot_social_links_view($field_id, $key, $link, $post_id, $get_option, $field_settings, $type);
             echo '</li>';
         }
     }
     echo '</ul>';
     /* button */
     echo '<a href="javascript:void(0);" class="option-tree-social-links-add option-tree-ui-button button button-primary right hug-right" title="' . __('Add New', 'option-tree') . '">' . __('Add New', 'option-tree') . '</a>';
     /* description */
     echo '<div class="list-item-description">' . apply_filters('ot_social_links_description', __('You can re-order with drag & drop, the order will update after saving.', 'option-tree'), $field_id) . '</div>';
     echo '</div>';
     echo '</div>';
 }
 function ot_modify_layouts()
 {
     /* check and verify modify layouts nonce */
     if (isset($_POST['option_tree_modify_layouts_nonce']) && wp_verify_nonce($_POST['option_tree_modify_layouts_nonce'], 'option_tree_modify_layouts_form')) {
         /* previous layouts value */
         $option_tree_layouts = get_option(ot_layouts_id());
         /* new layouts value */
         $layouts = isset($_POST[ot_layouts_id()]) ? $_POST[ot_layouts_id()] : '';
         /* rebuild layout array */
         $rebuild = array();
         /* validate layouts */
         if (is_array($layouts) && !empty($layouts)) {
             /* setup active layout */
             if (isset($layouts['active_layout']) && !empty($layouts['active_layout'])) {
                 $rebuild['active_layout'] = $layouts['active_layout'];
             }
             /* add new and overwrite active layout */
             if (isset($layouts['_add_new_layout_']) && !empty($layouts['_add_new_layout_'])) {
                 $rebuild['active_layout'] = ot_sanitize_layout_id($layouts['_add_new_layout_']);
                 $rebuild[$rebuild['active_layout']] = ot_encode(serialize(get_option(ot_options_id())));
             }
             $first_layout = '';
             /* loop through layouts */
             foreach ($layouts as $key => $layout) {
                 /* skip over active layout key */
                 if ($key == 'active_layout') {
                     continue;
                 }
                 /* check if the key exists then set value */
                 if (isset($option_tree_layouts[$key]) && !empty($option_tree_layouts[$key])) {
                     $rebuild[$key] = $option_tree_layouts[$key];
                     if ('' == $first_layout) {
                         $first_layout = $key;
                     }
                 }
             }
             if (isset($rebuild['active_layout']) && !isset($rebuild[$rebuild['active_layout']]) && !empty($first_layout)) {
                 $rebuild['active_layout'] = $first_layout;
             }
         }
         /* default message */
         $message = 'failed';
         /* is array: save & show success message */
         if (count($rebuild) > 1) {
             /* rebuild the theme options */
             $rebuild_option_tree = unserialize(ot_decode($rebuild[$rebuild['active_layout']]));
             if (is_array($rebuild_option_tree)) {
                 /* execute the action hook and pass the theme options to it */
                 do_action('ot_before_theme_options_save', $rebuild_option_tree);
                 update_option(ot_options_id(), $rebuild_option_tree);
             }
             /* rebuild the layouts */
             update_option(ot_layouts_id(), $rebuild);
             /* change message */
             $message = 'success';
         } else {
             if (count($rebuild) <= 1) {
                 /* delete layouts option */
                 delete_option(ot_layouts_id());
                 /* change message */
                 $message = 'deleted';
             }
         }
         /* redirect */
         if (isset($_REQUEST['page']) && $_REQUEST['page'] == apply_filters('ot_theme_options_menu_slug', 'ot-theme-options')) {
             $query_args = add_query_arg(array('settings-updated' => 'layout'), remove_query_arg(array('action', 'message'), $_POST['_wp_http_referer']));
         } else {
             $query_args = add_query_arg(array('action' => 'save-layouts', 'message' => $message), $_POST['_wp_http_referer']);
         }
         wp_redirect($query_args);
         exit;
     }
     return false;
 }
 function ot_type_slider($args = array())
 {
     /* turns arguments array into variables */
     extract($args);
     /* verify a description */
     $has_desc = $field_desc ? true : false;
     /* format setting outer wrapper */
     echo '<div class="format-setting type-slider ' . ($has_desc ? 'has-desc' : 'no-desc') . '">';
     /* description */
     echo $has_desc ? '<div class="description">' . htmlspecialchars_decode($field_desc) . '</div>' : '';
     /* format setting inner wrapper */
     echo '<div class="format-setting-inner">';
     /* pass the settings array arround */
     echo '<input type="hidden" name="' . esc_attr($field_id) . '_settings_array" id="' . esc_attr($field_id) . '_settings_array" value="' . ot_encode(serialize($field_settings)) . '" />';
     /** 
      * settings pages have array wrappers like 'option_tree'.
      * So we need that value to create a proper array to save to.
      * This is only for NON metaboxes settings.
      */
     if (!isset($get_option)) {
         $get_option = '';
     }
     /* build list items */
     echo '<ul class="option-tree-setting-wrap option-tree-sortable" data-name="' . esc_attr($field_id) . '" data-id="' . esc_attr($post_id) . '" data-get-option="' . esc_attr($get_option) . '" data-type="' . esc_attr($type) . '">';
     if (is_array($field_value) && !empty($field_value)) {
         foreach ($field_value as $key => $list_item) {
             echo '<li class="ui-state-default list-list-item">';
             ot_list_item_view($field_id, $key, $list_item, $post_id, $get_option, $field_settings, $type);
             echo '</li>';
         }
     }
     echo '</ul>';
     /* button */
     echo '<a href="javascript:void(0);" class="option-tree-list-item-add option-tree-ui-button blue right hug-right" title="' . __('Add New', 'option-tree') . '">' . __('Add New', 'option-tree') . '</a>';
     /* description */
     echo '<div class="list-item-description">' . __('You can re-order with drag & drop, the order will update after saving.', 'option-tree') . '</div>';
     echo '</div>';
     echo '</div>';
 }
Пример #8
0
 /**
  * Loads the content for each page
  *
  * @return    string
  *
  * @access    public
  * @since     2.0
  */
 public function display_page()
 {
     $screen = get_current_screen();
     /* loop through settings */
     foreach ((array) $this->options as $option) {
         /* loop through pages */
         foreach ((array) $this->get_pages($option) as $page) {
             /* verify page */
             if (!isset($page['hidden_page']) && $screen->id == $this->page_hook[$page['id']]) {
                 $show_buttons = isset($page['show_buttons']) && $page['show_buttons'] == false ? false : true;
                 /* update active layout content */
                 if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
                     $layouts = get_option(ot_layouts_id());
                     /* has active layout */
                     if (isset($layouts['active_layout'])) {
                         $option_tree = get_option($option['id']);
                         $layouts[$layouts['active_layout']] = ot_encode(serialize($option_tree));
                         update_option(ot_layouts_id(), $layouts);
                     }
                 }
                 echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
                 echo '<h2>' . $page['page_title'] . '</h2>';
                 echo ot_alert_message($page);
                 settings_errors('option-tree');
                 /* Header */
                 echo '<div id="option-tree-header-wrap">';
                 echo '<ul id="option-tree-header">';
                 echo '<li id="option-tree-logo">' . apply_filters('ot_header_logo_link', '<a href="http://wordpress.org/extend/plugins/option-tree/" target="_blank">OptionTree</a>', $page['id']) . '</li>';
                 echo '<li id="option-tree-version"><span>' . apply_filters('ot_header_version_text', 'OptionTree ' . OT_VERSION, $page['id']) . '</span></li>';
                 // Add additional theme specific links here.
                 do_action('ot_header_list', $page['id']);
                 echo '</ul>';
                 /* layouts form */
                 if ($page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true) {
                     ot_theme_options_layouts_form();
                 }
                 echo '</div>';
                 /* remove forms on the custom settings pages */
                 if ($show_buttons) {
                     echo '<form action="options.php" method="post" id="option-tree-settings-api">';
                     settings_fields($option['id']);
                 } else {
                     echo '<div id="option-tree-settings-api">';
                 }
                 /* Sub Header */
                 echo '<div id="option-tree-sub-header">';
                 echo '<span class="option-tree-ui-button left image"></span>';
                 $current_theme = wp_get_theme(PARENT_THEME);
                 echo '<span class="option-tree-ui-button left vesion ">ver. ' . $current_theme->get('Version') . '</span>';
                 if ($show_buttons) {
                     echo '<button class="option-tree-ui-button grey right">' . $page['button_text'] . '</button>';
                     echo '<button class="option-tree-ui-button grey right imgok"></button>';
                 }
                 echo '<span class="option-tree-ui-button right document"><a href="http://doc.cactusthemes.com/truemag/">Documentation</a></span>';
                 echo '<span class="option-tree-ui-button grey right imgok1"><a href="#"></a></span>';
                 echo '<span class="option-tree-ui-button grey right support"><a href="http://ticket.cactusthemes.com/">Support Forum</a></span>';
                 echo '<span class="option-tree-ui-button grey right imgok2"><a href="#"></a></span>';
                 if (ct_check_for_update(PARENT_THEME) == 1) {
                     echo '<button class="button right" style="margin:6px" name="ct_update_theme" type="submit" value="ct_update_theme" onclick="jQuery(\'#option-tree-settings-api\').attr(\'action\',\'themes.php?page=ot-theme-options&ct_update_theme=true\')">' . __('New Version Found! Update Theme?', 'cactusthemes') . '</button>';
                 }
                 echo '</div>';
                 /* Navigation */
                 echo '<div class="ui-tabs">';
                 /* check for sections */
                 if (isset($page['sections']) && count($page['sections']) > 0) {
                     echo '<ul class="ui-tabs-nav">';
                     /* loop through page sections */
                     foreach ((array) $page['sections'] as $section) {
                         echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
                     }
                     echo '</ul>';
                 }
                 /* sections */
                 echo '<div id="poststuff" class="metabox-holder">';
                 echo '<div id="post-body">';
                 echo '<div id="post-body-content">';
                 $this->do_settings_sections($_GET['page']);
                 echo '</div>';
                 echo '</div>';
                 echo '</div>';
                 echo '<div class="clear"></div>';
                 echo '</div>';
                 /* buttons */
                 if ($show_buttons) {
                     echo '<div class="option-tree-ui-buttons">';
                     echo '<button class="option-tree-ui-button blue right">' . $page['button_text'] . '</button>';
                     echo '</div>';
                 }
                 echo $show_buttons ? '</form>' : '</div>';
                 /* reset button */
                 if ($show_buttons) {
                     echo '<form method="post" action="' . str_replace('&settings-updated=true', '', $_SERVER["REQUEST_URI"]) . '">';
                     /* form nonce */
                     wp_nonce_field('option_tree_reset_form', 'option_tree_reset_nonce');
                     echo '<input type="hidden" name="action" value="reset" />';
                     echo '<button type="submit" class="option-tree-ui-button red left reset-settings" title="' . __('Reset Options', 'option-tree') . '">' . __('Reset Options', 'option-tree') . '</button>';
                     /* Display Import Sample Data Button */
                     echo '<a href="' . str_replace('&settings-updated=true', '', $_SERVER["REQUEST_URI"]) . '&import_data=true" class="button red" style="left:30px;position: relative;top: -40px;height: 30px; padding-top: 1px" onclick="return confirm(\'This will import sample data. It may take a couple of minitues to finish. Are you sure?\');">' . __('Import Sample Data', '') . '</a>';
                     echo '</form>';
                 }
                 echo '</div>';
             }
         }
     }
     return false;
 }
 function compat_ot_import_from_files()
 {
     /* file path & name without extention */
     $ot_xml = '/option-tree/theme-options.xml';
     $ot_data = '/option-tree/theme-options.txt';
     $ot_layout = '/option-tree/layouts.txt';
     /* XML file path - child theme first then parent */
     if (is_readable(get_stylesheet_directory() . $ot_xml)) {
         $xml_file = get_stylesheet_directory_uri() . $ot_xml;
     } else {
         if (is_readable(get_template_directory() . $ot_xml)) {
             $xml_file = get_template_directory_uri() . $ot_xml;
         }
     }
     /* Data file path - child theme first then parent */
     if (is_readable(get_stylesheet_directory() . $ot_data)) {
         $data_file = get_stylesheet_directory_uri() . $ot_data;
     } else {
         if (is_readable(get_template_directory() . $ot_data)) {
             $data_file = get_template_directory_uri() . $ot_data;
         }
     }
     /* Layout file path - child theme first then parent */
     if (is_readable(get_stylesheet_directory() . $ot_layout)) {
         $layout_file = get_stylesheet_directory_uri() . $ot_layout;
     } else {
         if (is_readable(get_template_directory() . $ot_layout)) {
             $layout_file = get_template_directory_uri() . $ot_layout;
         }
     }
     /* check for files */
     $has_xml = isset($xml_file) ? true : false;
     $has_data = isset($data_file) ? true : false;
     $has_layout = isset($layout_file) ? true : false;
     /* auto import XML file */
     if ($has_xml == true && !get_option('option_tree_settings') && class_exists('SimpleXMLElement')) {
         $settings = ot_import_xml($xml_file);
         if (isset($settings) && !empty($settings)) {
             update_option('option_tree_settings', $settings);
         }
     }
     /* auto import Data file */
     if ($has_data == true && !get_option('option_tree')) {
         $get_data = wp_remote_get($data_file);
         if (is_wp_error($get_data)) {
             return false;
         }
         $rawdata = isset($get_data['body']) ? $get_data['body'] : '';
         $options = unserialize(ot_decode($rawdata));
         /* get settings array */
         $settings = get_option('option_tree_settings');
         /* has options */
         if (is_array($options)) {
             /* validate options */
             if (is_array($settings)) {
                 foreach ($settings['settings'] as $setting) {
                     if (isset($options[$setting['id']])) {
                         $content = ot_stripslashes($options[$setting['id']]);
                         $options[$setting['id']] = ot_validate_setting($content, $setting['type'], $setting['id']);
                     }
                 }
             }
             /* update the option tree array */
             update_option('option_tree', $options);
         }
     }
     /* auto import Layout file */
     if ($has_layout == true && !get_option('option_tree_layouts')) {
         $get_data = wp_remote_get($data_file);
         if (is_wp_error($get_data)) {
             return false;
         }
         $rawdata = isset($get_data['body']) ? $get_data['body'] : '';
         $layouts = unserialize(ot_decode($rawdata));
         /* get settings array */
         $settings = get_option('option_tree_settings');
         /* has layouts */
         if (is_array($layouts)) {
             /* validate options */
             if (is_array($settings)) {
                 foreach ($layouts as $key => $value) {
                     if ($key == 'active_layout') {
                         continue;
                     }
                     $options = unserialize(ot_decode($value));
                     foreach ($settings['settings'] as $setting) {
                         if (isset($options[$setting['id']])) {
                             $content = ot_stripslashes($options[$setting['id']]);
                             $options[$setting['id']] = ot_validate_setting($content, $setting['type'], $setting['id']);
                         }
                     }
                     $layouts[$key] = ot_encode(serialize($options));
                 }
             }
             /* update the option tree array */
             if (isset($layouts['active_layout'])) {
                 update_option('option_tree', unserialize(ot_decode($layouts[$layouts['active_layout']])));
             }
             /* update the option tree layouts array */
             update_option('option_tree_layouts', $layouts);
         }
     }
 }
function rj_taxonomy_ot_export_callback()
{
    $plugins_url = plugins_url();
    rj_ot_admin_styless();
    /* format setting outer wrapper */
    echo '<div class="format-setting type-textarea simple has-desc">';
    echo '<h2>Export Taxonomy MetaboxUI Settings</h2>';
    /* description */
    echo '<div class="description">';
    echo '<p>' . __('Export your Settings by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>Metaboxes->Import</code> <strong>Settings</strong> textarea on another web site.', 'option-tree') . '</p>';
    echo '</div>';
    /* get theme options data */
    $settings = get_option('rj_taxonomy_' . ot_settings_id());
    $settings = !empty($settings) ? ot_encode(serialize($settings)) : '';
    echo '<div class="format-setting-inner">';
    echo '<textarea rows="10" cols="40" name="export_user_ot_meta_settings" id="export_user_ot_meta_settings" class="textarea">' . $settings . '</textarea>';
    echo '</div>';
    echo '</div>';
}
 function ot_type_export_layouts()
 {
     /* format setting outer wrapper */
     echo '<div class="format-setting type-textarea simple has-desc">';
     /* description */
     echo '<div class="description">';
     echo '<p>' . wp_kses(__('Export your Layouts by highlighting this text and doing a copy/paste into a blank .txt file. Then save the file for importing into another install of WordPress later. Alternatively, you could just paste it into the <code>OptionTree->Settings->Import</code> <strong>Layouts</strong> textarea on another web site.', 'option-tree'), array('strong' => array(), 'code' => array())) . '</p>';
     echo '</div>';
     /* get layout data */
     $layouts = get_option(ot_layouts_id());
     $layouts = !empty($layouts) ? ot_encode(serialize($layouts)) : '';
     echo '<div class="format-setting-inner">';
     echo '<textarea rows="10" cols="40" name="export_layouts" id="export_layouts" class="textarea">' . $layouts . '</textarea>';
     echo '</div>';
     echo '</div>';
 }
 /**
  * Loads the content for each page
  *
  * @return    string
  *
  * @access    public
  * @since     2.0
  */
 public function display_page()
 {
     $screen = get_current_screen();
     $get_settings = get_option('option_tree_settings');
     $theme_data = wp_get_theme();
     /* loop through settings */
     foreach ((array) $this->options as $option) {
         /* loop through pages */
         foreach ((array) $this->get_pages($option) as $page) {
             /* verify page */
             if (!isset($page['hidden_page']) && $screen->id == $this->page_hook[$page['id']]) {
                 $show_buttons = isset($page['show_buttons']) && $page['show_buttons'] == false ? false : true;
                 /* update active layout content */
                 if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
                     $layouts = get_option('option_tree_layouts');
                     /* has active layout */
                     if (isset($layouts['active_layout'])) {
                         $option_tree = get_option($option['id']);
                         $layouts[$layouts['active_layout']] = ot_encode(serialize($option_tree));
                         update_option('option_tree_layouts', $layouts);
                     }
                 }
                 echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
                 //screen_icon( ( isset( $page['screen_icon'] ) ? $page['screen_icon'] : 'options-general' ) );
                 //echo '<h2>' . $page['page_title'] . '</h2>';
                 echo ot_alert_message($page);
                 settings_errors('option-tree');
                 /* Header */
                 et_show_promo_text();
                 /* remove forms on the custom settings pages */
                 if ($show_buttons) {
                     echo '<form action="options.php" method="post" id="option-tree-settings-api">';
                     settings_fields($option['id']);
                 } else {
                     echo '<div id="option-tree-settings-api">';
                 }
                 /* Sub Header */
                 echo '<div id="option-tree-sub-header">';
                 // echo '<pre>';
                 //print_r($this->options[0]['pages'][0]['theme_name']);
                 //print_r($theme_data);
                 //echo '</pre>';
                 echo '<h3 class="theme-tittle">' . ETHEME_THEME_NAME . '</h3>' . '<span class="theme-version">v ' . $theme_data->version . '</span>';
                 /* layouts form */
                 if ($page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true) {
                     ot_theme_options_layouts_form();
                 }
                 if ($show_buttons) {
                     echo '<button class="option-tree-ui-button grey right">' . $page['button_text'] . '</button>';
                 }
                 //echo '<a href="'.get_admin_url().'admin.php?page=ot-theme-options&flush=1" class="option-tree-ui-button grey right">Flush cache</a>';
                 echo '<div class="clear"></div>';
                 echo '</div>';
                 /* Navigation */
                 echo '<div class="ui-tabs">';
                 /* check for sections */
                 if (isset($page['sections']) && count($page['sections']) > 0) {
                     echo '<ul class="ui-tabs-nav">';
                     /* loop through page sections */
                     foreach ((array) $page['sections'] as $section) {
                         echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '"><i class="' . $section['icon'] . '"></i>' . $section['title'] . '</a></li>';
                     }
                     echo '</ul>';
                 }
                 /* sections */
                 echo '<div id="poststuff" class="metabox-holder">';
                 echo '<div id="post-body">';
                 echo '<div id="post-body-content">';
                 $this->do_settings_sections($_GET['page']);
                 echo '</div>';
                 echo '</div>';
                 echo '</div>';
                 echo '<div class="clear"></div>';
                 echo '</div>';
                 /* buttons */
                 if ($show_buttons) {
                     echo '<div class="option-tree-ui-buttons">';
                     echo '<button class="option-tree-ui-button grey right">' . $page['button_text'] . '</button>';
                     echo '</div>';
                 }
                 echo $show_buttons ? '</form>' : '</div>';
                 /* reset button */
                 if ($show_buttons) {
                     echo '<form method="post" action="' . str_replace('&settings-updated=true', '', $_SERVER["REQUEST_URI"]) . '">';
                     /* form nonce */
                     wp_nonce_field('option_tree_reset_form', 'option_tree_reset_nonce');
                     echo '<input type="hidden" name="action" value="reset" />';
                     echo '<!--button type="submit" class="option-tree-ui-button red light left reset-settings" title="' . __('Reset Options', 'option-tree') . '">' . __('Reset Options', 'option-tree') . '</button-->';
                     echo '</form>';
                 }
                 echo '</div>';
             }
         }
     }
     return false;
 }
Пример #13
0
 /**
  * Loads the content for each page
  *
  * @return    string
  *
  * @access    public
  * @since     2.0
  */
 public function display_page()
 {
     $screen = get_current_screen();
     /* loop through settings */
     foreach ((array) $this->options as $option) {
         /* loop through pages */
         foreach ((array) $this->get_pages($option) as $page) {
             /* verify page */
             if (!isset($page['hidden_page']) && $screen->id == $this->page_hook[$page['id']]) {
                 $show_buttons = isset($page['show_buttons']) && $page['show_buttons'] == false ? false : true;
                 /* update active layout content */
                 if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
                     $layouts = get_option(ot_layouts_id());
                     /* has active layout */
                     if (isset($layouts['active_layout'])) {
                         $option_tree = get_option($option['id']);
                         $layouts[$layouts['active_layout']] = ot_encode(serialize($option_tree));
                         update_option(ot_layouts_id(), $layouts);
                     }
                 }
                 echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
                 echo '<h2>' . $page['page_title'] . '</h2>';
                 echo ot_alert_message($page);
                 settings_errors('option-tree');
                 /* Header */
                 echo '<div id="option-tree-header-wrap">';
                 echo '<ul id="option-tree-header">';
                 echo '<li id="option-tree-logo">' . apply_filters('ot_header_logo_link', '<a href="http://wordpress.org/extend/plugins/option-tree/" target="_blank">OptionTree</a>', $page['id']) . '</li>';
                 echo '<li id="option-tree-version"><span>' . apply_filters('ot_header_version_text', 'OptionTree ' . OT_VERSION, $page['id']) . '</span></li>';
                 // Add additional theme specific links here.
                 do_action('ot_header_list', $page['id']);
                 echo '</ul>';
                 /* layouts form */
                 if ($page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true) {
                     ot_theme_options_layouts_form();
                 }
                 echo '</div>';
                 /* remove forms on the custom settings pages */
                 if ($show_buttons) {
                     echo '<form action="options.php" method="post" id="option-tree-settings-api">';
                     settings_fields($option['id']);
                 } else {
                     echo '<div id="option-tree-settings-api">';
                 }
                 /* Sub Header */
                 echo '<div id="option-tree-sub-header">';
                 if ($show_buttons) {
                     echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
                 }
                 echo '</div>';
                 /* Navigation */
                 echo '<div class="ui-tabs">';
                 /* check for sections */
                 if (isset($page['sections']) && count($page['sections']) > 0) {
                     echo '<ul class="ui-tabs-nav">';
                     /* loop through page sections */
                     foreach ((array) $page['sections'] as $section) {
                         echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
                     }
                     echo '</ul>';
                 }
                 echo '<ul class="cohhe-social-profiles">
                 <li class="social-twitter"><i class="ot-icon-twitter"></i><a href="https://twitter.com/Cohhe_Themes" target="_blank">Follow us on Twitter</a></li>
                 <li class="social-facebook"><i class="ot-icon-facebook"></i><a href="https://www.facebook.com/cohhethemes" target="_blank">Join us on Facebook</a></li>
                 <li class="social-googleplus"><i class="ot-icon-google-plus"></i><a href="https://plus.google.com/+Cohhe_Themes/posts" target="_blank">Join us on Google+</a></li>
                 <li class="social-cohhe"><i class="cohhe_logo"></i><a href="http://cohhe.com/" target="_blank">Cohhe.com</a></li>
               </ul>';
                 /* sections */
                 echo '<div id="poststuff" class="metabox-holder">';
                 echo '<div id="post-body">';
                 echo '<div id="post-body-content">';
                 $this->do_settings_sections($_GET['page']);
                 echo '</div>';
                 echo '</div>';
                 echo '</div>';
                 echo '<div class="clear"></div>';
                 echo '</div>';
                 /* buttons */
                 if ($show_buttons) {
                     echo '<div class="option-tree-ui-buttons">';
                     echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
                     echo '</div>';
                 }
                 echo $show_buttons ? '</form>' : '</div>';
                 /* reset button */
                 if ($show_buttons) {
                     echo '<form method="post" action="' . str_replace('&settings-updated=true', '', $_SERVER["REQUEST_URI"]) . '">';
                     /* form nonce */
                     wp_nonce_field('option_tree_reset_form', 'option_tree_reset_nonce');
                     echo '<input type="hidden" name="action" value="reset" />';
                     echo '<button type="submit" class="option-tree-ui-button button button-secondary left reset-settings" title="' . __('Reset Options', 'option-tree') . '">' . __('Reset Options', 'option-tree') . '</button>';
                     echo '</form>';
                 }
                 echo '</div>';
             }
         }
     }
     return false;
 }
Пример #14
0
        /**
         * Loads the content for each page
         *
         * @return    string
         *
         * @access    public
         * @since     2.0
         */
        public function display_page()
        {
            $screen = get_current_screen();
            /* loop through settings */
            foreach ((array) $this->options as $option) {
                /* loop through pages */
                foreach ((array) $this->get_pages($option) as $page) {
                    /* verify page */
                    if (!isset($page['hidden_page']) && $screen->id == $this->page_hook[$page['id']]) {
                        $show_buttons = isset($page['show_buttons']) && $page['show_buttons'] == false ? false : true;
                        /* update active layout content */
                        if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
                            $layouts = get_option(ot_layouts_id());
                            /* has active layout */
                            if (isset($layouts['active_layout'])) {
                                $option_tree = get_option($option['id']);
                                $layouts[$layouts['active_layout']] = ot_encode(serialize($option_tree));
                                update_option(ot_layouts_id(), $layouts);
                            }
                        }
                        $sktlink = "http://www.sketchthemes.com/themes/incart-responsive-woocommerce-wordpress-theme/";
                        $sktratelink = "http://wordpress.org/support/view/theme-reviews/incart-lite";
                        $skttest_drive = "http://trial.sketchthemes.com/wp-signup.php";
                        echo '	<div class="donate-info">
					<strong>' . __("To Activate All Features, Please Upgrade to Pro version!", "incart-lite") . '</strong><br/>
					<a title="' . __("Upgrade to Pro", "incart-lite") . '" href="' . esc_url($sktlink) . '" target="_blank" class="upgrade">' . __("Upgrade to Pro", "incart-lite") . '</a>	<a title="' . __('Setup Instructions', 'incart-lite') . '" href="' . get_template_directory_uri() . '/Installation_Instructions.txt' . '" target="_blank" class="donate">' . __('Setup Instructions', 'incart-lite') . '</a>
					<a title="' . __('Rate Incart Lite', 'incart-lite') . '" href="' . esc_url($sktratelink) . '" target="_blank" class="review">' . __('Rate Incart Lite', 'incart-lite') . '</a>
					<a title="' . __('Test Drive', 'incart-lite') . '" href="' . esc_url($skttest_drive) . '" target="_blank" class="review">' . __('Theme Test Drive', 'incart-lite') . '</a>
          <div id="social-share">
					<div class="fb-like">
						<iframe src="//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2FSketchThemes&amp;width&amp;layout=button_count&amp;action=like&amp;show_faces=true&amp;share=false&amp;height=21&amp;appId=333709623346310" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:21px;" allowTransparency="true"></iframe>
					</div>
						<div class="tw-follow" ><a href="https://twitter.com/sketchthemes" class="twitter-follow-button" data-show-count="false" data-size="small">Follow @sketchthemes</a></div>
						<script>
							!function (d, s, id) {
							var js, fjs = d.getElementsByTagName(s)[0];
							if (!d.getElementById(id)) {
							js = d.createElement(s);
							js.id = id;
							js.src = "//platform.twitter.com/widgets.js";
							fjs.parentNode.insertBefore(js, fjs);
							}
							}(document, "script", "twitter-wjs");
						</script>
					</div>	
				</div>
				<div class="clearfix"></div>
				<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
                        echo '<h2>' . $page['page_title'] . '</h2>';
                        echo ot_alert_message($page);
                        settings_errors('option-tree');
                        /* Header */
                        echo '<div id="option-tree-header-wrap">';
                        echo '<ul id="option-tree-header">';
                        echo '<li id="option-tree-logo">' . apply_filters('ot_header_logo_link', '<a href="http://sketchthemes.com" target="_blank">OptionTree</a>', $page['id']) . '</li>';
                        echo '<li id="option-tree-version"><span>Version ' . INCART_LITE_THEME_VERSION . '</span></li>';
                        // Add additional theme specific links here.
                        do_action('ot_header_list', $page['id']);
                        echo '</ul>';
                        /* layouts form */
                        if ($page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true) {
                            ot_theme_options_layouts_form();
                        }
                        echo '</div>';
                        /* remove forms on the custom settings pages */
                        if ($show_buttons) {
                            echo '<form action="options.php" method="post" id="option-tree-settings-api">';
                            settings_fields($option['id']);
                        } else {
                            echo '<div id="option-tree-settings-api">';
                        }
                        /* Sub Header */
                        echo '<div id="option-tree-sub-header">';
                        if ($show_buttons) {
                            echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
                        }
                        echo '<button class="option-tree-ui-button button button-primary left">' . $page['button_text'] . '</button>';
                        echo '</div>';
                        /* Navigation */
                        echo '<div class="ui-tabs">';
                        /* check for sections */
                        if (isset($page['sections']) && count($page['sections']) > 0) {
                            echo '<ul class="ui-tabs-nav">';
                            /* loop through page sections */
                            foreach ((array) $page['sections'] as $section) {
                                echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">' . $section['title'] . '</a></li>';
                            }
                            echo '</ul>';
                        }
                        /* sections */
                        echo '<div id="poststuff" class="metabox-holder">';
                        echo '<div id="post-body">';
                        echo '<div id="post-body-content">';
                        $this->do_settings_sections($_GET['page']);
                        echo '</div>';
                        echo '</div>';
                        echo '</div>';
                        echo '<div class="clear"></div>';
                        echo '</div>';
                        /* buttons */
                        if ($show_buttons) {
                            echo '<div class="option-tree-ui-buttons">';
                            echo '<button class="option-tree-ui-button button button-primary right">' . $page['button_text'] . '</button>';
                            echo '</div>';
                        }
                        echo $show_buttons ? '</form>' : '</div>';
                        /* reset button */
                        if ($show_buttons) {
                            echo '<form method="post" action="' . str_replace('&settings-updated=true', '', $_SERVER["REQUEST_URI"]) . '">';
                            /* form nonce */
                            wp_nonce_field('option_tree_reset_form', 'option_tree_reset_nonce');
                            echo '<input type="hidden" name="action" value="reset" />';
                            echo '<button type="submit" class="option-tree-ui-button button button-secondary left reset-settings" title="' . __('Reset Options', 'option-tree') . '">' . __('Reset Options', 'option-tree') . '</button>';
                            echo '</form>';
                        }
                        echo '</div>';
                    }
                }
            }
            return false;
        }
Пример #15
0
        /**
         * Loads the content for each page
         *
         * @return    string
         *
         * @access    public
         * @since     2.0
         */
        public function display_page()
        {
            $screen = get_current_screen();
            /* loop through settings */
            foreach ((array) $this->options as $option) {
                /* loop through pages */
                foreach ((array) $this->get_pages($option) as $page) {
                    /* verify page */
                    if (!isset($page['hidden_page']) && $screen->id == $this->page_hook[$page['id']]) {
                        $show_buttons = isset($page['show_buttons']) && $page['show_buttons'] == false ? false : true;
                        /* update active layout content */
                        if (isset($_REQUEST['settings-updated']) && $_REQUEST['settings-updated'] == 'true') {
                            $layouts = get_option('option_tree_layouts');
                            /* has active layout */
                            if (isset($layouts['active_layout'])) {
                                $option_tree = get_option($option['id']);
                                $layouts[$layouts['active_layout']] = ot_encode(serialize($option_tree));
                                update_option('option_tree_layouts', $layouts);
                            }
                        }
                        echo '<div class="wrap settings-wrap" id ="page-' . $page['id'] . '">';
                        screen_icon(isset($page['screen_icon']) ? $page['screen_icon'] : 'options-general');
                        echo '<h2>' . $page['page_title'] . '</h2>';
                        echo ot_alert_message($page);
                        settings_errors('option-tree');
                        /* Header */
                        echo '<div id="option-tree-header-wrap">';
                        echo '<ul id="option-tree-header">';
                        echo '<li id="option-tree-version"><span>' . UT_THEME_NAME . ' Version ' . UT_THEME_VERSION . '</span></li>';
                        echo '</ul>';
                        /* layouts form */
                        if ($page['id'] == 'ot_theme_options' && OT_SHOW_NEW_LAYOUT == true) {
                            ot_theme_options_layouts_form();
                        }
                        echo '</div>';
                        /* remove forms on the custom settings pages */
                        if ($show_buttons) {
                            echo '<form action="options.php" method="post" id="option-tree-settings-api">';
                            settings_fields($option['id']);
                        } else {
                            echo '<div id="option-tree-settings-api">';
                        }
                        /* Sub Header */
                        echo '<div id="option-tree-sub-header">';
                        if ($show_buttons) {
                            //echo '<a href="http://faq.unitedthemes.com/brooklyn/" target="_blank" class="option-tree-ui-button blue right">View Documentation</a>';
                            echo '<button class="option-tree-ui-button blue right save-settings">' . $page['button_text'] . '</button>';
                        }
                        echo '</div>';
                        /* Navigation */
                        echo '<div class="ui-tabs">';
                        /* check for sections */
                        if (isset($page['sections']) && count($page['sections']) > 0) {
                            echo '<ul class="ui-tabs-nav">';
                            echo '<li class="ut-admin-branding"><img src="' . THEME_WEB_ROOT . '/admin/assets/images/ut-emblem.png" alt="UnitedThemes"></li>';
                            /* loop through page sections */
                            foreach ((array) $page['sections'] as $section) {
                                echo '<li id="tab_' . $section['id'] . '"><a href="#section_' . $section['id'] . '">';
                                if (!empty($section['icon'])) {
                                    echo '<i class="fa ' . $section['icon'] . ' fa-3x"></i>';
                                }
                                echo $section['title'];
                                echo '</a></li>';
                            }
                            echo '</ul>';
                        }
                        /* sections */
                        echo '<div id="poststuff" class="metabox-holder">';
                        echo '<div id="post-body">';
                        echo '<div id="post-body-content">';
                        $this->do_settings_sections($_GET['page']);
                        echo '</div>';
                        echo '</div>';
                        echo '</div>';
                        echo '<div class="clear"></div>';
                        echo '</div>';
                        echo $show_buttons ? '</form>' : '</div>';
                        echo '</div>';
                        if (function_exists('ut_recognized_icons')) {
                            ?>
            
            <div class="ut-modal-option-tree">
                <div class="ut-modal-box-option-tree ut-admin">
                    
                    <div class="ut-modal-option-tree-header">
                        <div class="inner">
                            <h2><?php 
                            _e('Choose Icon', 'unitedthemes');
                            ?>
</h2>
                        </div>
                    </div>
                    
                    <div class="ut-modal-option-tree-body">
                        <div class="inner">
                            <ul class="ut-glyphicons">
                            
                            <?php 
                            foreach (ut_recognized_icons() as $key => $icon) {
                                $icondisplay = $icon == 'icon-noicon' ? 'no icon' : '<i class="fa ' . $icon . '"></i>';
                                echo '<li><span data-icon="' . $icon . '" class="ut-icon-option-tree">' . $icondisplay . '</span></li>';
                            }
                            ?>
                            
                            </ul>
                        </div>
                    </div>
                    
                    <div class="ut-modal-option-tree-footer">
                        <div class="inner">
                            <a href="#" class="close-ut-modal-option-tree"><?php 
                            _e('Close', 'unitedthemes');
                            ?>
</a>
                        </div>
                    </div>
                    
                </div>
            </div>
            
            <?php 
                        }
                    }
                }
            }
            return false;
        }