本文整理汇总了PHP中cmsms_get_global_options函数的典型用法代码示例。如果您正苦于以下问题:PHP cmsms_get_global_options函数的具体用法?PHP cmsms_get_global_options怎么用?PHP cmsms_get_global_options使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cmsms_get_global_options函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cmsms_default_tab
function cmsms_default_tab()
{
$cmsms_option = cmsms_get_global_options();
$current_page = cmsms_get_admin_page();
if ($current_page == 'cmsms-settings') {
$default_tab = 'general';
} elseif ($current_page == 'cmsms-settings-style') {
if ($cmsms_option[CMSMS_SHORTNAME . '_theme_layout'] === 'boxed') {
$default_tab = 'bg';
} else {
$default_tab = 'header';
}
} elseif ($current_page == 'cmsms-settings-logo') {
$default_tab = 'image';
} elseif ($current_page == 'cmsms-settings-font') {
$default_tab = 'content';
} elseif ($current_page == 'cmsms-settings-icon') {
$default_tab = 'heading';
} elseif ($current_page == 'cmsms-settings-blog') {
$default_tab = 'page';
} elseif ($current_page == 'cmsms-settings-portfolio') {
$default_tab = 'full';
} elseif ($current_page == 'cmsms-settings-testimonial') {
$default_tab = 't_page';
} else {
$default_tab = 'general';
}
return $default_tab;
}
示例2: cmsms_get_global_options
<?php
/**
* @package WordPress
* @subpackage Newgate
* @since Newgate 1.0
*
* Template Name: Portfolio Timeline
* Created by CMSMasters
*
*/
$cmsms_option = cmsms_get_global_options();
get_header();
$cmsms_layout = get_post_meta(get_the_ID(), 'cmsms_layout', true);
if (!$cmsms_layout) {
$cmsms_layout = 'fullwidth';
}
echo '<!--_________________________ Start Content _________________________ -->' . "\n";
if ($cmsms_layout == 'r_sidebar') {
echo '<section id="content" role="main">' . "\n";
} elseif ($cmsms_layout == 'l_sidebar') {
echo '<section id="content" class="fr" role="main">' . "\n";
} else {
echo '<section id="middle_content" role="main">' . "\n";
}
echo '<div class="entry">' . "\n";
if (have_posts()) {
the_post();
if (has_post_thumbnail()) {
if (has_post_thumbnail()) {
if ($cmsms_layout == 'r_sidebar' || $cmsms_layout == 'l_sidebar') {
示例3: show_cmsms_meta_box
function show_cmsms_meta_box()
{
global $post, $custom_all_meta_fields;
$cmsms_option = cmsms_get_global_options();
echo '<input type="hidden" name="custom_meta_box_nonce" value="' . wp_create_nonce(basename(__FILE__)) . '" />';
foreach ($custom_all_meta_fields as $field) {
$meta = get_post_meta($post->ID, $field['id'], true);
if (isset($field['std']) && $meta === '') {
$meta = $field['std'];
}
if (!isset($field['hide'])) {
$field['hide'] = 'false';
}
if ($field['type'] != 'tabs' && $field['type'] != 'tab_start' && $field['type'] != 'tab_finish' && $field['type'] != 'content_start' && $field['type'] != 'content_finish') {
echo '<tr class="cmsms_tr_' . $field['type'] . '"' . ($field['hide'] == 'true' ? ' style="display:none;"' : '') . '>' . '<th>' . '<label for="' . $field['id'] . '">' . $field['label'] . '</label>' . '</th>' . '<td>';
}
switch ($field['type']) {
case 'tab_start':
echo '<div id="' . $field['id'] . '" class="nav-tab-content' . ($field['std'] === 'true' ? ' nav-tab-content-active' : '') . '">' . '<table class="form-table">';
break;
case 'tab_finish':
echo '</table>' . '</div>';
break;
case 'content_start':
echo '<table id="' . $field['id'] . '" class="form-table' . ($field['box'] === 'true' ? ' cmsms_box' : '') . '"' . ($field['hide'] === 'true' ? ' style="display:none;"' : '') . '>';
break;
case 'content_finish':
echo '</table>';
break;
case 'tabs':
echo '<h4 class="nav-tab-wrapper" id="' . $field['id'] . '">';
foreach ($field['options'] as $option) {
echo '<a href="#' . $option['value'] . '" class="nav-tab' . ($field['std'] === $option['value'] ? ' nav-tab-active' : '') . '">' . $option['label'] . '</a>';
}
echo '</h4>';
break;
case 'text':
echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" size="30" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'textcode':
echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . htmlspecialchars(stripslashes($meta)) . '" size="30" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'text_long':
echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" size="70" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'number':
echo '<input type="text" name="' . $field['id'] . '" id="' . $field['id'] . '" value="' . $meta . '" size="5" />' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'textarea':
echo '<textarea name="' . $field['id'] . '" id="' . $field['id'] . '" cols="50" rows="4">' . $meta . '</textarea>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'checkbox':
echo '<input type="checkbox" name="' . $field['id'] . '" id="' . $field['id'] . '" value="true"' . ($meta === 'false' ? '' : ' checked="checked"') . ' /> ' . '<label for="' . $field['id'] . '">' . $field['desc'] . '</label>';
break;
case 'radio':
foreach ($field['options'] as $option) {
echo '<input type="radio" name="' . $field['id'] . '" id="' . $field['id'] . '_' . $option['value'] . '" value="' . $option['value'] . '"' . ($meta === $option['value'] ? ' checked="checked"' : '') . ' /> ' . '<label for="' . $field['id'] . '_' . $option['value'] . '">' . $option['label'] . '</label>' . '<br />';
}
echo '<span class="description">' . $field['desc'] . '</span>';
break;
case 'radio_img':
echo '<table>' . '<tr>';
foreach ($field['options'] as $option) {
echo '<td style="text-align:center;">' . '<input type="radio" name="' . $field['id'] . '" id="' . $field['id'] . '_' . $option['value'] . '" value="' . $option['value'] . '"' . ($meta === $option['value'] ? ' checked="checked"' : '') . ' />' . '<br />' . '<label for="' . $field['id'] . '_' . $option['value'] . '">' . '<img src="' . $option['img'] . '" alt="' . $option['label'] . '" />' . '<br />' . $option['label'] . '</label>' . '</td>';
}
echo '</tr>' . '</table>' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'checkbox_group':
$i = 0;
foreach ($field['options'] as $option) {
echo '<input type="checkbox" value="' . $option['value'] . '" name="' . $field['id'] . '[' . $i . ']" id="' . $field['id'] . '_' . $option['value'] . '"' . ($meta && in_array($option['value'], $meta) ? ' checked="checked"' : '') . ' /> ' . '<label for="' . $field['id'] . '_' . $option['value'] . '">' . $option['label'] . '</label>' . '<br />';
$i++;
}
echo '<span class="description">' . $field['desc'] . '</span>';
break;
case 'select':
echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">';
foreach ($field['options'] as $option) {
echo '<option value="' . $option['value'] . '"' . ($meta === $option['value'] ? ' selected="selected"' : '') . '>' . $option['label'] . ' </option>';
}
echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'select_sidebar':
echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Default Sidebar', 'cmsmasters') . ' </option>';
if (!empty($cmsms_option[CMSMS_SHORTNAME . '_sidebar'])) {
foreach ($cmsms_option[CMSMS_SHORTNAME . '_sidebar'] as $sidebar_id => $sidebar_name) {
echo '<option value="' . generateSlug($sidebar_name, 45) . '"' . ($meta !== '' && $meta === generateSlug($sidebar_name, 45) ? ' selected="selected"' : '') . '>' . $sidebar_name . ' </option>';
}
}
echo '</select>' . '<br />' . '<span class="description">' . $field['desc'] . '</span>';
break;
case 'select_slider':
$sliderManager = new cmsmsSliderManager();
$sliders = $sliderManager->getSliders();
echo '<select name="' . $field['id'] . '" id="' . $field['id'] . '">' . '<option value="">' . __('Select Slider', 'cmsmasters') . ' </option>';
if (!empty($sliders)) {
foreach ($sliders as $slider) {
echo '<option value="' . $slider['id'] . '"' . ($meta !== '' && (int) $meta === $slider['id'] ? ' selected="selected"' : '') . '>' . $slider['name'] . ' </option>';
}
}
//.........这里部分代码省略.........
示例4: form
function form($instance)
{
$title = isset($instance['title']) ? esc_attr($instance['title']) : '';
$subtitle = isset($instance['subtitle']) ? esc_attr($instance['subtitle']) : '';
$icon = isset($instance['icon']) ? esc_attr($instance['icon']) : '';
$text = isset($instance['text']) ? esc_attr($instance['text']) : '';
$widget_width = isset($instance['widget_width']) && $instance['widget_width'] != '' ? $instance['widget_width'] : 'one_first';
?>
<p>
<label for="<?php
echo $this->get_field_id('title');
?>
"><?php
_e('Title', 'cmsmasters');
?>
:<br />
<input class="widefat" id="<?php
echo $this->get_field_id('title');
?>
" name="<?php
echo $this->get_field_name('title');
?>
" type="text" value="<?php
echo $title;
?>
" />
</label>
</p>
<p>
<label for="<?php
echo $this->get_field_id('subtitle');
?>
"><?php
_e('Subtitle', 'cmsmasters');
?>
:<br />
<input class="widefat" id="<?php
echo $this->get_field_id('subtitle');
?>
" name="<?php
echo $this->get_field_name('subtitle');
?>
" type="text" value="<?php
echo $subtitle;
?>
" />
</label>
</p>
<p class="m0">
<label for="<?php
echo $this->get_field_id('icon');
?>
"><?php
_e('Icon', 'cmsmasters');
?>
:<br />
<input id="<?php
echo $this->get_field_id('icon');
?>
" name="<?php
echo $this->get_field_name('icon');
?>
" type="hidden" value="<?php
echo $icon;
?>
" />
</label>
</p>
<div class="cmsmasters_icon_list">
<ul id="icons<?php
echo $this->get_field_id('icon');
?>
" class="iconslist">
<?php
$cmsms_option = cmsms_get_global_options();
if (!empty($cmsms_option[CMSMS_SHORTNAME . '_heading_icons'])) {
foreach ($cmsms_option[CMSMS_SHORTNAME . '_heading_icons'] as $icon_numb => $icon_id) {
$image = wp_get_attachment_image_src($icon_id, 'thumbnail');
echo '<li id="cmsms_heading_icon_' . $icon_numb . '"' . ($icon !== '' && $icon === $icon_id ? ' class="current_icon"' : '') . '>' . "\n" . '<a href="' . $icon_id . '" class="click_img">' . "\n" . '<img src="' . $image[0] . '" alt="' . $icon_numb . '" />' . "\n" . '</a>' . "\n" . '</li>' . "\n";
}
} else {
echo '<li>' . __('Add new heading icons', 'cmsmasters') . ' <a href="' . admin_url() . 'admin.php?page=cmsms-settings-icon&tab=heading">' . __('here', 'cmsmasters') . '</a>.</li>';
}
?>
</ul>
</div>
<p>
<label for="<?php
echo $this->get_field_id('text');
?>
"><?php
_e('Text', 'cmsmasters');
?>
:<br />
<textarea class="widefat" id="<?php
echo $this->get_field_id('text');
?>
" name="<?php
echo $this->get_field_name('text');
?>
//.........这里部分代码省略.........
示例5: cmsms_header_styles
function cmsms_header_styles()
{
global $post;
$cmsms_option = cmsms_get_global_options();
if (!is_home() && !is_404() && !is_archive() && !is_search()) {
$cmsms_bg_default = get_post_meta($post->ID, 'cmsms_bg_default', true);
$cmsms_bg_col = get_post_meta($post->ID, 'cmsms_bg_col', true);
$cmsms_bg_img_enable = get_post_meta($post->ID, 'cmsms_bg_img_enable', true);
$cmsms_bg_img = get_post_meta($post->ID, 'cmsms_bg_img', true);
$cmsms_bg_pos = get_post_meta($post->ID, 'cmsms_bg_pos', true);
$cmsms_bg_rep = get_post_meta($post->ID, 'cmsms_bg_rep', true);
$cmsms_bg_att = get_post_meta($post->ID, 'cmsms_bg_att', true);
}
echo '<style type="text/css">';
if (!is_home() && !is_404() && !is_archive() && !is_search() && $cmsms_bg_default != 'true') {
echo 'body { ' . 'background-color : ' . $cmsms_bg_col . '; ' . 'background-image : ' . ($cmsms_bg_img_enable == 'true' ? 'url(' . (is_numeric($cmsms_bg_img) ? array_shift(wp_get_attachment_image_src($cmsms_bg_img, 'full')) : $cmsms_bg_img) . ')' : 'none') . '; ' . 'background-position : ' . ($cmsms_bg_img_enable == 'true' ? $cmsms_bg_pos : 'top center') . '; ' . 'background-repeat : ' . ($cmsms_bg_img_enable == 'true' ? $cmsms_bg_rep : 'repeat') . '; ' . 'background-attachment : ' . ($cmsms_bg_img_enable == 'true' ? $cmsms_bg_att : 'scroll') . '; ' . '}';
} else {
echo 'body { ' . 'background-color : ' . $cmsms_option[CMSMS_SHORTNAME . '_bg_col'] . '; ' . 'background-image : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? 'url(' . (is_numeric($cmsms_option[CMSMS_SHORTNAME . '_bg_img']) ? array_shift(wp_get_attachment_image_src($cmsms_option[CMSMS_SHORTNAME . '_bg_img'], 'full')) : $cmsms_option[CMSMS_SHORTNAME . '_bg_img']) . ')' : 'none') . '; ' . 'background-position : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? $cmsms_option[CMSMS_SHORTNAME . '_bg_pos'] : 'top center') . '; ' . 'background-repeat : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? $cmsms_option[CMSMS_SHORTNAME . '_bg_rep'] : 'repeat') . '; ' . 'background-attachment : ' . ($cmsms_option[CMSMS_SHORTNAME . '_bg_img_enable'] ? $cmsms_option[CMSMS_SHORTNAME . '_bg_att'] : 'scroll') . '; ' . '}';
}
$fixed_header_margin_top = $cmsms_option[CMSMS_SHORTNAME . '_header_height'];
$fixed_header_height = $cmsms_option[CMSMS_SHORTNAME . '_header_height'] / 3 * 2;
$margin_difference = $cmsms_option[CMSMS_SHORTNAME . '_header_height'] / 6;
echo '#middle.cmsms_middle_margin { ' . 'margin-top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_height'] . 'px; ' . '} ' . '#header > .header_inner { ' . 'height : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_height'] . 'px; ' . '} ' . '#header.fixed_header + * { ' . 'margin-top : ' . $fixed_header_margin_top . 'px; ' . '} ' . '#header > .header_inner > a.logo { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_top'] . 'px; ' . 'left : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_left'] . 'px; ' . '} ' . '.header_inner:after { ' . 'width : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '#header > .header_inner > a.logo > img { ' . 'width : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_width'] . 'px; ' . 'height : ' . $cmsms_option[CMSMS_SHORTNAME . '_logo_height'] . 'px; ' . '} ' . '#header nav { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_nav_top'] . 'px; ' . 'left : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '#header .social_icons { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_social_top'] . 'px; ' . 'left : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '#header .search_line { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_height'] / 2 . 'px; ' . 'left : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_width'] < 255 ? 255 : $cmsms_option[CMSMS_SHORTNAME . '_logo_width']) . 'px; ' . '} ' . '.header_html { ' . 'top : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_custom_html_top'] . 'px; ' . 'right : ' . $cmsms_option[CMSMS_SHORTNAME . '_header_custom_html_right'] . 'px; ' . '} ' . '#header.fixed_header > .header_inner { ' . 'height : ' . $fixed_header_height . 'px; ' . '} ' . '#header.fixed_header > .header_inner > a.logo { ' . 'top : ' . ($cmsms_option[CMSMS_SHORTNAME . '_logo_top'] - $margin_difference) . 'px; ' . '} ' . '#header.fixed_header nav { ' . 'top : ' . ($cmsms_option[CMSMS_SHORTNAME . '_header_nav_top'] - $margin_difference) . 'px; ' . '} ' . '#header.fixed_header .social_icons { ' . 'top : ' . ($cmsms_option[CMSMS_SHORTNAME . '_header_social_top'] - $margin_difference) . 'px; ' . '} ' . '#header.fixed_header .search_line { ' . 'top : ' . $fixed_header_height / 2 . 'px; ' . '} ' . '@media only screen and (max-width : 1024px) { ' . '.cmsms_responsive #middle.cmsms_middle_margin { ' . 'margin-top : 0px; ' . '} ' . '.cmsms_responsive .header_inner:after { ' . 'margin-left : 5%; ' . '} ' . '.cmsms_responsive #header nav { ' . 'top : auto; ' . 'left : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner > a.logo { ' . 'top : auto; ' . 'left : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner { ' . 'height : auto; ' . '} ' . '} ' . '@media only screen and (max-width : 767px) { ' . '.cmsms_responsive #header .search_line, .cmsms_responsive #header .social_icons { ' . 'top : auto; ' . 'left : auto; ' . '} ' . '} ' . '@media only screen and (max-width : 450px) { ' . '.cmsms_responsive .header_html { ' . 'top : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner > a.logo { ' . 'width : 90%; ' . 'height : auto; ' . '} ' . '.cmsms_responsive #header > .header_inner > a.logo > img { ' . 'margin : 0 auto; ' . '} ' . '.cmsms_responsive .header_inner:after { ' . 'width : 90%; ' . '} ' . '} ' . '</style>';
}
示例6: cmsms_more
function cmsms_more($cmsms_id, $type = 'post')
{
if ($type == 'post') {
// Post type - blog
$cmsms_option = cmsms_get_global_options();
if ($cmsms_option[CMSMS_SHORTNAME . '_blog_page_more']) {
$cmsms_post_read_more = get_post_meta($cmsms_id, 'cmsms_post_read_more', true);
if ($cmsms_post_read_more == '') {
$cmsms_post_read_more = __('Read More', 'cmsmasters');
}
echo '<a class="more_button" href="' . get_permalink($cmsms_id) . '">' . $cmsms_post_read_more . '<span></span></a>' . "\n";
}
} elseif ($type == 'project') {
// Post type - portfolio
$cmsms_project_more = get_post_meta($cmsms_id, 'project_more', true);
if ($cmsms_project_more == '') {
$cmsms_project_more = __('Read More', 'cmsmasters');
}
echo '<a class="more_button" href="' . get_permalink($cmsms_id) . '">' . $cmsms_project_more . '<span></span></a>';
} elseif ($type == 'testimonial') {
// Post type - testimonial
$cmsms_option = cmsms_get_global_options();
if ($cmsms_option[CMSMS_SHORTNAME . '_testimonial_page_more']) {
$cmsms_testimonial_more = get_post_meta($cmsms_id, 'cmsms_testimonial_more', true);
if ($cmsms_testimonial_more == '') {
$cmsms_testimonial_more = __('Read More', 'cmsmasters');
}
echo '<a class="button" href="' . get_permalink($cmsms_id) . '">' . $cmsms_testimonial_more . '</a>' . "\n";
}
}
}
示例7: cmsms_form_field_fn
function cmsms_form_field_fn($args = array())
{
$cmsms_option = cmsms_get_global_options();
extract($args);
$settings_output = cmsms_get_settings();
$cmsms_option_name = $settings_output['cmsms_option_name'];
$options = get_option($cmsms_option_name);
if (!isset($options[$id])) {
$options[$id] = $std;
}
$field_class = $class != '' ? ' ' . $class : '';
switch ($type) {
case 'text':
$options[$id] = esc_attr(stripslashes($options[$id]));
echo '<input class="regular-text' . $field_class . '" type="text" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $options[$id] . '" />' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
break;
case 'multi-text':
foreach ($choices as $item) {
$item = explode('|', $item);
$item[0] = esc_html($item[0]);
if (!empty($options[$id])) {
foreach ($options[$id] as $option_key => $option_val) {
if ($item[1] == $option_key) {
$value = $option_val;
}
}
} else {
$value = '';
}
echo '<span>' . $item[0] . ':</span> ' . '<input class="' . $field_class . '" type="text" id="' . $id . '|' . $item[1] . '" name="' . $cmsms_option_name . '[' . $id . '|' . $item[1] . ']" value="' . $value . '" />' . '<br />';
}
echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
break;
case 'textarea':
$options[$id] = esc_html(stripslashes($options[$id]));
echo '<textarea class="textarea' . $field_class . '" type="text" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" rows="5" cols="30">' . $options[$id] . '</textarea>' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
break;
case 'select':
echo '<select id="' . $id . '" class="select' . $field_class . '" name="' . $cmsms_option_name . '[' . $id . ']">';
foreach ($choices as $item) {
$item = explode('|', $item);
$item[0] = esc_html($item[0]);
$selected = $options[$id] == $item[1] ? ' selected="selected"' : '';
echo '<option value="' . $item[1] . '"' . $selected . '>' . $item[0] . '</option>';
}
echo '</select>' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
break;
case 'select_sidebar':
echo '<select id="' . $id . '" class="select' . $field_class . '" name="' . $cmsms_option_name . '[' . $id . ']">' . '<option value="">' . __('None', 'cmsmasters') . ' </option>' . '<option value="default"' . ($options[$id] !== '' && $options[$id] === 'default' ? ' selected="selected"' : '') . '>' . __('Default Sidebar', 'cmsmasters') . ' </option>';
foreach ($cmsms_option[CMSMS_SHORTNAME . '_sidebar'] as $sidebar_id => $sidebar_name) {
echo '<option value="' . generateSlug($sidebar_name, 45) . '"' . ($options[$id] !== '' && $options[$id] === generateSlug($sidebar_name, 45) ? ' selected="selected"' : '') . '>' . $sidebar_name . ' </option>';
}
echo '</select>' . '<br />' . ($desc != '' ? '<br />' . '<span class="description">' . $desc . '</span>' : '');
break;
case 'checkbox':
echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="1" ' . checked($options[$id], 1, false) . ' /> ' . ($desc != '' ? '<span class="description">' . $desc . '</span>' : '');
break;
case 'multi-checkbox':
foreach ($choices as $item) {
$item = explode('|', $item);
$item[0] = esc_html($item[0]);
$checked = '';
if (isset($options[$id][$item[1]]) && $options[$id][$item[1]] == 'true') {
$checked = ' checked="checked"';
}
echo '<input class="checkbox' . $field_class . '" type="checkbox" id="' . $id . '|' . $item[1] . '" name="' . $cmsms_option_name . '[' . $id . '|' . $item[1] . ']" value="1"' . $checked . ' /> ' . '<label for="' . $id . '|' . $item[1] . '">' . $item[0] . '</label>' . '<br />';
}
echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
break;
case 'number':
$options[$id] = esc_attr(stripslashes($options[$id]));
echo '<input class="small-text' . $field_class . '" type="number" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $options[$id] . '" />' . ($desc != '' ? ' ' . '<span class="description">' . $desc . '</span>' : '');
break;
case 'radio':
foreach ($choices as $item) {
$item = explode('|', $item);
$item[0] = esc_html($item[0]);
echo '<input class="radio' . $field_class . '" type="radio" id="' . $id . '|' . $item[1] . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $item[1] . '" ' . checked($options[$id], $item[1], false) . ' /> ' . '<label for="' . $id . '|' . $item[1] . '">' . $item[0] . '</label>' . '<br />';
}
echo $desc != '' ? '<span class="description">' . $desc . '</span>' : '';
break;
case 'radio_img':
foreach ($choices as $item) {
$item = explode('|', $item);
$item[0] = esc_html($item[0]);
echo '<div style="text-align:center; float:left; margin-right:20px;">' . '<input class="radio' . $field_class . '" type="radio" id="' . $id . '|' . $item[2] . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $item[2] . '" ' . checked($options[$id], $item[2], false) . ' />' . '<br />' . '<label for="' . $id . '|' . $item[2] . '">' . '<img src="' . $item[1] . '" alt="' . $item[0] . '" title="' . $item[0] . '" />' . '<br />' . $item[0] . '</label>' . '</div>';
}
echo $desc != '' ? '<div style="clear:both;"></div>' . '<br />' . '<span class="description">' . $desc . '</span>' : '';
break;
case 'color':
$options[$id] = esc_attr(stripslashes($options[$id]));
echo '<input type="text" id="' . $id . '" name="' . $cmsms_option_name . '[' . $id . ']" value="' . $options[$id] . '" class="my-color-field" data-default-color="' . $std . '" />' . '<br />' . '<span class="description">' . ($desc != '' ? $desc . '<br />' : '') . '</span>' . '<script type="text/javascript">' . 'jQuery(document).ready(function () { ' . '(function ($) { ' . "\$('#" . $id . "').wpColorPicker(); " . '} )(jQuery); ' . '} ); ' . '</script>';
break;
case 'upload':
$options[$id] = esc_attr(stripslashes($options[$id]));
$image = $std;
echo '<span id="' . $id . '_default" class="custom_default_image" style="display:none;">' . $image . '</span>';
if (isset($options[$id]) && $options[$id] != '' && $options[$id] != $std) {
if (is_numeric($options[$id])) {
$image = wp_get_attachment_image_src($options[$id], 'medium');
//.........这里部分代码省略.........