Example #1
0
 public static function xing_share_button($attributes)
 {
     if (!empty($attributes['follow_url'])) {
         $attributes['follow-url'] = $attributes['follow_url'];
         unset($attributes['follow_url']);
     }
     $shortcode_attributes = shortcode_atts(array('url' => '', 'layout' => '', 'lang' => '', 'follow-url' => ''), $attributes, 'xing_share_button');
     if (!function_exists('xing_get_share_button')) {
         require_once dirname(__FILE__) . '/functions.php';
     }
     return xing_get_share_button($shortcode_attributes);
 }
Example #2
0
function xing_the_content_share_button($content)
{
    global $post;
    // Share Buttons should not be the only content in the post
    if (!$content) {
        return $content;
    }
    $options = get_option('xing_share');
    if (!is_array($options)) {
        $options = array();
    }
    if (!isset($options['display_on'])) {
        return $content;
    }
    $share_button_options['layout'] = $options['layout'];
    $share_button_options['url'] = get_permalink($post->ID);
    $share_button_options['lang'] = $options['language'];
    $share_button_options['follow-url'] = $options['is_valid_follow_url'] ? $options['follow_url'] : null;
    if ($options['follow_enabled'] === 'true' && $options['is_valid_follow_url']) {
        $follow_button_options['url'] = $options['follow_url'];
        $follow_button_options['lang'] = $options['language'];
        if (!empty($options['follow_counter'])) {
            $follow_button_options['counter'] = 'right';
        }
    }
    $wrappedButtons = xing_wrap_button_with_container($options['label'], xing_get_share_button($share_button_options), xing_get_follow_button($follow_button_options));
    if ($options['position'] === 'before') {
        return $wrappedButtons . $content;
    } else {
        if ($options['position'] === 'after') {
            return $content . $wrappedButtons;
        } else {
            if ($options['position'] === 'both') {
                return $wrappedButtons . $content . $wrappedButtons;
            }
        }
    }
    // don't break the filter
    return $content;
}