/** * Counter. * * @param array $atts Shortcode attributes. * * @return string Counter in text. */ public static function counter($atts) { $count = Social_Count_Plus_Generator::get_count(); extract(shortcode_atts(array('code' => 'twitter'), $atts)); $counter = $count[$code]; return apply_filters('social_count_plus_number_format', $counter); }
/** * Widget view. * * @return string */ public static function get_view() { wp_enqueue_style('social-count-plus'); $settings = get_option('socialcountplus_settings'); $design = get_option('socialcountplus_design'); $count = Social_Count_Plus_Generator::get_count(); $color = isset($design['text_color']) ? $design['text_color'] : '#333333'; $icons = isset($design['icons']) ? array_map('sanitize_key', explode(',', $design['icons'])) : array(); $style = self::get_view_model($design['models']); $html = '<div class="social-count-plus">'; $html .= '<ul class="' . $style . '">'; foreach ($icons as $icon) { $class = 'social_count_plus_' . $icon . '_counter'; if (!isset($count[$icon])) { continue; } $total = apply_filters('social_count_plus_number_format', $count[$icon]); if (class_exists($class)) { $_class = new $class(); $html .= $_class->get_view($settings, $total, $color); } else { $html .= apply_filters('social_count_plus_' . $icon . 'html_counter', '', $settings, $total, $color); } } $html .= '</ul>'; $html .= '</div>'; return $html; }
/** * Widget view. * * @return string */ public static function get_view() { wp_enqueue_style('social-count-plus'); $settings = get_option('socialcountplus_settings'); $design = get_option('socialcountplus_design'); $count = Social_Count_Plus_Generator::get_count(); $color = isset($design['text_color']) ? $design['text_color'] : '#333333'; $icons = isset($design['icons']) ? explode(',', $design['icons']) : array(); // Sets view design. $style = ''; switch ($design['models']) { case 1: $style = 'default vertical'; break; case 2: $style = 'circle'; break; case 3: $style = 'circle vertical'; break; case 4: $style = 'flat'; break; case 5: $style = 'flat vertical'; break; case 6: $style = 'custom'; break; case 7: $style = 'custom vertical'; break; default: $style = 'default'; break; } $html = '<div class="social-count-plus">'; $html .= '<ul class="' . $style . '">'; foreach ($icons as $icon) { $method = 'get_' . $icon . '_counter'; $html .= self::$method($settings, $count[$icon], $color); } $html .= '</ul>'; $html .= '</div>'; return $html; }
/** * All counters function. * * @return array All counts. */ function get_scp_all() { $count = Social_Count_Plus_Generator::get_count(); return $count; }
/** * Comments counter function. * * @deprecated since 3.2.0 * * @return int Comments count. */ function get_scp_comments() { _deprecated_function('get_scp_comments', '3.2.0', 'get_scp_counter'); $count = Social_Count_Plus_Generator::get_count(); return $count['comments']; }