'widget_dpa_leaderboard', 'description' => __( 'Your users ranked by their karma points.', 'dpa' ), ) ); parent::__construct( false, __( '(Achievements) Leaderboard', 'dpa' ), $widget_ops ); } /** * Register the widget * * @since Achievements (3.4) */ static public function register_widget() { register_widget( 'DPA_Leaderboard_Widget' ); } /** * Displays the output * * @param array $args * @param array $instance * @since Achievements (3.4) */ public function widget( $args, $instance ) { $settings = $this->parse_settings( $instance ); // Use this filter $settings['title'] = apply_filters( 'dpa_available_achievements_title', $settings['title'], $instance, $this->id_base ); // WordPress filters widget_title through esc_html. $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); echo $args['before_widget']; echo $args['before_title'] . $settings['title'] . $args['after_title']; dpa_get_template_part( 'content-leaderboard', 'widget' ); echo $args['after_widget']; } /** * Deals with the settings when they are saved by the admin. * * @param array $new_instance New settings * @param array $old_instance Old settings * @return array The validated and (if necessary) amended settings * @since Achievements (3.4) */ public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); return $instance; } /** * Output the widget options form * * @param array $instance The instance of the widget. * @since Achievements (3.4) */ public function form( $instance ) { $settings = $this->parse_settings( $instance ); ?>