Ejemplo n.º 1
0
/**
 * Checkbox and Multi Checkbox OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_checkbox($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    echo '<div ' . build_section_class('section-checkbox', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    // build checkboxes
    $count = 0;
    foreach ((array) $item['options'] as $choice_value => $choice_label) {
        $choice_id = esc_attr($id) . '-' . $count;
        // collecting attributes
        $atts = array();
        $atts['type'] = 'checkbox';
        $atts['id'] = $choice_id;
        $atts['name'] = esc_attr($item['name']) . '[' . $count . ']';
        $atts['value'] = esc_attr($choice_value);
        if (isset($value[$count]) && (string) $value[$count] === (string) $choice_value) {
            $atts['checked'] = 'checked';
        }
        printf('<label class="checkbox" for="%1$s"><input%2$s /> %3$s</label>', $choice_id, spyropress_build_atts($atts), htmlspecialchars_decode($choice_label));
        $count++;
    }
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    if ($is_widget) {
        return $ui_content;
    } else {
        echo $ui_content;
    }
}
Ejemplo n.º 2
0
function spyropress_ui_radio_img($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    echo '<div ' . build_section_class('section-radio-img section-full', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    // build checkboxes
    $count = 0;
    foreach ((array) $item['options'] as $choice_value => $choice) {
        $choice_id = esc_attr($id) . '-' . $count;
        // collecting attributes
        $atts = array();
        $atts['type'] = 'radio';
        $atts['id'] = $choice_id;
        $atts['name'] = esc_attr($item['name']);
        $atts['value'] = esc_attr($choice_value);
        if ((string) $value === (string) $choice_value) {
            $atts['checked'] = 'checked';
        }
        $choice_title = isset($choice['title']) ? '<span>' . esc_attr($choice['title']) . '</span>' : '';
        printf('<label class="radio-img%5$s" for="%1$s"><input%2$s /><img src="%4$s" alt="" title="%3$s" />%3$s</label>', $choice_id, spyropress_build_atts($atts), $choice_title, esc_url($choice['img']), $value == $choice_value ? ' selected' : '');
        $count++;
    }
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    if ($is_widget) {
        return $ui_content;
    } else {
        echo $ui_content;
    }
}
Ejemplo n.º 3
0
function spyropress_ui_multi_select($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = isset($item['ajax']) && $item['ajax'] ? 'chosen-ajax' : 'chosen';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name'] . '[]');
    $atts['multiple'] = 'multiple';
    // adding ajax attributes
    if (isset($item['ajax']) && $item['ajax']) {
        $atts['data-type'] = 'custom_post';
        $atts['data-wp_type'] = implode(',', (array) $item['post_type']);
    }
    $value = empty($value) ? array() : $value;
    echo '<div ' . build_section_class('section-multi-select', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    printf('<select%s><option value=""></option>', spyropress_build_atts($atts));
    foreach ($item['options'] as $k => $v) {
        render_option($k, $v, $value);
    }
    echo '</select>';
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    if ($is_widget) {
        return $ui_content;
    } else {
        echo $ui_content;
    }
}
Ejemplo n.º 4
0
/**
 * Gallery OptionType
 */
function spyropress_ui_gallery($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = 'gallery_shortcode' . ($value != '' ? ' has-file' : '');
    $atts['type'] = 'hidden';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name']);
    $atts['value'] = esc_attr($value);
    $ids = explode(',', $value);
    echo '<div ' . build_section_class('section-gallery section-full', $item) . '>';
    printf('<input class="gallery_reset_button button-red button-large pull-right" type="button" value="%s" /> ', __('Clear Gallery', 'spyropress'));
    printf('<input class="gallery_upload_button button button-primary button-large right" type="button" value="%2$s" id="upload_%1$s" />', $id, __('Add/Edit Gallery', 'spyropress'));
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    echo '<div class="gallery_holder clearfix">';
    foreach ($ids as $id) {
        printf('<div data-id="%1$s" class="gallery-item">%2$s</div>', $id, wp_get_attachment_image($id));
    }
    echo '</div>';
    printf('<input%s />', spyropress_build_atts($atts));
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    if ($is_widget) {
        return $ui_content;
    } else {
        echo $ui_content;
    }
}
Ejemplo n.º 5
0
/**
 * Date Picker OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_datepicker($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = 'field';
    $atts['autocomplete'] = 'off';
    $atts['type'] = 'text';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name']);
    if (isset($item['placeholder']) && $item['placeholder']) {
        $atts['placeholder'] = esc_attr($item['placeholder']);
    }
    $atts['value'] = esc_attr($value);
    echo '<div ' . build_section_class('section-datepicker', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    printf('<input%s />', spyropress_build_atts($atts));
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    $js = "panelUi.init_datepicker();";
    if ($is_widget) {
        if (!$is_builder) {
            add_jquery_ready($js);
        } else {
            $ui_content .= sprintf('<script type="text/javascript">%2$s//<![CDATA[%2$s %1$s %2$s//]]>%2$s</script>', $js, "\n");
        }
        return $ui_content;
    } else {
        echo $ui_content;
        add_jquery_ready($js);
    }
}
Ejemplo n.º 6
0
/**
 * Textarea OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_textarea($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = 'field';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name']);
    $atts['rows'] = esc_attr($item['rows']);
    if (isset($item['placeholder']) && $item['placeholder']) {
        $atts['placeholder'] = esc_attr($item['placeholder']);
    }
    echo '<div ' . build_section_class('section-textarea', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    printf('<textarea%s>%s</textarea>', spyropress_build_atts($atts), esc_textarea($value));
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    if ($is_widget) {
        return $ui_content;
    } else {
        echo $ui_content;
    }
}
Ejemplo n.º 7
0
/**
 * Hidden OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_hidden($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['type'] = 'hidden';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name']);
    $atts['value'] = esc_attr($value);
    printf('<input%s />', spyropress_build_atts($atts));
    $ui_content = ob_get_clean();
    if ($is_widget) {
        return $ui_content;
    } else {
        echo $ui_content;
    }
}
Ejemplo n.º 8
0
function spyropress_widget_editor($item, $id, $value, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = 'field builder-rich-text';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name']);
    $atts['rows'] = esc_attr($item['rows']);
    echo '<div ' . build_section_class('section-editor section-full', $item) . '>';
    build_heading($item, true);
    build_description($item);
    echo '<div class="controls">';
    printf('<textarea %s>%s</textarea>', spyropress_build_atts($atts), wp_richedit_pre($value));
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    return $ui_content;
}
Ejemplo n.º 9
0
/**
 * Range Slider OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_range_slider($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = 'field';
    $atts['type'] = 'text';
    $atts['name'] = esc_attr($item['name']);
    $atts['value'] = esc_attr($value);
    echo '<div ' . build_section_class('section-slider', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    echo '<div class="range-slider clearfix">';
    printf('<div id="%s" class="slider"></div>', $id);
    printf('<input%s />', spyropress_build_atts($atts));
    echo '</div>';
    echo '</div>';
    echo '</div>';
    // content
    $ui_content = ob_get_clean();
    // js
    if (isset($item['max']) && $item['max'] != '') {
        $range_slider['max'] = $item['max'];
    }
    if (isset($item['min']) && $item['min'] != '') {
        $range_slider['min'] = $item['min'];
    }
    if (isset($item['step']) && $item['step'] != '') {
        $range_slider['step'] = $item['step'];
    }
    $range_slider['value'] = (int) $value;
    $range_slider['range'] = isset($item['range']) && $item['range'] != '' ? $item['range'] : 'min';
    $js = "panelUi.bind_range_slider( '{$id}', " . json_encode($range_slider) . ");";
    if ($is_widget) {
        $ui_content .= sprintf('<script type="text/javascript">%2$s//<![CDATA[%2$s %1$s %2$s//]]>%2$s</script>', $js, "\n");
        return $ui_content;
    } else {
        echo $ui_content;
        add_jquery_ready($js);
    }
}
Ejemplo n.º 10
0
/**
 * Color Picker OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_colorpicker($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // collecting attributes
    $atts = array();
    $atts['class'] = 'field';
    $atts['type'] = 'text';
    $atts['id'] = esc_attr($id);
    $atts['name'] = esc_attr($item['name']);
    $atts['value'] = esc_attr($value);
    $style = '';
    if ('' != $value) {
        $style = ' style="background:' . $value . ';border-color:' . $value . '"';
    }
    echo '<div ' . build_section_class('section-color', $item) . '>';
    build_heading($item, $is_widget);
    build_description($item);
    echo '<div class="controls">';
    echo '<div class="color-picker clearfix">';
    printf('<input%s />', spyropress_build_atts($atts));
    printf('<div class="color-box"><div%s></div></div>', $style);
    echo '</div>';
    echo '</div>';
    echo '</div>';
    $ui_content = ob_get_clean();
    $js = "panelUi.bind_colorpicker( '{$id}', '', '' );";
    if ($is_widget) {
        if (!$is_builder) {
            add_jquery_ready($js);
        } else {
            $ui_content .= sprintf('<script type="text/javascript">%2$s//<![CDATA[%2$s %1$s %2$s//]]>%2$s</script>', $js, "\n");
        }
        return $ui_content;
    } else {
        echo $ui_content;
        add_jquery_ready($js);
    }
}
Ejemplo n.º 11
0
<div class="parallax_section center"<?php 
echo spyropress_build_atts(array('background' => $background), 'data-');
?>
>
<?php 
if ($icon) {
    echo '<i class="fa fa-featured ' . $icon . '"' . spyropress_build_atts(array('animation' => $icon_animation), 'data-appear-') . '></i>';
}
if ($title) {
    echo '<h1 class="short text-shadow big bold ' . $skin . '"' . spyropress_build_atts(array('animation' => $title_animation), 'data-appear-') . '><strong>' . $title . '</strong></h1>';
}
if ($teaser) {
    echo '<h3 class="lead ' . $skin . '"' . spyropress_build_atts(array('animation' => $teaser_animation), 'data-appear-') . '>' . $teaser . '</h3>';
}
?>

</div>
Ejemplo n.º 12
0
		<div class="panel-heading">
			<h4 class="panel-title">
				<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion' . $accordion_ids . '" href="#collapse' . $spyropress_tab_counter . '">
					' . $icon . $tab['title'] . '
				</a>
			</h4>
		</div>
		<div id="collapse' . $spyropress_tab_counter . '" class="accordion-body collapse' . $active . '">
			<div class="panel-body">
				' . $xcontent . '
			</div>
		</div>
	</div>';
}
if ($title) {
    echo '<h2' . spyropress_build_atts(array('animation' => $animation), 'data-appear-') . '>' . $title . '</h2>';
}
?>

<div class="panel-group <?php 
echo $style;
?>
" id="accordion<?php 
echo $accordion_ids;
?>
">
    <?php 
echo $content;
?>

</div> <!-- end tabbable -->
Ejemplo n.º 13
0
<?php

// Setup Instance for view
$filters = isset($instance['enable']);
// output content
if ($instance['title']) {
    echo '<h2' . spyropress_build_atts(array('animation' => $instance['animation']), 'data-appear-') . '>' . $instance['title'] . '</h2>';
}
if ($filters) {
    $terms = get_terms('designation');
    if (!empty($terms) && !is_wp_error($terms)) {
        $instance['callback'] = array($this, 'generate_filter_item');
        wp_enqueue_script('jquery-isotope');
        echo '
        <ul class="nav nav-pills sort-source" data-sort-id="team" data-option-key="filter">
            <li data-option-value="*" class="active"><a href="#">' . $instance['all_label'] . '</a></li>';
        foreach ($terms as $item) {
            echo '<li data-option-value=".' . $item->slug . '"><a href="#">' . $item->name . '</a></li>';
        }
        echo '</ul><hr/>';
    }
}
echo $filters ? '<div class="row"><ul class="team-list sort-destination" data-sort-id="team">' : '<div class="row"><ul class="team-list">';
echo $this->query($instance, '{content}');
echo '</ul></div>';
Ejemplo n.º 14
0
<?php

if (is_str_contain('[rotate_words]', $heading)) {
    $styles[] = 'word-rotator-title';
}
printf('<h%1$s%3$s class="%4$s">%2$s</h%1$s>', $html_tag, do_shortcode($heading), spyropress_build_atts(array('animation' => $animation), 'data-appear-'), spyropress_clean_cssclass($styles));
Ejemplo n.º 15
0
/**
 * Get an HTML img element representing an image url
 *
 * This function retrieves/resizes the image to be used with the post in this order:
 *      1. Image Passed
 *      2. Custom Field (meta_key)
 *      3. Attachment ID
 *      4. WP Post Thumbnail
 *      5. First Attached Image
 *      6. Default Image
 *
 * @param   $args  Array with
 *          post_id     => current post id or pass and id
 *          auto_img    => if no image found automatically search in child attachments
 * image source
 *          url         => image passed using this variable
 *          key         => meta key used to get image3
 *          attachment  => image passed using this variable
 *
 * image options
 *          width   => Optional, the width of image | default is the settings of WP
 *          height  => Optional
 *          crop    => Optional, Whether to crop image or resize. | default is false
 *          retina  => Optional boolean for creating images that are double the width and height. | default is false
 *          single  => Optional, true for single url on return $image, false for Array | default is true
 *
 *  html option
 *          type    => Output type
 *              1. With anchor of original image (rel)
 *              2. With anchor of permalink (url)
 *              3. Without anchor (img)
 *              4. Image URL (src)
 *          before  => before html
 *          after   => after html
 *          echo    => return html or echo it | default is true
 *
 *  image attributes
 *          class   =>
 *          alt     =>
 *          title   =>
 */
function get_image($args = array())
{
    global $post;
    // set defaults
    $defaults = array('post_id' => $post->ID, 'url' => false, 'key' => false, 'attachment' => false, 'width' => null, 'height' => null, 'crop' => null, 'retina' => false, 'single' => false, 'type' => 'img', 'before' => '', 'after' => '', 'echo' => true, 'responsive' => true, 'class' => '', 'alt' => '', 'title' => '', 'href' => '', 'rel' => 'lightbox', 'link_class' => false, 'auto_img' => get_setting('image_auto', false));
    // set a filter for custom settings via plugin
    $args = wp_parse_args($args, apply_filters('spyropress_img_resizer_args', $defaults));
    // Allow for different retina sizes
    $args['retina'] = $args['retina'] ? $args['retina'] === true ? 2 : $args['retina'] : 1;
    // validate inputs, set to integer
    $args['width'] = intval($args['width'] * $args['retina']);
    $args['height'] = intval($args['height'] * $args['retina']);
    $image_url = '';
    extract($args);
    // Image passed # 1
    if (!empty($args['url'])) {
        if (false === strpos($args['url'], home_url())) {
            return false;
        }
        $image_url = esc_url($args['url']);
    } elseif (empty($image_url) && !empty($args['key'])) {
        // get image in custom field by meta key
        $img = get_post_meta($post_id, $key, true);
        if (!empty($img)) {
            $image_url = esc_url($img);
        }
    } elseif (empty($image_url) && !empty($args['attachment'])) {
        // get image by attachment if
        $img = wp_get_attachment_url($args['attachment']);
        if (!empty($img)) {
            $image_url = esc_url($img);
        }
    } elseif (empty($image_url) && has_post_thumbnail($post_id)) {
        // get thumbnail id
        $thumb_id = get_post_thumbnail_id($post_id);
        // get image by attachment if
        $img = wp_get_attachment_url($thumb_id);
        if (!empty($img)) {
            $image_url = esc_url($img);
        }
        // Setting META
        $args['title'] = trim(strip_tags(get_post_field('post_title', $thumb_id)));
        $args['alt'] = get_post_meta($thumb_id, '_wp_attachment_image_alt', true);
    } elseif (empty($image_url) && $auto_img) {
        // Get attachments for the inputted $post_id.
        $attachments = get_children(array('post_parent' => $post_id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID', 'suppress_filters' => true, 'numberposts' => 1));
        // check any attachment
        if (!empty($attachments)) {
            // loop through attachments
            foreach ($attachments as $att_id => $attachment) {
                $attachment_id = $att_id;
                break;
            }
            // Check if we have an attachment ID before proceeding.
            if (!empty($attachment_id)) {
                // Get the attachment image
                $img = wp_get_attachment_url($attachment_id, $size);
                $image_url = esc_url($img);
                // Get the attachment excerpt
                $args['alt'] = trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true)));
            }
        }
    } elseif (empty($image_url)) {
        $image_url = get_placeholder_img_url();
    }
    // resize image now
    $args['url'] = $image_url;
    $image = spyropress_img_resizer($args);
    // if no image returned
    if (!$image) {
        return false;
    }
    /** Time to output **/
    if ('src' == $type) {
        return $image[0];
    }
    // anchor attributes
    $anchor_html = false;
    if ('rel' == $type || 'url' == $type) {
        $anchor_attr = array();
        if ('url' == $type) {
            if (is_single()) {
                $href = $image_url;
            } else {
                $href = get_permalink($post_id);
            }
        } elseif ('rel' == $type) {
            $href = $image_url;
        }
        $anchor_attr = array('href' => $href, 'rel' => $rel, 'class' => $link_class);
        $anchor_attr = apply_filters('spyropress_image_anchor_args', spyropress_clean_array($anchor_attr));
        $anchor_html = '<a ' . spyropress_build_atts($anchor_attr) . '>';
    }
    // set default image attributes
    list($image[0], $image[1], $image[2]) = $image;
    $width = $width ? $width : $image[1];
    $height = $height ? $height : $image[2];
    $hwstring = $responsive ? '' : image_hwstring($width, $height);
    $image_default_attr = array('src' => $image[0], 'class' => "attachment-{$image[1]}x{$image[2]}", 'alt' => trim(strip_tags(get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true))), 'title' => trim(strip_tags(get_the_title($post_id))));
    if (empty($image_default_attr['alt'])) {
        $image_default_attr['alt'] = trim(strip_tags(get_the_title()));
    }
    // Finally, use the title
    $image_attr = array('class' => $args['class'], 'alt' => $args['alt'], 'title' => $args['title']);
    $image_attr = wp_parse_args(spyropress_clean_array($image_attr), $image_default_attr);
    $image_attr = array_map('esc_attr', $image_attr);
    // build html with attributes
    $html = '<img ' . trim($hwstring) . spyropress_build_atts($image_attr) . ' />';
    if ($anchor_html) {
        $html = $anchor_html . $html . '</a>';
    }
    $html = wp_kses_post($args['before']) . $html . wp_kses_post($args['after']);
    // Remove no height attribute - IE fix when no height is set
    $html = str_replace('height=""', '', $html);
    $html = str_replace('height="0"', '', $html);
    // finally!
    if ($args['echo']) {
        echo $html;
    } else {
        return $html;
    }
}
Ejemplo n.º 16
0
/**
 * Background OptionType
 *
 * @author 		SpyroSol
 * @category 	UI
 * @package 	Spyropress
 */
function spyropress_ui_background($item, $id, $value, $is_widget = false, $is_builder = false)
{
    ob_start();
    // defaults
    $style = '';
    $defaults = array('background-color' => '', 'background-image' => '', 'background-repeat' => '', 'background-attachment' => '', 'background-position' => '', 'background-pattern' => '');
    $value = wp_parse_args($value, $defaults);
    // collecting colorpicker attributes
    $atts = array();
    $atts['class'] = 'field';
    $atts['type'] = 'text';
    $atts['id'] = esc_attr($id . '-colorpicker');
    $atts['name'] = esc_attr($item['name'] . '[background-color]');
    if ($value['background-color']) {
        $atts['value'] = esc_attr($value['background-color']);
    }
    $style = '';
    if ($value['background-color']) {
        $style = ' style="background:' . $value['background-color'] . ';border-color:' . $value['background-color'] . '"';
    }
    // collecting upload attributes
    $upload_attrs = array();
    $upload_attrs['class'] = 'field upload' . ($value != '' ? ' has-file' : '');
    $upload_attrs['type'] = 'text';
    $upload_attrs['id'] = esc_attr($id);
    $upload_attrs['name'] = esc_attr($item['name'] . '[background-image]');
    if ($value['background-image']) {
        $upload_attrs['value'] = esc_attr($value['background-image']);
    }
    ?>

    <div <?php 
    echo build_section_class('section-background', $item);
    ?>
>
        <?php 
    build_heading($item, $is_widget);
    ?>

        <?php 
    build_description($item);
    ?>

        <?php 
    build_section_reset();
    ?>

        <div class="controls">
            <div class="color-picker pb10 clearfix">
            <?php 
    printf('<input%s />', spyropress_build_atts($atts));
    printf('<div class="color-box"><div%s></div></div>', $style);
    ?>
                
            </div>
            <div class="pb10 row-fluid">
                <div class="span6">
                    <select name="<?php 
    echo $item['name'];
    ?>
[background-repeat]" class="chosen" data-placeholder="<?php 
    esc_attr_e('Background Repeat', 'spyropress');
    ?>
">
                        <?php 
    foreach (spyropress_panel_background_repeat() as $key => $repeat) {
        render_option(esc_attr($key), esc_html($repeat), array($value['background-repeat']));
    }
    ?>

                    </select>
                </div>
                <div class="span6">
                    <select name="<?php 
    echo $item['name'];
    ?>
[background-attachment]" class="chosen" data-placeholder="<?php 
    esc_attr_e('Background Attachment', 'spyropress');
    ?>
">
                        <?php 
    foreach (spyropress_panel_background_attachment() as $key => $attachment) {
        render_option(esc_attr($key), esc_html($attachment), array($value['background-attachment']));
    }
    ?>

                    </select>
                </div>
            </div>
            <div class="pb10">
                <select name="<?php 
    echo $item['name'];
    ?>
[background-position]" class="chosen" data-placeholder="<?php 
    esc_attr_e('Background Position', 'spyropress');
    ?>
">
                    <?php 
    foreach (spyropress_panel_background_position() as $key => $position) {
        render_option(esc_attr($key), esc_html($position), array($value['background-position']));
    }
    ?>

                </select>
            </div>
            <div class="uploader pb10 clearfix">
            <?php 
    printf('<input%s />', spyropress_build_atts($upload_attrs));
    printf('<input class="upload_button button-secondary" type="button" value="' . __('Upload', 'spyropress') . '" id="upload_%s" />', $id);
    if (is_array(@getimagesize($value['background-image']))) {
        ?>

                <div class="screenshot" id="<?php 
        echo $id;
        ?>
_image">
                <?php 
        if ($value['background-image'] != '') {
            $remove = '<a href="javascript:(void);" class="remove-media">Remove</a>';
            $image = preg_match('/(^.*\\.jpg|jpeg|png|gif|ico*)/i', $value['background-image']);
            if ($image) {
                echo '<img src="' . $value['background-image'] . '" alt="" />' . $remove . '';
            } else {
                $parts = explode("/", $value['background-image']);
                for ($i = 0; $i < sizeof($parts); ++$i) {
                    $title = $parts[$i];
                }
                echo '<div class="no_image"><a href="' . $value['background-image'] . '">' . $title . '</a>' . $remove . '</div>';
            }
        }
        ?>

                </div>
            <?php 
    }
    ?>

            </div>
            <?php 
    if (isset($item['use_pattern']) && $item['use_pattern'] && isset($item['patterns'])) {
        ?>

            <div class="section-radio-img section-pattern">
                <h3 class="heading"><?php 
        _e('Background Patterns', 'spyropress');
        ?>
</h3>
                <ul id="bg_patterns">
                <?php 
        foreach ($item['patterns'] as $path => $label) {
            printf('
                            <li><label class="radio-img%6$s" for="%1$s">
                                <input type="radio" id="%1$s" name="%3$s[background-pattern]" value="%2$s" %5$s />
                                <img src="%4$s">
                            </label></li>', $item['name'] . '_' . $label, $path, $item['name'], $path, checked($value['background-pattern'], $path, false), $value['background-pattern'] == $path ? ' selected' : '');
        }
        ?>

                </ul>
                <div class="clear"></div>
            </div>
            <?php 
    }
    ?>

        </div>
    </div>
<?php 
    $ui_content = ob_get_clean();
    $js = "panelUi.bind_colorpicker( '{$id}-colorpicker' );";
    if ($is_widget) {
        if (!$is_builder) {
            add_jquery_ready($js);
        } else {
            $ui_content .= sprintf('<script type="text/javascript">%2$s//<![CDATA[%2$s %1$s %2$s//]]>%2$s</script>', $js, "\n");
        }
        return $ui_content;
    } else {
        echo $ui_content;
        add_jquery_ready($js);
    }
}
Ejemplo n.º 17
0
 /**
  * @see Walker::start_el()
  */
 function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0)
 {
     $indent = $depth ? str_repeat("\t", $depth) : '';
     if (0 === $depth) {
         $this->has_megamenu = $item->isMega;
         $this->columns = $item->mega_columns;
     }
     if (1 === $depth) {
         $this->is_column = $item->is_mega_column;
     }
     if ('phone' == $item->title) {
         $output .= $indent . '<li class="phone"><span><i class="fa fa-phone"></i>' . get_setting('topbar_ph') . '</span>';
     } elseif (is_str_contain('divider', $item->title)) {
         $output .= $indent . '<li class="divider">';
     } elseif ('[sigin-form]' == $item->attr_title) {
         ob_start();
         $templates = array('woocommerce/nav-signin-form.php');
         include_once locate_template($templates, false);
         $nav_output = ob_get_clean();
         $output .= $nav_output;
     } elseif ('[mini-cart]' == $item->attr_title) {
         //check cart empty
         if (sizeof(WC()->cart->get_cart()) < 1 && get_setting('mini_cart_hide_if_empty', false)) {
             return;
         }
         ob_start();
         $templates = array('woocommerce/nav-mini-cart.php');
         include_once locate_template($templates, false);
         $nav_output = ob_get_clean();
         $output .= $nav_output;
     } else {
         $classes = empty($item->classes) ? array() : (array) $item->classes;
         $classes = apply_filters('nav_menu_css_class', array_filter($classes), $item, $args);
         if ($item->current && 'secondary' != $args->theme_location || in_array('current-menu-parent', $classes) || in_array('current-menu-ancestor', $classes)) {
             $classes[] = 'active';
         }
         if ($item->isMega || $item->bucket_id) {
             $classes[] = 'mega-menu-item mega-menu-fullwidth';
         }
         if ($item->bucket_id) {
             $classes[] = 'dropdown';
         }
         if ($this->has_children && $depth > 0) {
             $classes[] = 'dropdown-submenu';
         } else {
             if ($this->has_children && $depth === 0) {
                 $classes[] = 'dropdown';
             }
         }
         $class_names = spyropress_clean_cssclass($classes);
         $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : '';
         if ($depth === 1 && $this->has_megamenu) {
             $output .= $indent . '<div class="{col_class}"><ul class="sub-menu"><li>';
         } elseif ($depth === 2 && $this->has_megamenu && $this->is_column) {
         } else {
             $output .= $indent . '<li' . $class_names . '>';
         }
         $item_output = '';
         if ($depth === 1 && $this->has_megamenu && $this->is_column) {
             // do nothing
         } elseif ($depth === 1 && $this->has_megamenu || $depth === 2 && $this->has_megamenu && $this->is_column) {
             $item_output .= '<span class="mega-menu-sub-title">' . apply_filters('the_title', $item->title, $item->ID) . '</span>';
         } else {
             $atts = array();
             $atts['title'] = !empty($item->attr_title) ? esc_attr($item->attr_title) : '';
             $atts['target'] = !empty($item->target) ? esc_attr($item->target) : '';
             $atts['rel'] = !empty($item->xfn) ? esc_attr($item->xfn) : '';
             $atts['href'] = !empty($item->url) ? esc_url($item->url) : '';
             if ($this->has_children && $depth == 0 || $item->bucket_id) {
                 $atts['class'] = 'dropdown-toggle';
             }
             $attributes = apply_filters('nav_menu_link_attributes', spyropress_build_atts($atts), $item, $args);
             if (is_str_contain('#HOME_URL#', $item->url)) {
                 $attributes .= ' data-hash';
             }
             $item_output = $args->before;
             $item_output .= '<a' . $attributes . '>';
             $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after;
             if ($this->has_children && $depth == 0) {
                 $item_output .= ' <i class="fa fa-angle-down"></i>';
             }
             $item_output .= '</a>';
             $item_output .= $args->after;
         }
         $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args);
         if ($item->bucket_id) {
             $output .= '<ul class="dropdown-menu"><li><div class="mega-menu-content">';
             $con = do_shortcode('[bucket id=' . $item->bucket_id . ']');
             $output .= str_replace('class="container"', '', $con);
             $output .= '</div></li></ul>';
         }
     }
 }
function spyropress_sc_promo_img($atts = array(), $content = '')
{
    if (empty($content)) {
        return;
    }
    $atts = spyropress_clean_array(shortcode_atts(array('animation' => 'fadeInRight'), $atts));
    return '<div class="push-top"><img class="img-responsive" src="' . spyropress_remove_formatting($content) . '"' . spyropress_build_atts($atts, 'data-appear-') . '></div>';
}