?>
">

	<?php 
// Loop through social options
foreach ($social_options as $key => $val) {
    // Get URL from the theme mods
    $url = isset($profiles[$key]) ? $profiles[$key] : '';
    // Display if there is a value defined
    if ($url) {
        // Escape URL except for the following keys
        if (!in_array($key, array('skype', 'email'))) {
            $url = esc_url($url);
        }
        // Display link
        echo '<a href="' . $url . '" title="' . $val['label'] . '" class="wpex-' . $key . ' ' . wpex_get_social_button_class($style) . '"' . $link_target . '>';
        // Simple Font Icons
        if (!$style) {
            echo '<span class="' . $val['icon_class'] . '"></span>';
            // Image Icons
        } elseif ($style == 'colored-icons') {
            echo '<img src="' . $colored_icons_url . '/' . $key . '.png" alt="' . $val['label'] . '" />';
            // New 3.0.0+ styles
        } else {
            echo '<span class="' . $val['icon_class'] . '"></span>';
        }
        echo '</a>';
    }
    // End url check
}
// End loop
Exemple #2
0
$attributes = '';
if ($link_style) {
    $attributes .= $link_style;
}
if ('blank' == $link_target || '_blank' == $link_target) {
    $attributes .= ' target="_blank"';
}
if ($hover_bg) {
    $attributes .= ' data-hover-background="' . $hover_bg . '"';
}
if ($hover_color) {
    $attributes .= ' data-hover-color="' . $hover_color . '"';
}
// Link Classes
if ($style) {
    $a_classes = wpex_get_social_button_class($style);
} else {
    $a_classes = 'vcex-social-link';
}
if ($width || $height) {
    $a_classes .= ' no-padding';
}
if ($hover_bg || $hover_color) {
    $a_classes .= ' wpex-data-hover';
    vcex_inline_js(array('data_hover'));
}
if ($hover_animation) {
    $a_classes .= ' ' . wpex_hover_animation_class($hover_animation);
    vcex_enque_style('hover-animations');
}
if ($css) {
        /**
         * Front-end display of widget.
         *
         * @see WP_Widget::widget()
         * @since 1.0.0
         *
         *
         * @param array $args Widget arguments.
         * @param array $instance Saved values from database.
         */
        public function widget($args, $instance)
        {
            // Get social services and
            $social_services = isset($instance['social_services']) ? $instance['social_services'] : '';
            // Return if no services defined
            if (!$social_services) {
                return;
            }
            // Define vars
            $title = isset($instance['title']) ? apply_filters('widget_title', $instance['title']) : '';
            $description = isset($instance['description']) ? $instance['description'] : '';
            $style = isset($instance['style']) ? $instance['style'] : '';
            $type = isset($instance['type']) ? $instance['type'] : '';
            $target = isset($instance['target']) ? $instance['target'] : '';
            $size = isset($instance['size']) ? intval($instance['size']) : '';
            $font_size = isset($instance['font_size']) ? $instance['font_size'] : '';
            $border_radius = isset($instance['border_radius']) ? $instance['border_radius'] : '';
            // Parse style
            $style = $this->parse_style($style, $type);
            // Fallback for OLD styles pre-3.0.0
            // Sanitize vars
            $size = $size ? wpex_sanitize_data($size, 'px') : '';
            $font_size = $font_size ? wpex_sanitize_data($font_size, 'font_size') : '';
            $border_radius = $border_radius ? wpex_sanitize_data($border_radius, 'border_radius') : '';
            $target = 'blank' == $target ? ' target="_blank"' : '';
            // Wrapper style
            $ul_style = '';
            if ($font_size) {
                $ul_style .= ' style="font-size:' . esc_attr($font_size) . ';"';
            }
            // Inline style
            $add_style = '';
            if ($size) {
                $add_style .= 'height:' . $size . ';width:' . $size . ';line-height:' . $size . ';';
            }
            if ($border_radius) {
                $add_style .= 'border-radius:' . $border_radius . ';';
            }
            if ($add_style) {
                $add_style = ' style="' . esc_attr($add_style) . '"';
            }
            // Before widget hook
            echo $args['before_widget'];
            // Display title
            if ($title) {
                echo $args['before_title'] . $title . $args['after_title'];
            }
            ?>

			<div class="wpex-fa-social-widget clr">
				<?php 
            // Description
            if ($description) {
                ?>
					<div class="desc clr">
						<?php 
                echo wpex_sanitize_data($description, 'html');
                ?>
					</div><!-- .desc -->
				<?php 
            }
            ?>
				<ul<?php 
            echo $ul_style;
            ?>
>
					<?php 
            // Original Array
            $social_services_array = $this->social_services_array;
            // Loop through each item in the array
            foreach ($social_services as $key => $val) {
                $link = !empty($social_services[$key]['url']) ? $social_services[$key]['url'] : null;
                $name = $social_services_array[$key]['name'];
                $nofollow = isset($social_services_array[$key]['nofollow']) ? ' rel="nofollow"' : '';
                if ($link) {
                    $key = 'vimeo-square' == $key ? 'vimeo' : $key;
                    $icon = 'youtube' == $key ? 'youtube-play' : $key;
                    $icon = 'bloglovin' == $key ? 'heart' : $icon;
                    $icon = 'vimeo-square' == $key ? 'vimeo' : $icon;
                    echo '<li>
								<a href="' . esc_url($link) . '" title="' . esc_attr($name) . '" class="wpex-' . esc_attr($key) . ' ' . wpex_get_social_button_class($style) . '"' . $add_style . $target . $nofollow . '><span class="fa fa-' . esc_attr($icon) . '"></span>
								</a>
							</li>';
                }
            }
            ?>
				</ul>
			</div><!-- .fontawesome-social-widget -->

			<?php 
            // After widget hook
            echo $args['after_widget'];
            ?>

		<?php 
        }
Exemple #4
0
    function wpex_get_staff_social($atts = NULL)
    {
        // Extract staff social args
        extract(shortcode_atts(array('link_target' => 'blank', 'post_id' => '', 'style' => 'minimal-round', 'font_size' => '', 'css' => ''), $atts));
        ob_start();
        // Get social profiles array
        $profiles = wpex_staff_social_array();
        // Define post_id
        $post_id = $post_id ? $post_id : get_the_ID();
        // Parse style to return correct classname
        $style = wpex_get_social_button_class($style);
        // Wrap classes
        $wrap_classes = 'staff-social wpex-social-btns clr';
        if ($css) {
            $wrap_classes .= ' ' . vc_shortcode_custom_css_class($css);
        }
        // Font size
        $font_size = $font_size ? wpex_sanitize_data($font_size, 'font_size') : '';
        $font_size = $font_size ? 'style="font-size:' . $font_size . '"' : '';
        $tooltip = apply_filters('wpex_tooltips_enabled', false);
        $tooltip = $tooltip ? ' tooltip-up' : '';
        ?>

		<div class="<?php 
        echo esc_attr($wrap_classes);
        ?>
"<?php 
        echo $font_size;
        ?>
>
			<?php 
        // Loop through social options
        foreach ($profiles as $profile) {
            // Get meta
            $meta = $profile['meta'];
            // Display link if one exists
            if ($url = get_post_meta($post_id, $meta, true)) {
                // Add "mailto" for emails
                if ('wpex_staff_email' == $meta && is_email($url)) {
                    $url = 'mailto:' . $url;
                } elseif ('wpex_staff_skype' == $meta) {
                    if (strpos($url, 'skype') === false) {
                        $url = str_replace('callto:', '', $url);
                        $url = 'callto:' . $url;
                    }
                } elseif ('wpex_staff_phone_number' === $meta) {
                    if (strpos($url, 'callto') === false) {
                        $url = str_replace('tel:', '', $url);
                        $url = 'tel:' . $url;
                    }
                } else {
                    $url = esc_url($url);
                }
                ?>

					<a href="<?php 
                echo $url;
                ?>
" title="<?php 
                echo esc_attr($profile['label']);
                ?>
" class="wpex-<?php 
                echo esc_attr(str_replace('_', '-', $profile['key']));
                ?>
 <?php 
                echo $style;
                echo $tooltip;
                ?>
" target="_<?php 
                echo $link_target;
                ?>
">
						<span class="<?php 
                echo $profile['icon_class'];
                ?>
"></span>
					</a>

				<?php 
            }
        }
        ?>
		</div><!-- .staff-social -->

		<?php 
        return ob_get_clean();
    }
        /**
         * Front-end display of widget.
         *
         * @see WP_Widget::widget()
         * @since 1.0.0
         *
         *
         * @param array $args Widget arguments.
         * @param array $instance Saved values from database.
         */
        public function widget($args, $instance)
        {
            // Extract args
            extract($args);
            // Get social services and
            $social_services = isset($instance['social_services']) ? $instance['social_services'] : '';
            // Return if no services defined
            if (!$social_services) {
                return;
            }
            // Define vars
            $title = isset($instance['title']) ? $instance['title'] : '';
            $title = apply_filters('widget_title', $title);
            $description = isset($instance['description']) ? $instance['description'] : '';
            $style = isset($instance['style']) ? $instance['style'] : '';
            $type = isset($instance['type']) ? $instance['type'] : '';
            $target = isset($instance['target']) ? $instance['target'] : '';
            $size = isset($instance['size']) ? intval($instance['size']) : '';
            $font_size = isset($instance['font_size']) ? $instance['font_size'] : '';
            $border_radius = isset($instance['border_radius']) ? $instance['border_radius'] : '';
            // Parse style
            $style = $this->parse_style($style, $type);
            // Sanitize vars
            $size = $size ? wpex_sanitize_data($size, 'px') : '';
            $font_size = $font_size ? wpex_sanitize_data($font_size, 'font_size') : '';
            $border_radius = $border_radius ? wpex_sanitize_data($border_radius, 'border_radius') : '';
            $target = 'blank' == $target ? ' target="_blank"' : '';
            ?>

			<?php 
            // Before widget hook
            echo $before_widget;
            ?>

			<?php 
            // Display title
            if ($title) {
                echo $before_title . $title . $after_title;
            }
            ?>

			<div class="wpex-fa-social-widget clr">

				<?php 
            // Inline style
            $add_style = '';
            if ('30' != $size && $size) {
                $add_style .= 'height:' . $size . ';width:' . $size . ';line-height:' . $size . ';';
            }
            if ($font_size) {
                $add_style .= 'font-size:' . $font_size . ';';
            }
            if ($border_radius) {
                $add_style .= 'border-radius:' . $border_radius . ';';
            }
            if ($add_style) {
                $add_style = ' style="' . esc_attr($add_style) . '"';
            }
            ?>

				<?php 
            // Description
            if ($description) {
                ?>

					<div class="desc clr">
						<?php 
                echo $description;
                ?>
					</div><!-- .desc -->

				<?php 
            }
            ?>

				<ul>

					<?php 
            // Loop through each social service and display font icon
            foreach ($social_services as $key => $service) {
                $link = !empty($service['url']) ? esc_url($service['url']) : null;
                $name = $service['name'];
                if ($link) {
                    $key = 'vimeo-square' == $key ? 'vimeo' : $key;
                    $icon = 'youtube' == $key ? 'youtube-play' : $key;
                    $icon = 'vimeo-square' == $key ? 'vimeo' : $icon;
                    echo '<li>
									<a href="' . $link . '" title="' . esc_attr($name) . '" class="wpex-' . $key . ' ' . wpex_get_social_button_class($style) . '"' . $add_style . $target . '><span class="fa fa-' . $icon . '"></span>
									</a>
								</li>';
                }
            }
            ?>

				</ul>

			</div><!-- .fontawesome-social-widget -->

			<?php 
            echo $after_widget;
            ?>

		<?php 
        }