wp/wp-content/plugins/option-tree/includes/ot-functions-settings-page.php
author ymh <ymh.work@gmail.com>
Mon, 08 Sep 2025 19:44:41 +0200
changeset 23 417f20492bf7
parent 11 bf1778c34b9a
permissions -rwxr-xr-x
Update Docker configuration and plugin versions - Upgrade MariaDB from 10.6 to 11 with auto-upgrade support - Add WordPress debug environment variable to FPM container - Update PHP-FPM Dockerfile base image - Update Include Mastodon Feed plugin with bug fixes and improvements - Update Portfolio plugin (v2.58) with latest translations and demo data enhancements - Remove old README.md from Mastodon Feed plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     1
<?php
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     2
/**
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     3
 * OptionTree Settings Page Functions.
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     4
 *
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     5
 * @package OptionTree
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     6
 */
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
     7
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     8
if ( ! defined( 'OT_VERSION' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
     9
	exit( 'No direct script access allowed' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    10
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
    11
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    12
if ( ! function_exists( 'ot_type_theme_options_ui' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    13
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    14
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    15
	 * Create option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    16
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    17
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    18
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    19
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    20
	function ot_type_theme_options_ui() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    21
		global $blog_id;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    22
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    23
		echo '<form method="post" id="option-tree-settings-form">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    24
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    25
		// Form nonce.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    26
		wp_nonce_field( 'option_tree_settings_form', 'option_tree_settings_nonce' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    27
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    28
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    29
		echo '<div class="format-setting type-textblock has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    30
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    31
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    32
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    33
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    34
		echo '<h4>' . esc_html__( 'Warning!', 'option-tree' ) . '</h4>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    35
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    36
		/* translators: %s: link to theme options */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    37
		$string = esc_html__( 'Go to the %s page if you want to save data, this page is for adding settings.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    38
		echo '<p class="warning">' . sprintf( $string, '<a href="' . esc_url_raw( get_admin_url( $blog_id, apply_filters( 'ot_theme_options_parent_slug', 'themes.php' ) ) . '?page=' . apply_filters( 'ot_theme_options_menu_slug', 'ot-theme-options' ) ) . '"><code>' . esc_html__( 'Appearance->Theme Options', 'option-tree' ) . '</code></a>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    39
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    40
		/* translators: %s: link to documentation */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    41
		$string = esc_html__( 'If you\'re unsure or not completely positive that you should be editing these settings, you should read the %s first.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    42
		echo '<p class="warning">' . sprintf( $string, '<a href="' . esc_url_raw( get_admin_url( $blog_id, 'admin.php?page=ot-documentation' ) ) . '"><code>' . esc_html__( 'OptionTree->Documentation', 'option-tree' ) . '</code></a>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    43
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    44
		echo '<h4>' . esc_html__( 'Things could break or be improperly displayed to the end-user if you do one of the following:', 'option-tree' ) . '</h4>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    45
		echo '<p class="warning">' . esc_html__( 'Give two sections the same ID, give two settings the same ID, give two contextual help content areas the same ID, don\'t create any settings, or have a section at the end of the settings list.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    46
		echo '<p>' . esc_html__( 'You can create as many settings as your project requires and use them how you see fit. When you add a setting here, it will be available on the Theme Options page for use in your theme. To separate your settings into sections, click the "Add Section" button, fill in the input fields, and a new navigation menu item will be created.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    47
		echo '<p>' . esc_html__( 'All of the settings can be sorted and rearranged to your liking with Drag & Drop. Don\'t worry about the order in which you create your settings, you can always reorder them.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    48
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    49
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    50
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    51
		// Get the saved settings.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    52
		$settings = get_option( ot_settings_id() );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    53
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    54
		// Wrap settings array.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    55
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    56
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    57
		// Set count to zero.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    58
		$count = 0;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    59
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    60
		// Loop through each section and its settings.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    61
		echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_settings_list" data-name="' . esc_attr( ot_settings_id() ) . '[settings]">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    62
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    63
		if ( isset( $settings['sections'] ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    64
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    65
			foreach ( $settings['sections'] as $section ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    66
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    67
				// Section.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    68
				echo '<li class="' . ( $count == 0 ? 'ui-state-disabled' : 'ui-state-default' ) . ' list-section">' . ot_sections_view( ot_settings_id() . '[sections]', $count, $section ) . '</li>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    69
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    70
				// Increment item count.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    71
				$count++;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    72
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    73
				// Settings in this section.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    74
				if ( isset( $settings['settings'] ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    75
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    76
					foreach ( $settings['settings'] as $setting ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    77
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    78
						if ( isset( $setting['section'] ) && $setting['section'] === $section['id'] ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    79
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    80
							echo '<li class="ui-state-default list-setting">' . ot_settings_view( ot_settings_id() . '[settings]', $count, $setting ) . '</li>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    81
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    82
							// Increment item count.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    83
							$count++;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    84
						}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    85
					}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    86
				}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    87
			}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    88
		}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    89
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    90
		echo '</ul>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    91
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    92
		// Buttons.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    93
		echo '<a href="javascript:void(0);" class="option-tree-section-add option-tree-ui-button button hug-left">' . esc_html__( 'Add Section', 'option-tree' ) . '</a>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    94
		echo '<a href="javascript:void(0);" class="option-tree-setting-add option-tree-ui-button button">' . esc_html__( 'Add Setting', 'option-tree' ) . '</a>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    95
		echo '<button class="option-tree-ui-button button button-primary right hug-right">' . esc_html__( 'Save Changes', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    96
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    97
		// Sidebar textarea.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    98
		echo '
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
    99
		<div class="format-setting-label" id="contextual-help-label">
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   100
			<h3 class="label">' . esc_html__( 'Contextual Help', 'option-tree' ) . '</h3>
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   101
		</div>
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   102
		<div class="format-settings" id="contextual-help-setting">
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   103
			<div class="format-setting type-textarea no-desc">
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   104
				<div class="description"><strong>' . esc_html__( 'Contextual Help Sidebar', 'option-tree' ) . '</strong>: ' . esc_html__( 'If you decide to add contextual help to the Theme Option page, enter the optional "Sidebar" HTML here. This would be an extremely useful place to add links to your themes documentation or support forum. Only after you\'ve added some content below will this display to the user.', 'option-tree' ) . '</div>
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   105
				<div class="format-setting-inner">
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   106
					<textarea class="textarea" rows="10" cols="40" name="' . esc_attr( ot_settings_id() ) . '[contextual_help][sidebar]">' . ( isset( $settings['contextual_help']['sidebar'] ) ? esc_html( $settings['contextual_help']['sidebar'] ) : '' ) . '</textarea>
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   107
				</div>
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   108
			</div>
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   109
		</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   110
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   111
		// Set count to zero.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   112
		$count = 0;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   113
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   114
		// Loop through each contextual_help content section.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   115
		echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_settings_help" data-name="' . esc_attr( ot_settings_id() ) . '[contextual_help][content]">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   116
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   117
		if ( isset( $settings['contextual_help']['content'] ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   118
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   119
			foreach ( $settings['contextual_help']['content'] as $content ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   120
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   121
				// Content.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   122
				echo '<li class="ui-state-default list-contextual-help">' . ot_contextual_help_view( ot_settings_id() . '[contextual_help][content]', $count, $content ) . '</li>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   123
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   124
				// Increment content count.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   125
				$count++;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   126
			}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   127
		}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   128
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   129
		echo '</ul>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   130
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   131
		echo '<a href="javascript:void(0);" class="option-tree-help-add option-tree-ui-button button hug-left">' . esc_html__( 'Add Contextual Help Content', 'option-tree' ) . '</a>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   132
		echo '<button class="option-tree-ui-button button button-primary right hug-right">' . esc_html__( 'Save Changes', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   133
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   134
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   135
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   136
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   137
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   138
		echo '</form>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   139
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   140
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   141
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   142
if ( ! function_exists( 'ot_type_import_settings' ) ) {
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   143
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   144
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   145
	 * Import Settings option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   146
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   147
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   148
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   149
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   150
	function ot_type_import_settings() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   151
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   152
		echo '<form method="post" id="import-settings-form">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   153
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   154
		// Form nonce.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   155
		wp_nonce_field( 'import_settings_form', 'import_settings_nonce' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   156
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   157
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   158
		echo '<div class="format-setting type-textarea has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   159
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   160
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   161
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   162
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   163
		echo '<p>' . esc_html__( 'To import your Settings copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Settings" button.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   164
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   165
		echo '<button class="option-tree-ui-button button button-primary right hug-right">' . esc_html__( 'Import Settings', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   166
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   167
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   168
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   169
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   170
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   171
		echo '<textarea rows="10" cols="40" name="import_settings" id="import_settings" class="textarea"></textarea>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   172
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   173
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   174
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   175
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   176
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   177
		echo '</form>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   178
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   179
	}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   180
}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   181
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   182
if ( ! function_exists( 'ot_type_import_data' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   183
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   184
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   185
	 * Import Data option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   186
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   187
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   188
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   189
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   190
	function ot_type_import_data() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   191
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   192
		echo '<form method="post" id="import-data-form">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   193
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   194
		// Form nonce.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   195
		wp_nonce_field( 'import_data_form', 'import_data_nonce' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   196
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   197
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   198
		echo '<div class="format-setting type-textarea has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   199
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   200
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   201
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   202
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   203
		if ( OT_SHOW_SETTINGS_IMPORT ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   204
			echo '<p>' . esc_html__( 'Only after you\'ve imported the Settings should you try and update your Theme Options.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   205
		}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   206
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   207
		echo '<p>' . esc_html__( 'To import your Theme Options copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Theme Options" button.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   208
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   209
		echo '<button class="option-tree-ui-button button button-primary right hug-right">' . esc_html__( 'Import Theme Options', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   210
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   211
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   212
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   213
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   214
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   215
		echo '<textarea rows="10" cols="40" name="import_data" id="import_data" class="textarea"></textarea>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   216
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   217
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   218
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   219
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   220
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   221
		echo '</form>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   222
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   223
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   224
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   225
if ( ! function_exists( 'ot_type_import_layouts' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   226
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   227
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   228
	 * Import Layouts option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   229
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   230
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   231
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   232
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   233
	function ot_type_import_layouts() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   234
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   235
		echo '<form method="post" id="import-layouts-form">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   236
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   237
		// Form nonce.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   238
		wp_nonce_field( 'import_layouts_form', 'import_layouts_nonce' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   239
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   240
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   241
		echo '<div class="format-setting type-textarea has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   242
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   243
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   244
		echo '<div class="description">';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   245
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   246
		if ( OT_SHOW_SETTINGS_IMPORT ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   247
			echo '<p>' . esc_html__( 'Only after you\'ve imported the Settings should you try and update your Layouts.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   248
		}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   249
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   250
		echo '<p>' . esc_html__( 'To import your Layouts copy and paste what appears to be a random string of alpha numeric characters into this textarea and press the "Import Layouts" button. Keep in mind that when you import your layouts, the active layout\'s saved data will write over the current data set for your Theme Options.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   251
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   252
		echo '<button class="option-tree-ui-button button button-primary right hug-right">' . esc_html__( 'Import Layouts', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   253
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   254
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   255
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   256
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   257
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   258
		echo '<textarea rows="10" cols="40" name="import_layouts" id="import_layouts" class="textarea"></textarea>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   259
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   260
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   261
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   262
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   263
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   264
		echo '</form>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   265
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   266
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   267
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   268
if ( ! function_exists( 'ot_type_export_settings_file' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   269
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   270
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   271
	 * Export Settings File option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   272
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   273
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   274
	 * @since  2.0.8
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   275
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   276
	function ot_type_export_settings_file() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   277
		global $blog_id;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   278
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   279
		echo '<form method="post" id="export-settings-file-form">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   280
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   281
		// Form nonce.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   282
		wp_nonce_field( 'export_settings_file_form', 'export_settings_file_nonce' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   283
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   284
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   285
		echo '<div class="format-setting type-textarea simple has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   286
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   287
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   288
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   289
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   290
		/* translators: %1$s: file name, %2$s: link to I18n docs, %3$s: link to internal docs */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   291
		$string = esc_html__( 'Export your Settings into a fully functional %1$s file. If you want to add your own custom %2$s text domain to the file, enter it into the text field before exporting. For more information on how to use this file read the documentation on %3$s. Remember, you should always check the file for errors before including it in your theme.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   292
		echo '<p>' . sprintf( $string, '<code>theme-options.php</code>', '<a href="http://codex.wordpress.org/I18n_for_WordPress_Developers" target="_blank">I18n</a>', '<a href="' . get_admin_url( $blog_id, 'admin.php?page=ot-documentation#section_theme_mode' ) . '">' . esc_html__( 'Theme Mode', 'option-tree' ) . '</a>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   293
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   294
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   295
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   296
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   297
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   298
		echo '<input type="text" name="domain" value="" class="widefat option-tree-ui-input" placeholder="text-domain" autocomplete="off" />';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   299
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   300
		echo '<button class="option-tree-ui-button button button-primary hug-left">' . esc_html__( 'Export Settings File', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   301
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   302
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   303
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   304
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   305
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   306
		echo '</form>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   307
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   308
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   309
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   310
if ( ! function_exists( 'ot_type_export_settings' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   311
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   312
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   313
	 * Export Settings option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   314
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   315
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   316
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   317
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   318
	function ot_type_export_settings() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   319
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   320
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   321
		echo '<div class="format-setting type-textarea simple has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   322
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   323
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   324
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   325
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   326
		/* translators: %1$s: visual path to import, %2$s: visual path to settings */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   327
		$string = esc_html__( '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 %1$s %1$s textarea on another web site.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   328
		echo '<p>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Settings->Import', 'option-tree' ) . '</code>', '<code>' . esc_html__( 'Settings', 'option-tree' ) . '</code>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   329
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   330
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   331
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   332
		// Get theme options data.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   333
		$settings = get_option( ot_settings_id(), array() );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   334
		$settings = ! empty( $settings ) ? ot_encode( $settings ) : '';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   335
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   336
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   337
		echo '<textarea rows="10" cols="40" name="export_settings" id="export_settings" class="textarea">' . $settings . '</textarea>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   338
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   339
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   340
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   341
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   342
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   343
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   344
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   345
if ( ! function_exists( 'ot_type_export_data' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   346
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   347
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   348
	 * Export Data option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   349
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   350
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   351
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   352
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   353
	function ot_type_export_data() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   354
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   355
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   356
		echo '<div class="format-setting type-textarea simple has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   357
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   358
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   359
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   360
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   361
		/* translators: %1$s: visual path to import, %2$s: visual path to theme options */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   362
		$string = esc_html__( '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 %1$s %2$s textarea on another web site.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   363
		echo '<p>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Settings->Import', 'option-tree' ) . '</code>', '<code>' . esc_html__( 'Theme Options', 'option-tree' ) . '</code>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   364
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   365
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   366
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   367
		// Get theme options data.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   368
		$data = get_option( ot_options_id(), array() );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   369
		$data = ! empty( $data ) ? ot_encode( $data ) : '';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   370
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   371
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   372
		echo '<textarea rows="10" cols="40" name="export_data" id="export_data" class="textarea">' . $data . '</textarea>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   373
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   374
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   375
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   376
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   377
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   378
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   379
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   380
if ( ! function_exists( 'ot_type_export_layouts' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   381
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   382
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   383
	 * Export Layouts option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   384
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   385
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   386
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   387
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   388
	function ot_type_export_layouts() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   389
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   390
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   391
		echo '<div class="format-setting type-textarea simple has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   392
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   393
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   394
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   395
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   396
		/* translators: %1$s: visual path to import, %2$s: visual path to layouts */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   397
		$string = esc_html__( '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 %1$s %2$s textarea on another web site.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   398
		echo '<p>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Settings->Import', 'option-tree' ) . '</code>', '<code>' . esc_html__( 'Layouts', 'option-tree' ) . '</code>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   399
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   400
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   401
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   402
		// Get layout data.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   403
		$layouts = get_option( ot_layouts_id(), array() );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   404
		$layouts = ! empty( $layouts ) ? ot_encode( $layouts ) : '';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   405
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   406
		echo '<div class="format-setting-inner">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   407
		echo '<textarea rows="10" cols="40" name="export_layouts" id="export_layouts" class="textarea">' . $layouts . '</textarea>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   408
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   409
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   410
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   411
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   412
}
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   413
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   414
if ( ! function_exists( 'ot_type_modify_layouts' ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   415
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   416
	/**
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   417
	 * Modify Layouts option type.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   418
	 *
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   419
	 * @access public
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   420
	 * @since  2.0
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   421
	 */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   422
	function ot_type_modify_layouts() {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   423
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   424
		echo '<form method="post" id="option-tree-settings-form">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   425
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   426
		// Form nonce.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   427
		wp_nonce_field( 'option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce' );
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   428
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   429
		// Format setting outer wrapper.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   430
		echo '<div class="format-setting type-textarea has-desc">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   431
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   432
		// Description.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   433
		echo '<div class="description">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   434
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   435
		echo '<p>' . esc_html__( 'To add a new layout enter a unique lower case alphanumeric string (dashes allowed) in the text field and click "Save Layouts".', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   436
		echo '<p>' . esc_html__( 'As well, you can activate, remove, and drag & drop the order; all situations require you to click "Save Layouts" for the changes to be applied.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   437
		echo '<p>' . esc_html__( 'When you create a new layout it will become active and any changes made to the Theme Options will be applied to it. If you switch back to a different layout immediately after creating a new layout that new layout will have a snapshot of the current Theme Options data attached to it.', 'option-tree' ) . '</p>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   438
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   439
		if ( OT_SHOW_DOCS ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   440
			/* translators: %s: visual path to layouts overview */
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   441
			$string = esc_html__( 'Visit %s to see a more in-depth description of what layouts are and how to use them.', 'option-tree' );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   442
			echo '<p>' . sprintf( $string, '<code>' . esc_html__( 'OptionTree->Documentation->Layouts Overview', 'option-tree' ) . '</code>' ) . '</p>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   443
		}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   444
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   445
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   446
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   447
		echo '<div class="format-setting-inner">';
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   448
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   449
		// Get the saved layouts.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   450
		$layouts = get_option( ot_layouts_id() );
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   451
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   452
		// Set active layout.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   453
		$active_layout = isset( $layouts['active_layout'] ) ? $layouts['active_layout'] : '';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   454
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   455
		echo '<input type="hidden" name="' . esc_attr( ot_layouts_id() ) . '[active_layout]" value="' . esc_attr( $active_layout ) . '" class="active-layout-input" />';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   456
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   457
		// Add new layout.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   458
		echo '<input type="text" name="' . esc_attr( ot_layouts_id() ) . '[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   459
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   460
		// Loop through each layout.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   461
		echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_layouts">';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   462
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   463
		if ( is_array( $layouts ) && ! empty( $layouts ) ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   464
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   465
			foreach ( $layouts as $key => $data ) {
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   466
11
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   467
				// Skip active layout array.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   468
				if ( 'active_layout' === $key ) {
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   469
					continue;
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   470
				}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   471
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   472
				// Content.
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   473
				echo '<li class="ui-state-default list-layouts">' . ot_layout_view( $key, $data, $active_layout ) . '</li>'; // phpcs:ignore
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   474
			}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   475
		}
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   476
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   477
		echo '</ul>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   478
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   479
		echo '<button class="option-tree-ui-button button button-primary right hug-right">' . esc_html__( 'Save Layouts', 'option-tree' ) . '</button>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   480
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   481
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   482
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   483
		echo '</div>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   484
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   485
		echo '</form>';
bf1778c34b9a upgrade optiontree
ymh <ymh.work@gmail.com>
parents: 5
diff changeset
   486
	}
0
d970ebf37754 first import
ymh <ymh.work@gmail.com>
parents:
diff changeset
   487
}