@@ -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 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | */ |
23 | 23 | function give_get_logs_tab() { |
24 | 24 | |
25 | - require( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/logs.php' ); |
|
25 | + require(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/logs.php'); |
|
26 | 26 | |
27 | 27 | // Get current section. |
28 | 28 | $current_section = $_GET['section'] = give_get_current_setting_section(); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @since 1.0 |
34 | 34 | */ |
35 | - do_action( "give_logs_view_{$current_section}" ); |
|
35 | + do_action("give_logs_view_{$current_section}"); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | function give_logs_view_sales() { |
48 | 48 | |
49 | - include GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
49 | + include GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-sales-logs-list-table.php'; |
|
50 | 50 | |
51 | 51 | $logs_table = new Give_Sales_Log_Table(); |
52 | 52 | $logs_table->prepare_items(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | -add_action( 'give_logs_view_sales', 'give_logs_view_sales' ); |
|
57 | +add_action('give_logs_view_sales', 'give_logs_view_sales'); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | /** |
@@ -66,14 +66,14 @@ discard block |
||
66 | 66 | * @return void |
67 | 67 | */ |
68 | 68 | function give_logs_view_gateway_errors() { |
69 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-gateway-error-logs-list-table.php' ); |
|
69 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-gateway-error-logs-list-table.php'); |
|
70 | 70 | |
71 | 71 | $logs_table = new Give_Gateway_Error_Log_Table(); |
72 | 72 | $logs_table->prepare_items(); |
73 | 73 | $logs_table->display(); |
74 | 74 | } |
75 | 75 | |
76 | -add_action( 'give_logs_view_gateway_errors', 'give_logs_view_gateway_errors' ); |
|
76 | +add_action('give_logs_view_gateway_errors', 'give_logs_view_gateway_errors'); |
|
77 | 77 | |
78 | 78 | /** |
79 | 79 | * API Request Logs |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * @return void |
86 | 86 | */ |
87 | 87 | function give_logs_view_api_requests() { |
88 | - include( GIVE_PLUGIN_DIR . 'includes/admin/tools/logs/class-api-requests-logs-list-table.php' ); |
|
88 | + include(GIVE_PLUGIN_DIR.'includes/admin/tools/logs/class-api-requests-logs-list-table.php'); |
|
89 | 89 | |
90 | 90 | $logs_table = new Give_API_Request_Log_Table(); |
91 | 91 | $logs_table->prepare_items(); |
@@ -98,12 +98,12 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @since 1.0 |
100 | 100 | */ |
101 | - do_action( 'give_logs_api_requests_top' ); |
|
101 | + do_action('give_logs_api_requests_top'); |
|
102 | 102 | ?> |
103 | 103 | |
104 | 104 | <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs'; ?>"> |
105 | 105 | <?php |
106 | - $logs_table->search_box( esc_html__( 'Search', 'give' ), 'give-api-requests' ); |
|
106 | + $logs_table->search_box(esc_html__('Search', 'give'), 'give-api-requests'); |
|
107 | 107 | $logs_table->display(); |
108 | 108 | ?> |
109 | 109 | <input type="hidden" name="post_type" value="give_forms"/> |
@@ -116,14 +116,14 @@ discard block |
||
116 | 116 | * |
117 | 117 | * @since 1.0 |
118 | 118 | */ |
119 | - do_action( 'give_logs_api_requests_bottom' ); |
|
119 | + do_action('give_logs_api_requests_bottom'); |
|
120 | 120 | ?> |
121 | 121 | |
122 | 122 | </div> |
123 | 123 | <?php |
124 | 124 | } |
125 | 125 | |
126 | -add_action( 'give_logs_view_api_requests', 'give_logs_view_api_requests' ); |
|
126 | +add_action('give_logs_view_api_requests', 'give_logs_view_api_requests'); |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Renders the log views drop down. |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | $current_section = give_get_current_setting_section(); |
136 | 136 | |
137 | 137 | // If there are not any event attach to action then do not show form. |
138 | - if ( ! has_action( 'give_log_view_actions' ) ) { |
|
138 | + if ( ! has_action('give_log_view_actions')) { |
|
139 | 139 | return; |
140 | 140 | } |
141 | 141 | ?> |
142 | - <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion=' . $current_section; ?>"> |
|
142 | + <form id="give-logs-filter" method="get" action="<?php echo 'edit.php?post_type=give_forms&page=give-tools&tab=logs§ion='.$current_section; ?>"> |
|
143 | 143 | <?php |
144 | 144 | /** |
145 | 145 | * Fires after displaying the reports page views drop down. |
@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | * |
149 | 149 | * @since 1.0 |
150 | 150 | */ |
151 | - do_action( 'give_log_view_actions' ); |
|
151 | + do_action('give_log_view_actions'); |
|
152 | 152 | ?> |
153 | 153 | |
154 | 154 | <input type="hidden" name="post_type" value="give_forms"/> |
155 | 155 | <input type="hidden" name="page" value="give-tools"/> |
156 | 156 | <input type="hidden" name="tab" value="logs"/> |
157 | 157 | |
158 | - <?php submit_button( esc_html__( 'Apply', 'give' ), 'secondary', 'submit', false ); ?> |
|
158 | + <?php submit_button(esc_html__('Apply', 'give'), 'secondary', 'submit', false); ?> |
|
159 | 159 | </form> |
160 | 160 | <?php |
161 | 161 | } |
162 | 162 | \ No newline at end of file |
@@ -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 | |
@@ -55,22 +55,22 @@ discard block |
||
55 | 55 | public function get_data() { |
56 | 56 | global $wpdb; |
57 | 57 | |
58 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids' ); |
|
58 | + $items = $this->get_stored_data('give_temp_delete_test_ids'); |
|
59 | 59 | |
60 | - if ( ! is_array( $items ) ) { |
|
60 | + if ( ! is_array($items)) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
64 | - $offset = ( $this->step - 1 ) * $this->per_step; |
|
65 | - $step_items = array_slice( $items, $offset, $this->per_step ); |
|
64 | + $offset = ($this->step - 1) * $this->per_step; |
|
65 | + $step_items = array_slice($items, $offset, $this->per_step); |
|
66 | 66 | |
67 | - if ( $step_items ) { |
|
67 | + if ($step_items) { |
|
68 | 68 | |
69 | 69 | $step_ids = array( |
70 | 70 | 'other' => array(), |
71 | 71 | ); |
72 | 72 | |
73 | - foreach ( $step_items as $item ) { |
|
73 | + foreach ($step_items as $item) { |
|
74 | 74 | |
75 | 75 | $step_ids['other'][] = $item['id']; |
76 | 76 | |
@@ -78,15 +78,15 @@ discard block |
||
78 | 78 | |
79 | 79 | $sql = array(); |
80 | 80 | |
81 | - foreach ( $step_ids as $type => $ids ) { |
|
81 | + foreach ($step_ids as $type => $ids) { |
|
82 | 82 | |
83 | - if ( empty( $ids ) ) { |
|
83 | + if (empty($ids)) { |
|
84 | 84 | continue; |
85 | 85 | } |
86 | 86 | |
87 | - $ids = implode( ',', $ids ); |
|
87 | + $ids = implode(',', $ids); |
|
88 | 88 | |
89 | - switch ( $type ) { |
|
89 | + switch ($type) { |
|
90 | 90 | case 'other': |
91 | 91 | $sql[] = "DELETE FROM $wpdb->posts WHERE id IN ($ids)"; |
92 | 92 | $sql[] = "DELETE FROM $wpdb->postmeta WHERE post_id IN ($ids)"; |
@@ -97,9 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | } |
99 | 99 | |
100 | - if ( ! empty( $sql ) ) { |
|
101 | - foreach ( $sql as $query ) { |
|
102 | - $wpdb->query( $query ); |
|
100 | + if ( ! empty($sql)) { |
|
101 | + foreach ($sql as $query) { |
|
102 | + $wpdb->query($query); |
|
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
@@ -119,16 +119,16 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function get_percentage_complete() { |
121 | 121 | |
122 | - $items = $this->get_stored_data( 'give_temp_delete_test_ids', false ); |
|
123 | - $total = count( $items ); |
|
122 | + $items = $this->get_stored_data('give_temp_delete_test_ids', false); |
|
123 | + $total = count($items); |
|
124 | 124 | |
125 | 125 | $percentage = 100; |
126 | 126 | |
127 | - if ( $total > 0 ) { |
|
128 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
127 | + if ($total > 0) { |
|
128 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
129 | 129 | } |
130 | 130 | |
131 | - if ( $percentage > 100 ) { |
|
131 | + if ($percentage > 100) { |
|
132 | 132 | $percentage = 100; |
133 | 133 | } |
134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @param array $request The Form Data passed into the batch processing |
144 | 144 | */ |
145 | - public function set_properties( $request ) { |
|
145 | + public function set_properties($request) { |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -153,29 +153,29 @@ discard block |
||
153 | 153 | */ |
154 | 154 | public function process_step() { |
155 | 155 | |
156 | - if ( ! $this->can_export() ) { |
|
157 | - wp_die( __( 'You do not have permission to delete test transactions.', 'give' ), __( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
156 | + if ( ! $this->can_export()) { |
|
157 | + wp_die(__('You do not have permission to delete test transactions.', 'give'), __('Error', 'give'), array('response' => 403)); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $had_data = $this->get_data(); |
161 | 161 | |
162 | - if ( $had_data ) { |
|
162 | + if ($had_data) { |
|
163 | 163 | $this->done = false; |
164 | 164 | |
165 | 165 | return true; |
166 | 166 | } else { |
167 | - update_option( 'give_earnings_total', give_get_total_earnings( true ) ); |
|
168 | - Give_Cache::delete( Give_Cache::get_key('give_estimated_monthly_stats' ) ); |
|
167 | + update_option('give_earnings_total', give_get_total_earnings(true)); |
|
168 | + Give_Cache::delete(Give_Cache::get_key('give_estimated_monthly_stats')); |
|
169 | 169 | |
170 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
170 | + $this->delete_data('give_temp_delete_test_ids'); |
|
171 | 171 | |
172 | 172 | // Reset the sequential order numbers |
173 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
174 | - delete_option( 'give_last_payment_number' ); |
|
173 | + if (give_get_option('enable_sequential')) { |
|
174 | + delete_option('give_last_payment_number'); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | $this->done = true; |
178 | - $this->message = __( 'Test transactions successfully deleted.', 'give' ); |
|
178 | + $this->message = __('Test transactions successfully deleted.', 'give'); |
|
179 | 179 | |
180 | 180 | return false; |
181 | 181 | } |
@@ -185,10 +185,10 @@ discard block |
||
185 | 185 | * Headers |
186 | 186 | */ |
187 | 187 | public function headers() { |
188 | - ignore_user_abort( true ); |
|
188 | + ignore_user_abort(true); |
|
189 | 189 | |
190 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
191 | - set_time_limit( 0 ); |
|
190 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
191 | + set_time_limit(0); |
|
192 | 192 | } |
193 | 193 | } |
194 | 194 | |
@@ -212,26 +212,26 @@ discard block |
||
212 | 212 | */ |
213 | 213 | public function pre_fetch() { |
214 | 214 | |
215 | - if ( $this->step == 1 ) { |
|
216 | - $this->delete_data( 'give_temp_delete_test_ids' ); |
|
215 | + if ($this->step == 1) { |
|
216 | + $this->delete_data('give_temp_delete_test_ids'); |
|
217 | 217 | } |
218 | 218 | |
219 | - $items = get_option( 'give_temp_delete_test_ids', false ); |
|
219 | + $items = get_option('give_temp_delete_test_ids', false); |
|
220 | 220 | |
221 | - if ( false === $items ) { |
|
221 | + if (false === $items) { |
|
222 | 222 | $items = array(); |
223 | 223 | |
224 | - $args = apply_filters( 'give_tools_reset_stats_total_args', array( |
|
224 | + $args = apply_filters('give_tools_reset_stats_total_args', array( |
|
225 | 225 | 'post_type' => 'give_payment', |
226 | 226 | 'post_status' => 'any', |
227 | - 'posts_per_page' => - 1, |
|
227 | + 'posts_per_page' => -1, |
|
228 | 228 | // ONLY TEST MODE TRANSACTIONS!!! |
229 | 229 | 'meta_key' => '_give_payment_mode', |
230 | 230 | 'meta_value' => 'test' |
231 | - ) ); |
|
231 | + )); |
|
232 | 232 | |
233 | - $posts = get_posts( $args ); |
|
234 | - foreach ( $posts as $post ) { |
|
233 | + $posts = get_posts($args); |
|
234 | + foreach ($posts as $post) { |
|
235 | 235 | $items[] = array( |
236 | 236 | 'id' => (int) $post->ID, |
237 | 237 | 'type' => $post->post_type, |
@@ -240,9 +240,9 @@ discard block |
||
240 | 240 | |
241 | 241 | // Allow filtering of items to remove with an unassociative array for each item. |
242 | 242 | // The array contains the unique ID of the item, and a 'type' for you to use in the execution of the get_data method. |
243 | - $items = apply_filters( 'give_delete_test_items', $items ); |
|
243 | + $items = apply_filters('give_delete_test_items', $items); |
|
244 | 244 | |
245 | - $this->store_data( 'give_temp_delete_test_ids', $items ); |
|
245 | + $this->store_data('give_temp_delete_test_ids', $items); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | } |
@@ -256,11 +256,11 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @return mixed Returns the data from the database |
258 | 258 | */ |
259 | - private function get_stored_data( $key ) { |
|
259 | + private function get_stored_data($key) { |
|
260 | 260 | global $wpdb; |
261 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
261 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
262 | 262 | |
263 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
263 | + return empty($value) ? false : maybe_unserialize($value); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * |
274 | 274 | * @return void |
275 | 275 | */ |
276 | - private function store_data( $key, $value ) { |
|
276 | + private function store_data($key, $value) { |
|
277 | 277 | global $wpdb; |
278 | 278 | |
279 | - $value = maybe_serialize( $value ); |
|
279 | + $value = maybe_serialize($value); |
|
280 | 280 | |
281 | 281 | $data = array( |
282 | 282 | 'option_name' => $key, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | '%s', |
291 | 291 | ); |
292 | 292 | |
293 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
293 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | /** |
@@ -302,9 +302,9 @@ discard block |
||
302 | 302 | * |
303 | 303 | * @return void |
304 | 304 | */ |
305 | - private function delete_data( $key ) { |
|
305 | + private function delete_data($key) { |
|
306 | 306 | global $wpdb; |
307 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
307 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | } |
@@ -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 | |
@@ -53,49 +53,49 @@ discard block |
||
53 | 53 | */ |
54 | 54 | public function get_data() { |
55 | 55 | |
56 | - if ( $this->step == 1 ) { |
|
57 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
56 | + if ($this->step == 1) { |
|
57 | + $this->delete_data('give_temp_recount_earnings'); |
|
58 | 58 | } |
59 | 59 | |
60 | - $total = get_option( 'give_temp_recount_earnings', false ); |
|
60 | + $total = get_option('give_temp_recount_earnings', false); |
|
61 | 61 | |
62 | - if ( false === $total ) { |
|
62 | + if (false === $total) { |
|
63 | 63 | $total = (float) 0; |
64 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
64 | + $this->store_data('give_temp_recount_earnings', $total); |
|
65 | 65 | } |
66 | 66 | |
67 | - $accepted_statuses = apply_filters( 'give_recount_accepted_statuses', array( 'publish' ) ); |
|
67 | + $accepted_statuses = apply_filters('give_recount_accepted_statuses', array('publish')); |
|
68 | 68 | |
69 | - $args = apply_filters( 'give_recount_earnings_args', array( |
|
69 | + $args = apply_filters('give_recount_earnings_args', array( |
|
70 | 70 | 'number' => $this->per_step, |
71 | 71 | 'page' => $this->step, |
72 | 72 | 'status' => $accepted_statuses, |
73 | 73 | 'fields' => 'ids' |
74 | - ) ); |
|
74 | + )); |
|
75 | 75 | |
76 | - $payments = give_get_payments( $args ); |
|
76 | + $payments = give_get_payments($args); |
|
77 | 77 | |
78 | - if ( ! empty( $payments ) ) { |
|
78 | + if ( ! empty($payments)) { |
|
79 | 79 | |
80 | - foreach ( $payments as $payment ) { |
|
80 | + foreach ($payments as $payment) { |
|
81 | 81 | |
82 | - $total += give_get_payment_amount( $payment ); |
|
82 | + $total += give_get_payment_amount($payment); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
86 | - if ( $total < 0 ) { |
|
86 | + if ($total < 0) { |
|
87 | 87 | $totals = 0; |
88 | 88 | } |
89 | 89 | |
90 | - $total = round( $total, give_currency_decimal_filter() ); |
|
90 | + $total = round($total, give_currency_decimal_filter()); |
|
91 | 91 | |
92 | - $this->store_data( 'give_temp_recount_earnings', $total ); |
|
92 | + $this->store_data('give_temp_recount_earnings', $total); |
|
93 | 93 | |
94 | 94 | return true; |
95 | 95 | |
96 | 96 | } |
97 | 97 | |
98 | - update_option( 'give_earnings_total', $total ); |
|
98 | + update_option('give_earnings_total', $total); |
|
99 | 99 | |
100 | 100 | return false; |
101 | 101 | |
@@ -109,25 +109,25 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function get_percentage_complete() { |
111 | 111 | |
112 | - $total = $this->get_stored_data( 'give_recount_earnings_total' ); |
|
112 | + $total = $this->get_stored_data('give_recount_earnings_total'); |
|
113 | 113 | |
114 | - if ( false === $total ) { |
|
115 | - $args = apply_filters( 'give_recount_earnings_total_args', array() ); |
|
114 | + if (false === $total) { |
|
115 | + $args = apply_filters('give_recount_earnings_total_args', array()); |
|
116 | 116 | |
117 | - $counts = give_count_payments( $args ); |
|
118 | - $total = absint( $counts->publish ); |
|
119 | - $total = apply_filters( 'give_recount_store_earnings_total', $total ); |
|
117 | + $counts = give_count_payments($args); |
|
118 | + $total = absint($counts->publish); |
|
119 | + $total = apply_filters('give_recount_store_earnings_total', $total); |
|
120 | 120 | |
121 | - $this->store_data( 'give_recount_earnings_total', $total ); |
|
121 | + $this->store_data('give_recount_earnings_total', $total); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | $percentage = 100; |
125 | 125 | |
126 | - if ( $total > 0 ) { |
|
127 | - $percentage = ( ( $this->per_step * $this->step ) / $total ) * 100; |
|
126 | + if ($total > 0) { |
|
127 | + $percentage = (($this->per_step * $this->step) / $total) * 100; |
|
128 | 128 | } |
129 | 129 | |
130 | - if ( $percentage > 100 ) { |
|
130 | + if ($percentage > 100) { |
|
131 | 131 | $percentage = 100; |
132 | 132 | } |
133 | 133 | |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @param array $request The Form Data passed into the batch processing |
143 | 143 | */ |
144 | - public function set_properties( $request ) { |
|
144 | + public function set_properties($request) { |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
@@ -152,31 +152,31 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function process_step() { |
154 | 154 | |
155 | - if ( ! $this->can_export() ) { |
|
156 | - wp_die( esc_html__( 'You do not have permission to recount stats.', 'give' ), esc_html__( 'Error', 'give' ), array( 'response' => 403 ) ); |
|
155 | + if ( ! $this->can_export()) { |
|
156 | + wp_die(esc_html__('You do not have permission to recount stats.', 'give'), esc_html__('Error', 'give'), array('response' => 403)); |
|
157 | 157 | } |
158 | 158 | |
159 | 159 | $had_data = $this->get_data(); |
160 | 160 | |
161 | - if ( $had_data ) { |
|
161 | + if ($had_data) { |
|
162 | 162 | $this->done = false; |
163 | 163 | |
164 | 164 | return true; |
165 | 165 | } else { |
166 | - $this->delete_data( 'give_recount_earnings_total' ); |
|
167 | - $this->delete_data( 'give_temp_recount_earnings' ); |
|
166 | + $this->delete_data('give_recount_earnings_total'); |
|
167 | + $this->delete_data('give_temp_recount_earnings'); |
|
168 | 168 | $this->done = true; |
169 | - $this->message = esc_html__( 'Income stats have been successfully recounted.', 'give' ); |
|
169 | + $this->message = esc_html__('Income stats have been successfully recounted.', 'give'); |
|
170 | 170 | |
171 | 171 | return false; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | 175 | public function headers() { |
176 | - ignore_user_abort( true ); |
|
176 | + ignore_user_abort(true); |
|
177 | 177 | |
178 | - if ( ! give_is_func_disabled( 'set_time_limit' ) && ! ini_get( 'safe_mode' ) ) { |
|
179 | - set_time_limit( 0 ); |
|
178 | + if ( ! give_is_func_disabled('set_time_limit') && ! ini_get('safe_mode')) { |
|
179 | + set_time_limit(0); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | * |
205 | 205 | * @return mixed Returns the data from the database |
206 | 206 | */ |
207 | - private function get_stored_data( $key ) { |
|
207 | + private function get_stored_data($key) { |
|
208 | 208 | global $wpdb; |
209 | - $value = $wpdb->get_var( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key ) ); |
|
209 | + $value = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = '%s'", $key)); |
|
210 | 210 | |
211 | - return empty( $value ) ? false : maybe_unserialize( $value ); |
|
211 | + return empty($value) ? false : maybe_unserialize($value); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -221,10 +221,10 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @return void |
223 | 223 | */ |
224 | - private function store_data( $key, $value ) { |
|
224 | + private function store_data($key, $value) { |
|
225 | 225 | global $wpdb; |
226 | 226 | |
227 | - $value = maybe_serialize( $value ); |
|
227 | + $value = maybe_serialize($value); |
|
228 | 228 | |
229 | 229 | $data = array( |
230 | 230 | 'option_name' => $key, |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | '%s', |
239 | 239 | ); |
240 | 240 | |
241 | - $wpdb->replace( $wpdb->options, $data, $formats ); |
|
241 | + $wpdb->replace($wpdb->options, $data, $formats); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,9 +250,9 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return void |
252 | 252 | */ |
253 | - private function delete_data( $key ) { |
|
253 | + private function delete_data($key) { |
|
254 | 254 | global $wpdb; |
255 | - $wpdb->delete( $wpdb->options, array( 'option_name' => $key ) ); |
|
255 | + $wpdb->delete($wpdb->options, array('option_name' => $key)); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | } |
@@ -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_Export' ) ) : |
|
16 | +if ( ! class_exists('Give_Settings_Export')) : |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Give_Settings_Export. |
@@ -43,16 +43,16 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function __construct() { |
45 | 45 | $this->id = 'export'; |
46 | - $this->label = __( 'Export', 'give' ); |
|
46 | + $this->label = __('Export', 'give'); |
|
47 | 47 | |
48 | - add_filter( 'give-tools_tabs_array', array( $this, 'add_settings_page' ), 20 ); |
|
49 | - add_action( "give-tools_settings_{$this->id}_page", array( $this, 'output' ) ); |
|
50 | - add_action( 'give_admin_field_tools_export', array( $this, 'render_export_field' ), 10, 2 ); |
|
48 | + add_filter('give-tools_tabs_array', array($this, 'add_settings_page'), 20); |
|
49 | + add_action("give-tools_settings_{$this->id}_page", array($this, 'output')); |
|
50 | + add_action('give_admin_field_tools_export', array($this, 'render_export_field'), 10, 2); |
|
51 | 51 | |
52 | 52 | // Do not use main donor for this tab. |
53 | - if( give_get_current_setting_tab() === $this->id ) { |
|
54 | - add_action( 'give-tools_open_form', '__return_empty_string' ); |
|
55 | - add_action( 'give-tools_close_form', '__return_empty_string' ); |
|
53 | + if (give_get_current_setting_tab() === $this->id) { |
|
54 | + add_action('give-tools_open_form', '__return_empty_string'); |
|
55 | + add_action('give-tools_close_form', '__return_empty_string'); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | * @param array $pages Lst of pages. |
64 | 64 | * @return array |
65 | 65 | */ |
66 | - public function add_settings_page( $pages ) { |
|
67 | - $pages[ $this->id ] = $this->label; |
|
66 | + public function add_settings_page($pages) { |
|
67 | + $pages[$this->id] = $this->label; |
|
68 | 68 | |
69 | 69 | return $pages; |
70 | 70 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param array $settings |
87 | 87 | */ |
88 | 88 | $settings = apply_filters( |
89 | - 'give_get_settings_' . $this->id, |
|
89 | + 'give_get_settings_'.$this->id, |
|
90 | 90 | array( |
91 | 91 | array( |
92 | 92 | 'id' => 'give_tools_export', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ), |
96 | 96 | array( |
97 | 97 | 'id' => 'export', |
98 | - 'name' => __( 'Export', 'give' ), |
|
98 | + 'name' => __('Export', 'give'), |
|
99 | 99 | 'type' => 'tools_export', |
100 | 100 | ), |
101 | 101 | array( |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function output() { |
120 | 120 | $settings = $this->get_settings(); |
121 | 121 | |
122 | - Give_Admin_Settings::output_fields( $settings, 'give_settings' ); |
|
122 | + Give_Admin_Settings::output_fields($settings, 'give_settings'); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param $field |
132 | 132 | * @param $option_value |
133 | 133 | */ |
134 | - public function render_export_field( $field, $option_value ) { |
|
135 | - include_once( 'views/html-admin-page-exports.php' ); |
|
134 | + public function render_export_field($field, $option_value) { |
|
135 | + include_once('views/html-admin-page-exports.php'); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 |
@@ -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 | |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | * @return mixed |
24 | 24 | */ |
25 | 25 | function give_get_price_decimals() { |
26 | - return apply_filters( 'give_sanitize_amount_decimals', give_get_option( 'number_decimals', 0 ) ); |
|
26 | + return apply_filters('give_sanitize_amount_decimals', give_get_option('number_decimals', 0)); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @return mixed |
35 | 35 | */ |
36 | 36 | function give_get_price_thousand_separator() { |
37 | - return give_get_option( 'thousands_separator', ',' ); |
|
37 | + return give_get_option('thousands_separator', ','); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return mixed |
46 | 46 | */ |
47 | 47 | function give_get_price_decimal_separator() { |
48 | - return give_get_option( 'decimal_separator', '.' ); |
|
48 | + return give_get_option('decimal_separator', '.'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -61,67 +61,67 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return string $amount Newly sanitized amount |
63 | 63 | */ |
64 | -function give_sanitize_amount( $number, $dp = false, $trim_zeros = false ) { |
|
64 | +function give_sanitize_amount($number, $dp = false, $trim_zeros = false) { |
|
65 | 65 | |
66 | 66 | // Bailout. |
67 | - if ( empty( $number ) ) { |
|
67 | + if (empty($number)) { |
|
68 | 68 | return $number; |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Remove slash from amount. |
72 | 72 | // If thousand or decimal separator is set to ' then in $_POST or $_GET param we will get an escaped number. |
73 | 73 | // To prevent notices and warning remove slash from amount/number. |
74 | - $number = wp_unslash( $number ); |
|
74 | + $number = wp_unslash($number); |
|
75 | 75 | |
76 | 76 | $thousand_separator = give_get_price_thousand_separator(); |
77 | 77 | |
78 | 78 | $locale = localeconv(); |
79 | - $decimals = array( give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point'] ); |
|
79 | + $decimals = array(give_get_price_decimal_separator(), $locale['decimal_point'], $locale['mon_decimal_point']); |
|
80 | 80 | |
81 | 81 | // Remove locale from string |
82 | - if ( ! is_float( $number ) ) { |
|
83 | - $number = str_replace( $decimals, '.', $number ); |
|
82 | + if ( ! is_float($number)) { |
|
83 | + $number = str_replace($decimals, '.', $number); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // Remove thousand amount formatting if amount has. |
87 | 87 | // This condition use to add backward compatibility to version before 1.6, because before version 1.6 we were saving formatted amount to db. |
88 | 88 | // Do not replace thousand separator from price if it is same as decimal separator, because it will be already replace by above code. |
89 | - if ( ! in_array( $thousand_separator, $decimals ) && ( false !== strpos( $number, $thousand_separator ) ) ) { |
|
90 | - $number = str_replace( $thousand_separator, '', $number ); |
|
91 | - } elseif ( in_array( $thousand_separator, $decimals ) ) { |
|
92 | - $number = preg_replace( '/\.(?=.*\.)/', '', $number ); |
|
89 | + if ( ! in_array($thousand_separator, $decimals) && (false !== strpos($number, $thousand_separator))) { |
|
90 | + $number = str_replace($thousand_separator, '', $number); |
|
91 | + } elseif (in_array($thousand_separator, $decimals)) { |
|
92 | + $number = preg_replace('/\.(?=.*\.)/', '', $number); |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // Remove non numeric entity before decimal separator. |
96 | - $number = preg_replace( '/[^0-9\.]/', '', $number ); |
|
96 | + $number = preg_replace('/[^0-9\.]/', '', $number); |
|
97 | 97 | $default_dp = give_get_price_decimals(); |
98 | 98 | |
99 | 99 | // Reset negative amount to zero. |
100 | - if ( 0 > $number ) { |
|
101 | - $number = number_format( 0, $default_dp, '.' ); |
|
100 | + if (0 > $number) { |
|
101 | + $number = number_format(0, $default_dp, '.'); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // If number does not have decimal then add number of decimals to it. |
105 | 105 | if ( |
106 | - false === strpos( $number, '.' ) |
|
107 | - || ( $default_dp > strlen( substr( $number, strpos( $number, '.' ) + 1 ) ) ) |
|
106 | + false === strpos($number, '.') |
|
107 | + || ($default_dp > strlen(substr($number, strpos($number, '.') + 1))) |
|
108 | 108 | ) { |
109 | - $number = number_format( $number, $default_dp, '.', '' ); |
|
109 | + $number = number_format($number, $default_dp, '.', ''); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | // Format number by custom number of decimals. |
113 | - if ( false !== $dp ) { |
|
114 | - $dp = intval( is_bool( $dp ) ? $default_dp : $dp ); |
|
115 | - $dp = apply_filters( 'give_sanitize_amount_decimals', $dp, $number ); |
|
116 | - $number = number_format( floatval( $number ), $dp, '.', '' ); |
|
113 | + if (false !== $dp) { |
|
114 | + $dp = intval(is_bool($dp) ? $default_dp : $dp); |
|
115 | + $dp = apply_filters('give_sanitize_amount_decimals', $dp, $number); |
|
116 | + $number = number_format(floatval($number), $dp, '.', ''); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // Trim zeros. |
120 | - if ( $trim_zeros && strstr( $number, '.' ) ) { |
|
121 | - $number = rtrim( rtrim( $number, '0' ), '.' ); |
|
120 | + if ($trim_zeros && strstr($number, '.')) { |
|
121 | + $number = rtrim(rtrim($number, '0'), '.'); |
|
122 | 122 | } |
123 | 123 | |
124 | - return apply_filters( 'give_sanitize_amount', $number ); |
|
124 | + return apply_filters('give_sanitize_amount', $number); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | /** |
@@ -134,22 +134,22 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @return string $amount Newly formatted amount or Price Not Available |
136 | 136 | */ |
137 | -function give_format_amount( $amount, $decimals = true ) { |
|
138 | - $thousands_sep = give_get_option( 'thousands_separator', ',' ); |
|
139 | - $decimal_sep = give_get_option( 'decimal_separator', '.' ); |
|
137 | +function give_format_amount($amount, $decimals = true) { |
|
138 | + $thousands_sep = give_get_option('thousands_separator', ','); |
|
139 | + $decimal_sep = give_get_option('decimal_separator', '.'); |
|
140 | 140 | |
141 | - if ( empty( $amount ) ) { |
|
141 | + if (empty($amount)) { |
|
142 | 142 | $amount = 0; |
143 | 143 | } else { |
144 | 144 | // Sanitize amount before formatting. |
145 | - $amount = give_sanitize_amount( $amount ); |
|
145 | + $amount = give_sanitize_amount($amount); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | $decimals = $decimals ? give_get_price_decimals() : 0; |
149 | 149 | |
150 | - $formatted = number_format( $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
150 | + $formatted = number_format($amount, $decimals, $decimal_sep, $thousands_sep); |
|
151 | 151 | |
152 | - return apply_filters( 'give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep ); |
|
152 | + return apply_filters('give_format_amount', $formatted, $amount, $decimals, $decimal_sep, $thousands_sep); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | |
@@ -166,33 +166,33 @@ discard block |
||
166 | 166 | * |
167 | 167 | * @return float|string formatted amount number with large number names. |
168 | 168 | */ |
169 | -function give_human_format_large_amount( $amount ) { |
|
169 | +function give_human_format_large_amount($amount) { |
|
170 | 170 | |
171 | 171 | // Get thousand separator. |
172 | 172 | $thousands_sep = give_get_price_thousand_separator(); |
173 | 173 | |
174 | 174 | // Sanitize amount. |
175 | - $sanitize_amount = give_sanitize_amount( $amount ); |
|
175 | + $sanitize_amount = give_sanitize_amount($amount); |
|
176 | 176 | |
177 | 177 | // Explode amount to calculate name of large numbers. |
178 | - $amount_array = explode( $thousands_sep, $amount ); |
|
178 | + $amount_array = explode($thousands_sep, $amount); |
|
179 | 179 | |
180 | 180 | // Calculate amount parts count. |
181 | - $amount_count_parts = count( $amount_array ); |
|
181 | + $amount_count_parts = count($amount_array); |
|
182 | 182 | |
183 | 183 | // Human format amount (default). |
184 | 184 | $human_format_amount = $amount; |
185 | 185 | |
186 | 186 | // Calculate large number formatted amount. |
187 | - if ( 4 < $amount_count_parts ) { |
|
188 | - $human_format_amount = sprintf( esc_html__( '%s trillion', 'give' ), round( ( $sanitize_amount / 1000000000000 ), 2 ) ); |
|
189 | - } elseif ( 3 < $amount_count_parts ) { |
|
190 | - $human_format_amount = sprintf( esc_html__( '%s billion', 'give' ), round( ( $sanitize_amount / 1000000000 ), 2 ) ); |
|
191 | - } elseif ( 2 < $amount_count_parts ) { |
|
192 | - $human_format_amount = sprintf( esc_html__( '%s million', 'give' ), round( ( $sanitize_amount / 1000000 ), 2 ) ); |
|
187 | + if (4 < $amount_count_parts) { |
|
188 | + $human_format_amount = sprintf(esc_html__('%s trillion', 'give'), round(($sanitize_amount / 1000000000000), 2)); |
|
189 | + } elseif (3 < $amount_count_parts) { |
|
190 | + $human_format_amount = sprintf(esc_html__('%s billion', 'give'), round(($sanitize_amount / 1000000000), 2)); |
|
191 | + } elseif (2 < $amount_count_parts) { |
|
192 | + $human_format_amount = sprintf(esc_html__('%s million', 'give'), round(($sanitize_amount / 1000000), 2)); |
|
193 | 193 | } |
194 | 194 | |
195 | - return apply_filters( 'give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount ); |
|
195 | + return apply_filters('give_human_format_large_amount', $human_format_amount, $amount, $sanitize_amount); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | * |
206 | 206 | * @return string $amount Newly formatted amount or Price Not Available |
207 | 207 | */ |
208 | -function give_format_decimal( $amount, $dp = false ) { |
|
208 | +function give_format_decimal($amount, $dp = false) { |
|
209 | 209 | $decimal_separator = give_get_price_decimal_separator(); |
210 | - $formatted_amount = give_sanitize_amount( $amount, $dp ); |
|
210 | + $formatted_amount = give_sanitize_amount($amount, $dp); |
|
211 | 211 | |
212 | - if ( false !== strpos( $formatted_amount, '.' ) ) { |
|
213 | - $formatted_amount = str_replace( '.', $decimal_separator, $formatted_amount ); |
|
212 | + if (false !== strpos($formatted_amount, '.')) { |
|
213 | + $formatted_amount = str_replace('.', $decimal_separator, $formatted_amount); |
|
214 | 214 | } |
215 | 215 | |
216 | - return apply_filters( 'give_format_decimal', $formatted_amount, $amount, $decimal_separator ); |
|
216 | + return apply_filters('give_format_decimal', $formatted_amount, $amount, $decimal_separator); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -227,24 +227,24 @@ discard block |
||
227 | 227 | * |
228 | 228 | * @return mixed|string |
229 | 229 | */ |
230 | -function give_currency_filter( $price = '', $currency = '', $decode_currency = false ) { |
|
230 | +function give_currency_filter($price = '', $currency = '', $decode_currency = false) { |
|
231 | 231 | |
232 | - if ( empty( $currency ) ) { |
|
232 | + if (empty($currency)) { |
|
233 | 233 | $currency = give_get_currency(); |
234 | 234 | } |
235 | 235 | |
236 | - $position = give_get_option( 'currency_position', 'before' ); |
|
236 | + $position = give_get_option('currency_position', 'before'); |
|
237 | 237 | |
238 | 238 | $negative = $price < 0; |
239 | 239 | |
240 | - if ( $negative ) { |
|
240 | + if ($negative) { |
|
241 | 241 | // Remove proceeding "-". |
242 | - $price = substr( $price, 1 ); |
|
242 | + $price = substr($price, 1); |
|
243 | 243 | } |
244 | 244 | |
245 | - $symbol = give_currency_symbol( $currency, $decode_currency ); |
|
245 | + $symbol = give_currency_symbol($currency, $decode_currency); |
|
246 | 246 | |
247 | - switch ( $currency ) : |
|
247 | + switch ($currency) : |
|
248 | 248 | case 'GBP' : |
249 | 249 | case 'BRL' : |
250 | 250 | case 'EUR' : |
@@ -273,13 +273,13 @@ discard block |
||
273 | 273 | case 'MAD' : |
274 | 274 | case 'KRW' : |
275 | 275 | case 'ZAR' : |
276 | - $formatted = ( 'before' === $position ? $symbol . $price : $price . $symbol ); |
|
276 | + $formatted = ('before' === $position ? $symbol.$price : $price.$symbol); |
|
277 | 277 | break; |
278 | 278 | case 'NOK' : |
279 | - $formatted = ( 'before' === $position ? $symbol . ' ' . $price : $price . ' ' . $symbol ); |
|
279 | + $formatted = ('before' === $position ? $symbol.' '.$price : $price.' '.$symbol); |
|
280 | 280 | break; |
281 | 281 | default : |
282 | - $formatted = ( 'before' === $position ? $currency . ' ' . $price : $price . ' ' . $currency ); |
|
282 | + $formatted = ('before' === $position ? $currency.' '.$price : $price.' '.$currency); |
|
283 | 283 | break; |
284 | 284 | endswitch; |
285 | 285 | |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | * and if currency is USD and currency position is after then |
295 | 295 | * filter name will be give_usd_currency_filter_after |
296 | 296 | */ |
297 | - $formatted = apply_filters( 'give_' . strtolower( $currency ) . "_currency_filter_{$position}", $formatted, $currency, $price ); |
|
297 | + $formatted = apply_filters('give_'.strtolower($currency)."_currency_filter_{$position}", $formatted, $currency, $price); |
|
298 | 298 | |
299 | - if ( $negative ) { |
|
299 | + if ($negative) { |
|
300 | 300 | // Prepend the minus sign before the currency sign. |
301 | - $formatted = '-' . $formatted; |
|
301 | + $formatted = '-'.$formatted; |
|
302 | 302 | } |
303 | 303 | |
304 | 304 | return $formatted; |
@@ -314,21 +314,21 @@ discard block |
||
314 | 314 | */ |
315 | 315 | function give_currency_decimal_filter() { |
316 | 316 | |
317 | - remove_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
317 | + remove_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
318 | 318 | |
319 | 319 | // Set default number of decimals. |
320 | 320 | $decimals = give_get_price_decimals(); |
321 | 321 | |
322 | - add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
322 | + add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
323 | 323 | |
324 | 324 | // Get number of decimals with backward compatibility ( version < 1.6 ) |
325 | - if ( 1 <= func_num_args() ) { |
|
326 | - $decimals = ( false === func_get_arg( 0 ) ? $decimals : absint( func_get_arg( 0 ) ) ); |
|
325 | + if (1 <= func_num_args()) { |
|
326 | + $decimals = (false === func_get_arg(0) ? $decimals : absint(func_get_arg(0))); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | $currency = give_get_currency(); |
330 | 330 | |
331 | - switch ( $currency ) { |
|
331 | + switch ($currency) { |
|
332 | 332 | case 'RIAL' : |
333 | 333 | case 'JPY' : |
334 | 334 | case 'TWD' : |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | break; |
339 | 339 | } |
340 | 340 | |
341 | - return apply_filters( 'give_currency_decimal_count', $decimals, $currency ); |
|
341 | + return apply_filters('give_currency_decimal_count', $decimals, $currency); |
|
342 | 342 | } |
343 | 343 | |
344 | -add_filter( 'give_sanitize_amount_decimals', 'give_currency_decimal_filter' ); |
|
345 | -add_filter( 'give_format_amount_decimals', 'give_currency_decimal_filter' ); |
|
344 | +add_filter('give_sanitize_amount_decimals', 'give_currency_decimal_filter'); |
|
345 | +add_filter('give_format_amount_decimals', 'give_currency_decimal_filter'); |
|
346 | 346 | |
347 | 347 | |
348 | 348 | /** |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @return string Date format string |
356 | 356 | */ |
357 | -function give_date_format( $date_context = '' ) { |
|
357 | +function give_date_format($date_context = '') { |
|
358 | 358 | /** |
359 | 359 | * Filter the date context |
360 | 360 | * |
@@ -375,19 +375,19 @@ discard block |
||
375 | 375 | * |
376 | 376 | * } |
377 | 377 | */ |
378 | - $date_format_contexts = apply_filters( 'give_date_format_contexts', array() ); |
|
378 | + $date_format_contexts = apply_filters('give_date_format_contexts', array()); |
|
379 | 379 | |
380 | 380 | // Set date format to default date format. |
381 | - $date_format = get_option( 'date_format' ); |
|
381 | + $date_format = get_option('date_format'); |
|
382 | 382 | |
383 | 383 | // Update date format if we have non empty date format context array and non empty date format string for that context. |
384 | - if ( $date_context && ! empty( $date_format_contexts ) && array_key_exists( $date_context, $date_format_contexts ) ) { |
|
385 | - $date_format = ! empty( $date_format_contexts[ $date_context ] ) |
|
386 | - ? $date_format_contexts[ $date_context ] |
|
384 | + if ($date_context && ! empty($date_format_contexts) && array_key_exists($date_context, $date_format_contexts)) { |
|
385 | + $date_format = ! empty($date_format_contexts[$date_context]) |
|
386 | + ? $date_format_contexts[$date_context] |
|
387 | 387 | : $date_format; |
388 | 388 | } |
389 | 389 | |
390 | - return apply_filters( 'give_date_format', $date_format ); |
|
390 | + return apply_filters('give_date_format', $date_format); |
|
391 | 391 | } |
392 | 392 | |
393 | 393 | /** |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * |
402 | 402 | * @return string |
403 | 403 | */ |
404 | -function give_get_cache_key( $action, $query_args ) { |
|
405 | - return Give_Cache::get_key( $action, $query_args ); |
|
404 | +function give_get_cache_key($action, $query_args) { |
|
405 | + return Give_Cache::get_key($action, $query_args); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | /** |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | * |
416 | 416 | * @return string|array |
417 | 417 | */ |
418 | -function give_clean( $var ) { |
|
419 | - if ( is_array( $var ) ) { |
|
420 | - return array_map( 'give_clean', $var ); |
|
418 | +function give_clean($var) { |
|
419 | + if (is_array($var)) { |
|
420 | + return array_map('give_clean', $var); |
|
421 | 421 | } else { |
422 | - return is_scalar( $var ) ? sanitize_text_field( $var ) : $var; |
|
422 | + return is_scalar($var) ? sanitize_text_field($var) : $var; |
|
423 | 423 | } |
424 | 424 | } |
425 | 425 | |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | * |
433 | 433 | * @return int |
434 | 434 | */ |
435 | -function give_let_to_num( $size ) { |
|
436 | - $l = substr( $size, - 1 ); |
|
437 | - $ret = substr( $size, 0, - 1 ); |
|
438 | - switch ( strtoupper( $l ) ) { |
|
435 | +function give_let_to_num($size) { |
|
436 | + $l = substr($size, - 1); |
|
437 | + $ret = substr($size, 0, - 1); |
|
438 | + switch (strtoupper($l)) { |
|
439 | 439 | case 'P': |
440 | 440 | $ret *= 1024; |
441 | 441 | case 'T': |
@@ -460,19 +460,19 @@ discard block |
||
460 | 460 | * @param int $action |
461 | 461 | * @param array $wp_die_args |
462 | 462 | */ |
463 | -function give_validate_nonce( $nonce, $action = - 1, $wp_die_args = array() ) { |
|
463 | +function give_validate_nonce($nonce, $action = - 1, $wp_die_args = array()) { |
|
464 | 464 | |
465 | 465 | $default_wp_die_args = array( |
466 | - 'message' => esc_html__( 'Nonce verification has failed.', 'give' ), |
|
467 | - 'title' => esc_html__( 'Error', 'give' ), |
|
466 | + 'message' => esc_html__('Nonce verification has failed.', 'give'), |
|
467 | + 'title' => esc_html__('Error', 'give'), |
|
468 | 468 | 'args' => array( |
469 | 469 | 'response' => 403, |
470 | 470 | ), |
471 | 471 | ); |
472 | 472 | |
473 | - $wp_die_args = wp_parse_args( $wp_die_args, $default_wp_die_args ); |
|
473 | + $wp_die_args = wp_parse_args($wp_die_args, $default_wp_die_args); |
|
474 | 474 | |
475 | - if ( ! wp_verify_nonce( $nonce, $action ) ) { |
|
475 | + if ( ! wp_verify_nonce($nonce, $action)) { |
|
476 | 476 | wp_die( |
477 | 477 | $wp_die_args['message'], |
478 | 478 | $wp_die_args['title'], |
@@ -494,23 +494,23 @@ discard block |
||
494 | 494 | * |
495 | 495 | * @return mixed |
496 | 496 | */ |
497 | -function give_check_variable( $variable, $conditional = '', $default = false ) { |
|
497 | +function give_check_variable($variable, $conditional = '', $default = false) { |
|
498 | 498 | |
499 | - switch ( $conditional ) { |
|
499 | + switch ($conditional) { |
|
500 | 500 | case 'isset_empty': |
501 | - $variable = ( isset( $variable ) && ! empty( $variable ) ) ? $variable : $default; |
|
501 | + $variable = (isset($variable) && ! empty($variable)) ? $variable : $default; |
|
502 | 502 | break; |
503 | 503 | |
504 | 504 | case 'empty': |
505 | - $variable = ! empty( $variable ) ? $variable : $default; |
|
505 | + $variable = ! empty($variable) ? $variable : $default; |
|
506 | 506 | break; |
507 | 507 | |
508 | 508 | case 'null': |
509 | - $variable = ! is_null( $variable ) ? $variable : $default; |
|
509 | + $variable = ! is_null($variable) ? $variable : $default; |
|
510 | 510 | break; |
511 | 511 | |
512 | 512 | default: |
513 | - $variable = isset( $variable ) ? $variable : $default; |
|
513 | + $variable = isset($variable) ? $variable : $default; |
|
514 | 514 | |
515 | 515 | } |
516 | 516 |
@@ -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 | |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return bool true if has variable prices, false otherwise |
25 | 25 | */ |
26 | -function give_has_variable_prices( $form_id = 0 ) { |
|
26 | +function give_has_variable_prices($form_id = 0) { |
|
27 | 27 | |
28 | - if ( empty( $form_id ) ) { |
|
28 | + if (empty($form_id)) { |
|
29 | 29 | return false; |
30 | 30 | } |
31 | 31 | |
32 | - $form = new Give_Donate_Form( $form_id ); |
|
32 | + $form = new Give_Donate_Form($form_id); |
|
33 | 33 | |
34 | 34 | return $form->has_variable_prices(); |
35 | 35 | } |
@@ -44,13 +44,13 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return array|bool Variable prices |
46 | 46 | */ |
47 | -function give_get_variable_prices( $form_id = 0 ) { |
|
47 | +function give_get_variable_prices($form_id = 0) { |
|
48 | 48 | |
49 | - if ( empty( $form_id ) ) { |
|
49 | + if (empty($form_id)) { |
|
50 | 50 | return false; |
51 | 51 | } |
52 | 52 | |
53 | - $form = new Give_Donate_Form( $form_id ); |
|
53 | + $form = new Give_Donate_Form($form_id); |
|
54 | 54 | |
55 | 55 | return $form->prices; |
56 | 56 | |
@@ -65,13 +65,13 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return array Variable prices |
67 | 67 | */ |
68 | -function give_get_variable_price_ids( $form_id = 0 ) { |
|
69 | - if( ! ( $prices = give_get_variable_prices( $form_id ) ) ) { |
|
68 | +function give_get_variable_price_ids($form_id = 0) { |
|
69 | + if ( ! ($prices = give_get_variable_prices($form_id))) { |
|
70 | 70 | return array(); |
71 | 71 | } |
72 | 72 | |
73 | 73 | $price_ids = array(); |
74 | - foreach ( $prices as $price ){ |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | $price_ids[] = $price['_give_id']['level_id']; |
76 | 76 | } |
77 | 77 | |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @return string $default_price |
91 | 91 | */ |
92 | -function give_get_default_multilevel_amount( $form_id ) { |
|
92 | +function give_get_default_multilevel_amount($form_id) { |
|
93 | 93 | $default_price = '1.00'; |
94 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
94 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
95 | 95 | |
96 | - foreach ( $prices as $price ) { |
|
96 | + foreach ($prices as $price) { |
|
97 | 97 | |
98 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
98 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
99 | 99 | $default_price = $price['_give_amount']; |
100 | 100 | } |
101 | 101 | |
@@ -116,19 +116,19 @@ discard block |
||
116 | 116 | * @return string $default_price |
117 | 117 | * @since 1.0 |
118 | 118 | */ |
119 | -function give_get_default_form_amount( $form_id ) { |
|
119 | +function give_get_default_form_amount($form_id) { |
|
120 | 120 | |
121 | - if ( give_has_variable_prices( $form_id ) ) { |
|
121 | + if (give_has_variable_prices($form_id)) { |
|
122 | 122 | |
123 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
123 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
124 | 124 | |
125 | 125 | } else { |
126 | 126 | |
127 | - $default_amount = give_get_meta( $form_id, '_give_set_price', true ); |
|
127 | + $default_amount = give_get_meta($form_id, '_give_set_price', true); |
|
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | - return apply_filters( 'give_default_form_amount', $default_amount ); |
|
131 | + return apply_filters('give_default_form_amount', $default_amount); |
|
132 | 132 | |
133 | 133 | } |
134 | 134 | |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @return bool |
148 | 148 | */ |
149 | -function give_is_custom_price_mode( $form_id = 0 ) { |
|
149 | +function give_is_custom_price_mode($form_id = 0) { |
|
150 | 150 | |
151 | - if ( empty( $form_id ) ) { |
|
151 | + if (empty($form_id)) { |
|
152 | 152 | return false; |
153 | 153 | } |
154 | 154 | |
155 | - $form = new Give_Donate_Form( $form_id ); |
|
155 | + $form = new Give_Donate_Form($form_id); |
|
156 | 156 | |
157 | 157 | return $form->is_custom_price_mode(); |
158 | 158 | } |
159 | 159 | \ No newline at end of file |
@@ -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 | } |
@@ -254,8 +254,8 @@ |
||
254 | 254 | $args = array( |
255 | 255 | 'id' => 'give-api-user-search', |
256 | 256 | 'name' => 'user_id', |
257 | - ); |
|
258 | - echo Give()->html->ajax_user_search($args); ?> |
|
257 | + ); |
|
258 | + echo Give()->html->ajax_user_search($args); ?> |
|
259 | 259 | <?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
260 | 260 | <?php |
261 | 261 | $give_api_is_bottom = true; |
@@ -10,13 +10,13 @@ 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 | |
17 | 17 | // Load WP_List_Table if not loaded |
18 | -if ( ! class_exists( 'WP_List_Table' ) ) { |
|
19 | - require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php'; |
|
18 | +if ( ! class_exists('WP_List_Table')) { |
|
19 | + require_once ABSPATH.'wp-admin/includes/class-wp-list-table.php'; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -53,11 +53,11 @@ discard block |
||
53 | 53 | global $status, $page; |
54 | 54 | |
55 | 55 | // Set parent defaults |
56 | - parent::__construct( array( |
|
57 | - 'singular' => esc_html__( 'API Key', 'give' ), // Singular name of the listed records |
|
58 | - 'plural' => esc_html__( 'API Keys', 'give' ), // Plural name of the listed records |
|
59 | - 'ajax' => false,// Does this table support ajax? |
|
60 | - ) ); |
|
56 | + parent::__construct(array( |
|
57 | + 'singular' => esc_html__('API Key', 'give'), // Singular name of the listed records |
|
58 | + 'plural' => esc_html__('API Keys', 'give'), // Plural name of the listed records |
|
59 | + 'ajax' => false, // Does this table support ajax? |
|
60 | + )); |
|
61 | 61 | |
62 | 62 | $this->query(); |
63 | 63 | } |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | * |
74 | 74 | * @return string Column Name |
75 | 75 | */ |
76 | - public function column_default( $item, $column_name ) { |
|
77 | - return $item[ $column_name ]; |
|
76 | + public function column_default($item, $column_name) { |
|
77 | + return $item[$column_name]; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | * |
88 | 88 | * @return string Column Name |
89 | 89 | */ |
90 | - public function column_key( $item ) { |
|
91 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['key'] ) . '"/>'; |
|
90 | + public function column_key($item) { |
|
91 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['key']).'"/>'; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -101,8 +101,8 @@ discard block |
||
101 | 101 | * |
102 | 102 | * @return string Column Name |
103 | 103 | */ |
104 | - public function column_token( $item ) { |
|
105 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['token'] ) . '"/>'; |
|
104 | + public function column_token($item) { |
|
105 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['token']).'"/>'; |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | /** |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string Column Name |
117 | 117 | */ |
118 | - public function column_secret( $item ) { |
|
119 | - return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="' . esc_attr( $item['secret'] ) . '"/>'; |
|
118 | + public function column_secret($item) { |
|
119 | + return '<input onClick="this.setSelectionRange(0, this.value.length)" readonly="readonly" type="text" class="large-text" value="'.esc_attr($item['secret']).'"/>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | * @since 1.1 |
127 | 127 | * @return string |
128 | 128 | */ |
129 | - public function column_user( $item ) { |
|
129 | + public function column_user($item) { |
|
130 | 130 | |
131 | 131 | $actions = array(); |
132 | 132 | |
133 | - if ( apply_filters( 'give_api_log_requests', true ) ) { |
|
133 | + if (apply_filters('give_api_log_requests', true)) { |
|
134 | 134 | $actions['view'] = sprintf( |
135 | 135 | '<a href="%s">%s</a>', |
136 | - esc_url( add_query_arg( array( |
|
136 | + esc_url(add_query_arg(array( |
|
137 | 137 | 'section' => 'api_requests', |
138 | 138 | 'post_type' => 'give_forms', |
139 | 139 | 'page' => 'give-tools', |
140 | 140 | 'tab' => 'logs', |
141 | 141 | 's' => $item['email'], |
142 | - ), 'edit.php' ) ), |
|
143 | - esc_html__( 'View API Log', 'give' ) |
|
142 | + ), 'edit.php')), |
|
143 | + esc_html__('View API Log', 'give') |
|
144 | 144 | ); |
145 | 145 | } |
146 | 146 | |
147 | 147 | $actions['reissue'] = sprintf( |
148 | 148 | '<a href="%s" class="give-regenerate-api-key">%s</a>', |
149 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
149 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
150 | 150 | 'user_id' => $item['id'], |
151 | 151 | 'give_action' => 'process_api_key', |
152 | 152 | 'give_api_process' => 'regenerate', |
153 | - ) ), 'give-api-nonce' ) ), |
|
154 | - esc_html__( 'Reissue', 'give' ) |
|
153 | + )), 'give-api-nonce')), |
|
154 | + esc_html__('Reissue', 'give') |
|
155 | 155 | ); |
156 | - $actions['revoke'] = sprintf( |
|
156 | + $actions['revoke'] = sprintf( |
|
157 | 157 | '<a href="%s" class="give-revoke-api-key give-delete">%s</a>', |
158 | - esc_url( wp_nonce_url( add_query_arg( array( |
|
158 | + esc_url(wp_nonce_url(add_query_arg(array( |
|
159 | 159 | 'user_id' => $item['id'], |
160 | 160 | 'give_action' => 'process_api_key', |
161 | 161 | 'give_api_process' => 'revoke', |
162 | - ) ), 'give-api-nonce' ) ), |
|
163 | - esc_html__( 'Revoke', 'give' ) |
|
162 | + )), 'give-api-nonce')), |
|
163 | + esc_html__('Revoke', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | - $actions = apply_filters( 'give_api_row_actions', array_filter( $actions ) ); |
|
166 | + $actions = apply_filters('give_api_row_actions', array_filter($actions)); |
|
167 | 167 | |
168 | - return sprintf( '%1$s %2$s', $item['user'], $this->row_actions( $actions ) ); |
|
168 | + return sprintf('%1$s %2$s', $item['user'], $this->row_actions($actions)); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public function get_columns() { |
191 | 191 | $columns = array( |
192 | - 'user' => esc_html__( 'Username', 'give' ), |
|
193 | - 'key' => esc_html__( 'Public Key', 'give' ), |
|
194 | - 'token' => esc_html__( 'Token', 'give' ), |
|
195 | - 'secret' => esc_html__( 'Secret Key', 'give' ), |
|
192 | + 'user' => esc_html__('Username', 'give'), |
|
193 | + 'key' => esc_html__('Public Key', 'give'), |
|
194 | + 'token' => esc_html__('Token', 'give'), |
|
195 | + 'secret' => esc_html__('Secret Key', 'give'), |
|
196 | 196 | ); |
197 | 197 | |
198 | 198 | return $columns; |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param string $which |
208 | 208 | */ |
209 | - protected function display_tablenav( $which ) { |
|
210 | - if ( 'top' === $which ) { |
|
211 | - wp_nonce_field( 'bulk-' . $this->_args['plural'] ); |
|
209 | + protected function display_tablenav($which) { |
|
210 | + if ('top' === $which) { |
|
211 | + wp_nonce_field('bulk-'.$this->_args['plural']); |
|
212 | 212 | } |
213 | 213 | ?> |
214 | - <div class="tablenav <?php echo esc_attr( $which ); ?>"> |
|
214 | + <div class="tablenav <?php echo esc_attr($which); ?>"> |
|
215 | 215 | |
216 | 216 | <div class="alignleft actions bulkactions"> |
217 | - <?php $this->bulk_actions( $which ); ?> |
|
217 | + <?php $this->bulk_actions($which); ?> |
|
218 | 218 | </div> |
219 | 219 | |
220 | 220 | <?php |
221 | - $this->extra_tablenav( $which ); |
|
222 | - $this->pagination( $which ); |
|
221 | + $this->extra_tablenav($which); |
|
222 | + $this->pagination($which); |
|
223 | 223 | ?> |
224 | 224 | |
225 | 225 | <br class="clear"/> |
@@ -237,17 +237,17 @@ discard block |
||
237 | 237 | * |
238 | 238 | * @return void |
239 | 239 | */ |
240 | - function bulk_actions( $which = '' ) { |
|
240 | + function bulk_actions($which = '') { |
|
241 | 241 | // These aren't really bulk actions but this outputs the markup in the right place. |
242 | 242 | static $give_api_is_bottom; |
243 | 243 | |
244 | - if ( $give_api_is_bottom ) { |
|
244 | + if ($give_api_is_bottom) { |
|
245 | 245 | return; |
246 | 246 | } |
247 | 247 | ?> |
248 | 248 | <input type="hidden" name="give_action" value="process_api_key"/> |
249 | 249 | <input type="hidden" name="give_api_process" value="generate"/> |
250 | - <?php wp_nonce_field( 'give-api-nonce' ); |
|
250 | + <?php wp_nonce_field('give-api-nonce'); |
|
251 | 251 | /** |
252 | 252 | * API Key user search. |
253 | 253 | */ |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'name' => 'user_id', |
257 | 257 | ); |
258 | 258 | echo Give()->html->ajax_user_search($args); ?> |
259 | - <?php submit_button( esc_html__( 'Generate New API Keys', 'give' ), 'secondary', 'submit', false ); ?> |
|
259 | + <?php submit_button(esc_html__('Generate New API Keys', 'give'), 'secondary', 'submit', false); ?> |
|
260 | 260 | <?php |
261 | 261 | $give_api_is_bottom = true; |
262 | 262 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * @return int Current page number |
270 | 270 | */ |
271 | 271 | public function get_paged() { |
272 | - return isset( $_GET['paged'] ) ? absint( $_GET['paged'] ) : 1; |
|
272 | + return isset($_GET['paged']) ? absint($_GET['paged']) : 1; |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | /** |
@@ -280,21 +280,21 @@ discard block |
||
280 | 280 | * @return array |
281 | 281 | */ |
282 | 282 | public function query() { |
283 | - $users = get_users( array( |
|
283 | + $users = get_users(array( |
|
284 | 284 | 'meta_value' => 'give_user_secret_key', |
285 | 285 | 'number' => $this->per_page, |
286 | - 'offset' => $this->per_page * ( $this->get_paged() - 1 ), |
|
287 | - ) ); |
|
288 | - $keys = array(); |
|
289 | - |
|
290 | - foreach ( $users as $user ) { |
|
291 | - $keys[ $user->ID ]['id'] = $user->ID; |
|
292 | - $keys[ $user->ID ]['email'] = $user->user_email; |
|
293 | - $keys[ $user->ID ]['user'] = '<a href="' . add_query_arg( 'user_id', $user->ID, 'user-edit.php' ) . '"><strong>' . $user->user_login . '</strong></a>'; |
|
294 | - |
|
295 | - $keys[ $user->ID ]['key'] = Give()->api->get_user_public_key( $user->ID ); |
|
296 | - $keys[ $user->ID ]['secret'] = Give()->api->get_user_secret_key( $user->ID ); |
|
297 | - $keys[ $user->ID ]['token'] = Give()->api->get_token( $user->ID ); |
|
286 | + 'offset' => $this->per_page * ($this->get_paged() - 1), |
|
287 | + )); |
|
288 | + $keys = array(); |
|
289 | + |
|
290 | + foreach ($users as $user) { |
|
291 | + $keys[$user->ID]['id'] = $user->ID; |
|
292 | + $keys[$user->ID]['email'] = $user->user_email; |
|
293 | + $keys[$user->ID]['user'] = '<a href="'.add_query_arg('user_id', $user->ID, 'user-edit.php').'"><strong>'.$user->user_login.'</strong></a>'; |
|
294 | + |
|
295 | + $keys[$user->ID]['key'] = Give()->api->get_user_public_key($user->ID); |
|
296 | + $keys[$user->ID]['secret'] = Give()->api->get_user_secret_key($user->ID); |
|
297 | + $keys[$user->ID]['token'] = Give()->api->get_token($user->ID); |
|
298 | 298 | } |
299 | 299 | |
300 | 300 | return $keys; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | public function total_items() { |
312 | 312 | global $wpdb; |
313 | 313 | |
314 | - if ( ! ( $total_items = Give_Cache::get( 'give_total_api_keys', true ) ) ) { |
|
314 | + if ( ! ($total_items = Give_Cache::get('give_total_api_keys', true))) { |
|
315 | 315 | $total_items = $wpdb->get_var( |
316 | 316 | $wpdb->prepare( |
317 | 317 | "SELECT count(user_id) |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | ) |
321 | 321 | ); |
322 | 322 | |
323 | - Give_Cache::set( 'give_total_api_keys', $total_items, HOUR_IN_SECONDS, true ); |
|
323 | + Give_Cache::set('give_total_api_keys', $total_items, HOUR_IN_SECONDS, true); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | return $total_items; |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | $hidden = array(); // No hidden columns |
340 | 340 | $sortable = array(); // Not sortable... for now |
341 | 341 | |
342 | - $this->_column_headers = array( $columns, $hidden, $sortable ); |
|
342 | + $this->_column_headers = array($columns, $hidden, $sortable); |
|
343 | 343 | |
344 | 344 | $data = $this->query(); |
345 | 345 | |
@@ -347,10 +347,10 @@ discard block |
||
347 | 347 | |
348 | 348 | $this->items = $data; |
349 | 349 | |
350 | - $this->set_pagination_args( array( |
|
350 | + $this->set_pagination_args(array( |
|
351 | 351 | 'total_items' => $total_items, |
352 | 352 | 'per_page' => $this->per_page, |
353 | - 'total_pages' => ceil( $total_items / $this->per_page ), |
|
353 | + 'total_pages' => ceil($total_items / $this->per_page), |
|
354 | 354 | ) |
355 | 355 | ); |
356 | 356 | } |