PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
← All changes | includes/widgets/earnings-widget.php +48 -0 7.9.1 → 8.0.5 View file →
@@ -1,0 +1,48 @@
1 +<?php
2 +/**
3 + * User Earnings Widget
4 + *
5 + * @package GamiPress\Widgets\Widget\Earnings
6 + * @author GamiPress <[email protected]>, Ruben Garcia <[email protected]>
7 + * @since 1.3.9
8 + */
9 +// Exit if accessed directly
10 +if( !defined( 'ABSPATH' ) ) exit;
11 +
12 +class GamiPress_Earnings_Widget extends GamiPress_Widget {
13 +
14 + /**
15 + * Shortcode for this widget.
16 + *
17 + * @var string
18 + */
19 + protected $shortcode = 'gamipress_earnings';
20 +
21 + public function __construct() {
22 + parent::__construct(
23 + $this->shortcode . '_widget',
24 + __( 'GamiPress: User Earnings', 'gamipress' ),
25 + __( 'Display a list of user earnings.', 'gamipress' )
26 + );
27 + }
28 +
29 + public function get_tabs() {
30 + $tabs = GamiPress()->shortcodes[$this->shortcode]->tabs;
31 +
32 + // Add the widget title field to the general tab
33 + $tabs['general']['fields'][] = 'title';
34 +
35 + return $tabs;
36 + }
37 +
38 + public function get_fields() {
39 + return GamiPress()->shortcodes[$this->shortcode]->fields;
40 + }
41 +
42 + public function get_widget( $args, $instance ) {
43 + // Build shortcode attributes from widget instance
44 + $atts = gamipress_build_shortcode_atts( $this->shortcode, $instance );
45 +
46 + echo gamipress_do_shortcode( $this->shortcode, $atts );
47 + }
48 +}