/** * Return an instance of this class. * * @since 1.0.0 * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }
/** * Returns social buttons. * * @since 4.0.0 * * @return buttons */ public function bbpress_after_topics() { $networks = maybe_unserialize(UltimateSocialDeux::opt('us_bbpress_after_topics_buttons')); if (is_array($networks) && !empty($networks)) { $options = maybe_unserialize(UltimateSocialDeux::opt('us_bbpress_after_topics_options')); $sharetext = UltimateSocialDeux::opt('us_bbpress_after_topics_share_text'); $count = in_array('hide_count', $options) ? false : true; $native = in_array('native', $options) ? true : false; $align = UltimateSocialDeux::opt('us_bbpress_after_topics_align', 'center'); $margin_top = intval(UltimateSocialDeux::opt('us_bbpress_after_topics_margin_top', '0')); $margin_bottom = intval(UltimateSocialDeux::opt('us_bbpress_after_topics_margin_bottom', '0')); $skin = UltimateSocialDeux::opt('us_bbpress_after_topics_skin'); $custom_content = sprintf('<div class="us_bbpress_after_topics" style="margin-top:%spx;margin-bottom:%spx;">', $margin_top, $margin_bottom); $custom_content .= UltimateSocialDeuxButtons::buttons($sharetext, $networks, '', $align, $count, $native, $skin); $custom_content .= '</div>'; echo $custom_content; } }
function widget($args, $instance) { extract($args); // these are the widget options $share_text = isset($instance['us_w_share_text']) ? $instance['us_w_share_text'] : ''; $atts['names'] = !empty($instance['us_w_names']) ? 'names' : ''; $atts['total'] = !empty($instance['us_w_total']) ? 'total' : ''; $atts['facebook'] = !empty($instance['us_w_facebook']) ? 'facebook' : ''; $atts['facebook_native'] = !empty($instance['us_w_facebook_native']) ? 'facebook_native' : ''; $atts['twitter'] = !empty($instance['us_w_twitter']) ? 'twitter' : ''; $atts['google'] = !empty($instance['us_w_google']) ? 'google' : ''; $atts['google_native'] = !empty($instance['us_w_google_native']) ? 'google_native' : ''; $atts['pinterest'] = !empty($instance['us_w_pinterest']) ? 'pinterest' : ''; $atts['linkedin'] = !empty($instance['us_w_linkedin']) ? 'linkedin' : ''; $atts['stumble'] = !empty($instance['us_w_stumble']) ? 'stumble' : ''; $atts['delicious'] = !empty($instance['us_w_delicious']) ? 'delicious' : ''; $atts['buffer'] = !empty($instance['us_w_buffer']) ? 'buffer' : ''; $atts['reddit'] = !empty($instance['us_w_reddit']) ? 'reddit' : ''; $atts['vkontakte'] = !empty($instance['us_w_vkontakte']) ? 'vkontakte' : ''; $atts['vkontakte_native'] = !empty($instance['us_w_vkontakte_native']) ? 'vkontakte_native' : ''; $atts['love'] = !empty($instance['us_w_love']) ? 'love' : ''; $atts['pocket'] = !empty($instance['us_w_pocket']) ? 'pocket' : ''; $atts['flipboard'] = !empty($instance['us_w_flipboard']) ? 'flipboard' : ''; $atts['tumblr'] = !empty($instance['us_w_tumblr']) ? 'tumblr' : ''; $atts['ok'] = !empty($instance['us_w_ok']) ? 'ok' : ''; $atts['weibo'] = !empty($instance['us_w_weibo']) ? 'weibo' : ''; $atts['managewp'] = !empty($instance['us_w_managewp']) ? 'managewp' : ''; $atts['xing'] = !empty($instance['us_w_xing']) ? 'xing' : ''; $atts['print'] = !empty($instance['us_w_print']) ? 'print' : ''; $atts['mail'] = !empty($instance['us_w_mail']) ? 'mail' : ''; $atts['whatsapp'] = !empty($instance['us_w_whatsapp']) ? 'whatsapp' : ''; $count = !empty($instance['us_w_count']) ? false : true; $url = isset($instance['us_w_url']) ? $instance['us_w_url'] : ''; $align = !empty($instance['us_w_align']) ? $instance['us_w_align'] : ''; $skin = !empty($instance['us_w_skin']) ? $instance['us_w_skin'] : ''; $networks = ''; foreach ($atts as $key => $network) { $networks .= $network . ','; } echo $before_widget; if (class_exists('UltimateSocialDeux')) { echo UltimateSocialDeuxButtons::buttons($share_text, $networks, $url, $align, $count, false, $skin); } echo $after_widget; }
/** * Return shortcode markup for mail button * * @since 1.0.0 * * @return shortcode markup */ public function mail($atts) { $defaults = array('url' => '', 'custom_class' => '', 'align' => 'center', 'share_text' => '', 'skin' => ''); $atts = shortcode_atts($defaults, $atts); $shortcode = ''; $shortcode .= sprintf('<div class="us_shortcode %s">', $atts['custom_class']); $shortcode .= UltimateSocialDeuxButtons::buttons($atts['share_text'], 'mail', $atts['url'], $atts['align'], '', false, $atts['skin']); $shortcode .= '</div>'; return $shortcode; }