/** * Instance * This functions returns the only one true instance of the plugin main class * * @return object instance * @since 1.0 */ public static function instance() { if (self::$instance == null) { self::$instance = new SFMSB(); self::$instance->constants(); self::$instance->includes(); self::$instance->load_textdomain(); self::$instance->variables(); } return self::$instance; }
/** * widget * * @param array $args Arguments * @param array $instance Settings for the widget */ function widget($args, $instance) { extract($args); $instance = wp_parse_args((array) $instance, $this->defaults); echo $before_widget; $title = apply_filters('widget_title', $instance['title']); // ** do_action do_action('sfmsb_widget_pre_buttons'); echo '<div'; echo ' class="sfmsb-follow-social-buttons sfmsb-' . $instance['position'] . ' sfmsb-' . $instance['style'] . ' ' . $instance['size'] . ' sfmsb-' . $instance['layout'] . '"'; if ($instance['hover_color']) { echo ' data-hover="' . $instance['hover_color'] . '"'; } echo '>'; if (!empty($title)) { echo $before_title . $title . $after_title; } switch (TRUE) { case $instance['size'] <= 25: $text_size = 14; break; case $instance['size'] > 25 && $instance['size'] < 35: $text_size = $instance['size'] / 2 + 3; break; case $instance['size'] >= 35: $text_size = $instance['size'] / 2; break; } if (!empty($instance['text'])) { echo '<span class="sfmsb-text" style="font-size:' . $text_size . 'px;">' . $instance['text'] . '</span>'; } // ** do_action do_action('sfmsb_widget_before_links'); foreach (SFMSB::instance()->available_buttons as $key => $item) { if (isset($instance['url_' . $key]) && $instance['url_' . $key] != '') { // color (default or custom) $instance['color'] == '' ? $color = '#' . $item['color'] : ($color = $instance['color']); switch (TRUE) { /** * icon EMAIL */ case $key == 'email' && filter_var($instance['url_' . $key], FILTER_VALIDATE_EMAIL): $href = 'mailto:' . esc_attr($instance['url_' . $key]); break; /** * icon SKYPE */ /** * icon SKYPE */ case $key == 'skype': $href = 'skype:' . esc_attr($instance['url_' . $key]) . '?call'; break; /** * icon DEFAULT */ /** * icon DEFAULT */ default: $href = esc_url($instance['url_' . $key]); break; } $icon = '<a target="_blank" href="' . $href . '">'; $icon .= '<span class="sfmsb-icon-' . $key . ' sfmsb-' . $instance['style'] . '"'; $icon .= ' style="color:' . $color . ';font-size:' . $instance['size'] . 'px;"'; $icon .= ' data-color="' . $color . '"'; $icon .= '></span>'; $icon .= '</a>'; echo apply_filters('sfmsbw_widget_icon', $icon, $key, $instance); } // if enabled } // foreach // ** do_action do_action('sfmsb_widget_after_links'); echo '<div class="sfmsb-clearfix"></div></div>'; // ** do_action do_action('sfmsb_widget_pos_buttons'); echo $after_widget; }