@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | * |
51 | 51 | * @param $args array The array of arguments that can be passed in and used for setting up this payment query. |
52 | 52 | */ |
53 | - public function __construct( $args = array() ) { |
|
53 | + public function __construct($args = array()) { |
|
54 | 54 | $defaults = array( |
55 | 55 | 'output' => 'payments', // Use 'posts' to get standard post objects |
56 | - 'post_type' => array( 'give_payment' ), |
|
56 | + 'post_type' => array('give_payment'), |
|
57 | 57 | 'start_date' => false, |
58 | 58 | 'end_date' => false, |
59 | 59 | 'number' => 20, |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'give_forms' => null |
74 | 74 | ); |
75 | 75 | |
76 | - $this->args = wp_parse_args( $args, $defaults ); |
|
76 | + $this->args = wp_parse_args($args, $defaults); |
|
77 | 77 | |
78 | 78 | $this->init(); |
79 | 79 | } |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | * @access public |
85 | 85 | * @since 1.0 |
86 | 86 | */ |
87 | - public function __set( $query_var, $value ) { |
|
88 | - if ( in_array( $query_var, array( 'meta_query', 'tax_query' ) ) ) { |
|
89 | - $this->args[ $query_var ][] = $value; |
|
87 | + public function __set($query_var, $value) { |
|
88 | + if (in_array($query_var, array('meta_query', 'tax_query'))) { |
|
89 | + $this->args[$query_var][] = $value; |
|
90 | 90 | } else { |
91 | - $this->args[ $query_var ] = $value; |
|
91 | + $this->args[$query_var] = $value; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @access public |
99 | 99 | * @since 1.0 |
100 | 100 | */ |
101 | - public function __unset( $query_var ) { |
|
102 | - unset( $this->args[ $query_var ] ); |
|
101 | + public function __unset($query_var) { |
|
102 | + unset($this->args[$query_var]); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | /** |
@@ -111,19 +111,19 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function init() { |
113 | 113 | |
114 | - add_action( 'give_pre_get_payments', array( $this, 'date_filter_pre' ) ); |
|
115 | - add_action( 'give_post_get_payments', array( $this, 'date_filter_post' ) ); |
|
116 | - |
|
117 | - add_action( 'give_pre_get_payments', array( $this, 'orderby' ) ); |
|
118 | - add_action( 'give_pre_get_payments', array( $this, 'status' ) ); |
|
119 | - add_action( 'give_pre_get_payments', array( $this, 'month' ) ); |
|
120 | - add_action( 'give_pre_get_payments', array( $this, 'per_page' ) ); |
|
121 | - add_action( 'give_pre_get_payments', array( $this, 'page' ) ); |
|
122 | - add_action( 'give_pre_get_payments', array( $this, 'user' ) ); |
|
123 | - add_action( 'give_pre_get_payments', array( $this, 'search' ) ); |
|
124 | - add_action( 'give_pre_get_payments', array( $this, 'mode' ) ); |
|
125 | - add_action( 'give_pre_get_payments', array( $this, 'children' ) ); |
|
126 | - add_action( 'give_pre_get_payments', array( $this, 'give_forms' ) ); |
|
114 | + add_action('give_pre_get_payments', array($this, 'date_filter_pre')); |
|
115 | + add_action('give_post_get_payments', array($this, 'date_filter_post')); |
|
116 | + |
|
117 | + add_action('give_pre_get_payments', array($this, 'orderby')); |
|
118 | + add_action('give_pre_get_payments', array($this, 'status')); |
|
119 | + add_action('give_pre_get_payments', array($this, 'month')); |
|
120 | + add_action('give_pre_get_payments', array($this, 'per_page')); |
|
121 | + add_action('give_pre_get_payments', array($this, 'page')); |
|
122 | + add_action('give_pre_get_payments', array($this, 'user')); |
|
123 | + add_action('give_pre_get_payments', array($this, 'search')); |
|
124 | + add_action('give_pre_get_payments', array($this, 'mode')); |
|
125 | + add_action('give_pre_get_payments', array($this, 'children')); |
|
126 | + add_action('give_pre_get_payments', array($this, 'give_forms')); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | /** |
@@ -139,16 +139,16 @@ discard block |
||
139 | 139 | */ |
140 | 140 | public function get_payments() { |
141 | 141 | |
142 | - do_action( 'give_pre_get_payments', $this ); |
|
142 | + do_action('give_pre_get_payments', $this); |
|
143 | 143 | |
144 | - $query = new WP_Query( $this->args ); |
|
144 | + $query = new WP_Query($this->args); |
|
145 | 145 | |
146 | - if ( 'payments' != $this->args['output'] ) { |
|
146 | + if ('payments' != $this->args['output']) { |
|
147 | 147 | return $query->posts; |
148 | 148 | } |
149 | 149 | |
150 | - if ( $query->have_posts() ) { |
|
151 | - while ( $query->have_posts() ) { |
|
150 | + if ($query->have_posts()) { |
|
151 | + while ($query->have_posts()) { |
|
152 | 152 | $query->the_post(); |
153 | 153 | |
154 | 154 | $details = new stdClass; |
@@ -158,23 +158,23 @@ discard block |
||
158 | 158 | $details->ID = $payment_id; |
159 | 159 | $details->date = get_post()->post_date; |
160 | 160 | $details->post_status = get_post()->post_status; |
161 | - $details->total = give_get_payment_amount( $payment_id ); |
|
162 | - $details->fees = give_get_payment_fees( $payment_id ); |
|
163 | - $details->key = give_get_payment_key( $payment_id ); |
|
164 | - $details->gateway = give_get_payment_gateway( $payment_id ); |
|
165 | - $details->user_info = give_get_payment_meta_user_info( $payment_id ); |
|
166 | - |
|
167 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
168 | - $details->payment_number = give_get_payment_number( $payment_id ); |
|
161 | + $details->total = give_get_payment_amount($payment_id); |
|
162 | + $details->fees = give_get_payment_fees($payment_id); |
|
163 | + $details->key = give_get_payment_key($payment_id); |
|
164 | + $details->gateway = give_get_payment_gateway($payment_id); |
|
165 | + $details->user_info = give_get_payment_meta_user_info($payment_id); |
|
166 | + |
|
167 | + if (give_get_option('enable_sequential')) { |
|
168 | + $details->payment_number = give_get_payment_number($payment_id); |
|
169 | 169 | } |
170 | 170 | |
171 | - $this->payments[] = apply_filters( 'give_payment', $details, $payment_id, $this ); |
|
171 | + $this->payments[] = apply_filters('give_payment', $details, $payment_id, $this); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | wp_reset_postdata(); |
175 | 175 | } |
176 | 176 | |
177 | - do_action( 'give_post_get_payments', $this ); |
|
177 | + do_action('give_post_get_payments', $this); |
|
178 | 178 | |
179 | 179 | return $this->payments; |
180 | 180 | } |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | * @return void |
188 | 188 | */ |
189 | 189 | public function date_filter_pre() { |
190 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
190 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
191 | 191 | return; |
192 | 192 | } |
193 | 193 | |
194 | - $this->setup_dates( $this->args['start_date'], $this->args['end_date'] ); |
|
194 | + $this->setup_dates($this->args['start_date'], $this->args['end_date']); |
|
195 | 195 | |
196 | - add_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
196 | + add_filter('posts_where', array($this, 'payments_where')); |
|
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | public function date_filter_post() { |
208 | - if ( ! ( $this->args['start_date'] || $this->args['end_date'] ) ) { |
|
208 | + if ( ! ($this->args['start_date'] || $this->args['end_date'])) { |
|
209 | 209 | return; |
210 | 210 | } |
211 | 211 | |
212 | - remove_filter( 'posts_where', array( $this, 'payments_where' ) ); |
|
212 | + remove_filter('posts_where', array($this, 'payments_where')); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -220,12 +220,12 @@ discard block |
||
220 | 220 | * @return void |
221 | 221 | */ |
222 | 222 | public function status() { |
223 | - if ( ! isset ( $this->args['status'] ) ) { |
|
223 | + if ( ! isset ($this->args['status'])) { |
|
224 | 224 | return; |
225 | 225 | } |
226 | 226 | |
227 | - $this->__set( 'post_status', $this->args['status'] ); |
|
228 | - $this->__unset( 'status' ); |
|
227 | + $this->__set('post_status', $this->args['status']); |
|
228 | + $this->__unset('status'); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | * @return void |
237 | 237 | */ |
238 | 238 | public function page() { |
239 | - if ( ! isset ( $this->args['page'] ) ) { |
|
239 | + if ( ! isset ($this->args['page'])) { |
|
240 | 240 | return; |
241 | 241 | } |
242 | 242 | |
243 | - $this->__set( 'paged', $this->args['page'] ); |
|
244 | - $this->__unset( 'page' ); |
|
243 | + $this->__set('paged', $this->args['page']); |
|
244 | + $this->__unset('page'); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | /** |
@@ -253,17 +253,17 @@ discard block |
||
253 | 253 | */ |
254 | 254 | public function per_page() { |
255 | 255 | |
256 | - if ( ! isset( $this->args['number'] ) ) { |
|
256 | + if ( ! isset($this->args['number'])) { |
|
257 | 257 | return; |
258 | 258 | } |
259 | 259 | |
260 | - if ( $this->args['number'] == - 1 ) { |
|
261 | - $this->__set( 'nopaging', true ); |
|
260 | + if ($this->args['number'] == - 1) { |
|
261 | + $this->__set('nopaging', true); |
|
262 | 262 | } else { |
263 | - $this->__set( 'posts_per_page', $this->args['number'] ); |
|
263 | + $this->__set('posts_per_page', $this->args['number']); |
|
264 | 264 | } |
265 | 265 | |
266 | - $this->__unset( 'number' ); |
|
266 | + $this->__unset('number'); |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | * @return void |
275 | 275 | */ |
276 | 276 | public function month() { |
277 | - if ( ! isset ( $this->args['month'] ) ) { |
|
277 | + if ( ! isset ($this->args['month'])) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | - $this->__set( 'monthnum', $this->args['month'] ); |
|
282 | - $this->__unset( 'month' ); |
|
281 | + $this->__set('monthnum', $this->args['month']); |
|
282 | + $this->__unset('month'); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | * @return void |
291 | 291 | */ |
292 | 292 | public function orderby() { |
293 | - switch ( $this->args['orderby'] ) { |
|
293 | + switch ($this->args['orderby']) { |
|
294 | 294 | case 'amount' : |
295 | - $this->__set( 'orderby', 'meta_value_num' ); |
|
296 | - $this->__set( 'meta_key', '_give_payment_total' ); |
|
295 | + $this->__set('orderby', 'meta_value_num'); |
|
296 | + $this->__set('meta_key', '_give_payment_total'); |
|
297 | 297 | break; |
298 | 298 | default : |
299 | - $this->__set( 'orderby', $this->args['orderby'] ); |
|
299 | + $this->__set('orderby', $this->args['orderby']); |
|
300 | 300 | break; |
301 | 301 | } |
302 | 302 | } |
@@ -309,20 +309,20 @@ discard block |
||
309 | 309 | * @return void |
310 | 310 | */ |
311 | 311 | public function user() { |
312 | - if ( is_null( $this->args['user'] ) ) { |
|
312 | + if (is_null($this->args['user'])) { |
|
313 | 313 | return; |
314 | 314 | } |
315 | 315 | |
316 | - if ( is_numeric( $this->args['user'] ) ) { |
|
316 | + if (is_numeric($this->args['user'])) { |
|
317 | 317 | $user_key = '_give_payment_user_id'; |
318 | 318 | } else { |
319 | 319 | $user_key = '_give_payment_user_email'; |
320 | 320 | } |
321 | 321 | |
322 | - $this->__set( 'meta_query', array( |
|
322 | + $this->__set('meta_query', array( |
|
323 | 323 | 'key' => $user_key, |
324 | 324 | 'value' => $this->args['user'] |
325 | - ) ); |
|
325 | + )); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | /** |
@@ -334,33 +334,33 @@ discard block |
||
334 | 334 | */ |
335 | 335 | public function search() { |
336 | 336 | |
337 | - if ( ! isset( $this->args['s'] ) ) { |
|
337 | + if ( ! isset($this->args['s'])) { |
|
338 | 338 | return; |
339 | 339 | } |
340 | 340 | |
341 | - $search = trim( $this->args['s'] ); |
|
341 | + $search = trim($this->args['s']); |
|
342 | 342 | |
343 | - if ( empty( $search ) ) { |
|
343 | + if (empty($search)) { |
|
344 | 344 | return; |
345 | 345 | } |
346 | 346 | |
347 | - $is_email = is_email( $search ) || strpos( $search, '@' ) !== false; |
|
348 | - $is_user = strpos( $search, strtolower( 'user:' ) ) !== false; |
|
347 | + $is_email = is_email($search) || strpos($search, '@') !== false; |
|
348 | + $is_user = strpos($search, strtolower('user:')) !== false; |
|
349 | 349 | |
350 | - if ( ! empty( $this->args['search_in_notes'] ) ) { |
|
350 | + if ( ! empty($this->args['search_in_notes'])) { |
|
351 | 351 | |
352 | - $notes = give_get_payment_notes( 0, $search ); |
|
352 | + $notes = give_get_payment_notes(0, $search); |
|
353 | 353 | |
354 | - if ( ! empty( $notes ) ) { |
|
354 | + if ( ! empty($notes)) { |
|
355 | 355 | |
356 | - $payment_ids = wp_list_pluck( (array) $notes, 'comment_post_ID' ); |
|
356 | + $payment_ids = wp_list_pluck((array) $notes, 'comment_post_ID'); |
|
357 | 357 | |
358 | - $this->__set( 'post__in', $payment_ids ); |
|
358 | + $this->__set('post__in', $payment_ids); |
|
359 | 359 | } |
360 | 360 | |
361 | - $this->__unset( 's' ); |
|
361 | + $this->__unset('s'); |
|
362 | 362 | |
363 | - } elseif ( $is_email || strlen( $search ) == 32 ) { |
|
363 | + } elseif ($is_email || strlen($search) == 32) { |
|
364 | 364 | |
365 | 365 | $key = $is_email ? '_give_payment_user_email' : '_give_payment_purchase_key'; |
366 | 366 | $search_meta = array( |
@@ -369,19 +369,19 @@ discard block |
||
369 | 369 | 'compare' => 'LIKE' |
370 | 370 | ); |
371 | 371 | |
372 | - $this->__set( 'meta_query', $search_meta ); |
|
373 | - $this->__unset( 's' ); |
|
372 | + $this->__set('meta_query', $search_meta); |
|
373 | + $this->__unset('s'); |
|
374 | 374 | |
375 | - } elseif ( $is_user ) { |
|
375 | + } elseif ($is_user) { |
|
376 | 376 | |
377 | 377 | $search_meta = array( |
378 | 378 | 'key' => '_give_payment_user_id', |
379 | - 'value' => trim( str_replace( 'user:', '', strtolower( $search ) ) ) |
|
379 | + 'value' => trim(str_replace('user:', '', strtolower($search))) |
|
380 | 380 | ); |
381 | 381 | |
382 | - $this->__set( 'meta_query', $search_meta ); |
|
382 | + $this->__set('meta_query', $search_meta); |
|
383 | 383 | |
384 | - if ( give_get_option( 'enable_sequential' ) ) { |
|
384 | + if (give_get_option('enable_sequential')) { |
|
385 | 385 | |
386 | 386 | $search_meta = array( |
387 | 387 | 'key' => '_give_payment_number', |
@@ -389,19 +389,19 @@ discard block |
||
389 | 389 | 'compare' => 'LIKE' |
390 | 390 | ); |
391 | 391 | |
392 | - $this->__set( 'meta_query', $search_meta ); |
|
392 | + $this->__set('meta_query', $search_meta); |
|
393 | 393 | |
394 | 394 | $this->args['meta_query']['relation'] = 'OR'; |
395 | 395 | |
396 | 396 | } |
397 | 397 | |
398 | - $this->__unset( 's' ); |
|
398 | + $this->__unset('s'); |
|
399 | 399 | |
400 | 400 | } elseif ( |
401 | - give_get_option( 'enable_sequential' ) && |
|
401 | + give_get_option('enable_sequential') && |
|
402 | 402 | ( |
403 | - false !== strpos( $search, give_get_option( 'sequential_prefix' ) ) || |
|
404 | - false !== strpos( $search, give_get_option( 'sequential_postfix' ) ) |
|
403 | + false !== strpos($search, give_get_option('sequential_prefix')) || |
|
404 | + false !== strpos($search, give_get_option('sequential_postfix')) |
|
405 | 405 | ) |
406 | 406 | ) { |
407 | 407 | |
@@ -411,28 +411,28 @@ discard block |
||
411 | 411 | 'compare' => 'LIKE' |
412 | 412 | ); |
413 | 413 | |
414 | - $this->__set( 'meta_query', $search_meta ); |
|
415 | - $this->__unset( 's' ); |
|
414 | + $this->__set('meta_query', $search_meta); |
|
415 | + $this->__unset('s'); |
|
416 | 416 | |
417 | - } elseif ( is_numeric( $search ) ) { |
|
417 | + } elseif (is_numeric($search)) { |
|
418 | 418 | |
419 | - $post = get_post( $search ); |
|
419 | + $post = get_post($search); |
|
420 | 420 | |
421 | - if ( is_object( $post ) && $post->post_type == 'give_payment' ) { |
|
421 | + if (is_object($post) && $post->post_type == 'give_payment') { |
|
422 | 422 | |
423 | 423 | $arr = array(); |
424 | 424 | $arr[] = $search; |
425 | - $this->__set( 'post__in', $arr ); |
|
426 | - $this->__unset( 's' ); |
|
425 | + $this->__set('post__in', $arr); |
|
426 | + $this->__unset('s'); |
|
427 | 427 | } |
428 | 428 | |
429 | - } elseif ( '#' == substr( $search, 0, 1 ) ) { |
|
429 | + } elseif ('#' == substr($search, 0, 1)) { |
|
430 | 430 | |
431 | - $this->__set( 'give_forms', str_replace( '#', '', $search ) ); |
|
432 | - $this->__unset( 's' ); |
|
431 | + $this->__set('give_forms', str_replace('#', '', $search)); |
|
432 | + $this->__unset('s'); |
|
433 | 433 | |
434 | 434 | } else { |
435 | - $this->__set( 's', $search ); |
|
435 | + $this->__set('s', $search); |
|
436 | 436 | |
437 | 437 | } |
438 | 438 | |
@@ -446,16 +446,16 @@ discard block |
||
446 | 446 | * @return void |
447 | 447 | */ |
448 | 448 | public function mode() { |
449 | - if ( empty( $this->args['mode'] ) || $this->args['mode'] == 'all' ) { |
|
450 | - $this->__unset( 'mode' ); |
|
449 | + if (empty($this->args['mode']) || $this->args['mode'] == 'all') { |
|
450 | + $this->__unset('mode'); |
|
451 | 451 | |
452 | 452 | return; |
453 | 453 | } |
454 | 454 | |
455 | - $this->__set( 'meta_query', array( |
|
455 | + $this->__set('meta_query', array( |
|
456 | 456 | 'key' => '_give_payment_mode', |
457 | 457 | 'value' => $this->args['mode'] |
458 | - ) ); |
|
458 | + )); |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -466,10 +466,10 @@ discard block |
||
466 | 466 | * @return void |
467 | 467 | */ |
468 | 468 | public function children() { |
469 | - if ( empty( $this->args['children'] ) ) { |
|
470 | - $this->__set( 'post_parent', 0 ); |
|
469 | + if (empty($this->args['children'])) { |
|
470 | + $this->__set('post_parent', 0); |
|
471 | 471 | } |
472 | - $this->__unset( 'children' ); |
|
472 | + $this->__unset('children'); |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | /** |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | */ |
482 | 482 | public function give_forms() { |
483 | 483 | |
484 | - if ( empty( $this->args['give_forms'] ) ) { |
|
484 | + if (empty($this->args['give_forms'])) { |
|
485 | 485 | return; |
486 | 486 | } |
487 | 487 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $args = array( |
491 | 491 | // 'post_id' => $this->args['give_forms'], |
492 | 492 | 'log_type' => 'sale', |
493 | - 'post_status' => array( 'publish' ), |
|
493 | + 'post_status' => array('publish'), |
|
494 | 494 | 'nopaging' => true, |
495 | 495 | 'no_found_rows' => true, |
496 | 496 | 'update_post_term_cache' => false, |
@@ -499,31 +499,31 @@ discard block |
||
499 | 499 | 'fields' => 'ids' |
500 | 500 | ); |
501 | 501 | |
502 | - if ( is_array( $this->args['give_forms'] ) ) { |
|
503 | - unset( $args['post_parent'] ); |
|
502 | + if (is_array($this->args['give_forms'])) { |
|
503 | + unset($args['post_parent']); |
|
504 | 504 | $args['post_parent__in'] = $this->args['give_forms']; |
505 | 505 | } |
506 | 506 | |
507 | - $sales = $give_logs->get_connected_logs( $args ); |
|
507 | + $sales = $give_logs->get_connected_logs($args); |
|
508 | 508 | |
509 | - if ( ! empty( $sales ) ) { |
|
509 | + if ( ! empty($sales)) { |
|
510 | 510 | |
511 | 511 | $payments = array(); |
512 | 512 | |
513 | - foreach ( $sales as $sale ) { |
|
514 | - $payments[] = get_post_meta( $sale, '_give_log_payment_id', true ); |
|
513 | + foreach ($sales as $sale) { |
|
514 | + $payments[] = get_post_meta($sale, '_give_log_payment_id', true); |
|
515 | 515 | } |
516 | 516 | |
517 | - $this->__set( 'post__in', $payments ); |
|
517 | + $this->__set('post__in', $payments); |
|
518 | 518 | |
519 | 519 | } else { |
520 | 520 | |
521 | 521 | // Set post_parent to something crazy so it doesn't find anything |
522 | - $this->__set( 'post_parent', 999999999999999 ); |
|
522 | + $this->__set('post_parent', 999999999999999); |
|
523 | 523 | |
524 | 524 | } |
525 | 525 | |
526 | - $this->__unset( 'give_forms' ); |
|
526 | + $this->__unset('give_forms'); |
|
527 | 527 | |
528 | 528 | } |
529 | 529 | } |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Payments Query |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Classes/Stats |
|
7 | - * @copyright Copyright (c) 2015, WordImpress |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.0 |
|
10 | - */ |
|
3 | + * Payments Query |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Classes/Stats |
|
7 | + * @copyright Copyright (c) 2015, WordImpress |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | |
13 | 13 | /** |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Post Type Functions |
|
4 | - * |
|
5 | - * @package Give |
|
6 | - * @subpackage Functions |
|
7 | - * @copyright Copyright (c) 2015, WordImpress |
|
8 | - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | - * @since 1.0 |
|
10 | - */ |
|
3 | + * Post Type Functions |
|
4 | + * |
|
5 | + * @package Give |
|
6 | + * @subpackage Functions |
|
7 | + * @copyright Copyright (c) 2015, WordImpress |
|
8 | + * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
|
9 | + * @since 1.0 |
|
10 | + */ |
|
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | 13 | if ( ! defined( 'ABSPATH' ) ) { |
@@ -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,40 +23,40 @@ discard block |
||
23 | 23 | function give_setup_post_types() { |
24 | 24 | |
25 | 25 | /** Give Forms Post Type */ |
26 | - $give_forms_singular = give_get_option( 'disable_forms_singular' ) !== 'on' ? true : false; |
|
26 | + $give_forms_singular = give_get_option('disable_forms_singular') !== 'on' ? true : false; |
|
27 | 27 | |
28 | - $give_forms_archives = give_get_option( 'disable_forms_archives' ) !== 'on' ? true : false; |
|
28 | + $give_forms_archives = give_get_option('disable_forms_archives') !== 'on' ? true : false; |
|
29 | 29 | |
30 | - $give_forms_slug = defined( 'GIVE_SLUG' ) ? GIVE_SLUG : 'donations'; |
|
30 | + $give_forms_slug = defined('GIVE_SLUG') ? GIVE_SLUG : 'donations'; |
|
31 | 31 | //support for old 'GIVE_FORMS_SLUG' constant |
32 | - if ( defined( 'GIVE_FORMS_SLUG' ) ) { |
|
32 | + if (defined('GIVE_FORMS_SLUG')) { |
|
33 | 33 | $give_forms_slug = GIVE_FORMS_SLUG; |
34 | 34 | } |
35 | 35 | |
36 | - $give_forms_rewrite = defined( 'GIVE_DISABLE_FORMS_REWRITE' ) && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
36 | + $give_forms_rewrite = defined('GIVE_DISABLE_FORMS_REWRITE') && GIVE_DISABLE_FORMS_REWRITE ? false : array( |
|
37 | 37 | 'slug' => $give_forms_slug, |
38 | 38 | 'with_front' => false |
39 | 39 | ); |
40 | 40 | |
41 | - $give_forms_labels = apply_filters( 'give_forms_labels', array( |
|
42 | - 'name' => __( 'Donation %2$s', 'give' ), |
|
41 | + $give_forms_labels = apply_filters('give_forms_labels', array( |
|
42 | + 'name' => __('Donation %2$s', 'give'), |
|
43 | 43 | 'singular_name' => '%1$s', |
44 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
45 | - 'add_new_item' => __( 'Add New Donation %1$s', 'give' ), |
|
46 | - 'edit_item' => __( 'Edit Donation %1$s', 'give' ), |
|
47 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
48 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
49 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
50 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
51 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
52 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
44 | + 'add_new' => __('Add %1$s', 'give'), |
|
45 | + 'add_new_item' => __('Add New Donation %1$s', 'give'), |
|
46 | + 'edit_item' => __('Edit Donation %1$s', 'give'), |
|
47 | + 'new_item' => __('New %1$s', 'give'), |
|
48 | + 'all_items' => __('All %2$s', 'give'), |
|
49 | + 'view_item' => __('View %1$s', 'give'), |
|
50 | + 'search_items' => __('Search %2$s', 'give'), |
|
51 | + 'not_found' => __('No %2$s found', 'give'), |
|
52 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
53 | 53 | 'parent_item_colon' => '', |
54 | - 'menu_name' => apply_filters( 'give_menu_name', __( 'Donations', 'give' ) ), |
|
55 | - 'name_admin_bar' => apply_filters( 'give_name_admin_bar_name', __( 'Donation Form', 'give' ) ) |
|
56 | - ) ); |
|
54 | + 'menu_name' => apply_filters('give_menu_name', __('Donations', 'give')), |
|
55 | + 'name_admin_bar' => apply_filters('give_name_admin_bar_name', __('Donation Form', 'give')) |
|
56 | + )); |
|
57 | 57 | |
58 | - foreach ( $give_forms_labels as $key => $value ) { |
|
59 | - $give_forms_labels[ $key ] = sprintf( $value, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
58 | + foreach ($give_forms_labels as $key => $value) { |
|
59 | + $give_forms_labels[$key] = sprintf($value, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | //Default give_forms supports |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | ); |
70 | 70 | |
71 | 71 | //Has the user disabled the excerpt |
72 | - if ( give_get_option( 'disable_forms_excerpt' ) === 'on' ) { |
|
73 | - unset( $give_form_supports[2] ); |
|
72 | + if (give_get_option('disable_forms_excerpt') === 'on') { |
|
73 | + unset($give_form_supports[2]); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | //Has user disabled the featured image? |
77 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
78 | - unset( $give_form_supports[1] ); |
|
79 | - remove_action( 'give_before_single_form_summary', 'give_show_form_images' ); |
|
77 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
78 | + unset($give_form_supports[1]); |
|
79 | + remove_action('give_before_single_form_summary', 'give_show_form_images'); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $give_forms_args = array( |
@@ -92,36 +92,36 @@ discard block |
||
92 | 92 | 'has_archive' => $give_forms_archives, |
93 | 93 | 'menu_icon' => 'dashicons-give', |
94 | 94 | 'hierarchical' => false, |
95 | - 'supports' => apply_filters( 'give_forms_supports', $give_form_supports ), |
|
95 | + 'supports' => apply_filters('give_forms_supports', $give_form_supports), |
|
96 | 96 | ); |
97 | - register_post_type( 'give_forms', apply_filters( 'give_forms_post_type_args', $give_forms_args ) ); |
|
97 | + register_post_type('give_forms', apply_filters('give_forms_post_type_args', $give_forms_args)); |
|
98 | 98 | |
99 | 99 | |
100 | 100 | /** Give Campaigns Post Type */ |
101 | - $give_campaigns_archives = defined( 'GIVE_DISABLE_CAMPAIGNS_ARCHIVE' ) && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true; |
|
102 | - $give_campaigns_slug = defined( 'GIVE_CAMPAIGNS_SLUG' ) ? GIVE_CAMPAIGNS_SLUG : 'campaigns'; |
|
103 | - $give_campaigns_rewrite = defined( 'GIVE_DISABLE_CAMPAIGNS_REWRITE' ) && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array( |
|
101 | + $give_campaigns_archives = defined('GIVE_DISABLE_CAMPAIGNS_ARCHIVE') && GIVE_DISABLE_CAMPAIGNS_ARCHIVE ? false : true; |
|
102 | + $give_campaigns_slug = defined('GIVE_CAMPAIGNS_SLUG') ? GIVE_CAMPAIGNS_SLUG : 'campaigns'; |
|
103 | + $give_campaigns_rewrite = defined('GIVE_DISABLE_CAMPAIGNS_REWRITE') && GIVE_DISABLE_CAMPAIGNS_REWRITE ? false : array( |
|
104 | 104 | 'slug' => $give_campaigns_slug, |
105 | 105 | 'with_front' => false |
106 | 106 | ); |
107 | 107 | |
108 | - $give_campaigns_labels = apply_filters( 'give_campaign_labels', array( |
|
108 | + $give_campaigns_labels = apply_filters('give_campaign_labels', array( |
|
109 | 109 | 'name' => '%2$s', |
110 | 110 | 'singular_name' => '%1$s', |
111 | - 'add_new' => __( 'Add %1$s', 'give' ), |
|
112 | - 'add_new_item' => __( 'Add New %1$s', 'give' ), |
|
113 | - 'edit_item' => __( 'Edit %1$s', 'give' ), |
|
114 | - 'new_item' => __( 'New %1$s', 'give' ), |
|
115 | - 'all_items' => __( 'All %2$s', 'give' ), |
|
116 | - 'view_item' => __( 'View %1$s', 'give' ), |
|
117 | - 'search_items' => __( 'Search %2$s', 'give' ), |
|
118 | - 'not_found' => __( 'No %2$s found', 'give' ), |
|
119 | - 'not_found_in_trash' => __( 'No %2$s found in Trash', 'give' ), |
|
111 | + 'add_new' => __('Add %1$s', 'give'), |
|
112 | + 'add_new_item' => __('Add New %1$s', 'give'), |
|
113 | + 'edit_item' => __('Edit %1$s', 'give'), |
|
114 | + 'new_item' => __('New %1$s', 'give'), |
|
115 | + 'all_items' => __('All %2$s', 'give'), |
|
116 | + 'view_item' => __('View %1$s', 'give'), |
|
117 | + 'search_items' => __('Search %2$s', 'give'), |
|
118 | + 'not_found' => __('No %2$s found', 'give'), |
|
119 | + 'not_found_in_trash' => __('No %2$s found in Trash', 'give'), |
|
120 | 120 | 'parent_item_colon' => '', |
121 | - ) ); |
|
121 | + )); |
|
122 | 122 | |
123 | - foreach ( $give_campaigns_labels as $key => $value ) { |
|
124 | - $give_campaigns_labels[ $key ] = sprintf( $value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural() ); |
|
123 | + foreach ($give_campaigns_labels as $key => $value) { |
|
124 | + $give_campaigns_labels[$key] = sprintf($value, give_get_campaigns_label_singular(), give_get_campaigns_label_plural()); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | $give_campaigns_args = array( |
@@ -136,48 +136,48 @@ discard block |
||
136 | 136 | 'capability_type' => 'give_campaigns', |
137 | 137 | 'has_archive' => $give_campaigns_archives, |
138 | 138 | 'hierarchical' => false, |
139 | - 'supports' => apply_filters( 'give_campaigns_supports', array( |
|
139 | + 'supports' => apply_filters('give_campaigns_supports', array( |
|
140 | 140 | 'title', |
141 | 141 | 'thumbnail', |
142 | 142 | 'excerpt', |
143 | 143 | 'revisions', |
144 | 144 | 'author' |
145 | - ) ), |
|
145 | + )), |
|
146 | 146 | ); |
147 | 147 | // register_post_type( 'give_campaigns', apply_filters( 'give_campaigns_post_type_args', $give_campaigns_args ) ); |
148 | 148 | |
149 | 149 | /** Payment Post Type */ |
150 | 150 | $payment_labels = array( |
151 | - 'name' => _x( 'Donations', 'post type general name', 'give' ), |
|
152 | - 'singular_name' => _x( 'Donation', 'post type singular name', 'give' ), |
|
153 | - 'add_new' => __( 'Add New', 'give' ), |
|
154 | - 'add_new_item' => __( 'Add New Donation', 'give' ), |
|
155 | - 'edit_item' => __( 'Edit Donation', 'give' ), |
|
156 | - 'new_item' => __( 'New Donation', 'give' ), |
|
157 | - 'all_items' => __( 'All Donations', 'give' ), |
|
158 | - 'view_item' => __( 'View Donation', 'give' ), |
|
159 | - 'search_items' => __( 'Search Donations', 'give' ), |
|
160 | - 'not_found' => __( 'No Donations found', 'give' ), |
|
161 | - 'not_found_in_trash' => __( 'No Donations found in Trash', 'give' ), |
|
151 | + 'name' => _x('Donations', 'post type general name', 'give'), |
|
152 | + 'singular_name' => _x('Donation', 'post type singular name', 'give'), |
|
153 | + 'add_new' => __('Add New', 'give'), |
|
154 | + 'add_new_item' => __('Add New Donation', 'give'), |
|
155 | + 'edit_item' => __('Edit Donation', 'give'), |
|
156 | + 'new_item' => __('New Donation', 'give'), |
|
157 | + 'all_items' => __('All Donations', 'give'), |
|
158 | + 'view_item' => __('View Donation', 'give'), |
|
159 | + 'search_items' => __('Search Donations', 'give'), |
|
160 | + 'not_found' => __('No Donations found', 'give'), |
|
161 | + 'not_found_in_trash' => __('No Donations found in Trash', 'give'), |
|
162 | 162 | 'parent_item_colon' => '', |
163 | - 'menu_name' => __( 'Transactions', 'give' ) |
|
163 | + 'menu_name' => __('Transactions', 'give') |
|
164 | 164 | ); |
165 | 165 | |
166 | 166 | $payment_args = array( |
167 | - 'labels' => apply_filters( 'give_payment_labels', $payment_labels ), |
|
167 | + 'labels' => apply_filters('give_payment_labels', $payment_labels), |
|
168 | 168 | 'public' => false, |
169 | 169 | 'query_var' => false, |
170 | 170 | 'rewrite' => false, |
171 | 171 | 'map_meta_cap' => true, |
172 | 172 | 'capability_type' => 'give_payment', |
173 | - 'supports' => array( 'title' ), |
|
173 | + 'supports' => array('title'), |
|
174 | 174 | 'can_export' => true |
175 | 175 | ); |
176 | - register_post_type( 'give_payment', $payment_args ); |
|
176 | + register_post_type('give_payment', $payment_args); |
|
177 | 177 | |
178 | 178 | } |
179 | 179 | |
180 | -add_action( 'init', 'give_setup_post_types', 1 ); |
|
180 | +add_action('init', 'give_setup_post_types', 1); |
|
181 | 181 | |
182 | 182 | |
183 | 183 | /** |
@@ -190,30 +190,30 @@ discard block |
||
190 | 190 | */ |
191 | 191 | function give_setup_taxonomies() { |
192 | 192 | |
193 | - $slug = defined( 'GIVE_FORMS_SLUG' ) ? GIVE_FORMS_SLUG : 'donations'; |
|
193 | + $slug = defined('GIVE_FORMS_SLUG') ? GIVE_FORMS_SLUG : 'donations'; |
|
194 | 194 | |
195 | 195 | /** Categories */ |
196 | 196 | $category_labels = array( |
197 | - 'name' => sprintf( _x( '%s Categories', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
198 | - 'singular_name' => _x( 'Category', 'taxonomy singular name', 'give' ), |
|
199 | - 'search_items' => __( 'Search Categories', 'give' ), |
|
200 | - 'all_items' => __( 'All Categories', 'give' ), |
|
201 | - 'parent_item' => __( 'Parent Category', 'give' ), |
|
202 | - 'parent_item_colon' => __( 'Parent Category:', 'give' ), |
|
203 | - 'edit_item' => __( 'Edit Category', 'give' ), |
|
204 | - 'update_item' => __( 'Update Category', 'give' ), |
|
205 | - 'add_new_item' => sprintf( __( 'Add New %s Category', 'give' ), give_get_forms_label_singular() ), |
|
206 | - 'new_item_name' => __( 'New Category Name', 'give' ), |
|
207 | - 'menu_name' => __( 'Categories', 'give' ), |
|
197 | + 'name' => sprintf(_x('%s Categories', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
198 | + 'singular_name' => _x('Category', 'taxonomy singular name', 'give'), |
|
199 | + 'search_items' => __('Search Categories', 'give'), |
|
200 | + 'all_items' => __('All Categories', 'give'), |
|
201 | + 'parent_item' => __('Parent Category', 'give'), |
|
202 | + 'parent_item_colon' => __('Parent Category:', 'give'), |
|
203 | + 'edit_item' => __('Edit Category', 'give'), |
|
204 | + 'update_item' => __('Update Category', 'give'), |
|
205 | + 'add_new_item' => sprintf(__('Add New %s Category', 'give'), give_get_forms_label_singular()), |
|
206 | + 'new_item_name' => __('New Category Name', 'give'), |
|
207 | + 'menu_name' => __('Categories', 'give'), |
|
208 | 208 | ); |
209 | 209 | |
210 | - $category_args = apply_filters( 'give_forms_category_args', array( |
|
210 | + $category_args = apply_filters('give_forms_category_args', array( |
|
211 | 211 | 'hierarchical' => true, |
212 | - 'labels' => apply_filters( 'give_forms_category_labels', $category_labels ), |
|
212 | + 'labels' => apply_filters('give_forms_category_labels', $category_labels), |
|
213 | 213 | 'show_ui' => true, |
214 | 214 | 'query_var' => 'give_forms_category', |
215 | 215 | 'rewrite' => array( |
216 | - 'slug' => $slug . '/category', |
|
216 | + 'slug' => $slug.'/category', |
|
217 | 217 | 'with_front' => false, |
218 | 218 | 'hierarchical' => true |
219 | 219 | ), |
@@ -227,34 +227,34 @@ discard block |
||
227 | 227 | ); |
228 | 228 | |
229 | 229 | //Does the user want categories? |
230 | - if ( give_get_option( 'enable_categories' ) == 'on' ) { |
|
231 | - register_taxonomy( 'give_forms_category', array( 'give_forms' ), $category_args ); |
|
232 | - register_taxonomy_for_object_type( 'give_forms_category', 'give_forms' ); |
|
230 | + if (give_get_option('enable_categories') == 'on') { |
|
231 | + register_taxonomy('give_forms_category', array('give_forms'), $category_args); |
|
232 | + register_taxonomy_for_object_type('give_forms_category', 'give_forms'); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | |
236 | 236 | /** Tags */ |
237 | 237 | $tag_labels = array( |
238 | - 'name' => sprintf( _x( '%s Tags', 'taxonomy general name', 'give' ), give_get_forms_label_singular() ), |
|
239 | - 'singular_name' => _x( 'Tag', 'taxonomy singular name', 'give' ), |
|
240 | - 'search_items' => __( 'Search Tags', 'give' ), |
|
241 | - 'all_items' => __( 'All Tags', 'give' ), |
|
242 | - 'parent_item' => __( 'Parent Tag', 'give' ), |
|
243 | - 'parent_item_colon' => __( 'Parent Tag:', 'give' ), |
|
244 | - 'edit_item' => __( 'Edit Tag', 'give' ), |
|
245 | - 'update_item' => __( 'Update Tag', 'give' ), |
|
246 | - 'add_new_item' => __( 'Add New Tag', 'give' ), |
|
247 | - 'new_item_name' => __( 'New Tag Name', 'give' ), |
|
248 | - 'menu_name' => __( 'Tags', 'give' ), |
|
249 | - 'choose_from_most_used' => sprintf( __( 'Choose from most used %s tags', 'give' ), give_get_forms_label_singular() ), |
|
238 | + 'name' => sprintf(_x('%s Tags', 'taxonomy general name', 'give'), give_get_forms_label_singular()), |
|
239 | + 'singular_name' => _x('Tag', 'taxonomy singular name', 'give'), |
|
240 | + 'search_items' => __('Search Tags', 'give'), |
|
241 | + 'all_items' => __('All Tags', 'give'), |
|
242 | + 'parent_item' => __('Parent Tag', 'give'), |
|
243 | + 'parent_item_colon' => __('Parent Tag:', 'give'), |
|
244 | + 'edit_item' => __('Edit Tag', 'give'), |
|
245 | + 'update_item' => __('Update Tag', 'give'), |
|
246 | + 'add_new_item' => __('Add New Tag', 'give'), |
|
247 | + 'new_item_name' => __('New Tag Name', 'give'), |
|
248 | + 'menu_name' => __('Tags', 'give'), |
|
249 | + 'choose_from_most_used' => sprintf(__('Choose from most used %s tags', 'give'), give_get_forms_label_singular()), |
|
250 | 250 | ); |
251 | 251 | |
252 | - $tag_args = apply_filters( 'give_forms_tag_args', array( |
|
252 | + $tag_args = apply_filters('give_forms_tag_args', array( |
|
253 | 253 | 'hierarchical' => false, |
254 | - 'labels' => apply_filters( 'give_forms_tag_labels', $tag_labels ), |
|
254 | + 'labels' => apply_filters('give_forms_tag_labels', $tag_labels), |
|
255 | 255 | 'show_ui' => true, |
256 | 256 | 'query_var' => 'give_forms_tag', |
257 | - 'rewrite' => array( 'slug' => $slug . '/tag', 'with_front' => false, 'hierarchical' => true ), |
|
257 | + 'rewrite' => array('slug' => $slug.'/tag', 'with_front' => false, 'hierarchical' => true), |
|
258 | 258 | 'capabilities' => array( |
259 | 259 | 'manage_terms' => 'manage_give_forms_terms', |
260 | 260 | 'edit_terms' => 'edit_give_forms_terms', |
@@ -265,15 +265,15 @@ discard block |
||
265 | 265 | ) |
266 | 266 | ); |
267 | 267 | |
268 | - if ( give_get_option( 'enable_tags' ) == 'on' ) { |
|
269 | - register_taxonomy( 'give_forms_tag', array( 'give_forms' ), $tag_args ); |
|
270 | - register_taxonomy_for_object_type( 'give_forms_tag', 'give_forms' ); |
|
268 | + if (give_get_option('enable_tags') == 'on') { |
|
269 | + register_taxonomy('give_forms_tag', array('give_forms'), $tag_args); |
|
270 | + register_taxonomy_for_object_type('give_forms_tag', 'give_forms'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
274 | 274 | } |
275 | 275 | |
276 | -add_action( 'init', 'give_setup_taxonomies', 0 ); |
|
276 | +add_action('init', 'give_setup_taxonomies', 0); |
|
277 | 277 | |
278 | 278 | |
279 | 279 | /** |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | */ |
285 | 285 | function give_get_default_form_labels() { |
286 | 286 | $defaults = array( |
287 | - 'singular' => __( 'Form', 'give' ), |
|
288 | - 'plural' => __( 'Forms', 'give' ) |
|
287 | + 'singular' => __('Form', 'give'), |
|
288 | + 'plural' => __('Forms', 'give') |
|
289 | 289 | ); |
290 | 290 | |
291 | - return apply_filters( 'give_default_form_name', $defaults ); |
|
291 | + return apply_filters('give_default_form_name', $defaults); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | /** |
@@ -299,11 +299,11 @@ discard block |
||
299 | 299 | */ |
300 | 300 | function give_get_default_campaign_labels() { |
301 | 301 | $defaults = array( |
302 | - 'singular' => __( 'Campaign', 'give' ), |
|
303 | - 'plural' => __( 'Campaigns', 'give' ) |
|
302 | + 'singular' => __('Campaign', 'give'), |
|
303 | + 'plural' => __('Campaigns', 'give') |
|
304 | 304 | ); |
305 | 305 | |
306 | - return apply_filters( 'give_default_campaign_name', $defaults ); |
|
306 | + return apply_filters('give_default_campaign_name', $defaults); |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -315,10 +315,10 @@ discard block |
||
315 | 315 | * |
316 | 316 | * @return string $defaults['singular'] Singular label |
317 | 317 | */ |
318 | -function give_get_forms_label_singular( $lowercase = false ) { |
|
318 | +function give_get_forms_label_singular($lowercase = false) { |
|
319 | 319 | $defaults = give_get_default_form_labels(); |
320 | 320 | |
321 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
321 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -327,10 +327,10 @@ discard block |
||
327 | 327 | * @since 1.0 |
328 | 328 | * @return string $defaults['plural'] Plural label |
329 | 329 | */ |
330 | -function give_get_forms_label_plural( $lowercase = false ) { |
|
330 | +function give_get_forms_label_plural($lowercase = false) { |
|
331 | 331 | $defaults = give_get_default_form_labels(); |
332 | 332 | |
333 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
333 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | /** |
@@ -342,10 +342,10 @@ discard block |
||
342 | 342 | * |
343 | 343 | * @return string $defaults['singular'] Singular label |
344 | 344 | */ |
345 | -function give_get_campaigns_label_singular( $lowercase = false ) { |
|
345 | +function give_get_campaigns_label_singular($lowercase = false) { |
|
346 | 346 | $defaults = give_get_default_campaign_labels(); |
347 | 347 | |
348 | - return ( $lowercase ) ? strtolower( $defaults['singular'] ) : $defaults['singular']; |
|
348 | + return ($lowercase) ? strtolower($defaults['singular']) : $defaults['singular']; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | * @since 1.0 |
355 | 355 | * @return string $defaults['plural'] Plural label |
356 | 356 | */ |
357 | -function give_get_campaigns_label_plural( $lowercase = false ) { |
|
357 | +function give_get_campaigns_label_plural($lowercase = false) { |
|
358 | 358 | $defaults = give_get_default_campaign_labels(); |
359 | 359 | |
360 | - return ( $lowercase ) ? strtolower( $defaults['plural'] ) : $defaults['plural']; |
|
360 | + return ($lowercase) ? strtolower($defaults['plural']) : $defaults['plural']; |
|
361 | 361 | } |
362 | 362 | |
363 | 363 | /** |
@@ -369,26 +369,26 @@ discard block |
||
369 | 369 | * |
370 | 370 | * @return string $title New placeholder text |
371 | 371 | */ |
372 | -function give_change_default_title( $title ) { |
|
372 | +function give_change_default_title($title) { |
|
373 | 373 | // If a frontend plugin uses this filter (check extensions before changing this function) |
374 | - if ( ! is_admin() ) { |
|
374 | + if ( ! is_admin()) { |
|
375 | 375 | $label = give_get_forms_label_singular(); |
376 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
376 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
377 | 377 | |
378 | 378 | return $title; |
379 | 379 | } |
380 | 380 | |
381 | 381 | $screen = get_current_screen(); |
382 | 382 | |
383 | - if ( 'give_forms' == $screen->post_type ) { |
|
383 | + if ('give_forms' == $screen->post_type) { |
|
384 | 384 | $label = give_get_forms_label_singular(); |
385 | - $title = sprintf( __( 'Enter %s title here', 'give' ), $label ); |
|
385 | + $title = sprintf(__('Enter %s title here', 'give'), $label); |
|
386 | 386 | } |
387 | 387 | |
388 | 388 | return $title; |
389 | 389 | } |
390 | 390 | |
391 | -add_filter( 'enter_title_here', 'give_change_default_title' ); |
|
391 | +add_filter('enter_title_here', 'give_change_default_title'); |
|
392 | 392 | |
393 | 393 | /** |
394 | 394 | * Registers Custom Post Statuses which are used by the Payments |
@@ -398,42 +398,42 @@ discard block |
||
398 | 398 | */ |
399 | 399 | function give_register_post_type_statuses() { |
400 | 400 | // Payment Statuses |
401 | - register_post_status( 'refunded', array( |
|
402 | - 'label' => _x( 'Refunded', 'Refunded payment status', 'give' ), |
|
401 | + register_post_status('refunded', array( |
|
402 | + 'label' => _x('Refunded', 'Refunded payment status', 'give'), |
|
403 | 403 | 'public' => true, |
404 | 404 | 'exclude_from_search' => false, |
405 | 405 | 'show_in_admin_all_list' => true, |
406 | 406 | 'show_in_admin_status_list' => true, |
407 | - 'label_count' => _n_noop( 'Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give' ) |
|
408 | - ) ); |
|
409 | - register_post_status( 'failed', array( |
|
410 | - 'label' => _x( 'Failed', 'Failed payment status', 'give' ), |
|
407 | + 'label_count' => _n_noop('Refunded <span class="count">(%s)</span>', 'Refunded <span class="count">(%s)</span>', 'give') |
|
408 | + )); |
|
409 | + register_post_status('failed', array( |
|
410 | + 'label' => _x('Failed', 'Failed payment status', 'give'), |
|
411 | 411 | 'public' => true, |
412 | 412 | 'exclude_from_search' => false, |
413 | 413 | 'show_in_admin_all_list' => true, |
414 | 414 | 'show_in_admin_status_list' => true, |
415 | - 'label_count' => _n_noop( 'Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give' ) |
|
416 | - ) ); |
|
417 | - register_post_status( 'revoked', array( |
|
418 | - 'label' => _x( 'Revoked', 'Revoked payment status', 'give' ), |
|
415 | + 'label_count' => _n_noop('Failed <span class="count">(%s)</span>', 'Failed <span class="count">(%s)</span>', 'give') |
|
416 | + )); |
|
417 | + register_post_status('revoked', array( |
|
418 | + 'label' => _x('Revoked', 'Revoked payment status', 'give'), |
|
419 | 419 | 'public' => true, |
420 | 420 | 'exclude_from_search' => false, |
421 | 421 | 'show_in_admin_all_list' => true, |
422 | 422 | 'show_in_admin_status_list' => true, |
423 | - 'label_count' => _n_noop( 'Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give' ) |
|
424 | - ) ); |
|
425 | - register_post_status( 'abandoned', array( |
|
426 | - 'label' => _x( 'Abandoned', 'Abandoned payment status', 'give' ), |
|
423 | + 'label_count' => _n_noop('Revoked <span class="count">(%s)</span>', 'Revoked <span class="count">(%s)</span>', 'give') |
|
424 | + )); |
|
425 | + register_post_status('abandoned', array( |
|
426 | + 'label' => _x('Abandoned', 'Abandoned payment status', 'give'), |
|
427 | 427 | 'public' => true, |
428 | 428 | 'exclude_from_search' => false, |
429 | 429 | 'show_in_admin_all_list' => true, |
430 | 430 | 'show_in_admin_status_list' => true, |
431 | - 'label_count' => _n_noop( 'Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give' ) |
|
432 | - ) ); |
|
431 | + 'label_count' => _n_noop('Abandoned <span class="count">(%s)</span>', 'Abandoned <span class="count">(%s)</span>', 'give') |
|
432 | + )); |
|
433 | 433 | |
434 | 434 | } |
435 | 435 | |
436 | -add_action( 'init', 'give_register_post_type_statuses' ); |
|
436 | +add_action('init', 'give_register_post_type_statuses'); |
|
437 | 437 | |
438 | 438 | /** |
439 | 439 | * Updated Messages |
@@ -446,45 +446,45 @@ discard block |
||
446 | 446 | * |
447 | 447 | * @return array $messages New post updated messages |
448 | 448 | */ |
449 | -function give_updated_messages( $messages ) { |
|
449 | +function give_updated_messages($messages) { |
|
450 | 450 | global $post, $post_ID; |
451 | 451 | |
452 | - $url1 = '<a href="' . get_permalink( $post_ID ) . '">'; |
|
452 | + $url1 = '<a href="'.get_permalink($post_ID).'">'; |
|
453 | 453 | $url2 = give_get_forms_label_singular(); |
454 | 454 | $url3 = '</a>'; |
455 | 455 | |
456 | 456 | $messages['give_forms'] = array( |
457 | - 1 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
458 | - 4 => sprintf( __( '%2$s updated. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
459 | - 6 => sprintf( __( '%2$s published. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
460 | - 7 => sprintf( __( '%2$s saved. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ), |
|
461 | - 8 => sprintf( __( '%2$s submitted. %1$sView %2$s%3$s.', 'give' ), $url1, $url2, $url3 ) |
|
457 | + 1 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
458 | + 4 => sprintf(__('%2$s updated. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
459 | + 6 => sprintf(__('%2$s published. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
460 | + 7 => sprintf(__('%2$s saved. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3), |
|
461 | + 8 => sprintf(__('%2$s submitted. %1$sView %2$s%3$s.', 'give'), $url1, $url2, $url3) |
|
462 | 462 | ); |
463 | 463 | |
464 | 464 | return $messages; |
465 | 465 | } |
466 | 466 | |
467 | -add_filter( 'post_updated_messages', 'give_updated_messages' ); |
|
467 | +add_filter('post_updated_messages', 'give_updated_messages'); |
|
468 | 468 | |
469 | 469 | |
470 | 470 | /** |
471 | 471 | * Setup Post Type Images |
472 | 472 | */ |
473 | -add_action( 'after_setup_theme', 'give_add_thumbnail_support', 10 ); |
|
474 | -add_action( 'after_setup_theme', 'give_add_image_sizes', 10 ); |
|
473 | +add_action('after_setup_theme', 'give_add_thumbnail_support', 10); |
|
474 | +add_action('after_setup_theme', 'give_add_image_sizes', 10); |
|
475 | 475 | |
476 | 476 | /** |
477 | 477 | * Ensure post thumbnail support is turned on |
478 | 478 | */ |
479 | 479 | function give_add_thumbnail_support() { |
480 | - if ( give_get_option( 'disable_form_featured_img' ) === 'on' ) { |
|
480 | + if (give_get_option('disable_form_featured_img') === 'on') { |
|
481 | 481 | return; |
482 | 482 | } |
483 | - if ( ! current_theme_supports( 'post-thumbnails' ) ) { |
|
484 | - add_theme_support( 'post-thumbnails' ); |
|
483 | + if ( ! current_theme_supports('post-thumbnails')) { |
|
484 | + add_theme_support('post-thumbnails'); |
|
485 | 485 | } |
486 | - add_post_type_support( 'give_forms', 'thumbnail' ); |
|
487 | - add_post_type_support( 'give_campaigns', 'thumbnail' ); |
|
486 | + add_post_type_support('give_forms', 'thumbnail'); |
|
487 | + add_post_type_support('give_campaigns', 'thumbnail'); |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | /** |
@@ -493,11 +493,11 @@ discard block |
||
493 | 493 | * @since 1.0 |
494 | 494 | */ |
495 | 495 | function give_add_image_sizes() { |
496 | - $give_form_thumbnail = give_get_image_size( 'give_form_thumbnail' ); |
|
497 | - $give_form_single = give_get_image_size( 'give_form_single' ); |
|
496 | + $give_form_thumbnail = give_get_image_size('give_form_thumbnail'); |
|
497 | + $give_form_single = give_get_image_size('give_form_single'); |
|
498 | 498 | |
499 | - add_image_size( 'give_form_thumbnail', $give_form_thumbnail['width'], $give_form_thumbnail['height'], $give_form_thumbnail['crop'] ); |
|
500 | - add_image_size( 'give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop'] ); |
|
499 | + add_image_size('give_form_thumbnail', $give_form_thumbnail['width'], $give_form_thumbnail['height'], $give_form_thumbnail['crop']); |
|
500 | + add_image_size('give_form_single', $give_form_single['width'], $give_form_single['height'], $give_form_single['crop']); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -509,19 +509,19 @@ discard block |
||
509 | 509 | function give_widgets_init() { |
510 | 510 | |
511 | 511 | //Single Give Forms (disabled if single turned off in settings) |
512 | - if ( give_get_option( 'disable_forms_singular' ) !== 'on' && give_get_option( 'disable_form_sidebar' ) !== 'on' ) { |
|
512 | + if (give_get_option('disable_forms_singular') !== 'on' && give_get_option('disable_form_sidebar') !== 'on') { |
|
513 | 513 | |
514 | - register_sidebar( apply_filters( 'give_forms_single_sidebar', array( |
|
515 | - 'name' => __( 'Give Single Form Sidebar', 'give' ), |
|
514 | + register_sidebar(apply_filters('give_forms_single_sidebar', array( |
|
515 | + 'name' => __('Give Single Form Sidebar', 'give'), |
|
516 | 516 | 'id' => 'give-forms-sidebar', |
517 | - 'description' => __( 'Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give' ), |
|
517 | + 'description' => __('Widgets in this area will be shown on the single Give forms aside area. This sidebar will not display for embedded forms.', 'give'), |
|
518 | 518 | 'before_widget' => '<div id="%1$s" class="widget %2$s">', |
519 | 519 | 'after_widget' => '</div>', |
520 | 520 | 'before_title' => '<h3 class="widgettitle widget-title">', |
521 | 521 | 'after_title' => '</h3>', |
522 | - ) ) ); |
|
522 | + ))); |
|
523 | 523 | |
524 | 524 | } |
525 | 525 | } |
526 | 526 | |
527 | -add_action( 'widgets_init', 'give_widgets_init', 999 ); |
|
528 | 527 | \ No newline at end of file |
528 | +add_action('widgets_init', 'give_widgets_init', 999); |
|
529 | 529 | \ No newline at end of file |
@@ -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 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 | |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return string $default_price |
69 | 69 | */ |
70 | -function give_get_default_multilevel_amount( $form_id ) { |
|
70 | +function give_get_default_multilevel_amount($form_id) { |
|
71 | 71 | $default_price = '1.00'; |
72 | - $prices = apply_filters( 'give_form_variable_prices', give_get_variable_prices( $form_id ), $form_id ); |
|
72 | + $prices = apply_filters('give_form_variable_prices', give_get_variable_prices($form_id), $form_id); |
|
73 | 73 | |
74 | - foreach ( $prices as $price ) { |
|
74 | + foreach ($prices as $price) { |
|
75 | 75 | |
76 | - if ( isset( $price['_give_default'] ) && $price['_give_default'] === 'default' ) { |
|
76 | + if (isset($price['_give_default']) && $price['_give_default'] === 'default') { |
|
77 | 77 | $default_price = $price['_give_amount']; |
78 | 78 | } |
79 | 79 | |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | * @return string $default_price |
95 | 95 | * @since 1.0 |
96 | 96 | */ |
97 | -function give_get_default_form_amount( $form_id ) { |
|
97 | +function give_get_default_form_amount($form_id) { |
|
98 | 98 | |
99 | - if ( give_has_variable_prices( $form_id ) ) { |
|
99 | + if (give_has_variable_prices($form_id)) { |
|
100 | 100 | |
101 | - $default_amount = give_get_default_multilevel_amount( $form_id ); |
|
101 | + $default_amount = give_get_default_multilevel_amount($form_id); |
|
102 | 102 | |
103 | 103 | } else { |
104 | 104 | |
105 | - $default_amount = get_post_meta( $form_id, '_give_set_price', true ); |
|
105 | + $default_amount = get_post_meta($form_id, '_give_set_price', true); |
|
106 | 106 | |
107 | 107 | } |
108 | 108 |
@@ -79,7 +79,7 @@ |
||
79 | 79 | |
80 | 80 | //validate display_style and float_labels value |
81 | 81 | if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
82 | + || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
83 | 83 | ) { |
84 | 84 | |
85 | 85 | $atts[ $key ] = ''; |
@@ -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 | |
@@ -24,17 +24,17 @@ discard block |
||
24 | 24 | * @return string |
25 | 25 | */ |
26 | 26 | function give_donation_history() { |
27 | - if ( is_user_logged_in() ) { |
|
27 | + if (is_user_logged_in()) { |
|
28 | 28 | ob_start(); |
29 | - give_get_template_part( 'history', 'donations' ); |
|
29 | + give_get_template_part('history', 'donations'); |
|
30 | 30 | |
31 | 31 | return ob_get_clean(); |
32 | 32 | } else { |
33 | - echo apply_filters( 'give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>' . __( 'You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give' ) . '</p></div>' ); |
|
33 | + echo apply_filters('give_donation_history_nonuser_message', '<div class="give_error give_warning"><p>'.__('You must be logged in to view your donation history. Please login using your account or create an account using the same email you used to donate with.', 'give').'</p></div>'); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | |
37 | -add_shortcode( 'donation_history', 'give_donation_history' ); |
|
37 | +add_shortcode('donation_history', 'give_donation_history'); |
|
38 | 38 | |
39 | 39 | /** |
40 | 40 | * Donation Form Shortcode |
@@ -48,53 +48,53 @@ discard block |
||
48 | 48 | * |
49 | 49 | * @return string |
50 | 50 | */ |
51 | -function give_form_shortcode( $atts, $content = null ) { |
|
52 | - $atts = shortcode_atts( array( |
|
51 | +function give_form_shortcode($atts, $content = null) { |
|
52 | + $atts = shortcode_atts(array( |
|
53 | 53 | 'id' => '', |
54 | 54 | 'show_title' => true, |
55 | 55 | 'show_goal' => true, |
56 | 56 | 'show_content' => '', |
57 | 57 | 'float_labels' => '', |
58 | 58 | 'display_style' => '', |
59 | - ), $atts, 'give_form' ); |
|
59 | + ), $atts, 'give_form'); |
|
60 | 60 | |
61 | - foreach ( $atts as $key => $value ) { |
|
61 | + foreach ($atts as $key => $value) { |
|
62 | 62 | //convert shortcode_atts values to booleans |
63 | - if ( $key == 'show_title' ) { |
|
64 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
65 | - } elseif ( $key == 'show_goal' ) { |
|
66 | - $atts[ $key ] = filter_var( $atts[ $key ], FILTER_VALIDATE_BOOLEAN ); |
|
63 | + if ($key == 'show_title') { |
|
64 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
65 | + } elseif ($key == 'show_goal') { |
|
66 | + $atts[$key] = filter_var($atts[$key], FILTER_VALIDATE_BOOLEAN); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | //validate show_content value |
70 | - if ( $key == 'show_content' ) { |
|
71 | - if ( ! in_array( $value, array( 'none', 'above', 'below' ) ) ) { |
|
72 | - $atts[ $key ] = ''; |
|
73 | - } else if ( $value == 'above' ) { |
|
74 | - $atts[ $key ] = 'give_pre_form'; |
|
75 | - } else if ( $value == 'below' ) { |
|
76 | - $atts[ $key ] = 'give_post_form'; |
|
70 | + if ($key == 'show_content') { |
|
71 | + if ( ! in_array($value, array('none', 'above', 'below'))) { |
|
72 | + $atts[$key] = ''; |
|
73 | + } else if ($value == 'above') { |
|
74 | + $atts[$key] = 'give_pre_form'; |
|
75 | + } else if ($value == 'below') { |
|
76 | + $atts[$key] = 'give_post_form'; |
|
77 | 77 | } |
78 | 78 | } |
79 | 79 | |
80 | 80 | //validate display_style and float_labels value |
81 | - if ( ( $key == 'display_style' && ! in_array( $value, array( 'onpage', 'reveal', 'modal' ) ) ) |
|
82 | - || ( $key == 'float_labels' && ! in_array( $value, array( 'enabled', 'disabled' ) ) ) |
|
81 | + if (($key == 'display_style' && ! in_array($value, array('onpage', 'reveal', 'modal'))) |
|
82 | + || ($key == 'float_labels' && ! in_array($value, array('enabled', 'disabled'))) |
|
83 | 83 | ) { |
84 | 84 | |
85 | - $atts[ $key ] = ''; |
|
85 | + $atts[$key] = ''; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | |
89 | 89 | //get the Give Form |
90 | 90 | ob_start(); |
91 | - give_get_donation_form( $atts ); |
|
91 | + give_get_donation_form($atts); |
|
92 | 92 | $final_output = ob_get_clean(); |
93 | 93 | |
94 | - return apply_filters( 'give_donate_form', $final_output, $atts ); |
|
94 | + return apply_filters('give_donate_form', $final_output, $atts); |
|
95 | 95 | } |
96 | 96 | |
97 | -add_shortcode( 'give_form', 'give_form_shortcode' ); |
|
97 | +add_shortcode('give_form', 'give_form_shortcode'); |
|
98 | 98 | |
99 | 99 | /** |
100 | 100 | * Donation Form Goal Shortcode |
@@ -108,37 +108,37 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @return string |
110 | 110 | */ |
111 | -function give_goal_shortcode( $atts, $content = null ) { |
|
112 | - $atts = shortcode_atts( array( |
|
111 | +function give_goal_shortcode($atts, $content = null) { |
|
112 | + $atts = shortcode_atts(array( |
|
113 | 113 | 'id' => '', |
114 | 114 | 'show_text' => true, |
115 | 115 | 'show_bar' => true, |
116 | - ), $atts, 'give_goal' ); |
|
116 | + ), $atts, 'give_goal'); |
|
117 | 117 | |
118 | 118 | |
119 | 119 | //get the Give Form |
120 | 120 | ob_start(); |
121 | 121 | |
122 | 122 | //Sanity check 1: ensure there is an ID Provided |
123 | - if ( empty( $atts['id'] ) ) { |
|
124 | - give_output_error( __( 'Error: No Donation form ID for the shortcode provided.', 'give' ), true ); |
|
123 | + if (empty($atts['id'])) { |
|
124 | + give_output_error(__('Error: No Donation form ID for the shortcode provided.', 'give'), true); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | //Sanity check 2: Check that this form even has Goals enabled |
128 | - $goal_option = get_post_meta( $atts['id'], '_give_goal_option', true ); |
|
129 | - if ( empty( $goal_option ) || $goal_option !== 'yes' ) { |
|
130 | - give_output_error( __( 'Error: This form does not have Goals enabled.', 'give' ), true ); |
|
128 | + $goal_option = get_post_meta($atts['id'], '_give_goal_option', true); |
|
129 | + if (empty($goal_option) || $goal_option !== 'yes') { |
|
130 | + give_output_error(__('Error: This form does not have Goals enabled.', 'give'), true); |
|
131 | 131 | } else { |
132 | 132 | //Passed all sanity checks: output Goal |
133 | - give_show_goal_progress( $atts['id'], $atts ); |
|
133 | + give_show_goal_progress($atts['id'], $atts); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $final_output = ob_get_clean(); |
137 | 137 | |
138 | - return apply_filters( 'give_goal_shortcode_output', $final_output, $atts ); |
|
138 | + return apply_filters('give_goal_shortcode_output', $final_output, $atts); |
|
139 | 139 | } |
140 | 140 | |
141 | -add_shortcode( 'give_goal', 'give_goal_shortcode' ); |
|
141 | +add_shortcode('give_goal', 'give_goal_shortcode'); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | /** |
@@ -155,16 +155,16 @@ discard block |
||
155 | 155 | * @uses give_login_form() |
156 | 156 | * @return string |
157 | 157 | */ |
158 | -function give_login_form_shortcode( $atts, $content = null ) { |
|
159 | - extract( shortcode_atts( array( |
|
158 | +function give_login_form_shortcode($atts, $content = null) { |
|
159 | + extract(shortcode_atts(array( |
|
160 | 160 | 'redirect' => '', |
161 | - ), $atts, 'give_login' ) |
|
161 | + ), $atts, 'give_login') |
|
162 | 162 | ); |
163 | 163 | |
164 | - return give_login_form( $redirect ); |
|
164 | + return give_login_form($redirect); |
|
165 | 165 | } |
166 | 166 | |
167 | -add_shortcode( 'give_login', 'give_login_form_shortcode' ); |
|
167 | +add_shortcode('give_login', 'give_login_form_shortcode'); |
|
168 | 168 | |
169 | 169 | /** |
170 | 170 | * Register Shortcode |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | * @uses give_register_form() |
180 | 180 | * @return string |
181 | 181 | */ |
182 | -function give_register_form_shortcode( $atts, $content = null ) { |
|
183 | - extract( shortcode_atts( array( |
|
182 | +function give_register_form_shortcode($atts, $content = null) { |
|
183 | + extract(shortcode_atts(array( |
|
184 | 184 | 'redirect' => '', |
185 | - ), $atts, 'give_register' ) |
|
185 | + ), $atts, 'give_register') |
|
186 | 186 | ); |
187 | 187 | |
188 | - return give_register_form( $redirect ); |
|
188 | + return give_register_form($redirect); |
|
189 | 189 | } |
190 | 190 | |
191 | -add_shortcode( 'give_register', 'give_register_form_shortcode' ); |
|
191 | +add_shortcode('give_register', 'give_register_form_shortcode'); |
|
192 | 192 | |
193 | 193 | |
194 | 194 | /** |
@@ -203,48 +203,48 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return string |
205 | 205 | */ |
206 | -function give_receipt_shortcode( $atts, $content = null ) { |
|
206 | +function give_receipt_shortcode($atts, $content = null) { |
|
207 | 207 | |
208 | 208 | global $give_receipt_args; |
209 | 209 | |
210 | - $give_receipt_args = shortcode_atts( array( |
|
211 | - 'error' => __( 'Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give' ), |
|
210 | + $give_receipt_args = shortcode_atts(array( |
|
211 | + 'error' => __('Sorry, it appears the viewing window for this donation receipt has expired or you do not have the permission to view this donation receipt.', 'give'), |
|
212 | 212 | 'price' => true, |
213 | 213 | 'date' => true, |
214 | 214 | 'payment_key' => false, |
215 | 215 | 'payment_method' => true, |
216 | 216 | 'payment_id' => true |
217 | - ), $atts, 'give_receipt' ); |
|
217 | + ), $atts, 'give_receipt'); |
|
218 | 218 | |
219 | 219 | //set $session var |
220 | 220 | $session = give_get_purchase_session(); |
221 | 221 | |
222 | 222 | //set payment key var |
223 | - if ( isset( $_GET['payment_key'] ) ) { |
|
224 | - $payment_key = urldecode( $_GET['payment_key'] ); |
|
225 | - } elseif ( $session ) { |
|
223 | + if (isset($_GET['payment_key'])) { |
|
224 | + $payment_key = urldecode($_GET['payment_key']); |
|
225 | + } elseif ($session) { |
|
226 | 226 | $payment_key = $session['purchase_key']; |
227 | - } elseif ( $give_receipt_args['payment_key'] ) { |
|
227 | + } elseif ($give_receipt_args['payment_key']) { |
|
228 | 228 | $payment_key = $give_receipt_args['payment_key']; |
229 | 229 | } |
230 | 230 | |
231 | 231 | // No key found |
232 | - if ( ! isset( $payment_key ) ) { |
|
233 | - return '<div class="give_errors"><p class="give_error">' . $give_receipt_args['error'] . '</p></div>'; |
|
232 | + if ( ! isset($payment_key)) { |
|
233 | + return '<div class="give_errors"><p class="give_error">'.$give_receipt_args['error'].'</p></div>'; |
|
234 | 234 | } |
235 | 235 | |
236 | - $payment_id = give_get_purchase_id_by_key( $payment_key ); |
|
237 | - $user_can_view = give_can_view_receipt( $payment_key ); |
|
236 | + $payment_id = give_get_purchase_id_by_key($payment_key); |
|
237 | + $user_can_view = give_can_view_receipt($payment_key); |
|
238 | 238 | |
239 | 239 | // Key was provided, but user is logged out. Offer them the ability to login and view the receipt |
240 | - if ( ! $user_can_view && ! empty( $payment_key ) && ! is_user_logged_in() && ! give_is_guest_payment( $payment_id ) ) { |
|
240 | + if ( ! $user_can_view && ! empty($payment_key) && ! is_user_logged_in() && ! give_is_guest_payment($payment_id)) { |
|
241 | 241 | global $give_login_redirect; |
242 | 242 | $give_login_redirect = give_get_current_page_url(); |
243 | 243 | |
244 | 244 | ob_start(); |
245 | - echo '<div class="give_errors"><p class="give_error">' . __( 'You must be logged in to view this payment receipt.', 'give' ) . '</p></div>'; |
|
245 | + echo '<div class="give_errors"><p class="give_error">'.__('You must be logged in to view this payment receipt.', 'give').'</p></div>'; |
|
246 | 246 | |
247 | - give_get_template_part( 'shortcode', 'login' ); |
|
247 | + give_get_template_part('shortcode', 'login'); |
|
248 | 248 | |
249 | 249 | $login_form = ob_get_clean(); |
250 | 250 | |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | */ |
264 | 264 | |
265 | 265 | |
266 | - if ( ! apply_filters( 'give_user_can_view_receipt', $user_can_view, $give_receipt_args ) ) { |
|
267 | - return '<p class="edd-alert edd-alert-error">' . $give_receipt_args['error'] . '</p>'; |
|
266 | + if ( ! apply_filters('give_user_can_view_receipt', $user_can_view, $give_receipt_args)) { |
|
267 | + return '<p class="edd-alert edd-alert-error">'.$give_receipt_args['error'].'</p>'; |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | ob_start(); |
271 | 271 | |
272 | - give_get_template_part( 'shortcode', 'receipt' ); |
|
272 | + give_get_template_part('shortcode', 'receipt'); |
|
273 | 273 | |
274 | 274 | $display = ob_get_clean(); |
275 | 275 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | } |
280 | 280 | |
281 | -add_shortcode( 'give_receipt', 'give_receipt_shortcode' ); |
|
281 | +add_shortcode('give_receipt', 'give_receipt_shortcode'); |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * Profile Editor Shortcode |
@@ -298,18 +298,18 @@ discard block |
||
298 | 298 | * |
299 | 299 | * @return string Output generated from the profile editor |
300 | 300 | */ |
301 | -function give_profile_editor_shortcode( $atts, $content = null ) { |
|
301 | +function give_profile_editor_shortcode($atts, $content = null) { |
|
302 | 302 | |
303 | 303 | ob_start(); |
304 | 304 | |
305 | - give_get_template_part( 'shortcode', 'profile-editor' ); |
|
305 | + give_get_template_part('shortcode', 'profile-editor'); |
|
306 | 306 | |
307 | 307 | $display = ob_get_clean(); |
308 | 308 | |
309 | 309 | return $display; |
310 | 310 | } |
311 | 311 | |
312 | -add_shortcode( 'give_profile_editor', 'give_profile_editor_shortcode' ); |
|
312 | +add_shortcode('give_profile_editor', 'give_profile_editor_shortcode'); |
|
313 | 313 | |
314 | 314 | /** |
315 | 315 | * Process Profile Updater Form |
@@ -322,30 +322,30 @@ discard block |
||
322 | 322 | * |
323 | 323 | * @return false |
324 | 324 | */ |
325 | -function give_process_profile_editor_updates( $data ) { |
|
325 | +function give_process_profile_editor_updates($data) { |
|
326 | 326 | // Profile field change request |
327 | - if ( empty( $_POST['give_profile_editor_submit'] ) && ! is_user_logged_in() ) { |
|
327 | + if (empty($_POST['give_profile_editor_submit']) && ! is_user_logged_in()) { |
|
328 | 328 | return false; |
329 | 329 | } |
330 | 330 | |
331 | 331 | // Nonce security |
332 | - if ( ! wp_verify_nonce( $data['give_profile_editor_nonce'], 'give-profile-editor-nonce' ) ) { |
|
332 | + if ( ! wp_verify_nonce($data['give_profile_editor_nonce'], 'give-profile-editor-nonce')) { |
|
333 | 333 | return false; |
334 | 334 | } |
335 | 335 | |
336 | 336 | $user_id = get_current_user_id(); |
337 | - $old_user_data = get_userdata( $user_id ); |
|
338 | - |
|
339 | - $display_name = isset( $data['give_display_name'] ) ? sanitize_text_field( $data['give_display_name'] ) : $old_user_data->display_name; |
|
340 | - $first_name = isset( $data['give_first_name'] ) ? sanitize_text_field( $data['give_first_name'] ) : $old_user_data->first_name; |
|
341 | - $last_name = isset( $data['give_last_name'] ) ? sanitize_text_field( $data['give_last_name'] ) : $old_user_data->last_name; |
|
342 | - $email = isset( $data['give_email'] ) ? sanitize_email( $data['give_email'] ) : $old_user_data->user_email; |
|
343 | - $line1 = ( isset( $data['give_address_line1'] ) ? sanitize_text_field( $data['give_address_line1'] ) : '' ); |
|
344 | - $line2 = ( isset( $data['give_address_line2'] ) ? sanitize_text_field( $data['give_address_line2'] ) : '' ); |
|
345 | - $city = ( isset( $data['give_address_city'] ) ? sanitize_text_field( $data['give_address_city'] ) : '' ); |
|
346 | - $state = ( isset( $data['give_address_state'] ) ? sanitize_text_field( $data['give_address_state'] ) : '' ); |
|
347 | - $zip = ( isset( $data['give_address_zip'] ) ? sanitize_text_field( $data['give_address_zip'] ) : '' ); |
|
348 | - $country = ( isset( $data['give_address_country'] ) ? sanitize_text_field( $data['give_address_country'] ) : '' ); |
|
337 | + $old_user_data = get_userdata($user_id); |
|
338 | + |
|
339 | + $display_name = isset($data['give_display_name']) ? sanitize_text_field($data['give_display_name']) : $old_user_data->display_name; |
|
340 | + $first_name = isset($data['give_first_name']) ? sanitize_text_field($data['give_first_name']) : $old_user_data->first_name; |
|
341 | + $last_name = isset($data['give_last_name']) ? sanitize_text_field($data['give_last_name']) : $old_user_data->last_name; |
|
342 | + $email = isset($data['give_email']) ? sanitize_email($data['give_email']) : $old_user_data->user_email; |
|
343 | + $line1 = (isset($data['give_address_line1']) ? sanitize_text_field($data['give_address_line1']) : ''); |
|
344 | + $line2 = (isset($data['give_address_line2']) ? sanitize_text_field($data['give_address_line2']) : ''); |
|
345 | + $city = (isset($data['give_address_city']) ? sanitize_text_field($data['give_address_city']) : ''); |
|
346 | + $state = (isset($data['give_address_state']) ? sanitize_text_field($data['give_address_state']) : ''); |
|
347 | + $zip = (isset($data['give_address_zip']) ? sanitize_text_field($data['give_address_zip']) : ''); |
|
348 | + $country = (isset($data['give_address_country']) ? sanitize_text_field($data['give_address_country']) : ''); |
|
349 | 349 | |
350 | 350 | $userdata = array( |
351 | 351 | 'ID' => $user_id, |
@@ -365,45 +365,45 @@ discard block |
||
365 | 365 | 'country' => $country |
366 | 366 | ); |
367 | 367 | |
368 | - do_action( 'give_pre_update_user_profile', $user_id, $userdata ); |
|
368 | + do_action('give_pre_update_user_profile', $user_id, $userdata); |
|
369 | 369 | |
370 | 370 | // New password |
371 | - if ( ! empty( $data['give_new_user_pass1'] ) ) { |
|
372 | - if ( $data['give_new_user_pass1'] !== $data['give_new_user_pass2'] ) { |
|
373 | - give_set_error( 'password_mismatch', __( 'The passwords you entered do not match. Please try again.', 'give' ) ); |
|
371 | + if ( ! empty($data['give_new_user_pass1'])) { |
|
372 | + if ($data['give_new_user_pass1'] !== $data['give_new_user_pass2']) { |
|
373 | + give_set_error('password_mismatch', __('The passwords you entered do not match. Please try again.', 'give')); |
|
374 | 374 | } else { |
375 | 375 | $userdata['user_pass'] = $data['give_new_user_pass1']; |
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | 379 | // Make sure the new email doesn't belong to another user |
380 | - if ( $email != $old_user_data->user_email ) { |
|
381 | - if ( email_exists( $email ) ) { |
|
382 | - give_set_error( 'email_exists', __( 'The email you entered belongs to another user. Please use another.', 'give' ) ); |
|
380 | + if ($email != $old_user_data->user_email) { |
|
381 | + if (email_exists($email)) { |
|
382 | + give_set_error('email_exists', __('The email you entered belongs to another user. Please use another.', 'give')); |
|
383 | 383 | } |
384 | 384 | } |
385 | 385 | |
386 | 386 | // Check for errors |
387 | 387 | $errors = give_get_errors(); |
388 | 388 | |
389 | - if ( $errors ) { |
|
389 | + if ($errors) { |
|
390 | 390 | // Send back to the profile editor if there are errors |
391 | - wp_redirect( $data['give_redirect'] ); |
|
391 | + wp_redirect($data['give_redirect']); |
|
392 | 392 | give_die(); |
393 | 393 | } |
394 | 394 | |
395 | 395 | // Update the user |
396 | - $meta = update_user_meta( $user_id, '_give_user_address', $address ); |
|
397 | - $updated = wp_update_user( $userdata ); |
|
396 | + $meta = update_user_meta($user_id, '_give_user_address', $address); |
|
397 | + $updated = wp_update_user($userdata); |
|
398 | 398 | |
399 | - if ( $updated ) { |
|
400 | - do_action( 'give_user_profile_updated', $user_id, $userdata ); |
|
401 | - wp_redirect( add_query_arg( 'updated', 'true', $data['give_redirect'] ) ); |
|
399 | + if ($updated) { |
|
400 | + do_action('give_user_profile_updated', $user_id, $userdata); |
|
401 | + wp_redirect(add_query_arg('updated', 'true', $data['give_redirect'])); |
|
402 | 402 | give_die(); |
403 | 403 | } |
404 | 404 | |
405 | 405 | return false; |
406 | 406 | } |
407 | 407 | |
408 | -add_action( 'give_edit_user_profile', 'give_process_profile_editor_updates' ); |
|
408 | +add_action('give_edit_user_profile', 'give_process_profile_editor_updates'); |
|
409 | 409 |
@@ -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 | |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function give_get_templates_dir() { |
24 | - return GIVE_PLUGIN_DIR . 'templates'; |
|
24 | + return GIVE_PLUGIN_DIR.'templates'; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function give_get_templates_url() { |
34 | - return GIVE_PLUGIN_URL . 'templates'; |
|
34 | + return GIVE_PLUGIN_URL.'templates'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | * @uses load_template() |
52 | 52 | * @uses get_template_part() |
53 | 53 | */ |
54 | -function give_get_template_part( $slug, $name = null, $load = true ) { |
|
54 | +function give_get_template_part($slug, $name = null, $load = true) { |
|
55 | 55 | |
56 | 56 | // Execute code for this part |
57 | - do_action( 'get_template_part_' . $slug, $slug, $name ); |
|
57 | + do_action('get_template_part_'.$slug, $slug, $name); |
|
58 | 58 | |
59 | 59 | // Setup possible parts |
60 | 60 | $templates = array(); |
61 | - if ( isset( $name ) ) { |
|
62 | - $templates[] = $slug . '-' . $name . '.php'; |
|
61 | + if (isset($name)) { |
|
62 | + $templates[] = $slug.'-'.$name.'.php'; |
|
63 | 63 | } |
64 | - $templates[] = $slug . '.php'; |
|
64 | + $templates[] = $slug.'.php'; |
|
65 | 65 | |
66 | 66 | // Allow template parts to be filtered |
67 | - $templates = apply_filters( 'give_get_template_part', $templates, $slug, $name ); |
|
67 | + $templates = apply_filters('give_get_template_part', $templates, $slug, $name); |
|
68 | 68 | |
69 | 69 | // Return the part that is found |
70 | - return give_locate_template( $templates, $load, false ); |
|
70 | + return give_locate_template($templates, $load, false); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -88,37 +88,37 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @return string The template filename if one is located. |
90 | 90 | */ |
91 | -function give_locate_template( $template_names, $load = false, $require_once = true ) { |
|
91 | +function give_locate_template($template_names, $load = false, $require_once = true) { |
|
92 | 92 | // No file found yet |
93 | 93 | $located = false; |
94 | 94 | |
95 | 95 | // Try to find a template file |
96 | - foreach ( (array) $template_names as $template_name ) { |
|
96 | + foreach ((array) $template_names as $template_name) { |
|
97 | 97 | |
98 | 98 | // Continue if template is empty |
99 | - if ( empty( $template_name ) ) { |
|
99 | + if (empty($template_name)) { |
|
100 | 100 | continue; |
101 | 101 | } |
102 | 102 | |
103 | 103 | // Trim off any slashes from the template name |
104 | - $template_name = ltrim( $template_name, '/' ); |
|
104 | + $template_name = ltrim($template_name, '/'); |
|
105 | 105 | |
106 | 106 | // try locating this template file by looping through the template paths |
107 | - foreach ( give_get_theme_template_paths() as $template_path ) { |
|
107 | + foreach (give_get_theme_template_paths() as $template_path) { |
|
108 | 108 | |
109 | - if ( file_exists( $template_path . $template_name ) ) { |
|
110 | - $located = $template_path . $template_name; |
|
109 | + if (file_exists($template_path.$template_name)) { |
|
110 | + $located = $template_path.$template_name; |
|
111 | 111 | break; |
112 | 112 | } |
113 | 113 | } |
114 | 114 | |
115 | - if ( $located ) { |
|
115 | + if ($located) { |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | } |
119 | 119 | |
120 | - if ( ( true == $load ) && ! empty( $located ) ) { |
|
121 | - load_template( $located, $require_once ); |
|
120 | + if ((true == $load) && ! empty($located)) { |
|
121 | + load_template($located, $require_once); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $located; |
@@ -135,17 +135,17 @@ discard block |
||
135 | 135 | $template_dir = give_get_theme_template_dir_name(); |
136 | 136 | |
137 | 137 | $file_paths = array( |
138 | - 1 => trailingslashit( get_stylesheet_directory() ) . $template_dir, |
|
139 | - 10 => trailingslashit( get_template_directory() ) . $template_dir, |
|
138 | + 1 => trailingslashit(get_stylesheet_directory()).$template_dir, |
|
139 | + 10 => trailingslashit(get_template_directory()).$template_dir, |
|
140 | 140 | 100 => give_get_templates_dir() |
141 | 141 | ); |
142 | 142 | |
143 | - $file_paths = apply_filters( 'give_template_paths', $file_paths ); |
|
143 | + $file_paths = apply_filters('give_template_paths', $file_paths); |
|
144 | 144 | |
145 | 145 | // sort the file paths based on priority |
146 | - ksort( $file_paths, SORT_NUMERIC ); |
|
146 | + ksort($file_paths, SORT_NUMERIC); |
|
147 | 147 | |
148 | - return array_map( 'trailingslashit', $file_paths ); |
|
148 | + return array_map('trailingslashit', $file_paths); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @return string |
158 | 158 | */ |
159 | 159 | function give_get_theme_template_dir_name() { |
160 | - return trailingslashit( apply_filters( 'give_templates_dir', 'give' ) ); |
|
160 | + return trailingslashit(apply_filters('give_templates_dir', 'give')); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @return void |
168 | 168 | */ |
169 | 169 | function give_version_in_header() { |
170 | - echo '<meta name="generator" content="Give v' . GIVE_VERSION . '" />' . "\n"; |
|
170 | + echo '<meta name="generator" content="Give v'.GIVE_VERSION.'" />'."\n"; |
|
171 | 171 | } |
172 | 172 | |
173 | -add_action( 'wp_head', 'give_version_in_header' ); |
|
173 | +add_action('wp_head', 'give_version_in_header'); |
|
174 | 174 | |
175 | 175 | /** |
176 | 176 | * Determines if we're currently on the Donations History page. |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | */ |
181 | 181 | function give_is_donation_history_page() { |
182 | 182 | |
183 | - $ret = is_page( give_get_option( 'purchase_history_page' ) ); |
|
183 | + $ret = is_page(give_get_option('purchase_history_page')); |
|
184 | 184 | |
185 | - return apply_filters( 'give_is_donation_history_page', $ret ); |
|
185 | + return apply_filters('give_is_donation_history_page', $ret); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -194,25 +194,25 @@ discard block |
||
194 | 194 | * |
195 | 195 | * @return array Modified array of classes |
196 | 196 | */ |
197 | -function give_add_body_classes( $class ) { |
|
197 | +function give_add_body_classes($class) { |
|
198 | 198 | $classes = (array) $class; |
199 | 199 | |
200 | - if ( give_is_success_page() ) { |
|
200 | + if (give_is_success_page()) { |
|
201 | 201 | $classes[] = 'give-success'; |
202 | 202 | $classes[] = 'give-page'; |
203 | 203 | } |
204 | 204 | |
205 | - if ( give_is_failed_transaction_page() ) { |
|
205 | + if (give_is_failed_transaction_page()) { |
|
206 | 206 | $classes[] = 'give-failed-transaction'; |
207 | 207 | $classes[] = 'give-page'; |
208 | 208 | } |
209 | 209 | |
210 | - if ( give_is_donation_history_page() ) { |
|
210 | + if (give_is_donation_history_page()) { |
|
211 | 211 | $classes[] = 'give-donation-history'; |
212 | 212 | $classes[] = 'give-page'; |
213 | 213 | } |
214 | 214 | |
215 | - if ( give_is_test_mode() ) { |
|
215 | + if (give_is_test_mode()) { |
|
216 | 216 | $classes[] = 'give-test-mode'; |
217 | 217 | $classes[] = 'give-page'; |
218 | 218 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | //Theme-specific Classes used to prevent conflicts via CSS |
221 | 221 | $current_theme = wp_get_theme(); |
222 | 222 | |
223 | - switch ( $current_theme->template ) { |
|
223 | + switch ($current_theme->template) { |
|
224 | 224 | |
225 | 225 | case 'Divi': |
226 | 226 | $classes[] = 'give-divi'; |
@@ -231,10 +231,10 @@ discard block |
||
231 | 231 | |
232 | 232 | } |
233 | 233 | |
234 | - return array_unique( $classes ); |
|
234 | + return array_unique($classes); |
|
235 | 235 | } |
236 | 236 | |
237 | -add_filter( 'body_class', 'give_add_body_classes' ); |
|
237 | +add_filter('body_class', 'give_add_body_classes'); |
|
238 | 238 | |
239 | 239 | |
240 | 240 | /** |
@@ -250,22 +250,22 @@ discard block |
||
250 | 250 | * |
251 | 251 | * @return array |
252 | 252 | */ |
253 | -function give_add_post_class( $classes, $class = '', $post_id = '' ) { |
|
254 | - if ( ! $post_id || 'give_forms' !== get_post_type( $post_id ) ) { |
|
253 | +function give_add_post_class($classes, $class = '', $post_id = '') { |
|
254 | + if ( ! $post_id || 'give_forms' !== get_post_type($post_id)) { |
|
255 | 255 | return $classes; |
256 | 256 | } |
257 | 257 | |
258 | 258 | //@TODO: Add classes for custom taxonomy and form configurations (multi vs single donations, etc). |
259 | 259 | |
260 | - if ( false !== ( $key = array_search( 'hentry', $classes ) ) ) { |
|
261 | - unset( $classes[ $key ] ); |
|
260 | + if (false !== ($key = array_search('hentry', $classes))) { |
|
261 | + unset($classes[$key]); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | return $classes; |
265 | 265 | } |
266 | 266 | |
267 | 267 | |
268 | -add_filter( 'post_class', 'give_add_post_class', 20, 3 ); |
|
268 | +add_filter('post_class', 'give_add_post_class', 20, 3); |
|
269 | 269 | |
270 | 270 | |
271 | 271 | /** |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | * |
278 | 278 | * @return array |
279 | 279 | */ |
280 | -function give_get_image_size( $image_size ) { |
|
281 | - if ( in_array( $image_size, array( 'give_form_thumbnail', 'give_form_single' ) ) ) { |
|
282 | - $size = get_option( $image_size . '_image_size', array() ); |
|
283 | - $size['width'] = isset( $size['width'] ) ? $size['width'] : '300'; |
|
284 | - $size['height'] = isset( $size['height'] ) ? $size['height'] : '300'; |
|
285 | - $size['crop'] = isset( $size['crop'] ) ? $size['crop'] : 0; |
|
280 | +function give_get_image_size($image_size) { |
|
281 | + if (in_array($image_size, array('give_form_thumbnail', 'give_form_single'))) { |
|
282 | + $size = get_option($image_size.'_image_size', array()); |
|
283 | + $size['width'] = isset($size['width']) ? $size['width'] : '300'; |
|
284 | + $size['height'] = isset($size['height']) ? $size['height'] : '300'; |
|
285 | + $size['crop'] = isset($size['crop']) ? $size['crop'] : 0; |
|
286 | 286 | } else { |
287 | 287 | $size = array( |
288 | 288 | 'width' => '300', |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ); |
292 | 292 | } |
293 | 293 | |
294 | - return apply_filters( 'give_get_image_size_' . $image_size, $size ); |
|
294 | + return apply_filters('give_get_image_size_'.$image_size, $size); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -302,86 +302,86 @@ discard block |
||
302 | 302 | */ |
303 | 303 | function give_get_placeholder_img_src() { |
304 | 304 | |
305 | - $image_size = give_get_image_size( 'give_form_thumbnail' ); |
|
305 | + $image_size = give_get_image_size('give_form_thumbnail'); |
|
306 | 306 | |
307 | - $placeholder_url = 'http://placehold.it/' . $image_size['width'] . 'x' . $image_size['height'] . '&text=' . __( 'Give+Placeholder+Image+', 'give' ) . '(' . $image_size['width'] . 'x' . $image_size['height'] . ')'; |
|
307 | + $placeholder_url = 'http://placehold.it/'.$image_size['width'].'x'.$image_size['height'].'&text='.__('Give+Placeholder+Image+', 'give').'('.$image_size['width'].'x'.$image_size['height'].')'; |
|
308 | 308 | |
309 | - return apply_filters( 'give_placeholder_img_src', $placeholder_url ); |
|
309 | + return apply_filters('give_placeholder_img_src', $placeholder_url); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
313 | 313 | /** |
314 | 314 | * Global |
315 | 315 | */ |
316 | -if ( ! function_exists( 'give_output_content_wrapper' ) ) { |
|
316 | +if ( ! function_exists('give_output_content_wrapper')) { |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Output the start of the page wrapper. |
320 | 320 | */ |
321 | 321 | function give_output_content_wrapper() { |
322 | - give_get_template_part( 'global/wrapper-start' ); |
|
322 | + give_get_template_part('global/wrapper-start'); |
|
323 | 323 | } |
324 | 324 | } |
325 | -if ( ! function_exists( 'give_output_content_wrapper_end' ) ) { |
|
325 | +if ( ! function_exists('give_output_content_wrapper_end')) { |
|
326 | 326 | |
327 | 327 | /** |
328 | 328 | * Output the end of the page wrapper. |
329 | 329 | */ |
330 | 330 | function give_output_content_wrapper_end() { |
331 | - give_get_template_part( 'global/wrapper-end' ); |
|
331 | + give_get_template_part('global/wrapper-end'); |
|
332 | 332 | } |
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
336 | 336 | * Single Give Form |
337 | 337 | */ |
338 | -if ( ! function_exists( 'give_left_sidebar_pre_wrap' ) ) { |
|
338 | +if ( ! function_exists('give_left_sidebar_pre_wrap')) { |
|
339 | 339 | function give_left_sidebar_pre_wrap() { |
340 | - echo apply_filters( 'give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">' ); |
|
340 | + echo apply_filters('give_left_sidebar_pre_wrap', '<div id="give-sidebar-left" class="give-sidebar give-single-form-sidebar-left">'); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
344 | -if ( ! function_exists( 'give_left_sidebar_post_wrap' ) ) { |
|
344 | +if ( ! function_exists('give_left_sidebar_post_wrap')) { |
|
345 | 345 | function give_left_sidebar_post_wrap() { |
346 | - echo apply_filters( 'give_left_sidebar_post_wrap', '</div>' ); |
|
346 | + echo apply_filters('give_left_sidebar_post_wrap', '</div>'); |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | |
350 | -if ( ! function_exists( 'give_get_forms_sidebar' ) ) { |
|
350 | +if ( ! function_exists('give_get_forms_sidebar')) { |
|
351 | 351 | function give_get_forms_sidebar() { |
352 | - give_get_template_part( 'single-give-form/sidebar' ); |
|
352 | + give_get_template_part('single-give-form/sidebar'); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
356 | -if ( ! function_exists( 'give_show_form_images' ) ) { |
|
356 | +if ( ! function_exists('give_show_form_images')) { |
|
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Output the product image before the single product summary. |
360 | 360 | */ |
361 | 361 | function give_show_form_images() { |
362 | - $featured_image_option = give_get_option( 'disable_form_featured_img' ); |
|
363 | - if ( $featured_image_option !== 'on' ) { |
|
364 | - give_get_template_part( 'single-give-form/featured-image' ); |
|
362 | + $featured_image_option = give_get_option('disable_form_featured_img'); |
|
363 | + if ($featured_image_option !== 'on') { |
|
364 | + give_get_template_part('single-give-form/featured-image'); |
|
365 | 365 | } |
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
369 | -if ( ! function_exists( 'give_template_single_title' ) ) { |
|
369 | +if ( ! function_exists('give_template_single_title')) { |
|
370 | 370 | |
371 | 371 | /** |
372 | 372 | * Output the product title. |
373 | 373 | */ |
374 | 374 | function give_template_single_title() { |
375 | - give_get_template_part( 'single-give-form/title' ); |
|
375 | + give_get_template_part('single-give-form/title'); |
|
376 | 376 | } |
377 | 377 | } |
378 | 378 | |
379 | -if ( ! function_exists( 'give_show_avatars' ) ) { |
|
379 | +if ( ! function_exists('give_show_avatars')) { |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Output the product title. |
383 | 383 | */ |
384 | 384 | function give_show_avatars() { |
385 | - echo do_shortcode( '[give_donators_gravatars]' ); |
|
385 | + echo do_shortcode('[give_donators_gravatars]'); |
|
386 | 386 | } |
387 | 387 | } |
388 | 388 | \ No newline at end of file |
@@ -10,83 +10,83 @@ |
||
10 | 10 | */ |
11 | 11 | |
12 | 12 | // Exit if accessed directly |
13 | -if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
|
13 | +if ( ! defined('WP_UNINSTALL_PLUGIN')) { |
|
14 | 14 | exit; |
15 | 15 | } |
16 | 16 | |
17 | 17 | // Load Give file |
18 | -include_once( 'give.php' ); |
|
18 | +include_once('give.php'); |
|
19 | 19 | |
20 | 20 | global $wpdb, $wp_roles; |
21 | 21 | |
22 | 22 | |
23 | -if ( give_get_option( 'uninstall_on_delete' ) === 'on' ) { |
|
23 | +if (give_get_option('uninstall_on_delete') === 'on') { |
|
24 | 24 | |
25 | 25 | // Delete All the Custom Post Types |
26 | - $give_taxonomies = array( 'form_category', 'form_tag', 'give_log_type', ); |
|
27 | - $give_post_types = array( 'give_forms', 'give_payment', 'give_log' ); |
|
28 | - foreach ( $give_post_types as $post_type ) { |
|
26 | + $give_taxonomies = array('form_category', 'form_tag', 'give_log_type',); |
|
27 | + $give_post_types = array('give_forms', 'give_payment', 'give_log'); |
|
28 | + foreach ($give_post_types as $post_type) { |
|
29 | 29 | |
30 | - $give_taxonomies = array_merge( $give_taxonomies, get_object_taxonomies( $post_type ) ); |
|
31 | - $items = get_posts( array( |
|
30 | + $give_taxonomies = array_merge($give_taxonomies, get_object_taxonomies($post_type)); |
|
31 | + $items = get_posts(array( |
|
32 | 32 | 'post_type' => $post_type, |
33 | 33 | 'post_status' => 'any', |
34 | - 'numberposts' => - 1, |
|
34 | + 'numberposts' => -1, |
|
35 | 35 | 'fields' => 'ids' |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | |
38 | - if ( $items ) { |
|
39 | - foreach ( $items as $item ) { |
|
40 | - wp_delete_post( $item, true ); |
|
38 | + if ($items) { |
|
39 | + foreach ($items as $item) { |
|
40 | + wp_delete_post($item, true); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | |
45 | 45 | // Delete All the Terms & Taxonomies |
46 | - foreach ( array_unique( array_filter( $give_taxonomies ) ) as $taxonomy ) { |
|
46 | + foreach (array_unique(array_filter($give_taxonomies)) as $taxonomy) { |
|
47 | 47 | |
48 | - $terms = $wpdb->get_results( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy ) ); |
|
48 | + $terms = $wpdb->get_results($wpdb->prepare("SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('%s') ORDER BY t.name ASC", $taxonomy)); |
|
49 | 49 | |
50 | 50 | // Delete Terms |
51 | - if ( $terms ) { |
|
52 | - foreach ( $terms as $term ) { |
|
53 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $term->term_taxonomy_id ) ); |
|
54 | - $wpdb->delete( $wpdb->terms, array( 'term_id' => $term->term_id ) ); |
|
51 | + if ($terms) { |
|
52 | + foreach ($terms as $term) { |
|
53 | + $wpdb->delete($wpdb->term_taxonomy, array('term_taxonomy_id' => $term->term_taxonomy_id)); |
|
54 | + $wpdb->delete($wpdb->terms, array('term_id' => $term->term_id)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Delete Taxonomies |
59 | - $wpdb->delete( $wpdb->term_taxonomy, array( 'taxonomy' => $taxonomy ), array( '%s' ) ); |
|
59 | + $wpdb->delete($wpdb->term_taxonomy, array('taxonomy' => $taxonomy), array('%s')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | // Delete the Plugin Pages |
63 | - $give_created_pages = array( 'success_page', 'failure_page', 'history_page' ); |
|
64 | - foreach ( $give_created_pages as $p ) { |
|
65 | - $page = give_get_option( $p, false ); |
|
66 | - if ( $page ) { |
|
67 | - wp_delete_post( $page, true ); |
|
63 | + $give_created_pages = array('success_page', 'failure_page', 'history_page'); |
|
64 | + foreach ($give_created_pages as $p) { |
|
65 | + $page = give_get_option($p, false); |
|
66 | + if ($page) { |
|
67 | + wp_delete_post($page, true); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | // Delete all the Plugin Options |
72 | - delete_option( 'give_settings' ); |
|
73 | - delete_option( 'give_version' ); |
|
72 | + delete_option('give_settings'); |
|
73 | + delete_option('give_version'); |
|
74 | 74 | |
75 | 75 | // Delete Capabilities |
76 | 76 | Give()->roles->remove_caps(); |
77 | 77 | |
78 | 78 | // Delete the Roles |
79 | - $give_roles = array( 'give_manager', 'give_accountant', 'give_worker' ); |
|
80 | - foreach ( $give_roles as $role ) { |
|
81 | - remove_role( $role ); |
|
79 | + $give_roles = array('give_manager', 'give_accountant', 'give_worker'); |
|
80 | + foreach ($give_roles as $role) { |
|
81 | + remove_role($role); |
|
82 | 82 | } |
83 | 83 | |
84 | 84 | // Remove all database tables |
85 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_donors" ); |
|
86 | - $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "give_customers" ); |
|
85 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_donors"); |
|
86 | + $wpdb->query("DROP TABLE IF EXISTS ".$wpdb->prefix."give_customers"); |
|
87 | 87 | |
88 | 88 | // Cleanup Cron Events |
89 | - wp_clear_scheduled_hook( 'give_daily_scheduled_events' ); |
|
90 | - wp_clear_scheduled_hook( 'give_daily_cron' ); |
|
91 | - wp_clear_scheduled_hook( 'give_weekly_cron' ); |
|
89 | + wp_clear_scheduled_hook('give_daily_scheduled_events'); |
|
90 | + wp_clear_scheduled_hook('give_daily_cron'); |
|
91 | + wp_clear_scheduled_hook('give_weekly_cron'); |
|
92 | 92 | } |
@@ -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 | |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | function give_register_dashboard_widgets() { |
24 | - if ( current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
25 | - wp_add_dashboard_widget( 'give_dashboard_sales', __( 'Give: Donation Statistics', 'give' ), 'give_dashboard_sales_widget' ); |
|
24 | + if (current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
25 | + wp_add_dashboard_widget('give_dashboard_sales', __('Give: Donation Statistics', 'give'), 'give_dashboard_sales_widget'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | |
29 | -add_action( 'wp_dashboard_setup', 'give_register_dashboard_widgets', 10 ); |
|
29 | +add_action('wp_dashboard_setup', 'give_register_dashboard_widgets', 10); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sales Summary Dashboard Widget |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | function give_dashboard_sales_widget() { |
40 | 40 | |
41 | - if ( ! current_user_can( apply_filters( 'give_dashboard_stats_cap', 'view_give_reports' ) ) ) { |
|
41 | + if ( ! current_user_can(apply_filters('give_dashboard_stats_cap', 'view_give_reports'))) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | $stats = new Give_Payment_Stats; ?> |
@@ -46,19 +46,19 @@ discard block |
||
46 | 46 | <div class="give-dashboard-widget"> |
47 | 47 | |
48 | 48 | <div class="give-dashboard-today give-clearfix"> |
49 | - <h3 class="give-dashboard-date-today"><?php echo date( 'F j, Y' ); ?></h3> |
|
49 | + <h3 class="give-dashboard-date-today"><?php echo date('F j, Y'); ?></h3> |
|
50 | 50 | |
51 | - <p class="give-dashboard-happy-day"><?php printf( __( 'Happy %1$s!', 'give' ), date( 'l', current_time( 'timestamp' ) ) ); ?></p> |
|
51 | + <p class="give-dashboard-happy-day"><?php printf(__('Happy %1$s!', 'give'), date('l', current_time('timestamp'))); ?></p> |
|
52 | 52 | |
53 | - <?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?> |
|
53 | + <?php $earnings_today = $stats->get_earnings(0, 'today', false); ?> |
|
54 | 54 | |
55 | - <p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p> |
|
55 | + <p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p> |
|
56 | 56 | |
57 | - <p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array( |
|
57 | + <p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array( |
|
58 | 58 | 'publish', |
59 | 59 | 'revoked' |
60 | - ) ); ?><?php echo give_format_amount( $donations_today, false ); ?> |
|
61 | - <span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span> |
|
60 | + )); ?><?php echo give_format_amount($donations_today, false); ?> |
|
61 | + <span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span> |
|
62 | 62 | </p> |
63 | 63 | |
64 | 64 | |
@@ -68,34 +68,34 @@ discard block |
||
68 | 68 | <table class="give-table-stats"> |
69 | 69 | <thead style="display: none;"> |
70 | 70 | <tr> |
71 | - <th><?php _e( 'This Week', 'give' ); ?></th> |
|
72 | - <th><?php _e( 'This Month', 'give' ); ?></th> |
|
73 | - <th><?php _e( 'Past 30 Days', 'give' ); ?></th> |
|
71 | + <th><?php _e('This Week', 'give'); ?></th> |
|
72 | + <th><?php _e('This Month', 'give'); ?></th> |
|
73 | + <th><?php _e('Past 30 Days', 'give'); ?></th> |
|
74 | 74 | </tr> |
75 | 75 | </thead> |
76 | 76 | <tbody> |
77 | 77 | <tr id="give-table-stats-tr-1"> |
78 | 78 | <td> |
79 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> |
|
79 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> |
|
80 | 80 | |
81 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this week', 'give' ); ?></p> |
|
81 | + <p class="give-dashboard-stat-total-label"><?php _e('this week', 'give'); ?></p> |
|
82 | 82 | </td> |
83 | 83 | <td> |
84 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> |
|
84 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> |
|
85 | 85 | |
86 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this month', 'give' ); ?></p> |
|
86 | + <p class="give-dashboard-stat-total-label"><?php _e('this month', 'give'); ?></p> |
|
87 | 87 | </td> |
88 | 88 | </tr> |
89 | 89 | <tr id="give-table-stats-tr-2"> |
90 | 90 | <td> |
91 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> |
|
91 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> |
|
92 | 92 | |
93 | - <p class="give-dashboard-stat-total-label"><?php _e( 'last month', 'give' ); ?></p> |
|
93 | + <p class="give-dashboard-stat-total-label"><?php _e('last month', 'give'); ?></p> |
|
94 | 94 | </td> |
95 | 95 | <td> |
96 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> |
|
96 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> |
|
97 | 97 | |
98 | - <p class="give-dashboard-stat-total-label"><?php _e( 'this year', 'give' ); ?></p> |
|
98 | + <p class="give-dashboard-stat-total-label"><?php _e('this year', 'give'); ?></p> |
|
99 | 99 | </td> |
100 | 100 | </tr> |
101 | 101 | </tbody> |
@@ -112,18 +112,18 @@ discard block |
||
112 | 112 | * @since 1.0 |
113 | 113 | * @return void |
114 | 114 | */ |
115 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
116 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
115 | +function give_dashboard_at_a_glance_widget($items) { |
|
116 | + $num_posts = wp_count_posts('give_forms'); |
|
117 | 117 | |
118 | - if ( $num_posts && $num_posts->publish ) { |
|
119 | - $text = sprintf( _n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ), $num_posts->publish, give_get_forms_label_singular(), give_get_forms_label_plural() ); |
|
118 | + if ($num_posts && $num_posts->publish) { |
|
119 | + $text = sprintf(_n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'), $num_posts->publish, give_get_forms_label_singular(), give_get_forms_label_plural()); |
|
120 | 120 | |
121 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
121 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
122 | 122 | |
123 | - if ( current_user_can( 'edit_give_forms', get_the_ID() ) ) { |
|
124 | - $text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text ); |
|
123 | + if (current_user_can('edit_give_forms', get_the_ID())) { |
|
124 | + $text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text); |
|
125 | 125 | } else { |
126 | - $text = sprintf( '<span class="give-forms-count">%1$s</span>', $text ); |
|
126 | + $text = sprintf('<span class="give-forms-count">%1$s</span>', $text); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | $items[] = $text; |
@@ -132,4 +132,4 @@ discard block |
||
132 | 132 | return $items; |
133 | 133 | } |
134 | 134 | |
135 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
|
135 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
@@ -10,11 +10,11 @@ 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 | -add_filter( 'cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes' ); |
|
17 | +add_filter('cmb2_meta_boxes', 'give_single_forms_cmb2_metaboxes'); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Define the metabox and field configurations. |
@@ -23,17 +23,17 @@ discard block |
||
23 | 23 | * |
24 | 24 | * @return array |
25 | 25 | */ |
26 | -function give_single_forms_cmb2_metaboxes( array $meta_boxes ) { |
|
26 | +function give_single_forms_cmb2_metaboxes(array $meta_boxes) { |
|
27 | 27 | |
28 | 28 | $post_id = give_get_admin_post_id(); |
29 | - $price = give_get_form_price( $post_id ); |
|
30 | - $goal = give_get_form_goal( $post_id ); |
|
31 | - $variable_pricing = give_has_variable_prices( $post_id ); |
|
32 | - $prices = give_get_variable_prices( $post_id ); |
|
29 | + $price = give_get_form_price($post_id); |
|
30 | + $goal = give_get_form_goal($post_id); |
|
31 | + $variable_pricing = give_has_variable_prices($post_id); |
|
32 | + $prices = give_get_variable_prices($post_id); |
|
33 | 33 | |
34 | 34 | //No empty prices - min. 1.00 for new forms |
35 | - if ( empty( $price ) ) { |
|
36 | - $price = esc_attr( give_format_amount( '1.00' ) ); |
|
35 | + if (empty($price)) { |
|
36 | + $price = esc_attr(give_format_amount('1.00')); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | // Start with an underscore to hide fields from custom fields list |
@@ -42,275 +42,275 @@ discard block |
||
42 | 42 | /** |
43 | 43 | * Repeatable Field Groups |
44 | 44 | */ |
45 | - $meta_boxes['form_field_options'] = apply_filters( 'give_forms_field_options', array( |
|
45 | + $meta_boxes['form_field_options'] = apply_filters('give_forms_field_options', array( |
|
46 | 46 | 'id' => 'form_field_options', |
47 | - 'title' => __( 'Donation Options', 'give' ), |
|
48 | - 'object_types' => array( 'give_forms' ), |
|
47 | + 'title' => __('Donation Options', 'give'), |
|
48 | + 'object_types' => array('give_forms'), |
|
49 | 49 | 'context' => 'normal', |
50 | 50 | 'priority' => 'high', //Show above Content WYSIWYG |
51 | - 'fields' => apply_filters( 'give_forms_donation_form_metabox_fields', array( |
|
51 | + 'fields' => apply_filters('give_forms_donation_form_metabox_fields', array( |
|
52 | 52 | //Donation Option |
53 | 53 | array( |
54 | - 'name' => __( 'Donation Option', 'give' ), |
|
55 | - 'description' => __( 'Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give' ), |
|
56 | - 'id' => $prefix . 'price_option', |
|
54 | + 'name' => __('Donation Option', 'give'), |
|
55 | + 'description' => __('Would you like this form to have one set donation price or multiple levels (for example, $10 silver, $20 gold, $50 platinum)?', 'give'), |
|
56 | + 'id' => $prefix.'price_option', |
|
57 | 57 | 'type' => 'radio_inline', |
58 | 58 | 'default' => 'set', |
59 | - 'options' => apply_filters( 'give_forms_price_options', array( |
|
60 | - 'set' => __( 'Set Donation', 'give' ), |
|
61 | - 'multi' => __( 'Multi-level Donation', 'give' ), |
|
62 | - ) ), |
|
59 | + 'options' => apply_filters('give_forms_price_options', array( |
|
60 | + 'set' => __('Set Donation', 'give'), |
|
61 | + 'multi' => __('Multi-level Donation', 'give'), |
|
62 | + )), |
|
63 | 63 | ), |
64 | 64 | array( |
65 | - 'name' => __( 'Set Donation', 'give' ), |
|
66 | - 'description' => __( 'This is the set donation amount for this form.', 'give' ), |
|
67 | - 'id' => $prefix . 'set_price', |
|
65 | + 'name' => __('Set Donation', 'give'), |
|
66 | + 'description' => __('This is the set donation amount for this form.', 'give'), |
|
67 | + 'id' => $prefix.'set_price', |
|
68 | 68 | 'type' => 'text_small', |
69 | 69 | 'row_classes' => 'give-subfield', |
70 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
71 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
70 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
71 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
72 | 72 | 'attributes' => array( |
73 | - 'placeholder' => give_format_amount( '1.00' ), |
|
73 | + 'placeholder' => give_format_amount('1.00'), |
|
74 | 74 | 'value' => $price, |
75 | 75 | 'class' => 'cmb-type-text-small give-money-field', |
76 | 76 | ), |
77 | 77 | ), |
78 | 78 | //Donation levels: Header |
79 | 79 | array( |
80 | - 'id' => $prefix . 'levels_header', |
|
80 | + 'id' => $prefix.'levels_header', |
|
81 | 81 | 'type' => 'levels_repeater_header', |
82 | 82 | ), |
83 | 83 | //Donation Levels: Repeatable CMB2 Group |
84 | 84 | array( |
85 | - 'id' => $prefix . 'donation_levels', |
|
85 | + 'id' => $prefix.'donation_levels', |
|
86 | 86 | 'type' => 'group', |
87 | 87 | 'row_classes' => 'give-subfield', |
88 | 88 | 'options' => array( |
89 | - 'add_button' => __( 'Add Level', 'give' ), |
|
90 | - 'remove_button' => __( '<span class="dashicons dashicons-no"></span>', 'give' ), |
|
89 | + 'add_button' => __('Add Level', 'give'), |
|
90 | + 'remove_button' => __('<span class="dashicons dashicons-no"></span>', 'give'), |
|
91 | 91 | 'sortable' => true, // beta |
92 | 92 | ), |
93 | 93 | // Fields array works the same, except id's only need to be unique for this group. Prefix is not needed. |
94 | - 'fields' => apply_filters( 'give_donation_levels_table_row', array( |
|
94 | + 'fields' => apply_filters('give_donation_levels_table_row', array( |
|
95 | 95 | array( |
96 | - 'name' => __( 'ID', 'give' ), |
|
97 | - 'id' => $prefix . 'id', |
|
96 | + 'name' => __('ID', 'give'), |
|
97 | + 'id' => $prefix.'id', |
|
98 | 98 | 'type' => 'levels_id', |
99 | 99 | ), |
100 | 100 | array( |
101 | - 'name' => __( 'Amount', 'give' ), |
|
102 | - 'id' => $prefix . 'amount', |
|
101 | + 'name' => __('Amount', 'give'), |
|
102 | + 'id' => $prefix.'amount', |
|
103 | 103 | 'type' => 'text_small', |
104 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
105 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
104 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
105 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
106 | 106 | 'attributes' => array( |
107 | - 'placeholder' => give_format_amount( '1.00' ), |
|
107 | + 'placeholder' => give_format_amount('1.00'), |
|
108 | 108 | 'class' => 'cmb-type-text-small give-money-field', |
109 | 109 | ), |
110 | 110 | 'before' => 'give_format_admin_multilevel_amount', |
111 | 111 | ), |
112 | 112 | array( |
113 | - 'name' => __( 'Text', 'give' ), |
|
114 | - 'id' => $prefix . 'text', |
|
113 | + 'name' => __('Text', 'give'), |
|
114 | + 'id' => $prefix.'text', |
|
115 | 115 | 'type' => 'text', |
116 | 116 | 'attributes' => array( |
117 | - 'placeholder' => __( 'Donation Level', 'give' ), |
|
117 | + 'placeholder' => __('Donation Level', 'give'), |
|
118 | 118 | 'rows' => 3, |
119 | 119 | ), |
120 | 120 | ), |
121 | 121 | array( |
122 | - 'name' => __( 'Default', 'give' ), |
|
123 | - 'id' => $prefix . 'default', |
|
122 | + 'name' => __('Default', 'give'), |
|
123 | + 'id' => $prefix.'default', |
|
124 | 124 | 'type' => 'give_default_radio_inline' |
125 | 125 | ), |
126 | - ) ), |
|
126 | + )), |
|
127 | 127 | ), |
128 | 128 | //Display Style |
129 | 129 | array( |
130 | - 'name' => __( 'Display Style', 'give' ), |
|
131 | - 'description' => __( 'Set how the donations levels will display on the form.', 'give' ), |
|
132 | - 'id' => $prefix . 'display_style', |
|
130 | + 'name' => __('Display Style', 'give'), |
|
131 | + 'description' => __('Set how the donations levels will display on the form.', 'give'), |
|
132 | + 'id' => $prefix.'display_style', |
|
133 | 133 | 'type' => 'radio_inline', |
134 | 134 | 'default' => 'buttons', |
135 | 135 | 'options' => array( |
136 | - 'buttons' => __( 'Buttons', 'give' ), |
|
137 | - 'radios' => __( 'Radios', 'give' ), |
|
138 | - 'dropdown' => __( 'Dropdown', 'give' ), |
|
136 | + 'buttons' => __('Buttons', 'give'), |
|
137 | + 'radios' => __('Radios', 'give'), |
|
138 | + 'dropdown' => __('Dropdown', 'give'), |
|
139 | 139 | ), |
140 | 140 | ), |
141 | 141 | //Custom Amount |
142 | 142 | array( |
143 | - 'name' => __( 'Custom Amount', 'give' ), |
|
144 | - 'description' => __( 'Do you want the user to be able to input their own donation amount?', 'give' ), |
|
145 | - 'id' => $prefix . 'custom_amount', |
|
143 | + 'name' => __('Custom Amount', 'give'), |
|
144 | + 'description' => __('Do you want the user to be able to input their own donation amount?', 'give'), |
|
145 | + 'id' => $prefix.'custom_amount', |
|
146 | 146 | 'type' => 'radio_inline', |
147 | 147 | 'default' => 'no', |
148 | 148 | 'options' => array( |
149 | - 'yes' => __( 'Yes', 'give' ), |
|
150 | - 'no' => __( 'No', 'give' ), |
|
149 | + 'yes' => __('Yes', 'give'), |
|
150 | + 'no' => __('No', 'give'), |
|
151 | 151 | ), |
152 | 152 | ), |
153 | 153 | array( |
154 | - 'name' => __( 'Custom Amount Text', 'give' ), |
|
155 | - 'description' => __( 'This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give' ), |
|
156 | - 'id' => $prefix . 'custom_amount_text', |
|
154 | + 'name' => __('Custom Amount Text', 'give'), |
|
155 | + 'description' => __('This text appears as a label next to the custom amount field for single level forms. For multi-level forms the text will appear as it\'s own level (ie button, radio, or select option). Add your own message or leave this field blank to prevent it from displaying within your form.', 'give'), |
|
156 | + 'id' => $prefix.'custom_amount_text', |
|
157 | 157 | 'type' => 'text', |
158 | 158 | 'row_classes' => 'give-subfield', |
159 | 159 | 'attributes' => array( |
160 | 160 | 'rows' => 3, |
161 | - 'placeholder' => __( 'Give a Custom Amount', 'give' ), |
|
161 | + 'placeholder' => __('Give a Custom Amount', 'give'), |
|
162 | 162 | ), |
163 | 163 | ), |
164 | 164 | //Goals |
165 | 165 | array( |
166 | - 'name' => __( 'Set Goal?', 'give' ), |
|
167 | - 'description' => __( 'Do you want to set a donation goal for this form?', 'give' ), |
|
168 | - 'id' => $prefix . 'goal_option', |
|
166 | + 'name' => __('Set Goal?', 'give'), |
|
167 | + 'description' => __('Do you want to set a donation goal for this form?', 'give'), |
|
168 | + 'id' => $prefix.'goal_option', |
|
169 | 169 | 'type' => 'radio_inline', |
170 | 170 | 'default' => 'no', |
171 | 171 | 'options' => array( |
172 | - 'yes' => __( 'Yes', 'give' ), |
|
173 | - 'no' => __( 'No', 'give' ), |
|
172 | + 'yes' => __('Yes', 'give'), |
|
173 | + 'no' => __('No', 'give'), |
|
174 | 174 | ), |
175 | 175 | ), |
176 | 176 | array( |
177 | - 'name' => __( 'Set Goal', 'give' ), |
|
178 | - 'description' => __( 'This is the goal you want to achieve for this form.', 'give' ), |
|
179 | - 'id' => $prefix . 'set_goal', |
|
177 | + 'name' => __('Set Goal', 'give'), |
|
178 | + 'description' => __('This is the goal you want to achieve for this form.', 'give'), |
|
179 | + 'id' => $prefix.'set_goal', |
|
180 | 180 | 'type' => 'text_small', |
181 | 181 | 'row_classes' => 'give-subfield', |
182 | - 'before_field' => give_get_option( 'currency_position' ) == 'before' ? '<span class="give-money-symbol give-money-symbol-before">' . give_currency_symbol() . '</span>' : '', |
|
183 | - 'after_field' => give_get_option( 'currency_position' ) == 'after' ? '<span class="give-money-symbol give-money-symbol-after">' . give_currency_symbol() . '</span>' : '', |
|
182 | + 'before_field' => give_get_option('currency_position') == 'before' ? '<span class="give-money-symbol give-money-symbol-before">'.give_currency_symbol().'</span>' : '', |
|
183 | + 'after_field' => give_get_option('currency_position') == 'after' ? '<span class="give-money-symbol give-money-symbol-after">'.give_currency_symbol().'</span>' : '', |
|
184 | 184 | 'attributes' => array( |
185 | - 'placeholder' => give_format_amount( '0.00' ), |
|
186 | - 'value' => isset( $goal ) ? esc_attr( give_format_amount( $goal ) ) : '', |
|
185 | + 'placeholder' => give_format_amount('0.00'), |
|
186 | + 'value' => isset($goal) ? esc_attr(give_format_amount($goal)) : '', |
|
187 | 187 | 'class' => 'cmb-type-text-small give-money-field', |
188 | 188 | ), |
189 | 189 | ), |
190 | 190 | array( |
191 | - 'name' => __( 'Goal Progress Bar Color', 'give' ), |
|
192 | - 'id' => $prefix . 'goal_color', |
|
191 | + 'name' => __('Goal Progress Bar Color', 'give'), |
|
192 | + 'id' => $prefix.'goal_color', |
|
193 | 193 | 'type' => 'colorpicker', |
194 | 194 | 'row_classes' => 'give-subfield', |
195 | 195 | 'default' => '#2bc253', |
196 | 196 | ), |
197 | 197 | ) |
198 | 198 | ) |
199 | - ) ); |
|
199 | + )); |
|
200 | 200 | |
201 | 201 | |
202 | 202 | /** |
203 | 203 | * Content Field |
204 | 204 | */ |
205 | - $meta_boxes['form_content_options'] = apply_filters( 'give_forms_content_options', array( |
|
205 | + $meta_boxes['form_content_options'] = apply_filters('give_forms_content_options', array( |
|
206 | 206 | 'id' => 'form_content_options', |
207 | - 'title' => __( 'Form Content', 'give' ), |
|
208 | - 'object_types' => array( 'give_forms' ), |
|
207 | + 'title' => __('Form Content', 'give'), |
|
208 | + 'object_types' => array('give_forms'), |
|
209 | 209 | 'context' => 'normal', |
210 | 210 | 'priority' => 'high', //Show above Content WYSIWYG |
211 | - 'fields' => apply_filters( 'give_forms_content_options_metabox_fields', array( |
|
211 | + 'fields' => apply_filters('give_forms_content_options_metabox_fields', array( |
|
212 | 212 | //Donation Option |
213 | 213 | array( |
214 | - 'name' => __( 'Display Content', 'give' ), |
|
215 | - 'description' => __( 'Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give' ), |
|
216 | - 'id' => $prefix . 'content_option', |
|
214 | + 'name' => __('Display Content', 'give'), |
|
215 | + 'description' => __('Do you want to display content? If you select "Yes" a WYSIWYG editor will appear which you will be able to enter content to display above or below the form.', 'give'), |
|
216 | + 'id' => $prefix.'content_option', |
|
217 | 217 | 'type' => 'select', |
218 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
219 | - 'none' => __( 'No content', 'give' ), |
|
220 | - 'give_pre_form' => __( 'Yes, display content ABOVE the form fields', 'give' ), |
|
221 | - 'give_post_form' => __( 'Yes, display content BELOW the form fields', 'give' ), |
|
218 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
219 | + 'none' => __('No content', 'give'), |
|
220 | + 'give_pre_form' => __('Yes, display content ABOVE the form fields', 'give'), |
|
221 | + 'give_post_form' => __('Yes, display content BELOW the form fields', 'give'), |
|
222 | 222 | ) |
223 | 223 | ), |
224 | 224 | 'default' => 'none', |
225 | 225 | ), |
226 | 226 | array( |
227 | - 'name' => __( 'Content', 'give' ), |
|
228 | - 'description' => __( 'This content will display on the single give form page.', 'give' ), |
|
229 | - 'id' => $prefix . 'form_content', |
|
227 | + 'name' => __('Content', 'give'), |
|
228 | + 'description' => __('This content will display on the single give form page.', 'give'), |
|
229 | + 'id' => $prefix.'form_content', |
|
230 | 230 | 'row_classes' => 'give-subfield', |
231 | 231 | 'type' => 'wysiwyg' |
232 | 232 | ), |
233 | 233 | ) |
234 | 234 | ) |
235 | - ) ); |
|
235 | + )); |
|
236 | 236 | |
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Display Options |
240 | 240 | */ |
241 | - $meta_boxes['form_display_options'] = apply_filters( 'give_form_display_options', array( |
|
241 | + $meta_boxes['form_display_options'] = apply_filters('give_form_display_options', array( |
|
242 | 242 | 'id' => 'form_display_options', |
243 | - 'title' => __( 'Form Display Options', 'give' ), |
|
244 | - 'object_types' => array( 'give_forms' ), |
|
243 | + 'title' => __('Form Display Options', 'give'), |
|
244 | + 'object_types' => array('give_forms'), |
|
245 | 245 | 'context' => 'normal', // 'normal', 'advanced', or 'side' |
246 | 246 | 'priority' => 'high', //Show above Content WYSIWYG |
247 | 247 | 'show_names' => true, // Show field names on the left |
248 | - 'fields' => apply_filters( 'give_forms_display_options_metabox_fields', array( |
|
248 | + 'fields' => apply_filters('give_forms_display_options_metabox_fields', array( |
|
249 | 249 | array( |
250 | - 'name' => __( 'Payment Fields', 'give' ), |
|
251 | - 'desc' => __( 'How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give' ), |
|
252 | - 'id' => $prefix . 'payment_display', |
|
250 | + 'name' => __('Payment Fields', 'give'), |
|
251 | + 'desc' => __('How would you like to display payment information for this form? The "Show on Page" option will display the entire form when the page loads. "Reveal Upon Click" places a button below the donation fields and upon clicks slides into view the rest of the fields. "Modal Window Upon Click" is a similar option, rather than sliding into view the fields they will open in a shadow box or "modal" window.', 'give'), |
|
252 | + 'id' => $prefix.'payment_display', |
|
253 | 253 | 'type' => 'select', |
254 | 254 | 'options' => array( |
255 | - 'onpage' => __( 'Show on Page', 'give' ), |
|
256 | - 'reveal' => __( 'Reveal Upon Click', 'give' ), |
|
257 | - 'modal' => __( 'Modal Window Upon Click', 'give' ), |
|
255 | + 'onpage' => __('Show on Page', 'give'), |
|
256 | + 'reveal' => __('Reveal Upon Click', 'give'), |
|
257 | + 'modal' => __('Modal Window Upon Click', 'give'), |
|
258 | 258 | ), |
259 | 259 | 'default' => 'onpage', |
260 | 260 | ), |
261 | 261 | array( |
262 | - 'id' => $prefix . 'reveal_label', |
|
263 | - 'name' => __( 'Reveal / Modal Open Text', 'give' ), |
|
264 | - 'desc' => __( 'The button label for completing the donation.', 'give' ), |
|
262 | + 'id' => $prefix.'reveal_label', |
|
263 | + 'name' => __('Reveal / Modal Open Text', 'give'), |
|
264 | + 'desc' => __('The button label for completing the donation.', 'give'), |
|
265 | 265 | 'type' => 'text_small', |
266 | 266 | 'row_classes' => 'give-subfield', |
267 | 267 | 'attributes' => array( |
268 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
268 | + 'placeholder' => __('Donate Now', 'give'), |
|
269 | 269 | ), |
270 | 270 | ), |
271 | 271 | array( |
272 | - 'id' => $prefix . 'checkout_label', |
|
273 | - 'name' => __( 'Complete Donation Text', 'give' ), |
|
274 | - 'desc' => __( 'The button label for completing a donation.', 'give' ), |
|
272 | + 'id' => $prefix.'checkout_label', |
|
273 | + 'name' => __('Complete Donation Text', 'give'), |
|
274 | + 'desc' => __('The button label for completing a donation.', 'give'), |
|
275 | 275 | 'type' => 'text_small', |
276 | 276 | 'attributes' => array( |
277 | - 'placeholder' => __( 'Donate Now', 'give' ), |
|
277 | + 'placeholder' => __('Donate Now', 'give'), |
|
278 | 278 | ), |
279 | 279 | ), |
280 | 280 | array( |
281 | - 'name' => __( 'Default Gateway', 'give' ), |
|
282 | - 'desc' => __( 'By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give' ), |
|
283 | - 'id' => $prefix . 'default_gateway', |
|
281 | + 'name' => __('Default Gateway', 'give'), |
|
282 | + 'desc' => __('By default, the gateway for this form will inherit the global default gateway (set under Give > Settings > Payment Gateways). This option allows you to customize the default gateway for this form only.', 'give'), |
|
283 | + 'id' => $prefix.'default_gateway', |
|
284 | 284 | 'type' => 'default_gateway' |
285 | 285 | ), |
286 | 286 | array( |
287 | - 'name' => __( 'Disable Guest Donations', 'give' ), |
|
288 | - 'desc' => __( 'Do you want to require users be logged-in to make donations?', 'give' ), |
|
289 | - 'id' => $prefix . 'logged_in_only', |
|
287 | + 'name' => __('Disable Guest Donations', 'give'), |
|
288 | + 'desc' => __('Do you want to require users be logged-in to make donations?', 'give'), |
|
289 | + 'id' => $prefix.'logged_in_only', |
|
290 | 290 | 'type' => 'checkbox' |
291 | 291 | ), |
292 | 292 | array( |
293 | - 'name' => __( 'Register / Login Form', 'give' ), |
|
294 | - 'desc' => __( 'Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give' ), |
|
295 | - 'id' => $prefix . 'show_register_form', |
|
293 | + 'name' => __('Register / Login Form', 'give'), |
|
294 | + 'desc' => __('Display the registration and login forms in the checkout section for non-logged-in users. Note: this option will not require users to register or log in prior to completing a donation. It simply determines whether the login and/or registration form are displayed on the checkout page.', 'give'), |
|
295 | + 'id' => $prefix.'show_register_form', |
|
296 | 296 | 'type' => 'select', |
297 | 297 | 'options' => array( |
298 | - 'both' => __( 'Registration and Login Forms', 'give' ), |
|
299 | - 'registration' => __( 'Registration Form Only', 'give' ), |
|
300 | - 'login' => __( 'Login Form Only', 'give' ), |
|
301 | - 'none' => __( 'None', 'give' ), |
|
298 | + 'both' => __('Registration and Login Forms', 'give'), |
|
299 | + 'registration' => __('Registration Form Only', 'give'), |
|
300 | + 'login' => __('Login Form Only', 'give'), |
|
301 | + 'none' => __('None', 'give'), |
|
302 | 302 | ), |
303 | 303 | 'default' => 'none', |
304 | 304 | ), |
305 | 305 | array( |
306 | - 'name' => __( 'Floating Labels', 'give' ), |
|
307 | - 'desc' => sprintf( __( 'Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give' ), esc_url( "http://bradfrost.com/blog/post/float-label-pattern/" ) ), |
|
308 | - 'id' => $prefix . 'form_floating_labels', |
|
306 | + 'name' => __('Floating Labels', 'give'), |
|
307 | + 'desc' => sprintf(__('Select the <a href="%s" target="_blank">floating labels</a> setting for this Give form.<br>Be aware that if you have the "Disable CSS" option enabled, you will need to style the floating labels yourself.', 'give'), esc_url("http://bradfrost.com/blog/post/float-label-pattern/")), |
|
308 | + 'id' => $prefix.'form_floating_labels', |
|
309 | 309 | 'type' => 'select', |
310 | 310 | 'options' => array( |
311 | - '' => __( 'Use the global setting', 'give' ), |
|
312 | - 'enabled' => __( 'Enabled', 'give' ), |
|
313 | - 'disabled' => __( 'Disabled', 'give' ), |
|
311 | + '' => __('Use the global setting', 'give'), |
|
312 | + 'enabled' => __('Enabled', 'give'), |
|
313 | + 'disabled' => __('Disabled', 'give'), |
|
314 | 314 | ), |
315 | 315 | 'default' => 'none', |
316 | 316 | ) |
@@ -322,47 +322,47 @@ discard block |
||
322 | 322 | /** |
323 | 323 | * Terms & Conditions |
324 | 324 | */ |
325 | - $meta_boxes['form_terms_options'] = apply_filters( 'give_forms_terms_options', array( |
|
325 | + $meta_boxes['form_terms_options'] = apply_filters('give_forms_terms_options', array( |
|
326 | 326 | 'id' => 'form_terms_options', |
327 | - 'title' => __( 'Terms and Conditions', 'give' ), |
|
328 | - 'object_types' => array( 'give_forms' ), |
|
327 | + 'title' => __('Terms and Conditions', 'give'), |
|
328 | + 'object_types' => array('give_forms'), |
|
329 | 329 | 'context' => 'normal', |
330 | 330 | 'priority' => 'high', //Show above Content WYSIWYG |
331 | - 'fields' => apply_filters( 'give_forms_terms_options_metabox_fields', array( |
|
331 | + 'fields' => apply_filters('give_forms_terms_options_metabox_fields', array( |
|
332 | 332 | //Donation Option |
333 | 333 | array( |
334 | - 'name' => __( 'Terms and Conditions', 'give' ), |
|
335 | - 'description' => __( 'Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give' ), |
|
336 | - 'id' => $prefix . 'terms_option', |
|
334 | + 'name' => __('Terms and Conditions', 'give'), |
|
335 | + 'description' => __('Do you want to require the user to agree to terms and conditions prior to being able to complete their donation?', 'give'), |
|
336 | + 'id' => $prefix.'terms_option', |
|
337 | 337 | 'type' => 'select', |
338 | - 'options' => apply_filters( 'give_forms_content_options_select', array( |
|
339 | - 'none' => __( 'No', 'give' ), |
|
340 | - 'yes' => __( 'Yes', 'give' ), |
|
338 | + 'options' => apply_filters('give_forms_content_options_select', array( |
|
339 | + 'none' => __('No', 'give'), |
|
340 | + 'yes' => __('Yes', 'give'), |
|
341 | 341 | ) |
342 | 342 | ), |
343 | 343 | 'default' => 'none', |
344 | 344 | ), |
345 | 345 | array( |
346 | - 'id' => $prefix . 'agree_label', |
|
347 | - 'name' => __( 'Agree to Terms Label', 'give' ), |
|
348 | - 'desc' => __( 'The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give' ), |
|
346 | + 'id' => $prefix.'agree_label', |
|
347 | + 'name' => __('Agree to Terms Label', 'give'), |
|
348 | + 'desc' => __('The label shown next to the agree to terms check box. Add your own to customize or leave blank to use the default text placeholder.', 'give'), |
|
349 | 349 | 'type' => 'text', |
350 | 350 | 'row_classes' => 'give-subfield', |
351 | 351 | 'size' => 'regular', |
352 | 352 | 'attributes' => array( |
353 | - 'placeholder' => __( 'Agree to Terms?', 'give' ), |
|
353 | + 'placeholder' => __('Agree to Terms?', 'give'), |
|
354 | 354 | ), |
355 | 355 | ), |
356 | 356 | array( |
357 | - 'id' => $prefix . 'agree_text', |
|
357 | + 'id' => $prefix.'agree_text', |
|
358 | 358 | 'row_classes' => 'give-subfield', |
359 | - 'name' => __( 'Agreement Text', 'give' ), |
|
360 | - 'desc' => __( 'This is the actual text which the user will have to agree to in order to make a donation.', 'give' ), |
|
359 | + 'name' => __('Agreement Text', 'give'), |
|
360 | + 'desc' => __('This is the actual text which the user will have to agree to in order to make a donation.', 'give'), |
|
361 | 361 | 'type' => 'wysiwyg' |
362 | 362 | ), |
363 | 363 | ) |
364 | 364 | ) |
365 | - ) ); |
|
365 | + )); |
|
366 | 366 | |
367 | 367 | return $meta_boxes; |
368 | 368 | |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | /** |
372 | 372 | * Repeatable Levels Custom Field |
373 | 373 | */ |
374 | -add_action( 'cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10 ); |
|
374 | +add_action('cmb2_render_levels_repeater_header', 'give_cmb_render_levels_repeater_header', 10); |
|
375 | 375 | function give_cmb_render_levels_repeater_header() { |
376 | 376 | ?> |
377 | 377 | |
378 | 378 | <div class="table-container"> |
379 | 379 | <div class="table-row"> |
380 | - <div class="table-cell col-id"><?php _e( 'ID', 'give' ); ?></div> |
|
381 | - <div class="table-cell col-amount"><?php _e( 'Amount', 'give' ); ?></div> |
|
382 | - <div class="table-cell col-text"><?php _e( 'Text', 'give' ); ?></div> |
|
383 | - <div class="table-cell col-default"><?php _e( 'Default', 'give' ); ?></div> |
|
384 | - <?php do_action( 'give_donation_levels_table_head' ); ?> |
|
385 | - <div class="table-cell col-sort"><?php _e( 'Sort', 'give' ); ?></div> |
|
380 | + <div class="table-cell col-id"><?php _e('ID', 'give'); ?></div> |
|
381 | + <div class="table-cell col-amount"><?php _e('Amount', 'give'); ?></div> |
|
382 | + <div class="table-cell col-text"><?php _e('Text', 'give'); ?></div> |
|
383 | + <div class="table-cell col-default"><?php _e('Default', 'give'); ?></div> |
|
384 | + <?php do_action('give_donation_levels_table_head'); ?> |
|
385 | + <div class="table-cell col-sort"><?php _e('Sort', 'give'); ?></div> |
|
386 | 386 | |
387 | 387 | </div> |
388 | 388 | </div> |
@@ -397,22 +397,22 @@ discard block |
||
397 | 397 | * @description: Custom CMB2 incremental Levels ID Field |
398 | 398 | * @since 1.0 |
399 | 399 | */ |
400 | -add_action( 'cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5 ); |
|
401 | -function give_cmb_render_levels_id( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
400 | +add_action('cmb2_render_levels_id', 'give_cmb_render_levels_id', 10, 5); |
|
401 | +function give_cmb_render_levels_id($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
402 | 402 | |
403 | - $escaped_value = ( isset( $escaped_value['level_id'] ) ? $escaped_value['level_id'] : '' ); |
|
403 | + $escaped_value = (isset($escaped_value['level_id']) ? $escaped_value['level_id'] : ''); |
|
404 | 404 | |
405 | 405 | $field_options_array = array( |
406 | 406 | 'class' => 'give-hidden give-level-id-input', |
407 | - 'name' => $field_type_object->_name( '[level_id]' ), |
|
408 | - 'id' => $field_type_object->_id( '_level_id' ), |
|
407 | + 'name' => $field_type_object->_name('[level_id]'), |
|
408 | + 'id' => $field_type_object->_id('_level_id'), |
|
409 | 409 | 'value' => $escaped_value, |
410 | 410 | 'type' => 'number', |
411 | 411 | 'desc' => '', |
412 | 412 | ); |
413 | 413 | |
414 | - echo '<p class="give-level-id">' . $escaped_value . '</p>'; |
|
415 | - echo $field_type_object->input( $field_options_array ); |
|
414 | + echo '<p class="give-level-id">'.$escaped_value.'</p>'; |
|
415 | + echo $field_type_object->input($field_options_array); |
|
416 | 416 | |
417 | 417 | } |
418 | 418 | |
@@ -420,10 +420,10 @@ discard block |
||
420 | 420 | /** |
421 | 421 | * CMB2 Repeatable Default ID Field |
422 | 422 | */ |
423 | -add_action( 'cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5 ); |
|
424 | -function give_cmb_give_default_radio_inline( $field_object, $escaped_value, $object_id, $object_type, $field_type_object ) { |
|
425 | - echo '<input type="radio" class="cmb2-option donation-level-radio" name="' . $field_object->args['_name'] . '" id="' . $field_object->args['id'] . '" value="default" ' . checked( 'default', $escaped_value, false ) . '>'; |
|
426 | - echo '<label for="' . $field_object->args['id'] . '">Default</label>'; |
|
423 | +add_action('cmb2_render_give_default_radio_inline', 'give_cmb_give_default_radio_inline', 10, 5); |
|
424 | +function give_cmb_give_default_radio_inline($field_object, $escaped_value, $object_id, $object_type, $field_type_object) { |
|
425 | + echo '<input type="radio" class="cmb2-option donation-level-radio" name="'.$field_object->args['_name'].'" id="'.$field_object->args['id'].'" value="default" '.checked('default', $escaped_value, false).'>'; |
|
426 | + echo '<label for="'.$field_object->args['id'].'">Default</label>'; |
|
427 | 427 | |
428 | 428 | } |
429 | 429 | |
@@ -435,20 +435,20 @@ discard block |
||
435 | 435 | */ |
436 | 436 | function give_add_shortcode_to_publish_metabox() { |
437 | 437 | |
438 | - if ( 'give_forms' !== get_post_type() ) { |
|
438 | + if ('give_forms' !== get_post_type()) { |
|
439 | 439 | return false; |
440 | 440 | } |
441 | 441 | |
442 | 442 | global $post; |
443 | 443 | |
444 | 444 | //Only enqueue scripts for CPT on post type screen |
445 | - if ( 'give_forms' === $post->post_type ) { |
|
445 | + if ('give_forms' === $post->post_type) { |
|
446 | 446 | //Shortcode column with select all input |
447 | - $shortcode = htmlentities( '[give_form id="' . $post->ID . '"]' ); |
|
448 | - echo '<div class="shortcode-wrap box-sizing"><label>' . __( 'Give Form Shortcode:', 'give' ) . '</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="' . $shortcode . '"></div>'; |
|
447 | + $shortcode = htmlentities('[give_form id="'.$post->ID.'"]'); |
|
448 | + echo '<div class="shortcode-wrap box-sizing"><label>'.__('Give Form Shortcode:', 'give').'</label><input onClick="this.setSelectionRange(0, this.value.length)" type="text" class="shortcode-input" readonly value="'.$shortcode.'"></div>'; |
|
449 | 449 | |
450 | 450 | } |
451 | 451 | |
452 | 452 | } |
453 | 453 | |
454 | -add_action( 'post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox' ); |
|
454 | +add_action('post_submitbox_misc_actions', 'give_add_shortcode_to_publish_metabox'); |
@@ -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 | /** |
@@ -51,38 +51,38 @@ discard block |
||
51 | 51 | public function admin_menus() { |
52 | 52 | // About Page |
53 | 53 | add_dashboard_page( |
54 | - __( 'Welcome to Give', 'give' ), |
|
55 | - __( 'Welcome to Give', 'give' ), |
|
54 | + __('Welcome to Give', 'give'), |
|
55 | + __('Welcome to Give', 'give'), |
|
56 | 56 | $this->minimum_capability, |
57 | 57 | 'give-about', |
58 | - array( $this, 'about_screen' ) |
|
58 | + array($this, 'about_screen') |
|
59 | 59 | ); |
60 | 60 | |
61 | 61 | // Changelog Page |
62 | 62 | add_dashboard_page( |
63 | - __( 'Give Changelog', 'give' ), |
|
64 | - __( 'Give Changelog', 'give' ), |
|
63 | + __('Give Changelog', 'give'), |
|
64 | + __('Give Changelog', 'give'), |
|
65 | 65 | $this->minimum_capability, |
66 | 66 | 'give-changelog', |
67 | - array( $this, 'changelog_screen' ) |
|
67 | + array($this, 'changelog_screen') |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | // Getting Started Page |
71 | 71 | add_dashboard_page( |
72 | - __( 'Getting started with Give', 'give' ), |
|
73 | - __( 'Getting started with Give', 'give' ), |
|
72 | + __('Getting started with Give', 'give'), |
|
73 | + __('Getting started with Give', 'give'), |
|
74 | 74 | $this->minimum_capability, |
75 | 75 | 'give-getting-started', |
76 | - array( $this, 'getting_started_screen' ) |
|
76 | + array($this, 'getting_started_screen') |
|
77 | 77 | ); |
78 | 78 | |
79 | 79 | // Credits Page |
80 | 80 | add_dashboard_page( |
81 | - __( 'The people that build Give', 'give' ), |
|
82 | - __( 'The people that build Give', 'give' ), |
|
81 | + __('The people that build Give', 'give'), |
|
82 | + __('The people that build Give', 'give'), |
|
83 | 83 | $this->minimum_capability, |
84 | 84 | 'give-credits', |
85 | - array( $this, 'credits_screen' ) |
|
85 | + array($this, 'credits_screen') |
|
86 | 86 | ); |
87 | 87 | } |
88 | 88 | |
@@ -95,13 +95,13 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function admin_head() { |
97 | 97 | |
98 | - remove_submenu_page( 'index.php', 'give-about' ); |
|
99 | - remove_submenu_page( 'index.php', 'give-changelog' ); |
|
100 | - remove_submenu_page( 'index.php', 'give-getting-started' ); |
|
101 | - remove_submenu_page( 'index.php', 'give-credits' ); |
|
98 | + remove_submenu_page('index.php', 'give-about'); |
|
99 | + remove_submenu_page('index.php', 'give-changelog'); |
|
100 | + remove_submenu_page('index.php', 'give-getting-started'); |
|
101 | + remove_submenu_page('index.php', 'give-credits'); |
|
102 | 102 | |
103 | 103 | // Badge for welcome page |
104 | - $badge_url = GIVE_PLUGIN_URL . 'assets/images/give-badge.png'; |
|
104 | + $badge_url = GIVE_PLUGIN_URL.'assets/images/give-badge.png'; |
|
105 | 105 | |
106 | 106 | ?> |
107 | 107 | <style type="text/css" media="screen"> |
@@ -215,20 +215,20 @@ discard block |
||
215 | 215 | * @return void |
216 | 216 | */ |
217 | 217 | public function tabs() { |
218 | - $selected = isset( $_GET['page'] ) ? $_GET['page'] : 'give-about'; |
|
218 | + $selected = isset($_GET['page']) ? $_GET['page'] : 'give-about'; |
|
219 | 219 | ?> |
220 | 220 | <h1 class="nav-tab-wrapper"> |
221 | - <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-about' ), 'index.php' ) ) ); ?>"> |
|
222 | - <?php _e( "About Give", 'give' ); ?> |
|
221 | + <a class="nav-tab <?php echo $selected == 'give-about' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-about'), 'index.php'))); ?>"> |
|
222 | + <?php _e("About Give", 'give'); ?> |
|
223 | 223 | </a> |
224 | - <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-getting-started' ), 'index.php' ) ) ); ?>"> |
|
225 | - <?php _e( 'Getting Started', 'give' ); ?> |
|
224 | + <a class="nav-tab <?php echo $selected == 'give-getting-started' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-getting-started'), 'index.php'))); ?>"> |
|
225 | + <?php _e('Getting Started', 'give'); ?> |
|
226 | 226 | </a> |
227 | - <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'give-credits' ), 'index.php' ) ) ); ?>"> |
|
228 | - <?php _e( 'Credits', 'give' ); ?> |
|
227 | + <a class="nav-tab <?php echo $selected == 'give-credits' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'give-credits'), 'index.php'))); ?>"> |
|
228 | + <?php _e('Credits', 'give'); ?> |
|
229 | 229 | </a> |
230 | - <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url( admin_url( null, 'index.php' ) ) . 'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | - <?php _e( 'Add-ons', 'give' ); ?> |
|
230 | + <a class="nav-tab <?php echo $selected == 'give-add-ons' ? 'nav-tab-active' : ''; ?>" href="<?php echo esc_url(admin_url(null, 'index.php')).'edit.php?post_type=give_forms&page=give-addons'; ?>"> |
|
231 | + <?php _e('Add-ons', 'give'); ?> |
|
232 | 232 | </a> |
233 | 233 | </h1> |
234 | 234 | <?php |
@@ -242,20 +242,20 @@ discard block |
||
242 | 242 | * @return void |
243 | 243 | */ |
244 | 244 | public function about_screen() { |
245 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
245 | + list($display_version) = explode('-', GIVE_VERSION); |
|
246 | 246 | ?> |
247 | 247 | <div class="wrap about-wrap"> |
248 | - <h1 class="welcome-h1"><?php printf( __( 'Welcome to Give %s', 'give' ), $display_version ); ?></h1> |
|
248 | + <h1 class="welcome-h1"><?php printf(__('Welcome to Give %s', 'give'), $display_version); ?></h1> |
|
249 | 249 | |
250 | 250 | <?php give_social_media_elements() ?> |
251 | 251 | |
252 | - <div class="about-text"><?php printf( __( '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. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give' ), 'https://givewp.com/documenation/' ); ?></div> |
|
252 | + <div class="about-text"><?php printf(__('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. </You>We encourage you to check out the <a href="%s" title="View the Give plugin documentation online" target="_blank">plugin documentation</a> and getting started guide below.', 'give'), 'https://givewp.com/documenation/'); ?></div> |
|
253 | 253 | |
254 | - <p class="newsletter-intro"><?php _e( 'Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give' ); ?></p> |
|
254 | + <p class="newsletter-intro"><?php _e('Be sure to sign up for the Give newsletter below to stay informed of important updates and news.', 'give'); ?></p> |
|
255 | 255 | |
256 | 256 | <?php give_get_newsletter() ?> |
257 | 257 | |
258 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
258 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
259 | 259 | |
260 | 260 | |
261 | 261 | |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | <div class="feature-section clearfix introduction"> |
265 | 265 | |
266 | 266 | <div class="video feature-section-item"> |
267 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
267 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-form-mockup.png' ?>" title="A Give donation form" alt="A Give donation form"> |
|
268 | 268 | |
269 | 269 | </div> |
270 | 270 | |
271 | 271 | <div class="content feature-section-item last-feature"> |
272 | 272 | |
273 | - <h3><?php _e( 'Give - Democratizing Generosity', 'give' ); ?></h3> |
|
273 | + <h3><?php _e('Give - Democratizing Generosity', 'give'); ?></h3> |
|
274 | 274 | |
275 | - <p><?php _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> |
|
275 | + <p><?php _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> |
|
276 | 276 | <a href="https://givewp.com" target="_blank" class="button-secondary" title="Visit the Give Website">Learn More |
277 | 277 | <span class="dashicons dashicons-external"></span></a> |
278 | 278 | |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | |
286 | 286 | <div class="content feature-section-item"> |
287 | 287 | |
288 | - <h3><?php _e( 'Getting to Know Give', 'give' ); ?></h3> |
|
288 | + <h3><?php _e('Getting to Know Give', 'give'); ?></h3> |
|
289 | 289 | |
290 | - <p><?php _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 an 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> |
|
290 | + <p><?php _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 an 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> |
|
291 | 291 | <a href="https://givewp.com/documentation" target="_blank" class="button-secondary" title="Visit the Give Website">View Documentation |
292 | 292 | <span class="dashicons dashicons-external"></span></a> |
293 | 293 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | <div class="content feature-section-item last-feature"> |
297 | 297 | |
298 | - <img src="<?php echo GIVE_PLUGIN_URL . '/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
298 | + <img src="<?php echo GIVE_PLUGIN_URL.'/assets/images/give-logo-photo-mashup.png' ?>" title="Give" alt="Give"> |
|
299 | 299 | |
300 | 300 | </div> |
301 | 301 | |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | * @return void |
316 | 316 | */ |
317 | 317 | public function changelog_screen() { |
318 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
318 | + list($display_version) = explode('-', GIVE_VERSION); |
|
319 | 319 | ?> |
320 | 320 | <div class="wrap about-wrap"> |
321 | - <h1><?php _e( 'Give Changelog', 'give' ); ?></h1> |
|
321 | + <h1><?php _e('Give Changelog', 'give'); ?></h1> |
|
322 | 322 | |
323 | - <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give' ), $display_version ); ?></div> |
|
324 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
323 | + <div class="about-text"><?php printf(__('Thank you for updating to the latest version! Give %s is ready to make your online store faster, safer, and better!', 'give'), $display_version); ?></div> |
|
324 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
325 | 325 | |
326 | 326 | <?php $this->tabs(); ?> |
327 | 327 | |
328 | 328 | <div class="changelog"> |
329 | - <h3><?php _e( 'Full Changelog', 'give' ); ?></h3> |
|
329 | + <h3><?php _e('Full Changelog', 'give'); ?></h3> |
|
330 | 330 | |
331 | 331 | <div class="feature-section"> |
332 | 332 | <?php echo $this->parse_readme(); ?> |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | </div> |
335 | 335 | |
336 | 336 | <div class="return-to-dashboard"> |
337 | - <a href="<?php echo esc_url( admin_url( add_query_arg( array( |
|
337 | + <a href="<?php echo esc_url(admin_url(add_query_arg(array( |
|
338 | 338 | 'post_type' => 'give_forms', |
339 | 339 | 'page' => 'give-settings' |
340 | - ), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Give Settings', 'give' ); ?></a> |
|
340 | + ), 'edit.php'))); ?>"><?php _e('Go to Give Settings', 'give'); ?></a> |
|
341 | 341 | </div> |
342 | 342 | </div> |
343 | 343 | <?php |
@@ -351,35 +351,35 @@ discard block |
||
351 | 351 | * @return void |
352 | 352 | */ |
353 | 353 | public function getting_started_screen() { |
354 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
354 | + list($display_version) = explode('-', GIVE_VERSION); |
|
355 | 355 | ?> |
356 | 356 | <div class="wrap about-wrap get-started"> |
357 | - <h1 class="welcome-h1"><?php printf( __( 'Give %s - Getting Started Guide', 'give' ), $display_version ); ?></h1> |
|
357 | + <h1 class="welcome-h1"><?php printf(__('Give %s - Getting Started Guide', 'give'), $display_version); ?></h1> |
|
358 | 358 | |
359 | 359 | <?php give_social_media_elements() ?> |
360 | 360 | |
361 | - <div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div> |
|
361 | + <div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div> |
|
362 | 362 | |
363 | - <p class="newsletter-intro"><?php _e( 'Don\'t forget to sign up for the newsletter!', 'give' ); ?>.</p> |
|
363 | + <p class="newsletter-intro"><?php _e('Don\'t forget to sign up for the newsletter!', 'give'); ?>.</p> |
|
364 | 364 | |
365 | 365 | <?php give_get_newsletter() ?> |
366 | 366 | |
367 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
367 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
368 | 368 | |
369 | 369 | <?php $this->tabs(); ?> |
370 | 370 | |
371 | 371 | |
372 | - <div class="about-text"><?php printf( __( '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 ); ?></div> |
|
372 | + <div class="about-text"><?php printf(__('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); ?></div> |
|
373 | 373 | |
374 | 374 | |
375 | 375 | <div class="feature-section clearfix"> |
376 | 376 | |
377 | 377 | <div class="content feature-section-item"> |
378 | - <h3><?php _e( 'STEP 1: Create a New Form', 'give' ); ?></h3> |
|
378 | + <h3><?php _e('STEP 1: Create a New Form', 'give'); ?></h3> |
|
379 | 379 | |
380 | - <p><?php _e( 'Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give' ); ?></p> |
|
380 | + <p><?php _e('Give is driven by it\'s powerful form building features. But it is not simply a "form". From the "Add New Form" page you\'ll be able to choose how and where you want to receive your donations. You\'ll be able to set the donation amounts. You even get to choose whether you want to create a whole page for your form, or embed it on a different page of your site.', 'give'); ?></p> |
|
381 | 381 | |
382 | - <p><?php _e( 'But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give' ); ?></p> |
|
382 | + <p><?php _e('But all of these features begin simply by going to the menu and choosing "Add New Form."', 'give'); ?></p> |
|
383 | 383 | </div> |
384 | 384 | |
385 | 385 | <div class="content feature-section-item last-feature"> |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | </div> |
397 | 397 | |
398 | 398 | <div class="content feature-section-item last-feature"> |
399 | - <h3><?php _e( 'STEP 2: Choose Your Levels', 'give' ); ?></h3> |
|
399 | + <h3><?php _e('STEP 2: Choose Your Levels', 'give'); ?></h3> |
|
400 | 400 | |
401 | - <p><?php _e( 'Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give' ); ?></p> |
|
401 | + <p><?php _e('Each Form can be set to receive either a pre-determined amount or have multiple suggested levels of giving. Choosing "Multi-level Donation" opens up the levels section where you can add as many levels as you like with your own custom names and amounts.', 'give'); ?></p> |
|
402 | 402 | </div> |
403 | 403 | |
404 | 404 | </div> |
@@ -407,11 +407,11 @@ discard block |
||
407 | 407 | <div class="feature-section clearfix"> |
408 | 408 | |
409 | 409 | <div class="content feature-section-item add-content"> |
410 | - <h3><?php _e( 'STEP 3: Landing Page or Shortcode Mode?', 'give' ); ?></h3> |
|
410 | + <h3><?php _e('STEP 3: Landing Page or Shortcode Mode?', 'give'); ?></h3> |
|
411 | 411 | |
412 | - <p><?php _e( 'Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give' ); ?></p> |
|
412 | + <p><?php _e('Every form you create in Give can either become it\'s own stand-alone page, or it can be inserted into any other page or post throughout your site as a Shortcode.', 'give'); ?></p> |
|
413 | 413 | |
414 | - <p><?php _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> |
|
414 | + <p><?php _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> |
|
415 | 415 | </div> |
416 | 416 | |
417 | 417 | <div class="content feature-section-item last-feature"> |
@@ -428,9 +428,9 @@ discard block |
||
428 | 428 | </div> |
429 | 429 | |
430 | 430 | <div class="content feature-section-item last-feature"> |
431 | - <h3><?php _e( 'STEP 4: Configure Your Display Options', 'give' ); ?></h3> |
|
431 | + <h3><?php _e('STEP 4: Configure Your Display Options', 'give'); ?></h3> |
|
432 | 432 | |
433 | - <p><?php _e( 'Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give' ); ?></p> |
|
433 | + <p><?php _e('Lastly, you can present the form in a lot of different ways. With the "Display Options" section you can configure how the credit card field appears, the submit button text, which Gateway you want to use, whether Guests (non-logged in users) can donate or not, and a log-in form.', 'give'); ?></p> |
|
434 | 434 | </div> |
435 | 435 | |
436 | 436 | |
@@ -450,26 +450,26 @@ discard block |
||
450 | 450 | * @return void |
451 | 451 | */ |
452 | 452 | public function credits_screen() { |
453 | - list( $display_version ) = explode( '-', GIVE_VERSION ); |
|
453 | + list($display_version) = explode('-', GIVE_VERSION); |
|
454 | 454 | ?> |
455 | 455 | <div class="wrap about-wrap"> |
456 | - <h1 class="welcome-h1"><?php printf( __( 'Give %s - Credits', 'give' ), $display_version ); ?></h1> |
|
456 | + <h1 class="welcome-h1"><?php printf(__('Give %s - Credits', 'give'), $display_version); ?></h1> |
|
457 | 457 | |
458 | 458 | <?php give_social_media_elements() ?> |
459 | 459 | |
460 | - <div class="about-text"><?php printf( __( 'Thanks to all those who have contributed code directly or indirectly. ', 'give' ), $display_version ); ?></div> |
|
460 | + <div class="about-text"><?php printf(__('Thanks to all those who have contributed code directly or indirectly. ', 'give'), $display_version); ?></div> |
|
461 | 461 | |
462 | - <div class="about-text"><?php _e( 'Welcome to the getting started guide.', 'give' ); ?></div> |
|
462 | + <div class="about-text"><?php _e('Welcome to the getting started guide.', 'give'); ?></div> |
|
463 | 463 | |
464 | 464 | <p class="newsletter-intro">Be sure to sign up for the Give newsletter below to stay informed of important updates and news.</p> |
465 | 465 | |
466 | 466 | <?php give_get_newsletter() ?> |
467 | 467 | |
468 | - <div class="give-badge"><?php printf( __( 'Version %s', 'give' ), $display_version ); ?></div> |
|
468 | + <div class="give-badge"><?php printf(__('Version %s', 'give'), $display_version); ?></div> |
|
469 | 469 | |
470 | 470 | <?php $this->tabs(); ?> |
471 | 471 | |
472 | - <p class="about-description"><?php _e( 'Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give' ); ?></p> |
|
472 | + <p class="about-description"><?php _e('Give is created by a dedicated team of developers. If you are interested in contributing please visit the <a href="https://github.com/WordImpress/give" target="_blank">GitHub Repo</a>.', 'give'); ?></p> |
|
473 | 473 | |
474 | 474 | <?php echo $this->contributors(); ?> |
475 | 475 | </div> |
@@ -484,21 +484,21 @@ discard block |
||
484 | 484 | * @return string $readme HTML formatted readme file |
485 | 485 | */ |
486 | 486 | public function parse_readme() { |
487 | - $file = file_exists( GIVE_PLUGIN_DIR . 'readme.txt' ) ? GIVE_PLUGIN_DIR . 'readme.txt' : null; |
|
487 | + $file = file_exists(GIVE_PLUGIN_DIR.'readme.txt') ? GIVE_PLUGIN_DIR.'readme.txt' : null; |
|
488 | 488 | |
489 | - if ( ! $file ) { |
|
490 | - $readme = '<p>' . __( 'No valid changlog was found.', 'give' ) . '</p>'; |
|
489 | + if ( ! $file) { |
|
490 | + $readme = '<p>'.__('No valid changlog was found.', 'give').'</p>'; |
|
491 | 491 | } else { |
492 | - $readme = file_get_contents( $file ); |
|
493 | - $readme = nl2br( esc_html( $readme ) ); |
|
494 | - $readme = explode( '== Changelog ==', $readme ); |
|
495 | - $readme = end( $readme ); |
|
496 | - |
|
497 | - $readme = preg_replace( '/`(.*?)`/', '<code>\\1</code>', $readme ); |
|
498 | - $readme = preg_replace( '/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme ); |
|
499 | - $readme = preg_replace( '/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme ); |
|
500 | - $readme = preg_replace( '/= (.*?) =/', '<h4>\\1</h4>', $readme ); |
|
501 | - $readme = preg_replace( '/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme ); |
|
492 | + $readme = file_get_contents($file); |
|
493 | + $readme = nl2br(esc_html($readme)); |
|
494 | + $readme = explode('== Changelog ==', $readme); |
|
495 | + $readme = end($readme); |
|
496 | + |
|
497 | + $readme = preg_replace('/`(.*?)`/', '<code>\\1</code>', $readme); |
|
498 | + $readme = preg_replace('/[\040]\*\*(.*?)\*\*/', ' <strong>\\1</strong>', $readme); |
|
499 | + $readme = preg_replace('/[\040]\*(.*?)\*/', ' <em>\\1</em>', $readme); |
|
500 | + $readme = preg_replace('/= (.*?) =/', '<h4>\\1</h4>', $readme); |
|
501 | + $readme = preg_replace('/\[(.*?)\]\((.*?)\)/', '<a href="\\2">\\1</a>', $readme); |
|
502 | 502 | } |
503 | 503 | |
504 | 504 | return $readme; |
@@ -515,21 +515,21 @@ discard block |
||
515 | 515 | public function contributors() { |
516 | 516 | $contributors = $this->get_contributors(); |
517 | 517 | |
518 | - if ( empty( $contributors ) ) { |
|
518 | + if (empty($contributors)) { |
|
519 | 519 | return ''; |
520 | 520 | } |
521 | 521 | |
522 | 522 | $contributor_list = '<ul class="wp-people-group">'; |
523 | 523 | |
524 | - foreach ( $contributors as $contributor ) { |
|
524 | + foreach ($contributors as $contributor) { |
|
525 | 525 | $contributor_list .= '<li class="wp-person">'; |
526 | - $contributor_list .= sprintf( '<a href="%s" title="%s">', |
|
527 | - esc_url( 'https://github.com/' . $contributor->login ), |
|
528 | - esc_html( sprintf( __( 'View %s', 'give' ), $contributor->login ) ) |
|
526 | + $contributor_list .= sprintf('<a href="%s" title="%s">', |
|
527 | + esc_url('https://github.com/'.$contributor->login), |
|
528 | + esc_html(sprintf(__('View %s', 'give'), $contributor->login)) |
|
529 | 529 | ); |
530 | - $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) ); |
|
530 | + $contributor_list .= sprintf('<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url($contributor->avatar_url), esc_html($contributor->login)); |
|
531 | 531 | $contributor_list .= '</a>'; |
532 | - $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) ); |
|
532 | + $contributor_list .= sprintf('<a class="web" href="%s">%s</a>', esc_url('https://github.com/'.$contributor->login), esc_html($contributor->login)); |
|
533 | 533 | $contributor_list .= '</a>'; |
534 | 534 | $contributor_list .= '</li>'; |
535 | 535 | } |
@@ -547,25 +547,25 @@ discard block |
||
547 | 547 | * @return array $contributors List of contributors |
548 | 548 | */ |
549 | 549 | public function get_contributors() { |
550 | - $contributors = get_transient( 'give_contributors' ); |
|
550 | + $contributors = get_transient('give_contributors'); |
|
551 | 551 | |
552 | - if ( false !== $contributors ) { |
|
552 | + if (false !== $contributors) { |
|
553 | 553 | return $contributors; |
554 | 554 | } |
555 | 555 | |
556 | - $response = wp_remote_get( 'https://api.github.com/repos/WordImpress/Give/contributors', array( 'sslverify' => false ) ); |
|
556 | + $response = wp_remote_get('https://api.github.com/repos/WordImpress/Give/contributors', array('sslverify' => false)); |
|
557 | 557 | |
558 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
558 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
559 | 559 | return array(); |
560 | 560 | } |
561 | 561 | |
562 | - $contributors = json_decode( wp_remote_retrieve_body( $response ) ); |
|
562 | + $contributors = json_decode(wp_remote_retrieve_body($response)); |
|
563 | 563 | |
564 | - if ( ! is_array( $contributors ) ) { |
|
564 | + if ( ! is_array($contributors)) { |
|
565 | 565 | return array(); |
566 | 566 | } |
567 | 567 | |
568 | - set_transient( 'give_contributors', $contributors, 3600 ); |
|
568 | + set_transient('give_contributors', $contributors, 3600); |
|
569 | 569 | |
570 | 570 | return $contributors; |
571 | 571 | } |
@@ -584,24 +584,24 @@ discard block |
||
584 | 584 | |
585 | 585 | |
586 | 586 | // Bail if no activation redirect |
587 | - if ( ! get_transient( '_give_activation_redirect' ) ) { |
|
587 | + if ( ! get_transient('_give_activation_redirect')) { |
|
588 | 588 | return; |
589 | 589 | } |
590 | 590 | |
591 | 591 | // Delete the redirect transient |
592 | - delete_transient( '_give_activation_redirect' ); |
|
592 | + delete_transient('_give_activation_redirect'); |
|
593 | 593 | |
594 | 594 | // Bail if activating from network, or bulk |
595 | - if ( is_network_admin() || isset( $_GET['activate-multi'] ) ) { |
|
595 | + if (is_network_admin() || isset($_GET['activate-multi'])) { |
|
596 | 596 | return; |
597 | 597 | } |
598 | 598 | |
599 | - $upgrade = get_option( 'give_version_upgraded_from' ); |
|
599 | + $upgrade = get_option('give_version_upgraded_from'); |
|
600 | 600 | |
601 | - if ( ! $upgrade ) { // First time install |
|
602 | - wp_safe_redirect( admin_url( 'index.php?page=give-about' ) ); |
|
601 | + if ( ! $upgrade) { // First time install |
|
602 | + wp_safe_redirect(admin_url('index.php?page=give-about')); |
|
603 | 603 | exit; |
604 | - } elseif( isset( $give_options['disable_welcome'] ) ) { // Welcome is disabled in settings |
|
604 | + } elseif (isset($give_options['disable_welcome'])) { // Welcome is disabled in settings |
|
605 | 605 | |
606 | 606 | } else { // Welcome is NOT disabled in settings |
607 | 607 | wp_safe_redirect(admin_url('index.php?page=give-about')); |