@@ -6,25 +6,25 @@ discard block |
||
6 | 6 | global $give_receipt_args, $payment; |
7 | 7 | |
8 | 8 | // Validation: Ensure $payment var is set. |
9 | -if ( empty( $payment ) ) { |
|
10 | - $payment = ! empty( $give_receipt_args['id'] ) ? get_post( $give_receipt_args['id'] ) : 0; |
|
9 | +if (empty($payment)) { |
|
10 | + $payment = ! empty($give_receipt_args['id']) ? get_post($give_receipt_args['id']) : 0; |
|
11 | 11 | } |
12 | 12 | |
13 | 13 | // Double-Validation: Check for $payment global. |
14 | -if ( empty( $payment ) ) { |
|
15 | - Give()->notices->print_frontend_notice( __( 'The specified receipt ID appears to be invalid.', 'give' ) ); |
|
14 | +if (empty($payment)) { |
|
15 | + Give()->notices->print_frontend_notice(__('The specified receipt ID appears to be invalid.', 'give')); |
|
16 | 16 | |
17 | 17 | return; |
18 | 18 | } |
19 | 19 | |
20 | 20 | $donation_id = $payment->ID; |
21 | -$form_id = give_get_payment_meta( $donation_id, '_give_payment_form_id', true ); |
|
22 | -$meta = give_get_payment_meta( $donation_id ); |
|
23 | -$donation = give_get_payment_form_title( $meta ); |
|
24 | -$user = give_get_payment_meta_user_info( $donation_id ); |
|
25 | -$email = give_get_payment_user_email( $donation_id ); |
|
21 | +$form_id = give_get_payment_meta($donation_id, '_give_payment_form_id', true); |
|
22 | +$meta = give_get_payment_meta($donation_id); |
|
23 | +$donation = give_get_payment_form_title($meta); |
|
24 | +$user = give_get_payment_meta_user_info($donation_id); |
|
25 | +$email = give_get_payment_user_email($donation_id); |
|
26 | 26 | $status = $payment->post_status; |
27 | -$status_label = give_get_payment_status( $payment, true ); |
|
27 | +$status_label = give_get_payment_status($payment, true); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Generate Donation Receipt Arguments. |
@@ -34,56 +34,56 @@ discard block |
||
34 | 34 | * @since 1.8.8 |
35 | 35 | */ |
36 | 36 | $give_receipt_args['donation_receipt']['donor'] = array( |
37 | - 'name' => __( 'Donor', 'give' ), |
|
38 | - 'value' => $user['first_name'] . ' ' . $user['last_name'], |
|
37 | + 'name' => __('Donor', 'give'), |
|
38 | + 'value' => $user['first_name'].' '.$user['last_name'], |
|
39 | 39 | 'display' => $give_receipt_args['donor'], |
40 | 40 | ); |
41 | 41 | |
42 | 42 | $give_receipt_args['donation_receipt']['date'] = array( |
43 | - 'name' => __( 'Date', 'give' ), |
|
44 | - 'value' => date_i18n( give_date_format(), strtotime( $meta['date'] ) ), |
|
43 | + 'name' => __('Date', 'give'), |
|
44 | + 'value' => date_i18n(give_date_format(), strtotime($meta['date'])), |
|
45 | 45 | 'display' => $give_receipt_args['date'], |
46 | 46 | ); |
47 | 47 | |
48 | 48 | $give_receipt_args['donation_receipt']['total_donation'] = array( |
49 | - 'name' => __( 'Total Donation', 'give' ), |
|
50 | - 'value' => give_payment_amount( $donation_id ), |
|
49 | + 'name' => __('Total Donation', 'give'), |
|
50 | + 'value' => give_payment_amount($donation_id), |
|
51 | 51 | 'display' => true, |
52 | 52 | ); |
53 | 53 | |
54 | 54 | $give_receipt_args['donation_receipt']['donation'] = array( |
55 | - 'name' => __( 'Donation', 'give' ), |
|
55 | + 'name' => __('Donation', 'give'), |
|
56 | 56 | 'value' => $donation, |
57 | 57 | 'display' => true, |
58 | 58 | ); |
59 | 59 | |
60 | 60 | $give_receipt_args['donation_receipt']['donation_status'] = array( |
61 | - 'name' => __( 'Donation Status', 'give' ), |
|
62 | - 'value' => esc_attr( $status ), |
|
61 | + 'name' => __('Donation Status', 'give'), |
|
62 | + 'value' => esc_attr($status), |
|
63 | 63 | 'display' => $give_receipt_args['payment_status'], |
64 | 64 | ); |
65 | 65 | |
66 | 66 | $give_receipt_args['donation_receipt']['donation_id'] = array( |
67 | - 'name' => __( 'Donation ID', 'give' ), |
|
67 | + 'name' => __('Donation ID', 'give'), |
|
68 | 68 | 'value' => $donation_id, |
69 | - 'display' => ($give_receipt_args['payment_id'])?true:false, |
|
69 | + 'display' => ($give_receipt_args['payment_id']) ?true:false, |
|
70 | 70 | ); |
71 | 71 | |
72 | 72 | $give_receipt_args['donation_receipt']['payment_details'] = array( |
73 | - 'name' => __( 'Payment:', 'give' ), |
|
74 | - 'value' => __( 'Details:', 'give' ), |
|
75 | - 'display' => ($give_receipt_args['payment_id'])?false:true, |
|
73 | + 'name' => __('Payment:', 'give'), |
|
74 | + 'value' => __('Details:', 'give'), |
|
75 | + 'display' => ($give_receipt_args['payment_id']) ?false:true, |
|
76 | 76 | ); |
77 | 77 | |
78 | 78 | $give_receipt_args['donation_receipt']['payment_key'] = array( |
79 | - 'name' => __( 'Payment Key', 'give' ), |
|
80 | - 'value' => get_post_meta( $donation_id, '_give_payment_purchase_key', true ), |
|
79 | + 'name' => __('Payment Key', 'give'), |
|
80 | + 'value' => get_post_meta($donation_id, '_give_payment_purchase_key', true), |
|
81 | 81 | 'display' => $give_receipt_args['payment_key'], |
82 | 82 | ); |
83 | 83 | |
84 | 84 | $give_receipt_args['donation_receipt']['payment_method'] = array( |
85 | - 'name' => __( 'Payment Method', 'give' ), |
|
86 | - 'value' => give_get_gateway_checkout_label( give_get_payment_gateway( $donation_id ) ), |
|
85 | + 'name' => __('Payment Method', 'give'), |
|
86 | + 'value' => give_get_gateway_checkout_label(give_get_payment_gateway($donation_id)), |
|
87 | 87 | 'display' => true, |
88 | 88 | ); |
89 | 89 | |
@@ -98,49 +98,49 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @since 1.8.8 |
100 | 100 | */ |
101 | -$give_receipt_args['donation_receipt'] = apply_filters( 'give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id ); |
|
101 | +$give_receipt_args['donation_receipt'] = apply_filters('give_donation_receipt_args', $give_receipt_args['donation_receipt'], $donation_id, $form_id); |
|
102 | 102 | |
103 | 103 | // Show payment status notice based on shortcode attribute. |
104 | -if ( filter_var( $give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN ) ) { |
|
104 | +if (filter_var($give_receipt_args['status_notice'], FILTER_VALIDATE_BOOLEAN)) { |
|
105 | 105 | $notice_message = ''; |
106 | 106 | $notice_type = 'warning'; |
107 | 107 | |
108 | - switch ( $status ) { |
|
108 | + switch ($status) { |
|
109 | 109 | case 'publish': |
110 | - $notice_message = __( 'Payment Complete: Thank you for your donation.', 'give' ); |
|
110 | + $notice_message = __('Payment Complete: Thank you for your donation.', 'give'); |
|
111 | 111 | $notice_type = 'success'; |
112 | 112 | break; |
113 | 113 | case 'pending': |
114 | - $notice_message = __( 'Payment Pending: Your donation is currently processing.', 'give' ); |
|
114 | + $notice_message = __('Payment Pending: Your donation is currently processing.', 'give'); |
|
115 | 115 | $notice_type = 'warning'; |
116 | 116 | break; |
117 | 117 | case 'refunded': |
118 | - $notice_message = __( 'Payment Refunded: Your donation has been refunded.', 'give' ); |
|
118 | + $notice_message = __('Payment Refunded: Your donation has been refunded.', 'give'); |
|
119 | 119 | $notice_type = 'warning'; |
120 | 120 | break; |
121 | 121 | case 'preapproval': |
122 | - $notice_message = __( 'Payment Preapproved: Thank you for your donation.', 'give' ); |
|
122 | + $notice_message = __('Payment Preapproved: Thank you for your donation.', 'give'); |
|
123 | 123 | $notice_type = 'warning'; |
124 | 124 | break; |
125 | 125 | case 'failed': |
126 | - $notice_message = __( 'Payment Failed: Please contact the site owner for assistance.', 'give' ); |
|
126 | + $notice_message = __('Payment Failed: Please contact the site owner for assistance.', 'give'); |
|
127 | 127 | $notice_type = 'error'; |
128 | 128 | break; |
129 | 129 | case 'cancelled': |
130 | - $notice_message = __( 'Payment Cancelled: Your donation has been cancelled.', 'give' ); |
|
130 | + $notice_message = __('Payment Cancelled: Your donation has been cancelled.', 'give'); |
|
131 | 131 | $notice_type = 'error'; |
132 | 132 | break; |
133 | 133 | case 'abandoned': |
134 | - $notice_message = __( 'Payment Abandoned: This donation has not been completed.', 'give' ); |
|
134 | + $notice_message = __('Payment Abandoned: This donation has not been completed.', 'give'); |
|
135 | 135 | $notice_type = 'error'; |
136 | 136 | break; |
137 | 137 | case 'revoked': |
138 | - $notice_message = __( 'Payment Revoked: Please contact the site owner for assistance.', 'give' ); |
|
138 | + $notice_message = __('Payment Revoked: Please contact the site owner for assistance.', 'give'); |
|
139 | 139 | $notice_type = 'error'; |
140 | 140 | break; |
141 | 141 | } |
142 | 142 | |
143 | - if ( ! empty( $notice_message ) ) { |
|
143 | + if ( ! empty($notice_message)) { |
|
144 | 144 | /** |
145 | 145 | * Filters payment status notice for receipts. |
146 | 146 | * |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @param string $status Payment status. |
156 | 156 | * @param array $meta Array of meta data related to the payment. |
157 | 157 | */ |
158 | - echo apply_filters( 'give_receipt_status_notice', Give()->notices->print_frontend_notice( $notice_message, false, $notice_type ), $id, $status, $meta ); |
|
158 | + echo apply_filters('give_receipt_status_notice', Give()->notices->print_frontend_notice($notice_message, false, $notice_type), $id, $status, $meta); |
|
159 | 159 | } |
160 | 160 | }// End if(). |
161 | 161 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * @param object $payment The payment object. |
170 | 170 | * @param array $give_receipt_args Receipt_argument. |
171 | 171 | */ |
172 | -do_action( 'give_payment_receipt_before_table', $payment, $give_receipt_args ); |
|
172 | +do_action('give_payment_receipt_before_table', $payment, $give_receipt_args); |
|
173 | 173 | ?> |
174 | 174 | |
175 | 175 | <table id="give_donation_receipt" class="give-table"> |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | * @param object $payment The payment object. |
186 | 186 | * @param array $give_receipt_args Receipt_argument. |
187 | 187 | */ |
188 | - do_action( 'give_payment_receipt_header_before', $payment, $give_receipt_args ); |
|
188 | + do_action('give_payment_receipt_header_before', $payment, $give_receipt_args); |
|
189 | 189 | ?> |
190 | 190 | <tr> |
191 | 191 | <th scope="colgroup" colspan="2"> |
192 | - <span class="give-receipt-thead-text"><?php esc_html_e( 'Donation Receipt', 'give' ) ?></span> |
|
192 | + <span class="give-receipt-thead-text"><?php esc_html_e('Donation Receipt', 'give') ?></span> |
|
193 | 193 | </th> |
194 | 194 | </tr> |
195 | 195 | <?php |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @param object $payment The payment object. |
204 | 204 | * @param array $give_receipt_args Receipt_argument. |
205 | 205 | */ |
206 | - do_action( 'give_payment_receipt_header_after', $payment, $give_receipt_args ); |
|
206 | + do_action('give_payment_receipt_header_after', $payment, $give_receipt_args); |
|
207 | 207 | ?> |
208 | 208 | </thead> |
209 | 209 | |
@@ -219,11 +219,11 @@ discard block |
||
219 | 219 | * @param object $payment The payment object. |
220 | 220 | * @param array $give_receipt_args Receipt_argument. |
221 | 221 | */ |
222 | - do_action( 'give_payment_receipt_before', $payment, $give_receipt_args ); |
|
222 | + do_action('give_payment_receipt_before', $payment, $give_receipt_args); |
|
223 | 223 | ?> |
224 | 224 | |
225 | - <?php foreach ( $give_receipt_args['donation_receipt'] as $receipt_item ) { ?> |
|
226 | - <?php if ( filter_var( $receipt_item['display'], FILTER_VALIDATE_BOOLEAN ) ) : ?> |
|
225 | + <?php foreach ($give_receipt_args['donation_receipt'] as $receipt_item) { ?> |
|
226 | + <?php if (filter_var($receipt_item['display'], FILTER_VALIDATE_BOOLEAN)) : ?> |
|
227 | 227 | <tr> |
228 | 228 | <td scope="row"><strong><?php echo $receipt_item['name']; ?></strong></td> |
229 | 229 | <td><?php echo $receipt_item['value']; ?></td> |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param object $payment The payment object. |
243 | 243 | * @param array $give_receipt_args Receipt_argument. |
244 | 244 | */ |
245 | - do_action( 'give_payment_receipt_after', $payment, $give_receipt_args ); |
|
245 | + do_action('give_payment_receipt_after', $payment, $give_receipt_args); |
|
246 | 246 | ?> |
247 | 247 | </tbody> |
248 | 248 | </table> |
@@ -258,5 +258,5 @@ discard block |
||
258 | 258 | * @param object $payment The payment object. |
259 | 259 | * @param array $give_receipt_args Receipt_argument. |
260 | 260 | */ |
261 | -do_action( 'give_payment_receipt_after_table', $payment, $give_receipt_args ); |
|
261 | +do_action('give_payment_receipt_after_table', $payment, $give_receipt_args); |
|
262 | 262 | ?> |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // Exit if accessed directly. |
14 | -if ( ! defined( 'ABSPATH' ) ) { |
|
14 | +if ( ! defined('ABSPATH')) { |
|
15 | 15 | exit; |
16 | 16 | } |
17 | 17 | |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @since 1.0 |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_action( 'admin_menu', array( $this, 'admin_menus' ) ); |
|
39 | - add_action( 'admin_head', array( $this, 'admin_head' ) ); |
|
40 | - add_action( 'admin_init', array( $this, 'welcome' ) ); |
|
38 | + add_action('admin_menu', array($this, 'admin_menus')); |
|
39 | + add_action('admin_head', array($this, 'admin_head')); |
|
40 | + add_action('admin_init', array($this, 'welcome')); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,45 +49,45 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function admin_menus() { |
52 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
52 | + list($display_version) = explode('-', GIVE_VERSION); |
|
53 | 53 | |
54 | 54 | // About Page |
55 | 55 | add_dashboard_page( |
56 | 56 | /* translators: %s: Give version */ |
57 | - sprintf( esc_html__( 'Welcome to Give %s', 'give' ), $display_version ), |
|
58 | - esc_html__( 'Welcome to Give', 'give' ), |
|
57 | + sprintf(esc_html__('Welcome to Give %s', 'give'), $display_version), |
|
58 | + esc_html__('Welcome to Give', 'give'), |
|
59 | 59 | $this->minimum_capability, |
60 | 60 | 'give-about', |
61 | - array( $this, 'about_screen' ) |
|
61 | + array($this, 'about_screen') |
|
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Changelog Page |
65 | 65 | add_dashboard_page( |
66 | - esc_html__( 'Give Changelog', 'give' ), |
|
67 | - esc_html__( 'Give Changelog', 'give' ), |
|
66 | + esc_html__('Give Changelog', 'give'), |
|
67 | + esc_html__('Give Changelog', 'give'), |
|
68 | 68 | $this->minimum_capability, |
69 | 69 | 'give-changelog', |
70 | - array( $this, 'changelog_screen' ) |
|
70 | + array($this, 'changelog_screen') |
|
71 | 71 | ); |
72 | 72 | |
73 | 73 | // Getting Started Page |
74 | 74 | add_dashboard_page( |
75 | 75 | /* translators: %s: Give version */ |
76 | - sprintf( esc_html__( 'Give %s - Getting Started Guide', 'give' ), $display_version ), |
|
77 | - esc_html__( 'Getting started with Give', 'give' ), |
|
76 | + sprintf(esc_html__('Give %s - Getting Started Guide', 'give'), $display_version), |
|
77 | + esc_html__('Getting started with Give', 'give'), |
|
78 | 78 | $this->minimum_capability, |
79 | 79 | 'give-getting-started', |
80 | - array( $this, 'getting_started_screen' ) |
|
80 | + array($this, 'getting_started_screen') |
|
81 | 81 | ); |
82 | 82 | |
83 | 83 | // Credits Page |
84 | 84 | add_dashboard_page( |
85 | 85 | /* translators: %s: Give version */ |
86 | - sprintf( esc_html__( 'Give %s - Credits', 'give' ), $display_version ), |
|
87 | - esc_html__( 'The people that build Give', 'give' ), |
|
86 | + sprintf(esc_html__('Give %s - Credits', 'give'), $display_version), |
|
87 | + esc_html__('The people that build Give', 'give'), |
|
88 | 88 | $this->minimum_capability, |
89 | 89 | 'give-credits', |
90 | - array( $this, 'credits_screen' ) |
|
90 | + array($this, 'credits_screen') |
|
91 | 91 | ); |
92 | 92 | } |
93 | 93 | |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function admin_head() { |
102 | 102 | |
103 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
104 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
105 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
106 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
103 | + remove_submenu_page('index.php', 'give-about'); |
|
104 | + remove_submenu_page('index.php', 'give-changelog'); |
|
105 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
106 | + remove_submenu_page('index.php', 'give-credits'); |
|
107 | 107 | |
108 | 108 | } |
109 | 109 | |
@@ -115,24 +115,24 @@ discard block |
||
115 | 115 | * @return void |
116 | 116 | */ |
117 | 117 | public function tabs() { |
118 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
118 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
119 | 119 | ?> |
120 | 120 | <h2 class="nav-tab-wrapper"> |
121 | 121 | <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" |
122 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
123 | - <?php esc_html_e( 'About Give', 'give' ); ?> |
|
122 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
123 | + <?php esc_html_e('About Give', 'give'); ?> |
|
124 | 124 | </a> |
125 | 125 | <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" |
126 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
127 | - <?php esc_html_e( 'Getting Started', 'give' ); ?> |
|
126 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
127 | + <?php esc_html_e('Getting Started', 'give'); ?> |
|
128 | 128 | </a> |
129 | 129 | <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" |
130 | - href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
131 | - <?php esc_html_e( 'Credits', 'give' ); ?> |
|
130 | + href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
131 | + <?php esc_html_e('Credits', 'give'); ?> |
|
132 | 132 | </a> |
133 | 133 | <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" |
134 | - href="<?php echo esc_url( admin_url( 'edit.php?post_type=give_forms&page=give-addons' ) ); ?>"> |
|
135 | - <?php esc_html_e( 'Add-ons', 'give' ); ?> |
|
134 | + href="<?php echo esc_url(admin_url('edit.php?post_type=give_forms&page=give-addons')); ?>"> |
|
135 | + <?php esc_html_e('Add-ons', 'give'); ?> |
|
136 | 136 | </a> |
137 | 137 | </h2> |
138 | 138 | <?php |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @return void |
147 | 147 | */ |
148 | 148 | public function about_screen() { |
149 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
149 | + list($display_version) = explode('-', GIVE_VERSION); |
|
150 | 150 | ?> |
151 | 151 | <div class="wrap about-wrap"> |
152 | 152 | |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | <p class="about-text"><?php |
156 | 156 | printf( |
157 | 157 | /* translators: %s: https://givewp.com/documenation/ */ |
158 | - __( 'Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), |
|
159 | - esc_url( 'https://givewp.com/documenation/' ) |
|
158 | + __('Thank you for activating or updating to the latest version of Give! If you\'re a first time user, welcome! You\'re well on your way to empowering your cause. We encourage you to check out the <a href="%s" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), |
|
159 | + esc_url('https://givewp.com/documenation/') |
|
160 | 160 | ); |
161 | 161 | ?></p> |
162 | 162 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | <div class="give-badge"><?php |
166 | 166 | printf( |
167 | 167 | /* translators: %s: Give version */ |
168 | - esc_html__( 'Version %s', 'give' ), |
|
168 | + esc_html__('Version %s', 'give'), |
|
169 | 169 | $display_version |
170 | 170 | ); |
171 | 171 | ?></div> |
@@ -175,17 +175,17 @@ discard block |
||
175 | 175 | <div class="feature-section clearfix introduction"> |
176 | 176 | |
177 | 177 | <div class="video feature-section-item"> |
178 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | - alt="<?php esc_attr_e( 'Give', 'give' ); ?>"> |
|
178 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" |
|
179 | + alt="<?php esc_attr_e('Give', 'give'); ?>"> |
|
180 | 180 | </div> |
181 | 181 | |
182 | 182 | <div class="content feature-section-item last-feature"> |
183 | 183 | |
184 | - <h3><?php esc_html_e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
184 | + <h3><?php esc_html_e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
185 | 185 | |
186 | - <p><?php esc_html_e( 'Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give' ); ?></p> |
|
186 | + <p><?php esc_html_e('Give empowers you to easily accept donations and setup fundraising campaigns, directly within WordPress. We created Give to provide a better donation experience for you and your users. Robust, flexible, and intuitive, the plugin is built from the ground up to be the goto donation solution for WordPress. Create powerful donation forms, embed them throughout your website, start a campaign, and exceed your fundraising goals with Give. This plugin is actively developed and proudly supported by folks who are dedicated to helping you and your cause.', 'give'); ?></p> |
|
187 | 187 | <a href="https://givewp.com" target="_blank" class="button-secondary"> |
188 | - <?php esc_html_e( 'Learn More', 'give' ); ?> |
|
188 | + <?php esc_html_e('Learn More', 'give'); ?> |
|
189 | 189 | <span class="dashicons dashicons-external"></span> |
190 | 190 | </a> |
191 | 191 | |
@@ -198,22 +198,22 @@ discard block |
||
198 | 198 | |
199 | 199 | <div class="content feature-section-item"> |
200 | 200 | |
201 | - <h3><?php esc_html_e( 'Getting to Know Give', 'give' ); ?></h3> |
|
201 | + <h3><?php esc_html_e('Getting to Know Give', 'give'); ?></h3> |
|
202 | 202 | |
203 | - <p><?php esc_html_e( 'Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give' ); ?></p> |
|
203 | + <p><?php esc_html_e('Before you get started with Give we suggest you take a look at the online documentation. There you will find the getting started guide which will help you get up and running quickly. If you have a question, issue or bug with the Core plugin please submit an issue on the Give website. We also welcome your feedback and feature requests. Welcome to Give. We hope you much success with your cause.', 'give'); ?></p> |
|
204 | 204 | |
205 | 205 | <h4>Find Out More:</h4> |
206 | 206 | <ul class="ul-disc"> |
207 | - <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e( 'Visit the Give Website', 'give' ); ?></a></li> |
|
208 | - <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e( 'View the Give Features', 'give' ); ?></a></li> |
|
209 | - <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e( 'Read the Documentation', 'give' ); ?></a></li> |
|
207 | + <li><a href="https://givewp.com/" target="_blank"><?php esc_html_e('Visit the Give Website', 'give'); ?></a></li> |
|
208 | + <li><a href="https://givewp.com/features/" target="_blank"><?php esc_html_e('View the Give Features', 'give'); ?></a></li> |
|
209 | + <li><a href="https://givewp.com/documentation/" target="_blank"><?php esc_html_e('Read the Documentation', 'give'); ?></a></li> |
|
210 | 210 | </ul> |
211 | 211 | |
212 | 212 | </div> |
213 | 213 | |
214 | 214 | <div class="content feature-section-item last-feature"> |
215 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | - alt="<?php esc_attr_e( 'A Give donation form', 'give' ); ?>"> |
|
215 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/admin/give-form-mockup.png' ?>" |
|
216 | + alt="<?php esc_attr_e('A Give donation form', 'give'); ?>"> |
|
217 | 217 | </div> |
218 | 218 | |
219 | 219 | </div> |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return void |
233 | 233 | */ |
234 | 234 | public function changelog_screen() { |
235 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
235 | + list($display_version) = explode('-', GIVE_VERSION); |
|
236 | 236 | ?> |
237 | 237 | <div class="wrap about-wrap"> |
238 | 238 | <h1><?php echo get_admin_page_title(); ?></h1> |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | <p class="about-text"><?php |
241 | 241 | printf( |
242 | 242 | /* translators: %s: Give version */ |
243 | - esc_html__( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), |
|
243 | + esc_html__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), |
|
244 | 244 | $display_version |
245 | 245 | ); |
246 | 246 | ?></p> |
247 | 247 | <div class="give-badge"><?php |
248 | 248 | printf( |
249 | 249 | /* translators: %s: Give version */ |
250 | - esc_html__( 'Version %s', 'give' ), |
|
250 | + esc_html__('Version %s', 'give'), |
|
251 | 251 | $display_version |
252 | 252 | ); |
253 | 253 | ?></div> |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | <?php $this->tabs(); ?> |
256 | 256 | |
257 | 257 | <div class="changelog"> |
258 | - <h3><?php esc_html_e( 'Full Changelog', 'give' ); ?></h3> |
|
258 | + <h3><?php esc_html_e('Full Changelog', 'give'); ?></h3> |
|
259 | 259 | |
260 | 260 | <div class="feature-section"> |
261 | 261 | <?php echo $this->parse_readme(); ?> |
@@ -263,10 +263,10 @@ discard block |
||
263 | 263 | </div> |
264 | 264 | |
265 | 265 | <div class="return-to-dashboard"> |
266 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
266 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
267 | 267 | 'post_type' => 'give_forms', |
268 | 268 | 'page' => 'give-settings' |
269 | - ), 'edit.php' ) ) ); ?>"><?php esc_html_e( 'Give Settings', 'give' ); ?></a> |
|
269 | + ), 'edit.php'))); ?>"><?php esc_html_e('Give Settings', 'give'); ?></a> |
|
270 | 270 | </div> |
271 | 271 | </div> |
272 | 272 | <?php |
@@ -280,36 +280,36 @@ discard block |
||
280 | 280 | * @return void |
281 | 281 | */ |
282 | 282 | public function getting_started_screen() { |
283 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
283 | + list($display_version) = explode('-', GIVE_VERSION); |
|
284 | 284 | ?> |
285 | 285 | <div class="wrap about-wrap get-started"> |
286 | 286 | |
287 | 287 | <?php $this->get_welcome_header() ?> |
288 | 288 | |
289 | - <p class="about-text"><?php esc_html_e( 'Welcome to the getting started guide.', 'give' ); ?></p> |
|
289 | + <p class="about-text"><?php esc_html_e('Welcome to the getting started guide.', 'give'); ?></p> |
|
290 | 290 | |
291 | 291 | <?php give_get_newsletter(); ?> |
292 | 292 | |
293 | 293 | <div class="give-badge"><?php |
294 | 294 | printf( |
295 | 295 | /* translators: %s: Give version */ |
296 | - esc_html__( 'Version %s', 'give' ), |
|
296 | + esc_html__('Version %s', 'give'), |
|
297 | 297 | $display_version |
298 | 298 | ); |
299 | 299 | ?></div> |
300 | 300 | |
301 | 301 | <?php $this->tabs(); ?> |
302 | 302 | |
303 | - <p class="about-text"><?php printf( esc_html__( 'Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give' ), $display_version ); ?></p> |
|
303 | + <p class="about-text"><?php printf(esc_html__('Getting started with Give is easy! We put together this quick start guide to help first time users of the plugin. Our goal is to get you up and running in no time. Let\'s begin!', 'give'), $display_version); ?></p> |
|
304 | 304 | |
305 | 305 | <div class="feature-section clearfix"> |
306 | 306 | |
307 | 307 | <div class="content feature-section-item"> |
308 | - <h3><?php esc_html_e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
308 | + <h3><?php esc_html_e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
309 | 309 | |
310 | - <p><?php esc_html_e( 'Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give' ); ?></p> |
|
310 | + <p><?php esc_html_e('Give is driven by it\'s powerful donation form building features. However, it is much more than just a "donation form". From the "Add Form" page you\'ll be able to choose how and where you want to receive your donations. You will also be able to set the preferred donation amounts.', 'give'); ?></p> |
|
311 | 311 | |
312 | - <p><?php esc_html_e( 'All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give' ); ?></p> |
|
312 | + <p><?php esc_html_e('All of these features begin by simply going to the menu and choosing "Donations > Add Form".', 'give'); ?></p> |
|
313 | 313 | </div> |
314 | 314 | |
315 | 315 | <div class="content feature-section-item last-feature"> |
@@ -326,9 +326,9 @@ discard block |
||
326 | 326 | </div> |
327 | 327 | |
328 | 328 | <div class="content feature-section-item last-feature"> |
329 | - <h3><?php esc_html_e( 'STEP 2: Customize Your Donation Forms', 'give' ); ?></h3> |
|
329 | + <h3><?php esc_html_e('STEP 2: Customize Your Donation Forms', 'give'); ?></h3> |
|
330 | 330 | |
331 | - <p><?php esc_html_e( 'Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give' ); ?></p> |
|
331 | + <p><?php esc_html_e('Each donation form you create can be customized to receive either a pre-determined set donation amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the donation levels view where you can add as many levels as you\'d like with your own custom names and suggested amounts. As well, you can allow donors to give a custom amount and even set up donation goals.', 'give'); ?></p> |
|
332 | 332 | </div> |
333 | 333 | |
334 | 334 | </div> |
@@ -337,11 +337,11 @@ discard block |
||
337 | 337 | <div class="feature-section clearfix"> |
338 | 338 | |
339 | 339 | <div class="content feature-section-item add-content"> |
340 | - <h3><?php esc_html_e( 'STEP 3: Add Additional Content', 'give' ); ?></h3> |
|
340 | + <h3><?php esc_html_e('STEP 3: Add Additional Content', 'give'); ?></h3> |
|
341 | 341 | |
342 | - <p><?php esc_html_e( 'Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give' ); ?></p> |
|
342 | + <p><?php esc_html_e('Every donation form you create with Give can be used on its own stand-alone page, or it can be inserted into any other page or post throughout your site via a shortcode or widget.', 'give'); ?></p> |
|
343 | 343 | |
344 | - <p><?php esc_html_e( 'You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give' ); ?></p> |
|
344 | + <p><?php esc_html_e('You can choose these different modes by going to the "Form Content" section. From there, you can choose to add content before or after the donation form on a page, or if you choose "None" perhaps you want to instead use the shortcode. You can find the shortcode in the top right column directly under the Publish/Save button. This feature gives you the most amount of flexibility with controlling your content on your website all within the same page.', 'give'); ?></p> |
|
345 | 345 | </div> |
346 | 346 | |
347 | 347 | <div class="content feature-section-item last-feature"> |
@@ -358,9 +358,9 @@ discard block |
||
358 | 358 | </div> |
359 | 359 | |
360 | 360 | <div class="content feature-section-item last-feature"> |
361 | - <h3><?php esc_html_e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
361 | + <h3><?php esc_html_e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
362 | 362 | |
363 | - <p><?php esc_html_e( 'Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give' ); ?></p> |
|
363 | + <p><?php esc_html_e('Lastly, you can present the form in a number of different ways that each create their own unique donor experience. The "Modal" display mode opens the credit card fieldset within a popup window. The "Reveal" mode will slide into place the additional fields. If you\'re looking for a simple button, then "Button" more is the way to go. This allows you to create a customizable "Donate Now" button which will open the donation form upon clicking. There\'s tons of possibilities here, give it a try!', 'give'); ?></p> |
|
364 | 364 | </div> |
365 | 365 | |
366 | 366 | |
@@ -380,20 +380,20 @@ discard block |
||
380 | 380 | * @return void |
381 | 381 | */ |
382 | 382 | public function credits_screen() { |
383 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
383 | + list($display_version) = explode('-', GIVE_VERSION); |
|
384 | 384 | ?> |
385 | 385 | <div class="wrap about-wrap"> |
386 | 386 | |
387 | 387 | <?php $this->get_welcome_header() ?> |
388 | 388 | |
389 | - <p class="about-text"><?php esc_html_e( 'Thanks to all those who have contributed code directly or indirectly.', 'give' ); ?></p> |
|
389 | + <p class="about-text"><?php esc_html_e('Thanks to all those who have contributed code directly or indirectly.', 'give'); ?></p> |
|
390 | 390 | |
391 | 391 | <?php give_get_newsletter(); ?> |
392 | 392 | |
393 | 393 | <div class="give-badge"><?php |
394 | 394 | printf( |
395 | 395 | /* translators: %s: Give version */ |
396 | - esc_html__( 'Version %s', 'give' ), |
|
396 | + esc_html__('Version %s', 'give'), |
|
397 | 397 | $display_version |
398 | 398 | ); |
399 | 399 | ?></div> |
@@ -403,8 +403,8 @@ discard block |
||
403 | 403 | <p class="about-description"><?php |
404 | 404 | printf( |
405 | 405 | /* translators: %s: https://github.com/WordImpress/give */ |
406 | - __( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give' ), |
|
407 | - esc_url( 'https://github.com/WordImpress/give' ) |
|
406 | + __('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="%s" target="_blank">GitHub Repo</a>.', 'give'), |
|
407 | + esc_url('https://github.com/WordImpress/give') |
|
408 | 408 | ); |
409 | 409 | ?></p> |
410 | 410 | |
@@ -421,21 +421,21 @@ discard block |
||
421 | 421 | * @return string $readme HTML formatted readme file |
422 | 422 | */ |
423 | 423 | public function parse_readme() { |
424 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
424 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
425 | 425 | |
426 | - if ( ! $file ) { |
|
427 | - $readme = '<p>' . esc_html__( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
426 | + if ( ! $file) { |
|
427 | + $readme = '<p>'.esc_html__('No valid changlog was found.', 'give').'</p>'; |
|
428 | 428 | } else { |
429 | - $readme = file_get_contents( $file ); |
|
430 | - $readme = nl2br( esc_html( $readme ) ); |
|
431 | - $readme = explode( '== Changelog ==', $readme ); |
|
432 | - $readme = end( $readme ); |
|
433 | - |
|
434 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
435 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
436 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
437 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
438 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
429 | + $readme = file_get_contents($file); |
|
430 | + $readme = nl2br(esc_html($readme)); |
|
431 | + $readme = explode('== Changelog ==', $readme); |
|
432 | + $readme = end($readme); |
|
433 | + |
|
434 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
435 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
436 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
437 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
438 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | return $readme; |
@@ -452,24 +452,24 @@ discard block |
||
452 | 452 | public function contributors() { |
453 | 453 | $contributors = $this->get_contributors(); |
454 | 454 | |
455 | - if ( empty( $contributors ) ) { |
|
455 | + if (empty($contributors)) { |
|
456 | 456 | return ''; |
457 | 457 | } |
458 | 458 | |
459 | 459 | $contributor_list = '<ul class="wp-people-group">'; |
460 | 460 | |
461 | - foreach ( $contributors as $contributor ) { |
|
461 | + foreach ($contributors as $contributor) { |
|
462 | 462 | $contributor_list .= '<li class="wp-person">'; |
463 | 463 | $contributor_list .= sprintf( |
464 | 464 | '<a href="%1$s" target="_blank"><img src="%2$s" width="64" height="64" class="gravatar" alt="%3$s" /></a>', |
465 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
466 | - esc_url( $contributor->avatar_url ), |
|
467 | - esc_attr( $contributor->login ) |
|
465 | + esc_url('https://github.com/'.$contributor->login), |
|
466 | + esc_url($contributor->avatar_url), |
|
467 | + esc_attr($contributor->login) |
|
468 | 468 | ); |
469 | 469 | $contributor_list .= sprintf( |
470 | 470 | '<a class="web" target="_blank" href="%1$s">%2$s</a>', |
471 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
472 | - esc_html( $contributor->login ) |
|
471 | + esc_url('https://github.com/'.$contributor->login), |
|
472 | + esc_html($contributor->login) |
|
473 | 473 | ); |
474 | 474 | $contributor_list .= '</li>'; |
475 | 475 | } |
@@ -487,25 +487,25 @@ discard block |
||
487 | 487 | * @return array $contributors List of contributors |
488 | 488 | */ |
489 | 489 | public function get_contributors() { |
490 | - $contributors = Give_Cache::get( 'give_contributors', true ); |
|
490 | + $contributors = Give_Cache::get('give_contributors', true); |
|
491 | 491 | |
492 | - if ( false !== $contributors ) { |
|
492 | + if (false !== $contributors) { |
|
493 | 493 | return $contributors; |
494 | 494 | } |
495 | 495 | |
496 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
496 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
497 | 497 | |
498 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
498 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
499 | 499 | return array(); |
500 | 500 | } |
501 | 501 | |
502 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
502 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
503 | 503 | |
504 | - if ( ! is_array( $contributors ) ) { |
|
504 | + if ( ! is_array($contributors)) { |
|
505 | 505 | return array(); |
506 | 506 | } |
507 | 507 | |
508 | - Give_Cache::set( 'give_contributors', $contributors, HOUR_IN_SECONDS, true ); |
|
508 | + Give_Cache::set('give_contributors', $contributors, HOUR_IN_SECONDS, true); |
|
509 | 509 | |
510 | 510 | return $contributors; |
511 | 511 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function get_welcome_header() { |
519 | 519 | // Badge for welcome page |
520 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
520 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
521 | 521 | ?> |
522 | 522 | <h1 class="welcome-h1"><?php echo get_admin_page_title(); ?></h1> |
523 | 523 | <?php $this->social_media_elements(); ?> |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | <a href="https://twitter.com/givewp" class="twitter-follow-button" data-show-count="false"><?php |
611 | 611 | printf( |
612 | 612 | /* translators: %s: Give twitter user @givewp */ |
613 | - esc_html_e( 'Follow %s', 'give' ), |
|
613 | + esc_html_e('Follow %s', 'give'), |
|
614 | 614 | '@givewp' |
615 | 615 | ); |
616 | 616 | ?></a> |
@@ -644,27 +644,27 @@ discard block |
||
644 | 644 | public function welcome() { |
645 | 645 | |
646 | 646 | // Bail if no activation redirect |
647 | - if ( ! Give_Cache::get( '_give_activation_redirect', true ) ) { |
|
647 | + if ( ! Give_Cache::get('_give_activation_redirect', true)) { |
|
648 | 648 | return; |
649 | 649 | } |
650 | 650 | |
651 | 651 | // Delete the redirect transient |
652 | - Give_Cache::delete( Give_Cache::get_key( '_give_activation_redirect' ) ); |
|
652 | + Give_Cache::delete(Give_Cache::get_key('_give_activation_redirect')); |
|
653 | 653 | |
654 | 654 | // Bail if activating from network, or bulk |
655 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
655 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
656 | 656 | return; |
657 | 657 | } |
658 | 658 | |
659 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
659 | + $upgrade = get_option('give_version_upgraded_from'); |
|
660 | 660 | |
661 | - if ( ! $upgrade ) { // First time install |
|
662 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
661 | + if ( ! $upgrade) { // First time install |
|
662 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
663 | 663 | exit; |
664 | - } elseif ( ! give_is_setting_enabled( give_get_option( 'welcome' ) ) ) { // Welcome is disabled in settings |
|
664 | + } elseif ( ! give_is_setting_enabled(give_get_option('welcome'))) { // Welcome is disabled in settings |
|
665 | 665 | |
666 | 666 | } else { // Welcome is NOT disabled in settings |
667 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
667 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
668 | 668 | exit; |
669 | 669 | } |
670 | 670 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -93,19 +93,19 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function get_predefined_dates() { |
95 | 95 | $predefined = array( |
96 | - 'today' => esc_html__( 'Today', 'give' ), |
|
97 | - 'yesterday' => esc_html__( 'Yesterday', 'give' ), |
|
98 | - 'this_week' => esc_html__( 'This Week', 'give' ), |
|
99 | - 'last_week' => esc_html__( 'Last Week', 'give' ), |
|
100 | - 'this_month' => esc_html__( 'This Month', 'give' ), |
|
101 | - 'last_month' => esc_html__( 'Last Month', 'give' ), |
|
102 | - 'this_quarter' => esc_html__( 'This Quarter', 'give' ), |
|
103 | - 'last_quarter' => esc_html__( 'Last Quarter', 'give' ), |
|
104 | - 'this_year' => esc_html__( 'This Year', 'give' ), |
|
105 | - 'last_year' => esc_html__( 'Last Year', 'give' ), |
|
96 | + 'today' => esc_html__('Today', 'give'), |
|
97 | + 'yesterday' => esc_html__('Yesterday', 'give'), |
|
98 | + 'this_week' => esc_html__('This Week', 'give'), |
|
99 | + 'last_week' => esc_html__('Last Week', 'give'), |
|
100 | + 'this_month' => esc_html__('This Month', 'give'), |
|
101 | + 'last_month' => esc_html__('Last Month', 'give'), |
|
102 | + 'this_quarter' => esc_html__('This Quarter', 'give'), |
|
103 | + 'last_quarter' => esc_html__('Last Quarter', 'give'), |
|
104 | + 'this_year' => esc_html__('This Year', 'give'), |
|
105 | + 'last_year' => esc_html__('Last Year', 'give'), |
|
106 | 106 | ); |
107 | 107 | |
108 | - return apply_filters( 'give_stats_predefined_dates', $predefined ); |
|
108 | + return apply_filters('give_stats_predefined_dates', $predefined); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -121,18 +121,18 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return void |
123 | 123 | */ |
124 | - public function setup_dates( $_start_date = 'this_month', $_end_date = false ) { |
|
124 | + public function setup_dates($_start_date = 'this_month', $_end_date = false) { |
|
125 | 125 | |
126 | - if ( empty( $_start_date ) ) { |
|
126 | + if (empty($_start_date)) { |
|
127 | 127 | $_start_date = 'this_month'; |
128 | 128 | } |
129 | 129 | |
130 | - if ( empty( $_end_date ) ) { |
|
130 | + if (empty($_end_date)) { |
|
131 | 131 | $_end_date = $_start_date; |
132 | 132 | } |
133 | 133 | |
134 | - $this->start_date = $this->convert_date( $_start_date ); |
|
135 | - $this->end_date = $this->convert_date( $_end_date, true ); |
|
134 | + $this->start_date = $this->convert_date($_start_date); |
|
135 | + $this->end_date = $this->convert_date($_end_date, true); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -148,26 +148,26 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @return array|WP_Error If the date is invalid, a WP_Error object will be returned. |
150 | 150 | */ |
151 | - public function convert_date( $date, $end_date = false ) { |
|
151 | + public function convert_date($date, $end_date = false) { |
|
152 | 152 | |
153 | 153 | $this->timestamp = false; |
154 | 154 | $second = $end_date ? 59 : 0; |
155 | 155 | $minute = $end_date ? 59 : 0; |
156 | 156 | $hour = $end_date ? 23 : 0; |
157 | 157 | $day = 1; |
158 | - $month = date( 'n', current_time( 'timestamp' ) ); |
|
159 | - $year = date( 'Y', current_time( 'timestamp' ) ); |
|
158 | + $month = date('n', current_time('timestamp')); |
|
159 | + $year = date('Y', current_time('timestamp')); |
|
160 | 160 | |
161 | - if ( array_key_exists( (string) $date, $this->get_predefined_dates() ) ) { |
|
161 | + if (array_key_exists((string) $date, $this->get_predefined_dates())) { |
|
162 | 162 | |
163 | 163 | // This is a predefined date rate, such as last_week |
164 | - switch ( $date ) { |
|
164 | + switch ($date) { |
|
165 | 165 | |
166 | 166 | case 'this_month' : |
167 | 167 | |
168 | - if ( $end_date ) { |
|
168 | + if ($end_date) { |
|
169 | 169 | |
170 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
170 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
171 | 171 | $hour = 23; |
172 | 172 | $minute = 59; |
173 | 173 | $second = 59; |
@@ -177,28 +177,28 @@ discard block |
||
177 | 177 | |
178 | 178 | case 'last_month' : |
179 | 179 | |
180 | - if ( $month == 1 ) { |
|
180 | + if ($month == 1) { |
|
181 | 181 | |
182 | 182 | $month = 12; |
183 | - $year --; |
|
183 | + $year--; |
|
184 | 184 | |
185 | 185 | } else { |
186 | 186 | |
187 | - $month --; |
|
187 | + $month--; |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
191 | - if ( $end_date ) { |
|
192 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
191 | + if ($end_date) { |
|
192 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | break; |
196 | 196 | |
197 | 197 | case 'today' : |
198 | 198 | |
199 | - $day = date( 'd', current_time( 'timestamp' ) ); |
|
199 | + $day = date('d', current_time('timestamp')); |
|
200 | 200 | |
201 | - if ( $end_date ) { |
|
201 | + if ($end_date) { |
|
202 | 202 | $hour = 23; |
203 | 203 | $minute = 59; |
204 | 204 | $second = 59; |
@@ -208,23 +208,23 @@ discard block |
||
208 | 208 | |
209 | 209 | case 'yesterday' : |
210 | 210 | |
211 | - $day = date( 'd', current_time( 'timestamp' ) ) - 1; |
|
211 | + $day = date('d', current_time('timestamp')) - 1; |
|
212 | 212 | |
213 | 213 | // Check if Today is the first day of the month (meaning subtracting one will get us 0) |
214 | - if ( $day < 1 ) { |
|
214 | + if ($day < 1) { |
|
215 | 215 | |
216 | 216 | // If current month is 1 |
217 | - if ( 1 == $month ) { |
|
217 | + if (1 == $month) { |
|
218 | 218 | |
219 | 219 | $year -= 1; // Today is January 1, so skip back to last day of December |
220 | 220 | $month = 12; |
221 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
221 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
222 | 222 | |
223 | 223 | } else { |
224 | 224 | |
225 | 225 | // Go back one month and get the last day of the month |
226 | 226 | $month -= 1; |
227 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
227 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
228 | 228 | |
229 | 229 | } |
230 | 230 | } |
@@ -233,12 +233,12 @@ discard block |
||
233 | 233 | |
234 | 234 | case 'this_week' : |
235 | 235 | |
236 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
237 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
236 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
237 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
238 | 238 | |
239 | - if ( $today < $days_to_week_start ) { |
|
239 | + if ($today < $days_to_week_start) { |
|
240 | 240 | |
241 | - if ( $month > 1 ) { |
|
241 | + if ($month > 1) { |
|
242 | 242 | $month -= 1; |
243 | 243 | } else { |
244 | 244 | $month = 12; |
@@ -246,19 +246,19 @@ discard block |
||
246 | 246 | |
247 | 247 | } |
248 | 248 | |
249 | - if ( ! $end_date ) { |
|
249 | + if ( ! $end_date) { |
|
250 | 250 | |
251 | 251 | // Getting the start day |
252 | 252 | |
253 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
254 | - $day += get_option( 'start_of_week' ); |
|
253 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
254 | + $day += get_option('start_of_week'); |
|
255 | 255 | |
256 | 256 | } else { |
257 | 257 | |
258 | 258 | // Getting the end day |
259 | 259 | |
260 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 1; |
|
261 | - $day += get_option( 'start_of_week' ) + 6; |
|
260 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 1; |
|
261 | + $day += get_option('start_of_week') + 6; |
|
262 | 262 | |
263 | 263 | } |
264 | 264 | |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | |
267 | 267 | case 'last_week' : |
268 | 268 | |
269 | - $days_to_week_start = ( date( 'w', current_time( 'timestamp' ) ) - 1 ) * 60 * 60 * 24; |
|
270 | - $today = date( 'd', current_time( 'timestamp' ) ) * 60 * 60 * 24; |
|
269 | + $days_to_week_start = (date('w', current_time('timestamp')) - 1) * 60 * 60 * 24; |
|
270 | + $today = date('d', current_time('timestamp')) * 60 * 60 * 24; |
|
271 | 271 | |
272 | - if ( $today < $days_to_week_start ) { |
|
272 | + if ($today < $days_to_week_start) { |
|
273 | 273 | |
274 | - if ( $month > 1 ) { |
|
274 | + if ($month > 1) { |
|
275 | 275 | $month -= 1; |
276 | 276 | } else { |
277 | 277 | $month = 12; |
@@ -279,19 +279,19 @@ discard block |
||
279 | 279 | |
280 | 280 | } |
281 | 281 | |
282 | - if ( ! $end_date ) { |
|
282 | + if ( ! $end_date) { |
|
283 | 283 | |
284 | 284 | // Getting the start day |
285 | 285 | |
286 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
287 | - $day += get_option( 'start_of_week' ); |
|
286 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
287 | + $day += get_option('start_of_week'); |
|
288 | 288 | |
289 | 289 | } else { |
290 | 290 | |
291 | 291 | // Getting the end day |
292 | 292 | |
293 | - $day = date( 'd', current_time( 'timestamp' ) - $days_to_week_start ) - 8; |
|
294 | - $day += get_option( 'start_of_week' ) + 6; |
|
293 | + $day = date('d', current_time('timestamp') - $days_to_week_start) - 8; |
|
294 | + $day += get_option('start_of_week') + 6; |
|
295 | 295 | |
296 | 296 | } |
297 | 297 | |
@@ -299,39 +299,39 @@ discard block |
||
299 | 299 | |
300 | 300 | case 'this_quarter' : |
301 | 301 | |
302 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
302 | + $month_now = date('n', current_time('timestamp')); |
|
303 | 303 | |
304 | - if ( $month_now <= 3 ) { |
|
304 | + if ($month_now <= 3) { |
|
305 | 305 | |
306 | - if ( ! $end_date ) { |
|
306 | + if ( ! $end_date) { |
|
307 | 307 | $month = 1; |
308 | 308 | } else { |
309 | 309 | $month = 3; |
310 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
310 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
311 | 311 | $hour = 23; |
312 | 312 | $minute = 59; |
313 | 313 | $second = 59; |
314 | 314 | } |
315 | 315 | |
316 | - } else if ( $month_now <= 6 ) { |
|
316 | + } else if ($month_now <= 6) { |
|
317 | 317 | |
318 | - if ( ! $end_date ) { |
|
318 | + if ( ! $end_date) { |
|
319 | 319 | $month = 4; |
320 | 320 | } else { |
321 | 321 | $month = 6; |
322 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
322 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
323 | 323 | $hour = 23; |
324 | 324 | $minute = 59; |
325 | 325 | $second = 59; |
326 | 326 | } |
327 | 327 | |
328 | - } else if ( $month_now <= 9 ) { |
|
328 | + } else if ($month_now <= 9) { |
|
329 | 329 | |
330 | - if ( ! $end_date ) { |
|
330 | + if ( ! $end_date) { |
|
331 | 331 | $month = 7; |
332 | 332 | } else { |
333 | 333 | $month = 9; |
334 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
334 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
335 | 335 | $hour = 23; |
336 | 336 | $minute = 59; |
337 | 337 | $second = 59; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | |
340 | 340 | } else { |
341 | 341 | |
342 | - if ( ! $end_date ) { |
|
342 | + if ( ! $end_date) { |
|
343 | 343 | $month = 10; |
344 | 344 | } else { |
345 | 345 | $month = 12; |
346 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
346 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
347 | 347 | $hour = 23; |
348 | 348 | $minute = 59; |
349 | 349 | $second = 59; |
@@ -355,40 +355,40 @@ discard block |
||
355 | 355 | |
356 | 356 | case 'last_quarter' : |
357 | 357 | |
358 | - $month_now = date( 'n', current_time( 'timestamp' ) ); |
|
358 | + $month_now = date('n', current_time('timestamp')); |
|
359 | 359 | |
360 | - if ( $month_now <= 3 ) { |
|
360 | + if ($month_now <= 3) { |
|
361 | 361 | |
362 | - if ( ! $end_date ) { |
|
362 | + if ( ! $end_date) { |
|
363 | 363 | $month = 10; |
364 | 364 | } else { |
365 | 365 | $year -= 1; |
366 | 366 | $month = 12; |
367 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
367 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
368 | 368 | $hour = 23; |
369 | 369 | $minute = 59; |
370 | 370 | $second = 59; |
371 | 371 | } |
372 | 372 | |
373 | - } else if ( $month_now <= 6 ) { |
|
373 | + } else if ($month_now <= 6) { |
|
374 | 374 | |
375 | - if ( ! $end_date ) { |
|
375 | + if ( ! $end_date) { |
|
376 | 376 | $month = 1; |
377 | 377 | } else { |
378 | 378 | $month = 3; |
379 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
379 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
380 | 380 | $hour = 23; |
381 | 381 | $minute = 59; |
382 | 382 | $second = 59; |
383 | 383 | } |
384 | 384 | |
385 | - } else if ( $month_now <= 9 ) { |
|
385 | + } else if ($month_now <= 9) { |
|
386 | 386 | |
387 | - if ( ! $end_date ) { |
|
387 | + if ( ! $end_date) { |
|
388 | 388 | $month = 4; |
389 | 389 | } else { |
390 | 390 | $month = 6; |
391 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
391 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
392 | 392 | $hour = 23; |
393 | 393 | $minute = 59; |
394 | 394 | $second = 59; |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | |
397 | 397 | } else { |
398 | 398 | |
399 | - if ( ! $end_date ) { |
|
399 | + if ( ! $end_date) { |
|
400 | 400 | $month = 7; |
401 | 401 | } else { |
402 | 402 | $month = 9; |
403 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
403 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
404 | 404 | $hour = 23; |
405 | 405 | $minute = 59; |
406 | 406 | $second = 59; |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | |
413 | 413 | case 'this_year' : |
414 | 414 | |
415 | - if ( ! $end_date ) { |
|
415 | + if ( ! $end_date) { |
|
416 | 416 | $month = 1; |
417 | 417 | } else { |
418 | 418 | $month = 12; |
419 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
419 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
420 | 420 | $hour = 23; |
421 | 421 | $minute = 59; |
422 | 422 | $second = 59; |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | case 'last_year' : |
428 | 428 | |
429 | 429 | $year -= 1; |
430 | - if ( ! $end_date ) { |
|
430 | + if ( ! $end_date) { |
|
431 | 431 | $month = 1; |
432 | 432 | } else { |
433 | 433 | $month = 12; |
434 | - $day = cal_days_in_month( CAL_GREGORIAN, $month, $year ); |
|
434 | + $day = cal_days_in_month(CAL_GREGORIAN, $month, $year); |
|
435 | 435 | $hour = 23; |
436 | 436 | $minute = 59; |
437 | 437 | $second = 59; |
@@ -442,30 +442,30 @@ discard block |
||
442 | 442 | } |
443 | 443 | |
444 | 444 | |
445 | - } else if ( is_numeric( $date ) ) { |
|
445 | + } else if (is_numeric($date)) { |
|
446 | 446 | |
447 | 447 | // return $date unchanged since it is a timestamp |
448 | 448 | $this->timestamp = true; |
449 | 449 | |
450 | - } else if ( false !== strtotime( $date ) ) { |
|
450 | + } else if (false !== strtotime($date)) { |
|
451 | 451 | |
452 | - $date = strtotime( $date, current_time( 'timestamp' ) ); |
|
453 | - $year = date( 'Y', $date ); |
|
454 | - $month = date( 'm', $date ); |
|
455 | - $day = date( 'd', $date ); |
|
452 | + $date = strtotime($date, current_time('timestamp')); |
|
453 | + $year = date('Y', $date); |
|
454 | + $month = date('m', $date); |
|
455 | + $day = date('d', $date); |
|
456 | 456 | |
457 | 457 | } else { |
458 | 458 | |
459 | - return new WP_Error( 'invalid_date', esc_html__( 'Improper date provided.', 'give' ) ); |
|
459 | + return new WP_Error('invalid_date', esc_html__('Improper date provided.', 'give')); |
|
460 | 460 | |
461 | 461 | } |
462 | 462 | |
463 | - if ( false === $this->timestamp ) { |
|
463 | + if (false === $this->timestamp) { |
|
464 | 464 | // Create an exact timestamp |
465 | - $date = mktime( $hour, $minute, $second, $month, $day, $year ); |
|
465 | + $date = mktime($hour, $minute, $second, $month, $day, $year); |
|
466 | 466 | } |
467 | 467 | |
468 | - return apply_filters( 'give_stats_date', $date, $end_date, $this ); |
|
468 | + return apply_filters('give_stats_date', $date, $end_date, $this); |
|
469 | 469 | |
470 | 470 | } |
471 | 471 | |
@@ -481,33 +481,33 @@ discard block |
||
481 | 481 | * |
482 | 482 | * @return string |
483 | 483 | */ |
484 | - public function count_where( $where = '' ) { |
|
484 | + public function count_where($where = '') { |
|
485 | 485 | // Only get payments in our date range |
486 | 486 | |
487 | 487 | $start_where = ''; |
488 | 488 | $end_where = ''; |
489 | 489 | |
490 | - if ( $this->start_date ) { |
|
490 | + if ($this->start_date) { |
|
491 | 491 | |
492 | - if ( $this->timestamp ) { |
|
492 | + if ($this->timestamp) { |
|
493 | 493 | $format = 'Y-m-d H:i:s'; |
494 | 494 | } else { |
495 | 495 | $format = 'Y-m-d 00:00:00'; |
496 | 496 | } |
497 | 497 | |
498 | - $start_date = date( $format, $this->start_date ); |
|
498 | + $start_date = date($format, $this->start_date); |
|
499 | 499 | $start_where = " AND p.post_date >= '{$start_date}'"; |
500 | 500 | } |
501 | 501 | |
502 | - if ( $this->end_date ) { |
|
502 | + if ($this->end_date) { |
|
503 | 503 | |
504 | - if ( $this->timestamp ) { |
|
504 | + if ($this->timestamp) { |
|
505 | 505 | $format = 'Y-m-d H:i:s'; |
506 | 506 | } else { |
507 | 507 | $format = 'Y-m-d 23:59:59'; |
508 | 508 | } |
509 | 509 | |
510 | - $end_date = date( $format, $this->end_date ); |
|
510 | + $end_date = date($format, $this->end_date); |
|
511 | 511 | |
512 | 512 | $end_where = " AND p.post_date <= '{$end_date}'"; |
513 | 513 | } |
@@ -529,34 +529,34 @@ discard block |
||
529 | 529 | * |
530 | 530 | * @return string |
531 | 531 | */ |
532 | - public function payments_where( $where = '' ) { |
|
532 | + public function payments_where($where = '') { |
|
533 | 533 | |
534 | 534 | global $wpdb; |
535 | 535 | |
536 | 536 | $start_where = ''; |
537 | 537 | $end_where = ''; |
538 | 538 | |
539 | - if ( ! is_wp_error( $this->start_date ) ) { |
|
539 | + if ( ! is_wp_error($this->start_date)) { |
|
540 | 540 | |
541 | - if ( $this->timestamp ) { |
|
541 | + if ($this->timestamp) { |
|
542 | 542 | $format = 'Y-m-d H:i:s'; |
543 | 543 | } else { |
544 | 544 | $format = 'Y-m-d 00:00:00'; |
545 | 545 | } |
546 | 546 | |
547 | - $start_date = date( $format, $this->start_date ); |
|
547 | + $start_date = date($format, $this->start_date); |
|
548 | 548 | $start_where = " AND $wpdb->posts.post_date >= '{$start_date}'"; |
549 | 549 | } |
550 | 550 | |
551 | - if ( ! is_wp_error( $this->end_date ) ) { |
|
551 | + if ( ! is_wp_error($this->end_date)) { |
|
552 | 552 | |
553 | - if ( $this->timestamp ) { |
|
553 | + if ($this->timestamp) { |
|
554 | 554 | $format = 'Y-m-d H:i:s'; |
555 | 555 | } else { |
556 | 556 | $format = 'Y-m-d 23:59:59'; |
557 | 557 | } |
558 | 558 | |
559 | - $end_date = date( $format, $this->end_date ); |
|
559 | + $end_date = date($format, $this->end_date); |
|
560 | 560 | |
561 | 561 | $end_where = " AND $wpdb->posts.post_date <= '{$end_date}'"; |
562 | 562 | } |
@@ -89,7 +89,7 @@ |
||
89 | 89 | add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array( |
90 | 90 | 'read' => true, |
91 | 91 | 'edit_posts' => true, |
92 | - 'edit_pages' => true, |
|
92 | + 'edit_pages' => true, |
|
93 | 93 | 'upload_files' => true, |
94 | 94 | 'delete_posts' => false, |
95 | 95 | ) ); |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function __construct() { |
38 | - add_filter( 'give_map_meta_cap', array( $this, 'meta_caps' ), 10, 4 ); |
|
38 | + add_filter('give_map_meta_cap', array($this, 'meta_caps'), 10, 4); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public function add_roles() { |
52 | - add_role( 'give_manager', esc_html__( 'Give Manager', 'give' ), array( |
|
52 | + add_role('give_manager', esc_html__('Give Manager', 'give'), array( |
|
53 | 53 | 'read' => true, |
54 | 54 | 'edit_posts' => true, |
55 | 55 | 'delete_posts' => true, |
@@ -78,21 +78,21 @@ discard block |
||
78 | 78 | 'publish_posts' => true, |
79 | 79 | 'read_private_pages' => true, |
80 | 80 | 'read_private_posts' => true, |
81 | - ) ); |
|
81 | + )); |
|
82 | 82 | |
83 | - add_role( 'give_accountant', esc_html__( 'Give Accountant', 'give' ), array( |
|
83 | + add_role('give_accountant', esc_html__('Give Accountant', 'give'), array( |
|
84 | 84 | 'read' => true, |
85 | 85 | 'edit_posts' => false, |
86 | 86 | 'delete_posts' => false |
87 | - ) ); |
|
87 | + )); |
|
88 | 88 | |
89 | - add_role( 'give_worker', esc_html__( 'Give Worker', 'give' ), array( |
|
89 | + add_role('give_worker', esc_html__('Give Worker', 'give'), array( |
|
90 | 90 | 'read' => true, |
91 | 91 | 'edit_posts' => true, |
92 | 92 | 'edit_pages' => true, |
93 | 93 | 'upload_files' => true, |
94 | 94 | 'delete_posts' => false, |
95 | - ) ); |
|
95 | + )); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
@@ -111,38 +111,38 @@ discard block |
||
111 | 111 | public function add_caps() { |
112 | 112 | global $wp_roles; |
113 | 113 | |
114 | - if ( class_exists( 'WP_Roles' ) ) { |
|
115 | - if ( ! isset( $wp_roles ) ) { |
|
114 | + if (class_exists('WP_Roles')) { |
|
115 | + if ( ! isset($wp_roles)) { |
|
116 | 116 | $wp_roles = new WP_Roles(); |
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( is_object( $wp_roles ) ) { |
|
121 | - $wp_roles->add_cap( 'give_manager', 'view_give_reports' ); |
|
122 | - $wp_roles->add_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
123 | - $wp_roles->add_cap( 'give_manager', 'export_give_reports' ); |
|
124 | - $wp_roles->add_cap( 'give_manager', 'manage_give_settings' ); |
|
120 | + if (is_object($wp_roles)) { |
|
121 | + $wp_roles->add_cap('give_manager', 'view_give_reports'); |
|
122 | + $wp_roles->add_cap('give_manager', 'view_give_sensitive_data'); |
|
123 | + $wp_roles->add_cap('give_manager', 'export_give_reports'); |
|
124 | + $wp_roles->add_cap('give_manager', 'manage_give_settings'); |
|
125 | 125 | |
126 | - $wp_roles->add_cap( 'administrator', 'view_give_reports' ); |
|
127 | - $wp_roles->add_cap( 'administrator', 'view_give_sensitive_data' ); |
|
128 | - $wp_roles->add_cap( 'administrator', 'export_give_reports' ); |
|
129 | - $wp_roles->add_cap( 'administrator', 'manage_give_settings' ); |
|
126 | + $wp_roles->add_cap('administrator', 'view_give_reports'); |
|
127 | + $wp_roles->add_cap('administrator', 'view_give_sensitive_data'); |
|
128 | + $wp_roles->add_cap('administrator', 'export_give_reports'); |
|
129 | + $wp_roles->add_cap('administrator', 'manage_give_settings'); |
|
130 | 130 | |
131 | 131 | // Add the main post type capabilities. |
132 | 132 | $capabilities = $this->get_core_caps(); |
133 | - foreach ( $capabilities as $cap_group ) { |
|
134 | - foreach ( $cap_group as $cap ) { |
|
135 | - $wp_roles->add_cap( 'administrator', $cap ); |
|
136 | - $wp_roles->add_cap( 'give_manager', $cap ); |
|
137 | - $wp_roles->add_cap( 'give_worker', $cap ); |
|
133 | + foreach ($capabilities as $cap_group) { |
|
134 | + foreach ($cap_group as $cap) { |
|
135 | + $wp_roles->add_cap('administrator', $cap); |
|
136 | + $wp_roles->add_cap('give_manager', $cap); |
|
137 | + $wp_roles->add_cap('give_worker', $cap); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_forms' ); |
|
142 | - $wp_roles->add_cap( 'give_accountant', 'read_private_give_forms' ); |
|
143 | - $wp_roles->add_cap( 'give_accountant', 'view_give_reports' ); |
|
144 | - $wp_roles->add_cap( 'give_accountant', 'export_give_reports' ); |
|
145 | - $wp_roles->add_cap( 'give_accountant', 'edit_give_payments' ); |
|
141 | + $wp_roles->add_cap('give_accountant', 'edit_give_forms'); |
|
142 | + $wp_roles->add_cap('give_accountant', 'read_private_give_forms'); |
|
143 | + $wp_roles->add_cap('give_accountant', 'view_give_reports'); |
|
144 | + $wp_roles->add_cap('give_accountant', 'export_give_reports'); |
|
145 | + $wp_roles->add_cap('give_accountant', 'edit_give_payments'); |
|
146 | 146 | |
147 | 147 | } |
148 | 148 | } |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | public function get_core_caps() { |
161 | 161 | $capabilities = array(); |
162 | 162 | |
163 | - $capability_types = array( 'give_form', 'give_payment' ); |
|
163 | + $capability_types = array('give_form', 'give_payment'); |
|
164 | 164 | |
165 | - foreach ( $capability_types as $capability_type ) { |
|
166 | - $capabilities[ $capability_type ] = array( |
|
165 | + foreach ($capability_types as $capability_type) { |
|
166 | + $capabilities[$capability_type] = array( |
|
167 | 167 | // Post type. |
168 | 168 | "edit_{$capability_type}", |
169 | 169 | "read_{$capability_type}", |
@@ -209,22 +209,22 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @return array $caps Meta capabilities. |
211 | 211 | */ |
212 | - public function meta_caps( $caps, $cap, $user_id, $args ) { |
|
212 | + public function meta_caps($caps, $cap, $user_id, $args) { |
|
213 | 213 | |
214 | - switch ( $cap ) { |
|
214 | + switch ($cap) { |
|
215 | 215 | |
216 | 216 | case 'view_give_form_stats' : |
217 | 217 | |
218 | - if ( empty( $args[0] ) ) { |
|
218 | + if (empty($args[0])) { |
|
219 | 219 | break; |
220 | 220 | } |
221 | 221 | |
222 | - $form = get_post( $args[0] ); |
|
223 | - if ( empty( $form ) ) { |
|
222 | + $form = get_post($args[0]); |
|
223 | + if (empty($form)) { |
|
224 | 224 | break; |
225 | 225 | } |
226 | 226 | |
227 | - if ( user_can( $user_id, 'view_give_reports' ) || $user_id == $form->post_author ) { |
|
227 | + if (user_can($user_id, 'view_give_reports') || $user_id == $form->post_author) { |
|
228 | 228 | $caps = array(); |
229 | 229 | } |
230 | 230 | |
@@ -251,41 +251,41 @@ discard block |
||
251 | 251 | |
252 | 252 | global $wp_roles; |
253 | 253 | |
254 | - if ( class_exists( 'WP_Roles' ) ) { |
|
255 | - if ( ! isset( $wp_roles ) ) { |
|
254 | + if (class_exists('WP_Roles')) { |
|
255 | + if ( ! isset($wp_roles)) { |
|
256 | 256 | $wp_roles = new WP_Roles(); |
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
260 | - if ( is_object( $wp_roles ) ) { |
|
260 | + if (is_object($wp_roles)) { |
|
261 | 261 | // Give Manager Capabilities. |
262 | - $wp_roles->remove_cap( 'give_manager', 'view_give_reports' ); |
|
263 | - $wp_roles->remove_cap( 'give_manager', 'view_give_sensitive_data' ); |
|
264 | - $wp_roles->remove_cap( 'give_manager', 'export_give_reports' ); |
|
265 | - $wp_roles->remove_cap( 'give_manager', 'manage_give_settings' ); |
|
262 | + $wp_roles->remove_cap('give_manager', 'view_give_reports'); |
|
263 | + $wp_roles->remove_cap('give_manager', 'view_give_sensitive_data'); |
|
264 | + $wp_roles->remove_cap('give_manager', 'export_give_reports'); |
|
265 | + $wp_roles->remove_cap('give_manager', 'manage_give_settings'); |
|
266 | 266 | |
267 | 267 | // Site Administrator Capabilities. |
268 | - $wp_roles->remove_cap( 'administrator', 'view_give_reports' ); |
|
269 | - $wp_roles->remove_cap( 'administrator', 'view_give_sensitive_data' ); |
|
270 | - $wp_roles->remove_cap( 'administrator', 'export_give_reports' ); |
|
271 | - $wp_roles->remove_cap( 'administrator', 'manage_give_settings' ); |
|
268 | + $wp_roles->remove_cap('administrator', 'view_give_reports'); |
|
269 | + $wp_roles->remove_cap('administrator', 'view_give_sensitive_data'); |
|
270 | + $wp_roles->remove_cap('administrator', 'export_give_reports'); |
|
271 | + $wp_roles->remove_cap('administrator', 'manage_give_settings'); |
|
272 | 272 | |
273 | 273 | // Remove the Main Post Type Capabilities. |
274 | 274 | $capabilities = $this->get_core_caps(); |
275 | 275 | |
276 | - foreach ( $capabilities as $cap_group ) { |
|
277 | - foreach ( $cap_group as $cap ) { |
|
278 | - $wp_roles->remove_cap( 'give_manager', $cap ); |
|
279 | - $wp_roles->remove_cap( 'administrator', $cap ); |
|
280 | - $wp_roles->remove_cap( 'give_worker', $cap ); |
|
276 | + foreach ($capabilities as $cap_group) { |
|
277 | + foreach ($cap_group as $cap) { |
|
278 | + $wp_roles->remove_cap('give_manager', $cap); |
|
279 | + $wp_roles->remove_cap('administrator', $cap); |
|
280 | + $wp_roles->remove_cap('give_worker', $cap); |
|
281 | 281 | } |
282 | 282 | } |
283 | 283 | |
284 | 284 | /** Give Accountant Capabilities */ |
285 | - $wp_roles->remove_cap( 'give_accountant', 'edit_give_forms' ); |
|
286 | - $wp_roles->remove_cap( 'give_accountant', 'read_private_give_forms' ); |
|
287 | - $wp_roles->remove_cap( 'give_accountant', 'view_give_reports' ); |
|
288 | - $wp_roles->remove_cap( 'give_accountant', 'export_give_reports' ); |
|
285 | + $wp_roles->remove_cap('give_accountant', 'edit_give_forms'); |
|
286 | + $wp_roles->remove_cap('give_accountant', 'read_private_give_forms'); |
|
287 | + $wp_roles->remove_cap('give_accountant', 'view_give_reports'); |
|
288 | + $wp_roles->remove_cap('give_accountant', 'export_give_reports'); |
|
289 | 289 | |
290 | 290 | } |
291 | 291 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @see Give_Cron::weekly_events() |
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | - add_filter( 'cron_schedules', array( $this, 'add_schedules' ) ); |
|
38 | - add_action( 'wp', array( $this, 'schedule_Events' ) ); |
|
37 | + add_filter('cron_schedules', array($this, 'add_schedules')); |
|
38 | + add_action('wp', array($this, 'schedule_Events')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return array An array of non-default cron schedules. |
50 | 50 | */ |
51 | - public function add_schedules( $schedules = array() ) { |
|
51 | + public function add_schedules($schedules = array()) { |
|
52 | 52 | // Adds once weekly to the existing schedules. |
53 | 53 | $schedules['weekly'] = array( |
54 | 54 | 'interval' => 604800, |
55 | - 'display' => esc_html__( 'Once Weekly', 'give' ), |
|
55 | + 'display' => esc_html__('Once Weekly', 'give'), |
|
56 | 56 | ); |
57 | 57 | |
58 | 58 | return $schedules; |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | private function weekly_events() { |
83 | - if ( ! wp_next_scheduled( 'give_weekly_scheduled_events' ) ) { |
|
84 | - wp_schedule_event( current_time( 'timestamp' ), 'weekly', 'give_weekly_scheduled_events' ); |
|
83 | + if ( ! wp_next_scheduled('give_weekly_scheduled_events')) { |
|
84 | + wp_schedule_event(current_time('timestamp'), 'weekly', 'give_weekly_scheduled_events'); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @return void |
95 | 95 | */ |
96 | 96 | private function daily_events() { |
97 | - if ( ! wp_next_scheduled( 'give_daily_scheduled_events' ) ) { |
|
98 | - wp_schedule_event( current_time( 'timestamp' ), 'daily', 'give_daily_scheduled_events' ); |
|
97 | + if ( ! wp_next_scheduled('give_daily_scheduled_events')) { |
|
98 | + wp_schedule_event(current_time('timestamp'), 'daily', 'give_daily_scheduled_events'); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Exit if accessed directly. |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | 14 | // Add give command. |
15 | -WP_CLI::add_command( 'give', 'GIVE_CLI_COMMAND' ); |
|
15 | +WP_CLI::add_command('give', 'GIVE_CLI_COMMAND'); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | /** |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @subcommand logo |
70 | 70 | */ |
71 | - public function ascii( $args, $assoc_args ) { |
|
72 | - WP_CLI::log( file_get_contents( GIVE_PLUGIN_DIR . 'assets/images/give-ascii-logo.txt' ) ); |
|
71 | + public function ascii($args, $assoc_args) { |
|
72 | + WP_CLI::log(file_get_contents(GIVE_PLUGIN_DIR.'assets/images/give-ascii-logo.txt')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -94,54 +94,54 @@ discard block |
||
94 | 94 | * |
95 | 95 | * @subcommand details |
96 | 96 | */ |
97 | - public function details( $args, $assoc_args ) { |
|
97 | + public function details($args, $assoc_args) { |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Plugin Information |
101 | 101 | */ |
102 | - WP_CLI::log( $this->color_message( __( 'Give Version: ', 'give' ) ) . GIVE_VERSION ); |
|
102 | + WP_CLI::log($this->color_message(__('Give Version: ', 'give')).GIVE_VERSION); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * General Information. |
106 | 106 | */ |
107 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'General information', 'give' ) ) . ' ####' ); |
|
107 | + WP_CLI::log("\n#### ".$this->color_message(__('General information', 'give')).' ####'); |
|
108 | 108 | |
109 | - $success_page = give_get_option( 'success_page' ); |
|
110 | - $failure_page = give_get_option( 'failure_page' ); |
|
111 | - $history_page = give_get_option( 'history_page' ); |
|
109 | + $success_page = give_get_option('success_page'); |
|
110 | + $failure_page = give_get_option('failure_page'); |
|
111 | + $history_page = give_get_option('history_page'); |
|
112 | 112 | |
113 | - WP_CLI::log( $this->color_message( sprintf( __( 'Success Page: ', 'give' ) ) ) . ( $success_page ? "[{$success_page}] " . get_permalink( $success_page ) : __( 'Not Set', 'give' ) ) ); |
|
114 | - WP_CLI::log( $this->color_message( __( 'Failed Donation Page: ', 'give' ) ) . ( $failure_page ? "[{$failure_page}] " . get_permalink( $failure_page ) : __( 'Not Set', 'give' ) ) ); |
|
115 | - WP_CLI::log( $this->color_message( __( 'Donation History Page: ', 'give' ) ) . ( $history_page ? "[{$history_page}] " . get_permalink( $history_page ) : __( 'Not Set', 'give' ) ) ); |
|
116 | - WP_CLI::log( $this->color_message( __( 'Country: ', 'give' ) ) . give_get_country() ); |
|
113 | + WP_CLI::log($this->color_message(sprintf(__('Success Page: ', 'give'))).($success_page ? "[{$success_page}] ".get_permalink($success_page) : __('Not Set', 'give'))); |
|
114 | + WP_CLI::log($this->color_message(__('Failed Donation Page: ', 'give')).($failure_page ? "[{$failure_page}] ".get_permalink($failure_page) : __('Not Set', 'give'))); |
|
115 | + WP_CLI::log($this->color_message(__('Donation History Page: ', 'give')).($history_page ? "[{$history_page}] ".get_permalink($history_page) : __('Not Set', 'give'))); |
|
116 | + WP_CLI::log($this->color_message(__('Country: ', 'give')).give_get_country()); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Currency Information. |
120 | 120 | */ |
121 | - $default_gateway = give_get_option( 'default_gateway' ); |
|
121 | + $default_gateway = give_get_option('default_gateway'); |
|
122 | 122 | |
123 | - WP_CLI::log( "\n#### " . $this->color_message( __( 'Currency Information', 'give' ) ) . ' ####' ); |
|
123 | + WP_CLI::log("\n#### ".$this->color_message(__('Currency Information', 'give')).' ####'); |
|
124 | 124 | |
125 | - WP_CLI::log( $this->color_message( __( 'Currency: ', 'give' ), give_get_currency() ) ); |
|
126 | - WP_CLI::log( $this->color_message( __( 'Currency Position: ', 'give' ), give_get_currency_position() ) ); |
|
127 | - WP_CLI::log( $this->color_message( __( 'Thousand Separator: ', 'give' ), give_get_price_thousand_separator() ) ); |
|
128 | - WP_CLI::log( $this->color_message( __( 'Decimal Separator: ', 'give' ), give_get_price_decimal_separator() ) ); |
|
129 | - WP_CLI::log( $this->color_message( __( 'Number of Decimals: ', 'give' ), give_get_price_decimals() ) ); |
|
130 | - WP_CLI::log( $this->color_message( __( 'Test Mode: ', 'give' ), ( give_get_option( 'test_mode' ) ? __( 'Yes', 'give' ) : __( 'No', 'give' ) ) ) ); |
|
131 | - WP_CLI::log( $this->color_message( __( 'Default Gateway: ', 'give' ), ( $default_gateway ? $default_gateway : __( 'Not Set', 'give' ) ) ) ); |
|
125 | + WP_CLI::log($this->color_message(__('Currency: ', 'give'), give_get_currency())); |
|
126 | + WP_CLI::log($this->color_message(__('Currency Position: ', 'give'), give_get_currency_position())); |
|
127 | + WP_CLI::log($this->color_message(__('Thousand Separator: ', 'give'), give_get_price_thousand_separator())); |
|
128 | + WP_CLI::log($this->color_message(__('Decimal Separator: ', 'give'), give_get_price_decimal_separator())); |
|
129 | + WP_CLI::log($this->color_message(__('Number of Decimals: ', 'give'), give_get_price_decimals())); |
|
130 | + WP_CLI::log($this->color_message(__('Test Mode: ', 'give'), (give_get_option('test_mode') ? __('Yes', 'give') : __('No', 'give')))); |
|
131 | + WP_CLI::log($this->color_message(__('Default Gateway: ', 'give'), ($default_gateway ? $default_gateway : __('Not Set', 'give')))); |
|
132 | 132 | |
133 | 133 | // Payment gateways Information. |
134 | - $gateways = give_get_ordered_payment_gateways( give_get_payment_gateways() ); |
|
135 | - WP_CLI::log( $this->color_message( __( 'Enabled Gateways: ', 'give' ) ) ); |
|
134 | + $gateways = give_get_ordered_payment_gateways(give_get_payment_gateways()); |
|
135 | + WP_CLI::log($this->color_message(__('Enabled Gateways: ', 'give'))); |
|
136 | 136 | |
137 | - if ( ! empty( $gateways ) ) { |
|
137 | + if ( ! empty($gateways)) { |
|
138 | 138 | self::$counter = 1; |
139 | - foreach ( $gateways as $gateway ) { |
|
140 | - WP_CLI::log( ' ' . $this->color_message( self::$counter, $gateway['admin_label'] ) ); |
|
141 | - self::$counter ++; |
|
139 | + foreach ($gateways as $gateway) { |
|
140 | + WP_CLI::log(' '.$this->color_message(self::$counter, $gateway['admin_label'])); |
|
141 | + self::$counter++; |
|
142 | 142 | } |
143 | 143 | } else { |
144 | - WP_CLI::log( __( 'Not any payment gateways found', 'give' ) ); |
|
144 | + WP_CLI::log(__('Not any payment gateways found', 'give')); |
|
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @subcommand forms |
175 | 175 | */ |
176 | - public function forms( $args, $assoc_args ) { |
|
176 | + public function forms($args, $assoc_args) { |
|
177 | 177 | global $wp_query; |
178 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
179 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? absint( $assoc_args['number'] ) : 10; |
|
178 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
179 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? absint($assoc_args['number']) : 10; |
|
180 | 180 | $start = time(); |
181 | 181 | |
182 | 182 | // Cache previous number query var. |
183 | 183 | $is_set_number = $cache_per_page = false; |
184 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
184 | + if (isset($wp_query->query_vars['number'])) { |
|
185 | 185 | $cache_per_page = $wp_query->query_vars['number']; |
186 | 186 | $is_set_number = true; |
187 | 187 | } |
@@ -190,22 +190,22 @@ discard block |
||
190 | 190 | $wp_query->query_vars['number'] = $number; |
191 | 191 | |
192 | 192 | // Get forms. |
193 | - $forms = $form_id ? $this->api->get_forms( $form_id ) : $this->api->get_forms(); |
|
193 | + $forms = $form_id ? $this->api->get_forms($form_id) : $this->api->get_forms(); |
|
194 | 194 | |
195 | 195 | // Reset number query var. |
196 | - if ( $is_set_number ) { |
|
196 | + if ($is_set_number) { |
|
197 | 197 | $wp_query->query_vars['number'] = $cache_per_page; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // Bailout. |
201 | - if ( array_key_exists( 'error', $forms ) ) { |
|
201 | + if (array_key_exists('error', $forms)) { |
|
202 | 202 | |
203 | - WP_CLI::warning( $forms['error'] ); |
|
203 | + WP_CLI::warning($forms['error']); |
|
204 | 204 | |
205 | 205 | return; |
206 | - } elseif ( empty( $forms['forms'] ) ) { |
|
206 | + } elseif (empty($forms['forms'])) { |
|
207 | 207 | |
208 | - WP_CLI::error( __( 'No forms found.', 'give' ) ); |
|
208 | + WP_CLI::error(__('No forms found.', 'give')); |
|
209 | 209 | |
210 | 210 | return; |
211 | 211 | } |
@@ -213,25 +213,25 @@ discard block |
||
213 | 213 | // Param to check if form typeis already showed or not. |
214 | 214 | $is_show_form_type = false; |
215 | 215 | |
216 | - if ( 1 === count( $forms ) && $form_id ) { |
|
216 | + if (1 === count($forms) && $form_id) { |
|
217 | 217 | // Show single form. |
218 | - foreach ( $forms['forms'][0] as $key => $info ) { |
|
219 | - switch ( $key ) { |
|
218 | + foreach ($forms['forms'][0] as $key => $info) { |
|
219 | + switch ($key) { |
|
220 | 220 | case 'stats': |
221 | - $this->color_main_heading( ucfirst( $key ) ); |
|
221 | + $this->color_main_heading(ucfirst($key)); |
|
222 | 222 | |
223 | - foreach ( $info as $heading => $data ) { |
|
224 | - $this->color_sub_heading( ucfirst( $heading ) ); |
|
225 | - switch ( $heading ) { |
|
223 | + foreach ($info as $heading => $data) { |
|
224 | + $this->color_sub_heading(ucfirst($heading)); |
|
225 | + switch ($heading) { |
|
226 | 226 | default: |
227 | - foreach ( $data as $subheading => $subdata ) { |
|
227 | + foreach ($data as $subheading => $subdata) { |
|
228 | 228 | |
229 | - switch ( $subheading ) { |
|
229 | + switch ($subheading) { |
|
230 | 230 | case 'earnings': |
231 | - WP_CLI::log( $this->color_message( $subheading . ': ', give_currency_filter( $subdata ) ) ); |
|
231 | + WP_CLI::log($this->color_message($subheading.': ', give_currency_filter($subdata))); |
|
232 | 232 | break; |
233 | 233 | default: |
234 | - WP_CLI::log( $this->color_message( $subheading . ': ', $subdata ) ); |
|
234 | + WP_CLI::log($this->color_message($subheading.': ', $subdata)); |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | } |
@@ -241,26 +241,26 @@ discard block |
||
241 | 241 | case 'pricing': |
242 | 242 | case 'info': |
243 | 243 | default: |
244 | - $this->color_main_heading( ucfirst( $key ) ); |
|
244 | + $this->color_main_heading(ucfirst($key)); |
|
245 | 245 | |
246 | 246 | // Show form type. |
247 | - if ( ! $is_show_form_type ) { |
|
248 | - $form = new Give_Donate_Form( $form_id ); |
|
247 | + if ( ! $is_show_form_type) { |
|
248 | + $form = new Give_Donate_Form($form_id); |
|
249 | 249 | $is_show_form_type = true; |
250 | 250 | |
251 | - WP_CLI::log( $this->color_message( __( 'form type', 'give' ), $form->get_type() ) ); |
|
251 | + WP_CLI::log($this->color_message(__('form type', 'give'), $form->get_type())); |
|
252 | 252 | } |
253 | 253 | |
254 | - foreach ( $info as $heading => $data ) { |
|
254 | + foreach ($info as $heading => $data) { |
|
255 | 255 | |
256 | - switch ( $heading ) { |
|
256 | + switch ($heading) { |
|
257 | 257 | case 'id': |
258 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
258 | + WP_CLI::log($this->color_message($heading, $data)); |
|
259 | 259 | break; |
260 | 260 | |
261 | 261 | default: |
262 | - $data = empty( $data ) ? __( 'Not set', 'give' ) : $data; |
|
263 | - WP_CLI::log( $this->color_message( $heading, $data ) ); |
|
262 | + $data = empty($data) ? __('Not set', 'give') : $data; |
|
263 | + WP_CLI::log($this->color_message($heading, $data)); |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | }// End switch(). |
@@ -271,37 +271,37 @@ discard block |
||
271 | 271 | $is_table_first_row_set = false; |
272 | 272 | $table_column_count = 0; |
273 | 273 | |
274 | - WP_CLI::line( $this->color_message( sprintf( __( '%d donation forms found', 'give' ), count( $forms['forms'] ) ), '', false ) ); |
|
274 | + WP_CLI::line($this->color_message(sprintf(__('%d donation forms found', 'give'), count($forms['forms'])), '', false)); |
|
275 | 275 | |
276 | - foreach ( $forms['forms'] as $index => $form_data ) { |
|
276 | + foreach ($forms['forms'] as $index => $form_data) { |
|
277 | 277 | |
278 | 278 | // Default table data. |
279 | 279 | $table_first_row = array(); |
280 | 280 | $table_row = array(); |
281 | 281 | |
282 | - foreach ( $form_data['info'] as $key => $form ) { |
|
282 | + foreach ($form_data['info'] as $key => $form) { |
|
283 | 283 | |
284 | 284 | // Do not show thumbnail, content and link in table. |
285 | - if ( in_array( $key, array( 'content', 'thumbnail', 'link' ), true ) ) { |
|
285 | + if (in_array($key, array('content', 'thumbnail', 'link'), true)) { |
|
286 | 286 | continue; |
287 | 287 | } |
288 | 288 | |
289 | - if ( ! $is_table_first_row_set ) { |
|
289 | + if ( ! $is_table_first_row_set) { |
|
290 | 290 | $table_first_row[] = $key; |
291 | 291 | } |
292 | 292 | |
293 | 293 | $table_row[] = $form; |
294 | 294 | |
295 | - if ( 'status' === $key ) { |
|
295 | + if ('status' === $key) { |
|
296 | 296 | // First array item will be an form id in our case. |
297 | - $form = new Give_Donate_Form( absint( $table_row[0] ) ); |
|
297 | + $form = new Give_Donate_Form(absint($table_row[0])); |
|
298 | 298 | |
299 | 299 | $table_row[] = $form->get_type(); |
300 | 300 | } |
301 | 301 | } |
302 | 302 | |
303 | 303 | // Set table first row. |
304 | - if ( ! $is_table_first_row_set ) { |
|
304 | + if ( ! $is_table_first_row_set) { |
|
305 | 305 | |
306 | 306 | // Add extra column to table. |
307 | 307 | $table_first_row[] = 'type'; |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $table_data[] = $table_row; |
315 | 315 | }// End foreach(). |
316 | 316 | |
317 | - $this->display_table( $table_data ); |
|
317 | + $this->display_table($table_data); |
|
318 | 318 | }// End if(). |
319 | 319 | } |
320 | 320 | |
@@ -367,37 +367,37 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @subcommand donors |
369 | 369 | */ |
370 | - public function donors( $args, $assoc_args ) { |
|
370 | + public function donors($args, $assoc_args) { |
|
371 | 371 | global $wp_query; |
372 | - $donor_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? absint( $assoc_args['id'] ) : false; |
|
373 | - $email = isset( $assoc_args ) && array_key_exists( 'email', $assoc_args ) ? $assoc_args['email'] : false; |
|
374 | - $name = isset( $assoc_args ) && array_key_exists( 'name', $assoc_args ) ? $assoc_args['name'] : ''; |
|
375 | - $create = isset( $assoc_args ) && array_key_exists( 'create', $assoc_args ) ? $assoc_args['create'] : false; |
|
376 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
377 | - $form_id = isset( $assoc_args ) && array_key_exists( 'form-id', $assoc_args ) ? $assoc_args['form-id'] : 0; |
|
378 | - $format = isset( $assoc_args ) && array_key_exists( 'format', $assoc_args ) ? $assoc_args['format'] : 'table'; |
|
372 | + $donor_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? absint($assoc_args['id']) : false; |
|
373 | + $email = isset($assoc_args) && array_key_exists('email', $assoc_args) ? $assoc_args['email'] : false; |
|
374 | + $name = isset($assoc_args) && array_key_exists('name', $assoc_args) ? $assoc_args['name'] : ''; |
|
375 | + $create = isset($assoc_args) && array_key_exists('create', $assoc_args) ? $assoc_args['create'] : false; |
|
376 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
377 | + $form_id = isset($assoc_args) && array_key_exists('form-id', $assoc_args) ? $assoc_args['form-id'] : 0; |
|
378 | + $format = isset($assoc_args) && array_key_exists('format', $assoc_args) ? $assoc_args['format'] : 'table'; |
|
379 | 379 | $start = time(); |
380 | 380 | |
381 | - if ( $create ) { |
|
381 | + if ($create) { |
|
382 | 382 | $number = 1; |
383 | 383 | |
384 | - if ( isset( $assoc_args['email'] ) && ! is_email( $email ) ) { |
|
385 | - WP_CLI::warning( 'Wrong email address provided.', 'give' ); |
|
384 | + if (isset($assoc_args['email']) && ! is_email($email)) { |
|
385 | + WP_CLI::warning('Wrong email address provided.', 'give'); |
|
386 | 386 | |
387 | 387 | return; |
388 | 388 | } |
389 | 389 | |
390 | 390 | // Create one or more donors. |
391 | - if ( ! $email ) { |
|
391 | + if ( ! $email) { |
|
392 | 392 | // If no email is specified, look to see if we are generating arbitrary donor accounts. |
393 | - $number = is_numeric( $create ) ? absint( $create ) : 1; |
|
393 | + $number = is_numeric($create) ? absint($create) : 1; |
|
394 | 394 | } |
395 | 395 | |
396 | - for ( $i = 0; $i < $number; $i ++ ) { |
|
397 | - if ( ! $email ) { |
|
396 | + for ($i = 0; $i < $number; $i++) { |
|
397 | + if ( ! $email) { |
|
398 | 398 | |
399 | 399 | // Generate fake email. |
400 | - $email = 'customer-' . uniqid() . '@test.com'; |
|
400 | + $email = 'customer-'.uniqid().'@test.com'; |
|
401 | 401 | } |
402 | 402 | |
403 | 403 | $args = array( |
@@ -405,19 +405,19 @@ discard block |
||
405 | 405 | 'name' => $name, |
406 | 406 | ); |
407 | 407 | |
408 | - $donor_id = Give()->donors->add( $args ); |
|
408 | + $donor_id = Give()->donors->add($args); |
|
409 | 409 | |
410 | - if ( $donor_id ) { |
|
411 | - WP_CLI::line( $this->color_message( sprintf( __( 'Donor #%d created successfully', 'give' ), $donor_id ) ) ); |
|
410 | + if ($donor_id) { |
|
411 | + WP_CLI::line($this->color_message(sprintf(__('Donor #%d created successfully', 'give'), $donor_id))); |
|
412 | 412 | } else { |
413 | - WP_CLI::error( __( 'Failed to create donor', 'give' ) ); |
|
413 | + WP_CLI::error(__('Failed to create donor', 'give')); |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | // Reset email to false so it is generated on the next loop (if creating donors). |
417 | 417 | $email = false; |
418 | 418 | } |
419 | 419 | |
420 | - WP_CLI::line( $this->color_message( sprintf( __( '%1$d donors created in %2$d seconds', 'give' ), $number, time() - $start ) ) ); |
|
420 | + WP_CLI::line($this->color_message(sprintf(__('%1$d donors created in %2$d seconds', 'give'), $number, time() - $start))); |
|
421 | 421 | |
422 | 422 | } else { |
423 | 423 | // Counter. |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | */ |
432 | 432 | // Cache previous number query var. |
433 | 433 | $is_set_number = $cache_per_page = false; |
434 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
434 | + if (isset($wp_query->query_vars['number'])) { |
|
435 | 435 | $cache_per_page = $wp_query->query_vars['number']; |
436 | 436 | $is_set_number = true; |
437 | 437 | } |
@@ -440,24 +440,24 @@ discard block |
||
440 | 440 | $wp_query->query_vars['number'] = $number; |
441 | 441 | |
442 | 442 | // Get donors. |
443 | - if ( $form_id ) { |
|
443 | + if ($form_id) { |
|
444 | 444 | // @TODO: Allow user to get a list of donors by donation status. |
445 | - $donors = $this->get_donors_by_form_id( $form_id ); |
|
445 | + $donors = $this->get_donors_by_form_id($form_id); |
|
446 | 446 | } else { |
447 | - $donors = $this->api->get_donors( $search ); |
|
447 | + $donors = $this->api->get_donors($search); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | // Reset number query var. |
451 | - if ( $is_set_number ) { |
|
451 | + if ($is_set_number) { |
|
452 | 452 | $wp_query->query_vars['number'] = $cache_per_page; |
453 | 453 | } |
454 | 454 | |
455 | - if ( isset( $donors['error'] ) ) { |
|
456 | - WP_CLI::error( $donors['error'] ); |
|
455 | + if (isset($donors['error'])) { |
|
456 | + WP_CLI::error($donors['error']); |
|
457 | 457 | } |
458 | 458 | |
459 | - if ( empty( $donors ) ) { |
|
460 | - WP_CLI::error( __( 'No donors found.', 'give' ) ); |
|
459 | + if (empty($donors)) { |
|
460 | + WP_CLI::error(__('No donors found.', 'give')); |
|
461 | 461 | |
462 | 462 | return; |
463 | 463 | } |
@@ -465,24 +465,24 @@ discard block |
||
465 | 465 | $table_data = array(); |
466 | 466 | $is_table_first_row_set = false; |
467 | 467 | |
468 | - foreach ( $donors['donors'] as $donor_data ) { |
|
468 | + foreach ($donors['donors'] as $donor_data) { |
|
469 | 469 | // Set default table row data. |
470 | - $table_first_row = array( __( 's_no', 'give' ) ); |
|
471 | - $table_row = array( self::$counter ); |
|
470 | + $table_first_row = array(__('s_no', 'give')); |
|
471 | + $table_row = array(self::$counter); |
|
472 | 472 | |
473 | - foreach ( $donor_data as $key => $donor ) { |
|
474 | - switch ( $key ) { |
|
473 | + foreach ($donor_data as $key => $donor) { |
|
474 | + switch ($key) { |
|
475 | 475 | case 'stats': |
476 | - foreach ( $donor as $heading => $data ) { |
|
476 | + foreach ($donor as $heading => $data) { |
|
477 | 477 | |
478 | 478 | // Get first row. |
479 | - if ( ! $is_table_first_row_set ) { |
|
479 | + if ( ! $is_table_first_row_set) { |
|
480 | 480 | $table_first_row[] = $heading; |
481 | 481 | } |
482 | 482 | |
483 | - switch ( $heading ) { |
|
483 | + switch ($heading) { |
|
484 | 484 | case 'total_spent': |
485 | - $table_row[] = give_currency_filter( $data ); |
|
485 | + $table_row[] = give_currency_filter($data); |
|
486 | 486 | break; |
487 | 487 | |
488 | 488 | default: |
@@ -493,10 +493,10 @@ discard block |
||
493 | 493 | |
494 | 494 | case 'info': |
495 | 495 | default: |
496 | - foreach ( $donor as $heading => $data ) { |
|
496 | + foreach ($donor as $heading => $data) { |
|
497 | 497 | |
498 | 498 | // Get first row. |
499 | - if ( ! $is_table_first_row_set ) { |
|
499 | + if ( ! $is_table_first_row_set) { |
|
500 | 500 | $table_first_row[] = $heading; |
501 | 501 | } |
502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | } |
507 | 507 | |
508 | 508 | // Add first row data to table data. |
509 | - if ( ! $is_table_first_row_set ) { |
|
509 | + if ( ! $is_table_first_row_set) { |
|
510 | 510 | $table_data[] = $table_first_row; |
511 | 511 | $is_table_first_row_set = true; |
512 | 512 | } |
@@ -515,44 +515,44 @@ discard block |
||
515 | 515 | $table_data[] = $table_row; |
516 | 516 | |
517 | 517 | // Increase counter. |
518 | - self::$counter ++; |
|
518 | + self::$counter++; |
|
519 | 519 | }// End foreach(). |
520 | 520 | |
521 | - switch ( $format ) { |
|
521 | + switch ($format) { |
|
522 | 522 | case 'json': |
523 | 523 | $table_column_name = $table_data[0]; |
524 | - unset( $table_data[0] ); |
|
524 | + unset($table_data[0]); |
|
525 | 525 | |
526 | 526 | $new_table_data = array(); |
527 | - foreach ( $table_data as $index => $data ) { |
|
528 | - foreach ( $data as $key => $value ) { |
|
529 | - $new_table_data[ $index ][ $table_column_name[ $key ] ] = $value; |
|
527 | + foreach ($table_data as $index => $data) { |
|
528 | + foreach ($data as $key => $value) { |
|
529 | + $new_table_data[$index][$table_column_name[$key]] = $value; |
|
530 | 530 | } |
531 | 531 | } |
532 | 532 | |
533 | - WP_CLI::log( json_encode( $new_table_data ) ); |
|
533 | + WP_CLI::log(json_encode($new_table_data)); |
|
534 | 534 | break; |
535 | 535 | |
536 | 536 | case 'csv': |
537 | - $file_path = trailingslashit( WP_CONTENT_DIR ) . 'uploads/give_donors_' . date( 'Y_m_d_s', current_time( 'timestamp' ) ) . '.csv'; |
|
538 | - $fp = fopen( $file_path, 'w' ); |
|
537 | + $file_path = trailingslashit(WP_CONTENT_DIR).'uploads/give_donors_'.date('Y_m_d_s', current_time('timestamp')).'.csv'; |
|
538 | + $fp = fopen($file_path, 'w'); |
|
539 | 539 | |
540 | - if ( is_writable( $file_path ) ) { |
|
541 | - foreach ( $table_data as $fields ) { |
|
542 | - fputcsv( $fp, $fields ); |
|
540 | + if (is_writable($file_path)) { |
|
541 | + foreach ($table_data as $fields) { |
|
542 | + fputcsv($fp, $fields); |
|
543 | 543 | } |
544 | 544 | |
545 | - fclose( $fp ); |
|
545 | + fclose($fp); |
|
546 | 546 | |
547 | - WP_CLI::success( "Donors list csv created successfully: {$file_path}" ); |
|
547 | + WP_CLI::success("Donors list csv created successfully: {$file_path}"); |
|
548 | 548 | } else { |
549 | - WP_CLI::warning( "Unable to create donors list csv file: {$file_path} (May folder do not have write permission)" ); |
|
549 | + WP_CLI::warning("Unable to create donors list csv file: {$file_path} (May folder do not have write permission)"); |
|
550 | 550 | } |
551 | 551 | |
552 | 552 | break; |
553 | 553 | |
554 | 554 | default: |
555 | - $this->display_table( $table_data ); |
|
555 | + $this->display_table($table_data); |
|
556 | 556 | }// End switch(). |
557 | 557 | }// End if(). |
558 | 558 | } |
@@ -582,13 +582,13 @@ discard block |
||
582 | 582 | * |
583 | 583 | * @subcommand donations |
584 | 584 | */ |
585 | - public function donations( $args, $assoc_args ) { |
|
585 | + public function donations($args, $assoc_args) { |
|
586 | 586 | global $wp_query; |
587 | - $number = isset( $assoc_args ) && array_key_exists( 'number', $assoc_args ) ? $assoc_args['number'] : 10; |
|
587 | + $number = isset($assoc_args) && array_key_exists('number', $assoc_args) ? $assoc_args['number'] : 10; |
|
588 | 588 | |
589 | 589 | // Cache previous number query var. |
590 | 590 | $is_set_number = $cache_per_page = false; |
591 | - if ( isset( $wp_query->query_vars['number'] ) ) { |
|
591 | + if (isset($wp_query->query_vars['number'])) { |
|
592 | 592 | $cache_per_page = $wp_query->query_vars['number']; |
593 | 593 | $is_set_number = true; |
594 | 594 | } |
@@ -600,46 +600,46 @@ discard block |
||
600 | 600 | $donations = $this->api->get_recent_donations(); |
601 | 601 | |
602 | 602 | // Reset number query var. |
603 | - if ( $is_set_number ) { |
|
603 | + if ($is_set_number) { |
|
604 | 604 | $wp_query->query_vars['number'] = $cache_per_page; |
605 | 605 | } |
606 | 606 | |
607 | - if ( empty( $donations ) ) { |
|
608 | - WP_CLI::error( __( 'No donations found.', 'give' ) ); |
|
607 | + if (empty($donations)) { |
|
608 | + WP_CLI::error(__('No donations found.', 'give')); |
|
609 | 609 | |
610 | 610 | return; |
611 | 611 | } |
612 | 612 | |
613 | 613 | self::$counter = 1; |
614 | 614 | |
615 | - foreach ( $donations['donations'] as $key => $donation ) { |
|
616 | - $this->color_main_heading( sprintf( __( '%1$s. Donation #%2$s', 'give' ), self::$counter, $donation['ID'] ), 'Y' ); |
|
617 | - self::$counter ++; |
|
615 | + foreach ($donations['donations'] as $key => $donation) { |
|
616 | + $this->color_main_heading(sprintf(__('%1$s. Donation #%2$s', 'give'), self::$counter, $donation['ID']), 'Y'); |
|
617 | + self::$counter++; |
|
618 | 618 | |
619 | - foreach ( $donation as $column => $data ) { |
|
619 | + foreach ($donation as $column => $data) { |
|
620 | 620 | |
621 | - if ( is_array( $data ) ) { |
|
622 | - $this->color_sub_heading( $column ); |
|
623 | - foreach ( $data as $subcolumn => $subdata ) { |
|
621 | + if (is_array($data)) { |
|
622 | + $this->color_sub_heading($column); |
|
623 | + foreach ($data as $subcolumn => $subdata) { |
|
624 | 624 | |
625 | 625 | // Decode html codes. |
626 | - switch ( $subcolumn ) { |
|
626 | + switch ($subcolumn) { |
|
627 | 627 | case 'name': |
628 | - $subdata = html_entity_decode( $subdata ); |
|
628 | + $subdata = html_entity_decode($subdata); |
|
629 | 629 | break; |
630 | 630 | } |
631 | 631 | |
632 | 632 | // @TODO Check if multi dimension array information is importent to show or not. For example inside donation array we have array for fees data inside payment meta. |
633 | - if ( is_array( $subdata ) ) { |
|
633 | + if (is_array($subdata)) { |
|
634 | 634 | continue; |
635 | 635 | } |
636 | 636 | |
637 | - WP_CLI::log( $this->color_message( $subcolumn, $subdata ) ); |
|
637 | + WP_CLI::log($this->color_message($subcolumn, $subdata)); |
|
638 | 638 | } |
639 | 639 | continue; |
640 | 640 | } |
641 | 641 | |
642 | - WP_CLI::log( $this->color_message( $column, $data ) ); |
|
642 | + WP_CLI::log($this->color_message($column, $data)); |
|
643 | 643 | } |
644 | 644 | } |
645 | 645 | } |
@@ -679,27 +679,27 @@ discard block |
||
679 | 679 | * |
680 | 680 | * @return void |
681 | 681 | */ |
682 | - public function report( $args, $assoc_args ) { |
|
682 | + public function report($args, $assoc_args) { |
|
683 | 683 | $stats = new Give_Payment_Stats(); |
684 | - $date = isset( $assoc_args ) && array_key_exists( 'date', $assoc_args ) ? $assoc_args['date'] : false; |
|
685 | - $start_date = isset( $assoc_args ) && array_key_exists( 'start-date', $assoc_args ) ? $assoc_args['start-date'] : false; |
|
686 | - $end_date = isset( $assoc_args ) && array_key_exists( 'end-date', $assoc_args ) ? $assoc_args['end-date'] : false; |
|
687 | - $form_id = isset( $assoc_args ) && array_key_exists( 'id', $assoc_args ) ? $assoc_args['id'] : 0; |
|
684 | + $date = isset($assoc_args) && array_key_exists('date', $assoc_args) ? $assoc_args['date'] : false; |
|
685 | + $start_date = isset($assoc_args) && array_key_exists('start-date', $assoc_args) ? $assoc_args['start-date'] : false; |
|
686 | + $end_date = isset($assoc_args) && array_key_exists('end-date', $assoc_args) ? $assoc_args['end-date'] : false; |
|
687 | + $form_id = isset($assoc_args) && array_key_exists('id', $assoc_args) ? $assoc_args['id'] : 0; |
|
688 | 688 | |
689 | - if ( ! empty( $date ) ) { |
|
689 | + if ( ! empty($date)) { |
|
690 | 690 | $start_date = $date; |
691 | 691 | $end_date = false; |
692 | - } elseif ( empty( $date ) && empty( $start_date ) ) { |
|
692 | + } elseif (empty($date) && empty($start_date)) { |
|
693 | 693 | $start_date = 'this_month'; |
694 | 694 | $end_date = false; |
695 | 695 | } |
696 | 696 | |
697 | 697 | // Get stats. |
698 | - $earnings = $stats->get_earnings( $form_id, $start_date, $end_date ); |
|
699 | - $sales = $stats->get_sales( $form_id, $start_date, $end_date ); |
|
698 | + $earnings = $stats->get_earnings($form_id, $start_date, $end_date); |
|
699 | + $sales = $stats->get_sales($form_id, $start_date, $end_date); |
|
700 | 700 | |
701 | - WP_CLI::line( $this->color_message( __( 'Earnings', 'give' ), give_currency_filter( $earnings ) ) ); |
|
702 | - WP_CLI::line( $this->color_message( __( 'Sales', 'give' ), $sales ) ); |
|
701 | + WP_CLI::line($this->color_message(__('Earnings', 'give'), give_currency_filter($earnings))); |
|
702 | + WP_CLI::line($this->color_message(__('Sales', 'give'), $sales)); |
|
703 | 703 | } |
704 | 704 | |
705 | 705 | |
@@ -726,27 +726,27 @@ discard block |
||
726 | 726 | * |
727 | 727 | * @subcommand cache |
728 | 728 | */ |
729 | - public function cache( $args, $assoc_args ) { |
|
730 | - $action = isset( $assoc_args ) && array_key_exists( 'action', $assoc_args ) ? $assoc_args['action'] : false; |
|
729 | + public function cache($args, $assoc_args) { |
|
730 | + $action = isset($assoc_args) && array_key_exists('action', $assoc_args) ? $assoc_args['action'] : false; |
|
731 | 731 | |
732 | 732 | // Bailout. |
733 | - if ( ! $action || ! in_array( $action, array( 'delete' ), true ) ) { |
|
734 | - WP_CLI::warning( __( 'Type wp give cache --action=delete to delete all stat transients', 'give' ) ); |
|
733 | + if ( ! $action || ! in_array($action, array('delete'), true)) { |
|
734 | + WP_CLI::warning(__('Type wp give cache --action=delete to delete all stat transients', 'give')); |
|
735 | 735 | |
736 | 736 | return; |
737 | 737 | } |
738 | 738 | |
739 | - switch ( $action ) { |
|
739 | + switch ($action) { |
|
740 | 740 | case 'delete' : |
741 | 741 | // Reset counter. |
742 | 742 | self::$counter = 1; |
743 | 743 | |
744 | - if ( $this->delete_stats_transients() ) { |
|
744 | + if ($this->delete_stats_transients()) { |
|
745 | 745 | // Report .eading. |
746 | - WP_CLI::success( 'Give cache deleted.' ); |
|
746 | + WP_CLI::success('Give cache deleted.'); |
|
747 | 747 | } else { |
748 | 748 | // Report .eading. |
749 | - WP_CLI::warning( 'We did not find any Give plugin cache to delete :)' ); |
|
749 | + WP_CLI::warning('We did not find any Give plugin cache to delete :)'); |
|
750 | 750 | } |
751 | 751 | break; |
752 | 752 | } |
@@ -775,27 +775,27 @@ discard block |
||
775 | 775 | ARRAY_A |
776 | 776 | ); |
777 | 777 | |
778 | - if ( ! empty( $stat_option_names ) ) { |
|
778 | + if ( ! empty($stat_option_names)) { |
|
779 | 779 | |
780 | - foreach ( $stat_option_names as $option_name ) { |
|
780 | + foreach ($stat_option_names as $option_name) { |
|
781 | 781 | $error = false; |
782 | 782 | $option_name = $option_name['option_name']; |
783 | 783 | |
784 | - switch ( true ) { |
|
785 | - case ( false !== strpos( $option_name, 'transient' ) ): |
|
786 | - $option_name = str_replace( '_transient_', '', $option_name ); |
|
787 | - $error = delete_transient( $option_name ); |
|
784 | + switch (true) { |
|
785 | + case (false !== strpos($option_name, 'transient')): |
|
786 | + $option_name = str_replace('_transient_', '', $option_name); |
|
787 | + $error = delete_transient($option_name); |
|
788 | 788 | break; |
789 | 789 | |
790 | 790 | default: |
791 | - $error = delete_option( $option_name ); |
|
791 | + $error = delete_option($option_name); |
|
792 | 792 | } |
793 | 793 | |
794 | - if ( $error ) { |
|
795 | - WP_CLI::log( $this->color_message( self::$counter, $option_name ) ); |
|
796 | - self::$counter ++; |
|
794 | + if ($error) { |
|
795 | + WP_CLI::log($this->color_message(self::$counter, $option_name)); |
|
796 | + self::$counter++; |
|
797 | 797 | } else { |
798 | - WP_CLI::log( $this->color_message( __( 'Error while deleting this transient', 'give' ), $option_name ) ); |
|
798 | + WP_CLI::log($this->color_message(__('Error while deleting this transient', 'give'), $option_name)); |
|
799 | 799 | } |
800 | 800 | } |
801 | 801 | |
@@ -816,13 +816,13 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @return string |
818 | 818 | */ |
819 | - private function color_message( $heading, $message = '', $colon = true, $color = 'g' ) { |
|
819 | + private function color_message($heading, $message = '', $colon = true, $color = 'g') { |
|
820 | 820 | // Add colon. |
821 | - if ( $colon ) { |
|
822 | - $heading = $heading . ': '; |
|
821 | + if ($colon) { |
|
822 | + $heading = $heading.': '; |
|
823 | 823 | } |
824 | 824 | |
825 | - return WP_CLI::colorize( "%{$color}" . $heading . '%n' ) . $message; |
|
825 | + return WP_CLI::colorize("%{$color}".$heading.'%n').$message; |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | |
@@ -837,8 +837,8 @@ discard block |
||
837 | 837 | * |
838 | 838 | * @return void |
839 | 839 | */ |
840 | - private function color_main_heading( $heading, $color = 'g' ) { |
|
841 | - WP_CLI::log( "\n###### " . $this->color_message( $heading, '', false, $color ) . ' ######' ); |
|
840 | + private function color_main_heading($heading, $color = 'g') { |
|
841 | + WP_CLI::log("\n###### ".$this->color_message($heading, '', false, $color).' ######'); |
|
842 | 842 | } |
843 | 843 | |
844 | 844 | /** |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | * |
852 | 852 | * @return void |
853 | 853 | */ |
854 | - private function color_sub_heading( $subheading ) { |
|
855 | - WP_CLI::log( "\n--->" . $subheading . '', '', false ); |
|
854 | + private function color_sub_heading($subheading) { |
|
855 | + WP_CLI::log("\n--->".$subheading.'', '', false); |
|
856 | 856 | } |
857 | 857 | |
858 | 858 | |
@@ -866,17 +866,17 @@ discard block |
||
866 | 866 | * |
867 | 867 | * @return void |
868 | 868 | */ |
869 | - private function display_table( $data ) { |
|
869 | + private function display_table($data) { |
|
870 | 870 | $table = new \cli\Table(); |
871 | 871 | |
872 | 872 | // Set table header. |
873 | - $table->setHeaders( $data[0] ); |
|
873 | + $table->setHeaders($data[0]); |
|
874 | 874 | |
875 | 875 | // Remove table header. |
876 | - unset( $data[0] ); |
|
876 | + unset($data[0]); |
|
877 | 877 | |
878 | 878 | // Set table data. |
879 | - $table->setRows( $data ); |
|
879 | + $table->setRows($data); |
|
880 | 880 | |
881 | 881 | // Display table. |
882 | 882 | $table->display(); |
@@ -893,14 +893,14 @@ discard block |
||
893 | 893 | * @return array |
894 | 894 | */ |
895 | 895 | |
896 | - private function get_donors_by_form_id( $form_id ) { |
|
896 | + private function get_donors_by_form_id($form_id) { |
|
897 | 897 | $donors = array(); |
898 | 898 | |
899 | 899 | $donations = new Give_Payments_Query( |
900 | 900 | array( |
901 | - 'give_forms' => array( $form_id ), |
|
902 | - 'number' => - 1, |
|
903 | - 'status' => array( 'publish' ), |
|
901 | + 'give_forms' => array($form_id), |
|
902 | + 'number' => -1, |
|
903 | + 'status' => array('publish'), |
|
904 | 904 | ) |
905 | 905 | ); |
906 | 906 | |
@@ -908,16 +908,16 @@ discard block |
||
908 | 908 | $skip_donors = array(); |
909 | 909 | |
910 | 910 | /* @var Give_Payment|object $donation Payment object. */ |
911 | - foreach ( $donations as $donation ) { |
|
911 | + foreach ($donations as $donation) { |
|
912 | 912 | |
913 | - if ( in_array( $donation->customer_id, $skip_donors ,true ) ) { |
|
913 | + if (in_array($donation->customer_id, $skip_donors, true)) { |
|
914 | 914 | continue; |
915 | 915 | } |
916 | 916 | |
917 | - if ( ! empty( $donors ) ) { |
|
918 | - $donors['donors'][] = current( current( $this->api->get_donors( (int) $donation->customer_id ) ) ); |
|
917 | + if ( ! empty($donors)) { |
|
918 | + $donors['donors'][] = current(current($this->api->get_donors((int) $donation->customer_id))); |
|
919 | 919 | } else { |
920 | - $donors = array_merge( $donors, $this->api->get_donors( (int) $donation->customer_id ) ); |
|
920 | + $donors = array_merge($donors, $this->api->get_donors((int) $donation->customer_id)); |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | $skip_donors[] = $donation->customer_id; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly. |
13 | -if ( ! defined( 'ABSPATH' ) ) { |
|
13 | +if ( ! defined('ABSPATH')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
@@ -20,19 +20,19 @@ discard block |
||
20 | 20 | * @since 1.8 |
21 | 21 | */ |
22 | 22 | function give_load_wp_editor() { |
23 | - if ( ! isset( $_POST['wp_editor'] ) ) { |
|
23 | + if ( ! isset($_POST['wp_editor'])) { |
|
24 | 24 | die(); |
25 | 25 | } |
26 | 26 | |
27 | - $wp_editor = json_decode( base64_decode( $_POST['wp_editor'] ), true ); |
|
27 | + $wp_editor = json_decode(base64_decode($_POST['wp_editor']), true); |
|
28 | 28 | $wp_editor[2]['textarea_name'] = $_POST['textarea_name']; |
29 | 29 | |
30 | - wp_editor( $wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2] ); |
|
30 | + wp_editor($wp_editor[0], $_POST['wp_editor_id'], $wp_editor[2]); |
|
31 | 31 | |
32 | 32 | die(); |
33 | 33 | } |
34 | 34 | |
35 | -add_action( 'wp_ajax_give_load_wp_editor', 'give_load_wp_editor' ); |
|
35 | +add_action('wp_ajax_give_load_wp_editor', 'give_load_wp_editor'); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | /** |
@@ -52,13 +52,13 @@ discard block |
||
52 | 52 | ); |
53 | 53 | |
54 | 54 | // Get current page. |
55 | - $current_page = isset( $_GET['page'] ) ? esc_attr( $_GET['page'] ) : ''; |
|
55 | + $current_page = isset($_GET['page']) ? esc_attr($_GET['page']) : ''; |
|
56 | 56 | |
57 | 57 | // Bailout. |
58 | 58 | if ( |
59 | - empty( $current_page ) |
|
60 | - || empty( $_GET['_wp_http_referer'] ) |
|
61 | - || ! in_array( $current_page, $give_pages ) |
|
59 | + empty($current_page) |
|
60 | + || empty($_GET['_wp_http_referer']) |
|
61 | + || ! in_array($current_page, $give_pages) |
|
62 | 62 | ) { |
63 | 63 | return false; |
64 | 64 | } |
@@ -68,21 +68,21 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @since 1.8 |
70 | 70 | */ |
71 | - $redirect = apply_filters( "give_validate_{$current_page}", true ); |
|
71 | + $redirect = apply_filters("give_validate_{$current_page}", true); |
|
72 | 72 | |
73 | - if ( $redirect ) { |
|
73 | + if ($redirect) { |
|
74 | 74 | // Redirect. |
75 | 75 | wp_redirect( |
76 | 76 | remove_query_arg( |
77 | - array( '_wp_http_referer', '_wpnonce' ), |
|
78 | - wp_unslash( $_SERVER['REQUEST_URI'] ) |
|
77 | + array('_wp_http_referer', '_wpnonce'), |
|
78 | + wp_unslash($_SERVER['REQUEST_URI']) |
|
79 | 79 | ) |
80 | 80 | ); |
81 | 81 | exit; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | -add_action( 'admin_init', 'give_redirect_to_clean_url_admin_pages' ); |
|
85 | +add_action('admin_init', 'give_redirect_to_clean_url_admin_pages'); |
|
86 | 86 | |
87 | 87 | |
88 | 88 | /** |
@@ -96,25 +96,25 @@ discard block |
||
96 | 96 | */ |
97 | 97 | function give_hide_outdated_php_notice() { |
98 | 98 | |
99 | - if ( ! isset( $_POST['_give_hide_outdated_php_notices_shortly'] ) ) { |
|
99 | + if ( ! isset($_POST['_give_hide_outdated_php_notices_shortly'])) { |
|
100 | 100 | give_die(); |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Transient key name. |
104 | 104 | $transient_key = "_give_hide_outdated_php_notices_shortly"; |
105 | 105 | |
106 | - if ( Give_Cache::get( $transient_key, true ) ) { |
|
106 | + if (Give_Cache::get($transient_key, true)) { |
|
107 | 107 | return; |
108 | 108 | } |
109 | 109 | |
110 | 110 | // Hide notice for 24 hours. |
111 | - Give_Cache::set( $transient_key, true, DAY_IN_SECONDS, true ); |
|
111 | + Give_Cache::set($transient_key, true, DAY_IN_SECONDS, true); |
|
112 | 112 | |
113 | 113 | give_die(); |
114 | 114 | |
115 | 115 | } |
116 | 116 | |
117 | -add_action( 'wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice' ); |
|
117 | +add_action('wp_ajax_give_hide_outdated_php_notice', 'give_hide_outdated_php_notice'); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Updates state list. |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | * @return void |
125 | 125 | */ |
126 | 126 | function give_update_states() { |
127 | - $country_code = filter_input( INPUT_POST, 'country_code', FILTER_SANITIZE_STRING ); |
|
127 | + $country_code = filter_input(INPUT_POST, 'country_code', FILTER_SANITIZE_STRING); |
|
128 | 128 | $states_list = give_states_list(); |
129 | - echo wp_json_encode( $states_list[ $country_code ] ); |
|
129 | + echo wp_json_encode($states_list[$country_code]); |
|
130 | 130 | wp_die(); |
131 | 131 | } |
132 | -add_action( 'wp_ajax_give_update_states', 'give_update_states' ); |
|
132 | +add_action('wp_ajax_give_update_states', 'give_update_states'); |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * Register admin notices. |
@@ -138,23 +138,23 @@ discard block |
||
138 | 138 | */ |
139 | 139 | function _give_register_admin_notices() { |
140 | 140 | // Bailout. |
141 | - if( ! is_admin() ) { |
|
141 | + if ( ! is_admin()) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | 145 | // Add payment bulk notice. |
146 | 146 | if ( |
147 | - current_user_can( 'edit_give_payments' ) |
|
148 | - && isset( $_GET['action'] ) |
|
149 | - && ! empty( $_GET['action'] ) |
|
150 | - && isset( $_GET['payment'] ) |
|
151 | - && ! empty( $_GET['payment'] ) |
|
147 | + current_user_can('edit_give_payments') |
|
148 | + && isset($_GET['action']) |
|
149 | + && ! empty($_GET['action']) |
|
150 | + && isset($_GET['payment']) |
|
151 | + && ! empty($_GET['payment']) |
|
152 | 152 | ) { |
153 | - $payment_count = isset( $_GET['payment'] ) ? count( $_GET['payment'] ) : 0; |
|
153 | + $payment_count = isset($_GET['payment']) ? count($_GET['payment']) : 0; |
|
154 | 154 | |
155 | - switch ( $_GET['action'] ) { |
|
155 | + switch ($_GET['action']) { |
|
156 | 156 | case 'delete': |
157 | - Give()->notices->register_notice( array( |
|
157 | + Give()->notices->register_notice(array( |
|
158 | 158 | 'id' => 'bulk_action_delete', |
159 | 159 | 'type' => 'updated', |
160 | 160 | 'description' => sprintf( |
@@ -166,12 +166,12 @@ discard block |
||
166 | 166 | ), |
167 | 167 | $payment_count ), |
168 | 168 | 'show' => true, |
169 | - ) ); |
|
169 | + )); |
|
170 | 170 | |
171 | 171 | break; |
172 | 172 | |
173 | 173 | case 'resend-receipt': |
174 | - Give()->notices->register_notice( array( |
|
174 | + Give()->notices->register_notice(array( |
|
175 | 175 | 'id' => 'bulk_action_resend_receipt', |
176 | 176 | 'type' => 'updated', |
177 | 177 | 'description' => sprintf( |
@@ -184,196 +184,196 @@ discard block |
||
184 | 184 | $payment_count |
185 | 185 | ), |
186 | 186 | 'show' => true, |
187 | - ) ); |
|
187 | + )); |
|
188 | 188 | break; |
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
192 | 192 | // Add give message notices. |
193 | - if ( ! empty( $_GET['give-message'] ) ) { |
|
193 | + if ( ! empty($_GET['give-message'])) { |
|
194 | 194 | // Donation reports errors. |
195 | - if ( current_user_can( 'view_give_reports' ) ) { |
|
196 | - switch ( $_GET['give-message'] ) { |
|
195 | + if (current_user_can('view_give_reports')) { |
|
196 | + switch ($_GET['give-message']) { |
|
197 | 197 | case 'donation_deleted' : |
198 | - Give()->notices->register_notice( array( |
|
198 | + Give()->notices->register_notice(array( |
|
199 | 199 | 'id' => 'give-donation-deleted', |
200 | 200 | 'type' => 'updated', |
201 | - 'description' => __( 'The donation has been deleted.', 'give' ), |
|
201 | + 'description' => __('The donation has been deleted.', 'give'), |
|
202 | 202 | 'show' => true, |
203 | - ) ); |
|
203 | + )); |
|
204 | 204 | break; |
205 | 205 | case 'email_sent' : |
206 | - Give()->notices->register_notice( array( |
|
206 | + Give()->notices->register_notice(array( |
|
207 | 207 | 'id' => 'give-payment-sent', |
208 | 208 | 'type' => 'updated', |
209 | - 'description' => __( 'The donation receipt has been resent.', 'give' ), |
|
209 | + 'description' => __('The donation receipt has been resent.', 'give'), |
|
210 | 210 | 'show' => true, |
211 | - ) ); |
|
211 | + )); |
|
212 | 212 | break; |
213 | 213 | case 'refreshed-reports' : |
214 | - Give()->notices->register_notice( array( |
|
214 | + Give()->notices->register_notice(array( |
|
215 | 215 | 'id' => 'give-refreshed-reports', |
216 | 216 | 'type' => 'updated', |
217 | - 'description' => __( 'The reports cache has been cleared.', 'give' ), |
|
217 | + 'description' => __('The reports cache has been cleared.', 'give'), |
|
218 | 218 | 'show' => true, |
219 | - ) ); |
|
219 | + )); |
|
220 | 220 | break; |
221 | 221 | case 'donation-note-deleted' : |
222 | - Give()->notices->register_notice( array( |
|
222 | + Give()->notices->register_notice(array( |
|
223 | 223 | 'id' => 'give-donation-note-deleted', |
224 | 224 | 'type' => 'updated', |
225 | - 'description' => __( 'The donation note has been deleted.', 'give' ), |
|
225 | + 'description' => __('The donation note has been deleted.', 'give'), |
|
226 | 226 | 'show' => true, |
227 | - ) ); |
|
227 | + )); |
|
228 | 228 | break; |
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | // Give settings notices and errors. |
233 | - if ( current_user_can( 'manage_give_settings' ) ) { |
|
234 | - switch ( $_GET['give-message'] ) { |
|
233 | + if (current_user_can('manage_give_settings')) { |
|
234 | + switch ($_GET['give-message']) { |
|
235 | 235 | case 'settings-imported' : |
236 | - Give()->notices->register_notice( array( |
|
236 | + Give()->notices->register_notice(array( |
|
237 | 237 | 'id' => 'give-settings-imported', |
238 | 238 | 'type' => 'updated', |
239 | - 'description' => __( 'The settings have been imported.', 'give' ), |
|
239 | + 'description' => __('The settings have been imported.', 'give'), |
|
240 | 240 | 'show' => true, |
241 | - ) ); |
|
241 | + )); |
|
242 | 242 | break; |
243 | 243 | case 'api-key-generated' : |
244 | - Give()->notices->register_notice( array( |
|
244 | + Give()->notices->register_notice(array( |
|
245 | 245 | 'id' => 'give-api-key-generated', |
246 | 246 | 'type' => 'updated', |
247 | - 'description' => __( 'API keys have been generated.', 'give' ), |
|
247 | + 'description' => __('API keys have been generated.', 'give'), |
|
248 | 248 | 'show' => true, |
249 | - ) ); |
|
249 | + )); |
|
250 | 250 | break; |
251 | 251 | case 'api-key-exists' : |
252 | - Give()->notices->register_notice( array( |
|
252 | + Give()->notices->register_notice(array( |
|
253 | 253 | 'id' => 'give-api-key-exists', |
254 | 254 | 'type' => 'updated', |
255 | - 'description' => __( 'The specified user already has API keys.', 'give' ), |
|
255 | + 'description' => __('The specified user already has API keys.', 'give'), |
|
256 | 256 | 'show' => true, |
257 | - ) ); |
|
257 | + )); |
|
258 | 258 | break; |
259 | 259 | case 'api-key-regenerated' : |
260 | - Give()->notices->register_notice( array( |
|
260 | + Give()->notices->register_notice(array( |
|
261 | 261 | 'id' => 'give-api-key-regenerated', |
262 | 262 | 'type' => 'updated', |
263 | - 'description' => __( 'API keys have been regenerated.', 'give' ), |
|
263 | + 'description' => __('API keys have been regenerated.', 'give'), |
|
264 | 264 | 'show' => true, |
265 | - ) ); |
|
265 | + )); |
|
266 | 266 | break; |
267 | 267 | case 'api-key-revoked' : |
268 | - Give()->notices->register_notice( array( |
|
268 | + Give()->notices->register_notice(array( |
|
269 | 269 | 'id' => 'give-api-key-revoked', |
270 | 270 | 'type' => 'updated', |
271 | - 'description' => __( 'API keys have been revoked.', 'give' ), |
|
271 | + 'description' => __('API keys have been revoked.', 'give'), |
|
272 | 272 | 'show' => true, |
273 | - ) ); |
|
273 | + )); |
|
274 | 274 | break; |
275 | 275 | case 'sent-test-email' : |
276 | - Give()->notices->register_notice( array( |
|
276 | + Give()->notices->register_notice(array( |
|
277 | 277 | 'id' => 'give-sent-test-email', |
278 | 278 | 'type' => 'updated', |
279 | - 'description' => __( 'The test email has been sent.', 'give' ), |
|
279 | + 'description' => __('The test email has been sent.', 'give'), |
|
280 | 280 | 'show' => true, |
281 | - ) ); |
|
281 | + )); |
|
282 | 282 | break; |
283 | 283 | case 'matched-success-failure-page': |
284 | - Give()->notices->register_notice( array( |
|
284 | + Give()->notices->register_notice(array( |
|
285 | 285 | 'id' => 'give-matched-success-failure-page', |
286 | 286 | 'type' => 'updated', |
287 | - 'description' => __( 'You cannot set the success and failed pages to the same page', 'give' ), |
|
287 | + 'description' => __('You cannot set the success and failed pages to the same page', 'give'), |
|
288 | 288 | 'show' => true, |
289 | - ) ); |
|
289 | + )); |
|
290 | 290 | break; |
291 | 291 | } |
292 | 292 | } |
293 | 293 | // Payments errors. |
294 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
295 | - switch ( $_GET['give-message'] ) { |
|
294 | + if (current_user_can('edit_give_payments')) { |
|
295 | + switch ($_GET['give-message']) { |
|
296 | 296 | case 'note-added' : |
297 | - Give()->notices->register_notice( array( |
|
297 | + Give()->notices->register_notice(array( |
|
298 | 298 | 'id' => 'give-note-added', |
299 | 299 | 'type' => 'updated', |
300 | - 'description' => __( 'The donation note has been added.', 'give' ), |
|
300 | + 'description' => __('The donation note has been added.', 'give'), |
|
301 | 301 | 'show' => true, |
302 | - ) ); |
|
302 | + )); |
|
303 | 303 | break; |
304 | 304 | case 'payment-updated' : |
305 | - Give()->notices->register_notice( array( |
|
305 | + Give()->notices->register_notice(array( |
|
306 | 306 | 'id' => 'give-payment-updated', |
307 | 307 | 'type' => 'updated', |
308 | - 'description' => __( 'The donation has been updated.', 'give' ), |
|
308 | + 'description' => __('The donation has been updated.', 'give'), |
|
309 | 309 | 'show' => true, |
310 | - ) ); |
|
310 | + )); |
|
311 | 311 | break; |
312 | 312 | } |
313 | 313 | } |
314 | 314 | |
315 | 315 | // Donor Notices. |
316 | - if ( current_user_can( 'edit_give_payments' ) ) { |
|
317 | - switch ( $_GET['give-message'] ) { |
|
316 | + if (current_user_can('edit_give_payments')) { |
|
317 | + switch ($_GET['give-message']) { |
|
318 | 318 | case 'donor-deleted' : |
319 | - Give()->notices->register_notice( array( |
|
319 | + Give()->notices->register_notice(array( |
|
320 | 320 | 'id' => 'give-donor-deleted', |
321 | 321 | 'type' => 'updated', |
322 | - 'description' => __( 'The donor has been deleted.', 'give' ), |
|
322 | + 'description' => __('The donor has been deleted.', 'give'), |
|
323 | 323 | 'show' => true, |
324 | - ) ); |
|
324 | + )); |
|
325 | 325 | break; |
326 | 326 | |
327 | 327 | case 'email-added' : |
328 | - Give()->notices->register_notice( array( |
|
328 | + Give()->notices->register_notice(array( |
|
329 | 329 | 'id' => 'give-donor-email-added', |
330 | 330 | 'type' => 'updated', |
331 | - 'description' => __( 'Donor email added.', 'give' ), |
|
331 | + 'description' => __('Donor email added.', 'give'), |
|
332 | 332 | 'show' => true, |
333 | - ) ); |
|
333 | + )); |
|
334 | 334 | break; |
335 | 335 | |
336 | 336 | case 'email-removed' : |
337 | - Give()->notices->register_notice( array( |
|
337 | + Give()->notices->register_notice(array( |
|
338 | 338 | 'id' => 'give-donor-email-removed', |
339 | 339 | 'type' => 'updated', |
340 | - 'description' => __( 'Donor email removed.', 'give' ), |
|
340 | + 'description' => __('Donor email removed.', 'give'), |
|
341 | 341 | 'show' => true, |
342 | - ) ); |
|
342 | + )); |
|
343 | 343 | break; |
344 | 344 | |
345 | 345 | case 'email-remove-failed' : |
346 | - Give()->notices->register_notice( array( |
|
346 | + Give()->notices->register_notice(array( |
|
347 | 347 | 'id' => 'give-donor-email-remove-failed', |
348 | 348 | 'type' => 'updated', |
349 | - 'description' => __( 'Failed to remove donor email.', 'give' ), |
|
349 | + 'description' => __('Failed to remove donor email.', 'give'), |
|
350 | 350 | 'show' => true, |
351 | - ) ); |
|
351 | + )); |
|
352 | 352 | break; |
353 | 353 | |
354 | 354 | case 'primary-email-updated' : |
355 | - Give()->notices->register_notice( array( |
|
355 | + Give()->notices->register_notice(array( |
|
356 | 356 | 'id' => 'give-donor-primary-email-updated', |
357 | 357 | 'type' => 'updated', |
358 | - 'description' => __( 'Primary email updated for donor.', 'give' ), |
|
358 | + 'description' => __('Primary email updated for donor.', 'give'), |
|
359 | 359 | 'show' => true, |
360 | - ) ); |
|
360 | + )); |
|
361 | 361 | break; |
362 | 362 | |
363 | 363 | case 'primary-email-failed' : |
364 | - Give()->notices->register_notice( array( |
|
364 | + Give()->notices->register_notice(array( |
|
365 | 365 | 'id' => 'give-donor-primary-email-failed', |
366 | 366 | 'type' => 'updated', |
367 | - 'description' => __( 'Failed to set primary email.', 'give' ), |
|
367 | + 'description' => __('Failed to set primary email.', 'give'), |
|
368 | 368 | 'show' => true, |
369 | - ) ); |
|
369 | + )); |
|
370 | 370 | break; |
371 | 371 | } |
372 | 372 | } |
373 | 373 | } |
374 | 374 | } |
375 | 375 | |
376 | -add_action( 'admin_notices', '_give_register_admin_notices', - 1 ); |
|
376 | +add_action('admin_notices', '_give_register_admin_notices', - 1); |
|
377 | 377 | |
378 | 378 | |
379 | 379 | /** |
@@ -383,27 +383,26 @@ discard block |
||
383 | 383 | * |
384 | 384 | * @return bool |
385 | 385 | */ |
386 | -function _give_show_test_mode_notice_in_admin_bar( $wp_admin_bar ) { |
|
387 | - $is_test_mode = ! empty( $_POST['test_mode'] ) ? |
|
388 | - give_is_setting_enabled( $_POST['test_mode'] ) : |
|
389 | - give_is_test_mode(); |
|
386 | +function _give_show_test_mode_notice_in_admin_bar($wp_admin_bar) { |
|
387 | + $is_test_mode = ! empty($_POST['test_mode']) ? |
|
388 | + give_is_setting_enabled($_POST['test_mode']) : give_is_test_mode(); |
|
390 | 389 | |
391 | 390 | if ( |
392 | - ! current_user_can( 'view_give_reports' ) || |
|
391 | + ! current_user_can('view_give_reports') || |
|
393 | 392 | ! $is_test_mode |
394 | 393 | ) { |
395 | 394 | return false; |
396 | 395 | } |
397 | 396 | |
398 | 397 | // Add the main siteadmin menu item. |
399 | - $wp_admin_bar->add_menu( array( |
|
398 | + $wp_admin_bar->add_menu(array( |
|
400 | 399 | 'id' => 'give-test-notice', |
401 | - 'href' => admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways' ), |
|
400 | + 'href' => admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways'), |
|
402 | 401 | 'parent' => 'top-secondary', |
403 | - 'title' => esc_html__( 'Give Test Mode Active', 'give' ), |
|
404 | - 'meta' => array( 'class' => 'give-test-mode-active' ), |
|
405 | - ) ); |
|
402 | + 'title' => esc_html__('Give Test Mode Active', 'give'), |
|
403 | + 'meta' => array('class' => 'give-test-mode-active'), |
|
404 | + )); |
|
406 | 405 | |
407 | 406 | return true; |
408 | 407 | } |
409 | -add_action( 'admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1 ); |
|
410 | 408 | \ No newline at end of file |
409 | +add_action('admin_bar_menu', '_give_show_test_mode_notice_in_admin_bar', 1000, 1); |
|
411 | 410 | \ No newline at end of file |
@@ -90,13 +90,13 @@ discard block |
||
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | - array( |
|
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
95 | - 'id' => 'access_control_docs_link', |
|
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
98 | - 'type' => 'give_docs_link', |
|
99 | - ), |
|
93 | + array( |
|
94 | + 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
95 | + 'id' => 'access_control_docs_link', |
|
96 | + 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | + 'title' => __( 'Access Control', 'give' ), |
|
98 | + 'type' => 'give_docs_link', |
|
99 | + ), |
|
100 | 100 | array( |
101 | 101 | 'id' => 'give_title_session_control_1', |
102 | 102 | 'type' => 'sectionend' |
@@ -162,13 +162,13 @@ discard block |
||
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | - array( |
|
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
167 | - 'id' => 'currency_settings_docs_link', |
|
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
170 | - 'type' => 'give_docs_link', |
|
171 | - ), |
|
165 | + array( |
|
166 | + 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
167 | + 'id' => 'currency_settings_docs_link', |
|
168 | + 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | + 'title' => __( 'Currency Settings', 'give' ), |
|
170 | + 'type' => 'give_docs_link', |
|
171 | + ), |
|
172 | 172 | array( |
173 | 173 | 'type' => 'sectionend', |
174 | 174 | 'id' => 'give_title_general_settings_2' |
@@ -236,11 +236,11 @@ discard block |
||
236 | 236 | 'options' => give_states_list()[ get_option( 'give_settings' )['base_country'] ], |
237 | 237 | ), |
238 | 238 | array( |
239 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
240 | - 'id' => 'general_options_docs_link', |
|
241 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
242 | - 'title' => __( 'General Options', 'give' ), |
|
243 | - 'type' => 'give_docs_link', |
|
239 | + 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
240 | + 'id' => 'general_options_docs_link', |
|
241 | + 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
242 | + 'title' => __( 'General Options', 'give' ), |
|
243 | + 'type' => 'give_docs_link', |
|
244 | 244 | ), |
245 | 245 | array( |
246 | 246 | 'type' => 'sectionend', |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | * @since 1.8 |
10 | 10 | */ |
11 | 11 | |
12 | -if ( ! defined( 'ABSPATH' ) ) { |
|
12 | +if ( ! defined('ABSPATH')) { |
|
13 | 13 | exit; // Exit if accessed directly |
14 | 14 | } |
15 | 15 | |
16 | -if ( ! class_exists( 'Give_Settings_General' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_General')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_General. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | $this->id = 'general'; |
30 | - $this->label = esc_html__( 'General', 'give' ); |
|
30 | + $this->label = esc_html__('General', 'give'); |
|
31 | 31 | |
32 | 32 | $this->default_tab = 'general-settings'; |
33 | 33 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $settings = array(); |
45 | 45 | $current_section = give_get_current_setting_section(); |
46 | 46 | |
47 | - switch ( $current_section ) { |
|
47 | + switch ($current_section) { |
|
48 | 48 | case 'access-control': |
49 | 49 | $settings = array( |
50 | 50 | // Section 3: Access control. |
@@ -54,47 +54,47 @@ discard block |
||
54 | 54 | ), |
55 | 55 | array( |
56 | 56 | 'id' => 'session_lifetime', |
57 | - 'name' => esc_html__( 'Session Lifetime', 'give' ), |
|
58 | - 'desc' => esc_html__( 'The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give' ), |
|
57 | + 'name' => esc_html__('Session Lifetime', 'give'), |
|
58 | + 'desc' => esc_html__('The length of time a user\'s session is kept alive. Give starts a new session per user upon donation. Sessions allow donors to view their donation receipts without being logged in.', 'give'), |
|
59 | 59 | 'type' => 'select', |
60 | 60 | 'options' => array( |
61 | - '86400' => esc_html__( '24 Hours', 'give' ), |
|
62 | - '172800' => esc_html__( '48 Hours', 'give' ), |
|
63 | - '259200' => esc_html__( '72 Hours', 'give' ), |
|
64 | - '604800' => esc_html__( '1 Week', 'give' ), |
|
61 | + '86400' => esc_html__('24 Hours', 'give'), |
|
62 | + '172800' => esc_html__('48 Hours', 'give'), |
|
63 | + '259200' => esc_html__('72 Hours', 'give'), |
|
64 | + '604800' => esc_html__('1 Week', 'give'), |
|
65 | 65 | ) |
66 | 66 | ), |
67 | 67 | array( |
68 | - 'name' => esc_html__( 'Email Access', 'give' ), |
|
69 | - 'desc' => esc_html__( 'Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give' ), |
|
68 | + 'name' => esc_html__('Email Access', 'give'), |
|
69 | + 'desc' => esc_html__('Would you like your donors to be able to access their donation history using only email? Donors whose sessions have expired and do not have an account may still access their donation history via a temporary email access link.', 'give'), |
|
70 | 70 | 'id' => 'email_access', |
71 | 71 | 'type' => 'radio_inline', |
72 | 72 | 'default' => 'disabled', |
73 | 73 | 'options' => array( |
74 | - 'enabled' => __( 'Enabled', 'give' ), |
|
75 | - 'disabled' => __( 'Disabled', 'give' ), |
|
74 | + 'enabled' => __('Enabled', 'give'), |
|
75 | + 'disabled' => __('Disabled', 'give'), |
|
76 | 76 | ) |
77 | 77 | ), |
78 | 78 | array( |
79 | 79 | 'id' => 'recaptcha_key', |
80 | - 'name' => esc_html__( 'reCAPTCHA Site Key', 'give' ), |
|
80 | + 'name' => esc_html__('reCAPTCHA Site Key', 'give'), |
|
81 | 81 | /* translators: %s: https://www.google.com/recaptcha/ */ |
82 | - 'desc' => sprintf( __( 'Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give' ), esc_url( 'http://docs.givewp.com/recaptcha' ) ), |
|
82 | + 'desc' => sprintf(__('Please paste your reCAPTCHA site key here. <br />If you would like to prevent spam on the email access form navigate to <a href="%s" target="_blank">the reCAPTCHA website</a> and sign up for an API key. The reCAPTCHA uses Google\'s user-friendly single click verification method.', 'give'), esc_url('http://docs.givewp.com/recaptcha')), |
|
83 | 83 | 'default' => '', |
84 | 84 | 'type' => 'text' |
85 | 85 | ), |
86 | 86 | array( |
87 | 87 | 'id' => 'recaptcha_secret', |
88 | - 'name' => esc_html__( 'reCAPTCHA Secret Key', 'give' ), |
|
89 | - 'desc' => esc_html__( 'Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give' ), |
|
88 | + 'name' => esc_html__('reCAPTCHA Secret Key', 'give'), |
|
89 | + 'desc' => esc_html__('Please paste the reCAPTCHA secret key here from your reCAPTCHA API Keys panel.', 'give'), |
|
90 | 90 | 'default' => '', |
91 | 91 | 'type' => 'text' |
92 | 92 | ), |
93 | 93 | array( |
94 | - 'name' => esc_html__( 'Access Control Docs Link', 'give' ), |
|
94 | + 'name' => esc_html__('Access Control Docs Link', 'give'), |
|
95 | 95 | 'id' => 'access_control_docs_link', |
96 | - 'url' => esc_url( 'http://docs.givewp.com/settings-access-control' ), |
|
97 | - 'title' => __( 'Access Control', 'give' ), |
|
96 | + 'url' => esc_url('http://docs.givewp.com/settings-access-control'), |
|
97 | + 'title' => __('Access Control', 'give'), |
|
98 | 98 | 'type' => 'give_docs_link', |
99 | 99 | ), |
100 | 100 | array( |
@@ -112,61 +112,61 @@ discard block |
||
112 | 112 | 'id' => 'give_title_general_settings_2' |
113 | 113 | ), |
114 | 114 | array( |
115 | - 'name' => esc_html__( 'Currency Settings', 'give' ), |
|
115 | + 'name' => esc_html__('Currency Settings', 'give'), |
|
116 | 116 | 'desc' => '', |
117 | 117 | 'type' => 'give_title', |
118 | 118 | 'id' => 'give_title_general_settings_2' |
119 | 119 | ), |
120 | 120 | array( |
121 | - 'name' => esc_html__( 'Currency', 'give' ), |
|
122 | - 'desc' => esc_html__( 'The donation currency. Note that some payment gateways have currency restrictions.', 'give' ), |
|
121 | + 'name' => esc_html__('Currency', 'give'), |
|
122 | + 'desc' => esc_html__('The donation currency. Note that some payment gateways have currency restrictions.', 'give'), |
|
123 | 123 | 'id' => 'currency', |
124 | 124 | 'type' => 'select', |
125 | 125 | 'options' => give_get_currencies(), |
126 | 126 | 'default' => 'USD', |
127 | 127 | ), |
128 | 128 | array( |
129 | - 'name' => esc_html__( 'Currency Position', 'give' ), |
|
130 | - 'desc' => esc_html__( 'The position of the currency symbol.', 'give' ), |
|
129 | + 'name' => esc_html__('Currency Position', 'give'), |
|
130 | + 'desc' => esc_html__('The position of the currency symbol.', 'give'), |
|
131 | 131 | 'id' => 'currency_position', |
132 | 132 | 'type' => 'select', |
133 | 133 | 'options' => array( |
134 | 134 | /* translators: %s: currency symbol */ |
135 | - 'before' => sprintf( esc_html__( 'Before - %s10', 'give' ), give_currency_symbol( give_get_currency() ) ), |
|
135 | + 'before' => sprintf(esc_html__('Before - %s10', 'give'), give_currency_symbol(give_get_currency())), |
|
136 | 136 | /* translators: %s: currency symbol */ |
137 | - 'after' => sprintf( esc_html__( 'After - 10%s', 'give' ), give_currency_symbol( give_get_currency() ) ) |
|
137 | + 'after' => sprintf(esc_html__('After - 10%s', 'give'), give_currency_symbol(give_get_currency())) |
|
138 | 138 | ), |
139 | 139 | 'default' => 'before', |
140 | 140 | ), |
141 | 141 | array( |
142 | - 'name' => esc_html__( 'Thousands Separator', 'give' ), |
|
143 | - 'desc' => esc_html__( 'The symbol (typically , or .) to separate thousands.', 'give' ), |
|
142 | + 'name' => esc_html__('Thousands Separator', 'give'), |
|
143 | + 'desc' => esc_html__('The symbol (typically , or .) to separate thousands.', 'give'), |
|
144 | 144 | 'id' => 'thousands_separator', |
145 | 145 | 'type' => 'text', |
146 | 146 | 'default' => ',', |
147 | 147 | 'css' => 'width:12em;', |
148 | 148 | ), |
149 | 149 | array( |
150 | - 'name' => esc_html__( 'Decimal Separator', 'give' ), |
|
151 | - 'desc' => esc_html__( 'The symbol (usually , or .) to separate decimal points.', 'give' ), |
|
150 | + 'name' => esc_html__('Decimal Separator', 'give'), |
|
151 | + 'desc' => esc_html__('The symbol (usually , or .) to separate decimal points.', 'give'), |
|
152 | 152 | 'id' => 'decimal_separator', |
153 | 153 | 'type' => 'text', |
154 | 154 | 'default' => '.', |
155 | 155 | 'css' => 'width:12em;', |
156 | 156 | ), |
157 | 157 | array( |
158 | - 'name' => __( 'Number of Decimals', 'give' ), |
|
159 | - 'desc' => __( 'The number of decimal points displayed in amounts.', 'give' ), |
|
158 | + 'name' => __('Number of Decimals', 'give'), |
|
159 | + 'desc' => __('The number of decimal points displayed in amounts.', 'give'), |
|
160 | 160 | 'id' => 'number_decimals', |
161 | 161 | 'type' => 'text', |
162 | 162 | 'default' => 2, |
163 | 163 | 'css' => 'width:12em;', |
164 | 164 | ), |
165 | 165 | array( |
166 | - 'name' => esc_html__( 'Currency Options Docs Link', 'give' ), |
|
166 | + 'name' => esc_html__('Currency Options Docs Link', 'give'), |
|
167 | 167 | 'id' => 'currency_settings_docs_link', |
168 | - 'url' => esc_url( 'http://docs.givewp.com/settings-currency' ), |
|
169 | - 'title' => __( 'Currency Settings', 'give' ), |
|
168 | + 'url' => esc_url('http://docs.givewp.com/settings-currency'), |
|
169 | + 'title' => __('Currency Settings', 'give'), |
|
170 | 170 | 'type' => 'give_docs_link', |
171 | 171 | ), |
172 | 172 | array( |
@@ -184,62 +184,62 @@ discard block |
||
184 | 184 | 'id' => 'give_title_general_settings_1' |
185 | 185 | ), |
186 | 186 | array( |
187 | - 'name' => esc_html__( 'General Settings', 'give' ), |
|
187 | + 'name' => esc_html__('General Settings', 'give'), |
|
188 | 188 | 'desc' => '', |
189 | 189 | 'type' => 'give_title', |
190 | 190 | 'id' => 'give_title_general_settings_1' |
191 | 191 | ), |
192 | 192 | array( |
193 | - 'name' => esc_html__( 'Success Page', 'give' ), |
|
193 | + 'name' => esc_html__('Success Page', 'give'), |
|
194 | 194 | /* translators: %s: [give_receipt] */ |
195 | - 'desc' => sprintf( __( 'The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give' ), '<code>[give_receipt]</code>' ), |
|
195 | + 'desc' => sprintf(__('The page donors are sent to after completing their donations. The %s shortcode should be on this page.', 'give'), '<code>[give_receipt]</code>'), |
|
196 | 196 | 'id' => 'success_page', |
197 | 197 | 'type' => 'select', |
198 | - 'options' => give_cmb2_get_post_options( array( |
|
198 | + 'options' => give_cmb2_get_post_options(array( |
|
199 | 199 | 'post_type' => 'page', |
200 | - 'numberposts' => - 1 |
|
201 | - ) ), |
|
200 | + 'numberposts' => -1 |
|
201 | + )), |
|
202 | 202 | ), |
203 | 203 | array( |
204 | - 'name' => esc_html__( 'Failed Donation Page', 'give' ), |
|
205 | - 'desc' => esc_html__( 'The page donors are sent to if their donation is cancelled or fails.', 'give' ), |
|
204 | + 'name' => esc_html__('Failed Donation Page', 'give'), |
|
205 | + 'desc' => esc_html__('The page donors are sent to if their donation is cancelled or fails.', 'give'), |
|
206 | 206 | 'id' => 'failure_page', |
207 | 207 | 'type' => 'select', |
208 | - 'options' => give_cmb2_get_post_options( array( |
|
208 | + 'options' => give_cmb2_get_post_options(array( |
|
209 | 209 | 'post_type' => 'page', |
210 | - 'numberposts' => - 1 |
|
211 | - ) ), |
|
210 | + 'numberposts' => -1 |
|
211 | + )), |
|
212 | 212 | ), |
213 | 213 | array( |
214 | - 'name' => esc_html__( 'Donation History Page', 'give' ), |
|
214 | + 'name' => esc_html__('Donation History Page', 'give'), |
|
215 | 215 | /* translators: %s: [donation_history] */ |
216 | - 'desc' => sprintf( __( 'The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give' ), '<code>[donation_history]</code>' ), |
|
216 | + 'desc' => sprintf(__('The page showing a complete donation history for the current user. The %s shortcode should be on this page.', 'give'), '<code>[donation_history]</code>'), |
|
217 | 217 | 'id' => 'history_page', |
218 | 218 | 'type' => 'select', |
219 | - 'options' => give_cmb2_get_post_options( array( |
|
219 | + 'options' => give_cmb2_get_post_options(array( |
|
220 | 220 | 'post_type' => 'page', |
221 | - 'numberposts' => - 1 |
|
222 | - ) ), |
|
221 | + 'numberposts' => -1 |
|
222 | + )), |
|
223 | 223 | ), |
224 | 224 | array( |
225 | - 'name' => esc_html__( 'Base Country', 'give' ), |
|
226 | - 'desc' => esc_html__( 'The country your site operates from.', 'give' ), |
|
225 | + 'name' => esc_html__('Base Country', 'give'), |
|
226 | + 'desc' => esc_html__('The country your site operates from.', 'give'), |
|
227 | 227 | 'id' => 'base_country', |
228 | 228 | 'type' => 'select', |
229 | 229 | 'options' => give_get_country_list(), |
230 | 230 | ), |
231 | 231 | array( |
232 | - 'name' => esc_html__( 'Default State/Province', 'give' ), |
|
233 | - 'desc' => esc_html__( 'The state/province your site operates from.', 'give' ), |
|
232 | + 'name' => esc_html__('Default State/Province', 'give'), |
|
233 | + 'desc' => esc_html__('The state/province your site operates from.', 'give'), |
|
234 | 234 | 'id' => 'base_state', |
235 | 235 | 'type' => 'select', |
236 | - 'options' => give_states_list()[ get_option( 'give_settings' )['base_country'] ], |
|
236 | + 'options' => give_states_list()[get_option('give_settings')['base_country']], |
|
237 | 237 | ), |
238 | 238 | array( |
239 | - 'name' => esc_html__( 'General Options Docs Link', 'give' ), |
|
239 | + 'name' => esc_html__('General Options Docs Link', 'give'), |
|
240 | 240 | 'id' => 'general_options_docs_link', |
241 | - 'url' => esc_url( 'http://docs.givewp.com/settings-general' ), |
|
242 | - 'title' => __( 'General Options', 'give' ), |
|
241 | + 'url' => esc_url('http://docs.givewp.com/settings-general'), |
|
242 | + 'title' => __('General Options', 'give'), |
|
243 | 243 | 'type' => 'give_docs_link', |
244 | 244 | ), |
245 | 245 | array( |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | * Filter the general settings. |
255 | 255 | * Backward compatibility: Please do not use this filter. This filter is deprecated in 1.8 |
256 | 256 | */ |
257 | - $settings = apply_filters( 'give_settings_general', $settings ); |
|
257 | + $settings = apply_filters('give_settings_general', $settings); |
|
258 | 258 | |
259 | 259 | /** |
260 | 260 | * Filter the settings. |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @param array $settings |
265 | 265 | */ |
266 | - $settings = apply_filters( 'give_get_settings_' . $this->id, $settings ); |
|
266 | + $settings = apply_filters('give_get_settings_'.$this->id, $settings); |
|
267 | 267 | |
268 | 268 | // Output. |
269 | 269 | return $settings; |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | */ |
278 | 278 | public function get_sections() { |
279 | 279 | $sections = array( |
280 | - 'general-settings' => esc_html__( 'General', 'give' ), |
|
281 | - 'currency-settings' => esc_html__( 'Currency', 'give' ), |
|
282 | - 'access-control' => esc_html__( 'Access Control', 'give' ) |
|
280 | + 'general-settings' => esc_html__('General', 'give'), |
|
281 | + 'currency-settings' => esc_html__('Currency', 'give'), |
|
282 | + 'access-control' => esc_html__('Access Control', 'give') |
|
283 | 283 | ); |
284 | 284 | |
285 | - return apply_filters( 'give_get_sections_' . $this->id, $sections ); |
|
285 | + return apply_filters('give_get_sections_'.$this->id, $sections); |
|
286 | 286 | } |
287 | 287 | } |
288 | 288 |