function arrNetworks($name)
{
    global $mashsb_options, $post, $mashsb_custom_url, $mashsb_custom_text;
    $singular = isset($mashsb_options['singular']) ? $singular = true : ($singular = false);
    $url = $mashsb_custom_url ? $mashsb_custom_url : mashsb_get_url();
    $twitter_url = $mashsb_custom_url ? $mashsb_custom_url : mashsb_get_twitter_url();
    $title = $mashsb_custom_text ? $mashsb_custom_text : mashsb_get_title();
    $twitter_title = $mashsb_custom_text ? $mashsb_custom_text : mashsb_get_twitter_title();
    !empty($mashsb_options['mashsharer_hashtag']) ? $via = '&via=' . $mashsb_options['mashsharer_hashtag'] : ($via = '');
    $networks = apply_filters('mashsb_array_networks', array('facebook' => 'http://www.facebook.com/sharer.php?u=' . $url, 'twitter' => 'https://twitter.com/intent/tweet?text=' . $twitter_title . $via . '&url=' . $twitter_url, 'subscribe' => '#', 'url' => $url, 'title' => mashsb_get_title()));
    return isset($networks[$name]) ? $networks[$name] : '';
}
示例#2
0
function arrNetworks($name, $is_shortcode)
{
    global $mashsb_custom_url, $mashsb_custom_text, $mashsb_twitter_url;
    if ($is_shortcode) {
        $url = !empty($mashsb_custom_url) ? urlencode($mashsb_custom_url) : urlencode(mashsb_get_url());
        $title = !empty($mashsb_custom_text) ? $mashsb_custom_text : mashsb_get_title();
        $twitter_title = !empty($mashsb_custom_text) ? $mashsb_custom_text : mashsb_get_twitter_title();
    }
    if (!$is_shortcode) {
        $url = urlencode(mashsb_get_url());
        $title = mashsb_get_title();
        $twitter_title = mashsb_get_twitter_title();
    }
    $via = mashsb_get_twitter_username() ? '&via=' . mashsb_get_twitter_username() : '';
    $networks_arr = array('facebook' => 'http://www.facebook.com/sharer.php?u=' . $url, 'twitter' => 'https://twitter.com/intent/tweet?text=' . $twitter_title . '&url=' . $mashsb_twitter_url . $via, 'subscribe' => '#', 'url' => $url, 'title' => $title);
    // Delete custom text
    unset($mashsb_custom_text);
    // Delete custom url
    unset($mashsb_custom_url);
    $networks = apply_filters('mashsb_array_networks', $networks_arr);
    return isset($networks[$name]) ? $networks[$name] : '';
}