@@ -8,86 +8,86 @@ |
||
8 | 8 | */ |
9 | 9 | class WPInv_Receipt_Widget extends WP_Super_Duper { |
10 | 10 | |
11 | - /** |
|
12 | - * Register the widget with WordPress. |
|
13 | - * |
|
14 | - */ |
|
15 | - public function __construct() { |
|
16 | - |
|
17 | - $options = array( |
|
18 | - 'textdomain' => 'invoicing', |
|
19 | - 'block-icon' => 'admin-site', |
|
20 | - 'block-category' => 'widgets', |
|
21 | - 'block-keywords' => "['invoicing','receipt']", |
|
22 | - 'class_name' => __CLASS__, |
|
23 | - 'base_id' => 'wpinv_receipt', |
|
24 | - 'name' => __( 'GetPaid > Invoice Receipt', 'invoicing' ), |
|
25 | - 'widget_ops' => array( |
|
26 | - 'classname' => 'wpinv-receipt-class bsui', |
|
27 | - 'description' => esc_html__( 'Displays invoice receipt after checkout.', 'invoicing' ), |
|
28 | - ), |
|
29 | - 'arguments' => array( |
|
30 | - 'title' => array( |
|
31 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
32 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | - 'type' => 'text', |
|
34 | - 'desc_tip' => true, |
|
35 | - 'default' => '', |
|
36 | - 'advanced' => false, |
|
37 | - ), |
|
38 | - ), |
|
39 | - |
|
40 | - ); |
|
41 | - |
|
42 | - parent::__construct( $options ); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * The Super block output function. |
|
47 | - * |
|
48 | - * @param array $args |
|
49 | - * @param array $widget_args |
|
50 | - * @param string $content |
|
51 | - * |
|
52 | - * @return mixed|string|bool |
|
53 | - */ |
|
54 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
55 | - if ( $this->is_preview() ) { |
|
56 | - return $this->get_dummy_preview( $args ); |
|
57 | - } |
|
58 | - |
|
59 | - return wpinv_payment_receipt(); |
|
60 | - } |
|
61 | - |
|
62 | - public function get_dummy_preview( $args ) { |
|
63 | - global $wpdb; |
|
64 | - |
|
65 | - $output = aui()->alert( array( |
|
66 | - 'type'=> 'info', |
|
67 | - 'content' => __( 'This is a simple preview for a invoice receipt.', 'invoicing' ) |
|
68 | - ) |
|
69 | - ); |
|
70 | - |
|
71 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
72 | - return $output; |
|
73 | - } |
|
74 | - |
|
75 | - $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` = %s AND `post_status` IN( 'wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold' ) ORDER BY `post_status` ASC, `ID` ASC LIMIT 1;", 'wpi_invoice' ) ); |
|
76 | - |
|
77 | - if ( ! $invoice_id ) { |
|
78 | - return $output; |
|
79 | - } |
|
80 | - |
|
81 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
82 | - |
|
83 | - if ( empty( $invoice ) ) { |
|
84 | - return $output; |
|
85 | - } |
|
86 | - |
|
87 | - $output .= wpinv_get_template_html( 'invoice-receipt.php', array( 'invoice' => $invoice ) ); |
|
88 | - |
|
89 | - $output = preg_replace( '/<a([^>]*)href=(["\'])(.*?)\2([^>]*)>/is', '<a\\1href="javascript:void(0)"\\4>', $output ); |
|
90 | - |
|
91 | - return $output; |
|
92 | - } |
|
11 | + /** |
|
12 | + * Register the widget with WordPress. |
|
13 | + * |
|
14 | + */ |
|
15 | + public function __construct() { |
|
16 | + |
|
17 | + $options = array( |
|
18 | + 'textdomain' => 'invoicing', |
|
19 | + 'block-icon' => 'admin-site', |
|
20 | + 'block-category' => 'widgets', |
|
21 | + 'block-keywords' => "['invoicing','receipt']", |
|
22 | + 'class_name' => __CLASS__, |
|
23 | + 'base_id' => 'wpinv_receipt', |
|
24 | + 'name' => __( 'GetPaid > Invoice Receipt', 'invoicing' ), |
|
25 | + 'widget_ops' => array( |
|
26 | + 'classname' => 'wpinv-receipt-class bsui', |
|
27 | + 'description' => esc_html__( 'Displays invoice receipt after checkout.', 'invoicing' ), |
|
28 | + ), |
|
29 | + 'arguments' => array( |
|
30 | + 'title' => array( |
|
31 | + 'title' => __( 'Widget title', 'invoicing' ), |
|
32 | + 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
33 | + 'type' => 'text', |
|
34 | + 'desc_tip' => true, |
|
35 | + 'default' => '', |
|
36 | + 'advanced' => false, |
|
37 | + ), |
|
38 | + ), |
|
39 | + |
|
40 | + ); |
|
41 | + |
|
42 | + parent::__construct( $options ); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * The Super block output function. |
|
47 | + * |
|
48 | + * @param array $args |
|
49 | + * @param array $widget_args |
|
50 | + * @param string $content |
|
51 | + * |
|
52 | + * @return mixed|string|bool |
|
53 | + */ |
|
54 | + public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
55 | + if ( $this->is_preview() ) { |
|
56 | + return $this->get_dummy_preview( $args ); |
|
57 | + } |
|
58 | + |
|
59 | + return wpinv_payment_receipt(); |
|
60 | + } |
|
61 | + |
|
62 | + public function get_dummy_preview( $args ) { |
|
63 | + global $wpdb; |
|
64 | + |
|
65 | + $output = aui()->alert( array( |
|
66 | + 'type'=> 'info', |
|
67 | + 'content' => __( 'This is a simple preview for a invoice receipt.', 'invoicing' ) |
|
68 | + ) |
|
69 | + ); |
|
70 | + |
|
71 | + if ( ! current_user_can( 'manage_options' ) ) { |
|
72 | + return $output; |
|
73 | + } |
|
74 | + |
|
75 | + $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` = %s AND `post_status` IN( 'wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold' ) ORDER BY `post_status` ASC, `ID` ASC LIMIT 1;", 'wpi_invoice' ) ); |
|
76 | + |
|
77 | + if ( ! $invoice_id ) { |
|
78 | + return $output; |
|
79 | + } |
|
80 | + |
|
81 | + $invoice = new WPInv_Invoice( $invoice_id ); |
|
82 | + |
|
83 | + if ( empty( $invoice ) ) { |
|
84 | + return $output; |
|
85 | + } |
|
86 | + |
|
87 | + $output .= wpinv_get_template_html( 'invoice-receipt.php', array( 'invoice' => $invoice ) ); |
|
88 | + |
|
89 | + $output = preg_replace( '/<a([^>]*)href=(["\'])(.*?)\2([^>]*)>/is', '<a\\1href="javascript:void(0)"\\4>', $output ); |
|
90 | + |
|
91 | + return $output; |
|
92 | + } |
|
93 | 93 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if (!defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | 'block-keywords' => "['invoicing','receipt']", |
22 | 22 | 'class_name' => __CLASS__, |
23 | 23 | 'base_id' => 'wpinv_receipt', |
24 | - 'name' => __( 'GetPaid > Invoice Receipt', 'invoicing' ), |
|
24 | + 'name' => __('GetPaid > Invoice Receipt', 'invoicing'), |
|
25 | 25 | 'widget_ops' => array( |
26 | 26 | 'classname' => 'wpinv-receipt-class bsui', |
27 | - 'description' => esc_html__( 'Displays invoice receipt after checkout.', 'invoicing' ), |
|
27 | + 'description' => esc_html__('Displays invoice receipt after checkout.', 'invoicing'), |
|
28 | 28 | ), |
29 | 29 | 'arguments' => array( |
30 | 30 | 'title' => array( |
31 | - 'title' => __( 'Widget title', 'invoicing' ), |
|
32 | - 'desc' => __( 'Enter widget title.', 'invoicing' ), |
|
31 | + 'title' => __('Widget title', 'invoicing'), |
|
32 | + 'desc' => __('Enter widget title.', 'invoicing'), |
|
33 | 33 | 'type' => 'text', |
34 | 34 | 'desc_tip' => true, |
35 | 35 | 'default' => '', |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | ); |
41 | 41 | |
42 | - parent::__construct( $options ); |
|
42 | + parent::__construct($options); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,42 +51,42 @@ discard block |
||
51 | 51 | * |
52 | 52 | * @return mixed|string|bool |
53 | 53 | */ |
54 | - public function output( $args = array(), $widget_args = array(), $content = '' ) { |
|
55 | - if ( $this->is_preview() ) { |
|
56 | - return $this->get_dummy_preview( $args ); |
|
54 | + public function output($args = array(), $widget_args = array(), $content = '') { |
|
55 | + if ($this->is_preview()) { |
|
56 | + return $this->get_dummy_preview($args); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | return wpinv_payment_receipt(); |
60 | 60 | } |
61 | 61 | |
62 | - public function get_dummy_preview( $args ) { |
|
62 | + public function get_dummy_preview($args) { |
|
63 | 63 | global $wpdb; |
64 | 64 | |
65 | - $output = aui()->alert( array( |
|
65 | + $output = aui()->alert(array( |
|
66 | 66 | 'type'=> 'info', |
67 | - 'content' => __( 'This is a simple preview for a invoice receipt.', 'invoicing' ) |
|
67 | + 'content' => __('This is a simple preview for a invoice receipt.', 'invoicing') |
|
68 | 68 | ) |
69 | 69 | ); |
70 | 70 | |
71 | - if ( ! current_user_can( 'manage_options' ) ) { |
|
71 | + if (!current_user_can('manage_options')) { |
|
72 | 72 | return $output; |
73 | 73 | } |
74 | 74 | |
75 | - $invoice_id = $wpdb->get_var( $wpdb->prepare( "SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` = %s AND `post_status` IN( 'wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold' ) ORDER BY `post_status` ASC, `ID` ASC LIMIT 1;", 'wpi_invoice' ) ); |
|
75 | + $invoice_id = $wpdb->get_var($wpdb->prepare("SELECT `ID` FROM `{$wpdb->posts}` WHERE `post_type` = %s AND `post_status` IN( 'wpi-pending', 'publish', 'wpi-processing', 'wpi-onhold' ) ORDER BY `post_status` ASC, `ID` ASC LIMIT 1;", 'wpi_invoice')); |
|
76 | 76 | |
77 | - if ( ! $invoice_id ) { |
|
77 | + if (!$invoice_id) { |
|
78 | 78 | return $output; |
79 | 79 | } |
80 | 80 | |
81 | - $invoice = new WPInv_Invoice( $invoice_id ); |
|
81 | + $invoice = new WPInv_Invoice($invoice_id); |
|
82 | 82 | |
83 | - if ( empty( $invoice ) ) { |
|
83 | + if (empty($invoice)) { |
|
84 | 84 | return $output; |
85 | 85 | } |
86 | 86 | |
87 | - $output .= wpinv_get_template_html( 'invoice-receipt.php', array( 'invoice' => $invoice ) ); |
|
87 | + $output .= wpinv_get_template_html('invoice-receipt.php', array('invoice' => $invoice)); |
|
88 | 88 | |
89 | - $output = preg_replace( '/<a([^>]*)href=(["\'])(.*?)\2([^>]*)>/is', '<a\\1href="javascript:void(0)"\\4>', $output ); |
|
89 | + $output = preg_replace('/<a([^>]*)href=(["\'])(.*?)\2([^>]*)>/is', '<a\\1href="javascript:void(0)"\\4>', $output); |
|
90 | 90 | |
91 | 91 | return $output; |
92 | 92 | } |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | |
20 | 20 | // Define constants. |
21 | 21 | if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
22 | + define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | if ( ! defined( 'WPINV_VERSION' ) ) { |
26 | - define( 'WPINV_VERSION', '2.8.31' ); |
|
26 | + define( 'WPINV_VERSION', '2.8.31' ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | 30 | if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
31 | + require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
46 | - return $GLOBALS['invoicing']; |
|
46 | + return $GLOBALS['invoicing']; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -15,20 +15,20 @@ discard block |
||
15 | 15 | * @package GetPaid |
16 | 16 | */ |
17 | 17 | |
18 | -defined( 'ABSPATH' ) || exit; |
|
18 | +defined('ABSPATH') || exit; |
|
19 | 19 | |
20 | 20 | // Define constants. |
21 | -if ( ! defined( 'WPINV_PLUGIN_FILE' ) ) { |
|
22 | - define( 'WPINV_PLUGIN_FILE', __FILE__ ); |
|
21 | +if (!defined('WPINV_PLUGIN_FILE')) { |
|
22 | + define('WPINV_PLUGIN_FILE', __FILE__); |
|
23 | 23 | } |
24 | 24 | |
25 | -if ( ! defined( 'WPINV_VERSION' ) ) { |
|
26 | - define( 'WPINV_VERSION', '2.8.31' ); |
|
25 | +if (!defined('WPINV_VERSION')) { |
|
26 | + define('WPINV_VERSION', '2.8.31'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Include the main Invoicing class. |
30 | -if ( ! class_exists( 'WPInv_Plugin', false ) ) { |
|
31 | - require_once plugin_dir_path( WPINV_PLUGIN_FILE ) . 'includes/class-wpinv.php'; |
|
30 | +if (!class_exists('WPInv_Plugin', false)) { |
|
31 | + require_once plugin_dir_path(WPINV_PLUGIN_FILE) . 'includes/class-wpinv.php'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function getpaid() { |
41 | 41 | |
42 | - if ( empty( $GLOBALS['invoicing'] ) ) { |
|
42 | + if (empty($GLOBALS['invoicing'])) { |
|
43 | 43 | $GLOBALS['invoicing'] = new WPInv_Plugin(); |
44 | 44 | } |
45 | 45 | |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | * @since 2.0.8 |
53 | 53 | */ |
54 | 54 | function getpaid_deactivation_hook() { |
55 | - update_option( 'wpinv_flush_permalinks', 1 ); |
|
55 | + update_option('wpinv_flush_permalinks', 1); |
|
56 | 56 | } |
57 | -register_deactivation_hook( __FILE__, 'getpaid_deactivation_hook' ); |
|
57 | +register_deactivation_hook(__FILE__, 'getpaid_deactivation_hook'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @deprecated |
@@ -64,4 +64,4 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | // Kickstart the plugin. |
67 | -add_action( 'plugins_loaded', 'getpaid', 0 ); |
|
67 | +add_action('plugins_loaded', 'getpaid', 0); |