Ejemplo n.º 1
0
function x_shortcode_share($atts)
{
    extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'title' => '', 'facebook' => '', 'twitter' => '', 'google_plus' => '', 'linkedin' => '', 'pinterest' => '', 'reddit' => '', 'email' => ''), $atts, 'x_share'));
    $share_url = urlencode(get_permalink());
    $share_title = urlencode(get_the_title());
    $share_source = urlencode(get_bloginfo('name'));
    $share_image_info = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
    $share_image = function_exists('x_get_featured_image_with_fallback_url') ? urlencode(x_get_featured_image_with_fallback_url()) : urlencode($share_image_info[0]);
    if ($linkedin == 'true') {
        $share_content = urlencode(cs_get_raw_excerpt());
    }
    $tooltip_attr = cs_generate_data_attributes_extra('tooltip', 'hover', 'bottom');
    $id = $id != '' ? 'id="' . esc_attr($id) . '"' : '';
    $class = $class != '' ? 'x-entry-share ' . esc_attr($class) : 'x-entry-share';
    $style = $style != '' ? 'style="' . $style . '"' : '';
    $title = $title != '' ? $title : __('Share this Post', csl18n());
    $facebook = $facebook == 'true' ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __('Share on Facebook', csl18n()) . "\" onclick=\"window.open('http://www.facebook.com/sharer.php?u={$share_url}&amp;t={$share_title}', 'popupFacebook', 'width=650, height=270, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-facebook-square\" data-x-icon=\"&#xf082;\"></i></a>" : '';
    $twitter = $twitter == 'true' ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __('Share on Twitter', csl18n()) . "\" onclick=\"window.open('https://twitter.com/intent/tweet?text={$share_title}&amp;url={$share_url}', 'popupTwitter', 'width=500, height=370, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-twitter-square\" data-x-icon=\"&#xf081;\"></i></a>" : '';
    $google_plus = $google_plus == 'true' ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __('Share on Google+', csl18n()) . "\" onclick=\"window.open('https://plus.google.com/share?url={$share_url}', 'popupGooglePlus', 'width=650, height=226, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-google-plus-square\" data-x-icon=\"&#xf0d4;\"></i></a>" : '';
    $linkedin = $linkedin == 'true' ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __('Share on LinkedIn', csl18n()) . "\" onclick=\"window.open('http://www.linkedin.com/shareArticle?mini=true&amp;url={$share_url}&amp;title={$share_title}&amp;summary={$share_content}&amp;source={$share_source}', 'popupLinkedIn', 'width=610, height=480, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-linkedin-square\" data-x-icon=\"&#xf08c;\"></i></a>" : '';
    $pinterest = $pinterest == 'true' ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __('Share on Pinterest', csl18n()) . "\" onclick=\"window.open('http://pinterest.com/pin/create/button/?url={$share_url}&amp;media={$share_image}&amp;description={$share_title}', 'popupPinterest', 'width=750, height=265, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-pinterest-square\" data-x-icon=\"&#xf0d3;\"></i></a>" : '';
    $reddit = $reddit == 'true' ? "<a href=\"#share\" {$tooltip_attr} class=\"x-share\" title=\"" . __('Share on Reddit', csl18n()) . "\" onclick=\"window.open('http://www.reddit.com/submit?url={$share_url}', 'popupReddit', 'width=875, height=450, resizable=0, toolbar=0, menubar=0, status=0, location=0, scrollbars=0'); return false;\"><i class=\"x-icon-reddit-square\" data-x-icon=\"&#xf1a2;\"></i></a>" : '';
    $email = $email == 'true' ? "<a href=\"mailto:?subject=" . get_the_title() . "&amp;body=" . __('Hey, thought you might enjoy this! Check it out when you have a chance:', csl18n()) . " " . get_permalink() . "\" {$tooltip_attr} class=\"x-share email\" title=\"" . __('Share via Email', csl18n()) . "\"><span><i class=\"x-icon-envelope-square\" data-x-icon=\"&#xf199;\"></i></span></a>" : '';
    $output = "<div {$id} class=\"{$class}\" {$style}>" . '<p>' . $title . '</p>' . '<div class="x-share-options">' . $facebook . $twitter . $google_plus . $linkedin . $pinterest . $reddit . $email . '</div>' . '</div>';
    return $output;
}
Ejemplo n.º 2
0
function x_shortcode_extra($atts, $content = null)
{
    extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => ''), $atts, 'x_extra'));
    $id = $id != '' ? 'id="' . esc_attr($id) . '"' : '';
    $class = $class != '' ? 'x-extra ' . esc_attr($class) : 'x-extra';
    $style = $style != '' ? 'style="' . $style . '"' : '';
    $href = $href != '' ? $href : '#';
    $title = $title != '' ? 'title="' . $title . '"' : '';
    $target = $target == 'blank' ? 'target="_blank"' : '';
    $data = cs_generate_data_attributes_extra($info, $info_trigger, $info_place, $title, $info_content);
    $output = "<a {$id} class=\"{$class}\" {$data} {$style} href=\"{$href}\" {$title} {$target}>" . do_shortcode($content) . "</a>";
    return $output;
}
Ejemplo n.º 3
0
function x_shortcode_button($atts, $content = null)
{
    extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'type' => '', 'shape' => '', 'size' => '', 'float' => '', 'block' => '', 'circle' => '', 'icon_only' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => '', 'lightbox_thumb' => '', 'lightbox_video' => '', 'lightbox_caption' => ''), $atts, 'x_button'));
    $id = $id != '' ? 'id="' . esc_attr($id) . '"' : '';
    $class = $class != '' ? ' ' . esc_attr($class) : '';
    $style = $style != '' ? 'style="' . $style . '"' : '';
    $type = $type != '' ? ' x-btn-' . $type : '';
    $shape = $shape != '' ? ' x-btn-' . $shape : '';
    $size = $size != '' ? ' x-btn-' . $size : '';
    switch ($float) {
        case 'left':
            $float = ' alignleft';
            break;
        case 'right':
            $float = ' alignright';
            break;
        default:
            $float = '';
    }
    $block = $block == 'true' ? ' x-btn-block' : '';
    $icon_only = $icon_only == 'true' ? ' x-btn-icon-only' : '';
    $href = $href != '' ? $href : '#';
    $title = $title != '' ? 'title="' . $title . '"' : '';
    $target = $target == 'blank' ? 'target="_blank"' : '';
    $lightbox_thumb = $lightbox_thumb != '' ? $lightbox_thumb : '';
    $lightbox_video = $lightbox_video == 'true' ? ', width: 1080, height: 608' : '';
    $lightbox_caption = $lightbox_caption != '' ? 'data-caption="' . $lightbox_caption . '"' : '';
    $tooltip_attr = $info != '' ? cs_generate_data_attributes_extra($info, $info_trigger, $info_place, '', $info_content) : '';
    if (is_numeric($lightbox_thumb)) {
        $lightbox_thumb_info = wp_get_attachment_image_src($lightbox_thumb, 'full');
        $lightbox_thumb = $lightbox_thumb_info[0];
    }
    if ($lightbox_video != '') {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\"";
    } else {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\"";
    }
    if ($circle == 'true') {
        $output = "<div {$id} class=\"x-btn-circle-wrap{$size}{$block}{$float}\" {$style}><a class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$icon_only}\" href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode($content) . "</a></div>";
    } else {
        $output = "<a {$id} class=\"x-btn{$class}{$type}{$shape}{$size}{$block}{$float}{$icon_only}\" {$style} href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}>" . do_shortcode($content) . "</a>";
    }
    return $output;
}
Ejemplo n.º 4
0
function x_shortcode_image($atts)
{
    extract(shortcode_atts(array('id' => '', 'class' => '', 'style' => '', 'type' => '', 'float' => '', 'src' => '', 'alt' => '', 'link' => '', 'href' => '', 'title' => '', 'target' => '', 'info' => '', 'info_place' => '', 'info_trigger' => '', 'info_content' => '', 'lightbox_thumb' => '', 'lightbox_video' => '', 'lightbox_caption' => ''), $atts, 'x_image'));
    $id = $id != '' ? 'id="' . esc_attr($id) . '"' : '';
    $class = $class != '' ? 'x-img ' . esc_attr($class) : 'x-img';
    $style = $style != '' ? 'style="' . $style . '"' : '';
    $type = $type != '' ? ' x-img-' . $type : '';
    $float = $float != '' ? ' ' . $float : '';
    $src = $src != '' ? $src : '';
    $alt = $alt != '' ? 'alt="' . $alt . '"' : '';
    $link = $link == 'true' ? 'true' : '';
    $link_class = $link == 'true' ? ' x-img-link' : '';
    $href = $href != '' ? $href : $src;
    $title = $title != '' ? 'title="' . $title . '"' : '';
    $target = $target == 'blank' ? 'target="_blank"' : '';
    $lightbox_thumb = $lightbox_thumb != '' ? $lightbox_thumb : $src;
    $lightbox_video = $lightbox_video == 'true' ? ', width: 1080, height: 608' : '';
    $lightbox_caption = $lightbox_caption != '' ? 'data-caption="' . $lightbox_caption . '"' : '';
    $tooltip_attr = $info != '' ? cs_generate_data_attributes_extra($info, $info_trigger, $info_place, '', $info_content) : '';
    if (is_numeric($src)) {
        $src_info = wp_get_attachment_image_src($src, 'full');
        $src = $src_info[0];
    }
    if (is_numeric($href)) {
        $href_info = wp_get_attachment_image_src($href, 'full');
        $href = $href_info[0];
    }
    if (is_numeric($lightbox_thumb)) {
        $lightbox_thumb_info = wp_get_attachment_image_src($lightbox_thumb, 'full');
        $lightbox_thumb = $lightbox_thumb_info[0];
    }
    if ($lightbox_video != '') {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'{$lightbox_video}\"";
    } else {
        $lightbox_options = "data-options=\"thumbnail: '" . $lightbox_thumb . "'\"";
    }
    if ($link == 'true') {
        $output = "<a {$id} class=\"{$class}{$link_class}{$type}{$float}\" {$style} href=\"{$href}\" {$title} {$target} {$tooltip_attr} {$lightbox_caption} {$lightbox_options}><img src=\"{$src}\" {$alt}></a>";
    } else {
        $output = "<img {$id} class=\"{$class}{$type}{$float}\" {$style} src=\"{$src}\" {$alt}>";
    }
    return $output;
}