Passed
Push — master ( 07aba6...afad5e )
by Stiofan
05:16
created
templates/payment-forms-admin/edit/number.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 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( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <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
-        <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <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
+        <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <div class='form-group form-check'>
42 42
     <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
43
-    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
43
+    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
44 44
 </div>
45 45
 
46 46
 <hr class='featurette-divider mt-4'>
47 47
 
48 48
 <div class='form-group'>
49 49
     <label class="d-block">
50
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
50
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
51 51
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
52
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
52
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
53 53
     </label>
54 54
 </div>
55 55
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/textarea.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 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( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <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
-        <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <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
+        <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <div class='form-group form-check'>
42 42
     <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
43
-    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
43
+    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
44 44
 </div>
45 45
 
46 46
 <hr class='featurette-divider mt-4'>
47 47
 
48 48
 <div class='form-group'>
49 49
     <label class="d-block">
50
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
50
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
51 51
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
52
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
52
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
53 53
     </label>
54 54
 </div>
55 55
 
Please login to merge, or discard this patch.
templates/payment-forms-admin/edit/text.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 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( 'Field Label', 'invoicing' ); ?></span>
16
+        <span><?php esc_html_e('Field Label', 'invoicing'); ?></span>
17 17
         <input v-model='active_form_element.label' class='form-control' type="text"/>
18 18
     </label>
19 19
 </div>
20 20
 
21 21
 <div class='form-group'>
22 22
     <label class="d-block">
23
-        <span><?php esc_html_e( 'Placeholder text', 'invoicing' ); ?></span>
23
+        <span><?php esc_html_e('Placeholder text', 'invoicing'); ?></span>
24 24
         <input v-model='active_form_element.placeholder' class='form-control' type="text"/>
25 25
     </label>
26 26
 </div>
27 27
 
28 28
 <div class='form-group'>
29 29
     <label class="d-block">
30
-        <span><?php esc_html_e( 'Help Text', 'invoicing' ); ?></span>
31
-        <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
-        <small class="form-text text-muted"><?php _e( 'HTML is allowed', 'invoicing' ); ?></small>
30
+        <span><?php esc_html_e('Help Text', 'invoicing'); ?></span>
31
+        <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
+        <small class="form-text text-muted"><?php _e('HTML is allowed', 'invoicing'); ?></small>
33 33
     </label>
34 34
 </div>
35 35
 
36 36
 <div class='form-group form-check'>
37 37
     <input :id="active_form_element.id + '_edit'" v-model='active_form_element.required' type='checkbox' class='form-check-input' />
38
-    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e( 'Is this field required?', 'invoicing' ); ?></label>
38
+    <label class='form-check-label' :for="active_form_element.id + '_edit'"><?php esc_html_e('Is this field required?', 'invoicing'); ?></label>
39 39
 </div>
40 40
 
41 41
 <div class='form-group form-check'>
42 42
     <input :id="active_form_element.id + '_add_meta'" v-model='active_form_element.add_meta' type='checkbox' class='form-check-input' />
43
-    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e( 'Show this field in receipts and emails?', 'invoicing' ); ?></label>
43
+    <label class='form-check-label' :for="active_form_element.id + '_add_meta'"><?php esc_html_e('Show this field in receipts and emails?', 'invoicing'); ?></label>
44 44
 </div>
45 45
 
46 46
 <hr class='featurette-divider mt-4'>
47 47
 
48 48
 <div class='form-group'>
49 49
     <label class="d-block">
50
-        <span><?php esc_html_e( 'Email Merge Tag', 'invoicing' ); ?></span>
50
+        <span><?php esc_html_e('Email Merge Tag', 'invoicing'); ?></span>
51 51
         <input :value='active_form_element.label | formatMergeTag' class='form-control bg-white' type="text" readonly onclick="this.select()" />
52
-        <span class="form-text text-muted"><?php esc_html_e( 'You can use this merge tag in notification emails', 'invoicing' ); ?></span>
52
+        <span class="form-text text-muted"><?php esc_html_e('You can use this merge tag in notification emails', 'invoicing'); ?></span>
53 53
     </label>
54 54
 </div>
55 55
 
Please login to merge, or discard this patch.
includes/admin/wpinv-admin-functions.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -7,65 +7,65 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14
-function wpinv_bulk_actions( $actions ) {
15
-    if ( isset( $actions['edit'] ) ) {
16
-        unset( $actions['edit'] );
14
+function wpinv_bulk_actions($actions) {
15
+    if (isset($actions['edit'])) {
16
+        unset($actions['edit']);
17 17
     }
18 18
 
19 19
     return $actions;
20 20
 }
21
-add_filter( 'bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions' );
22
-add_filter( 'bulk_actions-edit-wpi_item', 'wpinv_bulk_actions' );
21
+add_filter('bulk_actions-edit-wpi_invoice', 'wpinv_bulk_actions');
22
+add_filter('bulk_actions-edit-wpi_item', 'wpinv_bulk_actions');
23 23
 
24
-function wpinv_admin_post_id( $id = 0 ) {
24
+function wpinv_admin_post_id($id = 0) {
25 25
     global $post;
26 26
 
27
-    if ( isset( $id ) && ! empty( $id ) ) {
28
-        return (int)$id;
29
-    } else if ( get_the_ID() ) {
27
+    if (isset($id) && !empty($id)) {
28
+        return (int) $id;
29
+    } else if (get_the_ID()) {
30 30
         return (int) get_the_ID();
31
-    } else if ( isset( $post->ID ) && !empty( $post->ID ) ) {
31
+    } else if (isset($post->ID) && !empty($post->ID)) {
32 32
         return (int) $post->ID;
33
-    } else if ( isset( $_GET['post'] ) && !empty( $_GET['post'] ) ) {
33
+    } else if (isset($_GET['post']) && !empty($_GET['post'])) {
34 34
         return (int) $_GET['post'];
35
-    } else if ( isset( $_GET['id'] ) && !empty( $_GET['id'] ) ) {
35
+    } else if (isset($_GET['id']) && !empty($_GET['id'])) {
36 36
         return (int) $_GET['id'];
37
-    } else if ( isset( $_POST['id'] ) && !empty( $_POST['id'] ) ) {
37
+    } else if (isset($_POST['id']) && !empty($_POST['id'])) {
38 38
         return (int) $_POST['id'];
39 39
     } 
40 40
 
41 41
     return null;
42 42
 }
43 43
     
44
-function wpinv_admin_post_type( $id = 0 ) {
45
-    if ( !$id ) {
44
+function wpinv_admin_post_type($id = 0) {
45
+    if (!$id) {
46 46
         $id = wpinv_admin_post_id();
47 47
     }
48 48
     
49
-    $type = get_post_type( $id );
49
+    $type = get_post_type($id);
50 50
     
51
-    if ( !$type ) {
52
-        $type = isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) ? $_GET['post_type'] : null;
51
+    if (!$type) {
52
+        $type = isset($_GET['post_type']) && !empty($_GET['post_type']) ? $_GET['post_type'] : null;
53 53
     }
54 54
     
55
-    return apply_filters( 'wpinv_admin_post_type', $type, $id );
55
+    return apply_filters('wpinv_admin_post_type', $type, $id);
56 56
 }
57 57
 
58 58
 function wpinv_admin_messages() {
59
-	settings_errors( 'wpinv-notices' );
59
+	settings_errors('wpinv-notices');
60 60
 }
61
-add_action( 'admin_notices', 'wpinv_admin_messages' );
61
+add_action('admin_notices', 'wpinv_admin_messages');
62 62
 
63
-add_action( 'admin_init', 'wpinv_show_test_payment_gateway_notice' );
64
-function wpinv_show_test_payment_gateway_notice(){
65
-    add_action( 'admin_notices', 'wpinv_test_payment_gateway_messages' );
63
+add_action('admin_init', 'wpinv_show_test_payment_gateway_notice');
64
+function wpinv_show_test_payment_gateway_notice() {
65
+    add_action('admin_notices', 'wpinv_test_payment_gateway_messages');
66 66
 }
67 67
 
68
-function wpinv_test_payment_gateway_messages(){
68
+function wpinv_test_payment_gateway_messages() {
69 69
     $gateways = wpinv_get_enabled_payment_gateways();
70 70
     $name = array(); $test_gateways = '';
71 71
     if ($gateways) {
@@ -76,9 +76,9 @@  discard block
 block discarded – undo
76 76
         }
77 77
         $test_gateways = implode(', ', $name);
78 78
     }
79
-    if(isset($test_gateways) && !empty($test_gateways) && wpinv_current_user_can_manage_invoicing()){
79
+    if (isset($test_gateways) && !empty($test_gateways) && wpinv_current_user_can_manage_invoicing()) {
80 80
         $link = admin_url('admin.php?page=wpinv-settings&tab=gateways');
81
-        $notice = wp_sprintf( __('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link );
81
+        $notice = wp_sprintf(__('<strong>Important:</strong> Payment Gateway(s) %s are in testing mode and will not receive real payments. Go to <a href="%s"> Gateway Settings</a>.', 'invoicing'), $test_gateways, $link);
82 82
         ?>
83 83
         <div class="notice notice-warning is-dismissible">
84 84
             <p><?php echo $notice; ?></p>
@@ -95,29 +95,29 @@  discard block
 block discarded – undo
95 95
     global $wpdb;
96 96
 
97 97
     // Only do this on our settings page.
98
-    if ( empty( $_GET[ 'page' ] ) || 'wpinv-settings' !== $_GET[ 'page' ] ) {
98
+    if (empty($_GET['page']) || 'wpinv-settings' !== $_GET['page']) {
99 99
         return;
100 100
     }
101 101
 
102 102
     // Check tables.
103
-    $tables             = array(
103
+    $tables = array(
104 104
         "{$wpdb->prefix}wpinv_subscriptions",
105 105
         "{$wpdb->prefix}getpaid_invoices",
106 106
         "{$wpdb->prefix}getpaid_invoice_items",
107 107
     );
108 108
 
109
-    foreach ( $tables as $table ) {
110
-        if ( $table != $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) {
109
+    foreach ($tables as $table) {
110
+        if ($table != $wpdb->get_var("SHOW TABLES LIKE '$table'")) {
111 111
 
112
-            $url     = esc_url(
112
+            $url = esc_url(
113 113
                 wp_nonce_url(
114
-                    add_query_arg( 'getpaid-admin-action', 'create_missing_tables' ),
114
+                    add_query_arg('getpaid-admin-action', 'create_missing_tables'),
115 115
                     'getpaid-nonce',
116 116
                     'getpaid-nonce'
117 117
                 )
118 118
             );
119
-            $message  = __( 'Some GetPaid database tables are missing. To use GetPaid without any issues, click on the button below to create the missing tables.', 'invoicing' );
120
-            $message2 = __( 'Create Tables', 'invoicing' );
119
+            $message  = __('Some GetPaid database tables are missing. To use GetPaid without any issues, click on the button below to create the missing tables.', 'invoicing');
120
+            $message2 = __('Create Tables', 'invoicing');
121 121
             echo "<div class='notice notice-warning is-dismissible'><p>$message<br><br><a href='$url' class='button button-primary'>$message2</a></p></div>";
122 122
             break;
123 123
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
     }
126 126
 
127 127
 }
128
-add_action( 'admin_notices', 'wpinv_check_for_missing_tables' );
128
+add_action('admin_notices', 'wpinv_check_for_missing_tables');
129 129
 
130 130
 add_action('admin_init', 'wpinv_admin_search_by_invoice');
131 131
 
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 function wpinv_admin_search_by_invoice() {
136 136
     global $typenow;
137 137
 
138
-    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote' ) {
138
+    if ($typenow === 'wpi_invoice' || $typenow === 'wpi_quote') {
139 139
         add_filter('posts_search', 'wpinv_posts_search_example_type', 10, 2);
140 140
     }
141 141
 }
@@ -150,9 +150,9 @@  discard block
 block discarded – undo
150 150
     global $wpdb;
151 151
 
152 152
     if ($query->is_main_query() && !empty($query->query['s'])) {
153
-        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql( $query->query['s'] ) . "%' )";
154
-        if ( ! empty( $search ) ) {
155
-            $search = preg_replace( '/^ AND /', '', $search );
153
+        $conditions_str = "{$wpdb->posts}.post_author IN ( SELECT ID FROM {$wpdb->users} WHERE user_email LIKE '%" . esc_sql($query->query['s']) . "%' )";
154
+        if (!empty($search)) {
155
+            $search = preg_replace('/^ AND /', '', $search);
156 156
             $search = " AND ( {$search} OR ( {$conditions_str} ) )";
157 157
         } else {
158 158
             $search = " AND ( {$conditions_str} )";
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 /**
166 166
  * Resets invoice counts.
167 167
  */
168
-function wpinv_reset_invoice_count(){
169
-    if ( ! empty( $_GET['reset_invoice_count'] ) && isset( $_GET['_nonce'] ) && wp_verify_nonce( $_GET['_nonce'], 'reset_invoice_count' ) ) {
168
+function wpinv_reset_invoice_count() {
169
+    if (!empty($_GET['reset_invoice_count']) && isset($_GET['_nonce']) && wp_verify_nonce($_GET['_nonce'], 'reset_invoice_count')) {
170 170
         wpinv_update_option('invoice_sequence_start', 1);
171 171
         delete_option('wpinv_last_invoice_number');
172
-        getpaid_admin()->show_success( __( 'Invoice number sequence reset successfully.', 'invoicing' ) );
173
-        $url = remove_query_arg( array('reset_invoice_count', '_nonce') );
172
+        getpaid_admin()->show_success(__('Invoice number sequence reset successfully.', 'invoicing'));
173
+        $url = remove_query_arg(array('reset_invoice_count', '_nonce'));
174 174
         wp_redirect($url);
175 175
         exit();
176 176
     }
177 177
 }
178
-add_action( 'admin_init', 'wpinv_reset_invoice_count' );
178
+add_action('admin_init', 'wpinv_reset_invoice_count');
179 179
 
180 180
 /**
181 181
  * Displays line items on the invoice edit page.
@@ -184,29 +184,29 @@  discard block
 block discarded – undo
184 184
  * @param array $columns
185 185
  * @return string
186 186
  */
187
-function wpinv_admin_get_line_items( $invoice, $columns ) {
187
+function wpinv_admin_get_line_items($invoice, $columns) {
188 188
 
189 189
     ob_start();
190 190
 
191
-    do_action( 'getpaid_admin_before_line_items', $invoice );
191
+    do_action('getpaid_admin_before_line_items', $invoice);
192 192
 
193 193
     $count = 0;
194
-    foreach ( $invoice->get_items() as $item ) {
194
+    foreach ($invoice->get_items() as $item) {
195 195
 
196
-        $item_price     = wpinv_price( $item->get_price(), $invoice->get_currency() );
196
+        $item_price     = wpinv_price($item->get_price(), $invoice->get_currency());
197 197
         $quantity       = (int) $item->get_quantity();
198
-        $item_subtotal  = wpinv_price( $item->get_sub_total(), $invoice->get_currency() );
199
-        $summary        = apply_filters( 'getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice );
198
+        $item_subtotal  = wpinv_price($item->get_sub_total(), $invoice->get_currency());
199
+        $summary        = apply_filters('getpaid_admin_invoice_line_item_summary', $item->get_description(), $item, $invoice);
200 200
         $item_tax       = $item->item_tax;
201
-        $tax_rate       = wpinv_round_amount( getpaid_get_invoice_tax_rate( $invoice, $item ), 2, true ) . '%';;
202
-        $tax_rate       = empty( $tax_rate ) ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
201
+        $tax_rate       = wpinv_round_amount(getpaid_get_invoice_tax_rate($invoice, $item), 2, true) . '%'; ;
202
+        $tax_rate       = empty($tax_rate) ? ' <span class="tax-rate">(' . $tax_rate . '%)</span>' : '';
203 203
         $line_item_tax  = $item_tax . $tax_rate;
204
-        $line_item      = '<tr class="item item-' . ( ($count % 2 == 0) ? 'even' : 'odd' ) . '" data-item-id="' . esc_attr( $item->get_id() ) . '">';
204
+        $line_item      = '<tr class="item item-' . (($count % 2 == 0) ? 'even' : 'odd') . '" data-item-id="' . esc_attr($item->get_id()) . '">';
205 205
         $line_item     .= '<td class="id">' . (int) $item->get_id() . '</td>';
206
-        $line_item     .= '<td class="title"><a href="' . get_edit_post_link( $item->get_id() ) . '" target="_blank">' . $item->get_name() . '</a>';
206
+        $line_item     .= '<td class="title"><a href="' . get_edit_post_link($item->get_id()) . '" target="_blank">' . $item->get_name() . '</a>';
207 207
 
208
-        if ( $summary !== '' ) {
209
-            $line_item .= '<span class="meta">' . wpautop( wp_kses_post( $summary ) ) . '</span>';
208
+        if ($summary !== '') {
209
+            $line_item .= '<span class="meta">' . wpautop(wp_kses_post($summary)) . '</span>';
210 210
         }
211 211
 
212 212
         $line_item .= '</td>';
@@ -214,23 +214,23 @@  discard block
 block discarded – undo
214 214
         $line_item .= '<td class="qty" data-quantity="' . $quantity . '">&nbsp;&times;&nbsp;' . $quantity . '</td>';
215 215
         $line_item .= '<td class="total">' . $item_subtotal . '</td>';
216 216
 
217
-        if ( wpinv_use_taxes() && $invoice->is_taxable() ) {
217
+        if (wpinv_use_taxes() && $invoice->is_taxable()) {
218 218
             $line_item .= '<td class="tax">' . $line_item_tax . '</td>';
219 219
         }
220 220
 
221 221
         $line_item .= '<td class="action">';
222
-        if ( ! $invoice->is_paid() && ! $invoice->is_refunded() ) {
222
+        if (!$invoice->is_paid() && !$invoice->is_refunded()) {
223 223
             $line_item .= '<i class="fa fa-remove wpinv-item-remove"></i>';
224 224
         }
225 225
         $line_item .= '</td>';
226 226
         $line_item .= '</tr>';
227 227
 
228
-        echo apply_filters( 'getpaid_admin_line_item', $line_item, $item, $invoice );
228
+        echo apply_filters('getpaid_admin_line_item', $line_item, $item, $invoice);
229 229
 
230 230
         $count++;
231 231
     }
232 232
 
233
-    do_action( 'getpaid_admin_after_line_items', $invoice );
233
+    do_action('getpaid_admin_after_line_items', $invoice);
234 234
 
235 235
     return ob_get_clean();
236 236
 }
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form-submission-fees.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
  * Payment form submission fees class
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	 *
30 30
 	 * @param GetPaid_Payment_Form_Submission $submission
31 31
 	 */
32
-	public function __construct( $submission ) {
32
+	public function __construct($submission) {
33 33
 
34 34
 		// Process any existing invoice fees.
35
-		if ( $submission->has_invoice() ) {
35
+		if ($submission->has_invoice()) {
36 36
 			$this->fees = $submission->get_invoice()->get_fees();
37 37
 		}
38 38
 
@@ -40,14 +40,14 @@  discard block
 block discarded – undo
40 40
 		$data         = $submission->get_data();
41 41
 		$payment_form = $submission->get_payment_form();
42 42
 
43
-		foreach ( $payment_form->get_elements() as $element ) {
43
+		foreach ($payment_form->get_elements() as $element) {
44 44
 
45
-			if ( 'price_input' == $element['type'] ) {
46
-				$this->process_price_input( $element, $data, $submission );
45
+			if ('price_input' == $element['type']) {
46
+				$this->process_price_input($element, $data, $submission);
47 47
 			}
48 48
 
49
-			if ( 'price_select' == $element['type'] ) {
50
-				$this->process_price_select( $element, $data );
49
+			if ('price_select' == $element['type']) {
50
+				$this->process_price_select($element, $data);
51 51
 			}
52 52
 
53 53
 		}
@@ -61,21 +61,21 @@  discard block
 block discarded – undo
61 61
 	 * @param array $data
62 62
 	 * @param GetPaid_Payment_Form_Submission $submission
63 63
 	 */
64
-	public function process_price_input( $element, $data, $submission ) {
64
+	public function process_price_input($element, $data, $submission) {
65 65
 
66 66
 		// Abort if not passed.
67
-		if ( empty( $data[ $element['id'] ] ) ) {
67
+		if (empty($data[$element['id']])) {
68 68
 			return;
69 69
 		}
70 70
 
71
-		$amount  = (float) wpinv_sanitize_amount( $data[ $element['id'] ] );
72
-		$minimum = empty( $element['minimum'] ) ? 0 : (float) wpinv_sanitize_amount( $element['minimum'] );
71
+		$amount  = (float) wpinv_sanitize_amount($data[$element['id']]);
72
+		$minimum = empty($element['minimum']) ? 0 : (float) wpinv_sanitize_amount($element['minimum']);
73 73
 
74
-		if ( $amount < $minimum ) {
75
-			throw new Exception( sprintf( __( 'The minimum allowed amount is %s', 'invoicing' ), getpaid_unstandardize_amount( $minimum, $submission->get_currency() ) ) );
74
+		if ($amount < $minimum) {
75
+			throw new Exception(sprintf(__('The minimum allowed amount is %s', 'invoicing'), getpaid_unstandardize_amount($minimum, $submission->get_currency())));
76 76
 		}
77 77
 
78
-		$this->fees[ $element['label'] ] = array(
78
+		$this->fees[$element['label']] = array(
79 79
 			'name'          => $element['label'],
80 80
 			'initial_fee'   => $amount,
81 81
 			'recurring_fee' => 0,
@@ -89,35 +89,35 @@  discard block
 block discarded – undo
89 89
 	 * @param array $element
90 90
 	 * @param array $data
91 91
 	 */
92
-	public function process_price_select( $element, $data ) {
92
+	public function process_price_select($element, $data) {
93 93
 
94 94
 		// Abort if not passed.
95
-		if ( empty( $data[ $element['id'] ] ) ) {
95
+		if (empty($data[$element['id']])) {
96 96
 			return;
97 97
 		}
98 98
 
99
-		$options    = getpaid_convert_price_string_to_options( $element['options'] );
100
-		$selected   = array_filter( array_map( 'trim', explode( ',', $data[ $element['id'] ] ) ) );
99
+		$options    = getpaid_convert_price_string_to_options($element['options']);
100
+		$selected   = array_filter(array_map('trim', explode(',', $data[$element['id']])));
101 101
 		$total      = 0;
102 102
 		$sub_labels = array();
103 103
 
104
-		foreach ( $selected as $price ) {
104
+		foreach ($selected as $price) {
105 105
 
106
-			if ( ! isset( $options[ $price ] ) ) {
107
-				throw new Exception( __( 'You have selected an invalid amount', 'invoicing' ) );
106
+			if (!isset($options[$price])) {
107
+				throw new Exception(__('You have selected an invalid amount', 'invoicing'));
108 108
 			}
109 109
 
110
-			$price = explode( '|', $price );
110
+			$price = explode('|', $price);
111 111
 
112 112
 			$sub_labels[] = $price[0];
113
-			$total += (float) wpinv_sanitize_amount( $price[1] );
113
+			$total += (float) wpinv_sanitize_amount($price[1]);
114 114
 		}
115 115
 
116
-		$this->fees[ $element['label'] ] = array(
116
+		$this->fees[$element['label']] = array(
117 117
 			'name'          => $element['label'],
118 118
 			'initial_fee'   => $total,
119 119
 			'recurring_fee' => 0,
120
-			'description'   => implode( ', ', $sub_labels ),
120
+			'description'   => implode(', ', $sub_labels),
121 121
 		);
122 122
 
123 123
 	}
Please login to merge, or discard this patch.
includes/admin/class-getpaid-admin-setup-wizard.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * @version     2.4.0
11 11
  * @info        GetPaid Setup Wizard.
12 12
  */
13
-defined( 'ABSPATH' ) || exit;
13
+defined('ABSPATH') || exit;
14 14
 
15 15
 /**
16 16
  * GetPaid_Admin_Setup_Wizard class.
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	 */
45 45
 	public function __construct() {
46 46
 
47
-		if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && wpinv_current_user_can_manage_invoicing() ) {
48
-			add_action( 'admin_menu', array( $this, 'add_menu' ) );
49
-			add_action( 'current_screen', array( $this, 'setup_wizard' ) );
47
+		if (apply_filters('getpaid_enable_setup_wizard', true) && wpinv_current_user_can_manage_invoicing()) {
48
+			add_action('admin_menu', array($this, 'add_menu'));
49
+			add_action('current_screen', array($this, 'setup_wizard'));
50 50
 		}
51 51
 
52 52
 	}
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	 * @since 2.4.0
58 58
 	 */
59 59
 	public function add_menu() {
60
-		add_dashboard_page( '', '', wpinv_get_capability(), 'gp-setup', '' );
60
+		add_dashboard_page('', '', wpinv_get_capability(), 'gp-setup', '');
61 61
 	}
62 62
 
63 63
 	/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public function setup_wizard() {
69 69
 
70
-		if ( isset( $_GET['page'] ) && 'gp-setup' === $_GET['page'] ) {
70
+		if (isset($_GET['page']) && 'gp-setup' === $_GET['page']) {
71 71
 			$this->setup_globals();
72 72
 			$this->maybe_save_current_step();
73 73
 			$this->display_wizard();
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 	 * @since 2.4.0
95 95
 	 */
96 96
 	protected function maybe_save_current_step() {
97
-		if ( ! empty( $_POST['save_step'] ) && is_callable( $this->steps[ $this->step ]['handler'] ) ) {
98
-			call_user_func( $this->steps[ $this->step ]['handler'], $this );
97
+		if (!empty($_POST['save_step']) && is_callable($this->steps[$this->step]['handler'])) {
98
+			call_user_func($this->steps[$this->step]['handler'], $this);
99 99
 		}
100 100
 	}
101 101
 
@@ -110,44 +110,44 @@  discard block
 block discarded – undo
110 110
 		$steps = array(
111 111
 
112 112
 			'introduction'     => array(
113
-				'name'    => __( 'Introduction', 'invoicing' ),
114
-				'view'    => array( $this, 'setup_introduction' ),
113
+				'name'    => __('Introduction', 'invoicing'),
114
+				'view'    => array($this, 'setup_introduction'),
115 115
 				'handler' => '',
116 116
 			),
117 117
 
118 118
 			'business_details'             => array(
119
-				'name'    => __( "Business Details", 'invoicing' ),
120
-				'view'    => array( $this, 'setup_business' ),
119
+				'name'    => __("Business Details", 'invoicing'),
120
+				'view'    => array($this, 'setup_business'),
121 121
 				'handler' => '',
122 122
 			),
123 123
 
124 124
 			'currency' => array(
125
-				'name'    => __( 'Currency', 'invoicing' ),
126
-				'view'    => array( $this, 'setup_currency' ),
125
+				'name'    => __('Currency', 'invoicing'),
126
+				'view'    => array($this, 'setup_currency'),
127 127
 				'handler' => '',
128 128
 			),
129 129
 
130 130
 			'payments'        => array(
131
-				'name'    => __( 'Payment Gateways', 'invoicing' ),
132
-				'view'    => array( $this, 'setup_payments' ),
133
-				'handler' => array( $this, 'setup_payments_save' ),
131
+				'name'    => __('Payment Gateways', 'invoicing'),
132
+				'view'    => array($this, 'setup_payments'),
133
+				'handler' => array($this, 'setup_payments_save'),
134 134
 			),
135 135
 
136 136
 			'recommend'          => array(
137
-				'name'    => __( 'Recommend', 'invoicing' ),
138
-				'view'    => array( $this, 'setup_recommend' ),
137
+				'name'    => __('Recommend', 'invoicing'),
138
+				'view'    => array($this, 'setup_recommend'),
139 139
 				'handler' => '',
140 140
 			),
141 141
 
142 142
 			'next_steps'       => array(
143
-				'name'    => __( 'Get Paid', 'invoicing' ),
144
-				'view'    => array( $this, 'setup_ready' ),
143
+				'name'    => __('Get Paid', 'invoicing'),
144
+				'view'    => array($this, 'setup_ready'),
145 145
 				'handler' => '',
146 146
 			),
147 147
 
148 148
 		);
149 149
 
150
-		return apply_filters( 'getpaid_setup_wizard_steps', $steps );
150
+		return apply_filters('getpaid_setup_wizard_steps', $steps);
151 151
 
152 152
 	}
153 153
 
@@ -158,8 +158,8 @@  discard block
 block discarded – undo
158 158
 	 * @return string
159 159
 	 */
160 160
 	protected function get_current_step() {
161
-		$step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : '';
162
-		return ! empty( $step ) && in_array( $step, array_keys( $this->steps ) ) ? $step : current( array_keys( $this->steps ) );
161
+		$step = isset($_GET['step']) ? sanitize_key($_GET['step']) : '';
162
+		return !empty($step) && in_array($step, array_keys($this->steps)) ? $step : current(array_keys($this->steps));
163 163
 	}
164 164
 
165 165
 	/**
@@ -172,8 +172,8 @@  discard block
 block discarded – undo
172 172
 
173 173
 		$previous = false;
174 174
 		$current  = $this->step;
175
-		foreach ( array_keys( $this->steps ) as $step ) {
176
-			if ( $current === $step ) {
175
+		foreach (array_keys($this->steps) as $step) {
176
+			if ($current === $step) {
177 177
 				return $previous;
178 178
 			}
179 179
 
@@ -193,13 +193,13 @@  discard block
 block discarded – undo
193 193
 
194 194
 		$on_current = false;
195 195
 		$current    = $this->step;
196
-		foreach ( array_keys( $this->steps ) as $step ) {
196
+		foreach (array_keys($this->steps) as $step) {
197 197
 
198
-			if ( $on_current ) {
198
+			if ($on_current) {
199 199
 				return $step;
200 200
 			}
201 201
 
202
-			if ( $current === $step ) {
202
+			if ($current === $step) {
203 203
 				return $on_current = true;
204 204
 			}
205 205
 
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 		$steps     = $this->steps;
229 229
 		$current   = $this->step;
230 230
 		$next_step = $this->next_step;
231
-		array_shift( $steps );
232
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-header.php';
231
+		array_shift($steps);
232
+		include plugin_dir_path(__FILE__) . 'views/wizard-header.php';
233 233
 	}
234 234
 
235 235
 	/**
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 		?>
242 242
 			<div class="gp-setup-content rowx mw-100 text-center mb-3">
243 243
 				<div class="col-12 col-md-5 m-auto">
244
-					<?php call_user_func( $this->steps[ $this->step ]['view'], $this ); ?>
244
+					<?php call_user_func($this->steps[$this->step]['view'], $this); ?>
245 245
 				</div>
246 246
 			</div>
247 247
 		<?php
@@ -254,9 +254,9 @@  discard block
 block discarded – undo
254 254
 	 */
255 255
 	public function display_footer() {
256 256
 
257
-		if ( isset( $_GET['step'] ) ) {
258
-			$next_url = esc_url( $this->get_next_step_link() );
259
-			$label    = $this->step == 'next_steps' ? __( 'Return to the WordPress Dashboard', 'invoicing' ) : __( 'Skip this step', 'invoicing' );
257
+		if (isset($_GET['step'])) {
258
+			$next_url = esc_url($this->get_next_step_link());
259
+			$label    = $this->step == 'next_steps' ? __('Return to the WordPress Dashboard', 'invoicing') : __('Skip this step', 'invoicing');
260 260
 
261 261
 			echo '<p class="gd-return-to-dashboard-wrap"> <a href="' . $next_url . '" class="gd-return-to-dashboard btn btn-link d-block text-muted">' . $label . '</a></p>';
262 262
 		}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 */
272 272
 	public function setup_introduction() {
273 273
 		$next_url = $this->get_next_step_link();
274
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-introduction.php';
274
+		include plugin_dir_path(__FILE__) . 'views/wizard-introduction.php';
275 275
 	}
276 276
 
277 277
 	/**
@@ -284,22 +284,22 @@  discard block
 block discarded – undo
284 284
 	 *                      Empty string on failure.
285 285
 	 * @since 3.0.0
286 286
 	 */
287
-	public function get_next_step_link( $step = '' ) {
288
-		if ( ! $step ) {
287
+	public function get_next_step_link($step = '') {
288
+		if (!$step) {
289 289
 			$step = $this->step;
290 290
 		}
291 291
 
292
-		$keys = array_keys( $this->steps );
293
-		if ( end( $keys ) === $step ) {
292
+		$keys = array_keys($this->steps);
293
+		if (end($keys) === $step) {
294 294
 			return admin_url();
295 295
 		}
296 296
 
297
-		$step_index = array_search( $step, $keys );
298
-		if ( false === $step_index ) {
297
+		$step_index = array_search($step, $keys);
298
+		if (false === $step_index) {
299 299
 			return '';
300 300
 		}
301 301
 
302
-		return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] ));
302
+		return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1]));
303 303
 	}
304 304
 
305 305
 	/**
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 		$wizard   = $this;
313 313
 		$page     = 'wpinv_settings_general_main';
314 314
 		$section  = 'wpinv_settings_general_main';
315
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php';
315
+		include plugin_dir_path(__FILE__) . 'views/wizard-settings.php';
316 316
 	}
317 317
 
318 318
 	/**
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
 		$wizard   = $this;
326 326
 		$page     = 'wpinv_settings_general_currency_section';
327 327
 		$section  = 'wpinv_settings_general_currency_section';
328
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php';
328
+		include plugin_dir_path(__FILE__) . 'views/wizard-settings.php';
329 329
 	}
330 330
 
331 331
 	/**
@@ -336,35 +336,35 @@  discard block
 block discarded – undo
336 336
 	public function setup_recommend() {
337 337
 		$next_url            = $this->get_next_step_link();
338 338
 		$recommended_plugins = self::get_recommend_wp_plugins();
339
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-plugins.php';
339
+		include plugin_dir_path(__FILE__) . 'views/wizard-plugins.php';
340 340
 	}
341 341
 
342 342
 	/**
343 343
 	 * A list of recommended wp.org plugins.
344 344
 	 * @return array
345 345
 	 */
346
-	public static function get_recommend_wp_plugins(){
346
+	public static function get_recommend_wp_plugins() {
347 347
 		return array(
348 348
 			'ayecode-connect' => array(
349 349
 				'file'   => 'ayecode-connect/ayecode-connect.php',
350 350
 				'url'    => 'https://wordpress.org/plugins/ayecode-connect/',
351 351
 				'slug'   => 'ayecode-connect',
352 352
 				'name'   => 'AyeCode Connect',
353
-				'desc'   => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ),
353
+				'desc'   => __('Documentation and Support from within your WordPress admin.', 'geodirectory'),
354 354
 			),
355 355
 			'invoicing-quotes' => array(
356 356
 				'file'   => 'invoicing-quotes/wpinv-quote.php',
357 357
 				'url'    => 'https://wordpress.org/plugins/invoicing-quotes/',
358 358
 				'slug'   => 'invoicing-quotes',
359 359
 				'name'   => 'Customer Quotes',
360
-				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'),
360
+				'desc'   => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'),
361 361
 			),
362 362
 			'userswp'    => array(
363 363
 				'file'   => 'userswp/userswp.php',
364 364
 				'url'    => 'https://wordpress.org/plugins/userswp/',
365 365
 				'slug'   => 'userswp',
366 366
 				'name'   => 'UsersWP',
367
-				'desc'   => __('Frontend user login and registration as well as slick profile pages.','geodirectory'),
367
+				'desc'   => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'),
368 368
 			),
369 369
 		);
370 370
 	}
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function setup_payments() {
378 378
 		$next_url = $this->get_next_step_link();
379
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-gateways.php';
379
+		include plugin_dir_path(__FILE__) . 'views/wizard-gateways.php';
380 380
 	}
381 381
 
382 382
 	/**
@@ -387,16 +387,16 @@  discard block
 block discarded – undo
387 387
 	 * @since 2.0.0
388 388
 	 */
389 389
 	public function setup_payments_save() {
390
-		check_admin_referer( 'getpaid-setup-wizard', 'getpaid-setup-wizard' );
391
-		wpinv_update_option( 'manual_active', ! empty( $_POST['enable-manual-gateway'] ) );
390
+		check_admin_referer('getpaid-setup-wizard', 'getpaid-setup-wizard');
391
+		wpinv_update_option('manual_active', !empty($_POST['enable-manual-gateway']));
392 392
 
393
-		if ( ! empty( $_POST['paypal-email'] ) ) {
394
-			wpinv_update_option( 'paypal_email', sanitize_email( $_POST['paypal-email'] ) );
395
-			wpinv_update_option( 'paypal_active', 1 );
396
-			wpinv_update_option( 'paypal_sandbox', 0 );
393
+		if (!empty($_POST['paypal-email'])) {
394
+			wpinv_update_option('paypal_email', sanitize_email($_POST['paypal-email']));
395
+			wpinv_update_option('paypal_active', 1);
396
+			wpinv_update_option('paypal_sandbox', 0);
397 397
 		}
398 398
 
399
-		wp_redirect( esc_url_raw( $this->get_next_step_link() ) );
399
+		wp_redirect(esc_url_raw($this->get_next_step_link()));
400 400
 		exit;
401 401
 	}
402 402
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 	 * @since 2.0.0
407 407
 	 */
408 408
 	public function setup_ready() {
409
-		include plugin_dir_path( __FILE__ ) . 'views/wizard-thank-you.php';
409
+		include plugin_dir_path(__FILE__) . 'views/wizard-thank-you.php';
410 410
 	}
411 411
 
412 412
 }
Please login to merge, or discard this patch.
includes/admin/views/wizard-introduction.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -4,78 +4,78 @@  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
 
11 11
 <div class="card shadow-sm my-5">
12 12
 
13 13
     <h1 class="h4 card-header bg-white border-bottom-0 pt-4 pb-1">
14
-        <?php esc_html_e( 'Welcome to the GetPaid Setup Wizard!', 'invoicing' ); ?>
14
+        <?php esc_html_e('Welcome to the GetPaid Setup Wizard!', 'invoicing'); ?>
15 15
     </h1>
16 16
 
17 17
     <div class="card-body text-muted ">
18
-        <p><?php _e( 'Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing' ); ?></p>
18
+        <p><?php _e('Thank you for choosing GetPaid - The most Powerful Payments Plugin for WordPress', 'invoicing'); ?></p>
19 19
         <hr class="mt-4 pt-3 pb-0" />
20
-        <p class="small"><?php _e( 'This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes</b>.', 'invoicing' ); ?></p>
20
+        <p class="small"><?php _e('This quick setup wizard will help you <b>configure the basic settings</b>. It’s <b>completely optional</b> and shouldn’t take longer than <b>five minutes</b>.', 'invoicing'); ?></p>
21 21
     </div>
22 22
 
23 23
     <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
24 24
         <a
25
-            href="<?php echo esc_url( $next_url ); ?>"
26
-            class="btn btn-primary button-next"><?php esc_html_e( "Let's go!", 'invoicing' ); ?></a>
25
+            href="<?php echo esc_url($next_url); ?>"
26
+            class="btn btn-primary button-next"><?php esc_html_e("Let's go!", 'invoicing'); ?></a>
27 27
         <a
28
-            href="<?php echo esc_url( admin_url() ); ?>"
29
-            class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
28
+            href="<?php echo esc_url(admin_url()); ?>"
29
+            class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
30 30
     </div>
31 31
 </div>
32 32
 
33 33
 <div class="card shadow-sm my-5 overflow-hidden">
34 34
     <h1 class="h4 card-header bg-white border-bottom-0  pt-4 pb-1">
35
-        <?php esc_html_e( 'GetPaid Features & Addons!', 'invoicing' ); ?>
35
+        <?php esc_html_e('GetPaid Features & Addons!', 'invoicing'); ?>
36 36
     </h1>
37 37
 
38 38
     <div class="card-body text-muted overflow-hidden">
39
-		<p><?php _e( 'Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing' ); ?></p>
39
+		<p><?php _e('Collect one time & recurring payments online within minutes. No complex setup required.', 'invoicing'); ?></p>
40 40
 		<hr>
41 41
 
42 42
 		<div class="row row-cols-2 text-left">
43 43
 			<div class="col mt-3">
44 44
 				<div class="media">
45
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg';?>" class="mr-3" alt="...">
45
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/buy.svg'; ?>" class="mr-3" alt="...">
46 46
                     <div class="media-body">
47
-                        <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via Buy Now Buttons', 'invoicing' );?></h6>
48
-                        <small><?php _e( 'Sell via buy now buttons anywhere on your site', 'invoicing' );?></small>
47
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Buy Now Buttons', 'invoicing'); ?></h6>
48
+                        <small><?php _e('Sell via buy now buttons anywhere on your site', 'invoicing'); ?></small>
49 49
                     </div>
50 50
                 </div>
51 51
 			</div>
52 52
 
53 53
             <div class="col mt-3">
54 54
                 <div class="media">
55
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg';?>" class="mr-3" alt="...">
55
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/report.svg'; ?>" class="mr-3" alt="...">
56 56
                         <div class="media-body">
57
-                        <h6 class="mt-0 font-weight-bold"><?php _e( 'GetPaid via payment form', 'invoicing' );?></h6>
58
-                        <small><?php _e( 'Payment forms are conversion-optimized checkout forms', 'invoicing' );?></small>
57
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via payment form', 'invoicing'); ?></h6>
58
+                        <small><?php _e('Payment forms are conversion-optimized checkout forms', 'invoicing'); ?></small>
59 59
                     </div>
60 60
                 </div>
61 61
 		    </div>
62 62
 
63 63
             <div class="col mt-3">
64 64
                 <div class="media">
65
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg';?>" class="mr-3" alt="...">
65
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/invoices.svg'; ?>" class="mr-3" alt="...">
66 66
                     <div class="media-body">
67
-                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice','invoicing');?></h6>
68
-                        <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard','invoicing');?></small>
67
+                        <h6 class="mt-0 font-weight-bold"><?php _e('GetPaid via Invoice', 'invoicing'); ?></h6>
68
+                        <small><?php _e('Create and send invoices for just about anything from the WordPress dashboard', 'invoicing'); ?></small>
69 69
                     </div>
70 70
                 </div>
71 71
 		    </div>
72 72
 
73 73
             <div class="col mt-3">
74 74
                 <div class="media">
75
-                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg';?>" class="mr-3" alt="...">
75
+                    <img src="<?php echo WPINV_PLUGIN_URL . 'assets/images/payment.svg'; ?>" class="mr-3" alt="...">
76 76
                     <div class="media-body">
77
-                        <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways','invoicing');?></h6>
78
-                        <small><?php _e('On average our gateways are over 66% cheaper than our competition','invoicing');?></small>
77
+                        <h6 class="mt-0 font-weight-bold"><?php _e('Affordable payment gateways', 'invoicing'); ?></h6>
78
+                        <small><?php _e('On average our gateways are over 66% cheaper than our competition', 'invoicing'); ?></small>
79 79
                     </div>
80 80
                 </div>
81 81
 		    </div>
@@ -86,51 +86,51 @@  discard block
 block discarded – undo
86 86
 	<div class="mt-5">
87 87
 		<a
88 88
             href="https://wpgetpaid.com/features-list/"
89
-			class="btn btn-primary"><?php esc_html_e( 'View All Features!', 'invoicing' ); ?></a>
89
+			class="btn btn-primary"><?php esc_html_e('View All Features!', 'invoicing'); ?></a>
90 90
 	</div>
91 91
 
92 92
 	<div class="mt-5 mx-n4 py-4" style="background:#eafaf6;">
93
-		<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e( 'More with Membership!' , 'invoicing' );?></h4>
93
+		<h4 class="mt-0 font-weight-bold text-dark mb-4"><?php _e('More with Membership!', 'invoicing'); ?></h4>
94 94
 		<div class="row row-cols-2 text-left px-5">
95 95
 
96 96
 			<div class="col">
97 97
 				<ul class="list-unstyled">
98
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'PDF Invoices' , 'invoicing' );?></li>
99
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Gravity Forms' , 'invoicing' );?></li>
100
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Contact form 7' , 'invoicing' );?></li>
101
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'AffiliateWP Integration' , 'invoicing' );?></li>
98
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('PDF Invoices', 'invoicing'); ?></li>
99
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Gravity Forms', 'invoicing'); ?></li>
100
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Contact form 7', 'invoicing'); ?></li>
101
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('AffiliateWP Integration', 'invoicing'); ?></li>
102 102
 				</ul>
103 103
 			</div>
104 104
 
105 105
 			<div class="col">
106 106
 				<ul class="list-unstyled">
107
-			    	<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Ninja forms' , 'invoicing' );?></li>
108
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Digital Downloads' , 'invoicing' );?></li>
109
-					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e( 'Wallet' , 'invoicing' );?></li>
107
+			    	<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Ninja forms', 'invoicing'); ?></li>
108
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Digital Downloads', 'invoicing'); ?></li>
109
+					<li class="my-2"><i class="far fa-check-circle text-success"></i> <?php _e('Wallet', 'invoicing'); ?></li>
110 110
 				</ul>
111 111
 			</div>
112 112
 		</div>
113 113
 
114
-		<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From','invoicing');?></h5>
115
-		<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e( '$49', 'invoicing' ); ?></h1>
114
+		<h5 class="mt-4 font-weight-bold text-dark mb-3"><?php _e('Membership Starts From', 'invoicing'); ?></h5>
115
+		<h1 class="mt-0 font-weight-bold text-dark mb-4 display-3"><?php esc_html_e('$49', 'invoicing'); ?></h1>
116 116
 
117 117
 		<div class="mt-2">
118 118
 			<a
119 119
                 href="https://wpgetpaid.com/downloads/membership/"
120
-				class="btn btn-primary"><?php esc_html_e( 'Buy Membership Now!', 'invoicing' ); ?></a>
120
+				class="btn btn-primary"><?php esc_html_e('Buy Membership Now!', 'invoicing'); ?></a>
121 121
 		</div>
122 122
 
123 123
 	</div>
124 124
 
125 125
     <div class="card-footer mb-0 bg-white gp-setup-actions step border-top-0">
126 126
         <a
127
-            href="<?php echo esc_url( $next_url ); ?>"
128
-            class="btn btn-outline-primary button-next"><?php esc_html_e( 'Launch the Setup Wizard!', 'invoicing' ); ?></a>
127
+            href="<?php echo esc_url($next_url); ?>"
128
+            class="btn btn-outline-primary button-next"><?php esc_html_e('Launch the Setup Wizard!', 'invoicing'); ?></a>
129 129
         <a
130 130
             href="https://docs.wpgetpaid.com/"
131
-            class="btn btn-outline-primary ml-4"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a>
131
+            class="btn btn-outline-primary ml-4"><?php esc_html_e('Documentation', 'invoicing'); ?></a>
132 132
         <a
133
-            href="<?php echo esc_url( admin_url() ); ?>"
134
-            class="btn btn-link d-block mt-2 "><?php esc_html_e( 'Not right now', 'invoicing' ); ?></a>
133
+            href="<?php echo esc_url(admin_url()); ?>"
134
+            class="btn btn-link d-block mt-2 "><?php esc_html_e('Not right now', 'invoicing'); ?></a>
135 135
     </div>
136 136
 </div>
Please login to merge, or discard this patch.
includes/class-getpaid-daily-maintenance.php 1 patch
Spacing   +35 added lines, -35 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,20 +15,20 @@  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, 'check_renewing_subscriptions' ) );
31
-		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, 'check_renewing_subscriptions'));
31
+		add_action('getpaid_daily_maintenance', array($this, 'maybe_update_geoip_databases'));
32 32
 
33 33
 	}
34 34
 
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function maybe_create_scheduled_event() {
40 40
 
41
-		if ( ! wp_next_scheduled( 'getpaid_daily_maintenance' ) ) {
42
-			$timestamp = strtotime( 'tomorrow 07:00:00', current_time( 'timestamp' ) );
43
-			wp_schedule_event( $timestamp, 'daily', 'getpaid_daily_maintenance' );
41
+		if (!wp_next_scheduled('getpaid_daily_maintenance')) {
42
+			$timestamp = strtotime('tomorrow 07:00:00', current_time('timestamp'));
43
+			wp_schedule_event($timestamp, 'daily', 'getpaid_daily_maintenance');
44 44
 		}
45 45
 
46 46
 	}
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
 	 */
52 52
 	public function maybe_clear_deprecated_events() {
53 53
 
54
-		if ( ! get_option( 'wpinv_cleared_old_events' ) ) {
55
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_twicedaily' );
56
-			wp_clear_scheduled_hook( 'wpinv_register_schedule_event_daily' );
57
-			update_option( 'wpinv_cleared_old_events', 1 );
54
+		if (!get_option('wpinv_cleared_old_events')) {
55
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_twicedaily');
56
+			wp_clear_scheduled_hook('wpinv_register_schedule_event_daily');
57
+			update_option('wpinv_cleared_old_events', 1);
58 58
 		}
59 59
 
60 60
 	}
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	 *
65 65
 	 */
66 66
 	public function backwards_compat() {
67
-		do_action( 'wpinv_register_schedule_event_daily' );
67
+		do_action('wpinv_register_schedule_event_daily');
68 68
 	}
69 69
 
70 70
 	/**
@@ -74,29 +74,29 @@  discard block
 block discarded – undo
74 74
 	public function check_renewing_subscriptions() {
75 75
 
76 76
 		// Fetch subscriptions that expire today.
77
-		$args  = array(
77
+		$args = array(
78 78
 			'number'             => -1,
79 79
 			'count_total'        => false,
80 80
 			'status'             => 'trialling active',
81 81
 			'date_expires_query' => array(
82 82
 				array(
83
-					'year'          => date( 'Y', current_time( 'timestamp' ) ),
84
-					'month'         => date( 'n', current_time( 'timestamp' ) ),
85
-					'day'           => date( 'j', current_time( 'timestamp' ) ),
83
+					'year'          => date('Y', current_time('timestamp')),
84
+					'month'         => date('n', current_time('timestamp')),
85
+					'day'           => date('j', current_time('timestamp')),
86 86
 					'compare'       => '=',
87 87
 				),
88 88
 			),
89 89
 		);
90 90
 
91
-		$subscriptions = new GetPaid_Subscriptions_Query( $args );
91
+		$subscriptions = new GetPaid_Subscriptions_Query($args);
92 92
 
93
-		foreach ( $subscriptions->get_results() as $subscription ) {
93
+		foreach ($subscriptions->get_results() as $subscription) {
94 94
 
95 95
 			/** @var WPInv_Subscription $subscription */
96
-			if ( $subscription->is_last_renewal() ) {
96
+			if ($subscription->is_last_renewal()) {
97 97
 				$subscription->complete();
98 98
 			} else {
99
-				do_action( 'getpaid_should_renew_subscription', $subscription );
99
+				do_action('getpaid_should_renew_subscription', $subscription);
100 100
 			}
101 101
 
102 102
 		}
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	public function maybe_expire_subscriptions() {
111 111
 
112 112
 		// Fetch expired subscriptions (skips those that expire today).
113
-		$args  = array(
113
+		$args = array(
114 114
 			'number'             => -1,
115 115
 			'count_total'        => false,
116 116
 			'status'             => 'trialling active failing cancelled',
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 			),
121 121
 		);
122 122
 
123
-		$subscriptions = new GetPaid_Subscriptions_Query( $args );
123
+		$subscriptions = new GetPaid_Subscriptions_Query($args);
124 124
 
125
-		foreach ( $subscriptions->get_results() as $subscription ) {
126
-			if ( apply_filters( 'getpaid_daily_maintenance_should_expire_subscription', false, $subscription ) ) {
127
-				$subscription->set_status( 'expired' );
125
+		foreach ($subscriptions->get_results() as $subscription) {
126
+			if (apply_filters('getpaid_daily_maintenance_should_expire_subscription', false, $subscription)) {
127
+				$subscription->set_status('expired');
128 128
 				$subscription->save();
129 129
 			}
130 130
 		}
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 */
138 138
 	public function log_cron_run() {
139
-		wpinv_error_log( 'GetPaid Daily Cron', false );
139
+		wpinv_error_log('GetPaid Daily Cron', false);
140 140
 	}
141 141
 
142 142
 	/**
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 	 *
145 145
 	 */
146 146
 	public function maybe_update_geoip_databases() {
147
-		$updated = get_transient( 'getpaid_updated_geoip_databases' );
147
+		$updated = get_transient('getpaid_updated_geoip_databases');
148 148
 
149
-		if ( false === $updated ) {
150
-			set_transient( 'getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS );
151
-			do_action( 'getpaid_update_geoip_databases' );
149
+		if (false === $updated) {
150
+			set_transient('getpaid_updated_geoip_databases', 1, 15 * DAY_IN_SECONDS);
151
+			do_action('getpaid_update_geoip_databases');
152 152
 		}
153 153
 
154 154
 	}
Please login to merge, or discard this patch.
includes/class-wpinv-addons.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * All Invoicing extensions screen related functions can be found here.
6 6
  *
7 7
  */
8
-if ( ! defined( 'ABSPATH' ) ) {
8
+if (!defined('ABSPATH')) {
9 9
 	exit;
10 10
 }
11 11
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @return array of tabs.
22 22
 	 */
23
-	public function get_tabs(){
23
+	public function get_tabs() {
24 24
 		$tabs = array(
25 25
 			'addons' => __("Addons", "invoicing"),
26 26
             'gateways' => __("Payment Gateways", "invoicing"),
@@ -38,28 +38,28 @@  discard block
 block discarded – undo
38 38
 	 *
39 39
 	 * @return array
40 40
 	 */
41
-	public function get_section_data( $section_id ) {
42
-		$section      = self::get_tab( $section_id );
41
+	public function get_section_data($section_id) {
42
+		$section      = self::get_tab($section_id);
43 43
 		$api_url = "https://wpinvoicing.com/edd-api/v2/products/";
44 44
 		$section_data = new stdClass();
45 45
 
46
-		if($section_id=='recommended_plugins'){
46
+		if ($section_id == 'recommended_plugins') {
47 47
 			$section_data->products = self::get_recommend_wp_plugins_edd_formatted();
48 48
 		}
49
-		elseif ( ! empty( $section ) ) {
50
-			if ( false === ( $section_data = get_transient( 'wpi_addons_section_' . $section_id ) ) ) { //@todo restore after testing
49
+		elseif (!empty($section)) {
50
+			if (false === ($section_data = get_transient('wpi_addons_section_' . $section_id))) { //@todo restore after testing
51 51
 			//if ( 1==1) {
52 52
 
53
-				$query_args = array( 'category' => $section_id, 'number' => 100);
54
-				$query_args = apply_filters('wpeu_edd_api_query_args',$query_args,$api_url,$section_id);
53
+				$query_args = array('category' => $section_id, 'number' => 100);
54
+				$query_args = apply_filters('wpeu_edd_api_query_args', $query_args, $api_url, $section_id);
55 55
 
56
-				$raw_section = wp_safe_remote_get( esc_url_raw( add_query_arg($query_args ,$api_url) ), array( 'user-agent' => 'Invoicing Addons Page','timeout'     => 15, ) );
56
+				$raw_section = wp_safe_remote_get(esc_url_raw(add_query_arg($query_args, $api_url)), array('user-agent' => 'Invoicing Addons Page', 'timeout'     => 15,));
57 57
 
58
-				if ( ! is_wp_error( $raw_section ) ) {
59
-					$section_data = json_decode( wp_remote_retrieve_body( $raw_section ) );
58
+				if (!is_wp_error($raw_section)) {
59
+					$section_data = json_decode(wp_remote_retrieve_body($raw_section));
60 60
 
61
-					if ( ! empty( $section_data->products ) ) {
62
-						set_transient( 'wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS );
61
+					if (!empty($section_data->products)) {
62
+						set_transient('wpi_addons_section_' . $section_id, $section_data, DAY_IN_SECONDS);
63 63
 					}
64 64
 				}
65 65
 			}
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
 		}
68 68
 
69 69
 		$products = isset($section_data->products) ? $section_data->products : array();
70
-		if ( 'addons' == $section_id ) {
70
+		if ('addons' == $section_id) {
71 71
 
72 72
 			$quotes = new stdClass();
73 73
 			$quotes->info = new stdClass();
74 74
 			$quotes->info->id = '';
75 75
 			$quotes->info->slug = 'invoicing-quotes';
76
-			$quotes->info->title = __( 'Quotes', 'invoicing' );
77
-			$quotes->info->excerpt = __( 'Create quotes and estimates', 'invoicing' );
76
+			$quotes->info->title = __('Quotes', 'invoicing');
77
+			$quotes->info->excerpt = __('Create quotes and estimates', 'invoicing');
78 78
 			$quotes->info->link = 'https://wordpress.org/plugins/invoicing-quotes/';
79 79
 			$quotes->info->thumbnail = 'https://wpgetpaid.com/wp-content/uploads/sites/13/edd/2019/11/Quotes-1-768x384.png';
80 80
 
81 81
 			$products[] = $quotes;
82 82
 		}
83 83
 		
84
-		return apply_filters( 'wpi_addons_section_data', $products, $section_id );
84
+		return apply_filters('wpi_addons_section_data', $products, $section_id);
85 85
 	}
86 86
 
87 87
 	/**
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	 * @param string $theme
93 93
 	 * @param string $plugin
94 94
 	 */
95
-	public function output_button( $addon ) {
96
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
95
+	public function output_button($addon) {
96
+		$current_tab = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
97 97
 //		$button_text = __('Free','invoicing');
98 98
 //		$licensing = false;
99 99
 //		$installed = false;
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
 //		$install_status = 'get';
106 106
 //		$onclick = '';
107 107
 
108
-		$wp_org_themes = array('supreme-directory','directory-starter');
108
+		$wp_org_themes = array('supreme-directory', 'directory-starter');
109 109
 
110 110
 		$button_args = array(
111
-			'type' => ($current_tab == 'addons' || $current_tab =='gateways') ? 'addons' : $current_tab,
111
+			'type' => ($current_tab == 'addons' || $current_tab == 'gateways') ? 'addons' : $current_tab,
112 112
 			'id' => isset($addon->info->id) ? absint($addon->info->id) : '',
113 113
 			'title' => isset($addon->info->title) ? $addon->info->title : '',
114
-			'button_text' => __('Free','invoicing'),
115
-			'price_text' => __('Free','invoicing'),
114
+			'button_text' => __('Free', 'invoicing'),
115
+			'price_text' => __('Free', 'invoicing'),
116 116
 			'link' => isset($addon->info->link) ? $addon->info->link : '', // link to product
117 117
 			'url' => isset($addon->info->link) ? $addon->info->link : '', // button url
118 118
 			'class' => 'button-primary',
@@ -128,83 +128,83 @@  discard block
 block discarded – undo
128 128
 			'update_url' => '',
129 129
 		);
130 130
 
131
-		if( 'invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ( $current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug )){
132
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
133
-			$status = install_plugin_install_status(array("slug"=>$button_args['slug'],"version"=>""));
131
+		if ('invoicing-quotes' == $addon->info->slug || 'getpaid-stripe-payments' == $addon->info->slug || ($current_tab == 'recommended_plugins' && isset($addon->info->slug) && $addon->info->slug)) {
132
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
133
+			$status = install_plugin_install_status(array("slug"=>$button_args['slug'], "version"=>""));
134 134
 			$button_args['install_status'] = isset($status['status']) ? $status['status'] : 'install';
135 135
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
136
-		}elseif( ($current_tab == 'addons' || $current_tab =='gateways') && isset($addon->info->id) && $addon->info->id){
137
-			include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
138
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
136
+		}elseif (($current_tab == 'addons' || $current_tab == 'gateways') && isset($addon->info->id) && $addon->info->id) {
137
+			include_once(ABSPATH . 'wp-admin/includes/plugin-install.php'); //for plugins_api..
138
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
139 139
 			$status = self::install_plugin_install_status($addon);
140 140
 			$button_args['file'] = isset($status['file']) ? $status['file'] : '';
141
-			if(isset($status['status'])){$button_args['install_status'] = $status['status'];}
141
+			if (isset($status['status'])) {$button_args['install_status'] = $status['status']; }
142 142
 			$button_args['update_url'] = "https://wpinvoicing.com";
143
-		}elseif($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
144
-			if(!empty($addon->licensing->edd_slug)){$button_args['slug'] = $addon->licensing->edd_slug;}
143
+		}elseif ($current_tab == 'themes' && isset($addon->info->id) && $addon->info->id) {
144
+			if (!empty($addon->licensing->edd_slug)) {$button_args['slug'] = $addon->licensing->edd_slug; }
145 145
 			$button_args['installed'] = self::is_theme_installed($addon);
146
-			if(!in_array($button_args['slug'],$wp_org_themes)){
146
+			if (!in_array($button_args['slug'], $wp_org_themes)) {
147 147
 				$button_args['update_url'] = "https://wpinvoicing.com";
148 148
 			}
149 149
 		}
150 150
 
151 151
 		// set price
152
-		if(isset($addon->pricing) && !empty($addon->pricing)){
153
-			if(is_object($addon->pricing)){
154
-				$prices = (Array)$addon->pricing;
152
+		if (isset($addon->pricing) && !empty($addon->pricing)) {
153
+			if (is_object($addon->pricing)) {
154
+				$prices = (Array) $addon->pricing;
155 155
 				$button_args['price'] = reset($prices);
156
-			}elseif(isset($addon->pricing)){
156
+			}elseif (isset($addon->pricing)) {
157 157
 				$button_args['price'] = $addon->pricing;
158 158
 			}
159 159
 		}
160 160
 
161 161
 		// set price text
162
-		if( $button_args['price'] && $button_args['price'] != '0.00' ){
163
-			$button_args['price_text'] = sprintf( __('From: $%d', 'invoicing'), $button_args['price']);
162
+		if ($button_args['price'] && $button_args['price'] != '0.00') {
163
+			$button_args['price_text'] = sprintf(__('From: $%d', 'invoicing'), $button_args['price']);
164 164
 		}
165 165
 
166 166
 
167 167
 		// set if installed
168
-		if(in_array($button_args['install_status'], array('installed','latest_installed','update_available','newer_installed'))){
168
+		if (in_array($button_args['install_status'], array('installed', 'latest_installed', 'update_available', 'newer_installed'))) {
169 169
 			$button_args['installed'] = true;
170 170
 		}
171 171
 
172 172
 //		print_r($button_args);
173 173
 		// set if active
174
-		if($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')){
175
-			if($button_args['type'] != 'themes'){
174
+		if ($button_args['installed'] && ($button_args['file'] || $button_args['type'] == 'themes')) {
175
+			if ($button_args['type'] != 'themes') {
176 176
 				$button_args['active'] = is_plugin_active($button_args['file']);
177
-			}else{
177
+			} else {
178 178
 				$button_args['active'] = self::is_theme_active($addon);
179 179
 			}
180 180
 		}
181 181
 
182 182
 		// set button text and class
183
-		if($button_args['active']){
184
-			$button_args['button_text'] = __('Active','invoicing');
183
+		if ($button_args['active']) {
184
+			$button_args['button_text'] = __('Active', 'invoicing');
185 185
 			$button_args['class'] = ' button-secondary disabled ';
186
-		}elseif($button_args['installed']){
187
-			$button_args['button_text'] = __('Activate','invoicing');
186
+		}elseif ($button_args['installed']) {
187
+			$button_args['button_text'] = __('Activate', 'invoicing');
188 188
 
189
-			if($button_args['type'] != 'themes'){
190
-				if ( current_user_can( 'manage_options' ) ) {
191
-					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$button_args['file']), 'activate-plugin_' . $button_args['file']);
192
-				}else{
189
+			if ($button_args['type'] != 'themes') {
190
+				if (current_user_can('manage_options')) {
191
+					$button_args['url'] = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $button_args['file']), 'activate-plugin_' . $button_args['file']);
192
+				} else {
193 193
 					$button_args['url'] = '#';
194 194
 				}
195
-			}else{
196
-				if ( current_user_can( 'switch_themes' ) ) {
195
+			} else {
196
+				if (current_user_can('switch_themes')) {
197 197
 					$button_args['url'] = self::get_theme_activation_url($addon);
198
-				}else{
198
+				} else {
199 199
 					$button_args['url'] = '#';
200 200
 				}
201 201
 			}
202 202
 
203
-		}else{
204
-			if($button_args['type'] == 'recommended_plugins'){
205
-				$button_args['button_text'] = __('Install','invoicing');
206
-			}else{
207
-				$button_args['button_text'] = __('Get it','invoicing');
203
+		} else {
204
+			if ($button_args['type'] == 'recommended_plugins') {
205
+				$button_args['button_text'] = __('Install', 'invoicing');
206
+			} else {
207
+				$button_args['button_text'] = __('Get it', 'invoicing');
208 208
 
209 209
 				/*if($button_args['type'] == 'themes' && in_array($button_args['slug'],$wp_org_themes) ){
210 210
 					$button_args['button_text'] = __('Install','invoicing');
@@ -217,45 +217,45 @@  discard block
 block discarded – undo
217 217
 
218 218
 		
219 219
 		// filter the button arguments
220
-		$button_args = apply_filters('edd_api_button_args',$button_args);
220
+		$button_args = apply_filters('edd_api_button_args', $button_args);
221 221
 //		print_r($button_args);
222 222
 		// set price text
223
-		if(isset($button_args['price_text'])){
223
+		if (isset($button_args['price_text'])) {
224 224
 			?>
225 225
 			<a
226 226
 				target="_blank"
227 227
 				class="addons-price-text"
228
-				href="<?php echo esc_url( $button_args['link'] ); ?>">
229
-				<?php echo esc_html( $button_args['price_text'] ); ?>
228
+				href="<?php echo esc_url($button_args['link']); ?>">
229
+				<?php echo esc_html($button_args['price_text']); ?>
230 230
 			</a>
231 231
 			<?php
232 232
 		}
233 233
 
234 234
 
235 235
 		$target = '';
236
-		if ( ! empty( $button_args['url'] ) ) {
236
+		if (!empty($button_args['url'])) {
237 237
 			$target = strpos($button_args['url'], get_site_url()) !== false ? '' : ' target="_blank" ';
238 238
 		}
239 239
 
240 240
 		?>
241 241
 		<a
242
-			data-licence="<?php echo esc_attr($button_args['license']);?>"
243
-			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0;?>"
244
-			data-title="<?php echo esc_attr($button_args['title']);?>"
245
-			data-type="<?php echo esc_attr($button_args['type']);?>"
246
-			data-text-error-message="<?php _e('Something went wrong!','invoicing');?>"
247
-			data-text-activate="<?php _e('Activate','invoicing');?>"
248
-			data-text-activating="<?php _e('Activating','invoicing');?>"
249
-			data-text-deactivate="<?php _e('Deactivate','invoicing');?>"
250
-			data-text-installed="<?php _e('Installed','invoicing');?>"
251
-			data-text-install="<?php _e('Install','invoicing');?>"
252
-			data-text-installing="<?php _e('Installing','invoicing');?>"
253
-			data-text-error="<?php _e('Error','invoicing');?>"
254
-			<?php if(!empty($button_args['onclick'])){echo " onclick='".$button_args['onclick']."' ";}?>
255
-			<?php echo $target;?>
256
-			class="addons-button  <?php echo esc_attr( $button_args['class'] ); ?>"
257
-			href="<?php echo esc_url( $button_args['url'] ); ?>">
258
-			<?php echo esc_html( $button_args['button_text'] ); ?>
242
+			data-licence="<?php echo esc_attr($button_args['license']); ?>"
243
+			data-licensing="<?php echo $button_args['licensing'] ? 1 : 0; ?>"
244
+			data-title="<?php echo esc_attr($button_args['title']); ?>"
245
+			data-type="<?php echo esc_attr($button_args['type']); ?>"
246
+			data-text-error-message="<?php _e('Something went wrong!', 'invoicing'); ?>"
247
+			data-text-activate="<?php _e('Activate', 'invoicing'); ?>"
248
+			data-text-activating="<?php _e('Activating', 'invoicing'); ?>"
249
+			data-text-deactivate="<?php _e('Deactivate', 'invoicing'); ?>"
250
+			data-text-installed="<?php _e('Installed', 'invoicing'); ?>"
251
+			data-text-install="<?php _e('Install', 'invoicing'); ?>"
252
+			data-text-installing="<?php _e('Installing', 'invoicing'); ?>"
253
+			data-text-error="<?php _e('Error', 'invoicing'); ?>"
254
+			<?php if (!empty($button_args['onclick'])) {echo " onclick='" . $button_args['onclick'] . "' "; }?>
255
+			<?php echo $target; ?>
256
+			class="addons-button  <?php echo esc_attr($button_args['class']); ?>"
257
+			href="<?php echo esc_url($button_args['url']); ?>">
258
+			<?php echo esc_html($button_args['button_text']); ?>
259 259
 		</a>
260 260
 		<?php
261 261
 
@@ -270,36 +270,36 @@  discard block
 block discarded – undo
270 270
 		$tabs            = self::get_tabs();
271 271
 		$sections        = self::get_sections();
272 272
 		$theme           = wp_get_theme();
273
-		$section_keys    = array_keys( $sections );
274
-		$current_section = isset( $_GET['section'] ) ? sanitize_text_field( $_GET['section'] ) : current( $section_keys );
275
-		$current_tab     = empty( $_GET['tab'] ) ? 'addons' : sanitize_title( $_GET['tab'] );
276
-		include_once( WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php' );
273
+		$section_keys    = array_keys($sections);
274
+		$current_section = isset($_GET['section']) ? sanitize_text_field($_GET['section']) : current($section_keys);
275
+		$current_tab     = empty($_GET['tab']) ? 'addons' : sanitize_title($_GET['tab']);
276
+		include_once(WPINV_PLUGIN_DIR . '/includes/admin/html-admin-page-addons.php');
277 277
 	}
278 278
 
279 279
 	/**
280 280
 	 * A list of recommended wp.org plugins.
281 281
 	 * @return array
282 282
 	 */
283
-	public function get_recommend_wp_plugins(){
283
+	public function get_recommend_wp_plugins() {
284 284
 		$plugins = array(
285 285
             'invoicing-quotes' => array(
286 286
                 'url'   => 'https://wordpress.org/plugins/invoicing-quotes/',
287 287
                 'slug'   => 'invoicing-quotes',
288 288
 				'name'   => 'Quotes',
289 289
 				'thumbnail'  => 'https://ps.w.org/invoicing-quotes/assets/banner-772x250.png',
290
-                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.','invoicing'),
290
+                'desc'   => __('Allows you to create quotes, send them to clients and convert them to Invoices when accepted by the customer.', 'invoicing'),
291 291
             ),
292 292
             'geodirectory' => array(
293 293
                 'url'   => 'https://wordpress.org/plugins/geodirectory/',
294 294
                 'slug'   => 'geodirectory',
295 295
                 'name'   => 'GeoDirectory',
296
-                'desc'   => __('Turn any WordPress theme into a global business directory portal.','invoicing'),
296
+                'desc'   => __('Turn any WordPress theme into a global business directory portal.', 'invoicing'),
297 297
             ),
298 298
             'userswp' => array(
299 299
                 'url'   => 'https://wordpress.org/plugins/userswp/',
300 300
                 'slug'   => 'userswp',
301 301
                 'name'   => 'UsersWP',
302
-                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.','invoicing'),
302
+                'desc'   => __('Allow frontend user login and registration as well as have slick profile pages.', 'invoicing'),
303 303
             ),
304 304
 		);
305 305
 
Please login to merge, or discard this patch.