Code Duplication    Length = 61-61 lines in 3 locations

widgets/invoice-history.php 1 location

@@ 11-71 (lines=61) @@
8
 *
9
 * @since 1.0.22
10
 */
11
class WPInv_History_Widget extends WP_Super_Duper {
12
13
    /**
14
     * Register the widget with WordPress.
15
     *
16
     */
17
    public function __construct() {
18
19
20
        $options = array(
21
            'textdomain'    => 'invoicing',
22
            'block-icon'    => 'admin-site',
23
            'block-category'=> 'widgets',
24
            'block-keywords'=> "['invoicing','history']",
25
            'class_name'     => __CLASS__,
26
            'base_id'       => 'wpinv_history',
27
            'name'          => __('Invoicing > Invoice History','invoicing'),
28
            'widget_ops'    => array(
29
                'classname'   => 'wpinv-history-class',
30
                'description' => esc_html__('Displays invoice history.','invoicing'),
31
            ),
32
            'arguments'     => array(
33
                'title'  => array(
34
                    'title'       => __( 'Widget title', 'invoicing' ),
35
                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
36
                    'type'        => 'text',
37
                    'desc_tip'    => true,
38
                    'default'     => '',
39
                    'advanced'    => false
40
                ),
41
            )
42
43
        );
44
45
46
        parent::__construct( $options );
47
    }
48
49
	/**
50
	 * The Super block output function.
51
	 *
52
	 * @param array $args
53
	 * @param array $widget_args
54
	 * @param string $content
55
	 *
56
	 * @return mixed|string|bool
57
	 */
58
    public function output( $args = array(), $widget_args = array(), $content = '' ) {
59
60
	    ob_start();
61
62
	    do_action( 'wpinv_before_user_invoice_history' );
63
	    wpinv_get_template_part( 'wpinv-invoice-history' );
64
	    do_action( 'wpinv_after_user_invoice_history' );
65
66
	    $output = ob_get_clean();
67
	    return trim($output);
68
69
    }
70
71
}

widgets/invoice-receipt.php 1 location

@@ 9-69 (lines=61) @@
6
/**
7
 * Invoice receipt widget.
8
 */
9
class WPInv_Receipt_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','receipt']",
23
            'class_name'     => __CLASS__,
24
            'base_id'       => 'wpinv_receipt',
25
            'name'          => __('Invoicing > Invoice Receipt','invoicing'),
26
            'widget_ops'    => array(
27
                'classname'   => 'wpinv-receipt-class',
28
                'description' => esc_html__('Displays invoice receipt after checkout.','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_success_content_before' );
61
	    echo wpinv_payment_receipt( $args );
62
	    do_action( 'wpinv_success_content_after' );
63
64
	    $output = ob_get_clean();
65
	    return trim($output);
66
67
    }
68
69
}

widgets/subscriptions.php 1 location

@@ 11-71 (lines=61) @@
8
 *
9
 * @since 1.0.22
10
 */
11
class WPInv_Subscriptions_Widget extends WP_Super_Duper {
12
13
    /**
14
     * Register the widget with WordPress.
15
     *
16
     */
17
    public function __construct() {
18
19
20
        $options = array(
21
            'textdomain'    => 'invoicing',
22
            'block-icon'    => 'admin-site',
23
            'block-category'=> 'widgets',
24
            'block-keywords'=> "['invoicing','subscriptions']",
25
            'class_name'     => __CLASS__,
26
            'base_id'       => 'wpinv_subscriptions',
27
            'name'          => __('Invoicing > Subscriptions History','invoicing'),
28
            'widget_ops'    => array(
29
                'classname'   => 'wpinv-checkout-class',
30
                'description' => esc_html__('Displays subscriptions history.','invoicing'),
31
            ),
32
            'arguments'     => array(
33
                'title'  => array(
34
                    'title'       => __( 'Widget title', 'invoicing' ),
35
                    'desc'        => __( 'Enter widget title.', 'invoicing' ),
36
                    'type'        => 'text',
37
                    'desc_tip'    => true,
38
                    'default'     => '',
39
                    'advanced'    => false
40
                ),
41
            )
42
43
        );
44
45
46
        parent::__construct( $options );
47
    }
48
49
	/**
50
	 * The Super block output function.
51
	 *
52
	 * @param array $args
53
	 * @param array $widget_args
54
	 * @param string $content
55
	 *
56
	 * @return mixed|string|bool
57
	 */
58
    public function output( $args = array(), $widget_args = array(), $content = '' ) {
59
60
	    ob_start();
61
62
	    do_action( 'wpinv_before_user_subscriptions' );
63
	    wpinv_get_template_part( 'wpinv-subscriptions-history' );
64
	    do_action( 'wpinv_after_user_subscriptions' );
65
66
	    $output = ob_get_clean();
67
	    return trim($output);
68
69
    }
70
71
}