Exemplo n.º 1
0
function wpsr_digg($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'type' => 'DiggMedium', 'text' => __('Digg this', 'wpsr'), 'image' => WPSR_PUBLIC_URL . 'buttons/digg-bt.png', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $digg_processed = "\n<!-- Start WP Socializer Plugin - Digg Button -->\n";
    switch ($output) {
        // Display the ordinary button
        case 'button':
            $digg_processed .= '<a class="DiggThisButton ' . $type . '" href="http://digg.com/submit?url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '></a>';
            break;
            // Display the Image format
        // Display the Image format
        case 'image':
            $digg_processed .= '<a href="http://digg.com/submit?url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '><img src="' . $image . '" alt="Digg!"  /></a>';
            break;
            // Display the Text format
        // Display the Text format
        case 'text':
            $digg_processed .= '<a href="http://digg.com/submit?url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '>' . $text . '</a>';
            break;
    }
    $digg_processed .= "\n<!-- End WP Socializer Plugin - Digg Button -->\n";
    return $digg_processed;
}
Exemplo n.º 2
0
function wpsr_facebook($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'type' => 'like', 'style' => 'button_count', 'showfaces' => 1, 'verb' => 'like', 'color' => 'light', 'appid' => '', 'text' => __('Share on Facebook', 'wpsr'), 'image' => WPSR_PUBLIC_URL . 'buttons/facebook-bt.png', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $facebook_processed = "\n<!-- Start WP Socializer Plugin - Facebook Button -->\n";
    switch ($output) {
        // Output ordinary button
        case 'button':
            $facebook_processed .= '<div class="fb-like" data-href="' . $url . '" data-share="' . ($type == 'send' ? 'true' : 'false') . '" data-layout="' . $style . '" data-show-faces="' . $showfaces . '" data-action="' . $verb . '" data-colorscheme="' . $color . '"></div>';
            break;
            // Output Image format
        // Output Image format
        case 'image':
            $facebook_processed .= '<a href="https://www.facebook.com/sharer.php?u=' . urlencode($url) . '" ' . $params . '><img src="' . $image . '" /></a>';
            break;
            // Output Text format
        // Output Text format
        case 'text':
            $facebook_processed .= '<a href="https://www.facebook.com/sharer.php?u=' . urlencode($url) . '" ' . $params . '>' . $text . '</a>';
            break;
    }
    $facebook_processed .= "\n<!-- End WP Socializer Plugin - Facebook Button -->\n";
    return $facebook_processed;
}
function wpsr_plusone($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'type' => 'standard', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $plusone_processed = "\n<!-- Start WP Socializer Plugin - +1 Button -->\n";
    switch ($output) {
        // Display the ordinary button
        case 'button':
            $plusone_processed .= '<g:plusone size="' . $type . '" href="' . $url . '" ' . $params . '></g:plusone>';
            break;
    }
    $plusone_processed .= "\n<!-- End WP Socializer Plugin - +1 Button -->\n";
    return $plusone_processed;
}
Exemplo n.º 4
0
function wpsr_linkedin($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'type' => 'right', 'text' => __('Submit this to ', 'wpsr'), 'image' => WPSR_PUBLIC_URL . 'buttons/linkedin-bt.png', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $linkedin_processed = "\n<!-- Start WP Socializer Plugin - LinkedIn Button -->\n";
    switch ($output) {
        // Display the ordinary button
        case 'button':
            $linkedin_processed .= '<script type="IN/Share" data-url="' . $url . '" data-counter="' . $type . '"></script>';
            break;
            // Display the Image format
        // Display the Image format
        case 'image':
            $linkedin_processed .= '<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '><img src="' . $image . '" alt="Submit to linkedin"  /></a>';
            break;
            // Display the Text format
        // Display the Text format
        case 'text':
            $linkedin_processed .= '<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=' . urlencode($url) . '&amp;title=' . urlencode($title) . '" ' . $params . '>' . $text . '</a>';
            break;
    }
    $linkedin_processed .= "\n<!-- End WP Socializer Plugin - LinkedIn Button -->\n";
    return $linkedin_processed;
}
Exemplo n.º 5
0
function wpsr_sharethis($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    ## Sharethis option
    $wpsr_sharethis = get_option('wpsr_sharethis_data');
    $defaults = array('output' => 'vcount', 'url' => $def_url, 'title' => $def_title, 'services' => 'facebook,twitter,email,sharethis', 'pubkey' => $wpsr_sharethis['pubkey'], 'addp' => 1, 'text' => 'ShareThis', 'image' => WPSR_PUBLIC_URL . 'buttons/sharethis-bt.png', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    // Preliminary Adjustments
    if ($services == '') {
        $output = 'classic';
    } else {
        $services_split = explode(',', $services);
    }
    // $title = urlencode($title); (fix v2.1)
    // $url = urlencode($url); (fix v2.4.6)
    if ($addp == 1) {
        $before_st = '<p>';
        $after_st = '</p>';
    } else {
        $before_st = $after_st = '';
    }
    $sharethis_processed = "\n<!-- Start WP Socializer Plugin - Sharethis Button -->\n" . $before_st;
    switch ($output) {
        case 'vcount':
            foreach ($services_split as $srvc) {
                $srvc = trim($srvc);
                $sharethis_processed .= "<span class='st_{$srvc}_vcount' st_title='{$title}' st_url='{$url}' displayText='share'></span>";
            }
            break;
        case 'hcount':
            foreach ($services_split as $srvc) {
                $srvc = trim($srvc);
                $sharethis_processed .= "<span class='st_{$srvc}_hcount' st_title='{$title}' st_url='{$url}' displayText='share'></span>";
            }
            break;
        case 'buttons':
            foreach ($services_split as $srvc) {
                $srvc = trim($srvc);
                $sharethis_processed .= "<span class='st_{$srvc}_buttons' st_title='{$title}' st_url='{$url}' displayText='share'></span>";
            }
            break;
        case 'large':
            foreach ($services_split as $srvc) {
                $srvc = trim($srvc);
                $sharethis_processed .= "<span class='st_{$srvc}_large' st_title='{$title}' st_url='{$url}' displayText='share'></span>";
            }
            break;
        case 'regular':
            foreach ($services_split as $srvc) {
                $srvc = trim($srvc);
                $sharethis_processed .= "<span class='st_{$srvc}' st_title='{$title}' st_url='{$url}' displayText='share'></span>";
            }
            break;
        case 'regular2':
            foreach ($services_split as $srvc) {
                $srvc = trim($srvc);
                $sharethis_processed .= "<span class='st_{$srvc}' st_title='{$title}' st_url='{$url}'></span>";
            }
            break;
        case 'classic':
            $sharethis_processed .= "<span class='st_sharethis' st_title='{$title}' st_url='{$url}' displayText='ShareThis'></span>";
            break;
        case 'image':
            $sharethis_processed .= '<a href="http://sharethis.com/item?publisher=' . $pubkey . '&amp;title=' . $title . '&amp;url=' . $url . '" ' . $params . '><img src="' . $image . '" /></a>';
            break;
        case 'text':
            $sharethis_processed .= '<a href="http://sharethis.com/item?publisher=' . $pubkey . '&amp;title=' . $title . '&amp;url=' . $url . '" ' . $params . '>' . $text . '</a>';
            break;
    }
    $sharethis_processed .= $after_st . "\n<!-- End WP Socializer Plugin - Sharethis Button -->\n";
    return $sharethis_processed;
}
Exemplo n.º 6
0
function wpsr_retweet($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'username' => '', 'service' => 'twitter', 'type' => 'compact', 'topsytheme' => 'blue', 'twitter_recacc' => '', 'twitter_lang' => 'en', 'text' => __('Retweet this', 'wpsr'), 'image' => WPSR_PUBLIC_URL . 'buttons/retweet-bt.png', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $pid = $post->ID;
    $purl = home_url() . '/?p=' . $pid;
    $title = trim(str_replace(array('&', '#', '&#8211;'), array('', '', '-'), $title));
    // revised since v2.4.7
    ## Start Output
    $retweet_processed = "\n<!-- Start WP Socializer Plugin - Retweet Button -->\n";
    switch ($output) {
        // Display the buttons
        case 'button':
            switch ($service) {
                // Twitter button processing code
                case 'twitter':
                    switch ($type) {
                        case 'normal':
                            $type = 'vertical';
                            break;
                        case 'compact':
                            $type = 'horizontal';
                            break;
                        case 'nocount':
                            $type = 'none';
                            break;
                    }
                    $user = $username == '' ? '' : "data-via='{$username}'";
                    $recacc = $twitter_recacc == '' ? '' : "data-related='{$twitter_recacc}'";
                    $retweet_processed .= '<a href="http://twitter.com/share" class="twitter-share-button" data-count="' . $type . '" ' . $user . ' data-lang="' . $twitter_lang . '" ' . $recacc . ' data-url="' . $url . '" data-text="' . $title . ' - "></a>';
                    break;
                    // Tweetmeme processing code
                // Tweetmeme processing code
                case "tweetmeme":
                    $retweet_processed .= '<script type="text/javascript">' . "\n" . "<!--\n" . 'tweetmeme_url = "' . $url . '"; ' . 'tweetmeme_style = "' . $type . '"; ' . 'tweetmeme_source = "' . $username . '"; ' . "\n" . "\n-->" . '</script>' . "\n" . '<script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js"></script>';
                    break;
                    // Topsy processing code
                // Topsy processing code
                case "topsy":
                    if ($type == 'normal') {
                        $type = "big";
                    } else {
                        $type = '';
                    }
                    $retweet_processed .= '<div class="topsy_widget_data"><!--{' . '"url": "' . $url . '", ' . '"title": "' . $title . '", ' . '"style": "' . $type . '", ' . '"nick": "' . $username . '", ' . '"theme": "' . $topsytheme . '", ' . '}--></div>';
                    break;
            }
            break;
            // Display the image format
        // Display the image format
        case 'image':
            $retweet_processed .= '<a href="http://twitter.com/?status=RT @' . $username . ' ' . $title . ' ' . $purl . '" ' . $params . '><img src="' . $image . '" alt="Retweet" /></a>';
            break;
            // Display the text format
        // Display the text format
        case 'text':
            $retweet_processed .= '<a href="http://twitter.com/?status=RT @' . $username . ' ' . $title . ' ' . $purl . '" ' . $params . '>' . $text . '</a>';
            break;
    }
    $retweet_processed .= "\n<!-- End WP Socializer Plugin - Retweet Button -->\n";
    return $retweet_processed;
}
function wpsr_socialbts($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    $def_excerpt = $details['excerpt'];
    $defaults = array('output' => 'image', 'url' => $def_url, 'title' => $def_title, 'excerpt' => $def_excerpt, 'type' => '16px', 'target' => 1, 'nofollow' => 1, 'effect' => 'opacity', 'label' => 0, 'columns' => 'no', 'services' => 'facebook,twitter,delicious,digg,googlebuzz,stumbleupon,addtofavorites,email', 'sprites' => 1, 'imgpath16px' => WPSR_SOCIALBT_IMGPATH . '16/', 'imgpath32px' => WPSR_SOCIALBT_IMGPATH . '32/', 'before' => '', 'after' => '', 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    $socialbt_processed = '';
    // Define empty var v2.4.9.6
    if ($output != 'singles') {
        $socialbt_processed = "\n<!-- Start WP Socializer - Social Buttons - Output -->\n";
    }
    switch ($output) {
        // Output the ordinary buttons
        case 'image':
            $socialbt_processed .= '<div class="wp-socializer ' . $type . '">' . "\n";
            $socialbt_processed .= '<ul class="wp-socializer-' . $effect . ' columns-' . $columns . '">';
            switch ($type) {
                case '16px':
                    $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'image', 'pixel' => '16px', 'services' => $services, 'sprites' => $sprites, 'label' => $label, 'target' => $target, 'nofollow' => $nofollow, 'imgpath' => $imgpath16px));
                    break;
                case '32px':
                    $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'image', 'pixel' => '32px', 'services' => $services, 'sprites' => $sprites, 'label' => $label, 'target' => $target, 'nofollow' => $nofollow, 'imgpath' => $imgpath32px));
                    break;
            }
            $socialbt_processed .= "</ul> \n";
            $socialbt_processed .= '<div class="wp-socializer-clearer"></div>';
            $socialbt_processed .= '</div>';
            break;
        case 'singles':
            switch ($type) {
                case '16px':
                    $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'image', 'pixel' => '16px', 'services' => $services, 'sprites' => $sprites, 'label' => $label, 'target' => $target, 'nofollow' => $nofollow, 'imgpath' => $imgpath16px, 'after' => '', 'before' => '', 'params' => 'class="wp-socializer-single"'));
                    break;
                case '32px':
                    $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'image', 'pixel' => '32px', 'services' => $services, 'sprites' => $sprites, 'label' => $label, 'target' => $target, 'nofollow' => $nofollow, 'imgpath' => $imgpath32px, 'after' => '', 'before' => '', 'params' => 'class="wp-socializer-single"'));
                    break;
                case 'text':
                    $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'text', 'services' => $services, 'sprites' => $sprites, 'label' => $label, 'target' => $target, 'nofollow' => $nofollow, 'after' => $after, 'before' => $before, 'textBefore' => '', 'textAfter' => ' ', 'params' => 'class="wp-socializer-single-text"'));
                    break;
            }
            break;
            // Output the text links
        // Output the text links
        case 'text':
            $socialbt_processed .= '<div class="wp-socializer text">' . "\n";
            $socialbt_processed .= '<ul class="wp-socializer-' . $effect . ' columns-' . $columns . '">';
            $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'text', 'services' => $services, 'textBefore' => '&bull; ', 'textAfter' => ' '));
            $socialbt_processed .= "</ul> \n";
            $socialbt_processed .= '<div class="wp-socializer-clearer"></div>';
            $socialbt_processed .= '</div>';
            break;
        case 'rss':
            $socialbt_processed .= wpsr_socialbts_processlist(array('pUrl' => $url, 'pTitle' => $title, 'pExcerpt' => $excerpt, 'btType' => 'text', 'services' => $services, 'textBefore' => ' &bull; ', 'textAfter' => '', 'before' => $before, 'after' => $after));
            break;
    }
    if ($output != 'singles') {
        $socialbt_processed .= "\n<!-- End WP Socializer - Social Buttons - Output -->\n";
    }
    return $socialbt_processed;
}
function wpsr_addthis($args = '')
{
    global $post;
    $details = wpsr_get_post_details();
    $def_url = $details['permalink'];
    $def_title = $details['title'];
    ## Get Addthis Options
    $wpsr_addthis = get_option('wpsr_addthis_data');
    $defaults = array('output' => 'button', 'url' => $def_url, 'title' => $def_title, 'type' => 'button', 'btstyle' => 'lg-share-', 'tbstyle' => '16px', 'tbservices' => 'facebook,twitter,digg,delicious,email,compact', 'scstyle' => 'normal', 'username' => $wpsr_addthis['username'], 'lang' => 'en', 'text' => __('Share with Addthis', 'wpsr'), 'params' => '');
    $args = wp_parse_args($args, $defaults);
    extract($args, EXTR_SKIP);
    ## Adjustments
    $url = ' addthis:url="' . $url . '"';
    $title = ' addthis:title="' . $title . '"';
    $btwidth = strpos($btstyle, 'lg') === false ? '83' : '125';
    $addthis_processed = "\n<!-- Start WP Socializer Plugin - Addthis Button -->\n";
    $inner = '';
    switch ($output) {
        // Output the ordinary button
        case 'button':
            switch ($type) {
                // Display the toolbar
                case 'toolbar':
                    $style = $tbstyle == '16px' ? 'addthis_default_style' : 'addthis_default_style addthis_32x32_style';
                    $outer_start = '<div class="addthis_toolbox ' . $style . '"' . $url . $title . '>' . "\n";
                    $outer_end = '</div>';
                    $default_code = '<a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a>';
                    switch ($tbstyle) {
                        case '16px':
                            if ($tbservices == '') {
                                $inner = $default_code;
                            } else {
                                $tb_16px = explode(',', $tbservices);
                                foreach ($tb_16px as $tb_16px_srvc) {
                                    $tb_16px_srvc = trim($tb_16px_srvc);
                                    $inner .= "<a class=\"addthis_button_{$tb_16px_srvc}\"></a>\n";
                                }
                            }
                            break;
                        case '32px':
                            if ($tbservices == '') {
                                $inner = $default_code;
                            } else {
                                $tb_32px = explode(',', $tbservices);
                                foreach ($tb_32px as $tb_32px_srvc) {
                                    $tb_32px_srvc = trim($tb_32px_srvc);
                                    $inner .= "<a class=\"addthis_button_{$tb_32px_srvc}\"></a>\n";
                                }
                            }
                            break;
                    }
                    $addthis_processed .= $outer_start . $inner . $outer_end;
                    break;
                    // Display the sharecount
                // Display the sharecount
                case 'sharecount':
                    $outer_start = "\n" . '<div class="addthis_toolbox addthis_default_style"' . $url . $title . '>' . "\n";
                    $outer_end = '</div>' . "\n";
                    switch ($scstyle) {
                        case 'normal':
                            $inner = '<a class="addthis_counter"></a>';
                            break;
                        case 'pill':
                            $inner = '<a class="addthis_counter addthis_pill_style"></a>';
                            break;
                        case 'grouped':
                            $inner = '<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a>';
                            break;
                    }
                    $addthis_processed .= $outer_start . $inner . $outer_end;
                    break;
                    // Display the ordinary button
                // Display the ordinary button
                case 'button':
                    $addthis_processed .= '<a class="addthis_button" ' . $params . ' href="http://addthis.com/bookmark.php?v=250&amp;pubid=' . $username . '"' . $url . $title . '><img src="http://s7.addthis.com/static/btn/v2/' . $btstyle . $lang . '.gif" width="' . $btwidth . '" height="16" alt="Bookmark and Share" style="border:0"/></a>';
                    break;
            }
            break;
        case 'text':
            $addthis_processed .= '<a class="addthis_button" ' . $params . ' href="http://addthis.com/bookmark.php?v=250&amp;pubid=' . $username . '"' . $url . $title . '>' . $text . '</a>';
            break;
    }
    $addthis_processed .= "\n<!-- End WP Socializer Plugin - Addthis Button -->\n";
    return $addthis_processed;
}