コード例 #1
0
ファイル: listing.php プロジェクト: afquinterog/zephyr
?>
<div class="w-portfolio-list"><?php 
// Preparing template settings for loop post template
$template_vars = array('metas' => $metas);
// Start the loop.
while (have_posts()) {
    the_post();
    us_load_template('templates/portfolio/listing-post', $template_vars);
}
?>
</div><?php 
if ($has_pagination) {
    $json_data = array('ajax_url' => admin_url('admin-ajax.php'), 'template_vars' => array('ratio' => $ratio, 'metas' => $metas), 'perpage' => $perpage, 'page' => $page, 'order' => $tile_order, 'sizes' => $tile_sizes);
    ?>
<div class="w-portfolio-json hidden"<?php 
    echo us_pass_data_to_js($json_data);
    ?>
></div><?php 
    if ($pagination == 'regular') {
        ?>
<div class="g-pagination"><?php 
        the_posts_pagination(array('prev_text' => '<', 'next_text' => '>', 'before_page_number' => '<span>', 'after_page_number' => '</span>'));
        ?>
</div><?php 
    } elseif ($pagination == 'ajax') {
        // Passing g-loadmore options to JavaScript via onclick event
        ?>
<div class="g-loadmore">
			<a href="javascript:void(0);" class="w-btn color_primary style_flat size_large">
				<label><?php 
        _e('Load More', 'us');
コード例 #2
0
ファイル: listing.php プロジェクト: afquinterog/zephyr
    if ($pagination == 'regular') {
        ?>
<div class="g-pagination"><?php 
        the_posts_pagination(array('prev_text' => '<', 'next_text' => '>', 'before_page_number' => '<span>', 'after_page_number' => '</span>'));
        ?>
</div><?php 
    } elseif ($pagination == 'ajax') {
        // Next page elements may have sliders, so we preloading the needed assets now
        // TODO On-demand ajax assets usage
        wp_enqueue_script('us-royalslider');
        wp_enqueue_style('us-royalslider');
        // Passing g-loadmore options to JavaScript via onclick event
        $loadmore_options = array('ajax_url' => admin_url('admin-ajax.php'), 'action' => 'us_ajax_blog', 'max_num_pages' => $wp_query->max_num_pages, 'template_vars' => array('query_args' => $query_args, 'layout_type' => $layout_type, 'metas' => $metas, 'content_type' => $content_type, 'show_read_more' => $show_read_more));
        ?>
<div class="g-loadmore"<?php 
        echo us_pass_data_to_js($loadmore_options);
        ?>
>
			<a href="javascript:void(0);" class="w-btn color_primary style_flat size_large">
				<label><?php 
        _e('Load More', 'us');
        ?>
</label>
			</a>
			<div class="g-preloader style_2"></div>
		</div><?php 
    }
}
?>
</div><?php 
if ($use_custom_query) {
コード例 #3
0
 /**
  * Process options data and build option fields
  *
  * @uses get_option()
  *
  * @access public
  * @since 1.0.0
  *
  * @return array
  */
 public static function optionsframework_machine($options)
 {
     $data = of_get_options();
     $smof_data = of_get_options();
     $defaults = array();
     $counter = 0;
     $menu = '';
     $output = '';
     $gfont_weights = array('100' => __('Thin 100', 'us'), '100italic' => __('Thin 100 Italic', 'us'), '200' => __('Extra-Light 200', 'us'), '200italic' => __('Extra-Light 200 Italic', 'us'), '300' => __('Light 300', 'us'), '300italic' => __('Light 300 Italic', 'us'), '400' => __('Normal 400', 'us'), '400italic' => __('Normal 400 Italic', 'us'), '500' => __('Medium 500', 'us'), '500italic' => __('Medium 500 Italic', 'us'), '600' => __('Semi-Bold 600', 'us'), '600italic' => __('Semi-Bold 600 Italic', 'us'), '700' => __('Bold 700', 'us'), '700italic' => __('Bold 700 Italic', 'us'), '800' => __('Extra-Bold 800', 'us'), '800italic' => __('Extra-Bold 800 Italic', 'us'), '900' => __('Ultra-Bold 900', 'us'), '900italic' => __('Ultra-Bold 900 Italic', 'us'));
     foreach ($options as $value) {
         $counter++;
         $val = '';
         //create array of defaults
         if ($value['type'] == 'multicheck') {
             if (is_array($value['std'])) {
                 foreach ($value['std'] as $i => $key) {
                     $defaults[$value['id']][$key] = true;
                 }
             } else {
                 $defaults[$value['id']][$value['std']] = true;
             }
         } else {
             if (isset($value['id']) and isset($value['std'])) {
                 $defaults[$value['id']] = $value['std'];
             }
         }
         //Start Heading
         if ($value['type'] != "heading") {
             $class = '';
             if (isset($value['class'])) {
                 $class = $value['class'];
             }
             //hide items in checkbox group
             $fold = '';
             if (array_key_exists('fold', $value)) {
                 if (@$smof_data[$value['fold']]) {
                     $fold = 'f_' . $value['fold'] . ' ';
                 } else {
                     $fold = 'f_' . $value['fold'] . ' temphide ';
                 }
             } elseif (array_key_exists('unfold', $value)) {
                 if (@$smof_data[$value['unfold']]) {
                     $fold = 'uf_' . $value['unfold'] . ' temphide ';
                 } else {
                     $fold = 'uf_' . $value['unfold'] . ' ';
                 }
             }
             $output .= '<div id="section-' . $value['id'] . '" class="' . $fold . 'section section-' . $value['type'] . ' ' . $class . '">' . "\n";
             //only show header if 'name' value exists
             if ($value['name']) {
                 $output .= '<h3 class="heading">' . $value['name'] . '</h3>' . "\n";
             }
             if ($value['type'] == 'checkbox' or $value['type'] == 'radio') {
                 $output .= '<label class="option">' . "\n" . '<div class="controls">' . "\n";
             } else {
                 $output .= '<div class="option">' . "\n" . '<div class="controls">' . "\n";
             }
         }
         //End Heading
         // Set default value for absent options
         if (!in_array($value['type'], array('info', 'image', 'heading', 'slider', 'sorter', 'backup', 'transfer')) and !isset($smof_data[$value['id']]) and isset($defaults[$value['id']])) {
             $smof_data[$value['id']] = $defaults[$value['id']];
         }
         //switch statement to handle various options type
         switch ($value['type']) {
             //text input
             case 'text':
                 $t_value = '';
                 $_smof_val = $t_value = isset($smof_data[$value['id']]) ? stripslashes($smof_data[$value['id']]) : '';
                 $_smof_val = $t_value = str_replace('"', '&quot;', $t_value);
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<input class="of-input ' . $mini . '" name="' . $value['id'] . '" id="' . $value['id'] . '" type="' . $value['type'] . '" value="' . $t_value . '" />';
                 break;
                 //select option
             //select option
             case 'select':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $_smof_val = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $value['id'] . '_' . $select_ID . '" value="' . $select_ID . '" ' . selected($_smof_val, $select_ID, false) . '>' . $option . '</option>';
                 }
                 $output .= '</select></div>';
                 break;
                 //select predefined option
             //select predefined option
             case 'select_predefined_options':
                 $mini = '';
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if ($value['mod'] == 'mini') {
                     $mini = 'mini';
                 }
                 $output .= '<div class="select_wrapper ' . $mini . '">';
                 $output .= '<select class="select of-input" name="' . $value['id'] . '" id="' . $value['id'] . '">';
                 $_smof_val = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $select_ID => $option) {
                     $output .= '<option id="' . $value['id'] . '_' . $select_ID . '" value="' . $select_ID . '" ' . selected($_smof_val, $select_ID, false) . '>' . $option['title'] . '</option>';
                 }
                 $output .= '</select><div class="json-data"' . us_pass_data_to_js($value['options']) . '></div></div>';
                 break;
                 //textarea option
             //textarea option
             case 'textarea':
                 $cols = '8';
                 $ta_value = '';
                 if (isset($value['options'])) {
                     $ta_options = $value['options'];
                     if (isset($ta_options['cols'])) {
                         $cols = $ta_options['cols'];
                     }
                 }
                 $ta_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 $output .= '<textarea class="of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" cols="' . $cols . '" rows="8">' . $ta_value . '</textarea>';
                 break;
                 //radiobox option
             //radiobox option
             case "radio":
                 $checked = isset($smof_data[$value['id']]) ? checked($smof_data[$value['id']], $option, false) : '';
                 foreach ($value['options'] as $option => $name) {
                     $output .= '<input class="of-input of-radio" name="' . $value['id'] . '" type="radio" value="' . $option . '" ' . checked($smof_data[$value['id']], $option, false) . ' /><label class="radio">' . $name . '</label><br/>';
                 }
                 break;
                 //checkbox option
             //checkbox option
             case 'checkbox':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "fld ";
                 }
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 break;
                 //multiple checkbox option
             //multiple checkbox option
             case 'multicheck':
                 isset($smof_data[$value['id']]) ? $multi_stored = $smof_data[$value['id']] : ($multi_stored = "");
                 foreach ($value['options'] as $key => $option) {
                     if (!isset($multi_stored[$key])) {
                         $multi_stored[$key] = '';
                     }
                     $of_key_string = $value['id'] . '_' . $key;
                     $output .= '<input type="checkbox" class="checkbox of-input" name="' . $value['id'] . '[' . $key . ']' . '" id="' . $of_key_string . '" value="1" ' . checked($multi_stored[$key], 1, false) . ' /><label class="multicheck" for="' . $of_key_string . '">' . $option . '</label><br />';
                 }
                 break;
                 //ajax image upload option
             //ajax image upload option
             case 'upload':
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 if (!isset($value['std'])) {
                     $value['std'] = '';
                 }
                 $output .= Options_Machine::optionsframework_uploader_function($value['id'], $value['std'], $value['mod']);
                 break;
                 // native media library uploader - @uses optionsframework_media_uploader_function()
             // native media library uploader - @uses optionsframework_media_uploader_function()
             case 'media':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 if (!isset($value['mod'])) {
                     $value['mod'] = '';
                 }
                 $output .= Options_Machine::optionsframework_media_uploader_function($value['id'], $value['std'], $int, $value['mod']);
                 // New AJAX Uploader using Media Library
                 break;
                 //colorpicker option
             //colorpicker option
             case 'color':
                 $_color = !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 $output .= '<div id="' . $value['id'] . '_picker" class="colorSelector"><div style="background-color: ' . $_color . '"></div></div>';
                 $output .= '<input class="of-color" name="' . $value['id'] . '" id="' . $value['id'] . '" type="text" value="' . $_color . '" />';
                 break;
                 //typography option
             //typography option
             case 'typography':
                 $typography_stored = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 /* Font Size */
                 if (isset($typography_stored['size'])) {
                     $output .= '<div class="select_wrapper typography-size" original-title="Font size">';
                     $output .= '<select class="of-typography of-typography-size select" name="' . $value['id'] . '[size]" id="' . $value['id'] . '_size">';
                     for ($i = 9; $i < 20; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['size'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Line Height */
                 if (isset($typography_stored['height'])) {
                     $output .= '<div class="select_wrapper typography-height" original-title="Line height">';
                     $output .= '<select class="of-typography of-typography-height select" name="' . $value['id'] . '[height]" id="' . $value['id'] . '_height">';
                     for ($i = 20; $i < 38; $i++) {
                         $test = $i . 'px';
                         $output .= '<option value="' . $i . 'px" ' . selected($typography_stored['height'], $test, false) . '>' . $i . 'px</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Face */
                 if (isset($typography_stored['face'])) {
                     $output .= '<div class="select_wrapper typography-face" original-title="Font family">';
                     $output .= '<select class="of-typography of-typography-face select" name="' . $value['id'] . '[face]" id="' . $value['id'] . '_face">';
                     $faces = array('arial' => 'Arial', 'verdana' => 'Verdana, Geneva', 'trebuchet' => 'Trebuchet', 'georgia' => 'Georgia', 'times' => 'Times New Roman', 'tahoma' => 'Tahoma, Geneva', 'palatino' => 'Palatino', 'helvetica' => 'Helvetica');
                     foreach ($faces as $i => $face) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['face'], $i, false) . '>' . $face . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Weight */
                 if (isset($typography_stored['style'])) {
                     $output .= '<div class="select_wrapper typography-style" original-title="Font style">';
                     $output .= '<select class="of-typography of-typography-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                     $styles = array('normal' => 'Normal', 'italic' => 'Italic', 'bold' => 'Bold', 'bold italic' => 'Bold Italic');
                     foreach ($styles as $i => $style) {
                         $output .= '<option value="' . $i . '" ' . selected($typography_stored['style'], $i, false) . '>' . $style . '</option>';
                     }
                     $output .= '</select></div>';
                 }
                 /* Font Color */
                 if (isset($typography_stored['color'])) {
                     $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector typography-color"><div style="background-color: ' . $typography_stored['color'] . '"></div></div>';
                     $output .= '<input class="of-color of-typography of-typography-color" original-title="Font color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $typography_stored['color'] . '" />';
                 }
                 break;
                 //border option
             //border option
             case 'border':
                 /* Border Width */
                 $border_stored = $smof_data[$value['id']];
                 $output .= '<div class="select_wrapper border-width">';
                 $output .= '<select class="of-border of-border-width select" name="' . $value['id'] . '[width]" id="' . $value['id'] . '_width">';
                 for ($i = 0; $i < 21; $i++) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['width'], $i, false) . '>' . $i . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Style */
                 $output .= '<div class="select_wrapper border-style">';
                 $output .= '<select class="of-border of-border-style select" name="' . $value['id'] . '[style]" id="' . $value['id'] . '_style">';
                 $styles = array('none' => 'None', 'solid' => 'Solid', 'dashed' => 'Dashed', 'dotted' => 'Dotted');
                 foreach ($styles as $i => $style) {
                     $output .= '<option value="' . $i . '" ' . selected($border_stored['style'], $i, false) . '>' . $style . '</option>';
                 }
                 $output .= '</select></div>';
                 /* Border Color */
                 $output .= '<div id="' . $value['id'] . '_color_picker" class="colorSelector"><div style="background-color: ' . $border_stored['color'] . '"></div></div>';
                 $output .= '<input class="of-color of-border of-border-color" name="' . $value['id'] . '[color]" id="' . $value['id'] . '_color" type="text" value="' . $border_stored['color'] . '" />';
                 break;
                 //images checkbox - use image as checkboxes
             //images checkbox - use image as checkboxes
             case 'images':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $key, false)) {
                         $checked = checked($select_value, $key, false);
                         $selected = 'of-radio-img-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-img-' . $value['id'] . $i . '" class="checkbox of-radio-img-radio" value="' . $key . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-img-label">' . $key . '</div>';
                     $output .= '<img src="' . $option . '" alt="" class="of-radio-img-img ' . $selected . '" onClick="document.getElementById(\'of-radio-img-' . $value['id'] . $i . '\').checked = true;" />';
                     $output .= '</span>';
                 }
                 break;
                 //info (for small intro box etc)
             //info (for small intro box etc)
             case "info":
                 $info_text = $value['std'];
                 $output .= '<div class="of-info">' . $info_text . '</div>';
                 break;
                 //display a single image
             //display a single image
             case "image":
                 $src = $value['std'];
                 $output .= '<img src="' . $src . '">';
                 break;
                 //tab heading
             //tab heading
             case 'heading':
                 if ($counter >= 2) {
                     $output .= '</div>' . "\n";
                 }
                 if (isset($value['classname'])) {
                     $header_class = $value['classname'];
                 } else {
                     $header_class = str_replace(' ', '', strtolower($value['name']));
                 }
                 $jquery_click_hook = "of-option-" . $header_class;
                 $menu .= '<li class="' . $header_class . '"><a title="' . $value['name'] . '" href="#' . $jquery_click_hook . '">' . $value['name'] . '</a></li>';
                 $output .= '<div class="group" id="' . $jquery_click_hook . '"><h2>' . $value['name'] . '</h2>' . "\n";
                 break;
                 //drag & drop slide manager
             //drag & drop slide manager
             case 'slider':
                 $_id = strip_tags(strtolower($value['id']));
                 $int = '';
                 $int = optionsframework_mlu_get_silentpost($_id);
                 $output .= '<div class="slider"><ul id="' . $value['id'] . '" rel="' . $int . '">';
                 $slides = $smof_data[$value['id']];
                 $count = count($slides);
                 if ($count < 2) {
                     $oldorder = 1;
                     $order = 1;
                     $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                 } else {
                     $i = 0;
                     foreach ($slides as $slide) {
                         $oldorder = $slide['order'];
                         $i++;
                         $order = $i;
                         $output .= Options_Machine::optionsframework_slider_function($value['id'], $value['std'], $oldorder, $order, $int);
                     }
                 }
                 $output .= '</ul>';
                 $output .= '<a href="#" class="button slide_add_button">Add New Slide</a></div>';
                 break;
                 //drag & drop block manager
             //drag & drop block manager
             case 'sorter':
                 $sortlists = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : $value['std'];
                 $output .= '<div id="' . $value['id'] . '" class="sorter">';
                 if ($sortlists) {
                     foreach ($sortlists as $group => $sortlist) {
                         $output .= '<ul id="' . $value['id'] . '_' . $group . '" class="sortlist_' . $value['id'] . '">';
                         $output .= '<h3>' . $group . '</h3>';
                         foreach ($sortlist as $key => $list) {
                             $output .= '<input class="sorter-placebo" type="hidden" name="' . $value['id'] . '[' . $group . '][placebo]" value="placebo">';
                             if ($key != "placebo") {
                                 $output .= '<li id="' . $key . '" class="sortee">';
                                 $output .= '<input class="position" type="hidden" name="' . $value['id'] . '[' . $group . '][' . $key . ']" value="' . $list . '">';
                                 $output .= $list;
                                 $output .= '</li>';
                             }
                         }
                         $output .= '</ul>';
                     }
                 }
                 $output .= '</div>';
                 break;
                 //background images option
             //background images option
             case 'tiles':
                 $i = 0;
                 $select_value = isset($smof_data[$value['id']]) && !empty($smof_data[$value['id']]) ? $smof_data[$value['id']] : '';
                 foreach ($value['options'] as $key => $option) {
                     $i++;
                     $checked = '';
                     $selected = '';
                     if (NULL != checked($select_value, $option, false)) {
                         $checked = checked($select_value, $option, false);
                         $selected = 'of-radio-tile-selected';
                     }
                     $output .= '<span>';
                     $output .= '<input type="radio" id="of-radio-tile-' . $value['id'] . $i . '" class="checkbox of-radio-tile-radio" value="' . $option . '" name="' . $value['id'] . '" ' . $checked . ' />';
                     $output .= '<div class="of-radio-tile-img ' . $selected . '" style="background: url(' . $option . ')" onClick="document.getElementById(\'of-radio-tile-' . $value['id'] . $i . '\').checked = true;"></div>';
                     $output .= '</span>';
                 }
                 break;
                 //backup and restore options data
             //backup and restore options data
             case 'backup':
                 $instructions = $value['desc'];
                 $backup = get_option(BACKUPS);
                 if (!isset($backup['backup_log'])) {
                     $log = __('No backups yet', 'us');
                 } else {
                     $log = $backup['backup_log'];
                 }
                 $output .= '<div class="backup-box">';
                 $output .= '<div class="instructions">' . $instructions . "\n";
                 $output .= '<p><strong>' . __('Last Backup', 'us') . ': <span class="backup-log">' . $log . '</span></strong></p></div>' . "\n";
                 $output .= '<a href="#" id="of_backup_button" class="button">' . __('Backup Options', 'us') . '</a>';
                 $output .= '<a href="#" id="of_restore_button" class="button">' . __('Restore Options', 'us') . '</a>';
                 $output .= '</div>';
                 break;
                 //export or import data between different installs
             //export or import data between different installs
             case 'transfer':
                 $instructions = $value['desc'];
                 $output .= '<textarea id="export_data" rows="8">' . base64_encode(serialize($smof_data)) . '</textarea>' . "\n";
                 $output .= '<a href="#" id="of_import_button" class="button">' . __('Import Options', 'us') . '</a>';
                 break;
                 // google font field
             // google font field
             case 'select_google_font':
                 static $first_google_font_selector = TRUE;
                 if ($first_google_font_selector) {
                     $output .= '<div class="google-fonts-json"' . us_pass_data_to_js(us_config('google-fonts')) . '></div>';
                 }
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = $value['std'];
                 }
                 $values = explode('|', $smof_data[$value['id']], 2);
                 if (!isset($values[1]) or empty($values[1])) {
                     $values[1] = '400,700';
                 }
                 $show_weights = (array) us_config('google-fonts.' . $values[0] . '.variants');
                 $output .= '<div class="ggf-container">';
                 $output .= '<input type="hidden" name="' . $value['id'] . '" value="' . implode('|', $values) . '" />';
                 $output .= '<div class="select_wrapper">';
                 $output .= '<select class="select of-input google_font_select" id="' . $value['id'] . '">';
                 $output .= '<option value="none">' . __('Font not specified', 'us') . '</option>';
                 $output .= '<optgroup label="' . __('Web safe font combinations (do not need to be loaded)', 'us') . '">';
                 foreach ($value['options']['web_safe_fonts'] as $select_key => $option) {
                     $output .= "<option value='" . $select_key . "' " . selected($values[0], $option, false) . '>' . $option . '</option>';
                 }
                 $output .= '</optgroup>';
                 $output .= '<optgroup label="' . __('Custom fonts (loaded from Google Fonts)', 'us') . '">';
                 foreach ($value['options']['google_fonts'] as $select_key => $option) {
                     $output .= '<option value="' . $select_key . '" ' . selected($values[0], $option, false) . '>' . $option . '</option>';
                 }
                 $output .= '</optgroup>';
                 $output .= '</select></div>';
                 if (isset($value['preview']['text'])) {
                     $g_text = $value['preview']['text'];
                 } else {
                     $g_text = '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz';
                 }
                 if (isset($value['preview']['size'])) {
                     $g_size = 'style="font-size: ' . $value['preview']['size'] . ';"';
                 } else {
                     $g_size = '';
                 }
                 $output .= '<p class="' . $value['id'] . '_ggf_previewer google_font_preview" ' . $g_size . '>' . $g_text . '</p>';
                 $output .= '<div class="' . $value['id'] . '_ggf_weights ggf_weights">';
                 $values[1] = explode(',', $values[1]);
                 foreach ($gfont_weights as $gfont_weight => $gfont_title) {
                     $output .= '<label for="' . $value['id'] . '_ggf_weight_' . $gfont_weight . '" ';
                     $output .= 'data-value="' . $gfont_weight . '"';
                     $output .= 'class="' . (in_array($gfont_weight, $show_weights) ? '' : 'hidden') . '">';
                     $output .= '<input type="checkbox" id="' . $value['id'] . '_ggf_weight_' . $gfont_weight . '" ';
                     $output .= 'value="' . $gfont_weight . '"';
                     $output .= in_array($gfont_weight, $values[1]) ? ' checked' : '';
                     $output .= '> ';
                     $output .= $gfont_title . '</label>';
                 }
                 $output .= '</div>';
                 $output .= '</div>';
                 break;
                 //JQuery UI Slider
             //JQuery UI Slider
             case 'sliderui':
                 $s_val = $s_min = $s_max = $s_step = $s_edit = '';
                 //no errors, please
                 $s_val = stripslashes(@$smof_data[@$value['id']]);
                 if (!isset($value['min'])) {
                     $s_min = '0';
                 } else {
                     $s_min = $value['min'];
                 }
                 if (!isset($value['max'])) {
                     $s_max = $s_min + 1;
                 } else {
                     $s_max = $value['max'];
                 }
                 if (!isset($value['step'])) {
                     $s_step = '1';
                 } else {
                     $s_step = $value['step'];
                 }
                 if (!isset($value['edit'])) {
                     $s_edit = ' readonly="readonly"';
                 } else {
                     $s_edit = '';
                 }
                 if ($s_val == '') {
                     $s_val = $s_min;
                 }
                 //values
                 $s_data = 'data-id="' . $value['id'] . '" data-val="' . $s_val . '" data-min="' . $s_min . '" data-max="' . $s_max . '" data-step="' . $s_step . '"';
                 //html output
                 $output .= '<input type="text" name="' . $value['id'] . '" id="' . $value['id'] . '" value="' . $s_val . '" class="mini" ' . $s_edit . ' />';
                 $output .= '<div id="' . $value['id'] . '-slider" class="smof_sliderui" style="margin-left: 7px;" ' . $s_data . '></div>';
                 break;
                 //Switch option
             //Switch option
             case 'switch':
                 if (!isset($smof_data[$value['id']])) {
                     $smof_data[$value['id']] = 0;
                 }
                 $fold = '';
                 if (array_key_exists("folds", $value)) {
                     $fold = "s_fld ";
                 }
                 $cb_enabled = $cb_disabled = '';
                 //no errors, please
                 //Get selected
                 if ($smof_data[$value['id']] == 1) {
                     $cb_enabled = ' selected';
                     $cb_disabled = '';
                 } else {
                     $cb_enabled = '';
                     $cb_disabled = ' selected';
                 }
                 //Label ON
                 if (!isset($value['on'])) {
                     $on = __('On', 'us');
                 } else {
                     $on = $value['on'];
                 }
                 //Label OFF
                 if (!isset($value['off'])) {
                     $off = __('Off', 'us');
                 } else {
                     $off = $value['off'];
                 }
                 $output .= '<p class="switch-options">';
                 $output .= '<label class="' . $fold . 'cb-enable' . $cb_enabled . '" data-id="' . $value['id'] . '"><span>' . $on . '</span></label>';
                 $output .= '<label class="' . $fold . 'cb-disable' . $cb_disabled . '" data-id="' . $value['id'] . '"><span>' . $off . '</span></label>';
                 $output .= '<input type="hidden" class="' . $fold . 'checkbox of-input" name="' . $value['id'] . '" id="' . $value['id'] . '" value="0"/>';
                 $output .= '<input type="checkbox" id="' . $value['id'] . '" class="' . $fold . 'checkbox of-input main_checkbox" name="' . $value['id'] . '"  value="1" ' . checked($smof_data[$value['id']], 1, false) . ' />';
                 $output .= '</p>';
                 break;
         }
         //description of each option
         if ($value['type'] != 'heading') {
             if (!isset($value['desc'])) {
                 $explain_value = '';
             } else {
                 $explain_value = '<div class="explain">' . strip_tags($value['desc'], '<a><strong>') . '</div>' . "\n";
             }
             $output .= '</div>' . $explain_value . "\n";
             if ($value['type'] == 'checkbox' or $value['type'] == 'radio') {
                 $output .= '<div class="clear"> </div></div></label>' . "\n";
             } else {
                 $output .= '<div class="clear"> </div></div></div>' . "\n";
             }
         }
     }
     $output .= '</div>';
     return array($output, $menu, $defaults);
 }
コード例 #4
0
        $js_options['fitInViewport'] = FALSE;
    }
    $full_image_attr = '';
    if ($atts['fullscreen']) {
        $full_image = wp_get_attachment_image_src($attachment->ID, 'full');
        if (!$full_image) {
            $full_image = $image;
        }
        $full_image_attr = ' data-rsBigImg="' . $full_image[0] . '"';
    }
    if ($atts['nav'] == 'thumbs') {
        $tnail = wp_get_attachment_image_src($attachment->ID, 'thumbnail');
        if (!$tnail) {
            $tnail = $image;
        }
        $images_html .= '<a class="rsImg" data-rsw="' . $image[1] . '" data-rsh="' . $image[2] . '"' . $full_image_attr . ' href="' . $image[0] . '">';
        $images_html .= '<img class="rsTmb" src="' . $tnail[0] . '" width="' . $tnail[1] . '" height="' . $tnail[2] . '" alt="" />';
        $images_html .= '</a>';
    } else {
        $images_html .= '<a class="rsImg" data-rsw="' . $image[1] . '" data-rsh="' . $image[2] . '"' . $full_image_attr . ' href="' . $image[0] . '">';
        $images_html .= '</a>';
    }
}
// We need Roayl Slider script for this
wp_enqueue_script('us-royalslider');
wp_enqueue_style('us-royalslider');
$output = '<div class="w-slider' . $classes . '">';
$output .= '<div class="royalSlider rsDefault">' . $images_html . '</div>';
$output .= '<div class="w-slider-json"' . us_pass_data_to_js($js_options) . '></div>';
$output .= '</div>';
echo $output;
コード例 #5
0
ファイル: us_gmaps.php プロジェクト: afquinterog/zephyr
}
if (!empty($atts['type'])) {
    $atts['type'] = strtoupper($atts['type']);
    if (in_array($atts['type'], array('ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN'))) {
        $script_options['maptype'] = $atts['type'];
    }
}
$custom_marker_options = '';
if ($atts['custom_marker_img'] != '') {
    if (is_numeric($atts['custom_marker_img'])) {
        $atts['custom_marker_img'] = wp_get_attachment_image_src(intval($atts['custom_marker_img']), 'thumbnail');
        if ($atts['custom_marker_img'] != NULL) {
            $atts['custom_marker_img'] = $atts['custom_marker_img'][0];
        }
    }
    $atts['custom_marker_size'] = intval($atts['custom_marker_size']);
    $script_options['icon'] = array('image' => $atts['custom_marker_img'], 'iconsize' => array($atts['custom_marker_size'], $atts['custom_marker_size']), 'iconanchor' => array(ceil($atts['custom_marker_size'] / 2), $atts['custom_marker_size']));
}
if (empty($atts['height'])) {
    $atts['height'] = 400;
}
$inner_css = ' style="height: ' . $atts['height'] . 'px"';
// Enqueued the script only once
wp_enqueue_script('us-google-maps');
wp_enqueue_script('us-gmap');
$script_options = apply_filters('us_gmaps_js_options', $script_options, get_the_ID(), $us_gmaps_index);
$output = '<div class="w-map' . $classes . '" id="us_map_' . $us_gmaps_index . '"' . $inner_css . '>';
$output .= '<div class="w-map-h"></div>';
$output .= '<div class="w-map-json"' . us_pass_data_to_js($script_options) . '></div>';
$output .= '</div>';
echo $output;