function mashshareShortcodeShow($atts, $place)
{
    global $wpdb, $mashsb_options, $post, $wp;
    $mainurl = mashsb_get_url();
    !empty($mashsb_options['sharecount_title']) ? $sharecount_title = $mashsb_options['sharecount_title'] : ($sharecount_title = __('SHARES', 'mashsb'));
    function_exists('MASHOG') ? $title = MASHOG()->MASHOG_OG_Output->_get_title() : ($title = the_title_attribute('echo=0'));
    $title = html_entity_decode($title, ENT_QUOTES, 'UTF-8');
    $title = urlencode($title);
    $title = str_replace('#', '%23', $title);
    $title = esc_html($title);
    $sharecount = '';
    extract(shortcode_atts(array('cache' => '3600', 'shares' => 'true', 'buttons' => 'true', 'align' => 'left', 'url' => ''), $atts));
    /* Load hashshag*/
    if ($mashsb_options['mashsharer_hashtag'] != '') {
        $via = '&via=' . $mashsb_options['mashsharer_hashtag'];
    } else {
        $via = '';
    }
    // Define url to share
    $url = !empty($url) ? $url : $mainurl;
    if ($shares != 'false') {
        /* get totalshares of the current page with sharedcount.com */
        $totalshares = getSharedcount($mainurl);
        /* Round total shares when enabled */
        $roundenabled = isset($mashsb_options['mashsharer_round']) ? $mashsb_options['mashsharer_round'] : null;
        if ($roundenabled) {
            $totalshares = roundshares($totalshares);
        }
        $sharecount = '<div class="mashsb-count" style="float:' . $align . ';"><div class="counts">' . $totalshares . '</div><span class="mashsb-sharetext">' . $sharecount_title . '</span></div>';
        /*If shortcode [mashshare shares="true" onlyshares="true"]
         * return shares and exit;
         */
        if ($shares === "true" && $buttons === 'false') {
            return $sharecount;
        }
        if ($shares === "false" && $buttons === 'true') {
            $sharecount = '';
        }
    }
    $return = '<aside class="mashsb-container">' . mashsb_content_above() . '<div class="mashsb-box">' . $sharecount . '<div class="mashsb-buttons">' . getNetworks($url, $title) . '</div></div>
                    <div style="clear:both;"></div>' . mashsb_subscribe_content() . mashsb_content_below() . '</aside>
                        <!-- Share buttons made by mashshare.net - Version: ' . MASHSB_VERSION . '-->';
    return apply_filters('mashsb_output_buttons', $return);
}
Ejemplo n.º 2
0
function mashshareShortcodeShow($atts, $place)
{
    global $wpdb, $mashsb_options, $post, $wp, $mashsb_custom_url, $mashsb_custom_text;
    //$mainurl = mashsb_get_url();
    !empty($mashsb_options['sharecount_title']) ? $sharecount_title = $mashsb_options['sharecount_title'] : ($sharecount_title = __('SHARES', 'mashsb'));
    $sharecount = '';
    extract(shortcode_atts(array('cache' => '3600', 'shares' => 'true', 'buttons' => 'true', 'align' => 'left', 'text' => '', 'url' => ''), $atts));
    /* Load hashshag*/
    if (!empty($mashsb_options['mashsharer_hashtag'])) {
        $via = '&amp;via=' . $mashsb_options['mashsharer_hashtag'];
    } else {
        $via = '';
    }
    // Define custom url var to share
    $mashsb_custom_url = empty($url) ? false : $url;
    // Define custom text to share
    $mashsb_custom_text = empty($text) ? false : $text;
    //$sharecount_url = empty($url) ? mashsb_get_url() : $url;
    if ($shares != 'false') {
        /* get totalshares of the current page with sharedcount.com */
        $totalshares = getSharedcount($mashsb_custom_url);
        //$totalshares = getSharedcount($mainurl);
        //$totalshares = $mashsb_custom_url;
        /* Round total shares when enabled */
        $roundenabled = isset($mashsb_options['mashsharer_round']) ? $mashsb_options['mashsharer_round'] : null;
        if ($roundenabled) {
            $totalshares = roundshares($totalshares);
        }
        $sharecount = '<div class="mashsb-count" style="float:' . $align . ';"><div class="counts">' . $totalshares . '</div><span class="mashsb-sharetext">' . $sharecount_title . '</span></div>';
        /*If shortcode [mashshare shares="true" onlyshares="true"]
         * return shares and exit;
         */
        if ($shares === "true" && $buttons === 'false') {
            return $sharecount;
        }
        if ($shares === "false" && $buttons === 'true') {
            $sharecount = '';
        }
    }
    $return = '<aside class="mashsb-container">' . mashsb_content_above() . '<div class="mashsb-box">' . $sharecount . '<div class="mashsb-buttons">' . getNetworks() . '</div></div>
                    <div style="clear:both;"></div>' . mashsb_subscribe_content() . mashsb_content_below() . '</aside>
                        <!-- Share buttons made by mashshare.net - Version: ' . MASHSB_VERSION . '-->';
    // Do not execute filter for excerpts
    //if(in_array('get_the_excerpt', $GLOBALS['wp_current_filter'])) apply_filters( 'mashsb_output_buttons', '' );
    return apply_filters('mashsb_output_buttons', $return);
}
Ejemplo n.º 3
0
function mashshareShortcodeShow($args)
{
    global $mashsb_options, $mashsb_custom_url, $mashsb_custom_text;
    $sharecount = '';
    //Filter shortcode args to add an option for developers to change (add) some args
    apply_filters('mashsb_shortcode_atts', $args);
    extract(shortcode_atts(array('cache' => '3600', 'shares' => 'true', 'buttons' => 'true', 'services' => '0', 'align' => 'left', 'text' => '', 'url' => ''), $args));
    // Visible services
    $count_services = !empty($services) ? $services : 0;
    // Define custom url var to share
    //$mashsb_custom_url = empty( $url ) ? mashsb_get_url() : $url;
    // The global available custom url to share
    $mashsb_custom_url = !empty($url) ? $url : '';
    // local url
    $mashsb_url = empty($url) ? mashsb_get_url() : $url;
    // Define custom text to share
    $mashsb_custom_text = !empty($text) ? $text : false;
    if ($shares != 'false') {
        $sharecount = mashsb_render_sharecounts($mashsb_url, $align);
        // shortcode [mashshare shares="true" buttons="false"]
        if ($shares === "true" && $buttons === 'false') {
            return $sharecount;
        }
    }
    $class_stretched = isset($mashsb_options['responsive_buttons']) ? 'mashsb-stretched' : '';
    $return = '<aside class="mashsb-container mashsb-main ' . $class_stretched . '">' . mashsb_content_above() . '<div class="mashsb-box">' . $sharecount . '<div class="mashsb-buttons">' . mashsb_getNetworks(true, $count_services) . '</div></div>
                    <div style="clear:both;"></div>' . mashsb_subscribe_content() . mashsb_content_below() . '</aside>
            <!-- Share buttons made by mashshare.net - Version: ' . MASHSB_VERSION . '-->';
    return apply_filters('mashsb_output_buttons', $return);
}