Passed
Push — master ( c93677...8aa7be )
by Brian
10:03 queued 04:50
created

WPInv_Subscriptions_Widget::print_table_header()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 33
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 34
c 1
b 0
f 0
dl 0
loc 33
rs 9.376
cc 2
nc 2
nop 0
1
<?php
2
if ( ! defined( 'ABSPATH' ) ) {
3
    exit;
4
}
5
6
/**
7
 * Invoicing subscriptions history widget.
8
 */
9
class WPInv_Subscriptions_Widget extends WP_Super_Duper {
10
11
    /**
12
     * Register the widget with WordPress.
13
     *
14
     */
15
    public function __construct() {
16
17
18
        $options = array(
19
            'textdomain'    => 'invoicing',
20
            'block-icon'    => 'admin-site',
21
            'block-category'=> 'widgets',
22
            'block-keywords'=> "['invoicing','subscriptions']",
23
            'class_name'     => __CLASS__,
24
            'base_id'       => 'wpinv_subscriptions',
25
            'name'          => __('GetPaid > Subscriptions History','invoicing'),
26
            'widget_ops'    => array(
27
                'classname'   => 'wpinv-checkout-class  wpi-g',
28
                'description' => esc_html__('Displays subscriptions history.','invoicing'),
29
            ),
30
            'arguments'     => array(
31
                'title'  => array(
32
                    'title'       => __( 'Widget title', 'invoicing' ),
33
                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
34
                    'type'        => 'text',
35
                    'desc_tip'    => true,
36
                    'default'     => '',
37
                    'advanced'    => false
38
                ),
39
            )
40
41
        );
42
43
44
        parent::__construct( $options );
45
    }
46
47
	/**
48
	 * The Super block output function.
49
	 *
50
	 * @param array $args
51
	 * @param array $widget_args
52
	 * @param string $content
53
	 *
54
	 * @return mixed|string|bool
55
	 */
56
    public function output( $args = array(), $widget_args = array(), $content = '' ) {
57
58
	    ob_start();
59
60
	    do_action( 'wpinv_before_user_subscriptions' );
61
	    wpinv_get_template_part( 'wpinv-subscriptions-history' );
62
	    do_action( 'wpinv_after_user_subscriptions' );
63
64
	    $output = ob_get_clean();
65
	    return trim($output);
66
67
    }
68
69
}