Import legacy nurinda.co.id website

This commit is contained in:
dirga committed 2026-10-01 14:27:19 +07:00
1 parent 3f59bb9038
commit 6e21646ac4
13389 files changed
+3246690

No files matched your search

@@ -0,0 +1,51 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Add to cart element
*/
global $product;
if ( ! class_exists( 'woocommerce' ) OR ! $product OR $us_elm_context == 'grid_term' ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Output WooCommerce Add to cart
if ( $us_elm_context == 'shortcode' ) {
// Prepare inline CSS for shortcode
if ( ! isset( $font_size ) OR trim( $font_size ) == us_get_option( 'body_fontsize', '16px' ) ) {
$font_size = '';
}
$inline_css = us_prepare_inline_css( array( 'font-size' => $font_size ) );
echo '<div class="w-post-elm add_to_cart' . $classes . '"' . $el_id . $inline_css . '>';
if ( is_object( $product ) AND method_exists( $product, 'get_type' ) ) {
woocommerce_template_single_add_to_cart();
if ( function_exists( 'wc_print_notices' ) ) {
woocommerce_output_all_notices();
}
}
echo '</div>';
} else {
add_filter( 'woocommerce_product_add_to_cart_text', 'us_add_to_cart_text', 99, 2 );
add_filter( 'woocommerce_loop_add_to_cart_link', 'us_add_to_cart_text_replace', 99, 3 );
if ( empty( $view_cart_link ) ) {
$classes .= ' no_view_cart_link';
}
echo '<div class="w-btn-wrapper woocommerce' . $classes . '">';
woocommerce_template_loop_add_to_cart();
echo '</div>';
remove_filter( 'woocommerce_product_add_to_cart_text', 'us_add_to_cart_text', 99 );
remove_filter( 'woocommerce_loop_add_to_cart_link', 'us_add_to_cart_text_replace', 99 );
}
@@ -0,0 +1,22 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output links menu element
*/
if ( empty( $source ) OR ! is_nav_menu( $source ) ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
wp_nav_menu(
array(
'container' => 'div',
'container_class' => 'w-menu ' . $classes,
'menu' => $source,
'walker' => new US_Walker_Simplenav_Menu,
'items_wrap' => '<div class="w-menu-list">%3$s</div>',
'depth' => 1,
)
);
@@ -0,0 +1,118 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_breadcrumbs
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $home string Homepage Label
* @param $font_size string Font Size
* @param $align string Alignment
* @param $separator_type string Separator Type: 'icon' / 'custom'
* @param $separator_icon string Separator Icon
* @param $separator_symbol string Separator Symbol
* @param $show_current bool Show current page?
* @param $el_class string Extra class name
*/
// Don't show the element on the homepage
if ( is_home() OR is_front_page() ) {
return;
}
$classes = '';
$classes .= ' separator_' . $separator_type;
$classes .= ' align_' . $align;
if ( ! $show_current ) {
$classes .= ' hide_current';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Generate inline styles
$inline_css = us_prepare_inline_css(
array(
'font-size' => $font_size,
)
);
// Generate separator between crumbs
$delimiter = '';
if ( $separator_type == 'icon' ) {
$delimiter = us_prepare_icon_tag( $separator_icon );
} elseif ( $separator_type == 'custom' ) {
$delimiter = strip_tags( $separator_symbol );
}
if ( $delimiter != '' ) {
$delimiter = '<li class="g-breadcrumbs-separator">' . $delimiter . '</li>';
}
// Generate microdata markup
$microdata_list = $microdata_item = $link_attr = $name_attr = $position_attr = '';
if ( us_get_option( 'schema_markup' ) ) {
$microdata_list = ' itemscope itemtype="http://schema.org/BreadcrumbList"';
$microdata_item = ' itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"';
$link_attr = ' itemprop="item"';
$name_attr = ' itemprop="name"';
$position_attr = ' itemprop="position"';
}
if ( function_exists( 'woocommerce_breadcrumb' ) AND is_woocommerce() ) {
// Remove markup from WooCommerce Breadcrumbs
$microdata_list = $microdata_item = '';
}
// Homepage Label
$home = strip_tags( $home );
// The breadcrumb’s container starting code
$list_before = '<ol class="g-breadcrumbs' . $classes . '"' . $el_id . $inline_css . $microdata_list . '>';
// The breadcrumb’s container ending code
$list_after = '</ol>';
// Code before single crumb
$item_before = '<li class="g-breadcrumbs-item"' . $microdata_item . '>';
// Code after single crumb
$item_after = '</li>';
// Return default WooCommerce breadcrumbs
if ( function_exists( 'woocommerce_breadcrumb' ) AND is_woocommerce() ) {
return woocommerce_breadcrumb(
array(
'wrap_before' => $list_before,
'wrap_after' => $list_after,
'delimiter' => $delimiter,
'before' => $item_before,
'after' => $item_after,
'home' => $home,
)
);
// Return default bbPress breadcrumbs
} elseif ( function_exists( 'bbp_get_breadcrumb' ) AND is_singular( array( 'topic', 'forum', 'reply' ) ) ) {
echo bbp_get_breadcrumb(
array(
'before' => $list_before,
'after' => $list_after,
'sep' => $delimiter,
'crumb_before' => $item_before,
'crumb_after' => $item_after,
)
);
// Output theme breadcrumbs
} else {
$us_breadcrumbs = new US_Breadcrumbs( $delimiter, $home, $item_before, $item_after, $link_attr, $name_attr, $position_attr );
echo $list_before . $us_breadcrumbs->render() . $list_after;
}
@@ -0,0 +1,114 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Button element
*/
// Default variables
$output = $wrapper_classes = $wrapper_inline_css = $btn_inline_css = $responsive_css = '';
// Button classes & inline styles
$btn_classes = 'w-btn us-btn-style_' . $style;
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
if ( $us_elm_context == 'shortcode' ) {
$wrapper_classes .= ' width_' . $width_type;
if ( $width_type != 'full' ) {
$wrapper_classes .= ' align_' . $align;
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$wrapper_classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$wrapper_inline_css = us_prepare_inline_css(
array(
'width' => ( $width_type == 'custom' AND $align != 'center' ) ? $custom_width : NULL,
'max-width' => ( $width_type == 'max' AND $align != 'center' ) ? $custom_width : NULL,
)
);
if ( ! isset( $font_size ) OR trim( $font_size ) == us_get_option( 'body_fontsize', '16px' ) ) {
$font_size = '';
}
$btn_inline_css = us_prepare_inline_css(
array(
'font-size' => $font_size,
'width' => ( $width_type == 'custom' AND $align == 'center' ) ? $custom_width : NULL,
'max-width' => ( $width_type == 'max' AND $align == 'center' ) ? $custom_width : NULL,
)
);
if ( ! empty( $font_size_mobiles ) ) {
global $us_btn_index;
$us_btn_index = isset( $us_btn_index ) ? ( $us_btn_index + 1 ) : 1;
$btn_classes .= ' us_btn_' . $us_btn_index;
$responsive_css = '<style>@media(max-width:600px){.us_btn_' . $us_btn_index . '{font-size:' . $font_size_mobiles . '!important}}</style>';
}
$btn_classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
} else {
$btn_classes .= isset( $classes ) ? $classes : '';
}
// Icon
$icon_html = '';
if ( ! empty( $icon ) ) {
$icon_html = us_prepare_icon_tag( $icon );
$btn_classes .= ' icon_at' . $iconpos;
}
if ( is_rtl() ) { // swap icon position for RTL
$iconpos = ( $iconpos == 'left' ) ? 'right' : 'left';
}
// Text
$text = trim( strip_tags( $label, '<br>' ) );
if ( $text == '' ) {
$btn_classes .= ' text_none';
}
// Link
if ( in_array( $us_elm_context, array( 'shortcode', 'header' ) ) ) {
$link_type = 'custom';
}
if ( $link_type === 'post' ) {
// Terms of selected taxonomy in Grid
if ( $us_elm_context == 'grid_term' ) {
global $us_grid_term;
$link_atts = ' href="' . get_term_link( $us_grid_term ) . '"';
} else {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
}
} elseif ( $link_type === 'custom' ) {
$link_atts = us_generate_link_atts( $link );
} else {
$link_atts = '';
}
if ( ! empty( $link_atts ) ) {
$btn_tag = 'a';
} else {
$btn_tag = 'div';
}
// Output the element
if ( $us_elm_context == 'shortcode' ) {
$output .= '<div class="w-btn-wrapper' . $wrapper_classes . '"' . $wrapper_inline_css . '>';
$output .= $responsive_css;
}
$output .= '<' . $btn_tag . ' class="' . $btn_classes . '"';
$output .= $link_atts . $btn_inline_css . $el_id;
$output .= '>';
if ( $iconpos == 'left' ) {
$output .= $icon_html;
}
if ( $text != '' ) {
$output .= '<span class="w-btn-label">' . $text . '</span>';
}
if ( $iconpos == 'right' ) {
$output .= $icon_html;
}
$output .= '</' . $btn_tag . '>';
if ( $us_elm_context == 'shortcode' ) {
$output .= '</div>';
}
echo $output;
@@ -0,0 +1,48 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output cart element
*
* @var $icon int
* @var $dropdown_effect string Dropdown Effect
* @var $icon_size int
* @var $design_options array
* @var $classes string
* @var $id string
*/
if ( ! class_exists( 'woocommerce' ) ) {
return;
}
global $cache_enabled;
$classes = isset( $classes ) ? $classes : '';
$classes .= ' dropdown_' . $dropdown_effect;
if ( $vstretch ) {
$classes .= ' height_full';
}
$quantity_inline_css = us_prepare_inline_css(
array(
'background' => $quantity_color_bg,
'color' => $quantity_color_text,
)
);
echo '<div class="w-cart' . $classes . ' empty">';
echo '<div class="w-cart-h">';
echo '<a class="w-cart-link" href="' . esc_attr( wc_get_cart_url() ) . '" aria-label="' . __( 'Cart', 'us' ) . '">';
echo '<span class="w-cart-icon">';
if ( ! empty( $icon ) ) {
echo us_prepare_icon_tag( $icon );
}
echo '<span class="w-cart-quantity"' . $quantity_inline_css . '></span></span></a>';
echo '<div class="w-cart-notification"><div><span class="product-name">' . us_translate( 'Product', 'woocommerce' ) . '</span> ' . __( 'was added to your cart', 'us' ) . '</div></div>';
echo '<div class="w-cart-dropdown">';
the_widget( 'WC_Widget_Cart' ); // This widget being always filled with products via AJAX
echo '</div>';
echo '</div>';
echo '</div>';
@@ -0,0 +1,115 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_cform
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
*
* @param $receiver_email string Receiver Email
* @param $name_field string Name field state: 'required' / 'shown' / 'hidden'
* @param $email_field string Email field state: 'required' / 'shown' / 'hidden'
* @param $phone_field string Phone field state: 'required' / 'shown' / 'hidden'
* @param $message_field string Message field state: 'required' / 'shown' / 'hidden'
* @param $captcha_field string Message field state: 'hidden' / 'required'
* @param $checkbox_field string Checkbox field state: 'hidden' / 'required'
* @param $button_color string Button color: 'primary' / 'secondary' / 'light' / 'contrast' / 'black' / 'white'
* @param $button_bg_color string Button background color
* @param $button_text_color string Button text color
* @param $button_style string Button style: 'raised' / 'flat'
* @param $button_size string Button size
* @param $button_align string Button alignment: 'left' / 'center' / 'right'
* @param $button_text string Button text
* @param $icon string Icon name
* @param $iconpos string Icon Position: 'left' / 'right'
* @param $el_class string Extra class name
*/
global $us_cform_index, $us_cform_prev_post_id, $us_page_block_ids;
if ( isset( $us_page_block_ids ) AND ! empty( $us_page_block_ids ) ) {
$post_id = $us_page_block_ids[0];
} else {
$post_id = get_the_ID();
}
if ( ! empty( $us_cform_prev_post_id ) AND $us_cform_prev_post_id != $post_id ) {
$us_cform_index = 0;
}
// Form indexes start from 1
$us_cform_index = ! empty( $us_cform_index ) ? ( $us_cform_index + 1 ) : 1;
$us_cform_prev_post_id = $post_id;
$us_form_index = $us_cform_index;
if ( isset( $button_fullwidth ) AND $button_fullwidth ) {
$submit_classes = 'width_full';
} else {
$submit_classes = 'align_' . $button_align;
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes = ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Generate fields params
if ( empty( $items ) ) {
$fields = array();
} else {
$fields = json_decode( urldecode( $items ), TRUE );
if ( ! is_array( $fields ) ) {
$fields = array();
}
}
$fields[] = array(
'type' => 'hidden',
'label' => 'action',
'value' => 'us_ajax_cform',
);
$fields[] = array(
'type' => 'hidden',
'label' => 'post_id',
'value' => $post_id,
);
$fields[] = array(
'type' => 'hidden',
'label' => 'form_index',
'value' => $us_cform_index,
);
$submit_params = array(
'type' => 'submit',
'classes' => $submit_classes,
'icon' => ( ! empty( $icon ) ) ? $icon : '',
'icon_pos' => ( ! empty( $iconpos ) ) ? $iconpos : 'left',
'btn_classes' => ( ! empty( $iconpos ) AND ! empty( $icon ) ) ? 'icon_at' . $iconpos : '',
'btn_inner_css' => ( ! empty( $button_size ) ) ? 'font-size:' . $button_size . ';' : '',
'btn_size_mobiles' => ( ! empty( $button_size_mobiles ) ) ? $button_size_mobiles : '',
'title' => ( ! empty( $button_text ) ) ? $button_text : us_config( 'elements/cform.params.button_text.std' ),
);
if ( ! empty( $button_color ) ) {
$submit_params['btn_classes'] .= ' color_' . $button_color;
if ( $button_color == 'custom' ) {
if ( $button_bg_color != '' ) {
$submit_params['btn_inner_css'] .= 'background:' . $button_bg_color . ';';
}
if ( $button_text_color != '' ) {
$submit_params['btn_inner_css'] .= 'color:' . $button_text_color . ';';
}
}
}
$submit_params['btn_classes'] .= ' us-btn-style_' . $button_style;
$fields[] = $submit_params;
// Load form template
us_load_template(
'templates/form/form', array(
'type' => 'cform',
'fields' => $fields,
'classes' => $classes,
'el_id' => $el_id,
)
);
@@ -0,0 +1,45 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_contacts
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $address string Addresss
* @param $phone string Phone
* @param $fax string Fax
* @param $email string Email
* @param $el_class string Extra class name
*/
$classes = '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Output the element
$output = '<div class="w-contacts' . $classes . '"' . $el_id . '><div class="w-contacts-list">';
if ( ! empty( $address ) ) {
$output .= '<div class="w-contacts-item for_address"><span class="w-contacts-item-value">' . $address . '</span></div>';
}
if ( ! empty( $phone ) ) {
$output .= '<div class="w-contacts-item for_phone"><span class="w-contacts-item-value">' . $phone . '</span></div>';
}
if ( ! empty( $fax ) ) {
$output .= '<div class="w-contacts-item for_fax"><span class="w-contacts-item-value">' . $fax . '</span></div>';
}
if ( ! empty( $email ) ) {
$output .= '<div class="w-contacts-item for_email"><span class="w-contacts-item-value">';
$output .= '<a href="mailto:' . $email . '">' . $email . '</a></span></div>';
}
$output .= '</div></div>';
echo $output;
@@ -0,0 +1,101 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Counter
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
*/
$classes = $value_inline_css = '';
$classes .= ' color_' . $color;
$classes .= ' align_' . $align;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Generate inline styles for Value
$value_inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $size,
'color' => $custom_color,
)
);
// Generate inline styles for Title
$title_inline_css = us_prepare_inline_css(
array(
'font-size' => $title_size,
'color' => $title_color,
)
);
// Finding numbers positions in both initial and final strings
$pos = array();
foreach ( array( 'initial', 'final' ) as $key ) {
$pos[ $key ] = array();
// In this array we'll store the string's character number, where primitive changes from letter to number or back
preg_match_all( '~(\(\-?\d+([\.,\'· ]\d+)*\))|(\-?\d+([\.,\'· ]\d+)*)~u', $$key, $matches, PREG_OFFSET_CAPTURE );
foreach ( $matches[0] as $match ) {
$pos[ $key ][] = $match[1];
$pos[ $key ][] = $match[1] + strlen( $match[0] );
}
};
// Making sure we have the equal number of numbers in both strings
if ( count( $pos['initial'] ) != count( $pos['final'] ) ) {
// Not-paired numbers will be treated as letters
if ( count( $pos['initial'] ) > count( $pos['final'] ) ) {
$pos['initial'] = array_slice( $pos['initial'], 0, count( $pos['final'] ) );
} else/*if ( count( $positions['initial'] ) < count( $positions['final'] ) )*/ {
$pos['final'] = array_slice( $pos['final'], 0, count( $pos['initial'] ) );
}
}
// Position boundaries
foreach ( array( 'initial', 'final' ) as $key ) {
array_unshift( $pos[ $key ], 0 );
$pos[ $key ][] = strlen( $$key );
}
// Output the element
$output = '<div class="w-counter' . $classes . '" data-duration="' . intval( $duration ) * 1000 . '"' . $el_id . '>';
$output .= '<div class="w-counter-value"' . $value_inline_css . '>';
// Determining if we treat each part as a number or as a letter combination
for ( $index = 0, $length = count( $pos['initial'] ) - 1; $index < $length; $index++ ) {
$part_type = ( $index % 2 ) ? 'number' : 'text';
$part_initial = substr( $initial, $pos['initial'][ $index ], $pos['initial'][ $index + 1 ] - $pos['initial'][ $index ] );
$part_final = substr( $final, $pos['final'][ $index ], $pos['final'][ $index + 1 ] - $pos['final'][ $index ] );
$output .= '<span class="w-counter-value-part type_' . $part_type . '" data-final="' . esc_attr( $part_final ) . '">' . $part_initial . '</span>';
}
$output .= '</div>';
if ( ! empty ( $title ) ) {
$output .= '<' . $title_tag .' class="w-counter-title"' . $title_inline_css . '>';
$output .= $title;
$output .= '</' . $title_tag . '>';
}
$output .= '</div>';
// If we are in front end editor mode, apply JS to logos
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$output .= '<script>
jQuery(function($){
if (typeof $.fn.wCounter === "function") {
jQuery(".w-counter").wCounter();
}
});
</script>';
}
echo $output;
@@ -0,0 +1,110 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_cta
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $title string ActionBox title
* @param $title_tag string Title HTML tag: 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
* @param $title_size string Title Size
* @param $color string ActionBox color style: 'primary' / 'secondary' / 'light' / 'custom'
* @param $bg_color string Background color
* @param $text_color string Text color
* @param $controls string Button(s) location: 'right' / 'bottom'
* @param $btn_label string Button 1 label
* @param $btn_link string Button 1 link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
* @param $btn_style string Button 2 Style: 'primary' / 'secondary' / 'light' / 'contrast' / 'black' / 'white'
* @param $btn_size string Button 1 size
* @param $btn_icon string Button 1 icon
* @param $btn_iconpos string Button 1 icon position: 'left' / 'right'
* @param $second_button bool Has second button?
* @param $btn2_label string Button 2 label
* @param $btn2_link string Button 2 link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
* @param $btn2_style string Button 2 Style: 'primary' / 'secondary' / 'light' / 'contrast' / 'black' / 'white'
* @param $btn2_size string Button 2 size
* @param $btn2_icon string Button 2 icon
* @param $btn2_iconpos string Button 2 icon position: 'left' / 'right'
* @param $el_class string Extra class name
* @param $el_id string Element ID
* @param $css string CSS box
*/
$classes = ' color_' . $color;
$classes .= ' controls_' . $controls;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$inline_css = us_prepare_inline_css(
array(
'background' => $bg_color,
'color' => $text_color,
)
);
// Button keys that will be parsed
$btn_prefixes = array( 'btn' );
if ( $second_button ) {
$btn_prefixes[] = 'btn2';
}
// Preparing buttons
$buttons = array();
foreach ( $btn_prefixes as $prefix ) {
if ( empty( ${$prefix . '_label'} ) ) {
continue;
}
$icon_html = '';
$btn_classes = ' us-btn-style_' . ${$prefix . '_style'};
if ( ! isset( ${$prefix . '_size'} ) OR trim( ${$prefix . '_size'} ) == ( us_get_option( 'body_fontsize' ) ) ) {
${$prefix . '_size'} = '';
}
$btn_inline_css = us_prepare_inline_css(
array(
'font-size' => ${$prefix . '_size'},
)
);
if ( ! empty( ${$prefix . '_icon'} ) ) {
$btn_classes .= ' icon_at' . ${$prefix . '_iconpos'};
$icon_html = us_prepare_icon_tag( ${$prefix . '_icon'} );
}
$btn_link_atts = us_generate_link_atts( ${$prefix . '_link'} );
$buttons[ $prefix ] = '<a class="w-btn' . $btn_classes . '"' . $btn_link_atts . $btn_inline_css . '>';
$buttons[ $prefix ] .= ( ${$prefix . '_iconpos'} == 'left' ) ? $icon_html : '';
$buttons[ $prefix ] .= '<span class="w-btn-label">' . strip_tags( ${$prefix . '_label'}, '<br>' ) . '</span>';
$buttons[ $prefix ] .= ( ${$prefix . '_iconpos'} == 'right' ) ? $icon_html : '';
$buttons[ $prefix ] .= '</a>';
}
// Output the element
$output = '<div class="w-actionbox' . $classes . '"' . $inline_css . $el_id . '><div class="w-actionbox-text">';
if ( ! empty( $title ) ) {
$title_inline_css = us_prepare_inline_css(
array(
'font-size' => $title_size,
)
);
$output .= '<' . $title_tag . $title_inline_css . '>' . html_entity_decode( $title ) . '</' . $title_tag . '>';
}
if ( ! empty( $content ) ) {
$output .= '<p>' . do_shortcode( $content ) . '</p>';
}
$output .= '</div>';
if ( ! empty( $buttons ) ) {
$output .= '<div class="w-actionbox-controls">' . implode( '', $buttons ) . '</div>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,144 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output dropdown element
*
* @var $source string Source: 'own' / 'sidebar' / 'wpml' / 'polylang'
* @var $link_title string
* @var $link_icon string
* @var $sidebar_id string
* @var $links array
* @var $wpml_switcher array
* @var $dropdown_open string 'click' / 'hover'
* @var $dropdown_dir string 'left' / 'right'
* @var $dropdown_effect string
* @var $size int
* @var $size_tablets int
* @var $size_mobiles int
* @var $design_options array
* @var $classes string
* @var $id string
*/
$classes = isset( $classes ) ? $classes : '';
$classes .= ' source_' . $source;
$classes .= ' dropdown_' . $dropdown_effect;
$classes .= ' drop_to_' . $dropdown_dir;
$classes .= ' open_on_' . $dropdown_open;
$data = array(
'current' => array(),
'list' => array(),
);
if ( $source == 'wpml' AND ! function_exists( 'icl_get_languages' ) ) {
return;
}
if ( $source == 'polylang' AND ! function_exists( 'pll_the_languages' ) ) {
return;
}
// Custom Links
if ( $source == 'own' ) {
foreach ( $links as $link ) {
$link_atts = usof_get_link_atts( $link['url'] ); // TODO: change it to us_generate_link_atts
if ( ! isset( $link_atts['href'] ) ) {
$link_atts['href'] = '';
}
$icon = ( ! empty( $link['icon'] ) ) ? us_prepare_icon_tag( $link['icon'] ) : '';
$data['list'][] = array(
'icon' => $icon,
'title' => $link['label'],
'url' => ( substr( $link_atts['href'], 0, 4 ) == 'http' OR substr( $link_atts['href'], 0, 1 ) == '/' OR strpos( $link_atts['href'], '#' ) !== FALSE OR strpos( $link_atts['href'], '?' ) !== FALSE ) ? $link_atts['href'] : ( '//' . $link_atts['href'] ),
'target' => ( isset( $link_atts['target'] ) ) ? $link_atts['target'] : NULL,
);
}
// WPML Language Switcher
} elseif ( $source == 'wpml' AND function_exists( 'icl_get_languages' ) ) {
$languages = apply_filters( 'wpml_active_languages', NULL, array( 'skip_missing' => 0 ) );
foreach ( $languages as $language ) {
$data_language = array();
$data_language['title'] = $data_language['icon'] = '';
if ( in_array( 'native_lang', $wpml_switcher ) ) {
$data_language['title'] = $language['native_name'];
if ( in_array( 'display_lang', $wpml_switcher ) AND ( $language['native_name'] != $language['translated_name'] ) ) {
$data_language['title'] .= ' (' . $language['translated_name'] . ')';
}
} elseif ( in_array( 'display_lang', $wpml_switcher ) ) {
$data_language['title'] = $language['translated_name'];
}
if ( in_array( 'flag', $wpml_switcher ) ) {
$data_language['flag'] = $language['country_flag_url'];
$data_language['code'] = $language['language_code'];
}
if ( $language['active'] ) {
$data['current'] = $data_language;
} else {
$data_language['url'] = $language['url'];
$data['list'][] = $data_language;
}
}
// Polylang Language Switcher
} elseif ( $source == 'polylang' AND function_exists( 'pll_the_languages' ) ) {
$pll_langs = pll_the_languages( array( 'raw' => 1 ) );
foreach ( $pll_langs as $pll_lang ) {
$data_language = array(
'title' => $pll_lang['name'],
'flag' => $pll_lang['flag'],
'code' => $pll_lang['slug'],
'icon' => '', // set empty icon
);
if ( $pll_lang['current_lang'] ) {
$data['current'] = $data_language;
} else {
$data_language['url'] = $pll_lang['url'];
$data['list'][] = $data_language;
}
}
}
if ( in_array( $source, array( 'sidebar', 'own' ) ) ) {
$data['current']['title'] = $link_title;
$data['current']['icon'] = us_prepare_icon_tag( $link_icon );
}
// Output the element
$output = '<div class="w-dropdown' . $classes . '"><div class="w-dropdown-h">';
if ( isset( $data['current'] ) AND ! empty( $data['current'] ) ) {
$output .= '<div class="w-dropdown-current"><a class="w-dropdown-item" href="javascript:void(0)">';
if ( isset( $data['current']['flag'] ) AND ! empty( $data['current']['flag'] ) ) {
$output .= '<img src="' . $data['current']['flag'] . '" alt="' . $data['current']['code'] . '" />';
}
$output .= $data['current']['icon'];
$output .= '<span class="w-dropdown-item-title';
if ( isset( $data['current']['title_class'] ) AND ! empty( $data['current']['title_class'] ) ) {
$output .= ' ' . esc_attr( $data['current']['title_class'] );
}
$output .= '">' . strip_tags( $data['current']['title'] ) . '</span>';
$output .= '</a></div>';
}
$output .= '<div class="w-dropdown-list"><div class="w-dropdown-list-h">';
if ( $source == 'sidebar' ) {
ob_start();
dynamic_sidebar( $sidebar_id );
$output .= ob_get_clean();
} else {
foreach ( $data['list'] as $link ) {
$output .= '<a class="w-dropdown-item smooth-scroll" href="' . esc_url( $link['url'] ) . '"';
$output .= ( ! empty( $link['target'] ) ) ? ' target="' . esc_attr( $link['target'] ) . '"' : '';
$output .= '>';
if ( isset( $link['flag'] ) AND ! empty( $link['flag'] ) ) {
$output .= '<img src="' . $link['flag'] . '" alt="' . $link['code'] . '" />';
}
$output .= $link['icon'];
$output .= '<span class="w-dropdown-item-title';
if ( isset( $link['title_class'] ) AND ! empty( $link['title_class'] ) ) {
$output .= ' ' . esc_attr( $link['title_class'] );
}
$output .= '">' . strip_tags( $link['title'] ) . '</span>';
$output .= '</a>';
}
}
$output .= '</div></div>';
$output .= '</div></div>';
echo $output;
@@ -0,0 +1,193 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Flipbox
*/
$front_inline_css = $back_inline_css = array();
// When rotating cubetilt in diagonal direction, we're actually doing a cube flip animation instead
if ( in_array( $direction, array( 'ne', 'se', 'sw', 'nw' ) ) ) {
if ( $animation == 'cubetilt' ) {
$animation = 'cubeflip';
}
if ( $animation == 'cubeflip' AND $link_type == 'btn' ) {
$direction = 'n'; // disable diagonal directions, when back side has a button
}
}
// Main element classes
$classes = ' animation_' . $animation;
$classes .= ' direction_' . $direction;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
// Extract "padding" properties from "css" attribute to use them inside flipbox
if ( ! empty( $css ) AND preg_match( '~\{([^\}]+?)\;?\}~', $css, $matches ) ) {
$css_rules = array_map( 'trim', explode( ';', $matches[1] ) );
$padding_params = array(
'border',
'border-radius',
'padding',
'padding-top',
'padding-left',
'padding-right',
'padding-bottom',
);
foreach ( $css_rules as $css_rule ) {
$css_rule = explode( ':', $css_rule );
if ( count( $css_rule ) == 2 AND in_array( $css_rule[0], $padding_params ) ) {
$front_inline_css[ $css_rule[0] ] = $css_rule[1];
$back_inline_css[ $css_rule[0] ] = $css_rule[1];
}
}
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Link
$tag = 'div';
$btn_html = '';
$link_atts = us_generate_link_atts( $link );
if ( ! empty( $link_atts ) ) {
if ( $link_type == 'container' ) {
$tag = 'a';
} elseif ( $link_type == 'btn' ) {
$btn_html .= '<a class="w-btn us-btn-style_' . $btn_style . '"';
$btn_html .= $link_atts;
$btn_html .= us_prepare_inline_css( array( 'font-size' => $btn_size ) );
$btn_html .= '>';
$btn_html .= '<span>' . strip_tags( $btn_label ) . '</span>';
$btn_html .= '</a>';
}
}
$inline_css = us_prepare_inline_css(
array(
'width' => $custom_width,
)
);
// Output the element
$output = '<' . $tag . ' class="w-flipbox' . $classes . '"' . $inline_css . $el_id . $link_atts . '>';
$helper_classes = ' easing_' . $easing;
$helper_inline_css = us_prepare_inline_css(
array(
'transition-duration' => floatval( $duration ) . 's',
)
);
$output .= '<div class="w-flipbox-h' . $helper_classes . '"' . $helper_inline_css . '>';
$output .= '<div class="w-flipbox-hh">';
if ( $animation == 'cubeflip' AND in_array( $direction, array( 'ne', 'se', 'sw', 'nw' ) ) ) {
$output .= '<div class="w-flipbox-hhh">';
}
// Front Side
$front_inline_css['height'] = $custom_height;
$front_inline_css['background'] = $front_bgcolor;
$front_inline_css['color'] = $front_textcolor;
if ( $front_bgimage_src = wp_get_attachment_image_src( $front_bgimage, $front_bgimage_size ) ) {
$front_inline_css['background-image'] = $front_bgimage_src[0];
}
$output .= '<div class="w-flipbox-front"' . us_prepare_inline_css( $front_inline_css ) . '><div class="w-flipbox-front-h">';
$output_front_icon = '';
if ( $front_icon_type == 'font' ) {
$icon_inline_css = array(
'font-size' => $front_icon_size,
'background' => $front_icon_bgcolor,
'color' => $front_icon_color,
);
$output_front_icon .= '<div class="w-flipbox-front-icon style_' . $front_icon_style . '"' . us_prepare_inline_css( $icon_inline_css ) . '>';
$output_front_icon .= us_prepare_icon_tag( $front_icon_name );
$output_front_icon .= '</div>';
} elseif ( $front_icon_type == 'image' ) {
$icon_inline_css = array(
'width' => $front_icon_image_width,
);
$output_front_icon .= '<div class="w-flipbox-front-icon type_image"' . us_prepare_inline_css( $icon_inline_css ) . '>';
$output_front_icon .= wp_get_attachment_image( $front_icon_image, 'medium' );
$output_front_icon .= '</div>';
}
$output_front_title = '';
if ( ! empty( $front_title ) ) {
$output_front_title .= '<' . $front_title_tag . ' class="w-flipbox-front-title"';
$output_front_title .= us_prepare_inline_css(
array(
'font-size' => $front_title_size,
'color' => $front_textcolor,
)
);
$output_front_title .= '>' . esc_html( $front_title ) . '</' . $front_title_tag . '>';
}
$output_front_desc = '';
if ( ! empty( $front_desc ) ) {
$output_front_desc .= '<div class="w-flipbox-front-desc">' . wpautop( $front_desc ) . '</div>';
}
if ( $front_icon_pos == 'below_title' ) {
$output .= $output_front_title . $output_front_icon . $output_front_desc;
} elseif ( $front_icon_pos == 'below_desc' ) {
$output .= $output_front_title . $output_front_desc . $output_front_icon;
} else/*if ( $front_icon_pos == 'above_title' )*/ {
$output .= $output_front_icon . $output_front_title . $output_front_desc;
}
$output .= '</div></div>';
// Back Side
$back_inline_css['display'] = 'none';
$back_inline_css['background'] = $back_bgcolor;
$back_inline_css['color'] = $back_textcolor;
if ( $back_bgimage_src = wp_get_attachment_image_src( $back_bgimage, $back_bgimage_size ) ) {
$back_inline_css['background-image'] = $back_bgimage_src[0];
}
$output .= '<div class="w-flipbox-back"' . us_prepare_inline_css( $back_inline_css ) . '><div class="w-flipbox-back-h">';
if ( ! empty( $back_title ) ) {
$output .= '<' . $back_title_tag . ' class="w-flipbox-back-title"';
$output .= us_prepare_inline_css(
array(
'font-size' => $back_title_size,
'color' => $back_textcolor,
)
);
$output .= '>' . esc_html( $back_title ) . '</' . $back_title_tag . '>';
}
if ( ! empty( $back_desc ) ) {
$output .= '<div class="w-flipbox-back-desc">' . wpautop( $back_desc ) . '</div>';
}
$output .= $btn_html;
$output .= '</div></div>';
// We need additional dom-elements for 'cubeflip' animations (:before / :after won't suit)
if ( $animation == 'cubeflip' ) {
$front_bgcolor = ( ! empty( $front_bgcolor ) ) ? $front_bgcolor : us_get_color( 'color_content_bg_alt', TRUE );
// Top & bottom flank with shaded color
if ( in_array( $direction, array( 'ne', 'e', 'se', 'sw', 'w', 'nw' ) ) ) {
$shaded_color = us_shade_color( $front_bgcolor );
$output .= '<div class="w-flipbox-yflank"' . us_prepare_inline_css( array( 'background' => $shaded_color ) ) . '></div>';
}
// Left & right flank with shaded color
if ( in_array( $direction, array( 'n', 'ne', 'se', 's', 'sw', 'nw' ) ) ) {
$shaded_color = us_shade_color( $front_bgcolor, 0.1 );
$output .= '<div class="w-flipbox-xflank"' . us_prepare_inline_css( array( 'background' => $shaded_color ) ) . '></div>';
}
}
if ( $animation == 'cubeflip' AND in_array( $direction, array( 'ne', 'se', 'sw', 'nw' ) ) ) {
$output .= '</div>';
}
$output .= '</div></div>';
$output .= '</' . $tag . '>';
echo $output;
@@ -0,0 +1,128 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: Gallery
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
*/
if ( empty( $ids ) ) {
return;
}
$classes = '';
// Columns
$columns = intval( $columns );
if ( $columns != 1 ) {
$classes .= ' cols_' . $columns;
}
// Link type
if ( $link == 'none' ) {
$link_type = 'none';
} elseif ( $link == 'file' ) {
$link_type = 'file';
} else {
$link_type = 'attachment';
}
$classes .= ' link_' . $link_type;
// Masonry layout
if ( isset( $masonry ) AND $masonry == 'true' ) {
$classes .= ' type_masonry';
if ( $columns > 1 AND us_get_option( 'ajax_load_js', FALSE ) == FALSE ) {
wp_enqueue_script( 'us-isotope' );
}
}
// With titles
$with_titles = FALSE;
if ( isset( $meta ) AND $meta == 'true' ) {
$with_titles = TRUE;
$classes .= ' with_meta';
}
// With indents
if ( isset( $indents ) AND $indents == 'true' ) {
$classes .= ' with_indents';
}
// Filter classes
$classes = apply_filters( 'us_gallery_listing_classes', $classes );
// Get images
$query_args = array(
'include' => $ids,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'post__in',
);
if ( $orderby == 'rand' ) {
$query_args['orderby'] = 'rand';
}
$attachments = get_posts( $query_args );
if ( ! is_array( $attachments ) OR empty( $attachments ) ) {
return;
}
// Gallery shortcode usage in feeds
if ( is_feed() ) {
$output = "\n";
foreach ( $attachments as $attachment ) {
$output .= wp_get_attachment_link( $attachment->ID, 'thumbnail', TRUE ) . "\n";
}
return $output;
}
// Output the element
$output = '<div class="w-gallery' . $classes . '"><div class="w-gallery-list">';
$item_tag_name = ( $link_type == 'none' ) ? 'div' : 'a';
foreach ( $attachments as $index => $attachment ) {
// Use the Caption as title
$title = trim( strip_tags( $attachment->post_excerpt ) );
if ( empty( $title ) ) {
// If no Caption, use the Alt
$title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
}
if ( empty( $title ) ) {
// If no Alt, use the Title
$title = trim( strip_tags( $attachment->post_title ) );
}
$output .= '<' . $item_tag_name . ' class="w-gallery-item order_' . ( $index + 1 );
$output .= apply_filters( 'us_gallery_listing_item_classes', '' );
$output .= '"';
if ( $link_type == 'file' ) {
$output .= ' href="' . wp_get_attachment_url( $attachment->ID ) . '" title="' . esc_attr( $title ) . '"';
} elseif ( $link_type == 'attachment' ) {
$output .= ' href="' . get_attachment_link( $attachment->ID ) . '" title="' . esc_attr( $title ) . '"';
}
$output .= '>';
$output .= '<div class="w-gallery-item-img">';
$output .= us_get_attachment_image( $attachment->ID, $size );
$output .= '</div>';
if ( $with_titles ) {
$output .= '<div class="w-gallery-item-meta">';
if ( $title != '' ) {
$output .= '<div class="w-gallery-item-title">' . $title . '</div>';
}
$output .= ( ! empty( $attachment->post_content ) ) ? '<div class="w-gallery-item-description">' . $attachment->post_content . '</div>' : '';
$output .= '</div>';
}
$output .= '</' . $item_tag_name . '>';
}
$output .= "</div></div>";
echo $output;
@@ -0,0 +1,213 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_gmaps
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $marker_address string Marker 1 address
* @param $marker_text string Marker 1 text
* @param $show_infowindow bool Show Marker's InfoWindow
* @param $custom_marker_img int Custom marker image (from WordPress media)
* @param $custom_marker_size int Custom marker size
* @param $markers array Additional Markers
* @param $provider string Map Provider: 'google' / 'osm'
* @param $type string Map type: 'roadmap' / 'satellite' / 'hybrid' / 'terrain'
* @param $height int Map height
* @param $zoom int Map zoom
* @param $hide_controls bool Hide all map controls
* @param $disable_dragging bool Disable dragging on touch screens
* @param $disable_zoom bool Disable map zoom on mouse wheel scroll
* @param $map_bg_color string Map Background Color
* @param $el_class string Extra class name
* @param $map_style_json string Map Style
* @param $layer_style string Leaflet Map TileLayer
*
* @filter 'us_maps_js_options' Allows to filter options, passed to JavaScript
*/
global $us_maps_index;
$us_maps_index = isset( $us_maps_index ) ? $us_maps_index + 1 : 1;
$classes = ' provider_' . $provider;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ' id="' . esc_attr( $el_id ) . '"' : ' id="us_map_' . esc_attr( $us_maps_index ) . '"';
$classes .= ' us_map_' . $us_maps_index;
// Decoding base64-encoded HTML attributes
if ( ! empty( $marker_text ) ) {
$marker_text = rawurldecode( base64_decode( $marker_text ) );
}
if ( ! in_array( $zoom, array( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 ) ) ) {
$zoom = 14;
}
// Form all options needed for JS
$script_options = array();
if ( ! empty( $marker_address ) ) {
$script_options['address'] = $marker_address;
} else {
return NULL;
}
$script_options['markers'] = array(
array_merge(
$script_options, array(
'html' => ( ! empty( $marker_text ) ) ? $marker_text : $marker_address,
'infowindow' => $show_infowindow,
)
),
);
if ( empty( $markers ) ) {
$markers = array();
} else {
$markers = json_decode( urldecode( $markers ), TRUE );
if ( ! is_array( $markers ) ) {
$markers = array();
}
}
foreach ( $markers as $index => $marker ) {
/**
* Filtering the included markers
*
* @param $marker ['marker_address'] string Address
* @param $marker ['marker_text'] string Marker Text
* @param $marker ['marker_img'] string Marker Image
* @param $marker ['marker_size'] string Marker Size
*/
if ( ! empty( $marker['marker_address'] ) ) {
$script_options['markers'][] = array(
'html' => ( ! empty( $marker['marker_text'] ) ) ? $marker['marker_text'] : $marker['marker_address'],
'address' => $marker['marker_address'],
'marker_img' => ( ! empty( $marker['marker_img'] ) ) ? wp_get_attachment_image_src( intval( $marker['marker_img'] ), 'thumbnail' ) : NULL,
'marker_size' => ( ! empty( $marker['marker_size'] ) ) ? array(
$marker['marker_size'],
$marker['marker_size'],
) : NULL,
);
}
}
if ( ! empty( $zoom ) ) {
$script_options['zoom'] = intval( $zoom );
}
if ( ! empty( $type ) AND $provider == 'google' ) {
$type = strtoupper( $type );
if ( in_array( $type, array( 'ROADMAP', 'SATELLITE', 'HYBRID', 'TERRAIN' ) ) ) {
$script_options['maptype'] = $type;
}
}
if ( ! empty( $map_bg_color ) ) {
$script_options['mapBgColor'] = $map_bg_color;
}
if ( $custom_marker_img != '' ) {
if ( is_numeric( $custom_marker_img ) ) {
$custom_marker_img = wp_get_attachment_image_url( intval( $custom_marker_img ), 'thumbnail' );
}
$custom_marker_size = intval( $custom_marker_size );
$script_options['icon'] = array(
'url' => $custom_marker_img,
'size' => array( $custom_marker_size, $custom_marker_size ),
);
}
if ( empty( $height ) ) {
$height = 400;
}
$script_options['height'] = $height;
if ( $provider == 'osm' ) {
if ( ! empty( $layer_style ) ) {
$script_options['style'] = $layer_style;
} else {
$script_options['style'] = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; // default value for empty case
}
}
if ( $hide_controls ) {
$script_options['hideControls'] = TRUE;
}
if ( $disable_zoom ) {
$script_options['disableZoom'] = TRUE;
}
if ( $disable_dragging ) {
$script_options['disableDragging'] = TRUE;
}
$script_options = apply_filters( 'us_maps_js_options', $script_options, get_the_ID(), $us_maps_index );
// Enqueue relevant scripts
if ( $provider == 'osm' ) {
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
wp_enqueue_script( 'us-lmap' );
}
} elseif ( $provider == 'google' ) {
wp_enqueue_script( 'us-google-maps' );
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
wp_enqueue_script( 'us-gmap' );
}
}
$inline_css = us_prepare_inline_css(
array(
'background' => $map_bg_color,
'height' => $height . 'px',
)
);
// Output the element
$output = '<div class="w-map' . $classes . '"' . $el_id . $inline_css . '>';
$output .= '<div class="w-map-json"' . us_pass_data_to_js( $script_options ) . '></div>';
if ( $provider == 'google' AND $map_style_json != '' ) {
$output .= '<div class="w-map-style-json" onclick=\'return ' . str_replace( "'", '&#39;', rawurldecode( base64_decode( $map_style_json ) ) ) . '\'></div>';
}
$output .= '</div>';
// If we are in front end editor mode, apply JS to maps
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
if ( $provider == 'osm' ) {
$output .= '<script>
jQuery(function($){
if (typeof $us !== "undefined" && typeof $us.WMaps === "function") {
var $wLmap = $(".w-map.provider_osm");
if ($wLmap.length){
$us.getScript($us.templateDirectoryUri+"/framework/js/vendor/leaflet.js", function(){
$wLmap.WLmaps();
});
}
}
});
</script>';
} else {
$output .= '<script>
jQuery(function($){
if (typeof $us !== "undefined" && typeof $us.WMaps === "function") {
var $wMap = $(".w-map.provider_google");
if ($wMap.length){
$us.getScript($us.templateDirectoryUri+"/framework/js/vendor/gmaps.js", function(){
$wMap.wMaps();
});
}
}
});
</script>';
}
}
echo $output;
@@ -0,0 +1,390 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_grid
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the element config.
*
*/
// If we are running US Grid loop already, return nothing
global $us_grid_loop_running;
if ( isset( $us_grid_loop_running ) AND $us_grid_loop_running ) {
return;
}
$us_grid_loop_running = TRUE;
$classes = ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
// Grid indexes for CSS, start from 1
global $us_grid_index;
$us_grid_index = isset( $us_grid_index ) ? ( $us_grid_index + 1 ) : 1;
// Get the page we are on for AJAX calls
global $us_page_block_ids;
if ( isset( $us_page_block_ids ) AND ! empty( $us_page_block_ids ) ) {
$post_id = $us_page_block_ids[0];
} else {
$post_id = get_the_ID();
}
$current_post_id = get_the_ID();
// Grid indexes for ajax, start from 1
if ( $shortcode_base != 'us_carousel' ) {
global $us_grid_ajax_indexes;
$us_grid_ajax_indexes[ $post_id ] = isset( $us_grid_ajax_indexes[ $post_id ] ) ? ( $us_grid_ajax_indexes[ $post_id ] + 1 ) : 1;
} else {
$us_grid_ajax_indexes = NULL;
}
// Preparing the query
$query_args = $terms = $filter_taxonomies = array();
$filter_taxonomy_name = $filter_default_taxonomies = '';
/*
* THINGS TO OUTPUT
*/
// Singulars
if ( in_array( $post_type, array_keys( us_grid_available_post_types( TRUE ) ) ) ) {
$query_args['post_type'] = explode( ',', $post_type );
// Posts from selected taxonomies
$known_post_type_taxonomies = us_grid_available_taxonomies();
if ( ! empty( $known_post_type_taxonomies[ $post_type ] ) ) {
foreach ( $known_post_type_taxonomies[ $post_type ] as $taxonomy ) {
if ( ! empty( ${'taxonomy_' . $taxonomy} ) ) {
if ( ! isset( $query_args['tax_query'] ) ) {
$query_args['tax_query'] = array();
}
$query_args['tax_query'][] = array(
'taxonomy' => $taxonomy,
'field' => 'slug',
'terms' => explode( ',', ${'taxonomy_' . $taxonomy} ),
);
}
}
}
// Media attachments should have some differ arguments
if ( $post_type == 'attachment' ) {
if ( ! empty( $images ) ) {
$ids = explode( ',', $images );
$query_args['post__in'] = $ids;
} else {
$attached_images = get_attached_media( 'image', $current_post_id );
if ( ! empty( $attached_images ) ) {
foreach ( $attached_images as $attached_image ) {
$query_args['post__in'][] = $attached_image->ID;
}
}
}
$query_args['post_status'] = 'inherit';
$query_args['post_mime_type'] = 'image';
} else {
// Proper post statuses
$query_args['post_status'] = array( 'publish' => 'publish' );
$query_args['post_status'] += (array) get_post_stati( array( 'public' => TRUE ) );
// Add private states if user is capable to view them
if ( is_user_logged_in() AND current_user_can( 'read_private_posts' ) ) {
$query_args['post_status'] += (array) get_post_stati( array( 'private' => TRUE ) );
}
$query_args['post_status'] = array_values( $query_args['post_status'] );
}
// Data for filter
if ( ! empty( ${'filter_' . $post_type} ) ) {
$filter_taxonomy_name = ${'filter_' . $post_type};
$terms_args = array(
'hierarchical' => FALSE,
'taxonomy' => $filter_taxonomy_name,
'number' => 100,
);
if ( ! empty( ${'taxonomy_' . $filter_taxonomy_name} ) ) {
$terms_args['slug'] = explode( ',', ${'taxonomy_' . $filter_taxonomy_name} );
if ( is_user_logged_in() ) {
$terms_args['hide_empty'] = FALSE;
}
$filter_default_taxonomies = ${'taxonomy_' . $filter_taxonomy_name};
}
$filter_taxonomies = get_terms( $terms_args );
if ( isset( $filter_show_all ) AND ! $filter_show_all AND ! empty( $filter_taxonomies[0] ) ) {
$query_args['tax_query'] = array(
array(
'taxonomy' => $filter_taxonomy_name,
'field' => 'slug',
'terms' => $filter_taxonomies[0],
),
);
}
}
// Specific items by IDs
} elseif ( $post_type == 'ids' AND ! empty( $ids ) ) {
$ids = explode( ',', $ids );
$query_args['ignore_sticky_posts'] = 1;
$query_args['post_type'] = 'any';
$query_args['post__in'] = $ids;
// Items with the same taxonomy of current post
} elseif ( $post_type == 'related' AND is_singular() AND ! empty( $related_taxonomy ) ) {
$query_args['ignore_sticky_posts'] = 1;
$query_args['post_type'] = get_post_type();
$query_args['tax_query'] = array(
array(
'taxonomy' => $related_taxonomy,
'terms' => wp_get_object_terms( $current_post_id, $related_taxonomy, array( 'fields' => 'ids' ) ),
),
);
// Product upsells (WooCommerce only)
} elseif ( $post_type == 'product_upsells' AND is_singular() ) {
$upsells_ids = get_post_meta( $current_post_id, '_upsell_ids', TRUE );
$query_args['post_type'] = 'product';
$query_args['post__in'] = (array) $upsells_ids;
// Terms of selected (or current) taxonomy
} elseif ( in_array( $post_type, array( 'taxonomy_terms', 'current_child_terms' ) ) ) {
$current_term_id = $parent = 0;
$hide_empty = TRUE;
if ( strpos( $terms_include, 'children' ) !== FALSE ) {
$parent = '';
}
if ( strpos( $terms_include, 'empty' ) !== FALSE ) {
$hide_empty = FALSE;
}
// If the current page is archive, we will output its children terms only
if ( $post_type == 'current_child_terms' AND is_archive() ) {
$current_term = get_queried_object();
$related_taxonomy = $current_term->taxonomy;
if ( strpos( $terms_include, 'children' ) !== FALSE ) {
$current_term_id = $current_term->term_id;
} else {
$parent = $current_term->term_id;
}
}
$terms = get_terms(
array(
'taxonomy' => $related_taxonomy,
'orderby' => $terms_orderby,
'order' => ( $terms_orderby == 'count' ) ? 'DESC' : 'ASC',
'number' => $items_quantity,
'hide_empty' => $hide_empty,
'child_of' => $current_term_id,
'parent' => $parent,
)
);
// When taxonomy doesn't exist, it returns WP_Error object, so we need to use empty array for further work
if ( is_wp_error( $terms ) ) {
$terms = array();
}
// Imitate random ordering for terms
if ( $terms_orderby == 'rand' ) {
shuffle( $terms );
}
// Generate query for "Gallery" and "Post Object" types from ACF PRO plugin
} elseif ( strpos( $post_type, 'acf_' ) !== FALSE AND is_singular() ) {
// ACF Galleries
if ( strpos( $post_type, 'acf_gallery_' ) !== FALSE ) {
$key = str_replace( 'acf_gallery_', '', $post_type );
$query_args['post_type'] = 'attachment';
$query_args['post_status'] = 'inherit';
$query_args['post__in'] = get_post_meta( $current_post_id, $key, TRUE );
}
// ACF Post objects
if ( strpos( $post_type, 'acf_posts_' ) !== FALSE ) {
$key = str_replace( 'acf_posts_', '', $post_type );
$ids = get_post_meta( $current_post_id, $key, TRUE );
$query_args['post_type'] = 'any';
$query_args['ignore_sticky_posts'] = 1;
$query_args['post__in'] = is_array( $ids ) ? $ids : array( $ids );
}
}
// Always exclude the current post from the query
if ( is_singular() ) {
$query_args['post__not_in'] = array( $current_post_id );
}
// Exclude sticky posts
if ( ! empty( $ignore_sticky ) ) {
$query_args['ignore_sticky_posts'] = 1;
}
// Set ordering arguments
switch ( $orderby ) {
case 'date':
$query_args['orderby'] = array( 'date' => 'DESC' );
break;
case 'date_asc':
$query_args['orderby'] = array( 'date' => 'ASC' );
break;
case 'modified':
$query_args['orderby'] = array( 'modified' => 'DESC' );
break;
case 'modified_asc':
$query_args['orderby'] = array( 'modified' => 'ASC' );
break;
case 'alpha':
$query_args['orderby'] = array( 'title' => 'ASC' );
break;
case 'menu_order':
$query_args['orderby'] = array( 'menu_order' => 'ASC' );
break;
case 'rand':
$query_args['orderby'] = 'RAND(' . rand() . ')';
break;
case 'price_desc':
$query_args['orderby'] = 'meta_value_num';
$query_args['meta_key'] = '_price';
$query_args['order'] = 'DESC';
break;
case 'price_asc':
$query_args['orderby'] = 'meta_value_num';
$query_args['meta_key'] = '_price';
$query_args['order'] = 'ASC';
break;
case 'popularity':
$query_args['orderby'] = 'meta_value_num';
$query_args['meta_key'] = 'total_sales';
$query_args['order'] = 'DESC';
break;
case 'rating':
$query_args['orderby'] = 'meta_value_num';
$query_args['meta_key'] = '_wc_average_rating';
$query_args['order'] = 'DESC';
break;
default:
$query_args['orderby'] = $orderby;
}
// Pagination
if ( $pagination == 'regular' ) {
$request_paged = is_front_page() ? 'page' : 'paged';
if ( get_query_var( $request_paged ) ) {
$query_args['paged'] = get_query_var( $request_paged );
}
}
// Extra arguments for WooCommerce products
if ( class_exists( 'woocommerce' ) AND in_array( $post_type, array( 'product', 'product_upsells' ) ) ) {
$query_args['meta_query'] = array();
// Exclude out of stock products
if ( $exclude_items == 'out_of_stock' ) {
$query_args['meta_query'][] = array(
'key' => '_stock_status',
'value' => 'outofstock',
'compare' => '!=',
);
}
// Show Sale products
if ( strpos( $products_include, 'sale' ) !== FALSE ) {
$query_args['meta_query'][] = array(
'key' => '_sale_price',
'value' => '',
'compare' => '!=',
);
}
// Show Featured products
if ( strpos( $products_include, 'featured' ) !== FALSE ) {
$tax_query_featured = array(
'taxonomy' => 'product_visibility',
'field' => 'name',
'terms' => 'featured',
'operator' => 'IN',
);
$query_args['tax_query'][] = $tax_query_featured;
}
}
// Exclude posts of previous grids on the same page
if ( $exclude_items == 'prev' ) {
global $us_grid_skip_ids;
if ( ! empty( $us_grid_skip_ids ) AND is_array( $us_grid_skip_ids ) ) {
if ( empty( $query_args['post__not_in'] ) OR ! is_array( $query_args['post__not_in'] ) ) {
$query_args['post__not_in'] = array();
}
$query_args['post__not_in'] = array_merge( $query_args['post__not_in'], $us_grid_skip_ids );
}
}
// Items per page
if ( $items_quantity < 1 ) {
$items_quantity = 999;
}
$query_args['posts_per_page'] = $items_quantity;
// Reset query for using on archives
if ( $post_type == 'current_query' ) {
if ( is_tax( 'tribe_events_cat' ) OR is_post_type_archive( 'tribe_events' ) ) {
$the_content = apply_filters( 'the_content', get_the_content() );
// The page may be paginated itself via <!--nextpage--> tags
$the_pagination = wp_link_pages(
array(
'before' => '<nav class="post-pagination"><span class="title">' . us_translate( 'Pages:' ) . '</span>',
'after' => '</nav>',
'link_before' => '<span>',
'link_after' => '</span>',
'echo' => 0,
)
);
echo $the_content . $the_pagination;
return;
} elseif ( is_archive() OR is_search() OR is_home() ) {
$query_args = NULL;
} else {
return;
}
}
// Load Grid Listing template with given params
$template_vars = array(
'query_args' => $query_args,
'terms' => $terms,
'us_grid_index' => $us_grid_index,
'us_grid_ajax_indexes' => $us_grid_ajax_indexes,
'classes' => $classes,
'post_id' => $post_id,
'filter_taxonomy_name' => $filter_taxonomy_name,
'filter_default_taxonomies' => $filter_default_taxonomies,
'filter_taxonomies' => $filter_taxonomies,
);
// Add default values for unset variables from Grid config
$default_grid_params = us_shortcode_atts( array(), 'us_grid' );
foreach ( $default_grid_params as $param => $value ) {
$template_vars[ $param ] = isset( $$param ) ? $$param : $value;
}
// Add default values for unset variables from Carousel config
if ( $shortcode_base == 'us_carousel' ) {
$default_carousel_params = us_shortcode_atts( array(), 'us_carousel' );
foreach ( $default_carousel_params as $param => $value ) {
$template_vars[ $param ] = isset( $$param ) ? $$param : $value;
}
$template_vars['type'] = 'carousel'; // force 'carousel' type for us_carousel shortcode
}
us_load_template( 'templates/us_grid/listing', $template_vars );
$us_grid_loop_running = FALSE;
@@ -0,0 +1,16 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output html element
*
* @var $content string
* @var $design_options array
* @var $classes string
* @var $id string
*/
$classes = isset( $classes ) ? $classes : '';
echo '<div class="w-html' . $classes . '">';
echo do_shortcode( rawurldecode( base64_decode( $content ) ) );
echo '</div>';
@@ -0,0 +1,22 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Horizontal Wrapper
*/
$classes = ' align_' . $alignment;
$classes .= ' valign_' . $valign;
$classes .= ( $wrap ) ? ' wrap' : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Output the element
$output = '<div class="w-hwrapper' . $classes . '"' . $el_id . '>';
$output .= do_shortcode( $content );
$output .= '</div>';
echo $output;
@@ -0,0 +1,113 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_iconbox
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $icon string Icon
* @param $style string Icon style: 'default' / 'circle' / 'outlined'
* @param $color string Icon color: 'primary' / 'secondary' / 'light' / 'contrast' / 'custom'
* @param $icon_color string Icon color value
* @param $bg_color string Icon circle color
* @param $iconpos string Icon position: 'top' / 'left'
* @param $size string Icon size in pixels
* @param $img int Icon image (from WordPress media)
* @param $title string Title
* @param $title_tag string Title HTML tag: 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
* @param $title_size string Title Size
* @param $link string Link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
* @param $alignment string Alignment of the whole element
* @param $el_class string Extra class name
*/
$classes = $icon_html = $link_opener = $link_closer = '';
$classes .= ' iconpos_' . $iconpos;
$classes .= ' style_' . $style;
$classes .= ' color_' . $color;
$classes .= ' align_' . $alignment;
if ( $title == '' ) {
$classes .= ' no_title';
}
if ( $content == '' ) {
$classes .= ' no_text';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Use image instead icon, if set
if ( $img != '' ) {
$classes .= ' icontype_img';
if ( is_numeric( $img ) ) {
$icon_html = us_get_attachment_image( intval( $img ), 'full' );
} else {
// Direct link to image is set in the shortcode attribute
$icon_html = '<img src="' . $img . '" alt="' . $title . '">';
}
} elseif ( $icon != '' ) {
$icon_html = us_prepare_icon_tag( $icon );
}
// Link
$link_atts = us_generate_link_atts( $link );
if ( ! empty( $link_atts ) ) {
if ( $title != '' ) {
$link_atts .= ' aria-label="' . esc_attr( $title ) . '"';
} else {
$link_atts .= ' aria-hidden="true"';
}
$link_opener = '<a class="w-iconbox-link"' . $link_atts . '>';
$link_closer = '</a>';
}
$icon_inline_css = us_prepare_inline_css(
array(
'font-size' => ( $size == '36px' ) ? '' : $size,
'box-shadow' => empty( $circle_color ) ? '' : '0 0 0 2px ' . $circle_color . ' inset',
'background' => $circle_color,
'color' => $icon_color,
)
);
// Output the element
$output = '<div class="w-iconbox' . $classes . '"' . $el_id . '>';
if ( in_array( $iconpos, array( 'top', 'left' ) ) ) {
$output .= $link_opener;
$output .= '<div class="w-iconbox-icon"' . $icon_inline_css . '>' . $icon_html . '</div>';
$output .= $link_closer;
$output .= '<div class="w-iconbox-meta">';
} elseif ( $iconpos == 'right' ) {
$output .= '<div class="w-iconbox-meta">';
}
if ( $title != '' ) {
$output .= $link_opener;
$title_inline_css = us_prepare_inline_css(
array(
'font-size' => $title_size,
)
);
$output .= '<' . $title_tag . ' class="w-iconbox-title"' . $title_inline_css . '>' . $title . '</' . $title_tag . '>';
$output .= $link_closer;
}
if ( $content != '' ) {
$output .= '<div class="w-iconbox-text">' . do_shortcode( wpautop( $content ) ) . '</div>';
}
if ( in_array( $iconpos, array( 'top', 'left' ) ) ) {
$output .= '</div>';
} elseif ( $iconpos == 'right' ) {
$output .= '</div>';
$output .= $link_opener;
$output .= '<div class="w-iconbox-icon"' . $icon_inline_css . '>' . $icon_html . '</div>';
$output .= $link_closer;
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,111 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Image element
*/
$img_html = $img_shadow = $inline_css = '';
$classes = isset( $classes ) ? $classes : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$css = ! empty( $css ) ? $css : '';
if ( class_exists( 'SitePress' ) ) {
$image = apply_filters( 'wpml_object_id', $image );
}
// Classes & inline styles
if ( $us_elm_context == 'shortcode' ) {
$img = $image;
$classes .= ' align_' . $align;
$classes .= ( ! empty( $style ) ) ? ' style_' . $style : '';
$classes .= ( $meta ) ? ' meta_' . $meta_style : '';
if ( ! empty( $animate ) ) {
$classes .= ' animate_' . $animate;
if ( ! empty( $animate_delay ) ) {
$inline_css = us_prepare_inline_css(
array(
'animation-delay' => floatval( $animate_delay ) . 's',
)
);
}
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
}
// Get the image
$img_arr = explode( '|', $img );
$img_html .= us_get_attachment_image( $img_arr[0], $size );
// Get the image for transparent header if set
if ( ! empty( $img_transparent ) ) {
$classes .= ' with_transparent';
$img_arr = explode( '|', $img_transparent );
$img_html .= us_get_attachment_image( $img_arr[0], $size );
}
if ( $us_elm_context == 'shortcode' AND $img_html ) {
if ( $meta ) {
$attachment = get_post( $img );
// Use the Caption as a Title
$title = trim( strip_tags( $attachment->post_excerpt ) );
if ( empty( $title ) ) {
// If not, Use the Alt
$title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
}
if ( empty( $title ) ) {
// If no Alt, use the Title
$title = trim( strip_tags( $attachment->post_title ) );
}
$img_html .= '<div class="w-image-meta">';
$img_html .= ( ! empty( $title ) ) ? '<div class="w-image-title">' . $title . '</div>' : '';
$img_html .= ( ! empty( $attachment->post_content ) ) ? '<div class="w-image-description">' . $attachment->post_content . '</div>' : '';
$img_html .= '</div>';
}
// Get url to the image to immitate shadow
$img_src = wp_get_attachment_image_url( $img, $size );
if ( $style == 'shadow-2' ) {
$img_shadow = '<div class="w-image-shadow" style="background-image:url(' . $img_src . ');"></div>';
}
}
// Link
if ( $onclick == 'lightbox' ) {
$link_atts = ' href="' . wp_get_attachment_image_url( $img, 'full' ) . '" ref="magnificPopup"';
} else {
$link_atts = us_generate_link_atts( $link );
}
if ( ! empty( $link_atts ) ) {
$tag = 'a';
} else {
$tag = 'div';
}
if ( empty( $img_html ) ) {
// Check if image ID is URL
if ( strpos( $img, 'http' ) !== FALSE ) {
$img_html = '<img src="' . esc_attr( $img ) . '" alt="image" />';
} else {
$classes .= ' no_image';
$img_html = '<div class="g-placeholder"></div>';
}
}
// Output the element
$output = '<div class="w-image' . $classes . '"' . $el_id . $inline_css . '>';
$output .= '<' . $tag . ' class="w-image-h"' . $link_atts . '>';
$output .= $img_shadow;
$output .= $img_html;
$output .= '</' . $tag . '>';
$output .= '</div>';
echo $output;
@@ -0,0 +1,182 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_image_slider
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*/
if ( empty( $ids ) ) {
return;
}
$classes = ' style_' . $style;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Royal Slider options
$js_options = array(
'loopRewind' => TRUE,
'slidesSpacing' => 0,
'imageScalePadding' => 0,
'numImagesToPreload' => 2,
'arrowsNav' => ( $arrows != 'hide' ),
'arrowsNavAutoHide' => ( $arrows == 'hover' ),
'transitionType' => ( $transition == 'crossfade' ) ? 'fade' : 'move',
'transitionSpeed' => intval( $transition_speed ),
'block' => array(
'moveEffect' => 'none',
'speed' => 300,
),
);
if ( $nav == 'dots' ) {
$js_options['controlNavigation'] = 'bullets';
} elseif ( $nav == 'thumbs' ) {
$js_options['controlNavigation'] = 'thumbnails';
} else {
$js_options['controlNavigation'] = 'none';
}
if ( $autoplay AND $autoplay_period ) {
$js_options['autoplay'] = array(
'enabled' => TRUE,
'pauseOnHover' => $pause_on_hover ? TRUE : FALSE,
'delay' => intval( $autoplay_period * 1000 ),
);
}
if ( $fullscreen ) {
$js_options['fullscreen'] = array( 'enabled' => TRUE );
}
if ( $img_fit == 'contain' ) {
$js_options['imageScaleMode'] = 'fit';
} elseif ( $img_fit == 'cover' ) {
$js_options['imageScaleMode'] = 'fill';
} else/*if ( $img_fit == 'scaledown' )*/ {
$js_options['imageScaleMode'] = 'fit-if-smaller';
}
if ( ! in_array( $img_size, get_intermediate_image_sizes() ) ) {
$img_size = 'full';
}
// Getting images
$query_args = array(
'include' => $ids,
'post_status' => 'inherit',
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'post__in',
'numberposts' => - 1,
);
if ( $orderby == 'rand' ) {
$query_args['orderby'] = 'rand';
}
$attachments = get_posts( $query_args );
if ( ! is_array( $attachments ) OR empty( $attachments ) ) {
return;
}
$i = 1;
$first_image = array( '0' => '' );
$data_ratio = NULL;
$images_html = '';
$images_alts = array();
foreach ( $attachments as $index => $attachment ) {
$image = wp_get_attachment_image_src( $attachment->ID, $img_size );
if ( ! $image ) {
continue;
}
// Correct width and height for SVG files
if ( preg_match( '~\.svg$~', $image[0] ) ) {
$size_array = us_get_intermediate_image_size( $img_size );
if ( $size_array['width'] ) {
$image[1] = $image[2] = $size_array['width'];
} elseif ( $size_array['height'] ) {
$image[1] = $image[2] = $size_array['height'];
} else {
$image[1] = $image[2] = '2000'; // fallback for non-numeric values
}
}
if ( ! isset( $js_options['autoScaleSlider'] ) ) {
$js_options['autoScaleSlider'] = TRUE;
$js_options['autoScaleSliderWidth'] = $image[1];
$js_options['autoScaleSliderHeight'] = $image[2];
$js_options['fitInViewport'] = FALSE;
}
$full_image_attr = '';
if ( $fullscreen ) {
$full_image = wp_get_attachment_image_url( $attachment->ID, 'full' );
if ( ! $full_image ) {
$full_image = $image[0];
}
$full_image_attr = ' data-rsBigImg="' . $full_image . '"';
}
// Use the Caption as a Title
$image_title = trim( strip_tags( $attachment->post_excerpt ) );
if ( empty( $image_title ) ) {
// If not, Use the Alt
$image_title = trim( strip_tags( get_post_meta( $attachment->ID, '_wp_attachment_image_alt', TRUE ) ) );
}
if ( empty( $image_title ) ) {
// If no Alt, use the Title
$image_title = trim( strip_tags( $attachment->post_title ) );
}
$img_alt = us_get_image_alt( $attachment->ID );
$images_html .= '<div class="rsContent">';
if ( $i == 1 ) {
$first_image = $image;
$first_image_alt = ' alt="' . $img_alt . '"';
}
$images_html .= '<a class="rsImg" data-rsw="' . $image[1] . '" data-rsh="' . $image[2] . '"' . $full_image_attr . ' href="' . $image[0] . '"><span data-alt="' . $img_alt . '"></span></a>';
if ( $nav == 'thumbs' ) {
$images_html .= wp_get_attachment_image( $attachment->ID, 'thumbnail', FALSE, array( 'class' => 'rsTmb' ) );
}
if ( $meta ) {
$images_html .= '<div class="rsABlock" data-fadeEffect="false" data-moveEffect="none">';
if ( $image_title != '' ) {
$images_html .= '<div class="w-slider-item-title">' . $image_title . '</div>';
}
if ( $attachment->post_content != '' ) {
$images_html .= '<div class="w-slider-item-description">' . $attachment->post_content . '</div>';
}
$images_html .= '</div>';
}
$images_html .= '</div>';
$i ++;
}
// We need Royal Slider script for this
if ( us_get_option( 'ajax_load_js', 0 ) == 0 ) {
wp_enqueue_script( 'us-royalslider' );
}
$output = '<div class="w-slider' . $classes . '"' . $el_id . '>';
$output .= '<div class="w-slider-h">';
$output .= '<div class="royalSlider">' . $images_html . '</div>';
$output .= '<img src="' . $first_image[0] . '"' . $first_image_alt . '></div>';
$output .= '<div class="w-slider-json"' . us_pass_data_to_js( $js_options ) . '></div>';
$output .= '</div>';
// If we are in front end editor mode, apply JS to logos
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$output .= '<script>
jQuery(function($){
if (typeof $.fn.wSlider === "function") {
jQuery(".w-slider").wSlider();
}
});
</script>';
}
echo $output;
@@ -0,0 +1,186 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Interactive Text
*/
$classes = ' type_' . $animation_type . ' align_' . $align;
if ( $dynamic_bold ) {
$classes .= ' dynamic_bold';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Allows to use nbsps and other entities
$texts = html_entity_decode( $texts );
$texts_arr = explode( "\n", strip_tags( $texts ) );
$js_data = array(
'duration' => intval( $duration ) * 1000,
'delay' => intval( floatval( $delay ) * 1000 ),
);
if ( ! empty( $dynamic_color ) ) {
$js_data['dynamicColor'] = $dynamic_color;
}
// Getting words and their delimiters to work on this level of abstraction
$_parts = array();
foreach ( $texts_arr as $index => $text ) {
preg_match_all( '~[\w\-]+|[^\w\-]+~u', $text, $matches );
$_parts[ $index ] = $matches[0];
}
// Getting the whole set of parts with all the intermediate values (part_index => part_states)
$groups = array();
foreach ( $_parts[0] as $part ) {
$groups[] = array( $part );
}
for ( $i_index = count( $_parts ) - 1; $i_index > 0; $i_index -- ) {
$f_index = isset( $_parts[ $i_index + 1 ] ) ? ( $i_index + 1 ) : 0;
$initial = &$_parts[ $i_index ];
$final = &$_parts[ $f_index ];
// Counting arrays edit distance for the strings parts to find the common parts
$dist = array();
for ( $i = 0; $i <= count( $initial ); $i ++ ) {
$dist[ $i ] = array( $i );
}
for ( $j = 1; $j <= count( $final ); $j ++ ) {
$dist[0][ $j ] = $j;
for ( $i = 1; $i <= count( $initial ); $i ++ ) {
if ( $initial[ $i - 1 ] == $final[ $j - 1 ] ) {
$dist[ $i ][ $j ] = $dist[ $i - 1 ][ $j - 1 ];
} else {
$dist[ $i ][ $j ] = min( $dist[ $i - 1 ][ $j ], $dist[ $i ][ $j - 1 ], $dist[ $i - 1 ][ $j - 1 ] ) + 1;
}
}
}
for ( $i = count( $initial ), $j = count( $final ); $i > 0 OR $j > 0; $i --, $j -- ) {
$min = $dist[ $i ][ $j ];
if ( $i > 0 ) {
$min = min( $min, $dist[ $i - 1 ][ $j ], ( $j > 0 ) ? $dist[ $i - 1 ][ $j - 1 ] : $min );
}
if ( $j > 0 ) {
$min = min( $min, $dist[ $i ][ $j - 1 ] );
}
if ( $min >= $dist[ $i ][ $j ] ) {
$groups[ $j - 1 ][ $i_index ] = $initial[ $i - 1 ];
continue;
}
if ( $i > 0 AND $j > 0 AND $min == $dist[ $i - 1 ][ $j - 1 ] ) {
// Modify
$groups[ $j - 1 ][ $i_index ] = $initial[ $i - 1 ];
} elseif ( $j > 0 AND $min == $dist[ $i ][ $j - 1 ] ) {
// Remove
$groups[ $j - 1 ][ $i_index ] = '';
$i ++;
} elseif ( $min == $dist[ $i - 1 ][ $j ] ) {
// Insert
if ( $j == 0 ) {
array_unshift( $groups, '' );
} else {
array_splice( $groups, $j, 0, '' );
}
$groups[ $j ] = array_fill( 0, count( $_parts ), '' );
$groups[ $j ][ $i_index ] = $initial[ $i - 1 ];
$j ++;
}
}
// Updating final parts
$_parts[ $i_index ] = array();
foreach ( $groups as $parts_group ) {
$_parts[ $i_index ][] = $parts_group[ $i_index ];
}
}
// Finding the dynamic parts and their animation indexes
$group_changes = array();
$nbsp_char = html_entity_decode( '&nbsp;' );
foreach ( $groups as $index => $group ) {
$group_changes[ $index ] = array();
for ( $i = 0; $i < count( $_parts ); $i ++ ) {
if ( $group[ $i ] != $group[ isset( $group[ $i + 1 ] ) ? ( $i + 1 ) : 0 ] OR $group[ $i ] === '' ) {
$group_changes[ $index ][] = $i;
}
// HTML won't show spans with spaces at all, so replacing them with nbsps
// A bit sophisticated check to speed up this frequent action
if ( strlen( $group[ $i ] ) AND $group[ $i ][0] == ' ' AND preg_match( '~^ +$~u', $group[ $i ][0] ) ) {
$groups[ $index ][ $i ] = str_replace( ' ', $nbsp_char, $group[ $i ] );
}
}
}
// Combining groups that are either static, or are changed at the same time
for ( $i = 1; $i < count( $group_changes ); $i ++ ) {
if ( $group_changes[ $i - 1 ] == $group_changes[ $i ] ) {
// Combining with the previous element
foreach ( $groups[ $i - 1 ] AS $index => $part ) {
$groups[ $i - 1 ][ $index ] .= $groups[ $i ][ $index ];
}
array_splice( $groups, $i, 1 );
array_splice( $group_changes, $i, 1 );
$i --;
}
}
// Generate inline styles
$inline_css = us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
'color' => $color,
), TRUE, $tag
);
$responsive_css = '';
if ( ! empty( $font_size_mobiles ) OR ! empty( $line_height_mobiles ) ) {
global $us_itext_id;
$us_itext_id = isset( $us_itext_id ) ? ( $us_itext_id + 1 ) : 1;
$classes .= ' us_itext_' . $us_itext_id;
$responsive_css .= '<style>';
$responsive_css .= '@media (max-width: 600px) {.us_itext_' . $us_itext_id . '{';
$responsive_css .= ! empty( $font_size_mobiles ) ? ( 'font-size:' . $font_size_mobiles . '!important;' ) : '';
$responsive_css .= ! empty( $line_height_mobiles ) ? ( 'line-height:' . $line_height_mobiles . '!important;' ) : '';
$responsive_css .= '}}';
$responsive_css .= '</style>';
}
// Output the element
$output = '<' . $tag . ' class="w-itext' . $classes . '"';
$output .= $el_id . $inline_css;
$output .= us_pass_data_to_js( $js_data );
$output .= '>';
foreach ( $groups as $index => $group ) {
ksort( $group );
if ( empty( $group_changes[ $index ] ) ) {
// Static part
$output .= $group[0];
} else {
$output .= '<span class="w-itext-part';
// Animation classes (just in case site editor wants some custom styling for them)
foreach ( $group_changes[ $index ] as $changesat ) {
$output .= ' changesat_' . $changesat;
}
if ( in_array( '0', $group_changes[ $index ] ) ) {
// Highlighting dynamic parts at start
$output .= ' dynamic"' . us_prepare_inline_css( array( 'color' => $dynamic_color ) );
} else {
$output .= '"';
}
$output .= us_pass_data_to_js( $group ) . '>' . preg_replace( '/\s/', '&nbsp', htmlentities( $group[0] ) ) . '</span>';
}
}
$output .= '</' . $tag . '>';
$output .= $responsive_css;
echo $output;
@@ -0,0 +1,99 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output menu element
*
* @var $hover_effect string Hover Effect: 'simple' / 'underline'
* @var $dropdown_effect string Dropdown Effect
* @var $vstretch boolean Stretch menu items vertically to fit the available height
* @var $indents int Items Indents
* @var $mobile_width int On which screen width menu becomes mobile
* @var $mobile_behavior boolean Mobile behavior
* @var $design_options array
* @var $id string
* @var $classes string
* @var $source string WP Menu source
*/
if ( substr( $source, 0, 9 ) == 'location:' ) {
$location = substr( $source, 9 );
$theme_locations = get_nav_menu_locations();
if ( isset( $theme_locations[$location] ) ) {
$menu_obj = get_term( $theme_locations[$location], 'nav_menu' );
if ( $menu_obj ) {
$source = $menu_obj->slug;
} else {
return;
}
} else {
return;
}
} else {
$location = NULL;
}
if ( empty( $location ) AND ( empty( $source ) OR ! is_nav_menu( $source ) ) ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
$list_classes = ' level_1 hide_for_mobiles';
$list_classes .= ( isset( $hover_effect ) ) ? ' hover_' . $hover_effect : '';
if ( $vstretch ) {
$classes .= ' height_full';
}
$classes .= ' type_desktop dropdown_' . $dropdown_effect;
$classes .= ( isset( $mobile_align ) ) ? ' m_align_' . $mobile_align : '';
if ( isset( $mobile_layout ) ) {
$classes .= ' m_layout_' . $mobile_layout;
if ( $mobile_layout == 'panel' ) {
$classes .= ( isset( $mobile_effect_p ) ) ? ' m_effect_' . $mobile_effect_p : '';
}
if ( $mobile_layout == 'fullscreen' ) {
$classes .= ( isset( $mobile_effect_f ) ) ? ' m_effect_' . $mobile_effect_f : '';
}
}
echo '<nav class="w-nav' . $classes . '"';
if ( us_get_option( 'schema_markup' ) ) {
echo ' itemscope itemtype="https://schema.org/SiteNavigationElement"';
}
echo '>';
echo '<a class="w-nav-control" href="javascript:void(0);" aria-label="' . us_translate( 'Menu' ) . '">';
echo '<div class="w-nav-icon"><i></i></div>';
echo '<span>' . us_translate( 'Menu' ) . '</span>';
echo '</a>';
echo '<ul class="w-nav-list' . $list_classes . '">';
if ( $location ) {
wp_nav_menu(
array(
'theme_location' => $location,
'container' => FALSE,
'walker' => new US_Walker_Nav_Menu,
'items_wrap' => '%3$s',
'fallback_cb' => FALSE,
)
);
} else {
wp_nav_menu(
array(
'menu' => $source,
'container' => FALSE,
'walker' => new US_Walker_Nav_Menu,
'items_wrap' => '%3$s',
'fallback_cb' => FALSE,
)
);
}
echo '<li class="w-nav-close"></li>';
echo '</ul>';
echo '<div class="w-nav-options hidden"';
echo us_pass_data_to_js(
array(
'mobileWidth' => intval( $mobile_width ),
'mobileBehavior' => intval( $mobile_behavior ),
)
);
echo '></div>';
echo '</nav>';
@@ -0,0 +1,50 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_message
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $color string Message box color: 'info' / 'attention' / 'success' / 'error' / 'custom'
* @param $bg_color string Background color
* @param $text_color string Text color
* @param $icon string Icon
* @param $closing bool Enable closing?
* @param $el_class string Extra class name
*/
$classes = $icon_html = $closer_html = '';
$classes .= ' color_' . $color;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
if ( ! empty( $icon ) ) {
$icon_html = '<div class="w-message-icon">' . us_prepare_icon_tag( $icon ) . '</div>';
$classes .= ' with_icon';
}
if ( $closing ) {
$classes .= ' with_close';
$closer_html = '<a class="w-message-close" href="javascript:void(0)" aria-label="' . us_translate( 'Close' ) . '"></a>';
}
$inline_css = us_prepare_inline_css(
array(
'background' => $bg_color,
'color' => $text_color,
)
);
// Output the element
$output = '<div class="w-message' . $classes . '"' . $el_id . $inline_css . '>' . $icon_html;
$output .= '<div class="w-message-body"><p>' . do_shortcode( $content ) . '</p></div>' . $closer_html . '</div>';
echo $output;
@@ -0,0 +1,42 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Page Block element
*/
if ( is_numeric( $id ) ) {
$page_block = get_post( $id );
} else {
return;
}
if ( $page_block AND $page_block->post_type == 'us_page_block' ) {
us_add_to_page_block_ids( $page_block->ID );
$page_block_content = $page_block->post_content;
us_open_wp_query_context();
us_add_page_shortcodes_custom_css( $id );
us_close_wp_query_context();
} else {
return;
}
// Remove [vc_row] and [vc_column] if set
if ( $remove_rows ) {
$page_block_content = str_replace( array( '[vc_row]', '[/vc_row]', '[vc_column]', '[/vc_column]' ), '', $page_block_content );
$page_block_content = preg_replace( '~\[vc_row (.+?)]~', '', $page_block_content );
$page_block_content = preg_replace( '~\[vc_column (.+?)]~', '', $page_block_content );
}
// Force fullwidth for all [vc_row] if set
if ( ! $remove_rows AND $force_fullwidth_rows ) {
$page_block_content = str_replace( '[vc_row]', '[vc_row width="full"]', $page_block_content );
$page_block_content = str_replace( '[vc_row ', '[vc_row width="full" ', $page_block_content );
}
// Apply filters to Page Block content and echoing it ouside of us_open_wp_query_context
echo apply_filters( 'us_page_block_the_content', $page_block_content );
us_remove_from_page_block_ids();
@@ -0,0 +1,74 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_page_title
*/
$classes = $schema_heading = $output = '';
$classes .= ' align_' . $align;
if ( $inline AND $align != 'center' ) {
$classes .= ' type_inline';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Generate inline styles
$inline_css = us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
'color' => $color,
), TRUE, $tag
);
// Add microdata depending on the relevant Theme Option
if ( us_get_option( 'schema_markup' ) ) {
$schema_heading = ' itemprop="headline"';
}
// Get title based on page type
if ( is_home() ) {
$title = us_translate( 'All Posts' );
} elseif ( is_search() ) {
$title = sprintf( us_translate( 'Search results for &#8220;%s&#8221;' ), esc_attr( get_search_query() ) );
} elseif ( is_author() ) {
$title = sprintf( us_translate( 'Posts by %s' ), get_the_author() );
} elseif ( is_tag() ) {
$title = single_tag_title( '', FALSE );
} elseif ( is_category() ) {
$title = single_cat_title( '', FALSE );
} elseif ( is_tax() ) {
$title = single_term_title( '', FALSE );
} elseif ( function_exists( 'is_shop' ) AND is_shop() ) {
$title = woocommerce_page_title( '', FALSE );
} elseif ( is_archive() ) {
$post_type = get_post_type_object( get_post_type() );
if ( isset( $post_type->labels->name ) ) {
$title = $post_type->labels->name;
}
} elseif ( is_404() ) {
$title = us_translate( 'Page not found' );
} else {
$title = get_the_title();
}
// Output the element
if ( $title != '' ) {
$output .= '<' . $tag . ' class="w-page-title' . $classes . '"';
$output .= $el_id . $schema_heading . $inline_css;
$output .= '>';
$output .= $title;
$output .= '</' . $tag . '>';
}
if ( $description AND term_description() ) {
$output .= '<div class="w-term-description">' . term_description() . '</div>';
}
echo $output;
@@ -0,0 +1,136 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_person
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $image int Photo (from WP Media Library)
* @param $image_hover int Photo on hover (from WP Media Library)
* @param $name string Name
* @param $role string Role
* @param $link string Link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
* @param $layout string Layout: 'simple' / 'simple_circle' / 'circle' / 'square' / 'card' / 'modern' / 'trendy'
* @param $effect string Photo Effect: 'none' / 'sepia' / 'bw' / 'faded' / 'colored'
* @param $email string Email
* @param $facebook string Facebook link
* @param $twitter string Twitter link
* @param $google_plus string Google link
* @param $linkedin string LinkedIn link
* @param $skype string Skype link
* @param $custom_icon string Custom icon
* @param $custom_link string Custom link
* @param $el_class string Extra class name
*/
$classes = $img_html = $links_html = $link_opener = $link_closer = '';
// Generate schema.org markup
$schema_base = $schema_image = $schema_name = $schema_job = $schema_desc = '';
if ( us_get_option( 'schema_markup' ) ) {
$schema_base = ' itemscope itemtype="https://schema.org/Person"';
$schema_image = ' itemprop="image"';
$schema_name = ' itemprop="name"';
$schema_job = ' itemprop="jobTitle"';
$schema_desc = ' itemprop="description"';
}
$classes .= ' layout_' . $layout;
if ( $effect != 'none' ) {
$classes .= ' effect_' . $effect;
}
if ( ! empty( $content ) ) {
$classes .= ' with_desc';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
if ( is_numeric( $image ) ) {
$img_html = us_get_attachment_image( intval( $image ), $img_size );
} elseif ( ! empty( $image ) ) {
// Direct link to image is set in the shortcode attribute
$img_html = '<img src="' . $image . '" alt="' . esc_attr( $name ) . '">';
}
if ( is_numeric( $image_hover ) ) {
$img_hover = wp_get_attachment_image_url( intval( $image_hover ), $img_size );
if ( $img_hover !== FALSE ) {
$img_html .= '<div class="img_hover" style="background-image:url(' . $img_hover . ')"></div>';
}
} elseif ( ! empty( $image_hover ) ) {
// Direct link to image is set in the shortcode attribute
$img_html .= '<div class="img_hover" style="background-image:url(' . $image_hover . ')"></div>';
}
if ( ! empty( $email ) ) {
$links_html .= '<a class="w-person-links-item type_email" href="mailto:' . esc_attr( $email ) . '"><i></i></a>';
}
if ( ! empty( $facebook ) ) {
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $facebook ) . '" target="_blank"><i class="fab fa-facebook-f"></i></a>';
}
if ( ! empty( $twitter ) ) {
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $twitter ) . '" target="_blank"><i class="fab fa-twitter"></i></a>';
}
if ( ! empty( $google_plus ) ) {
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $google_plus ) . '" target="_blank"><i class="fab fa-google-plus-g"></i></a>';
}
if ( ! empty( $linkedin ) ) {
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $linkedin ) . '" target="_blank"><i class="fab fa-linkedin-in"></i></a>';
}
if ( ! empty( $skype ) ) {
// Skype link may be some http(s): or skype: link. If protocol is not set, adding "skype:"
$skype_url = $skype;
if ( strpos( $skype_url, ':' ) === FALSE ) {
$skype_url = 'skype:' . esc_attr( $skype_url );
}
$links_html .= '<a class="w-person-links-item" href="' . $skype_url . '"><i class="fab fa-skype"></i></a>';
}
if ( ! empty( $custom_icon ) AND ! empty( $custom_link ) ) {
$links_html .= '<a class="w-person-links-item" href="' . esc_url( $custom_link ) . '" target="_blank">' . us_prepare_icon_tag( $custom_icon ) . '</a>';
}
if ( ! empty( $links_html ) ) {
$classes .= ' with_socials';
$links_html = '<div class="w-person-links"><div class="w-person-links-list">' . $links_html . '</div></div>';
}
// Link
$link_atts = us_generate_link_atts( $link );
if ( ! empty( $link_atts ) ) {
$link_opener = '<a class="w-person-link"' . $link_atts . '>';
$link_closer = '</a>';
}
// Output the element
$output = '<div class="w-person' . $classes . '"' . $el_id . $schema_base . '>';
$output .= '<div class="w-person-image">';
$output .= $link_opener . $img_html . $link_closer;
if ( in_array( $layout, array( 'square', 'circle' ) ) ) {
$output .= $links_html;
}
$output .= '</div>';
$output .= '<div class="w-person-content">';
if ( ! empty( $name ) ) {
$output .= $link_opener . '<h4 class="w-person-name"' . $schema_name . '><span>' . $name . '</span></h4>' . $link_closer;
}
if ( ! empty( $role ) ) {
$output .= '<div class="w-person-role"' . $schema_job . '>' . $role . '</div>';
}
if ( $layout == 'trendy' AND ( ! empty( $content ) OR ! empty( $links_html ) ) ) {
$output .= '</div><div class="w-person-content-alt">' . $link_opener . $link_closer;
}
if ( ! in_array( $layout, array( 'square', 'circle' ) ) ) {
$output .= $links_html;
}
if ( ! empty( $content ) ) {
$output .= '<div class="w-person-description"' . $schema_desc . '>' . do_shortcode( $content ) . '</div>';
}
$output .= '</div></div>';
echo $output;
@@ -0,0 +1,124 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Popup
*/
$popup_classes = ' animation_' . $animation;
$classes = ' align_' . $align;
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
// Output the trigger
$output = '<div class="w-popup' . $classes . '" ' . $el_id . '>';
// Trigger
if ( $show_on == 'image' AND ! empty( $image ) AND ( $image_html = wp_get_attachment_image( $image, $image_size ) ) ) {
$output .= '<a href="javascript:void(0)" class="w-popup-trigger type_image">' . $image_html . '</a>';
} elseif ( $show_on == 'load' ) {
$output .= '<span class="w-popup-trigger type_load" data-delay="' . intval( $show_delay ) . '"></span>';
} elseif ( $show_on == 'selector' ) {
$output .= '<span class="w-popup-trigger type_selector" data-selector="' . esc_attr( $trigger_selector ) . '"></span>';
} else/*if ( $show_on == 'btn' )*/ {
if ( ! isset( $btn_size ) OR trim( $btn_size ) == ( us_get_option( 'body_fontsize' ) ) ) {
$btn_size = '';
}
$btn_inline_css = us_prepare_inline_css(
array(
'font-size' => $btn_size,
)
);
// Icon
$icon_html = $btn_classes = '';
if ( ! empty( $btn_icon ) ) {
$icon_html = us_prepare_icon_tag( $btn_icon );
$btn_classes = ' icon_at' . $btn_iconpos;
}
$output .= '<div class="w-btn-wrapper">';
$output .= '<a href="javascript:void(0)" class="w-popup-trigger type_btn w-btn us-btn-style_' . $btn_style . $btn_classes . '"' . $btn_inline_css . '>';
if ( is_rtl() ) {
$btn_iconpos = ( $btn_iconpos == 'left' ) ? 'right' : 'left';
}
if ( $btn_iconpos == 'left' ) {
$output .= $icon_html;
}
$output .= '<span class="w-btn-label">' . trim( strip_tags( $btn_label, '<br>' ) ) . '</span>';
if ( $btn_iconpos == 'right' ) {
$output .= $icon_html;
}
$output .= '</a>';
$output .= '</div>';
}
// Overlay
$output .= '<div class="w-popup-overlay"';
$output .= us_prepare_inline_css(
array(
'background' => $overlay_bgcolor,
)
);
$output .= '></div>';
// Popup title
$output_title = '';
if ( ! empty( $title ) ) {
$popup_classes .= ' with_title';
$output_title .= '<div class="w-popup-box-title"';
$output_title .= us_prepare_inline_css(
array(
'color' => $title_textcolor,
'background' => $title_bgcolor,
)
);
$output_title .= '>' . esc_html( $title ) . '</div>';
} else {
$popup_classes .= ' without_title';
}
// The Popup itself
$output .= '<div class="w-popup-wrap">';
$output .= '<div class="w-popup-box' . $popup_classes . '"';
$output .= us_prepare_inline_css(
array(
'border-radius' => $popup_border_radius,
'width' => $popup_width,
)
);
$output .= '><div class="w-popup-box-h">';
$output .= $output_title;
// Popup content
$output .= '<div class="w-popup-box-content"';
$output .= us_prepare_inline_css(
array(
'padding' => $popup_padding,
'background' => $content_bgcolor,
'color' => $content_textcolor,
)
);
$output .= '>';
$output .= do_shortcode( wpautop( $content ) );
$output .= '</div>';
$output .= '</div></div>'; // .w-popup-box
// Popup closer
$output .= '<div class="w-popup-closer"';
$output .= us_prepare_inline_css(
array(
'background' => $content_bgcolor,
'color' => $content_textcolor,
)
);
$output .= '></div>';
$output .= '</div>'; // .w-popup-wrap
$output .= '</div>'; // .w-popup
echo $output;
@@ -0,0 +1,121 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Author element
*
* @var $link string Link type: 'post' / 'author' / 'custom' / 'none'
* @var $custom_link array
* @var $color string Custom color
* @var $icon string Icon name
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
if ( $us_elm_context == 'grid_term' ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
if ( $color_link ) {
$classes .= ' color_link_inherit';
}
$classes .= ' vcard author'; // needed for Google structured data
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$author_id = get_the_author_meta( 'ID' );
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
)
);
}
// Generate anchor semantics
$link_start_tag = $link_end_tag = '';
if ( $link === 'author_page' ) {
$link_atts = ' href="' . get_author_posts_url( $author_id, get_the_author_meta( 'user_nicename' ) ) . '"';
} elseif ( $link === 'author_website' ) {
$link_atts = ' href="' . get_the_author_meta('url') . '" target="_blank" rel="nofollow"';
} elseif ( $link === 'post' ) {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
} elseif ( $link === 'custom' ) {
$link_atts = us_generate_link_atts( $custom_link );
} else {
$link_atts = '';
}
if ( ! empty( $link_atts ) ) {
$link_start_tag = '<a class="fn"' . $link_atts . '>';
$link_end_tag = '</a>';
}
if ( $avatar ) {
$classes .= ' with_ava avapos_' . $avatar_pos;
}
// Output the element
$output = '<div class="w-post-elm post_author' . $classes . '"' . $inline_css . $el_id . '>';
$output .= us_prepare_icon_tag( $icon );
// Avatar
if ( $avatar ) {
$args = array(
'force_display' => TRUE, // always show avatar
);
$output .= $link_start_tag;
$output .= '<div class="post-author-ava"' . us_prepare_inline_css( array( 'font-size' => $avatar_width ) ) . '>';
$avatar_width = intval( $avatar_width );
$output .= get_avatar( $author_id, $avatar_width, NULL, '', $args );
$output .= '</div>';
$output .= $link_end_tag;
}
$output .= '<div class="post-author-meta">';
// Name
if ( ! empty( $link_atts ) ) {
$output .= '<a class="post-author-name fn"' . $link_atts . '>' . get_the_author() . '</a>';
} else {
$output .= '<div class="post-author-name">' . get_the_author() . '</div>';
}
if ( ! empty( $link_atts ) ) {
$output .= '</a>';
}
// Posts count
if ( $posts_count ) {
$author_posts_amount = count_user_posts( $author_id, 'post', TRUE );
$output .= '<div class="post-author-posts">';
$output .= sprintf( _n( '%s post', '%s posts', $author_posts_amount, 'us' ), $author_posts_amount );
$output .= '</div>';
}
// Website
if ( $website AND $website_url = get_the_author_meta( 'url' ) ) {
$output .= '<a class="post-author-website" href="' . $website_url . '" target="_blank" rel="nofollow">';
$output .= $website_url;
$output .= '</a>';
}
// Bio Info
if ( $info AND $info_text = get_the_author_meta( 'description' ) ) {
$output .= '<div class="post-author-info">' . $info_text . '</div>';
}
$output .= '</div>';
$output .= '</div>';
echo $output;
@@ -0,0 +1,107 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Comments
*/
if ( get_post_format() == 'link' OR ( is_admin() AND ( ! defined( 'DOING_AJAX' ) OR ! DOING_AJAX ) ) ) {
return;
}
// Exclude 'comments_template' layout for Grid context
if ( $us_elm_context != 'shortcode' ) {
$layout = 'amount';
}
$classes = isset( $classes ) ? $classes : '';
$classes .= ' layout_' . $layout;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
)
);
}
if ( $layout == 'amount' ) {
// Link
if ( $link === 'post' ) {
if ( get_post_type() == 'product' ) {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '#reviews"';
} else {
$link_atts = ' href="' . get_comments_link() . '"';
}
} elseif ( $link === 'custom' ) {
$link_atts = us_generate_link_atts( $custom_link );
} else {
$link_atts = '';
}
if ( $color_link ) {
$classes .= ' color_link_inherit';
}
// Define no comments indication
$comments_none = '0';
if ( ! $number ) {
$classes .= ' with_word';
$comments_none = us_translate( 'No Comments' );
}
$comments_number = get_comments_number();
// "Hide this element if no comments"
if ( $hide_zero AND empty( $comments_number ) ) {
return;
}
}
// Output the element
$output = '<div class="w-post-elm post_comments' . $classes . '"' . $inline_css . $el_id . '>';
if ( $layout == 'comments_template' ) {
wp_enqueue_script( 'comment-reply' );
ob_start();
comments_template();
$output .= ob_get_clean();
} else {
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
if ( ! empty( $link_atts ) ) {
$output .= '<a class="smooth-scroll"' . $link_atts . '>';
}
if ( class_exists( 'woocommerce' ) AND get_post_type() == 'product' ) {
$output .= sprintf( us_translate_n( '%s customer review', '%s customer reviews', $comments_number, 'woocommerce' ), '<span class="count">' . esc_html( $comments_number ) . '</span>' );
} else {
ob_start();
$comments_label = sprintf( us_translate_n( '%s <span class="screen-reader-text">Comment</span>', '%s <span class="screen-reader-text">Comments</span>', $comments_number ), $comments_number );
comments_number( $comments_none, $comments_label, $comments_label );
$output .= ob_get_clean();
}
if ( ! empty( $link_atts ) ) {
$output .= '</a>';
}
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,153 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Content element
*
* @var $type string Show: 'excerpt_only' / 'excerpt_content' / 'part_content' / 'full_content'
* @var $length int Amount of words
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
if ( get_post_format() == 'link' OR ( is_admin() AND ( ! defined( 'DOING_AJAX' ) OR ! DOING_AJAX ) ) ) {
return;
}
// Calculate amount of usage the element with full content to avoid infinite recursion
global $us_full_content_stack;
if ( isset( $us_full_content_stack ) AND $us_full_content_stack > 10 AND $type == 'full_content' ) {
die( '<h5 style="text-align:center; margin-top:20vh; padding:5%;">Post Content outputs itself infinitely. Fix layout of this page.</h5>' );
}
// Find Post Image element with media preview in Page Block
global $us_page_block_ids;
$strip_from_the_content = FALSE;
if ( ! empty( $us_page_block_ids ) ) {
$page_block = get_post( $us_page_block_ids[0] );
// Find Post Image element
if ( preg_match( '~\[us_post_image.+media_preview="1".+?\]~', $page_block->post_content ) ) {
$strip_from_the_content = TRUE;
}
}
us_add_to_page_block_ids( get_the_ID() );
if ( $type == 'full_content' ) {
$us_full_content_stack = ( empty( $us_full_content_stack ) ) ? 1 : $us_full_content_stack + 1;
}
$classes = isset( $classes ) ? $classes : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
)
);
}
// Default case
$the_content = '';
// Get term description as "Excerpt" for Grid terms
if ( $us_elm_context == 'grid_term' ) {
global $us_grid_term;
$the_content = $us_grid_term->description;
// Get term description as "Excerpt" for archive pages
} elseif ( $us_elm_context == 'shortcode' AND ( is_category() OR is_tag() OR is_tax() ) ) {
if ( $type == 'excerpt_only' ) { // for "Excerpt only" case
$the_content = term_description();
}
// Post excerpt is not empty
} elseif ( in_array( $type, array( 'excerpt_content', 'excerpt_only' ) ) AND has_excerpt() ) {
$the_content = apply_filters( 'the_excerpt', get_the_excerpt() );
// Either the excerpt is empty and we show the content instead or we show the content only
} elseif ( in_array( $type, array( 'excerpt_content', 'part_content', 'full_content' ) ) ) {
global $us_is_search_page_block;
if ( get_post_type() == 'attachment' ) {
$the_content = get_the_content();
} else {
// Get WooCommerce Shop Page content
if ( function_exists( 'is_shop' ) AND is_shop() ) {
if ( is_search() ) {
$the_content = '';
} else {
$shop_page = get_post( wc_get_page_id( 'shop' ) );
if ( $shop_page ) {
$the_content = $shop_page->post_content;
}
}
} elseif ( isset( $us_is_search_page_block ) AND $us_is_search_page_block AND $us_elm_context == 'shortcode' ) {
$us_page = get_post( us_get_option( 'search_page' ) );
if ( $us_page ) {
$us_page = get_post( apply_filters( 'wpml_object_id', $us_page->ID, 'page', TRUE ) );
$the_content = $us_page->post_content;
}
$us_is_search_page_block = FALSE;
} else {
$the_content = get_the_content();
}
// Force fullwidth for all [vc_row] if set
if ( $force_fullwidth_rows ) {
$the_content = str_replace( '[vc_row]', '[vc_row width="full"]', $the_content );
$the_content = str_replace( '[vc_row ', '[vc_row width="full" ', $the_content );
}
// Remove video, audio, gallery from the content for relevant post formats
us_get_post_preview( $the_content, $strip_from_the_content );
$the_content = apply_filters( 'the_content', $the_content );
// Limit the amount of words for the corresponding types
if ( in_array( $type, array( 'excerpt_content', 'part_content' ) ) AND intval( $length ) > 0 ) {
$the_content = wp_trim_words( $the_content, intval( $length ) );
}
}
}
// Schema.org markup
$schema_markup = '';
if ( us_get_option( 'schema_markup' ) AND $us_elm_context == 'shortcode' ) {
$schema_markup = ' itemprop="text"';
}
// Output the element
$output = '<div class="w-post-elm post_content' . $classes . '"' . $inline_css . $el_id . $schema_markup . '>';
$output .= $the_content;
$output .= '</div>';
if ( $type == 'full_content' ) {
$us_full_content_stack --;
}
us_remove_from_page_block_ids();
// Output empty string for "Link" post format OR when no content
// Do not remove to avoid bug https://github.com/upsolution/wp/issues/407
if ( $the_content == '' ) {
return;
} else {
echo $output;
}
@@ -0,0 +1,151 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Custom Field element
*
* @var $key string custom field key
* @var $link string Link type: 'post' / 'custom' / 'none'
* @var $custom_link array
* @var $type string 'text' / 'image'
* @var $thumbnail_size string Image WordPress size
* @var $icon string Icon name
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
$postID = get_the_ID();
if ( ! $postID ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
if ( $color_link ) {
$classes .= ' color_link_inherit';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$tag = 'div';
$type = 'text';
// Force "image" type for relevant meta keys
if ( $key == 'us_tile_additional_image' ) {
$type = 'image';
}
// Force "image" type for ACF images fields
if ( function_exists( 'acf_get_fields' ) ) {
$fields = acf_get_fields( '' ); // empty string to get all fields
foreach ( $fields as $field ) {
if ( $field['name'] == $key AND $field['type'] == 'image' ) {
$type = 'image';
}
}
}
$classes .= ' type_' . $type;
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
), TRUE, $tag
);
}
// Retrieve meta key value
if ( $key != 'custom' ) {
$value = get_post_meta( $postID, $key, TRUE );
} elseif ( ! empty( $custom_key ) ) {
$value = get_post_meta( $postID, $custom_key, TRUE );
} else {
$value = '';
}
// Don't output the element, when its value is empty
if ( ( $hide_empty AND $value == '' ) OR is_object( $value ) ) {
return;
}
// Generate image semantics
if ( $type == 'image' ) {
$value = intval( $value );
if ( $value ) {
global $us_grid_img_size;
if ( ! empty( $us_grid_img_size ) AND $us_grid_img_size != 'default' ) {
$thumbnail_size = $us_grid_img_size;
}
$image = wp_get_attachment_image_src( $value, $thumbnail_size );
if ( is_array( $image ) ) {
$value = us_get_attachment_image( $value, $thumbnail_size );
} else {
return;
}
} else {
return;
}
} elseif ( is_array( $value ) ) {
$value = implode( ' ', $value );
} else {
$value = wpautop( $value ); // add <p> and <br> if custom field has WYSIWYG
}
// Link
if ( $link === 'post' ) {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
} elseif ( $link === 'custom' ) {
$link_atts = us_generate_link_atts( $custom_link );
} else {
$link_atts = '';
}
// Generate semantics for Testimonial Rating
if ( $key == 'us_testimonial_rating' ) {
$rating_value = (int) strip_tags( $value );
if ( $rating_value == 0 ) {
return;
} else {
$value = '<div class="w-testimonial-rating">';
for ( $i = 1; $i <= $rating_value; $i ++ ) {
$value .= '<i></i>';
}
$value .= '</div>';
}
}
$text_before = ( trim( $text_before ) != '' ) ? '<span class="w-post-elm-before">' . trim( $text_before ) . ' </span>' : '';
// Output the element
$output = '<' . $tag . ' class="w-post-elm post_custom_field' . $classes . '"' . $inline_css . $el_id . '>';
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= $text_before;
if ( ! empty( $link_atts ) ) {
$output .= '<a' . $link_atts . '>';
}
$output .= $value;
if ( ! empty( $link_atts ) ) {
$output .= '</a>';
}
$output .= '</' . $tag . '>';
echo $output;
@@ -0,0 +1,107 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Date element
*
* @var $type string Date type: 'published' / 'modified'
* @var $format string Date format selected from preset
* @var $format_custom string Date custom format
* @var $icon string Icon name
* @var $tag string 'h1' / 'h2' / 'h3' / 'h4' / 'h5' / 'h6' / 'p' / 'div'
* @var $color string Custom color
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
if ( $us_elm_context == 'grid_term' ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
// Classes for Google structured data
$classes .= ' entry-date';
if ( $type == 'modified' ) {
$classes .= ' updated';
} else {
$classes .= ' published';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$tag = 'time';
$elm_attr = '';
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
),
$style_attr = TRUE,
$tag
);
}
$smart_date = FALSE;
// Generate date format
if ( $format == 'default' ) {
$format = get_option( 'date_format' );
} elseif ( $format == 'custom' ) {
$format = $format_custom;
} elseif ( $format == 'smart' ) {
$format = 'U';
$smart_date = TRUE;
}
if ( $type == 'modified' ) {
$date = get_the_modified_date( $format );
$elm_attr .= ' datetime="' . get_the_modified_date( 'c' ) . '"'; // needed datetime attribute for <time> tag
if ( $smart_date ) {
$elm_attr .= ' title="' . sprintf( us_translate( '%1$s at %2$s' ), get_the_modified_date( 'j F Y' ), get_the_modified_date( 'H:i:s e' ) ) . '"';
}
} else {
$date = get_the_date( $format );
$elm_attr .= ' datetime="' . get_the_date( 'c' ) . '"'; // needed datetime attribute for <time> tag
if ( $smart_date ) {
$elm_attr .= ' title="' . sprintf( us_translate( '%1$s at %2$s' ), get_the_date( 'j F Y' ), get_the_date( 'H:i:s e' ) ) . '"';
}
}
// Generate date in smart format
if ( $smart_date ) {
$date = us_get_smart_date( $date );
}
// Schema.org markup
if ( us_get_option( 'schema_markup' ) AND $us_elm_context == 'shortcode' ) {
$elm_attr .= ( $type == 'modified' ) ? ' itemprop="dateModified"' : ' itemprop="datePublished"';
}
$text_before = ( trim( $text_before ) != '' ) ? '<span class="w-post-elm-before">' . trim( $text_before ) . ' </span>' : '';
// Output the element
$output = '<' . $tag . ' class="w-post-elm post_date' . $classes . '"';
$output .= $inline_css . $el_id . $elm_attr;
$output .= '>';
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= $text_before;
$output .= $date;
$output .= '</' . $tag . '>';
echo $output;
@@ -0,0 +1,145 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Image element
*
* @var $thumbnail_size string Image WordPress size
* @var $placeholder bool Use placeholder if post has no thumbnail?
* @var $media_preview bool Show media preview for video and gallery posts?
* @var $link string Link type: 'post' / 'custom' / 'none'
* @var $custom_link array
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
if ( is_admin() AND ( ! defined( 'DOING_AJAX' ) OR ! DOING_AJAX ) ) {
return;
}
global $us_grid_img_size, $_wp_additional_image_sizes, $us_post_img_ratio, $us_post_slider_size;
$classes = isset( $classes ) ? $classes : '';
$classes .= ( isset( $circle ) AND $circle ) ? ' as_circle' : '';
$classes .= ( isset( $stretch ) AND $stretch ) ? ' stretched' : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Overwrite thumbnail_size from [us_grid] shortcode if set
if ( ! empty( $us_grid_img_size ) AND $us_grid_img_size != 'default' ) {
$thumbnail_size = $us_grid_img_size;
}
// Calculate aspect ratio for media preview and for placeholder
if ( isset( $_wp_additional_image_sizes[ $thumbnail_size ] ) AND $_wp_additional_image_sizes[ $thumbnail_size ]['width'] != 0 AND $_wp_additional_image_sizes[ $thumbnail_size ]['height'] != 0 ) {
$us_post_img_ratio = number_format( $_wp_additional_image_sizes[ $thumbnail_size ]['height'] / $_wp_additional_image_sizes[ $thumbnail_size ]['width'] * 100, 4 );
}
// Link
if ( $link === 'post' ) {
// Terms of selected taxonomy in Grid
if ( $us_elm_context == 'grid_term' ) {
global $us_grid_term;
$link_atts = ' href="' . get_term_link( $us_grid_term ) . '"';
} else {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
}
} elseif ( $link === 'custom' ) {
$link_atts = us_generate_link_atts( $custom_link );
} else {
$link_atts = '';
}
$_post_preview = '';
// Output image of taxonomy term (works for WooCommerce product categories)
if ( $us_elm_context == 'grid_term' ) {
global $us_grid_term;
$term_thumbnail_id = get_term_meta( $us_grid_term->term_id, 'thumbnail_id', TRUE );
if ( $term_thumbnail_id ) {
$_post_preview = wp_get_attachment_image( $term_thumbnail_id, $thumbnail_size );
}
}
// Generate media preview
if ( $_post_preview == '' AND $media_preview AND ! post_password_required() ) {
if ( get_post_type() == 'product' ) { // for products with gallery
$postID = get_the_ID();
$product_images = get_post_meta( $postID, '_product_image_gallery', TRUE );
if ( $product_images ) {
$slider_shortcode = '[us_image_slider ids="' . get_post_thumbnail_id() . ',' . $product_images . '" img_size="' . $thumbnail_size . '" arrows="hover"]';
$_post_preview = do_shortcode( $slider_shortcode );
}
} else { // for posts with Video, Audio, Gallery formats
$us_post_slider_size = $thumbnail_size;
$the_content = get_the_content();
$_post_preview = us_get_post_preview( $the_content );
}
if ( $_post_preview != '' ) {
$classes .= ' media_preview'; // add CSS class for media preview
$link_atts = ''; // remove link for media preview
}
}
// Output image of attachment post type
if ( $_post_preview == '' AND get_post_type() == 'attachment' ) {
$_post_preview = wp_get_attachment_image( get_the_ID(), $thumbnail_size );
}
// Output Featured image
if ( $_post_preview == '' AND has_post_thumbnail() ) {
$_post_preview = get_the_post_thumbnail( get_the_ID(), $thumbnail_size );
}
// Output the first image from the content of Gallery format
if ( $_post_preview == '' AND get_post_format() == 'gallery' ) {
$the_content = get_the_content();
if ( preg_match( '~\[us_gallery.+?\]|\[us_image_slider.+?\]|\[gallery.+?\]~', $the_content, $matches ) ) {
$gallery = preg_replace( '~(vc_gallery|us_gallery|gallery)~', 'us_image_slider', $matches[0] );
preg_match( '~\[us_image_slider(.+?)\]~', $gallery, $matches2 );
$shortcode_atts = shortcode_parse_atts( $matches2[1] );
if ( ! empty( $shortcode_atts['ids'] ) ) {
$ids = explode( ',', $shortcode_atts['ids'] );
if ( count( $ids ) > 0 ) {
$_post_preview = wp_get_attachment_image( $ids[0], $thumbnail_size );
}
}
}
}
// Output placeholder if enabled
if ( $_post_preview == '' AND $placeholder ) {
$classes .= ' with_placeholder';
// Use WooCommerce placeholder if enabled
if ( ( $us_elm_context == 'grid_term' OR get_post_type() == 'product' ) AND function_exists( 'wc_placeholder_img_src' ) ) {
$_post_preview = '<img src="' . wc_placeholder_img_src( $thumbnail_size ) . '" alt=""/>';
} else {
$_post_preview = '<div class="w-post-elm-placeholder" style="padding-bottom:' . ( empty( $us_post_img_ratio ) ? 100 : $us_post_img_ratio ) . '%;"></div>';
}
}
// Don't output the element without any content
if ( $_post_preview == '' ) {
return;
}
$output = '<div class="w-post-elm post_image' . $classes . '"' . $el_id . '>';
if ( ! empty( $link_atts ) ) {
$output .= '<a' . $link_atts . ' aria-label="' . esc_attr( get_the_title() ) . '">';
}
$output .= $_post_preview;
if ( ! empty( $link_atts ) ) {
$output .= '</a>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,52 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Prev/Next navigation
*/
$prevnext = us_get_post_prevnext( $invert, $in_same_term, $taxonomy );
if ( empty( $prevnext ) ) {
return;
}
$classes = ' layout_' . $layout;
$classes .= ( $invert ) ? ' inv_true' : ' inv_false';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Output the element
$output = '<div class="w-post-elm post_navigation' . $classes . '"' . $el_id . '>';
$item_order = 'first';
foreach ( $prevnext as $key => $item ) {
if ( ! empty( $prevnext[ $key ] ) ) {
$tnail_id = get_post_thumbnail_id( $item['id'] );
if ( $tnail_id ) {
$image = wp_get_attachment_image( $tnail_id, 'thumbnail' );
}
if ( ! $tnail_id OR empty( $image ) ) {
$image = '<div class="g-placeholder"></div>';
}
$output .= '<a class="post_navigation-item order_' . $item_order . ' to_' . $key . '" href="' . $item['link'] . '">';
if ( $layout == 'sided' ) {
$output .= '<div class="post_navigation-item-img">' . $image . '</div>';
}
$output .= '<div class="post_navigation-item-arrow"></div>';
if ( $layout == 'simple' ) {
$output .= '<div class="post_navigation-item-meta">' . $item['meta'] . '</div>';
}
$output .= '<div class="post_navigation-item-title"><span>' . $item['title'] . '</span></div>';
$output .= '</a>';
} else {
$output .= '<div class="post_navigation-item order_' . $item_order . ' to_' . $key . '"></div>';
}
$item_order = 'second';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,104 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Taxonomy element
*
* @var $taxonomy_name string Taxonomy name
* @var $link string Link type: 'post' / 'archive' / 'custom' / 'none'
* @var $custom_link array
* @var $color string Custom color
* @var $icon string Icon name
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
if ( empty( $taxonomy_name ) OR ! taxonomy_exists( $taxonomy_name ) OR ! is_object_in_taxonomy( get_post_type(), $taxonomy_name ) ) {
return FALSE;
}
$terms = get_the_terms( get_the_ID(), $taxonomy_name );
if ( ! is_array( $terms ) OR count( $terms ) == 0 ) {
return FALSE;
}
$classes = isset( $classes ) ? $classes : '';
$classes .= ' style_' . $style;
if ( $color_link ) {
$classes .= ' color_link_inherit';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
)
);
}
// Link
if ( $link === 'post' ) {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
} elseif ( $link === 'custom' ) {
$link_atts = us_generate_link_atts( $custom_link );
} else {
$link_atts = '';
}
$text_before = ( trim( $text_before ) != '' ) ? '<span class="w-post-elm-before">' . trim( $text_before ) . ' </span>' : '';
// Set Button Style class
$btn_classes = '';
if ( $style == 'badge' ) {
$btn_classes = ' class="w-btn us-btn-style_' . $btn_style . '"';
}
// Output the element
$output = '<div class="w-post-elm post_taxonomy' . $classes . '"' . $inline_css . $el_id . '>';
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= $text_before;
if ( $style == 'badge' AND count( $terms ) > 1 ) {
$output .= '<div class="w-post-elm-list">';
}
$i = 1;
foreach ( $terms as $term ) {
if ( $link === 'archive' ) {
$link_atts = ' href="' . get_term_link( $term ) . '"';
// Output "rel" attribute for Posts tags
if ( $taxonomy_name == 'post_tag' ) {
$link_atts .= ' rel="tag"';
}
}
if ( ! empty( $link_atts ) ) {
$output .= '<a' . $btn_classes . $link_atts . '>' . $term->name . '</a>';
} else {
$output .= '<span' . $btn_classes . '>' . $term->name . '</span>';
}
// Output comma after anchor except the last one
if ( $style != 'badge' AND $i != count( $terms ) ) {
$output .= $separator;
}
$i++;
}
if ( $style == 'badge' AND count( $terms ) > 1 ) {
$output .= '</div>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,100 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Post Title element
*
* @var $link string Link type: 'post' / 'custom' / 'none'
* @var $custom_link array
* @var $tag string 'h1' / 'h2' / 'h3' / 'h4' / 'h5' / 'h6' / 'p' / 'div'
* @var $color string Custom color
* @var $icon string Icon name
* @var $design_options array
*
* @var $classes string
* @var $id string
*/
$classes = isset( $classes ) ? $classes : '';
if ( $align != 'none' ) {
$classes .= ' align_' . $align;
}
if ( $us_elm_context == 'grid' AND get_post_type() == 'product' ) {
$classes .= ' woocommerce-loop-product__title'; // needed for adding to cart
} else {
$classes .= ' entry-title'; // needed for Google structured data
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
), TRUE, $tag
);
}
// Link
if ( $link === 'post' ) {
// Terms of selected taxonomy in Grid
if ( $us_elm_context == 'grid_term' ) {
global $us_grid_term;
$link_atts = ' href="' . get_term_link( $us_grid_term ) . '"';
} else {
$link_atts = ' href="' . apply_filters( 'the_permalink', get_permalink() ) . '"';
// Force opening in a new tab for "Link" post format
if ( get_post_format() == 'link' ) {
$link_atts .= ' target="_blank"';
}
}
} elseif ( $link === 'custom' ) {
$link_atts = us_generate_link_atts( $custom_link );
} else {
$link_atts = '';
}
// Extra class for link color
if ( ! empty( $link_atts ) AND $color_link ) {
$classes .= ' color_link_inherit';
}
// Schema.org markup
$schema_markup = '';
if ( us_get_option( 'schema_markup' ) AND $us_elm_context == 'shortcode' ) {
$schema_markup = ' itemprop="headline"';
}
// Output the element
$output = '<' . $tag . ' class="w-post-elm post_title' . $classes . '"' . $inline_css . $el_id . $schema_markup . '>';
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
if ( ! empty( $link_atts ) ) {
$output .= '<a' . $link_atts . '>';
}
if ( $us_elm_context == 'grid_term' ) {
global $us_grid_term;
$output .= $us_grid_term->name;
} else {
$output .= get_the_title();
}
if ( ! empty( $link_atts ) ) {
$output .= '</a>';
}
$output .= '</' . $tag . '>';
echo $output;
@@ -0,0 +1,115 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_pricing
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $style string Table style: '1' / '2'
* @param $items string Pricing table items
* @param $el_class string Extra class name
*/
$classes = $items_html = '';
if ( empty( $items ) ) {
$items = array();
} else {
$items = json_decode( urldecode( $items ), TRUE );
if ( ! is_array( $items ) ) {
$items = array();
}
}
if ( ! empty( $style ) ) {
$classes .= ' style_' . $style;
}
if ( count( $items ) > 0 ) {
$classes .= ' items_' . count( $items );
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
foreach ( $items as $index => $item ) {
/**
* Filtering the included items
*
* @param $item ['title'] string Item title
* @param $item ['type'] string Item type: 'default' / 'featured'
* @param $item ['price'] string Item price
* @param $item ['substring'] string Price substring
* @param $item ['features'] string Comma-separated list of features
* @param $item ['btn_text'] string Button label
* @param $item ['btn_link'] string Button link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
* @param $item ['btn_style'] string Button Style
* @param $item ['btn_size'] string Button size
* @param $item ['btn_icon'] string Button icon
* @param $item ['btn_iconpos'] string Icon position: 'left' / 'right'
*/
$item['type'] = ( isset( $item['type'] ) AND $item['type'] ) ? 'featured' : 'default';
$item['btn_icon'] = ( isset( $item['btn_icon'] ) ) ? $item['btn_icon'] : '';
$item['btn_link'] = ( isset( $item['btn_link'] ) ) ? $item['btn_link'] : '';
$item['btn_iconpos'] = ( isset( $item['btn_iconpos'] ) ) ? $item['btn_iconpos'] : 'left';
$items_html .= '<div class="w-pricing-item type_' . $item['type'] . '"><div class="w-pricing-item-h"><div class="w-pricing-item-header">';
if ( ! empty( $item['title'] ) ) {
$items_html .= '<div class="w-pricing-item-title">' . $item['title'] . '</div>';
}
$items_html .= '<div class="w-pricing-item-price">';
if ( ! empty( $item['price'] ) ) {
$items_html .= $item['price'];
}
if ( ! empty( $item['substring'] ) ) {
$items_html .= '<small>' . $item['substring'] . '</small>';
}
$items_html .= '</div></div>';
if ( ! empty( $item['features'] ) ) {
$items_html .= '<ul class="w-pricing-item-features">';
$features = explode( "\n", trim( $item['features'] ) );
foreach ( $features as $feature ) {
$items_html .= '<li class="w-pricing-item-feature">' . $feature . '</li>';
}
$items_html .= '</ul>';
}
if ( ! empty( $item['btn_text'] ) ) {
$btn_classes = $icon_html = '';
$btn_classes .= ' us-btn-style_' . $item['btn_style'];
if ( ! isset( $item['btn_size'] ) OR trim( $item['btn_size'] ) == ( us_get_option( 'body_fontsize' ) ) ) {
$item['btn_size'] = '';
}
$btn_inline_css = us_prepare_inline_css(
array(
'font-size' => $item['btn_size'],
)
);
if ( ! empty( $item['btn_icon'] ) ) {
$icon_html = us_prepare_icon_tag( $item['btn_icon'] );
$btn_classes .= ' icon_at' . $item['btn_iconpos'];
}
$btn_link_atts = us_generate_link_atts( $item['btn_link'] );
$items_html .= '<div class="w-pricing-item-footer">';
$items_html .= '<a class="w-btn' . $btn_classes . '"' . $btn_link_atts . $btn_inline_css . '>';
$items_html .= ( $item['btn_iconpos'] == 'left' ) ? $icon_html : '';
$items_html .= '<span class="w-btn-label">' . strip_tags( $item['btn_text'], '<br>' ) . '</span>';
$items_html .= ( $item['btn_iconpos'] == 'right' ) ? $icon_html : '';
$items_html .= '</a>';
$items_html .= '</div>';
}
$items_html .= '</div></div>';
}
// Output the element
$output = '<div class="w-pricing' . $classes . '"' . $el_id . '>' . $items_html . '</div>';
echo $output;
@@ -0,0 +1,67 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* WooCommerce Product data
*/
global $product;
if ( ! class_exists( 'woocommerce' ) OR ! $product OR $us_elm_context == 'grid_term' ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
$classes .= isset( $type ) ? ( ' ' . $type ) : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Get product data value
$value = '';
if ( $type == 'price' ) {
$value .= $product->get_price_html();
} elseif ( $type == 'sku' AND $product->get_sku() ) {
$value .= '<span class="w-post-elm-before">' . us_translate( 'SKU', 'woocommerce' ) . ': </span>';
$value .= $product->get_sku();
} elseif ( $type == 'rating' AND get_option( 'woocommerce_enable_reviews', 'yes' ) === 'yes' ) {
$value .= wc_get_rating_html( $product->get_average_rating() );
} elseif ( $type == 'sale_badge' AND $product->is_on_sale() ) {
$classes .= ' onsale';
$value .= strip_tags( $sale_text );
} elseif ( $type == 'weight' AND $product->has_weight() ) {
$value .= '<span class="w-post-elm-before">' . us_translate( 'Weight', 'woocommerce' ) . ': </span>';
$value .= esc_html( wc_format_weight( $product->get_weight() ) );
} elseif ( $type == 'dimensions' AND $product->has_dimensions() ) {
$value .= '<span class="w-post-elm-before">' . us_translate( 'Dimensions', 'woocommerce' ) . ': </span>';
$value .= esc_html( wc_format_dimensions( $product->get_dimensions( FALSE ) ) );
} elseif ( $product_attribute_values = wc_get_product_terms( $product->get_id(), $type, array( 'fields' => 'names' ) ) ) {
$value .= '<span class="w-post-elm-before">' . wc_attribute_label( $type ) . ': </span>';
$value .= implode( ', ', $product_attribute_values );
}
// Prepare inline CSS for shortcode
$inline_css = '';
if ( $us_elm_context == 'shortcode' ) {
$inline_css .= us_prepare_inline_css(
array(
'font-family' => $font,
'font-weight' => $font_weight,
'text-transform' => $text_transform,
'font-style' => $font_style,
'font-size' => $font_size,
'line-height' => $line_height,
), TRUE
);
}
// Output the element
$output = '<div class="w-post-elm product_field' . $classes . '"';
$output .= $el_id . $inline_css;
$output .= '>';
$output .= $value;
$output .= '</div>';
if ( $value != '' ) {
echo $output;
}
@@ -0,0 +1,24 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* WooCommerce Product gallery
*
* $type
*
*/
global $product;
if ( ! class_exists( 'woocommerce' ) OR ! $product ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Output the element
echo '<div class="w-post-elm product_gallery' . $classes . '"' . $el_id . '>';
wc_get_template( 'single-product/product-image.php' );
echo '</div>';
@@ -0,0 +1,25 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* WooCommerce Product ordering
*
* $type
*
*/
if ( ! class_exists( 'woocommerce' ) ) {
return;
}
$classes = isset( $classes ) ? $classes : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) AND $us_elm_context == 'shortcode' ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Output the element
echo '<div class="w-post-elm product_ordering' . $classes . '"' . $el_id . '>';
if ( function_exists( 'woocommerce_catalog_ordering' ) ) {
woocommerce_catalog_ordering();
}
echo '</div>';
@@ -0,0 +1,72 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_separator
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $title string Progress Bar title
* @param $count int Progress Bar length in percents: '0' - '100'
* @param $style string Style: '1' / '2' / '3' / '4' / '5'
* @param $size string Height
* @param $color string Color style: 'primary' / 'secondary' / 'heading' / 'text' / 'custom'
* @param $bar_color string
* @param $hide_count bool Hide progress value counter?
*/
$classes = '';
$classes .= ' style_' . $style;
$classes .= ' color_' . $color;
if ( $hide_count ) {
$classes .= ' hide_count';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
if ( $title != '' ) {
$title_tag = '<span class="w-progbar-title-text">' . $title . '</span>';
} else {
$title_tag = '';
$classes .= ' title_none';
}
$count = max( 0, min( 100, $count ) );
$bar_inline_css = us_prepare_inline_css(
array(
'height' => $size,
'width' => $count . '%',
'background' => $bar_color,
)
);
// Output the element
$output = '<div class="w-progbar' . $classes . ' initial"' . $el_id . ' data-count="' . $count . '">';
$output .= '<h6 class="w-progbar-title">';
$output .= $title_tag;
$output .= '<span class="w-progbar-title-count">' . $count . '%</span>';
$output .= '</h6>';
$output .= '<div class="w-progbar-bar"><div class="w-progbar-bar-h"' . $bar_inline_css . '>';
$output .= '<span class="w-progbar-bar-count">' . $count . '%</span>';
$output .= '</div></div></div>';
// If we are in front end editor mode, apply JS to logos
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$output .= '<script>
jQuery(function($){
if (typeof $.fn.wProgbar === "function") {
jQuery(".w-progbar").wProgbar();
}
});
</script>';
}
echo $output;
@@ -0,0 +1,54 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_scroller
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $speed string Scroll Speed
* @param $dots bool Show navigation dots?
* @param $dots_pos string Dots Position
* @param $dots_size string Dots Size
* @param $dots_color string Dots color value
* @param $disable_width string Dots color value
* @param $el_class string Extra class name
*/
$classes = $data_atts = '';
$classes .= ' style_' . $dots_style . ' pos_' . $dots_pos;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
if ( $speed != '' ) {
$data_atts = ' data-speed="' . $speed . '"';
}
if ( $disable_width != '' ) {
$data_atts .= ' data-disablewidth="' . intval( $disable_width ) . '"';
}
$dot_inline_css = us_prepare_inline_css(
array(
'font-size' => $dots_size,
'box-shadow' => empty( $dots_color ) ? '' : '0 0 0 2px ' . $dots_color,
'background' => $dots_color,
)
);
// Output the element
$output = '<div class="w-scroller' . $classes . '"' . $el_id . $data_atts . ' aria-hidden="true">';
if ( $dots ) {
$output .= '<div class="w-scroller-dots">';
$output .= '<a href="javascript:void(0);" class="w-scroller-dot"><span' . $dot_inline_css . '></span></a>';
$output .= '</div>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,50 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output search element
*
* @var $text string Placeholder Text
* @var $layout string Layout: 'simple' / 'modern' / 'fulwidth' / 'fullscreen'
* @var $width int Field width
* @var $design_options array
* @var $product_search bool Whether to search for WooCommerce products only
* @var $classes string
* @var $id string
*/
$classes = isset( $classes ) ? $classes : '';
$classes .= ' layout_' . $layout;
$output = '<div class="w-search' . $classes . '">';
if ( $layout == 'fullscreen' ) {
$output .= '<div class="w-search-background"></div>';
}
$output .= '<a class="w-search-open" href="javascript:void(0);" aria-label="' . us_translate( 'Search' ) . '">';
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= '</a>';
$output .= '<div class="w-search-form">';
$output .= '<form class="w-search-form-h" autocomplete="off" action="' . esc_attr( home_url( '/' ) ) . '" method="get">';
$output .= '<div class="w-search-form-field">';
$output .= '<input type="text" name="s" id="us_form_search_s" placeholder="' . esc_attr( $text ) . '" aria-label="' . esc_attr( $text ) . '"/>';
if ( ! empty( $product_search ) AND $product_search ) {
$output .= '<input type="hidden" name="post_type" value="product" />';
}
$output .= '<span class="w-form-row-field-bar"></span>';
$output .= '</div>';
if ( $layout == 'simple' ) {
$output .= '<button class="w-search-form-btn" type="submit" aria-label="' . us_translate( 'Search' ) . '">';
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= '</button>';
}
// Language code
if ( defined( 'ICL_LANGUAGE_CODE' ) AND ICL_LANGUAGE_CODE != '' ) {
$output .= '<input type="hidden" name="lang" value="' . esc_attr( ICL_LANGUAGE_CODE ) . '" />';
}
$output .= '<a class="w-search-close" href="javascript:void(0);" aria-label="' . us_translate( 'Close' ) . '"></a>';
$output .= '</form></div></div>';
echo $output;
@@ -0,0 +1,113 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_separator
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $size string Separator Height: 'small' / 'medium' / 'large' / 'huge' / 'custom'
* @param $height string Separator custom height
* @param $show_line bool Show the line in the middle?
* @param $line_width string Separator type: 'default' / 'fullwidth' / 'short'
* @param $thick string Line thickness: '1' / '2' / '3' / '4' / '5'
* @param $style string Line style: 'solid' / 'dashed' / 'dotted' / 'double'
* @param $color string Color style: 'border' / 'primary' / 'secondary' / 'custom'
* @param $bdcolor string Border color value
* @param $icon string Icon
* @param $text string Title
* @param $title_tag string Title HTML tag: 'h1' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'div'
* @param $title_size string Font Size
* @param $align string Alignment
* @param $link string Link in a serialized format: 'url:http%3A%2F%2Fwordpress.org|title:WP%20Website|target:_blank|rel:nofollow'
* @param $el_class string Extra class name
* @param $breakpoint_1_width string Screen Width breakpoint 1
* @param $breakpoint_1_height string Separator custom height 1
* @param $breakpoint_2_width string Screen Width breakpoint 2
* @param $breakpoint_2_height string Separator custom height 2
*/
$classes = $inner_html = $inline_css = $link_opener = $link_closer = $responsive_styles = '';
// Set element index to apply <style> for responsive CSS
if ( $size == 'custom' AND $breakpoint_1_height != '' OR $breakpoint_2_height != '' ) {
global $us_separator_index;
$us_separator_index = isset( $us_separator_index ) ? ( $us_separator_index + 1 ) : 1;
$classes .= ' us_separator_' . $us_separator_index;
$responsive_styles = '<style>';
if ( $breakpoint_1_height != '' AND $breakpoint_1_height != $height ) {
$responsive_styles .= '@media(max-width:' . esc_attr( $breakpoint_1_width ) . '){.us_separator_' . $us_separator_index . '{height:' . esc_attr( $breakpoint_1_height ) . '!important}}';
}
if ( $breakpoint_2_height != '' AND $breakpoint_2_height != $height ) {
$responsive_styles .= '@media(max-width:' . esc_attr( $breakpoint_2_width ) . '){.us_separator_' . $us_separator_index . '{height:' . esc_attr( $breakpoint_2_height ) . '!important}}';
}
$responsive_styles .= '</style>';
}
$classes .= ' size_' . $size;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Link
$link_atts = us_generate_link_atts( $link );
if ( ! empty( $link_atts ) ) {
$link_opener = '<a' . $link_atts . '>';
$link_closer = '</a>';
}
// Generate separator icon and title
if ( $show_line ) {
$classes .= ' with_line';
$classes .= ' width_' . $line_width;
$classes .= ' thick_' . $thick;
$classes .= ' style_' . $style;
$classes .= ' color_' . $color;
$classes .= ' align_' . $align;
if ( ! empty( $text ) ) {
$inner_html .= '<' . $title_tag . ' class="w-separator-text">';
$inner_html .= $link_opener;
$inner_html .= us_prepare_icon_tag( $icon );
$inner_html .= '<span>' . strip_tags( $text, '<br><strong>' ) . '</span>';
$inner_html .= $link_closer;
$inner_html .= '</' . $title_tag . '>';
} else {
$inner_html .= us_prepare_icon_tag( $icon );
}
if ( $inner_html != '' ) {
$classes .= ' with_content';
}
$inline_css = us_prepare_inline_css(
array(
'height' => $height,
'border-color' => $bdcolor,
'color' => $bdcolor,
'font-size' => $title_size,
)
);
} else {
$inline_css = us_prepare_inline_css(
array(
'height' => $height,
)
);
}
// Output the element
$output = '<div class="w-separator' . $classes . '"' . $el_id . $inline_css . '>';
$output .= $responsive_styles;
if ( $show_line ) {
$output .= '<div class="w-separator-h">' . $inner_html . '</div>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,129 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_sharing
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @param $type string Type: 'simple' / 'solid' / 'outlined' / 'fixed'
* @param $align string Alignment: 'left' / 'center' / 'right'
* @param $color string Color Style: 'default' / 'primary' / 'secondary'
* @param $counters string Share Counters: 'show' / 'hide'
* @param $email bool Is Email button available?
* @param $facebook bool Is Facebook button available?
* @param $twitter bool Is Twitter button available?
* @param $gplus bool Is Google button available?
* @param $linkedin bool Is LinkedIn button available?
* @param $pinterest bool Is Pinterest button available?
* @param $vk bool Is VK button available?
* @param $url string Sharing URL
* @param $el_class string Extra class name
*/
$classes = ' type_' . $type . ' align_' . $align . ' color_' . $color;
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$inline_css = us_prepare_inline_css(
array(
'font-size' => ( trim( $font_size ) == us_get_option( 'body_fontsize' ) ) ? '' : $font_size,
)
);
// The list of available sharing providers and additional in-shortcode data
$providers_list = array(
'email' => array(
'title' => __( 'Email this', 'us' ),
),
'facebook' => array(
'title' => __( 'Share this', 'us' ),
),
'twitter' => array(
'title' => __( 'Tweet this', 'us' ),
),
'linkedin' => array(
'title' => __( 'Share this', 'us' ),
),
'pinterest' => array(
'title' => __( 'Pin this', 'us' ),
),
'vk' => array(
'title' => __( 'Share this', 'us' ),
),
'whatsapp' => array(
'title' => __( 'Share this', 'us' ),
),
'xing' => array(
'title' => __( 'Share this', 'us' ),
),
'reddit' => array(
'title' => __( 'Share this', 'us' ),
),
);
$set_providers = explode( ',', $providers );
// Keeping only the actually used providers
foreach ( $providers_list as $provider => $provider_data ) {
if ( ! in_array( $provider, $set_providers ) ) {
unset( $providers_list[ $provider ] );
}
}
if ( empty( $providers_list ) ) {
return;
}
if ( empty( $url ) ) {
// Using the current page URL
$url = home_url( $_SERVER['REQUEST_URI'] );
$url = str_replace( '?us_iframe=1', '', $url );
}
if ( $counters == 'show' ) {
$counts = us_get_sharing_counts( $url, array_keys( $providers_list ) );
}
$post_thumbnail = get_the_post_thumbnail_url( NULL, 'large' );
$post_thumbnail = ( $post_thumbnail ) ? $post_thumbnail : '';
// Output the element
$output = '<div class="w-sharing' . $classes . '"' . $el_id . $inline_css . '>';
$output .= '<div class="w-sharing-list" data-sharing-url="' . esc_attr( $url ) . '" data-sharing-image="' . esc_attr( $post_thumbnail ) . '">';
$sharing_list = '';
foreach ( $providers_list as $provider => $provider_data ) {
$sharing_list .= '<a class="w-sharing-item ' . $provider . '" href="javascript:void(0)"';
$sharing_list .= ' title="' . esc_attr( $provider_data['title'] ) . '"';
$sharing_list .= ' aria-label="' . esc_attr( $provider_data['title'] ) . '"';
$sharing_list .= '>';
$sharing_list .= '<span class="w-sharing-icon"></span>';
if ( $counters == 'show' AND isset( $counts[ $provider ] ) AND $counts[ $provider ] != 0 ) {
$sharing_list .= '<span class="w-sharing-count">' . $counts[ $provider ] . '</span>';
}
$sharing_list .= '</a>';
}
$output .= $sharing_list;
$output .= '</div>';
if ( $text_selection ) {
$sharing_area = ( $text_selection_post ) ? 'post_content' : 'l-main';
$output .= '<div class="w-sharing-tooltip" style="display: none" data-sharing-area="' . $sharing_area . '">';
$output .= '<div class="w-sharing-list" data-sharing-url="' . esc_attr( $url ) . '" data-sharing-image="' . esc_attr( $post_thumbnail ) . '">';
$output .= $sharing_list;
$output .= '<a class="w-sharing-item copy2clipboard" href="javascript:void(0)"';
$output .= ' title="' . us_translate( 'Copy' ) . '"';
$output .= ' aria-label="' . us_translate( 'Copy' ) . '"';
$output .= '>';
$output .= '<span class="w-sharing-icon"></span></a>';
$output .= '</div></div>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,109 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output Social Links element
*/
$classes = isset( $classes ) ? $classes : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
$list_inline_css = $item_inline_css = '';
$classes .= ' style_' . $style;
$classes .= ' hover_' . $hover;
$classes .= ' color_' . $color;
$classes .= ' shape_' . $shape;
if ( isset( $us_elm_context ) AND $us_elm_context == 'shortcode' ) {
$classes .= ' align_' . $align;
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$list_inline_css = us_prepare_inline_css(
array(
'font-size' => $size,
'margin' => '-' . $gap,
)
);
$item_inline_css = us_prepare_inline_css(
array(
'padding' => $gap,
)
);
}
// Output the element
$output = '<div class="w-socials' . $classes . '"' . $el_id . '>';
$output .= '<div class="w-socials-list"' . $list_inline_css . '>';
$social_links = us_config( 'social_links' );
// Decoding items in case it is shortcode
if ( ! empty( $items ) AND ! is_array( $items ) ) {
$items = json_decode( urldecode( $items ), TRUE );
if ( ! is_array( $items ) ) {
$items = array();
}
} elseif ( empty( $items ) OR ! is_array( $items ) ) {
$items = array();
}
foreach ( $items as $index => $item ) {
$social_title = ( isset( $social_links[ $item['type'] ] ) ) ? $social_links[ $item['type'] ] : $item['type'];
$social_url = ( isset( $item['url'] ) ) ? $item['url'] : '';
$social_target = $social_icon = $social_custom_bg = $social_custom_color = '';
// Custom type
if ( $item['type'] == 'custom' ) {
$social_title = ( ! empty( $item['title'] ) ) ? $item['title'] : us_translate( 'Title' );
$social_url = esc_url( $social_url );
$social_target = ' target="_blank"';
if ( isset( $item['icon'] ) ) {
$social_icon = us_prepare_icon_tag( $item['icon'] );
}
$social_custom_bg = us_prepare_inline_css(
array(
'background' => $item['color'],
)
);
$social_custom_color = us_prepare_inline_css(
array(
'color' => $item['color'],
)
);
// Email type
} elseif ( $item['type'] == 'email' ) {
if ( filter_var( $social_url, FILTER_VALIDATE_EMAIL ) ) {
$social_url = 'mailto:' . $social_url;
}
// Skype type
} elseif ( $item['type'] == 'skype' ) {
if ( strpos( $social_url, ':' ) === FALSE ) {
$social_url = 'skype:' . esc_attr( $social_url );
}
// All others types
} else {
$social_url = esc_url( $social_url );
$social_target = ' target="_blank"';
}
$output .= '<div class="w-socials-item ' . $item['type'] . '"' . $item_inline_css . '>';
$output .= '<a class="w-socials-item-link"';
$output .= ' rel="nofollow"' . $social_target;
$output .= ' href="' . $social_url . '"';
$output .= ' title="' . esc_attr( $social_title ) . '"';
$output .= ' aria-label="' . esc_attr( $social_title ) . '"';
if ( $color == 'brand' ) {
$output .= $social_custom_color;
}
$output .= '>';
$output .= '<span class="w-socials-item-link-hover"' . $social_custom_bg . '></span>';
$output .= $social_icon;
$output .= '</a>';
$output .= '<div class="w-socials-item-popup"><span>' . strip_tags( $social_title ) . '</span></div>';
$output .= '</div>';
}
$output .= '</div></div>';
echo $output;
@@ -0,0 +1,42 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Output text element
*
* @var $text string
* @var $size int Text size
* @var $size_tablets int Text size for tablets
* @var $size_mobiles int Text size for mobiles
* @var $link string Link
* @var $icon string FontAwesome or Material icon
* @var $font string Font Source
* @var $color string Custom text color
* @var $design_options array
* @var $classes string
* @var $id string
*/
$classes = isset( $classes ) ? $classes : '';
$output = '<div class="w-text' . $classes . '">';
$link_atts = us_generate_link_atts( $link );
if ( ! empty( $link_atts ) ) {
$output .= '<a class="w-text-h"' . $link_atts . '>';
} else {
$output .= '<div class="w-text-h">';
}
if ( ! empty( $icon ) ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= '<span class="w-text-value">' . strip_tags( $text, '<br>' ) . '</span>';
if ( ! empty( $link_atts ) ) {
$output .= '</a>';
} else {
$output .= '</div>';
}
$output .= '</div>';
echo $output;
@@ -0,0 +1,90 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: vc_column
*
* Overloaded by UpSolution custom implementation.
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @var $width string Width in format: 1/2 (is set by WPBakery Page Builder renderer)
* @var $text_color string Text color
* @var $animate string Animation type: '' / 'fade' / 'afc' / 'afl' / 'afr' / 'afb' / 'aft' / 'hfc' / 'wfc'
* @var $animate_delay float Animation delay (in seconds)
* @var $el_id string element ID
* @var $el_class string Additional class
* @var $offset string WPBakery Page Builder classes for responsive behaviour
* @var $css string Custom CSS
*/
$inner_classes = $el_id_string = $link_html = '';
if ( function_exists( 'wpb_translateColumnWidthToSpan' ) ) {
$width = wpb_translateColumnWidthToSpan( $width );
} elseif ( function_exists( 'us_wpb_translateColumnWidthToSpan' ) ) {
$width = us_wpb_translateColumnWidthToSpan( $width );
}
if ( function_exists( 'vc_column_offset_class_merge' ) ) {
$width = vc_column_offset_class_merge( $offset, $width );
} elseif ( function_exists( 'us_vc_column_offset_class_merge' ) ) {
$width = us_vc_column_offset_class_merge( $offset, $width );
}
$classes = $width . ' wpb_column vc_column_container';
if ( function_exists( 'vc_shortcode_custom_css_has_property' ) AND vc_shortcode_custom_css_has_property(
$css, array(
'border',
'background',
)
) ) {
$classes .= ' has-fill';
} elseif ( function_exists( 'us_vc_shortcode_custom_css_has_property' ) AND us_vc_shortcode_custom_css_has_property(
$css, array(
'border',
'background',
)
) ) {
$classes .= ' has-fill';
}
if ( ! empty( $animate ) ) {
$classes .= ' animate_' . $animate;
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$inner_classes .= ' ' . vc_shortcode_custom_css_class( $css, ' ' );
}
if ( ! empty( $text_color ) ) {
$inner_classes .= ' color_custom';
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
// Link
$link_atts = us_generate_link_atts( $link );
if ( ! empty( $link_atts ) ) {
$classes .= ' has-link';
$link_html = '<a class="vc_column-link smooth-scroll"' . $link_atts . '></a>';
}
$inline_css = us_prepare_inline_css(
array(
'color' => $text_color,
'animation-delay' => empty( $animate_delay ) ? '' : floatval( $animate_delay ) . 's',
)
);
// Output the element
$output = '<div class="' . $classes . '"' . $el_id . $inline_css . '>';
$output .= '<div class="vc_column-inner' . $inner_classes . '">';
$output .= '<div class="wpb_wrapper">' . do_shortcode( $content ) . '</div>';
$output .= $link_html;
$output .= '</div></div>';
echo $output;
@@ -0,0 +1,39 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode attributes
*
* @var $el_class
* @var $css_animation
* @var $css
* @var $content - shortcode content
* Shortcode class
* @var $this WPBakeryShortCode_VC_Column_text
*/
$classes = '';
if ( function_exists( 'vc_shortcode_custom_css_class' ) AND ! empty( $css ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
if ( ! empty( $el_class ) ) {
$classes .= ' ' . $el_class;
}
$el_id_string = '';
if ( $el_id != '' ) {
$el_id_string = ' id="' . esc_attr( $el_id ) . '"';
}
$content = wpautop( preg_replace( '/<\/?p\>/', "\n", $content ) . "\n" );
$output = '
<div class="wpb_text_column ' . esc_attr( $classes ) . '"' . $el_id_string . '>
<div class="wpb_wrapper">
' . do_shortcode( shortcode_unautop( $content ) ) . '
</div>
</div>
';
echo $output;
@@ -0,0 +1,295 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: vc_row
*
* Overloaded by UpSolution custom implementation to allow creating fullwidth sections and provide lots of additional
* features.
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
* @var $content_placement string Columns Content Position: 'top' / 'middle' / 'bottom'
* @var $gap string gap class for columns
* @var $height string Height type. Possible values: 'default' / 'small' / 'medium' / 'large' / 'huge' / 'auto' / 'full'
* @var $valign string Vertical align for full-height sections: '' / 'center'
* @var $width string Section width: '' / 'full'
* @var $color_scheme string Color scheme: '' / 'alternate' / 'primary' / 'secondary' / 'custom'
* @var $us_bg_color string
* @var $us_text_color string
* @var $us_bg_image_source string Background image source: 'none' / 'media' / 'featured' / 'custom'
* @var $us_bg_image int Background image ID (from WordPress media)
* @var $us_bg_size string Background size: 'cover' / 'contain' / 'initial'
* @var $us_bg_repeat string Background size: 'repeat' / 'repeat-x' / 'repeat-y' / 'no-repeat'
* @var $us_bg_pos string Background position: 'top left' / 'top center' / 'top right' / 'center left' / 'center center' / 'center right' / 'bottom left' / 'bottom center' / 'bottom right'
* @var $us_bg_parallax string Parallax type: '' / 'vertical' / 'horizontal' / 'still'
* @var $us_bg_parallax_width string Parallax background width: '110' / '120' / '130' / '140' / '150'
* @var $us_bg_parallax_reverse bool Reverse vertival parllax effect?
* @var $us_bg_video string Link to video file
* @var $us_bg_overlay_color string
* @var $sticky bool Fix this row at the top of a page during scroll
* @var $sticky_disable_width int When screen width is less than this value, sticky row becomes not sticky
* @var $el_id string
* @var $el_class string
* @var $disable_element string
* @var $css string
*/
$atts = us_shortcode_atts( $atts, $shortcode_base );
// .l-section container additional classes and inner CSS-styles
$classes = $inline_css = $inner_inline_css = '';
if ( $disable_element === 'yes' ) {
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$classes .= ' vc_hidden-lg vc_hidden-xs vc_hidden-sm vc_hidden-md';
} else {
return '';
}
}
if ( $height == 'default' ) {
$classes .= ' height_' . us_get_option( 'row_height', 'medium' );
} else {
$classes .= ' height_' . $height;
}
if ( $height == 'full' AND ! empty( $valign ) ) {
$classes .= ' valign_' . $valign;
}
if ( $width == 'full' ) {
$classes .= ' width_full';
}
if ( $color_scheme != '' ) {
$classes .= ' color_' . $color_scheme;
if ( $color_scheme == 'custom' ) {
// Custom colors
if ( $us_bg_color != '' ) {
$inline_css .= 'background: ' . $us_bg_color . ';';
}
if ( $us_text_color != '' ) {
$inline_css .= ' color: ' . $us_text_color . ';';
}
}
}
if ( $sticky == 1 ) {
$classes .= ' type_sticky';
}
if ( ! empty( $el_class ) ) {
$classes .= ' ' . $el_class;
}
// Background Image
$bg_image_html = $bg_image_url = $bg_img_atts = '';
if ( $us_bg_image_source == 'media' AND ! empty( $us_bg_image ) ) {
if ( is_numeric( $us_bg_image ) ) {
$wp_image = wp_get_attachment_image_src( (int) $us_bg_image, 'full' );
if ( $wp_image ) {
$bg_image_url = $wp_image[0];
$bg_img_atts .= ' data-img-width="' . esc_attr( $wp_image[1] ) . '" data-img-height="' . esc_attr( $wp_image[2] ) . '"';
}
} else {
$bg_image_url = $us_bg_image;
}
}
if ( $us_bg_image_source == 'featured' AND ( isset( $GLOBALS['post'] ) OR is_404() OR is_search() OR is_archive() OR ( is_home() AND ! have_posts() ) ) ) {
$us_layout = US_Layout::instance();
if ( ! empty( $us_layout->post_id ) ) {
$wp_image = wp_get_attachment_image_src( get_post_thumbnail_id( $us_layout->post_id ), 'full' );
if ( $wp_image ) {
$bg_image_url = $wp_image[0];
$bg_img_atts .= ' data-img-width="' . esc_attr( $wp_image[1] ) . '" data-img-height="' . esc_attr( $wp_image[2] ) . '"';
}
}
}
if ( ! empty( $bg_image_url ) ) {
$classes .= ' with_img';
$bg_image_inline_css = 'background-image: url(' . $bg_image_url . ');';
if ( $us_bg_pos != 'center center' ) {
$bg_image_inline_css .= 'background-position: ' . $us_bg_pos . ';';
}
if ( $us_bg_repeat != 'repeat' ) {
$bg_image_inline_css .= 'background-repeat: ' . $us_bg_repeat . ';';
}
if ( $us_bg_size != 'cover' ) {
$bg_image_inline_css .= 'background-size: ' . $us_bg_size . ';';
}
$bg_image_additional_class = ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) ? ' loaded' : '';
$bg_image_html = '<div class="l-section-img' . $bg_image_additional_class . '" style="' . $bg_image_inline_css . '"' . $bg_img_atts . '></div>';
}
// Background Video
$bg_video_html = '';
if ( $us_bg_video != '' ) {
$classes .= ' with_video';
$provider_matched = FALSE;
$bg_video_html = '<div class="l-section-video">';
foreach ( us_config( 'embeds' ) as $provider => $embed ) {
if ( $embed['type'] != 'video' OR ! preg_match( $embed['regex'], $us_bg_video, $matches ) ) {
continue;
}
$provider_matched = TRUE;
$video_id = $matches[ $embed['match_index'] ];
if ( $provider == 'youtube' ) {
$classes .= ' with_youtube';
$video_title = '?autoplay=1&loop=1&playlist=' . $video_id . '&showinfo=0&controls=0&rel=0&showinfo=0&mute=1&iv_load_policy=3&disablekb=1&wmode=transparent';
} elseif ( $provider == 'vimeo' ) {
$classes .= ' with_vimeo';
$video_title = '&autoplay=1&loop=1&muted=1&title=0&byline=0&background=1';
}
$embed_html = str_replace( '<id>', $matches[ $embed['match_index'] ], $embed['html'] );
$embed_html = str_replace( '<video-title>', $video_title, $embed_html );
break;
}
if ( $provider_matched ) {
$bg_video_html .= $embed_html;
} else {
$bg_video_html .= '<video muted loop autoplay preload="auto">';
$video_ext = 'mp4'; //use mp4 as default extension
$file_path_info = pathinfo( $us_bg_video );
if ( isset( $file_path_info['extension'] ) ) {
if ( in_array( $file_path_info['extension'], array( 'ogg', 'ogv' ) ) ) {
$video_ext = 'ogg';
} elseif ( $file_path_info['extension'] == 'webm' ) {
$video_ext = 'webm';
}
}
$bg_video_html .= '<source type="video/' . $video_ext . '" src="' . $us_bg_video . '" />';
$bg_video_html .= '</video>';
}
$bg_video_html .= '</div>';
} else {
if ( $us_bg_parallax == 'vertical' ) {
$classes .= ' parallax_ver';
if ( $us_bg_parallax_reverse ) {
$classes .= ' parallaxdir_reversed';
}
if ( in_array( $us_bg_pos, array( 'top right', 'center right', 'bottom right' ) ) ) {
$classes .= ' parallax_xpos_right';
} elseif ( in_array( $us_bg_pos, array( 'top left', 'center left', 'bottom left' ) ) ) {
$classes .= ' parallax_xpos_left';
}
} elseif ( $us_bg_parallax == 'fixed' OR $us_bg_parallax == 'still' ) {
$classes .= ' parallax_fixed';
} elseif ( $us_bg_parallax == 'horizontal' ) {
$classes .= ' parallax_hor';
$classes .= ' bgwidth_' . $us_bg_parallax_width;
}
}
// Background Slider
$bg_slider_html = '';
if ( class_exists( 'RevSlider' ) AND $us_bg_slider != '' ) {
$classes .= ' with_slider';
$bg_slider_html = '<div class="l-section-slider">' . do_shortcode( '[rev_slider ' . $us_bg_slider . ']' ) . '</div>';
}
// Background Overlay
$bg_overlay_html = '';
if ( ! empty( $us_bg_overlay_color ) ) {
$classes .= ' with_overlay';
$bg_overlay_html = '<div class="l-section-overlay" style="background: ' . $us_bg_overlay_color . '"></div>';
}
// We cannot use VC's method directly for rows: as it uses !important values, so we're moving the defined css
// that don't duplicate the theme's features to inline style attribute.
if ( ! empty( $css ) AND preg_match( '~\{([^\}]+?)\;?\}~', $css, $matches ) ) {
$vc_css_rules = array_map( 'trim', explode( ';', $matches[1] ) );
$overloaded_params = array(
'background',
'background-position',
'background-repeat',
'background-size',
'padding-top',
'padding-bottom',
);
$inner_params = array(
'padding-top',
'padding-bottom',
);
foreach ( $vc_css_rules as $vc_css_rule ) {
$vc_css_rule = explode( ':', $vc_css_rule );
// Generate inline styles for "l-section"
if ( count( $vc_css_rule ) == 2 AND ! in_array( $vc_css_rule[0], $overloaded_params ) ) {
$inline_css .= $vc_css_rule[0] . ':' . $vc_css_rule[1] . ';';
}
// Generate inline styles for "l-section-h"
if ( count( $vc_css_rule ) == 2 AND in_array( $vc_css_rule[0], $inner_params ) ) {
$inner_inline_css .= $vc_css_rule[0] . ':' . $vc_css_rule[1] . ';';
}
}
}
$classes = apply_filters( 'vc_shortcodes_css_class', $classes, $shortcode_base, $atts );
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$classes .= ' vc_row';
}
// Output the element
$output = '<section class="l-section wpb_row' . $classes . '"';
if ( ! empty( $el_id ) ) {
$output .= ' id="' . $el_id . '"';
}
if ( ! empty( $inline_css ) ) {
$output .= ' style="' . $inline_css . '"';
}
if ( $sticky == 1 AND ! empty( $sticky_disable_width ) ) {
$output .= ' data-sticky-disable-width="' . intval( $sticky_disable_width ) . '"';
}
$output .= '>';
$output .= $bg_image_html;
$output .= $bg_video_html;
$output .= $bg_slider_html;
$output .= $bg_overlay_html;
$output .= '<div class="l-section-h i-cf"';
if ( ! empty( $inner_inline_css ) ) {
$output .= ' style="' . $inner_inline_css . '"';
}
$output .= '>';
$inner_output = do_shortcode( $content );
// If the row has no inner rows, preparing wrapper for inner columns
if ( substr( $inner_output, 0, 18 ) != '<div class="g-cols' ) {
$cols_gap_styles = '';
$cols_class_name = ( $columns_type ) ? ' type_boxes' : ' type_default';
if ( ! empty( $content_placement ) ) {
$cols_class_name .= ' valign_' . $content_placement;
}
if ( ! empty( $columns_reverse ) ) {
$cols_class_name .= ' reversed';
}
// Prepare extra styles for columns gap
$gap = trim( $gap );
if ( ! empty( $gap ) ) {
$gap = trim( strip_tags( $gap ) );
$gap_class = 'gap-' . str_replace( array( '.', ',', ' ' ), '-', $gap );
$cols_class_name .= ' ' . $gap_class;
$cols_gap_styles = '<style>';
if ( $columns_type ) {
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 -' . $gap . '}';
} else {
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 calc(-1.5rem - ' . $gap . ')}';
}
$cols_gap_styles .= '.' . $gap_class . ' > .vc_column_container {padding:' . $gap . '}';
$cols_gap_styles .= '</style>';
}
$output .= '<div class="g-cols vc_row' . $cols_class_name . '">';
$output .= $cols_gap_styles . $inner_output;
$output .= '</div>';
} else {
$output .= $inner_output;
}
$output .= '</div></section>';
if ( $sticky == 1 ) {
$output .= '<div class="l-section-gap"></div>';
}
echo $output;
@@ -0,0 +1,86 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: vc_row_inner
*
* Overloaded by UpSolution custom implementation.
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @var $content_placement string Columns Content Position: 'top' / 'middle' / 'bottom'
* @var $gap string gap class for columns
* @var $el_id string
* @var $el_class string
* @var $disable_element string
* @var $css string
*/
$atts = us_shortcode_atts( $atts, $shortcode_base );
if ( $disable_element === 'yes' ) {
if ( function_exists( 'vc_is_page_editable' ) AND vc_is_page_editable() ) {
$classes .= ' vc_hidden-lg vc_hidden-xs vc_hidden-sm vc_hidden-md';
} else {
return '';
}
}
$class_name = ( $columns_type ) ? ' type_boxes' : ' type_default';
if ( ! empty( $content_placement ) ) {
$class_name .= ' valign_' . $content_placement;
}
// Prepare extra styles for columns gap
$cols_gap_styles = '';
$gap = trim( $gap );
if ( ! empty( $gap ) ) {
$gap = trim( strip_tags( $gap ) );
$gap_class = 'gap-' . str_replace( array( '.', ',', ' ' ), '-', $gap );
$class_name .= ' ' . $gap_class;
$cols_gap_styles = '<style>';
if ( $columns_type ) {
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 -' . $gap . '}';
} else {
$cols_gap_styles .= '.g-cols.' . $gap_class . '{margin:0 calc(-1.5rem - ' . $gap . ')}';
}
$cols_gap_styles .= '.' . $gap_class . ' > .vc_column_container {padding:' . $gap . '}';
$cols_gap_styles .= '</style>';
}
if ( ! empty( $columns_reverse ) ) {
$class_name .= ' reversed';
}
// Preserving additional class for inner VC rows
if ( $shortcode_base == 'vc_row_inner' ) {
$class_name .= ' vc_inner';
}
// Additional class set by a user in a shortcode attributes
if ( ! empty( $el_class ) ) {
$class_name .= ' ' . $el_class;
}
if ( function_exists( 'vc_shortcode_custom_css_class' ) ) {
$class_name .= ' ' . vc_shortcode_custom_css_class( $css, ' ' );
}
$class_name = apply_filters( 'vc_shortcodes_css_class', $class_name, $shortcode_base, $atts );
$row_id_param = '';
$output = '<div class="g-cols wpb_row ' . $class_name . '"';
if ( ! empty( $el_id ) ) {
$output .= ' id="' . $el_id . '"';
}
$output .= '>';
$output .= $cols_gap_styles;
$output .= do_shortcode( $content );
$output .= '</div>';
echo $output;
@@ -0,0 +1,100 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: vc_tta_section
*
* Overloaded by UpSolution custom implementation.
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @var $title string Section title
* @var $tab_id string Section slug
* @var $icon string Icon
* @var $i_position string Icon position: 'left' / 'right'
* @var $active bool Tab is opened when page loads
* @var $indents string Indents type: '' / 'none'
* @var $bg_color string Background color
* @var $text_color string Text color
* @var $c_position string Control position (inherited from wrapping vc_tta_tabs shortcode): 'left' / 'right'
* @var $title_tag string Title HTML tag (inherited from wrapping vc_tta_tabs shortcode): 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
* @var $title_size string Title Size
* @var $el_class string Extra class name
*/
global $us_tabs_atts, $us_tab_index;
// Tab indexes start from 1
$us_tab_index = isset( $us_tab_index ) ? ( $us_tab_index + 1 ) : 1;
// We could overload some of the atts at vc_tabs implementation, so apply them here as well
if ( isset( $us_tab_index ) AND isset( $us_tabs_atts[ $us_tab_index - 1 ] ) ) {
foreach ( $us_tabs_atts[ $us_tab_index - 1 ] as $_key => $_value ) {
${$_key} = $_value;
}
}
$content_html = do_shortcode( $content );
$classes = $item_tag_href = '';
if ( $icon ) {
$classes .= ' with_icon';
}
if ( $indents == 'none' ) {
$classes .= ' no_indents';
}
if ( $active ) {
$classes .= ' active';
}
// Hide the section with empty content
if ( $content_html == '' ) {
$classes .= ' content-empty';
}
if ( ! empty( $el_class ) ) {
$classes .= ' ' . $el_class;
}
$item_tag = 'div';
if ( ! empty( $tab_id ) ) {
$item_tag = 'a';
$item_tag_href = ' href="#' . $tab_id . '"';
$tab_id = ' id="' . $tab_id . '"';
}
$inline_css = us_prepare_inline_css(
array(
'background' => $bg_color,
'color' => $text_color,
)
);
if ( ! empty( $inline_css ) ) {
$classes .= ' color_custom';
}
// Replace comments amount instead of variable
$title = us_replace_comment_count_var( $title );
// Output the element
$output = '<div class="w-tabs-section' . $classes . '"' . $tab_id . $inline_css . '>';
$output .= '<' . $item_tag . $item_tag_href . ' class="w-tabs-section-header"' . us_prepare_inline_css( array( 'font-size' => $title_size ) ) . '><div class="w-tabs-section-header-h">';
if ( $c_position == 'left' ) {
$output .= '<div class="w-tabs-section-control"></div>';
}
if ( $icon AND $i_position == 'left' ) {
$output .= us_prepare_icon_tag( $icon );
}
$output .= '<' . $title_tag . ' class="w-tabs-section-title">' . $title . '</' . $title_tag . '>';
if ( $icon AND $i_position == 'right' ) {
$output .= us_prepare_icon_tag( $icon );
}
if ( $c_position == 'right' ) {
$output .= '<div class="w-tabs-section-control"></div>';
}
$output .= '</div></' . $item_tag . '>';
$output .= '<div class="w-tabs-section-content"><div class="w-tabs-section-content-h i-cf">' . $content_html . '</div></div>';
$output .= '</div>';
echo $output;
@@ -0,0 +1,176 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: vc_tta_tabs
*
* Overloaded by UpSolution custom implementation.
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @var $toggle bool {@for [vc_tta_accordion]} Act as toggle?
* @var $c_align string {@for [vc_tta_accordion], [vc_tta_tour]} Text alignment: 'left' / 'center' / 'right'
* @var $c_icon string {@for [vc_tta_accordion]} Icon: '' / 'chevron' / 'plus' / 'triangle'
* @var $c_position string {@for [vc_tta_accordion]} Icon position: 'left' / 'right'
* @var $title_tag string Title HTML tag (inherited from wrapping vc_tta_tabs shortcode): 'div' / 'h2'/ 'h3'/ 'h4'/ 'h5'/ 'h6'/ 'p'
* @var $title_size string Title Size
* @var $layout string {@for [vc_tta_tabs]} Tabs layout: 'default' / 'modern' / 'trendy' / 'timeline'
* @var $stretch bool {@for [vc_tta_tabs]} Stretch tabs to the full available width
* @var $tab_position string {@for [vc_tta_tour]} Tabs position: 'left' / 'right'
* @var $controls_size string {@for [vc_tta_tour]} Tabs size: 'auto' / '10' / '20' / '30' / '40' / '50'
* @var $el_id string element ID
* @var $el_class string {@for [vc_tta_accordion], [vc_tta_tabs], [vc_tta_tour]} Extra class
* @var $css string Custom CSS
*/
// Backward compatibility
if ( $shortcode_base == 'vc_tour' ) {
$shortcode_base = 'vc_tta_tour';
} elseif ( $shortcode_base == 'vc_accordion' ) {
$shortcode_base = 'vc_tta_accordion';
} elseif ( $shortcode_base == 'vc_tabs' ) {
$shortcode_base = 'vc_tta_tabs';
}
$classes = $list_classes = $list_inline_css = $el_id_string = '';
// Extract tab attributes for future html preparations
global $us_tabs_atts;
preg_match_all( '/\[vc_tta_section([^\]]*?)\]/i', $content, $matches, PREG_OFFSET_CAPTURE );
$us_tabs_atts = isset( $matches[0] ) ? $matches[0] : array();
$active_tab_indexes = array();
foreach ( $us_tabs_atts as $index => $tab_atts ) {
$us_tabs_atts[ $index ] = shortcode_parse_atts( '[' . rtrim( $tab_atts[0], '[]' ) . ' ]' );
if ( isset( $us_tabs_atts[ $index ]['active'] ) AND $us_tabs_atts[ $index ]['active'] ) {
$active_tab_indexes[] = $index;
$us_tabs_atts[ $index ]['defined_active'] = 1;
}
}
// If none of the tabs is active, the first one will be
if ( empty( $active_tab_indexes ) AND $shortcode_base != 'vc_tta_accordion' ) {
$active_tab_indexes[] = 0;
$us_tabs_atts[0]['active'] = 'yes';
}
if ( ! ( $shortcode_base == 'vc_tta_accordion' AND $toggle ) AND count( $active_tab_indexes ) > 1 ) {
foreach ( array_slice( $active_tab_indexes, 1 ) as $index ) {
$us_tabs_atts[ $index ]['active'] = 0;
$us_tabs_atts[ $index ]['defined_active'] = 0;
}
}
// Inheriging some of the attributes to the sections
if ( isset( $c_position ) ) {
foreach ( $us_tabs_atts as $index => $tab_atts ) {
$us_tabs_atts[ $index ]['c_position'] = $c_position;
}
}
// Inheriging some of the attributes to the sections
if ( isset( $title_tag ) ) {
foreach ( $us_tabs_atts as $index => $tab_atts ) {
$us_tabs_atts[ $index ]['title_tag'] = $title_tag;
}
}
// Inheriging some of the attributes to the sections
if ( isset( $title_size ) ) {
foreach ( $us_tabs_atts as $index => $tab_atts ) {
$us_tabs_atts[ $index ]['title_size'] = $title_size;
}
}
if ( empty( $layout ) ) {
$layout = 'default';
}
if ( $shortcode_base == 'vc_tta_tabs' ) {
$list_classes .= ' hidden';
} elseif ( $shortcode_base == 'vc_tta_tour' ) {
$layout = 'ver';
$classes .= ' navpos_' . $tab_position . ' navwidth_' . $controls_size . ' title_at' . $c_align;
}
$classes .= ' layout_' . $layout;
$list_classes .= ' items_' . count( $us_tabs_atts );
$list_classes .= ( isset( $stretch ) AND $stretch ) ? ' stretch' : '';
// Accordion-specific settings
if ( $shortcode_base == 'vc_tta_accordion' ) {
$classes .= ' accordion';
if ( $toggle ) {
$classes .= ' type_togglable';
}
$classes .= ' title_at' . $c_align;
if ( ! empty( $c_icon ) ) {
$classes .= ' icon_' . $c_icon . ' iconpos_' . $c_position;
} else {
$classes .= ' icon_none';
}
} else {
// For accordion state of tabs
$classes .= ' icon_chevron iconpos_right';
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
if ( ! empty( $el_class ) ) {
$classes .= ' ' . $el_class;
}
if ( $el_id != '' ) {
$el_id_string = ' id="' . esc_attr( $el_id ) . '"';
}
// Generate inline styles for Tabs & Tour
if ( $shortcode_base != 'vc_tta_accordion' ) {
$list_inline_css .= us_prepare_inline_css(
array(
'font-family' => $title_font,
'font-weight' => $title_weight,
'text-transform' => $title_transform,
'font-size' => $title_size,
)
);
}
// Output the element
$output = '<div class="w-tabs' . $classes . ' "' . $el_id_string . '>';
$output .= '<div class="w-tabs-list' . $list_classes . '"' . $list_inline_css . '>';
$output .= '<div class="w-tabs-list-h">';
foreach ( $us_tabs_atts as $index => $tab_atts ) {
$tab_atts['title'] = isset( $tab_atts['title'] ) ? us_replace_comment_count_var( $tab_atts['title'] ) : '';
$tab_atts['i_position'] = isset( $tab_atts['i_position'] ) ? $tab_atts['i_position'] : 'left';
$tab_atts['el_class'] = isset( $tab_atts['el_class'] ) ? ' ' . $tab_atts['el_class'] : '';
$item_tag = 'div';
$item_tag_href = '';
if ( ! empty( $tab_atts['tab_id'] ) ) {
$item_tag = 'a';
$item_tag_href = ' href="#' . $tab_atts['tab_id'] . '"';
}
$active_class = ( isset( $tab_atts['active'] ) AND $tab_atts['active'] ) ? ' active' : '';
$active_class .= ( isset( $tab_atts['defined_active'] ) AND $tab_atts['defined_active'] ) ? ' defined-active' : '';
$icon_class = isset( $tab_atts['icon'] ) ? ' with_icon' : '';
$output .= '<div class="w-tabs-item' . $active_class . $icon_class . $tab_atts['el_class'] . '"><' . $item_tag . $item_tag_href . ' class="w-tabs-item-h">';
if ( isset( $tab_atts['icon'] ) AND $tab_atts['i_position'] == 'left' ) {
$output .= us_prepare_icon_tag( $tab_atts['icon'] );
}
$output .= '<span class="w-tabs-item-title">' . $tab_atts['title'] . '</span>';
if ( isset( $tab_atts['icon'] ) AND $tab_atts['i_position'] == 'right' ) {
$output .= us_prepare_icon_tag( $tab_atts['icon'] );
}
$output .= '</' . $item_tag . '></div>';
}
$output .= '</div></div>';
// Handling inner tabs
global $us_tab_index;
$us_tab_index = 0;
$output .= '<div class="w-tabs-sections"><div class="w-tabs-sections-h">' . do_shortcode( $content ) . '</div></div></div>';
echo $output;
@@ -0,0 +1,67 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: us_btn
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
* @var $content string Shortcode's inner content
*
* @var $link string Video link
* @var $ratio string Ratio: '16x9' / '4x3' / '3x2' / '1x1'
* @var $max_width string Max width in pixels
* @var $align string Video alignment: 'left' / 'center' / 'right'
* @var $css string Extra css
* @var $el_id string element ID
* @var $el_class string Extra class name
*/
$classes = $inline_css = $embed_html = $video_title = '';
$hide_video_title = ! empty( $hide_video_title ) ? TRUE : FALSE;
$hide_controls = ! empty( $hide_controls ) ? TRUE : FALSE;
if ( ! empty( $ratio ) ) {
$classes .= ' ratio_' . $ratio;
}
if ( ! empty( $max_width ) ) {
$classes .= ' align_' . $align;
$inline_css = us_prepare_inline_css(
array(
'max-width' => $max_width,
)
);
}
if ( ! empty( $css ) AND function_exists( 'vc_shortcode_custom_css_class' ) ) {
$classes .= ' ' . vc_shortcode_custom_css_class( $css );
}
$classes .= ( ! empty( $el_class ) ) ? ( ' ' . $el_class ) : '';
$el_id = ( ! empty( $el_id ) ) ? ( ' id="' . esc_attr( $el_id ) . '"' ) : '';
foreach ( us_config( 'embeds' ) as $provider => $embed ) {
if ( $embed['type'] != 'video' OR ! preg_match( $embed['regex'], $link, $matches ) ) {
continue;
}
if ( $hide_controls AND $provider == 'youtube' ) {
$video_title = '?controls=0';
} elseif ( $hide_video_title AND $provider == 'vimeo' ) {
$video_title = '&byline=0&title=0';
}
$video_id = $matches[ $embed['match_index'] ];
$embed_html = str_replace( '<id>', $video_id, $embed['html'] );
$embed_html = str_replace( '<video-title>', $video_title, $embed_html );
break;
}
if ( empty( $embed_html ) ) {
// Using the default WordPress way
global $wp_embed;
$embed_html = $wp_embed->run_shortcode( '[embed]' . $link . '[/embed]' );
}
$output = '<div class="w-video' . $classes . '"' . $inline_css . $el_id . '><div class="w-video-h">' . $embed_html . '</div></div>';
echo $output;
@@ -0,0 +1,47 @@
<?php defined( 'ABSPATH' ) OR die( 'This script cannot be accessed directly.' );
/**
* Shortcode: vc_wp_custommenu
*
* Overloaded by UpSolution custom implementation.
*
* Dev note: if you want to change some of the default values or acceptable attributes, overload the shortcodes config.
*
* @var $shortcode string Current shortcode name
* @var $shortcode_base string The original called shortcode name (differs if called an alias)
*
*/
$atts = us_shortcode_atts( $atts, $shortcode_base );
$classes = '';
if ( ! empty( $layout ) ) {
$classes .= ' layout_' . $layout;
}
$classes .= ' align_' . $align;
if ( $el_class != '' ) {
$classes .= ' ' . $el_class;
}
$inline_css = us_prepare_inline_css( array( 'font-size' => $font_size ) );
$output = '<div class="vc_wp_custommenu ' . esc_attr( $classes ) . '"';
if ( ! empty( $el_id ) ) {
$output .= ' id="' . $el_id . '"';
}
$output .= $inline_css . '>';
$type = 'WP_Nav_Menu_Widget';
$args = array();
global $wp_widget_factory;
// to avoid unwanted warnings let's check before using widget
if ( is_object( $wp_widget_factory ) AND isset( $wp_widget_factory->widgets, $wp_widget_factory->widgets[ $type ] ) ) {
ob_start();
the_widget( $type, $atts, $args );
$output .= ob_get_clean();
$output .= '</div>';
echo $output;
} else {
echo 'Widget ' . esc_attr( $type ) . 'Not found in : vc_wp_custommenu';
}