本文整理汇总了PHP中ot_layouts_id函数的典型用法代码示例。如果您正苦于以下问题:PHP ot_layouts_id函数的具体用法?PHP ot_layouts_id怎么用?PHP ot_layouts_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ot_layouts_id函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display_page
/**
* 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>';
}
/* 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;
//.........这里部分代码省略.........
示例2: ot_maybe_migrate_layouts
function ot_maybe_migrate_layouts()
{
// Filter the ID to migrate from
$layouts_id = apply_filters('ot_migrate_layouts_id', '');
// Attempt to migrate Layouts
if (!empty($layouts_id) && get_option(ot_layouts_id()) === false && ot_layouts_id() !== $layouts_id) {
// Old options
$layouts = get_option($layouts_id);
// Migrate to new ID
update_option(ot_layouts_id(), $layouts);
}
}
示例3: display_page
/**
* 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"]) . '">';
//.........这里部分代码省略.........
示例4: ot_type_modify_layouts
function ot_type_modify_layouts()
{
echo '<form method="post" id="option-tree-settings-form">';
/* form nonce */
wp_nonce_field('option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce');
/* format setting outer wrapper */
echo '<div class="format-setting type-textarea has-desc">';
/* description */
echo '<div class="description">';
echo '<p>' . __('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>';
echo '<p>' . __('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>';
echo '<p>' . __('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>';
if (OT_SHOW_DOCS) {
echo '<p>' . __('Visit <code>OptionTree->Documentation->Layouts Overview</code> to see a more in-depth description of what layouts are and how to use them.', 'option-tree') . '</p>';
}
echo '</div>';
echo '<div class="format-setting-inner">';
/* get the saved layouts */
$layouts = get_option(ot_layouts_id());
/* set active layout */
$active_layout = isset($layouts['active_layout']) ? $layouts['active_layout'] : '';
echo '<input type="hidden" name="' . ot_layouts_id() . '[active_layout]" value="' . esc_attr($active_layout) . '" class="active-layout-input" />';
/* add new layout */
echo '<input type="text" name="' . ot_layouts_id() . '[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
/* loop through each layout */
echo '<ul class="option-tree-setting-wrap option-tree-sortable" id="option_tree_layouts">';
if (is_array($layouts) && !empty($layouts)) {
foreach ($layouts as $key => $data) {
/* skip active layout array */
if ($key == 'active_layout') {
continue;
}
/* content */
echo '<li class="ui-state-default list-layouts">' . ot_layout_view($key, $data, $active_layout) . '</li>';
}
}
echo '</ul>';
echo '<button class="option-tree-ui-button button button-primary right hug-right">' . __('Save Layouts', 'option-tree') . '</button>';
echo '</div>';
echo '</div>';
echo '</form>';
}
示例5: ot_theme_options_layouts_form
function ot_theme_options_layouts_form($active = false)
{
echo '<form method="post" id="option-tree-options-layouts-form">';
/* form nonce */
wp_nonce_field('option_tree_modify_layouts_form', 'option_tree_modify_layouts_nonce');
/* get the saved layouts */
$layouts = get_option(ot_layouts_id());
/* set active layout */
$active_layout = isset($layouts['active_layout']) ? $layouts['active_layout'] : '';
if (is_array($layouts) && count($layouts) > 1) {
$active_layout = esc_attr($layouts['active_layout']);
echo '<input type="hidden" id="the_current_layout" value="' . $active_layout . '" />';
echo '<div class="option-tree-active-layout">';
echo '<select name="' . ot_layouts_id() . '[active_layout]" class="option-tree-ui-select">';
foreach ($layouts as $key => $data) {
if ($key == 'active_layout') {
continue;
}
echo '<option' . selected($key, $active_layout, false) . ' value="' . esc_attr($key) . '">' . esc_attr($key) . '</option>';
}
echo '</select>';
echo '</div>';
foreach ($layouts as $key => $data) {
if ($key == 'active_layout') {
continue;
}
echo '<input type="hidden" name="' . ot_layouts_id() . '[' . $key . ']" value="' . (isset($data) ? $data : '') . '" />';
}
}
/* new layout wrapper */
echo '<div class="option-tree-save-layout' . (!empty($active_layout) ? ' active-layout' : '') . '">';
/* add new layout */
echo '<input type="text" name="' . ot_layouts_id() . '[_add_new_layout_]" value="" class="widefat option-tree-ui-input" autocomplete="off" />';
echo '<button type="submit" class="option-tree-ui-button button button-primary save-layout" title="' . __('New Layout', 'option-tree') . '">' . __('New Layout', 'option-tree') . '</button>';
echo '</div>';
echo '</form>';
}
示例6: display_page
/**
* 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&width&layout=button_count&action=like&show_faces=true&share=false&height=21&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">';
//.........这里部分代码省略.........
示例7: compat_ot_import_from_files
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(ot_settings_id()) && class_exists('SimpleXMLElement')) {
$settings = ot_import_xml($xml_file);
if (isset($settings) && !empty($settings)) {
update_option(ot_settings_id(), $settings);
}
}
/* auto import Data file */
if ($has_data == true && !get_option(ot_options_id())) {
$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(ot_settings_id());
/* 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(ot_options_id(), $options);
}
}
/* auto import Layout file */
if ($has_layout == true && !get_option(ot_layouts_id())) {
$get_data = wp_remote_get($layout_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(ot_settings_id());
/* 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(ot_options_id(), unserialize(ot_decode($layouts[$layouts['active_layout']])));
}
/* update the option tree layouts array */
update_option(ot_layouts_id(), $layouts);
//.........这里部分代码省略.........