Passed
Push — master ( 82bd21...0587d7 )
by Brian
05:01
created
templates/emails/wpinv-email-subscription_expired.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
  * @var WPInv_Subscription $object
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 $invoice = $object->get_parent_payment();
14 14
 
15 15
 // Print the email header.
16
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
17 17
 
18 18
 // Generate the custom message body.
19 19
 echo $message_body;
20 20
 
21 21
 // Print the billing details.
22
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
22
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
23 23
 
24 24
 // Print the email footer.
25
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
25
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
Please login to merge, or discard this patch.
templates/emails/wpinv-email-subscription_cancelled.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@
 block discarded – undo
8 8
  * @var WPInv_Subscription $object
9 9
  */
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 $invoice = $object->get_parent_payment();
14 14
 
15 15
 // Print the email header.
16
-do_action( 'wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin );
16
+do_action('wpinv_email_header', $email_heading, $invoice, $email_type, $sent_to_admin);
17 17
 
18 18
 // Generate the custom message body.
19 19
 echo $message_body;
20 20
 
21 21
 // Print the billing details.
22
-do_action( 'wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin );
22
+do_action('wpinv_email_billing_details', $invoice, $email_type, $sent_to_admin);
23 23
 
24 24
 // Print the email footer.
25
-do_action( 'wpinv_email_footer', $invoice, $email_type, $sent_to_admin );
25
+do_action('wpinv_email_footer', $invoice, $email_type, $sent_to_admin);
Please login to merge, or discard this patch.
templates/invoice-receipt.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -7,55 +7,55 @@  discard block
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 // Fetch the invoice.
13
-$invoice = new WPInv_Invoice( $invoice );
13
+$invoice = new WPInv_Invoice($invoice);
14 14
 
15 15
 // @deprecated
16
-do_action( 'wpinv_success_content_before', $invoice );
17
-do_action( 'wpinv_before_receipt', $invoice );
16
+do_action('wpinv_success_content_before', $invoice);
17
+do_action('wpinv_before_receipt', $invoice);
18 18
 
19 19
 wpinv_print_errors();
20 20
 
21 21
 // Prepare header text.
22
-if ( $invoice->is_paid() ) {
22
+if ($invoice->is_paid()) {
23 23
 
24 24
     $alert = aui()->alert(
25 25
         array(
26 26
             'type'    => 'success',
27
-            'content' => __( 'Thank you for your payment!', 'invoicing' ),
27
+            'content' => __('Thank you for your payment!', 'invoicing'),
28 28
         )
29 29
     );
30 30
 
31
-} else if ( $invoice->is_refunded() ) {
31
+} else if ($invoice->is_refunded()) {
32 32
 
33 33
     $alert = aui()->alert(
34 34
         array(
35 35
             'type'    => 'info',
36
-            'content' => __( 'This invoice was refunded.', 'invoicing' ),
36
+            'content' => __('This invoice was refunded.', 'invoicing'),
37 37
         )
38 38
     );
39 39
 
40
-} else if ( $invoice->is_held() ) {
40
+} else if ($invoice->is_held()) {
41 41
 
42 42
     $alert = aui()->alert(
43 43
         array(
44 44
             'type'    => 'info',
45
-            'content' => __( 'This invoice will be processed as soon we verify your payment.', 'invoicing' ),
45
+            'content' => __('This invoice will be processed as soon we verify your payment.', 'invoicing'),
46 46
         )
47 47
     );
48 48
 
49
-} else if ( $invoice->needs_payment() ) {
49
+} else if ($invoice->needs_payment()) {
50 50
 
51
-    if ( $invoice->is_due() ) {
51
+    if ($invoice->is_due()) {
52 52
 
53 53
         $alert = aui()->alert(
54 54
             array(
55 55
                 'type'    => 'danger',
56 56
                 'content' => sprintf(
57
-                    __( 'This invoice was due on %.', 'invoicing' ),
58
-                    getpaid_format_date_value( $invoice->get_due_date() )
57
+                    __('This invoice was due on %.', 'invoicing'),
58
+                    getpaid_format_date_value($invoice->get_due_date())
59 59
                 ),
60 60
             )
61 61
         );
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
         $alert = aui()->alert(
66 66
             array(
67 67
                 'type'    => 'warning',
68
-                'content' => __( 'This invoice needs payment.', 'invoicing' ),
68
+                'content' => __('This invoice needs payment.', 'invoicing'),
69 69
             )
70 70
         );
71 71
 
@@ -80,19 +80,19 @@  discard block
 block discarded – undo
80 80
 
81 81
         'pay' => array(
82 82
             'url'   => $invoice->get_checkout_payment_url(),
83
-            'name'  => __( 'Pay For Invoice', 'invoicing' ),
83
+            'name'  => __('Pay For Invoice', 'invoicing'),
84 84
             'class' => 'btn-success',
85 85
         ),
86 86
 
87 87
         'view' => array(
88 88
             'url'   => $invoice->get_view_url(),
89
-            'name'  => __( 'View Invoice', 'invoicing' ),
89
+            'name'  => __('View Invoice', 'invoicing'),
90 90
             'class' => 'btn-primary',
91 91
         ),
92 92
 
93 93
         'history' => array(
94 94
             'url'   => wpinv_get_history_page_uri(),
95
-            'name'  => __( 'Invoice History', 'invoicing' ),
95
+            'name'  => __('Invoice History', 'invoicing'),
96 96
             'class' => 'btn-warning',
97 97
         ),
98 98
 
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 
102 102
 );
103 103
 
104
-if ( ( ! $invoice->needs_payment() || $invoice->is_held() ) && isset( $actions['pay'] ) ) {
105
-    unset( $actions['pay'] );
104
+if ((!$invoice->needs_payment() || $invoice->is_held()) && isset($actions['pay'])) {
105
+    unset($actions['pay']);
106 106
 }
107 107
 
108
-if ( ! is_user_logged_in() && isset( $actions['history'] ) ) {
109
-    unset( $actions['history'] );
108
+if (!is_user_logged_in() && isset($actions['history'])) {
109
+    unset($actions['history']);
110 110
 }
111 111
 
112 112
 ?>
@@ -115,19 +115,19 @@  discard block
 block discarded – undo
115 115
 
116 116
         <?php
117 117
         
118
-            do_action( 'wpinv_receipt_start', $invoice );
118
+            do_action('wpinv_receipt_start', $invoice);
119 119
 
120
-            if ( ! empty( $actions ) ) {
120
+            if (!empty($actions)) {
121 121
 
122 122
                 echo '<div class="wpinv-receipt-actions text-right mt-1 mb-4">';
123 123
 
124
-                foreach ( $actions as $key => $action ) {
124
+                foreach ($actions as $key => $action) {
125 125
 
126
-                    $key    = sanitize_html_class( $key );
127
-                    $class  = empty( $action['class'] ) ? 'btn-dark' : sanitize_html_class( $action['class'] );
128
-                    $url    = empty( $action['url'] ) ? '#' : esc_url( $action['url'] );
129
-                    $attrs  = empty( $action['attrs'] ) ? '' : $action['attrs'];
130
-                    $anchor = sanitize_text_field( $action['name'] );
126
+                    $key    = sanitize_html_class($key);
127
+                    $class  = empty($action['class']) ? 'btn-dark' : sanitize_html_class($action['class']);
128
+                    $url    = empty($action['url']) ? '#' : esc_url($action['url']);
129
+                    $attrs  = empty($action['attrs']) ? '' : $action['attrs'];
130
+                    $anchor = sanitize_text_field($action['name']);
131 131
 
132 132
                     echo "<a href='$url' class='btn btn-sm ml-1 $class $key' $attrs>$anchor</a>";
133 133
                 }
@@ -143,20 +143,20 @@  discard block
 block discarded – undo
143 143
         <div class="wpinv-receipt-details">
144 144
 
145 145
             <h4 class="wpinv-details-t mb-3 mt-3">
146
-                <?php echo apply_filters( 'wpinv_receipt_details_title', __( 'Invoice Details', 'invoicing' ), $invoice ); ?>
146
+                <?php echo apply_filters('wpinv_receipt_details_title', __('Invoice Details', 'invoicing'), $invoice); ?>
147 147
             </h4>
148 148
 
149
-            <?php getpaid_invoice_meta( $invoice ); ?>
149
+            <?php getpaid_invoice_meta($invoice); ?>
150 150
 
151 151
         </div>
152 152
 
153 153
 
154
-        <?php do_action( 'wpinv_receipt_end', $invoice ); ?>
154
+        <?php do_action('wpinv_receipt_end', $invoice); ?>
155 155
 
156 156
     </div>
157 157
 
158 158
 <?php
159 159
 
160 160
 // @deprecated
161
-do_action( 'wpinv_success_content_after', $invoice );
162
-do_action( 'wpinv_after_receipt', $invoice );
161
+do_action('wpinv_success_content_after', $invoice);
162
+do_action('wpinv_after_receipt', $invoice);
Please login to merge, or discard this patch.
includes/class-wpinv-cli.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
10
+if (!defined('WPINC')) {
11 11
     exit;
12 12
 }
13 13
 
@@ -24,40 +24,40 @@  discard block
 block discarded – undo
24 24
      *  @param Array $assoc_args Key value arguments stored in associated array format.
25 25
      *  @since 1.0.13
26 26
      */
27
-    public function insert_invoice( $args, $assoc_args ) {
27
+    public function insert_invoice($args, $assoc_args) {
28 28
 
29 29
         // Fetch invoice data from the args
30
-        $invoice_data = wp_unslash( $assoc_args );
30
+        $invoice_data = wp_unslash($assoc_args);
31 31
 
32 32
         // Abort if no invoice data is provided
33
-        if( empty( $invoice_data ) ) {
34
-            return WP_CLI::error( __( 'Invoice data not provided', 'invoicing' ) );
33
+        if (empty($invoice_data)) {
34
+            return WP_CLI::error(__('Invoice data not provided', 'invoicing'));
35 35
         }
36 36
 
37 37
         //Cart details
38
-        if( !empty( $invoice_data['cart_details'] ) ) {
39
-            $invoice_data['cart_details'] = json_decode( $invoice_data['cart_details'], true );
38
+        if (!empty($invoice_data['cart_details'])) {
39
+            $invoice_data['cart_details'] = json_decode($invoice_data['cart_details'], true);
40 40
         }
41 41
 
42 42
         //User details
43
-        if( !empty( $invoice_data['user_info'] ) ) {
44
-            $invoice_data['user_info'] = json_decode( $invoice_data['user_info'], true );
43
+        if (!empty($invoice_data['user_info'])) {
44
+            $invoice_data['user_info'] = json_decode($invoice_data['user_info'], true);
45 45
         }
46 46
 
47 47
         //Payment info
48
-        if( !empty( $invoice_data['payment_details'] ) ) {
49
-            $invoice_data['payment_details'] = json_decode( $invoice_data['payment_details'], true );
48
+        if (!empty($invoice_data['payment_details'])) {
49
+            $invoice_data['payment_details'] = json_decode($invoice_data['payment_details'], true);
50 50
         }
51 51
 
52 52
         // Try creating the invoice
53
-        $invoice = wpinv_insert_invoice( $invoice_data, true );
53
+        $invoice = wpinv_insert_invoice($invoice_data, true);
54 54
 
55
-        if ( is_wp_error( $invoice ) ) {
56
-            return WP_CLI::error( $invoice->get_error_message() );
55
+        if (is_wp_error($invoice)) {
56
+            return WP_CLI::error($invoice->get_error_message());
57 57
         }
58 58
 
59
-        $message = sprintf( __( 'Invoice %s created', 'invoicing' ), $invoice->get_id() );
60
-        WP_CLI::success( $message );
59
+        $message = sprintf(__('Invoice %s created', 'invoicing'), $invoice->get_id());
60
+        WP_CLI::success($message);
61 61
     }
62 62
     
63 63
     
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/heading.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,23 +8,23 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 
11
-defined( 'ABSPATH' ) || exit;
11
+defined('ABSPATH') || exit;
12 12
 
13 13
 ?>
14 14
 
15 15
 <div class='form-group'>
16
-    <label :for="active_form_element.id + '_edit_heading'"><?php esc_html_e( 'Heading', 'invoicing' ) ?></label>
16
+    <label :for="active_form_element.id + '_edit_heading'"><?php esc_html_e('Heading', 'invoicing') ?></label>
17 17
     <input :id="active_form_element.id + '_edit_heading'" v-model='active_form_element.text' class='form-control' type='text' />
18 18
 </div>
19 19
 
20 20
 <div class='form-group'>
21
-    <label :for="active_form_element.id + '_edit_level'"><?php esc_html_e( 'Select Heading Level', 'invoicing' ) ?></label>
21
+    <label :for="active_form_element.id + '_edit_level'"><?php esc_html_e('Select Heading Level', 'invoicing') ?></label>
22 22
     <select class='form-control custom-select' :id="active_form_element.id + '_edit_level'" v-model='active_form_element.level'>
23
-        <option value='h1'><?php esc_html_e( 'H1', 'invoicing' ); ?></option>
24
-        <option value='h2'><?php esc_html_e( 'H2', 'invoicing' ); ?></option>
25
-        <option value='h3'><?php esc_html_e( 'H3', 'invoicing' ); ?></option>
26
-        <option value='h4'><?php esc_html_e( 'H4', 'invoicing' ); ?></option>
27
-        <option value='h5'><?php esc_html_e( 'H5', 'invoicing' ); ?></option>
28
-        <option value='h6'><?php esc_html_e( 'H6', 'invoicing' ); ?></option>
23
+        <option value='h1'><?php esc_html_e('H1', 'invoicing'); ?></option>
24
+        <option value='h2'><?php esc_html_e('H2', 'invoicing'); ?></option>
25
+        <option value='h3'><?php esc_html_e('H3', 'invoicing'); ?></option>
26
+        <option value='h4'><?php esc_html_e('H4', 'invoicing'); ?></option>
27
+        <option value='h5'><?php esc_html_e('H5', 'invoicing'); ?></option>
28
+        <option value='h6'><?php esc_html_e('H6', 'invoicing'); ?></option>
29 29
     </select>
30 30
 </div>
Please login to merge, or discard this patch.
includes/api/class-wpinv-rest-invoice-controller.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @version 1.0.19
6 6
  */
7 7
 
8
-defined( 'ABSPATH' ) || exit;
8
+defined('ABSPATH') || exit;
9 9
 
10 10
 /**
11 11
  * REST API invoices controller class.
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 
54 54
 				'customers' => array(
55
-					'description'       => __( 'Limit result set to invoices for specific user ids.', 'invoicing' ),
55
+					'description'       => __('Limit result set to invoices for specific user ids.', 'invoicing'),
56 56
 					'type'              => 'array',
57 57
 					'items'             => array(
58 58
 						'type'          => 'integer',
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				),
63 63
 
64 64
 				'exclude_customers'  	=> array(
65
-					'description' 		=> __( 'Exclude invoices to specific users.', 'invoicing' ),
65
+					'description' 		=> __('Exclude invoices to specific users.', 'invoicing'),
66 66
 					'type'        		=> 'array',
67 67
 					'items'       		=> array(
68 68
 						'type'          => 'integer',
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 				),
73 73
 
74 74
 				'parent'  	            => array(
75
-					'description'       => __( 'Limit result set to those of particular parent IDs.', 'invoicing' ),
75
+					'description'       => __('Limit result set to those of particular parent IDs.', 'invoicing'),
76 76
 					'type'              => 'array',
77 77
 					'items'             => array(
78 78
 						'type'          => 'integer',
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 				),
83 83
 
84 84
 				'parent_exclude'  	    => array(
85
-					'description'       => __( 'Limit result set to all items except those of a particular parent ID.', 'invoicing' ),
85
+					'description'       => __('Limit result set to all items except those of a particular parent ID.', 'invoicing'),
86 86
 					'type'              => 'array',
87 87
 					'items'             => array(
88 88
 						'type'          => 'integer',
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		);
97 97
 
98 98
 		// Filter collection parameters for the invoices controller.
99
-		return apply_filters( 'getpaid_rest_invoices_collection_params', $params, $this );
99
+		return apply_filters('getpaid_rest_invoices_collection_params', $params, $this);
100 100
 	}
101 101
 
102 102
 	/**
@@ -107,21 +107,21 @@  discard block
 block discarded – undo
107 107
 	 * @param WP_REST_Request $request Request object.
108 108
 	 * @return array          $query_args
109 109
 	 */
110
-	protected function prepare_items_query( $prepared_args = array(), $request = null ) {
110
+	protected function prepare_items_query($prepared_args = array(), $request = null) {
111 111
 
112
-		$query_args = parent::prepare_items_query( $prepared_args );
112
+		$query_args = parent::prepare_items_query($prepared_args);
113 113
 
114 114
 		// Retrieve invoices for specific customers.
115
-		if ( ! empty( $request['customers'] ) ) {
115
+		if (!empty($request['customers'])) {
116 116
 			$query_args['author__in'] = $request['customers'];
117 117
 		}
118 118
 
119 119
 		// Skip invoices for specific customers.
120
-		if ( ! empty( $request['exclude_customers'] ) ) {
120
+		if (!empty($request['exclude_customers'])) {
121 121
 			$query_args['author__not_in'] = $request['exclude_customers'];
122 122
 		}
123 123
 
124
-		return apply_filters( 'getpaid_rest_invoices_prepare_items_query', $query_args, $request, $this );
124
+		return apply_filters('getpaid_rest_invoices_prepare_items_query', $query_args, $request, $this);
125 125
 
126 126
 	}
127 127
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 	 * @return array A list of registered item statuses.
134 134
 	 */
135 135
 	public function get_post_statuses() {
136
-		return array_keys( wpinv_get_invoice_statuses( true, false, $this->post_type ) );
136
+		return array_keys(wpinv_get_invoice_statuses(true, false, $this->post_type));
137 137
 	}
138 138
 
139 139
 	/**
@@ -142,9 +142,9 @@  discard block
 block discarded – undo
142 142
 	 * @param WPInv_Invoice $invoice Invoice to save.
143 143
 	 * @return WP_Error|WPInv_Invoice
144 144
 	 */
145
-	protected function save_object( $invoice ) {
145
+	protected function save_object($invoice) {
146 146
 		$invoice->recalculate_total();
147
-		return parent::save_object( $invoice );
147
+		return parent::save_object($invoice);
148 148
 	}
149 149
 
150 150
 }
Please login to merge, or discard this patch.
includes/data-stores/class-getpaid-invoice-data-store.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  * GetPaid_Invoice_Data_Store class file.
5 5
  *
6 6
  */
7
-if ( ! defined( 'ABSPATH' ) ) {
7
+if (!defined('ABSPATH')) {
8 8
 	exit;
9 9
 }
10 10
 
@@ -108,61 +108,61 @@  discard block
 block discarded – undo
108 108
 	 *
109 109
 	 * @param WPInv_Invoice $invoice Invoice object.
110 110
 	 */
111
-	public function create( &$invoice ) {
112
-		$invoice->set_version( WPINV_VERSION );
113
-		$invoice->set_date_created( current_time('mysql') );
111
+	public function create(&$invoice) {
112
+		$invoice->set_version(WPINV_VERSION);
113
+		$invoice->set_date_created(current_time('mysql'));
114 114
 
115 115
 		// Create a new post.
116 116
 		$id = wp_insert_post(
117 117
 			apply_filters(
118 118
 				'getpaid_new_invoice_data',
119 119
 				array(
120
-					'post_date'     => $invoice->get_date_created( 'edit' ),
121
-					'post_type'     => $invoice->get_post_type( 'edit' ),
122
-					'post_status'   => $this->get_post_status( $invoice ),
120
+					'post_date'     => $invoice->get_date_created('edit'),
121
+					'post_type'     => $invoice->get_post_type('edit'),
122
+					'post_status'   => $this->get_post_status($invoice),
123 123
 					'ping_status'   => 'closed',
124
-					'post_author'   => $invoice->get_user_id( 'edit' ),
125
-					'post_title'    => $invoice->get_title( 'edit' ),
126
-					'post_excerpt'  => $invoice->get_description( 'edit' ),
127
-					'post_parent'   => $invoice->get_parent_id( 'edit' ),
124
+					'post_author'   => $invoice->get_user_id('edit'),
125
+					'post_title'    => $invoice->get_title('edit'),
126
+					'post_excerpt'  => $invoice->get_description('edit'),
127
+					'post_parent'   => $invoice->get_parent_id('edit'),
128 128
 				)
129 129
 			),
130 130
 			true
131 131
 		);
132 132
 
133
-		if ( $id && ! is_wp_error( $id ) ) {
133
+		if ($id && !is_wp_error($id)) {
134 134
 
135 135
 			// Update the new id and regenerate a title.
136
-			$invoice->set_id( $id );
136
+			$invoice->set_id($id);
137 137
 
138 138
 			$invoice->maybe_set_number();
139 139
 
140 140
 			wp_update_post(
141 141
 				array(
142 142
 					'ID'         => $invoice->get_id(),
143
-					'post_title' => $invoice->get_number( 'edit' ),
144
-					'post_name'  => $invoice->get_path( 'edit' )
143
+					'post_title' => $invoice->get_number('edit'),
144
+					'post_name'  => $invoice->get_path('edit')
145 145
 				)
146 146
 			);
147 147
 
148 148
 			// Save special fields and items.
149
-			$this->save_special_fields( $invoice );
150
-			$this->save_items( $invoice );
149
+			$this->save_special_fields($invoice);
150
+			$this->save_items($invoice);
151 151
 
152 152
 			// Update meta data.
153
-			$this->update_post_meta( $invoice );
153
+			$this->update_post_meta($invoice);
154 154
 			$invoice->save_meta_data();
155 155
 
156 156
 			// Apply changes.
157 157
 			$invoice->apply_changes();
158
-			$this->clear_caches( $invoice );
158
+			$this->clear_caches($invoice);
159 159
 
160 160
 			// Fires after a new invoice is created.
161
-			do_action( 'getpaid_new_invoice', $invoice );
161
+			do_action('getpaid_new_invoice', $invoice);
162 162
 			return true;
163 163
 		}
164 164
 
165
-		if ( is_wp_error( $id ) ) {
165
+		if (is_wp_error($id)) {
166 166
 			$invoice->last_error = $id->get_error_message();
167 167
 		}
168 168
 
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
 	 * @param WPInv_Invoice $invoice Invoice object.
176 176
 	 *
177 177
 	 */
178
-	public function read( &$invoice ) {
178
+	public function read(&$invoice) {
179 179
 
180 180
 		$invoice->set_defaults();
181
-		$invoice_object = get_post( $invoice->get_id() );
181
+		$invoice_object = get_post($invoice->get_id());
182 182
 
183
-		if ( ! $invoice->get_id() || ! $invoice_object || ! getpaid_is_invoice_post_type( $invoice_object->post_type ) ) {
184
-			$invoice->last_error = __( 'Invalid invoice.', 'invoicing' );
185
-			$invoice->set_id( 0 );
183
+		if (!$invoice->get_id() || !$invoice_object || !getpaid_is_invoice_post_type($invoice_object->post_type)) {
184
+			$invoice->last_error = __('Invalid invoice.', 'invoicing');
185
+			$invoice->set_id(0);
186 186
 			return false;
187 187
 		}
188 188
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 			)
201 201
 		);
202 202
 
203
-		$invoice->set_type( $invoice_object->post_type );
203
+		$invoice->set_type($invoice_object->post_type);
204 204
 
205
-		$this->read_object_data( $invoice, $invoice_object );
206
-		$this->add_special_fields( $invoice );
207
-		$this->add_items( $invoice );
205
+		$this->read_object_data($invoice, $invoice_object);
206
+		$this->add_special_fields($invoice);
207
+		$this->add_items($invoice);
208 208
 		$invoice->read_meta_data();
209
-		$invoice->set_object_read( true );
210
-		do_action( 'getpaid_read_invoice', $invoice );
209
+		$invoice->set_object_read(true);
210
+		do_action('getpaid_read_invoice', $invoice);
211 211
 
212 212
 	}
213 213
 
@@ -216,35 +216,35 @@  discard block
 block discarded – undo
216 216
 	 *
217 217
 	 * @param WPInv_Invoice $invoice Invoice object.
218 218
 	 */
219
-	public function update( &$invoice ) {
219
+	public function update(&$invoice) {
220 220
 		$invoice->save_meta_data();
221
-		$invoice->set_version( WPINV_VERSION );
221
+		$invoice->set_version(WPINV_VERSION);
222 222
 
223
-		if ( null === $invoice->get_date_created( 'edit' ) ) {
224
-			$invoice->set_date_created(  current_time('mysql') );
223
+		if (null === $invoice->get_date_created('edit')) {
224
+			$invoice->set_date_created(current_time('mysql'));
225 225
 		}
226 226
 
227 227
 		// Ensure both the key and number are set.
228 228
 		$invoice->get_path();
229 229
 
230 230
 		// Grab the current status so we can compare.
231
-		$previous_status = get_post_status( $invoice->get_id() );
231
+		$previous_status = get_post_status($invoice->get_id());
232 232
 
233 233
 		$changes = $invoice->get_changes();
234 234
 
235 235
 		// Only update the post when the post data changes.
236
-		if ( array_intersect( array( 'date_created', 'date_modified', 'status', 'name', 'author', 'description', 'parent_id', 'post_excerpt', 'path' ), array_keys( $changes ) ) ) {
236
+		if (array_intersect(array('date_created', 'date_modified', 'status', 'name', 'author', 'description', 'parent_id', 'post_excerpt', 'path'), array_keys($changes))) {
237 237
 			$post_data = array(
238
-				'post_date'         => $invoice->get_date_created( 'edit' ),
239
-				'post_date_gmt'     => $invoice->get_date_created_gmt( 'edit' ),
240
-				'post_status'       => $invoice->get_status( 'edit' ),
241
-				'post_title'        => $invoice->get_name( 'edit' ),
242
-				'post_author'       => $invoice->get_user_id( 'edit' ),
243
-				'post_modified'     => $invoice->get_date_modified( 'edit' ),
244
-				'post_excerpt'      => $invoice->get_description( 'edit' ),
245
-				'post_parent'       => $invoice->get_parent_id( 'edit' ),
246
-				'post_name'         => $invoice->get_path( 'edit' ),
247
-				'post_type'         => $invoice->get_post_type( 'edit' ),
238
+				'post_date'         => $invoice->get_date_created('edit'),
239
+				'post_date_gmt'     => $invoice->get_date_created_gmt('edit'),
240
+				'post_status'       => $invoice->get_status('edit'),
241
+				'post_title'        => $invoice->get_name('edit'),
242
+				'post_author'       => $invoice->get_user_id('edit'),
243
+				'post_modified'     => $invoice->get_date_modified('edit'),
244
+				'post_excerpt'      => $invoice->get_description('edit'),
245
+				'post_parent'       => $invoice->get_parent_id('edit'),
246
+				'post_name'         => $invoice->get_path('edit'),
247
+				'post_type'         => $invoice->get_post_type('edit'),
248 248
 			);
249 249
 
250 250
 			/**
@@ -255,35 +255,35 @@  discard block
 block discarded – undo
255 255
 			 * This ensures hooks are fired by either WP itself (admin screen save),
256 256
 			 * or an update purely from CRUD.
257 257
 			 */
258
-			if ( doing_action( 'save_post' ) ) {
259
-				$GLOBALS['wpdb']->update( $GLOBALS['wpdb']->posts, $post_data, array( 'ID' => $invoice->get_id() ) );
260
-				clean_post_cache( $invoice->get_id() );
258
+			if (doing_action('save_post')) {
259
+				$GLOBALS['wpdb']->update($GLOBALS['wpdb']->posts, $post_data, array('ID' => $invoice->get_id()));
260
+				clean_post_cache($invoice->get_id());
261 261
 			} else {
262
-				wp_update_post( array_merge( array( 'ID' => $invoice->get_id() ), $post_data ) );
262
+				wp_update_post(array_merge(array('ID' => $invoice->get_id()), $post_data));
263 263
 			}
264
-			$invoice->read_meta_data( true ); // Refresh internal meta data, in case things were hooked into `save_post` or another WP hook.
264
+			$invoice->read_meta_data(true); // Refresh internal meta data, in case things were hooked into `save_post` or another WP hook.
265 265
 		}
266 266
 
267 267
 		// Update meta data.
268
-		$this->update_post_meta( $invoice );
268
+		$this->update_post_meta($invoice);
269 269
 
270 270
 		// Save special fields and items.
271
-		$this->save_special_fields( $invoice );
272
-		$this->save_items( $invoice );
271
+		$this->save_special_fields($invoice);
272
+		$this->save_items($invoice);
273 273
 
274 274
 		// Apply the changes.
275 275
 		$invoice->apply_changes();
276 276
 
277 277
 		// Clear caches.
278
-		$this->clear_caches( $invoice );
278
+		$this->clear_caches($invoice);
279 279
 
280 280
 		// Fire a hook depending on the status - this should be considered a creation if it was previously draft status.
281
-		$new_status = $invoice->get_status( 'edit' );
281
+		$new_status = $invoice->get_status('edit');
282 282
 
283
-		if ( $new_status !== $previous_status && in_array( $previous_status, array( 'new', 'auto-draft', 'draft' ), true ) ) {
284
-			do_action( 'getpaid_new_invoice', $invoice );
283
+		if ($new_status !== $previous_status && in_array($previous_status, array('new', 'auto-draft', 'draft'), true)) {
284
+			do_action('getpaid_new_invoice', $invoice);
285 285
 		} else {
286
-			do_action( 'getpaid_update_invoice', $invoice );
286
+			do_action('getpaid_update_invoice', $invoice);
287 287
 		}
288 288
 
289 289
 	}
@@ -299,45 +299,45 @@  discard block
 block discarded – undo
299 299
 	 *
300 300
 	 * @param WPInv_Invoice $invoice Invoice object.
301 301
      */
302
-    public function add_special_fields( &$invoice ) {
302
+    public function add_special_fields(&$invoice) {
303 303
 		global $wpdb;
304 304
 
305 305
 		// Maybe retrieve from the cache.
306
-		$data   = wp_cache_get( $invoice->get_id(), 'getpaid_invoice_special_fields' );
306
+		$data = wp_cache_get($invoice->get_id(), 'getpaid_invoice_special_fields');
307 307
 
308 308
 		// If not found, retrieve from the db.
309
-		if ( false === $data ) {
310
-			$table =  $wpdb->prefix . 'getpaid_invoices';
309
+		if (false === $data) {
310
+			$table = $wpdb->prefix . 'getpaid_invoices';
311 311
 
312 312
 			$data  = $wpdb->get_row(
313
-				$wpdb->prepare( "SELECT * FROM $table WHERE `post_id`=%d LIMIT 1", $invoice->get_id() ),
313
+				$wpdb->prepare("SELECT * FROM $table WHERE `post_id`=%d LIMIT 1", $invoice->get_id()),
314 314
 				ARRAY_A
315 315
 			);
316 316
 
317 317
 			// Update the cache with our data
318
-			wp_cache_set( $invoice->get_id(), $data, 'getpaid_invoice_special_fields' );
318
+			wp_cache_set($invoice->get_id(), $data, 'getpaid_invoice_special_fields');
319 319
 
320 320
 		}
321 321
 
322 322
 		// Abort if the data does not exist.
323
-		if ( empty( $data ) ) {
324
-			$invoice->set_object_read( true );
325
-			$invoice->set_props( wpinv_get_user_address( $invoice->get_user_id() ) );
323
+		if (empty($data)) {
324
+			$invoice->set_object_read(true);
325
+			$invoice->set_props(wpinv_get_user_address($invoice->get_user_id()));
326 326
 			return;
327 327
 		}
328 328
 
329 329
 		$props = array();
330 330
 
331
-		foreach ( $this->database_fields_to_props as $db_field => $prop ) {
331
+		foreach ($this->database_fields_to_props as $db_field => $prop) {
332 332
 			
333
-			if ( $db_field == 'post_id' ) {
333
+			if ($db_field == 'post_id') {
334 334
 				continue;
335 335
 			}
336 336
 
337
-			$props[ $prop ] = $data[ $db_field ];
337
+			$props[$prop] = $data[$db_field];
338 338
 		}
339 339
 
340
-		$invoice->set_props( $props );
340
+		$invoice->set_props($props);
341 341
 
342 342
 	}
343 343
 
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @param  WPInv_Invoice $invoice       The Invoice object.
349 349
 	 * @return array                        A mapping of field keys => prop names, filtered by ones that should be updated.
350 350
 	 */
351
-	protected function get_special_fields_to_update( $invoice ) {
351
+	protected function get_special_fields_to_update($invoice) {
352 352
 		$fields_to_update = array();
353
-		$changed_props   = $invoice->get_changes();
353
+		$changed_props = $invoice->get_changes();
354 354
 
355 355
 		// Props should be updated if they are a part of the $changed array or don't exist yet.
356
-		foreach ( $this->database_fields_to_props as $database_field => $prop ) {
357
-			if ( array_key_exists( $prop, $changed_props ) ) {
358
-				$fields_to_update[ $database_field ] = $prop;
356
+		foreach ($this->database_fields_to_props as $database_field => $prop) {
357
+			if (array_key_exists($prop, $changed_props)) {
358
+				$fields_to_update[$database_field] = $prop;
359 359
 			}
360 360
 		}
361 361
 
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
 	 * @param WPInv_Invoice $invoice WPInv_Invoice object.
369 369
 	 * @since 1.0.19
370 370
 	 */
371
-	protected function update_special_fields( &$invoice ) {
371
+	protected function update_special_fields(&$invoice) {
372 372
 		global $wpdb;
373 373
 
374 374
 		$updated_props    = array();
375
-		$fields_to_update = $this->get_special_fields_to_update( $invoice );
375
+		$fields_to_update = $this->get_special_fields_to_update($invoice);
376 376
 
377
-		foreach ( $fields_to_update as $database_field => $prop ) {
378
-			$value = $invoice->{"get_$prop"}( 'edit' );
379
-			$value = is_string( $value ) ? wp_slash( $value ) : $value;
380
-			$value = is_bool( $value ) ? ( int ) $value : $value;
381
-			$updated_props[ $database_field ] = maybe_serialize( $value );
377
+		foreach ($fields_to_update as $database_field => $prop) {
378
+			$value = $invoice->{"get_$prop"}('edit');
379
+			$value = is_string($value) ? wp_slash($value) : $value;
380
+			$value = is_bool($value) ? (int) $value : $value;
381
+			$updated_props[$database_field] = maybe_serialize($value);
382 382
 		}
383 383
 
384
-		if ( ! empty( $updated_props ) ) {
384
+		if (!empty($updated_props)) {
385 385
 
386 386
 			$table = $wpdb->prefix . 'getpaid_invoices';
387
-			$wpdb->update( $table, $updated_props, array( 'post_id' => $invoice->get_id() ) );
388
-			wp_cache_delete( $invoice->get_id(), 'getpaid_invoice_special_fields' );
389
-			do_action( "getpaid_invoice_update_database_fields", $invoice, $updated_props );
387
+			$wpdb->update($table, $updated_props, array('post_id' => $invoice->get_id()));
388
+			wp_cache_delete($invoice->get_id(), 'getpaid_invoice_special_fields');
389
+			do_action("getpaid_invoice_update_database_fields", $invoice, $updated_props);
390 390
 
391 391
 		}
392 392
 
@@ -398,22 +398,22 @@  discard block
 block discarded – undo
398 398
 	 * @param WPInv_Invoice $invoice WPInv_Invoice object.
399 399
 	 * @since 1.0.19
400 400
 	 */
401
-	protected function insert_special_fields( &$invoice ) {
401
+	protected function insert_special_fields(&$invoice) {
402 402
 		global $wpdb;
403 403
 
404
-		$updated_props   = array();
404
+		$updated_props = array();
405 405
 
406
-		foreach ( $this->database_fields_to_props as $database_field => $prop ) {
407
-			$value = $invoice->{"get_$prop"}( 'edit' );
408
-			$value = is_string( $value ) ? wp_slash( $value ) : $value;
409
-			$value = is_bool( $value ) ? ( int ) $value : $value;
410
-			$updated_props[ $database_field ] = maybe_serialize( $value );
406
+		foreach ($this->database_fields_to_props as $database_field => $prop) {
407
+			$value = $invoice->{"get_$prop"}('edit');
408
+			$value = is_string($value) ? wp_slash($value) : $value;
409
+			$value = is_bool($value) ? (int) $value : $value;
410
+			$updated_props[$database_field] = maybe_serialize($value);
411 411
 		}
412 412
 
413 413
 		$table = $wpdb->prefix . 'getpaid_invoices';
414
-		$wpdb->insert( $table, $updated_props );
415
-		wp_cache_delete( $invoice->get_id(), 'getpaid_invoice_special_fields' );
416
-		do_action( "getpaid_invoice_insert_database_fields", $invoice, $updated_props );
414
+		$wpdb->insert($table, $updated_props);
415
+		wp_cache_delete($invoice->get_id(), 'getpaid_invoice_special_fields');
416
+		do_action("getpaid_invoice_insert_database_fields", $invoice, $updated_props);
417 417
 
418 418
 	}
419 419
 
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 	 *
423 423
 	 * @param WPInv_Invoice $invoice Invoice object.
424 424
      */
425
-    public function save_special_fields( & $invoice ) {
425
+    public function save_special_fields(& $invoice) {
426 426
 		global $wpdb;
427 427
 
428 428
 		// The invoices table.
@@ -430,13 +430,13 @@  discard block
 block discarded – undo
430 430
 		$id    = (int) $invoice->get_id();
431 431
 		$invoice->maybe_set_key();
432 432
 
433
-		if ( $wpdb->get_var( "SELECT `post_id` FROM $table WHERE `post_id`= $id" ) ) {
433
+		if ($wpdb->get_var("SELECT `post_id` FROM $table WHERE `post_id`= $id")) {
434 434
 
435
-			$this->update_special_fields( $invoice );
435
+			$this->update_special_fields($invoice);
436 436
 
437 437
 		} else {
438 438
 
439
-			$this->insert_special_fields( $invoice );
439
+			$this->insert_special_fields($invoice);
440 440
 
441 441
 		}
442 442
 
@@ -447,43 +447,43 @@  discard block
 block discarded – undo
447 447
 	 *
448 448
 	 * @param WPInv_Invoice $invoice Invoice object.
449 449
      */
450
-    public function add_items( &$invoice ) {
450
+    public function add_items(&$invoice) {
451 451
 		global $wpdb;
452 452
 
453 453
 		// Maybe retrieve from the cache.
454
-		$items = wp_cache_get( $invoice->get_id(), 'getpaid_invoice_cart_details' );
454
+		$items = wp_cache_get($invoice->get_id(), 'getpaid_invoice_cart_details');
455 455
 
456 456
 		// If not found, retrieve from the db.
457
-		if ( false === $items ) {
458
-			$table =  $wpdb->prefix . 'getpaid_invoice_items';
457
+		if (false === $items) {
458
+			$table = $wpdb->prefix . 'getpaid_invoice_items';
459 459
 
460 460
 			$items = $wpdb->get_results(
461
-				$wpdb->prepare( "SELECT * FROM $table WHERE `post_id`=%d", $invoice->get_id() )
461
+				$wpdb->prepare("SELECT * FROM $table WHERE `post_id`=%d", $invoice->get_id())
462 462
 			);
463 463
 
464 464
 			// Update the cache with our data
465
-			wp_cache_set( $invoice->get_id(), $items, 'getpaid_invoice_cart_details' );
465
+			wp_cache_set($invoice->get_id(), $items, 'getpaid_invoice_cart_details');
466 466
 
467 467
 		}
468 468
 
469 469
 		// Abort if no items found.
470
-        if ( empty( $items ) ) {
470
+        if (empty($items)) {
471 471
             return;
472 472
 		}
473 473
 
474
-		foreach ( $items as $item_data ) {
475
-			$item = new GetPaid_Form_Item( $item_data->item_id );
474
+		foreach ($items as $item_data) {
475
+			$item = new GetPaid_Form_Item($item_data->item_id);
476 476
 
477 477
 			// Set item data.
478
-			$item->item_tax      = wpinv_sanitize_amount( $item_data->tax );
479
-			$item->item_discount = wpinv_sanitize_amount( $item_data->discount );
480
-			$item->set_name( $item_data->item_name );
481
-			$item->set_description( $item_data->item_description );
482
-			$item->set_price( $item_data->item_price );
483
-			$item->set_quantity( $item_data->quantity );
484
-			$item->set_item_meta( $item_data->meta );
485
-
486
-			$invoice->add_item( $item );
478
+			$item->item_tax      = wpinv_sanitize_amount($item_data->tax);
479
+			$item->item_discount = wpinv_sanitize_amount($item_data->discount);
480
+			$item->set_name($item_data->item_name);
481
+			$item->set_description($item_data->item_description);
482
+			$item->set_price($item_data->item_price);
483
+			$item->set_quantity($item_data->quantity);
484
+			$item->set_item_meta($item_data->meta);
485
+
486
+			$invoice->add_item($item);
487 487
 		}
488 488
 
489 489
 	}
@@ -493,20 +493,20 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @param WPInv_Invoice $invoice Invoice object.
495 495
      */
496
-    public function save_items( $invoice ) {
496
+    public function save_items($invoice) {
497 497
 
498 498
 		// Delete previously existing items.
499
-		$this->delete_items( $invoice );
499
+		$this->delete_items($invoice);
500 500
 
501
-		$table   =  $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
501
+		$table = $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
502 502
 
503
-		foreach ( $invoice->get_cart_details() as $item_data ) {
504
-			$item_data = array_map( 'maybe_serialize', $item_data );
505
-			$GLOBALS['wpdb']->insert( $table, $item_data );
503
+		foreach ($invoice->get_cart_details() as $item_data) {
504
+			$item_data = array_map('maybe_serialize', $item_data);
505
+			$GLOBALS['wpdb']->insert($table, $item_data);
506 506
 		}
507 507
 
508
-		wp_cache_delete( $invoice->get_id(), 'getpaid_invoice_cart_details' );
509
-		do_action( "getpaid_invoice_save_items", $invoice );
508
+		wp_cache_delete($invoice->get_id(), 'getpaid_invoice_cart_details');
509
+		do_action("getpaid_invoice_save_items", $invoice);
510 510
 
511 511
 	}
512 512
 
@@ -515,9 +515,9 @@  discard block
 block discarded – undo
515 515
 	 *
516 516
 	 * @param WPInv_Invoice $invoice Invoice object.
517 517
      */
518
-    public function delete_items( $invoice ) {
519
-		$table =  $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
520
-		return $GLOBALS['wpdb']->delete( $table, array( 'post_id' => $invoice->get_id() ) );
518
+    public function delete_items($invoice) {
519
+		$table = $GLOBALS['wpdb']->prefix . 'getpaid_invoice_items';
520
+		return $GLOBALS['wpdb']->delete($table, array('post_id' => $invoice->get_id()));
521 521
 	}
522 522
 
523 523
 	/**
@@ -525,9 +525,9 @@  discard block
 block discarded – undo
525 525
 	 *
526 526
 	 * @param WPInv_Invoice $invoice Invoice object.
527 527
      */
528
-    public function delete_special_fields( $invoice ) {
529
-		$table =  $GLOBALS['wpdb']->prefix . 'getpaid_invoices';
530
-		return $GLOBALS['wpdb']->delete( $table, array( 'post_id' => $invoice->get_id() ) );
528
+    public function delete_special_fields($invoice) {
529
+		$table = $GLOBALS['wpdb']->prefix . 'getpaid_invoices';
530
+		return $GLOBALS['wpdb']->delete($table, array('post_id' => $invoice->get_id()));
531 531
 	}
532 532
 	
533 533
 	/**
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 	 * @param  WPInv_Invoice $object GetPaid_Data object.
539 539
 	 * @return string
540 540
 	 */
541
-	protected function get_post_status( $object ) {
542
-		$object_status = $object->get_status( 'edit' );
541
+	protected function get_post_status($object) {
542
+		$object_status = $object->get_status('edit');
543 543
 
544
-		if ( ! $object_status ) {
544
+		if (!$object_status) {
545 545
 			$object_status = $object->get_default_status();
546 546
 		}
547 547
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/pay_button.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,44 +7,44 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
14 14
 <div class='form-group'>
15 15
     <label class="d-block">
16
-        <span><?php esc_html_e( 'Button Text', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Button Text', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18
-        <small class="form-text text-muted"><?php _e( '%price% will be replaced by the total payable amount', 'invoicing' ); ?></small>
18
+        <small class="form-text text-muted"><?php _e('%price% will be replaced by the total payable amount', 'invoicing'); ?></small>
19 19
     </label>
20 20
 </div>
21 21
 
22 22
 <div class='form-group'>
23 23
     <label class="d-block">
24
-        <span><?php esc_html_e( 'Free Checkout Text', 'invoicing' ); ?></span>
24
+        <span><?php esc_html_e('Free Checkout Text', 'invoicing'); ?></span>
25 25
         <input v-model='active_form_element.free' class='form-control' type="text"/>
26
-        <small class="form-text text-muted"><?php _e( 'The text to display if the total payable amount is zero', 'invoicing' ); ?></small>
26
+        <small class="form-text text-muted"><?php _e('The text to display if the total payable amount is zero', 'invoicing'); ?></small>
27 27
     </label>
28 28
 </div>
29 29
 
30 30
 <div class='form-group'>
31 31
     <label class="d-block">
32
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
33
-        <textarea placeholder='<?php esc_attr_e( 'Add some help text for this field', 'invoicing' ); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
32
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
33
+        <textarea placeholder='<?php esc_attr_e('Add some help text for this field', 'invoicing'); ?>' v-model='active_form_element.description' class='form-control' rows='3'></textarea>
34 34
     </label>
35 35
 </div>
36 36
 
37 37
 <div class='form-group'>
38
-    <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e( 'Button Type', 'invoicing' ) ?></label>
38
+    <label :for="active_form_element.id + '_edit_type'"><?php esc_html_e('Button Type', 'invoicing') ?></label>
39 39
     <select class='form-control custom-select' :id="active_form_element.id + '_edit_type'" v-model='active_form_element.class'>
40
-        <option value='btn-primary'><?php esc_html_e( 'Primary', 'invoicing' ); ?></option>
41
-        <option value='btn-secondary'><?php esc_html_e( 'Secondary', 'invoicing' ); ?></option>
42
-        <option value='btn-success'><?php esc_html_e( 'Success', 'invoicing' ); ?></option>
43
-        <option value='btn-danger'><?php esc_html_e( 'Danger', 'invoicing' ); ?></option>
44
-        <option value='btn-warning'><?php esc_html_e( 'Warning', 'invoicing' ); ?></option>
45
-        <option value='btn-info'><?php esc_html_e( 'Info', 'invoicing' ); ?></option>
46
-        <option value='btn-light'><?php esc_html_e( 'Light', 'invoicing' ); ?></option>
47
-        <option value='btn-dark'><?php esc_html_e( 'Dark', 'invoicing' ); ?></option>
48
-        <option value='btn-link'><?php esc_html_e( 'Link', 'invoicing' ); ?></option>
40
+        <option value='btn-primary'><?php esc_html_e('Primary', 'invoicing'); ?></option>
41
+        <option value='btn-secondary'><?php esc_html_e('Secondary', 'invoicing'); ?></option>
42
+        <option value='btn-success'><?php esc_html_e('Success', 'invoicing'); ?></option>
43
+        <option value='btn-danger'><?php esc_html_e('Danger', 'invoicing'); ?></option>
44
+        <option value='btn-warning'><?php esc_html_e('Warning', 'invoicing'); ?></option>
45
+        <option value='btn-info'><?php esc_html_e('Info', 'invoicing'); ?></option>
46
+        <option value='btn-light'><?php esc_html_e('Light', 'invoicing'); ?></option>
47
+        <option value='btn-dark'><?php esc_html_e('Dark', 'invoicing'); ?></option>
48
+        <option value='btn-link'><?php esc_html_e('Link', 'invoicing'); ?></option>
49 49
     </select>
50 50
 </div>
Please login to merge, or discard this patch.
includes/class-getpaid-daily-maintenance.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-defined( 'ABSPATH' ) || exit;
7
+defined('ABSPATH') || exit;
8 8
 
9 9
 /**
10 10
  * Daily maintenance class.
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	 * Class constructor.
17 17
 	 */
18
-	public function __construct(){
18
+	public function __construct() {
19 19
 
20 20
 		// Clear deprecated events.
21
-		add_action( 'wp', array( $this, 'maybe_clear_deprecated_events' ) );
21
+		add_action('wp', array($this, 'maybe_clear_deprecated_events'));
22 22
 
23 23
 		// (Maybe) schedule a cron that runs daily.
24
-		add_action( 'wp', array( $this, 'maybe_create_scheduled_event' ) );
24
+		add_action('wp', array($this, 'maybe_create_scheduled_event'));
25 25
 
26 26
 		// Fired everyday at 7 a.m (this might vary for sites with few visitors)
27
-		add_action( 'getpaid_daily_maintenance', array( $this, 'log_cron_run' ) );
28
-		add_action( 'getpaid_daily_maintenance', array( $this, 'backwards_compat' ) );
29
-		add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_expire_subscriptions' ) );
30
-		add_action( 'getpaid_daily_maintenance', array( $this, 'maybe_update_geoip_databases' ) );
27
+		add_action('getpaid_daily_maintenance', array($this, 'log_cron_run'));
28
+		add_action('getpaid_daily_maintenance', array($this, 'backwards_compat'));
29
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_expire_subscriptions'));
30
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_update_geoip_databases'));
31 31
 
32 32
 	}
33 33
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function maybe_create_scheduled_event() {
39 39
 
40
-		if ( ! wp_next_scheduled( 'getpaid_daily_maintenance' ) ) {
41
-			$timestamp = strtotime( 'tomorrow 07:00:00', current_time( 'timestamp' ) );
42
-			wp_schedule_event( $timestamp, 'daily', 'getpaid_daily_maintenance' );
40
+		if (!wp_next_scheduled('getpaid_daily_maintenance')) {
41
+			$timestamp = strtotime('tomorrow 07:00:00', current_time('timestamp'));
42
+			wp_schedule_event($timestamp, 'daily', 'getpaid_daily_maintenance');
43 43
 		}
44 44
 
45 45
 	}
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 	 */
51 51
 	public function maybe_clear_deprecated_events() {
52 52
 
53
-		if ( ! get_option( 'wpinv_cleared_old_events' ) ) {
54
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' );
55
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_daily' );
56
-			update_option( 'wpinv_cleared_old_events', 1 );
53
+		if (!get_option('wpinv_cleared_old_events')) {
54
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily');
55
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_daily');
56
+			update_option('wpinv_cleared_old_events', 1);
57 57
 		}
58 58
 
59 59
 	}
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	 *
64 64
 	 */
65 65
 	public function backwards_compat() {
66
-		do_action( 'wpinv_register_schedule_event_daily' );
66
+		do_action('wpinv_register_schedule_event_daily');
67 67
 	}
68 68
 
69 69
 	/**
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 	public function maybe_expire_subscriptions() {
74 74
 
75 75
 		// Fetch expired subscriptions (skips those that expire today).
76
-		$args  = array(
76
+		$args = array(
77 77
 			'number'             => -1,
78 78
 			'count_total'        => false,
79 79
 			'status'             => 'trialling active failing cancelled',
@@ -83,11 +83,11 @@  discard block
 block discarded – undo
83 83
 			),
84 84
 		);
85 85
 
86
-		$subscriptions = new GetPaid_Subscriptions_Query( $args );
86
+		$subscriptions = new GetPaid_Subscriptions_Query($args);
87 87
 
88
-		foreach ( $subscriptions->get_results() as $subscription ) {
89
-			if ( apply_filters( 'getpaid_daily_maintenance_should_expire_subscription', true, $subscription ) ) {
90
-				$subscription->set_status( 'expired' );
88
+		foreach ($subscriptions->get_results() as $subscription) {
89
+			if (apply_filters('getpaid_daily_maintenance_should_expire_subscription', true, $subscription)) {
90
+				$subscription->set_status('expired');
91 91
 				$subscription->save();
92 92
 			}
93 93
 		}
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 	 *
100 100
 	 */
101 101
 	public function log_cron_run() {
102
-		wpinv_error_log( 'GetPaid Daily Cron' );
102
+		wpinv_error_log('GetPaid Daily Cron');
103 103
 	}
104 104
 
105 105
 	/**
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
 	 *
108 108
 	 */
109 109
 	public function maybe_update_geoip_databases() {
110
-		$updated = get_transient( 'getpaid_updated_geoip_databases' );
110
+		$updated = get_transient('getpaid_updated_geoip_databases');
111 111
 
112
-		if ( false === $updated ) {
113
-			set_transient( 'getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS );
114
-			do_action( 'getpaid_update_geoip_databases' );
112
+		if (false === $updated) {
113
+			set_transient('getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS);
114
+			do_action('getpaid_update_geoip_databases');
115 115
 		}
116 116
 
117 117
 	}
Please login to merge, or discard this patch.