Example #1
0
function sw_linkedIn_button_html($array)
{
    // If we've already generated this button, just use our existing html
    if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['linkedIn'])) {
        $array['resource']['linkedIn'] = $_GLOBALS['sw']['buttons'][$array['postID']]['linkedIn'];
        // If not, let's check if Facebook is activated and create the button HTML
    } elseif ($array['options']['linkedIn']) {
        $array['totes'] += $array['shares']['linkedIn'];
        ++$array['count'];
        $array['resource']['linkedIn'] = '<div class="nc_tweetContainer linkedIn" data-id="' . $array['count'] . '">';
        $link = urlencode(urldecode(sw_process_url($array['url'], 'linkedIn', $array['postID'])));
        $array['resource']['linkedIn'] .= '<a target="_blank" href="https://www.linkedin.com/cws/share?url=' . $link . '" data-link="https://www.linkedin.com/cws/share?url=' . $link . '" class="nc_tweet">';
        if ($array['options']['totesEach'] && $array['shares']['totes'] >= $array['options']['minTotes'] && $array['shares']['linkedIn'] > 0) {
            $array['resource']['linkedIn'] .= '<span class="iconFiller">';
            $array['resource']['linkedIn'] .= '<span class="spaceManWilly">';
            $array['resource']['linkedIn'] .= '<i class="sw sw-linkedin"></i>';
            $array['resource']['linkedIn'] .= '<span class="sw_share"> ' . $array['language']['linkedIn'] . '</span>';
            $array['resource']['linkedIn'] .= '</span></span>';
            $array['resource']['linkedIn'] .= '<span class="sw_count">' . kilomega($array['shares']['linkedIn']) . '</span>';
        } else {
            $array['resource']['linkedIn'] .= '<span class="sw_count sw_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-linkedin"></i><span class="sw_share"> ' . $array['language']['linkedIn'] . '</span></span></span></span>';
        }
        $array['resource']['linkedIn'] .= '</a>';
        $array['resource']['linkedIn'] .= '</div>';
        // Store these buttons so that we don't have to generate them for each set
        $_GLOBALS['sw']['buttons'][$array['postID']]['linkedIn'] = $array['resource']['linkedIn'];
    }
    return $array;
}
Example #2
0
function sw_tumblr_button_html($array)
{
    // If we've already generated this button, just use our existing html
    if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['tumblr'])) {
        $array['resource']['tumblr'] = $_GLOBALS['sw']['buttons'][$array['postID']]['tumblr'];
        // If not, let's check if Facebook is activated and create the button HTML
    } elseif (isset($array['options']['tumblr']) && $array['options']['tumblr']) {
        $array['totes'] += $array['shares']['tumblr'];
        ++$array['count'];
        // Collect the Title
        $title = SW_META_meta('nc_ogTitle');
        if (!$title) {
            $title = get_the_title();
        }
        // Collect the Description
        $description = SW_META_meta('nc_ogDescription');
        $array['resource']['tumblr'] = '<div class="nc_tweetContainer sw_tumblr" data-id="' . $array['count'] . '">';
        $link = urlencode(urldecode(sw_process_url($array['url'], 'tumblr', $array['postID'])));
        $array['resource']['tumblr'] .= '<a target="_blank" href="http://www.tumblr.com/share/link?url=' . $link . '&name=' . urlencode($title) . ($description ? '&description=' : '') . urlencode($description) . '" data-link="http://www.tumblr.com/share/link?url=' . $link . '&name=' . urlencode($title) . ($description ? '&description=' : '') . urlencode($description) . '" class="nc_tweet">';
        if ($array['options']['totesEach'] && $array['shares']['totes'] >= $array['options']['minTotes'] && $array['shares']['tumblr'] > 0) {
            $array['resource']['tumblr'] .= '<span class="iconFiller">';
            $array['resource']['tumblr'] .= '<span class="spaceManWilly">';
            $array['resource']['tumblr'] .= '<i class="sw sw-tumblr"></i>';
            $array['resource']['tumblr'] .= '<span class="sw_share"> ' . $array['language']['tumblr'] . '</span>';
            $array['resource']['tumblr'] .= '</span></span>';
            $array['resource']['tumblr'] .= '<span class="sw_count">' . kilomega($array['shares']['tumblr']) . '</span>';
        } else {
            $array['resource']['tumblr'] .= '<span class="sw_count sw_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-tumblr"></i><span class="sw_share"> ' . $array['language']['tumblr'] . '</span></span></span></span>';
        }
        $array['resource']['tumblr'] .= '</a>';
        $array['resource']['tumblr'] .= '</div>';
        // Store these buttons so that we don't have to generate them for each set
        $_GLOBALS['sw']['buttons'][$array['postID']]['tumblr'] = $array['resource']['tumblr'];
    }
    return $array;
}
Example #3
0
 function widget($args, $instance)
 {
     extract($args);
     // these are the widget options
     $title = apply_filters('widget_title', $instance['title']);
     $count = $instance['count'];
     $timeframe = $instance['timeframe'] . ' days ago';
     $network = $instance['network'];
     $showCount = $instance['showCount'];
     $countLabel = $instance['countLabel'];
     $style = $instance['style'];
     echo $before_widget;
     // Display the widget
     echo '<div class="widget-text wp_widget_plugin_box">';
     // Check if title is set
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     // Check if text is set
     $args = array("posts_per_page" => $count, "post_type" => "post", "meta_key" => '_' . $network, "orderby" => "meta_value_num", "order" => "DESC");
     $q = new WP_Query($args);
     if ($q->have_posts()) {
         $i = 1;
         echo '<ul class="' . $style . '">';
         while ($q->have_posts()) {
             $q->the_post();
             if ($showCount == 'true') {
                 $postID = get_the_ID();
                 $shares = get_post_meta($postID, '_' . $network, true);
                 echo '<li><a class="swPopularity" href="' . get_the_permalink() . '"><b>' . get_the_title() . '</b> - ' . kilomega($shares) . ' ' . $countLabel . '</a></li>';
             } else {
                 echo '<li><a class="swPopularity" href="' . get_the_permalink() . '"><b>' . get_the_title() . '</b></a></li>';
             }
         }
         echo '</ul>';
     }
     wp_reset_postdata();
     echo '</div>';
     echo $after_widget;
 }
function social_warfare_buttons($array = array())
{
    // Setup the default Array parameters
    if (!isset($array['where'])) {
        $array['where'] = 'default';
    }
    if (!isset($array['echo'])) {
        $array['echo'] = true;
    }
    if (!isset($array['content'])) {
        $array['content'] = false;
    }
    // Get the options...or create them if they don't exist
    if (isset($array['post_id'])) {
        $postID = $array['post_id'];
    } else {
        $postID = get_the_ID();
    }
    $options = sw_get_user_options();
    // Check to see if display location was specifically defined for this post
    $specWhere = get_post_meta($postID, 'nc_postLocation', true);
    if ($array['where'] == 'default') {
        if ($specWhere == 'default' || $specWhere == '') {
            if (is_singular('post')) {
                $array['where'] = $options['locationPost'];
            } elseif (is_singular('page')) {
                $array['where'] = $options['locationPage'];
            } elseif (is_singular()) {
                $postType = get_post_type($postID);
                if (isset($options['location' . $postType])) {
                    $array['where'] = $options['location' . $postType];
                } else {
                    $array['where'] = 'none';
                }
            } else {
                $postType = get_post_type($postID);
                if (isset($options['location' . $postType])) {
                    $array['where'] = $options['location' . $postType];
                } elseif ($postType == 'post' || $postType == 'page') {
                    $array['where'] = $options['locationSite'];
                } else {
                    $array['where'] = 'none';
                }
            }
        } else {
            $array['where'] = $specWhere;
        }
    }
    // Disable the buttons on Buddy Press pages
    if (function_exists('is_buddypress') && is_buddypress()) {
        return $array['content'];
        // Disable the buttons if the location is set to "None / Manual"
    } elseif ($array['where'] == 'none' && !isset($array['devs'])) {
        return $array['content'];
        // Disable the button if we're not in the loop, unless there is no content which means the function was called by a developer.
    } elseif ((!is_main_query() || !in_the_loop()) && !isset($array['devs'])) {
        return $array['content'];
        // Don't do anything if we're in the admin section
    } elseif (is_admin()) {
        return $array['content'];
        // If all the checks pass, let's make us some buttons!
    } else {
        // Set the options for the horizontal floating bar
        if ($options['float'] && is_singular()) {
            $floatOption = 'float' . ucfirst($options['floatOption']);
        } else {
            $floatOption = 'floatNone';
        }
        // Disable the plugin on feeds, search results, and non-published content
        if (!is_feed() && !is_search() && get_post_status($postID) == 'publish') {
            // Acquire the social stats from the networks
            if (isset($array['url'])) {
                $buttonsArray['url'] = $array['url'];
            } else {
                $buttonsArray['url'] = get_permalink($postID);
            }
            $language = array();
            $language = apply_filters('sw_languages', $language);
            // Setup the buttons array to pass into the 'sw_network_buttons' hook
            $buttonsArray['shares'] = get_social_warfare_shares($postID);
            $buttonsArray['language'] = apply_filters('sw_languages', $language);
            $buttonsArray['count'] = 0;
            $buttonsArray['totes'] = 0;
            $buttonsArray['options'] = $options;
            if ($buttonsArray['options']['totes'] && $buttonsArray['shares']['totes'] >= $buttonsArray['options']['minTotes']) {
                ++$buttonsArray['count'];
            }
            $buttonsArray['resource'] = array();
            $buttonsArray['postID'] = $postID;
            // Disable the subtitles plugin to avoid letting them inject their subtitle into our share titles
            if (is_plugin_active('subtitles/subtitles.php') && class_exists('Subtitles')) {
                remove_filter('the_title', array(Subtitles::getinstance(), 'the_subtitle'), 10, 2);
            }
            // This array will contain the HTML for all of the individual buttons
            $buttonsArray = apply_filters('sw_network_buttons', $buttonsArray);
            // Create the social panel
            $assets = '<div class="nc_socialPanel sw_' . $options['visualTheme'] . ' sw_d_' . $options['dColorSet'] . ' sw_i_' . $options['iColorSet'] . ' sw_o_' . $options['oColorSet'] . '" data-position="' . $options['locationPost'] . '" data-float="' . $floatOption . '" data-count="' . $buttonsArray['count'] . '" data-floatColor="' . $options['floatBgColor'] . '" data-scale="' . $options['buttonSize'] . '" data-align="' . $options['buttonFloat'] . '">';
            // Setup the total shares count if it's on the left
            if ($options['totes'] && $options['swTotesFormat'] == 'totesAltLeft' && $buttonsArray['totes'] >= $options['minTotes']) {
                $assets .= '<div class="nc_tweetContainer totes totesalt" data-id="6" >';
                $assets .= '<span class="sw_count">' . kilomega($buttonsArray['totes']) . ' <span class="sw_label">' . $language['total'] . '</span></span>';
                $assets .= '</div>';
            }
            // Sort the buttons according to the user's preferences
            if ($options['orderOfIconsSelect'] == 'manual') {
                foreach ($options['newOrderOfIcons'] as $thisIcon => $status) {
                    if (isset($buttonsArray['resource'][$thisIcon])) {
                        $assets .= $buttonsArray['resource'][$thisIcon];
                    }
                }
            } elseif ($options['orderOfIconsSelect'] == 'dynamicCount') {
                arsort($buttonsArray['shares']);
                foreach ($buttonsArray['shares'] as $thisIcon => $status) {
                    if (isset($buttonsArray['resource'][$thisIcon])) {
                        $assets .= $buttonsArray['resource'][$thisIcon];
                    }
                }
            }
            // Create the Total Shares Box if it's on the right
            if ($options['totes'] && $options['swTotesFormat'] != 'totesAltLeft' && $buttonsArray['totes'] >= $options['minTotes']) {
                if ($options['swTotesFormat'] == 'totes') {
                    $assets .= '<div class="nc_tweetContainer totes" data-id="6" >';
                    $assets .= '<span class="sw_count">' . kilomega($buttonsArray['totes']) . ' <span class="sw_label">' . $language['total'] . '</span></span>';
                    $assets .= '</div>';
                } else {
                    $assets .= '<div class="nc_tweetContainer totes totesalt" data-id="6" >';
                    $assets .= '<span class="sw_count"><span class="sw_label">' . $language['total'] . '</span> ' . kilomega($buttonsArray['totes']) . '</span>';
                    $assets .= '</div>';
                }
            }
            // Close the Social Panel
            $assets .= '</div>';
            // Reset the cache timestamp if needed
            if (sw_is_cache_fresh($postID) == false) {
                delete_post_meta($postID, 'sw_cache_timestamp');
                update_post_meta($postID, 'sw_cache_timestamp', floor(date('U') / 60 / 60));
            }
            if ($array['echo'] == false && $array['where'] != 'none') {
                return $assets;
            } elseif ($array['content'] === false) {
                echo $assets;
            } elseif ($array['where'] == 'below') {
                $content = $array['content'] . '' . $assets;
                return $content;
            } elseif ($array['where'] == 'above') {
                $content = $assets . '' . $array['content'];
                return $content;
            } elseif ($array['where'] == 'both') {
                $content = $assets . '' . $array['content'] . '' . $assets;
                return $content;
            } elseif ($array['where'] == 'none') {
                return $array['content'];
            }
        } else {
            return $array['content'];
        }
    }
}
function sw_pinterest_button_html($array)
{
    // If we've already generated this button, just use our existing html
    if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['pinterest'])) {
        $array['resource']['pinterest'] = $_GLOBALS['sw']['buttons'][$array['postID']]['pinterest'];
        // If not, let's check if Facebook is activated and create the button HTML
    } elseif ($array['options']['pinterest']) {
        $array['totes'] += $array['shares']['pinterest'];
        ++$array['count'];
        $pi = get_post_meta($array['postID'], 'nc_pinterestImage', true);
        if (sw_is_cache_fresh($array['postID']) == false) {
            // Check if an image ID has been provided
            $array['imageID'] = get_post_meta($array['postID'], 'nc_pinterestImage', true);
            if ($array['imageID']) {
                $array['imageURL'] = wp_get_attachment_url($array['imageID']);
                delete_post_meta($array['postID'], 'sw_pinterest_image_url');
                update_post_meta($array['postID'], 'sw_pinterest_image_url', $array['imageURL']);
            } else {
                $array['imageURL'] = wp_get_attachment_url(get_post_thumbnail_id($array['postID']));
                delete_post_meta($array['postID'], 'sw_pinterest_image_url');
            }
        } else {
            // Check if we have a cached Open Graph Image URL
            $array['imageURL'] = get_post_meta($array['postID'], 'sw_pinterest_image_url', true);
            // If not, let's check to see if we have an ID to generate one
            if (!$array['imageURL']) {
                // Check for an Open Graph Image ID
                $array['imageID'] = get_post_meta($array['postID'], 'nc_pinterestImage', true);
                if ($array['imageID']) {
                    // If we find one, let's convert it to a link and cache it for next time
                    $array['imageURL'] = wp_get_attachment_url($array['imageID']);
                    delete_post_meta($array['postID'], 'sw_pinterest_image_url');
                    update_post_meta($array['postID'], 'sw_pinterest_image_url', $array['imageURL']);
                } else {
                    // If we don't find one, let's see if we can use a post thumbnail
                    $array['imageURL'] = wp_get_attachment_url(get_post_thumbnail_id($array['postID']));
                }
            }
        }
        $pd = get_post_meta($array['postID'], 'nc_pinterestDescription', true);
        if ($array['imageURL']) {
            $pi = '&media=' . urlencode(html_entity_decode($array['imageURL'], ENT_COMPAT, 'UTF-8'));
        } else {
            $pi = '';
        }
        $pinterestLink = $array['url'];
        $title = strip_tags(get_the_title($array['postID']));
        $title = str_replace('|', '', $title);
        if ($pi != '') {
            $a = '<a data-link="https://pinterest.com/pin/create/button/?url=' . $pinterestLink . '' . $pi . '&description=' . ($pd != '' ? urlencode(html_entity_decode($pd, ENT_COMPAT, 'UTF-8')) : urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8'))) . '" class="nc_tweet" data-count="0">';
        } else {
            $a = '<a onClick="var e=document.createElement(\'script\');e.setAttribute(\'type\',\'text/javascript\');e.setAttribute(\'charset\',\'UTF-8\');e.setAttribute(\'src\',\'//assets.pinterest.com/js/pinmarklet.js?r=\'+Math.random()*99999999);document.body.appendChild(e);" class="nc_tweet noPop">';
        }
        $array['resource']['pinterest'] = '<div class="nc_tweetContainer nc_pinterest" data-id="' . $array['count'] . '">';
        $array['resource']['pinterest'] .= $a;
        if ($array['options']['totesEach'] && $array['totes'] >= $array['options']['minTotes'] && $array['shares']['pinterest'] > 0) {
            $array['resource']['pinterest'] .= '<span class="iconFiller">';
            $array['resource']['pinterest'] .= '<span class="spaceManWilly" style="width:55px;">';
            $array['resource']['pinterest'] .= '<i class="sw sw-pinterest"></i>';
            $array['resource']['pinterest'] .= '<span class="sw_share"> ' . $array['language']['pinterest'] . '</span>';
            $array['resource']['pinterest'] .= '</span></span>';
            $array['resource']['pinterest'] .= '<span class="sw_count">' . kilomega($array['shares']['pinterest']) . '</span>';
        } else {
            $array['resource']['pinterest'] .= '<span class="sw_count sw_hide"><span class="iconFiller"><span class="spaceManWilly" style="width:55px;"><i class="sw sw-pinterest"></i><span class="sw_share"> ' . $array['language']['pinterest'] . '</span></span></span></span>';
        }
        $array['resource']['pinterest'] .= '</a>';
        $array['resource']['pinterest'] .= '</div>';
        // Store these buttons so that we don't have to generate them for each set
        $_GLOBALS['sw']['buttons'][$array['postID']]['pinterest'] = $array['resource']['pinterest'];
    }
    return $array;
}
function socialWarfareSideFloat()
{
    $postID = get_the_ID();
    $options = sw_get_user_options();
    $postType = get_post_type($postID);
    if (is_singular('post')) {
        $visibility = $options['floatLocationPost'];
    } elseif (is_singular('page')) {
        $visibility = $options['floatlocationPage'];
    } elseif (is_singular()) {
        $postType = get_post_type($postID);
        if (isset($options['floatLocation' . $postType])) {
            $visilibity = $options['floatLocation' . $postType];
        } else {
            $visibility = 'on';
        }
    } else {
        $visibility = 'on';
    }
    if (is_singular() && get_post_status($postID) == 'publish' && get_post_meta($postID, 'nc_floatLocation', true) != 'off' && $visibility == 'on' && !is_home()) {
        // Get the options...or create them if they don't exist
        wp_reset_query();
        // Acquire the social stats from the networks
        // Acquire the social stats from the networks
        if (isset($array['url'])) {
            $buttonsArray['url'] = $array['url'];
        } else {
            $buttonsArray['url'] = get_permalink($postID);
        }
        if ($options['float'] && is_singular()) {
            $floatOption = 'float' . ucfirst($options['floatOption']);
        } else {
            $floatOption = 'floatNone';
        }
        $language = array();
        $language = apply_filters('sw_languages', $language);
        if ($options['floatStyleSource'] == true) {
            $options['sideDColorSet'] = $options['dColorSet'];
            $options['sideIColorSet'] = $options['iColorSet'];
            $options['sideOColorSet'] = $options['oColorSet'];
        }
        // Setup the buttons array to pass into the 'sw_network_buttons' hook
        $buttonsArray['shares'] = get_social_warfare_shares($postID);
        $buttonsArray['language'] = apply_filters('sw_languages', $language);
        $buttonsArray['count'] = 0;
        $buttonsArray['totes'] = 0;
        $buttonsArray['options'] = $options;
        if ($buttonsArray['options']['totes'] && $buttonsArray['shares']['totes'] >= $buttonsArray['options']['minTotes']) {
            ++$buttonsArray['count'];
        }
        $buttonsArray['resource'] = array();
        $buttonsArray['postID'] = $postID;
        $buttonsArray = apply_filters('sw_network_buttons', $buttonsArray);
        // Create the social panel
        $assets = '<div class="nc_socialPanelSide nc_socialPanel sw_' . $options['floatStyle'] . ' sw_d_' . $options['sideDColorSet'] . ' sw_i_' . $options['sideIColorSet'] . ' sw_o_' . $options['sideOColorSet'] . '" data-position="' . $options['locationPost'] . '" data-float="' . $floatOption . '" data-count="' . $buttonsArray['count'] . '" data-floatColor="' . $options['floatBgColor'] . '" data-screen-width="' . $options['sw_float_scr_sz'] . '">';
        // Display Total Shares if the Threshold has been met
        if ($options['totes'] && $buttonsArray['totes'] >= $options['minTotes']) {
            $assets .= '<div class="nc_tweetContainer totes totesalt" data-id="6" >';
            $assets .= '<span class="sw_count">' . kilomega($buttonsArray['totes']) . '</span><span class="sw_label"> ' . $language['total'] . '</span>';
            $assets .= '</div>';
        }
        $i = 0;
        if ($options['orderOfIconsSelect'] == 'manual') {
            foreach ($options['newOrderOfIcons'] as $thisIcon => $status) {
                if (isset($buttonsArray['resource'][$thisIcon])) {
                    $assets .= $buttonsArray['resource'][$thisIcon];
                    ++$i;
                }
                if ($i == 5) {
                    break;
                }
            }
        } elseif ($options['orderOfIconsSelect'] == 'dynamicCount') {
            arsort($buttonsArray['shares']);
            foreach ($buttonsArray['shares'] as $thisIcon => $status) {
                if (isset($buttonsArray['resource'][$thisIcon])) {
                    $assets .= $buttonsArray['resource'][$thisIcon];
                    ++$i;
                }
                if ($i == 5) {
                    break;
                }
            }
        }
        // Close the Social Panel
        $assets .= '</div>';
        echo $assets;
    }
}
Example #7
0
function sw_twitter_button_html($array)
{
    // If we've already generated this button, just use our existing html
    if (isset($_GLOBALS['sw']['buttons'][$array['postID']]['twitter'])) {
        $array['resource']['twitter'] = $_GLOBALS['sw']['buttons'][$array['postID']]['twitter'];
        // If not, let's check if Facebook is activated and create the button HTML
    } elseif (isset($array['options']['twitter']) && $array['options']['twitter']) {
        $array['totes'] += $array['shares']['twitter'];
        ++$array['count'];
        $title = strip_tags(get_the_title($array['postID']));
        $title = str_replace('|', '', $title);
        $ct = get_post_meta($array['postID'], 'nc_customTweet', true);
        $ct = $ct != '' ? urlencode(html_entity_decode($ct, ENT_COMPAT, 'UTF-8')) : urlencode(html_entity_decode($title, ENT_COMPAT, 'UTF-8'));
        $twitterLink = sw_process_url($array['url'], 'twitter', $array['postID']);
        if (strpos($ct, 'http') !== false) {
            $urlParam = '&url=/';
        } else {
            $urlParam = '&url=' . $twitterLink;
        }
        if (sw_is_cache_fresh($array['postID']) == false) {
            $user_twitter_handle = get_the_author_meta('sw_twitter', sw_get_author($array['postID']));
            if ($user_twitter_handle) {
                delete_post_meta($array['postID'], 'sw_twitter_username');
                update_post_meta($array['postID'], 'sw_twitter_username', $user_twitter_handle);
            } else {
                delete_post_meta($array['postID'], 'sw_twitter_username');
            }
        } else {
            $user_twitter_handle = get_post_meta($array['postID'], 'sw_twitter_username', true);
        }
        if ($user_twitter_handle) {
            $viaText = '&via=' . $user_twitter_handle;
        } elseif ($array['options']['twitterID']) {
            $viaText = '&via=' . $array['options']['twitterID'];
        } else {
            $viaText = '';
        }
        $array['resource']['twitter'] = '<div class="nc_tweetContainer twitter" data-id="' . $array['count'] . '">';
        $array['resource']['twitter'] .= '<a href="https://twitter.com/share?original_referer=/&text=' . $ct . '' . $urlParam . '' . $viaText . '" data-link="https://twitter.com/share?original_referer=/&text=' . $ct . '' . $urlParam . '' . $viaText . '" class="nc_tweet">';
        if ($array['options']['totesEach'] && $array['totes'] >= $array['options']['minTotes'] && $array['shares']['twitter'] > 0) {
            $array['resource']['twitter'] .= '<span class="iconFiller">';
            $array['resource']['twitter'] .= '<span class="spaceManWilly">';
            $array['resource']['twitter'] .= '<i class="sw sw-twitter"></i>';
            $array['resource']['twitter'] .= '<span class="sw_share"> ' . $array['language']['twitter'] . '</span>';
            $array['resource']['twitter'] .= '</span></span>';
            $array['resource']['twitter'] .= '<span class="sw_count">' . kilomega($array['shares']['twitter']) . '</span>';
        } else {
            $array['resource']['twitter'] .= '<span class="sw_count sw_hide"><span class="iconFiller"><span class="spaceManWilly"><i class="sw sw-twitter"></i><span class="sw_share"> ' . $array['language']['twitter'] . '</span></span></span></span>';
        }
        $array['resource']['twitter'] .= '</a>';
        $array['resource']['twitter'] .= '</div>';
        // Store these buttons so that we don't have to generate them for each set
        $_GLOBALS['sw']['buttons'][$array['postID']]['twitter'] = $array['resource']['twitter'];
    }
    return $array;
}