/** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { $title = apply_filters('widget_title', $instance['title']); echo $args['before_widget']; if (!empty($title)) { echo $args['before_title'] . $title . $args['after_title']; } echo Social_Count_Plus_View::get_view(); echo $args['after_widget']; }
/** * Models element callback. * * @param array $args Field arguments. */ public function models_element_callback($args) { $tab = $args['tab']; $id = $args['id']; $default = isset($args['default']) ? $args['default'] : 0; $current = $this->get_option_value($id, $default); $html = ''; foreach ($args['options'] as $option) { $html .= sprintf('<input type="radio" name="%1$s[%2$s]" class="social-count-plus-model-input" value="%3$s"%4$s />', $tab, $id, $option, checked($current, $option, false)); $style = Social_Count_Plus_View::get_view_model($option); $html .= '<div class="social-count-plus">'; $html .= '<ul class="' . $style . '">'; foreach ($this->get_i18n_counters() as $slug => $name) { $class = 'social_count_plus_' . $slug . '_counter'; if (class_exists($class)) { $_class = new $class(); $html .= $_class->get_view(array(), 100, '#333333'); } } $html .= '</ul>'; $html .= '</div>'; } // Displays option description. if (isset($args['description'])) { $html .= sprintf('<p class="description">%s</p>', $args['description']); } echo $html; }
/** * Widget counter function. * * @return int Widget count. */ function get_scp_widget() { return Social_Count_Plus_View::get_view(); }