@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.3.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) or exit; |
|
| 12 | +defined('ABSPATH') or exit; |
|
| 13 | 13 | |
| 14 | 14 | class Give_Shortcode_Login extends Give_Shortcode_Generator { |
| 15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - $this->shortcode['title'] = esc_html( 'Login', 'give' ); |
|
| 22 | - $this->shortcode['label'] = esc_html( 'Login', 'give' ); |
|
| 21 | + $this->shortcode['title'] = esc_html('Login', 'give'); |
|
| 22 | + $this->shortcode['label'] = esc_html('Login', 'give'); |
|
| 23 | 23 | |
| 24 | - parent::__construct( 'give_login' ); |
|
| 24 | + parent::__construct('give_login'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -34,13 +34,13 @@ discard block |
||
| 34 | 34 | return array( |
| 35 | 35 | array( |
| 36 | 36 | 'type' => 'container', |
| 37 | - 'html' => sprintf( '<p class="no-margin">%s</p>', esc_html( 'Redirect URL (optional):', 'give' ) ), |
|
| 37 | + 'html' => sprintf('<p class="no-margin">%s</p>', esc_html('Redirect URL (optional):', 'give')), |
|
| 38 | 38 | ), |
| 39 | 39 | array( |
| 40 | 40 | 'type' => 'textbox', |
| 41 | 41 | 'name' => 'redirect', |
| 42 | 42 | 'minWidth' => 320, |
| 43 | - 'tooltip' => esc_attr( 'Enter an URL here to redirect to after login.', 'give' ), |
|
| 43 | + 'tooltip' => esc_attr('Enter an URL here to redirect to after login.', 'give'), |
|
| 44 | 44 | ), |
| 45 | 45 | ); |
| 46 | 46 | } |
@@ -248,8 +248,8 @@ |
||
| 248 | 248 | |
| 249 | 249 | // do not reindex array! |
| 250 | 250 | $field['options'] = array( |
| 251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_html( '- Select -', 'give' ) ), |
|
| 252 | - ) + $field['options']; |
|
| 251 | + '' => ( $field['placeholder'] ? $field['placeholder'] : esc_html( '- Select -', 'give' ) ), |
|
| 252 | + ) + $field['options']; |
|
| 253 | 253 | |
| 254 | 254 | foreach ( $field['options'] as $value => $text ) { |
| 255 | 255 | $new_listbox['values'][] = array( |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @since 1.3.0 |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -defined( 'ABSPATH' ) or exit; |
|
| 14 | +defined('ABSPATH') or exit; |
|
| 15 | 15 | |
| 16 | 16 | abstract class Give_Shortcode_Generator { |
| 17 | 17 | |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @since 1.0 |
| 59 | 59 | */ |
| 60 | - public function __construct( $shortcode ) { |
|
| 60 | + public function __construct($shortcode) { |
|
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | $this->shortcode_tag = $shortcode; |
| 64 | 64 | |
| 65 | - add_action( 'admin_init', array( $this, 'init' ) ); |
|
| 65 | + add_action('admin_init', array($this, 'init')); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -73,9 +73,9 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function init() { |
| 75 | 75 | |
| 76 | - if ( $this->shortcode_tag ) { |
|
| 76 | + if ($this->shortcode_tag) { |
|
| 77 | 77 | |
| 78 | - $this->self = get_class( $this ); |
|
| 78 | + $this->self = get_class($this); |
|
| 79 | 79 | |
| 80 | 80 | $this->errors = array(); |
| 81 | 81 | $this->required = array(); |
@@ -84,18 +84,18 @@ discard block |
||
| 84 | 84 | $fields = $this->get_fields(); |
| 85 | 85 | |
| 86 | 86 | $defaults = array( |
| 87 | - 'btn_close' => esc_html( 'Close', 'give' ), |
|
| 88 | - 'btn_okay' => esc_html( 'Insert Shortcode', 'give' ), |
|
| 87 | + 'btn_close' => esc_html('Close', 'give'), |
|
| 88 | + 'btn_okay' => esc_html('Insert Shortcode', 'give'), |
|
| 89 | 89 | 'errors' => $this->errors, |
| 90 | 90 | 'fields' => $fields, |
| 91 | - 'label' => '[' . $this->shortcode_tag . ']', |
|
| 91 | + 'label' => '['.$this->shortcode_tag.']', |
|
| 92 | 92 | 'required' => $this->required, |
| 93 | - 'title' => esc_attr( 'Insert Shortcode', 'give' ), |
|
| 93 | + 'title' => esc_attr('Insert Shortcode', 'give'), |
|
| 94 | 94 | ); |
| 95 | 95 | |
| 96 | - if ( user_can_richedit() ) { |
|
| 96 | + if (user_can_richedit()) { |
|
| 97 | 97 | |
| 98 | - Give_Shortcode_Button::$shortcodes[ $this->shortcode_tag ] = wp_parse_args( $this->shortcode, $defaults ); |
|
| 98 | + Give_Shortcode_Button::$shortcodes[$this->shortcode_tag] = wp_parse_args($this->shortcode, $defaults); |
|
| 99 | 99 | |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -124,13 +124,13 @@ discard block |
||
| 124 | 124 | * |
| 125 | 125 | * @since 1.0 |
| 126 | 126 | */ |
| 127 | - protected function generate_fields( $defined_fields ) { |
|
| 127 | + protected function generate_fields($defined_fields) { |
|
| 128 | 128 | |
| 129 | 129 | $fields = array(); |
| 130 | 130 | |
| 131 | - if ( is_array( $defined_fields ) ) { |
|
| 131 | + if (is_array($defined_fields)) { |
|
| 132 | 132 | |
| 133 | - foreach ( $defined_fields as $field ) { |
|
| 133 | + foreach ($defined_fields as $field) { |
|
| 134 | 134 | |
| 135 | 135 | $defaults = array( |
| 136 | 136 | 'label' => false, |
@@ -141,14 +141,14 @@ discard block |
||
| 141 | 141 | 'type' => '', |
| 142 | 142 | ); |
| 143 | 143 | |
| 144 | - $field = wp_parse_args( (array) $field, $defaults ); |
|
| 145 | - $method = 'generate_' . strtolower( $field['type'] ); |
|
| 144 | + $field = wp_parse_args((array) $field, $defaults); |
|
| 145 | + $method = 'generate_'.strtolower($field['type']); |
|
| 146 | 146 | |
| 147 | - if ( method_exists( $this, $method ) ) { |
|
| 147 | + if (method_exists($this, $method)) { |
|
| 148 | 148 | |
| 149 | - $field = call_user_func( array( $this, $method ), $field ); |
|
| 149 | + $field = call_user_func(array($this, $method), $field); |
|
| 150 | 150 | |
| 151 | - if ( $field ) { |
|
| 151 | + if ($field) { |
|
| 152 | 152 | $fields[] = $field; |
| 153 | 153 | } |
| 154 | 154 | } |
@@ -168,22 +168,22 @@ discard block |
||
| 168 | 168 | protected function get_fields() { |
| 169 | 169 | |
| 170 | 170 | $defined_fields = $this->define_fields(); |
| 171 | - $generated_fields = $this->generate_fields( $defined_fields ); |
|
| 171 | + $generated_fields = $this->generate_fields($defined_fields); |
|
| 172 | 172 | |
| 173 | 173 | $errors = array(); |
| 174 | 174 | |
| 175 | - if ( ! empty( $this->errors ) ) { |
|
| 176 | - foreach ( $this->required as $name => $alert ) { |
|
| 177 | - if ( false === array_search( $name, array_column( $generated_fields, 'name' ) ) ) { |
|
| 175 | + if ( ! empty($this->errors)) { |
|
| 176 | + foreach ($this->required as $name => $alert) { |
|
| 177 | + if (false === array_search($name, array_column($generated_fields, 'name'))) { |
|
| 178 | 178 | |
| 179 | - $errors[] = $this->errors[ $name ]; |
|
| 179 | + $errors[] = $this->errors[$name]; |
|
| 180 | 180 | } |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | $this->errors = $errors; |
| 184 | 184 | } |
| 185 | 185 | |
| 186 | - if ( ! empty( $errors ) ) { |
|
| 186 | + if ( ! empty($errors)) { |
|
| 187 | 187 | |
| 188 | 188 | return $errors; |
| 189 | 189 | } |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | * |
| 201 | 201 | * @since 1.0 |
| 202 | 202 | */ |
| 203 | - protected function generate_container( $field ) { |
|
| 203 | + protected function generate_container($field) { |
|
| 204 | 204 | |
| 205 | - if ( array_key_exists( 'html', $field ) ) { |
|
| 205 | + if (array_key_exists('html', $field)) { |
|
| 206 | 206 | |
| 207 | 207 | return array( |
| 208 | 208 | 'type' => $field['type'], |
@@ -222,36 +222,36 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @since 1.0 |
| 224 | 224 | */ |
| 225 | - protected function generate_listbox( $field ) { |
|
| 225 | + protected function generate_listbox($field) { |
|
| 226 | 226 | |
| 227 | - $listbox = shortcode_atts( array( |
|
| 227 | + $listbox = shortcode_atts(array( |
|
| 228 | 228 | 'label' => '', |
| 229 | 229 | 'minWidth' => '', |
| 230 | 230 | 'name' => false, |
| 231 | 231 | 'tooltip' => '', |
| 232 | 232 | 'type' => '', |
| 233 | 233 | 'value' => '', |
| 234 | - ), $field ); |
|
| 234 | + ), $field); |
|
| 235 | 235 | |
| 236 | - if ( $this->validate( $field ) ) { |
|
| 236 | + if ($this->validate($field)) { |
|
| 237 | 237 | |
| 238 | 238 | $new_listbox = array(); |
| 239 | 239 | |
| 240 | - foreach ( $listbox as $key => $value ) { |
|
| 240 | + foreach ($listbox as $key => $value) { |
|
| 241 | 241 | |
| 242 | - if ( $key == 'value' && empty( $value ) ) { |
|
| 243 | - $new_listbox[ $key ] = $listbox['name']; |
|
| 244 | - } else if ( $value ) { |
|
| 245 | - $new_listbox[ $key ] = $value; |
|
| 242 | + if ($key == 'value' && empty($value)) { |
|
| 243 | + $new_listbox[$key] = $listbox['name']; |
|
| 244 | + } else if ($value) { |
|
| 245 | + $new_listbox[$key] = $value; |
|
| 246 | 246 | } |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | // do not reindex array! |
| 250 | 250 | $field['options'] = array( |
| 251 | - '' => ( $field['placeholder'] ? $field['placeholder'] : esc_html( '- Select -', 'give' ) ), |
|
| 251 | + '' => ($field['placeholder'] ? $field['placeholder'] : esc_html('- Select -', 'give')), |
|
| 252 | 252 | ) + $field['options']; |
| 253 | 253 | |
| 254 | - foreach ( $field['options'] as $value => $text ) { |
|
| 254 | + foreach ($field['options'] as $value => $text) { |
|
| 255 | 255 | $new_listbox['values'][] = array( |
| 256 | 256 | 'text' => $text, |
| 257 | 257 | 'value' => $value, |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * |
| 274 | 274 | * @since 1.0 |
| 275 | 275 | */ |
| 276 | - protected function generate_post( $field ) { |
|
| 276 | + protected function generate_post($field) { |
|
| 277 | 277 | |
| 278 | 278 | $args = array( |
| 279 | 279 | 'post_type' => 'post', |
@@ -282,23 +282,23 @@ discard block |
||
| 282 | 282 | 'posts_per_page' => 30, |
| 283 | 283 | ); |
| 284 | 284 | |
| 285 | - $args = wp_parse_args( (array) $field['query_args'], $args ); |
|
| 286 | - $posts = get_posts( $args ); |
|
| 285 | + $args = wp_parse_args((array) $field['query_args'], $args); |
|
| 286 | + $posts = get_posts($args); |
|
| 287 | 287 | $options = array(); |
| 288 | 288 | |
| 289 | - if ( $posts ) { |
|
| 290 | - foreach ( $posts as $post ) { |
|
| 291 | - $options[ absint( $post->ID ) ] = esc_html( $post->post_title ); |
|
| 289 | + if ($posts) { |
|
| 290 | + foreach ($posts as $post) { |
|
| 291 | + $options[absint($post->ID)] = esc_html($post->post_title); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | $field['type'] = 'listbox'; |
| 295 | 295 | $field['options'] = $options; |
| 296 | 296 | |
| 297 | - return $this->generate_listbox( $field ); |
|
| 297 | + return $this->generate_listbox($field); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | // perform validation here before returning false |
| 301 | - $this->validate( $field ); |
|
| 301 | + $this->validate($field); |
|
| 302 | 302 | |
| 303 | 303 | return false; |
| 304 | 304 | } |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | * |
| 313 | 313 | * @since 1.0 |
| 314 | 314 | */ |
| 315 | - protected function generate_textbox( $field ) { |
|
| 315 | + protected function generate_textbox($field) { |
|
| 316 | 316 | |
| 317 | - $textbox = shortcode_atts( array( |
|
| 317 | + $textbox = shortcode_atts(array( |
|
| 318 | 318 | 'label' => '', |
| 319 | 319 | 'maxLength' => '', |
| 320 | 320 | 'minHeight' => '', |
@@ -324,10 +324,10 @@ discard block |
||
| 324 | 324 | 'tooltip' => '', |
| 325 | 325 | 'type' => '', |
| 326 | 326 | 'value' => '', |
| 327 | - ), $field ); |
|
| 327 | + ), $field); |
|
| 328 | 328 | |
| 329 | - if ( $this->validate( $field ) ) { |
|
| 330 | - return array_filter( $textbox, array( $this, 'return_textbox_value' ) ); |
|
| 329 | + if ($this->validate($field)) { |
|
| 330 | + return array_filter($textbox, array($this, 'return_textbox_value')); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | return false; |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | * |
| 341 | 341 | * @return bool |
| 342 | 342 | */ |
| 343 | - function return_textbox_value( $value ) { |
|
| 343 | + function return_textbox_value($value) { |
|
| 344 | 344 | return $value !== ''; |
| 345 | 345 | } |
| 346 | 346 | |
@@ -356,9 +356,9 @@ discard block |
||
| 356 | 356 | * |
| 357 | 357 | * @since 1.0 |
| 358 | 358 | */ |
| 359 | - protected function validate( $field ) { |
|
| 359 | + protected function validate($field) { |
|
| 360 | 360 | |
| 361 | - extract( shortcode_atts( |
|
| 361 | + extract(shortcode_atts( |
|
| 362 | 362 | array( |
| 363 | 363 | 'name' => false, |
| 364 | 364 | 'required' => false, |
@@ -366,36 +366,36 @@ discard block |
||
| 366 | 366 | ), $field ) |
| 367 | 367 | ); |
| 368 | 368 | |
| 369 | - if ( $name ) { |
|
| 369 | + if ($name) { |
|
| 370 | 370 | |
| 371 | - if ( isset( $required['error'] ) ) { |
|
| 371 | + if (isset($required['error'])) { |
|
| 372 | 372 | |
| 373 | 373 | $error = array( |
| 374 | 374 | 'type' => 'container', |
| 375 | 375 | 'html' => $required['error'], |
| 376 | 376 | ); |
| 377 | 377 | |
| 378 | - $this->errors[ $name ] = $this->generate_container( $error ); |
|
| 378 | + $this->errors[$name] = $this->generate_container($error); |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - if ( ! ! $required || is_array( $required ) ) { |
|
| 381 | + if ( ! ! $required || is_array($required)) { |
|
| 382 | 382 | |
| 383 | - $alert = esc_html( 'Some of the Shortcode options are required.', 'give' ); |
|
| 383 | + $alert = esc_html('Some of the Shortcode options are required.', 'give'); |
|
| 384 | 384 | |
| 385 | - if ( isset( $required['alert'] ) ) { |
|
| 385 | + if (isset($required['alert'])) { |
|
| 386 | 386 | |
| 387 | 387 | $alert = $required['alert']; |
| 388 | 388 | |
| 389 | - } else if ( ! empty( $label ) ) { |
|
| 389 | + } else if ( ! empty($label)) { |
|
| 390 | 390 | |
| 391 | 391 | $alert = sprintf( |
| 392 | 392 | /* translators: %s: option lable */ |
| 393 | - esc_html( 'The "%s" option is required.', 'give' ), |
|
| 394 | - str_replace( ':', '', $label ) |
|
| 393 | + esc_html('The "%s" option is required.', 'give'), |
|
| 394 | + str_replace(':', '', $label) |
|
| 395 | 395 | ); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - $this->required[ $name ] = $alert; |
|
| 398 | + $this->required[$name] = $alert; |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | return true; |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.3.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) or exit; |
|
| 12 | +defined('ABSPATH') or exit; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * Class Give_Shortcode_Donation_Form |
@@ -21,10 +21,10 @@ discard block |
||
| 21 | 21 | */ |
| 22 | 22 | public function __construct() { |
| 23 | 23 | |
| 24 | - $this->shortcode['title'] = esc_html( 'Donation Form', 'give' ); |
|
| 25 | - $this->shortcode['label'] = esc_html( 'Donation Form', 'give' ); |
|
| 24 | + $this->shortcode['title'] = esc_html('Donation Form', 'give'); |
|
| 25 | + $this->shortcode['label'] = esc_html('Donation Form', 'give'); |
|
| 26 | 26 | |
| 27 | - parent::__construct( 'give_form' ); |
|
| 27 | + parent::__construct('give_form'); |
|
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -36,8 +36,8 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | $create_form_link = sprintf( |
| 38 | 38 | /* translators: %s: create new form URL */ |
| 39 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
| 40 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
| 39 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
| 40 | + admin_url('post-new.php?post_type=give_forms') |
|
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | return array( |
@@ -47,68 +47,68 @@ discard block |
||
| 47 | 47 | 'post_type' => 'give_forms', |
| 48 | 48 | ), |
| 49 | 49 | 'name' => 'id', |
| 50 | - 'tooltip' => esc_attr( 'Select a Donation Form', 'give' ), |
|
| 51 | - 'placeholder' => esc_attr( '- Select a Form -', 'give' ), |
|
| 50 | + 'tooltip' => esc_attr('Select a Donation Form', 'give'), |
|
| 51 | + 'placeholder' => esc_attr('- Select a Form -', 'give'), |
|
| 52 | 52 | 'required' => array( |
| 53 | - 'alert' => esc_html( 'You must first select a Form!', 'give' ), |
|
| 54 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
| 53 | + 'alert' => esc_html('You must first select a Form!', 'give'), |
|
| 54 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html('No donation forms were found!', 'give'), $create_form_link), |
|
| 55 | 55 | ), |
| 56 | 56 | ), |
| 57 | 57 | array( |
| 58 | 58 | 'type' => 'container', |
| 59 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html( 'Optional form settings', 'give' ) ), |
|
| 59 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html('Optional form settings', 'give')), |
|
| 60 | 60 | ), |
| 61 | 61 | array( |
| 62 | 62 | 'type' => 'listbox', |
| 63 | 63 | 'name' => 'show_title', |
| 64 | - 'label' => esc_html( 'Show Title:', 'give' ), |
|
| 65 | - 'tooltip' => esc_attr( 'Do you want to display the form title?', 'give' ), |
|
| 64 | + 'label' => esc_html('Show Title:', 'give'), |
|
| 65 | + 'tooltip' => esc_attr('Do you want to display the form title?', 'give'), |
|
| 66 | 66 | 'options' => array( |
| 67 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 68 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 67 | + 'true' => esc_html('Show', 'give'), |
|
| 68 | + 'false' => esc_html('Hide', 'give'), |
|
| 69 | 69 | ), |
| 70 | 70 | ), |
| 71 | 71 | array( |
| 72 | 72 | 'type' => 'listbox', |
| 73 | 73 | 'name' => 'show_goal', |
| 74 | - 'label' => esc_html( 'Show Goal:', 'give' ), |
|
| 75 | - 'tooltip' => esc_attr( 'Do you want to display the donation goal?', 'give' ), |
|
| 74 | + 'label' => esc_html('Show Goal:', 'give'), |
|
| 75 | + 'tooltip' => esc_attr('Do you want to display the donation goal?', 'give'), |
|
| 76 | 76 | 'options' => array( |
| 77 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 78 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 77 | + 'true' => esc_html('Show', 'give'), |
|
| 78 | + 'false' => esc_html('Hide', 'give'), |
|
| 79 | 79 | ), |
| 80 | 80 | ), |
| 81 | 81 | array( |
| 82 | 82 | 'type' => 'listbox', |
| 83 | 83 | 'name' => 'show_content', |
| 84 | 84 | 'minWidth' => 240, |
| 85 | - 'label' => esc_html( 'Display Content:', 'give' ), |
|
| 86 | - 'tooltip' => esc_attr( 'Do you want to display the form content?', 'give' ), |
|
| 85 | + 'label' => esc_html('Display Content:', 'give'), |
|
| 86 | + 'tooltip' => esc_attr('Do you want to display the form content?', 'give'), |
|
| 87 | 87 | 'options' => array( |
| 88 | - 'none' => esc_html( 'No Content', 'give' ), |
|
| 89 | - 'above' => esc_html( 'Display above the form fields', 'give' ), |
|
| 90 | - 'below' => esc_html( 'Display below the form fields', 'give' ), |
|
| 88 | + 'none' => esc_html('No Content', 'give'), |
|
| 89 | + 'above' => esc_html('Display above the form fields', 'give'), |
|
| 90 | + 'below' => esc_html('Display below the form fields', 'give'), |
|
| 91 | 91 | ), |
| 92 | 92 | ), |
| 93 | 93 | array( |
| 94 | 94 | 'type' => 'listbox', |
| 95 | 95 | 'name' => 'display_style', |
| 96 | - 'label' => esc_html( 'Payment Fields:', 'give' ), |
|
| 97 | - 'tooltip' => esc_attr( 'How would you like to display payment information?', 'give' ), |
|
| 96 | + 'label' => esc_html('Payment Fields:', 'give'), |
|
| 97 | + 'tooltip' => esc_attr('How would you like to display payment information?', 'give'), |
|
| 98 | 98 | 'options' => array( |
| 99 | - 'onpage' => esc_html( 'Show on Page', 'give' ), |
|
| 100 | - 'reveal' => esc_html( 'Reveal Upon Click', 'give' ), |
|
| 101 | - 'modal' => esc_html( 'Modal Window Upon Click', 'give' ), |
|
| 99 | + 'onpage' => esc_html('Show on Page', 'give'), |
|
| 100 | + 'reveal' => esc_html('Reveal Upon Click', 'give'), |
|
| 101 | + 'modal' => esc_html('Modal Window Upon Click', 'give'), |
|
| 102 | 102 | ), |
| 103 | 103 | ), |
| 104 | 104 | array( |
| 105 | 105 | 'type' => 'listbox', |
| 106 | 106 | 'name' => 'float_labels', |
| 107 | - 'label' => esc_html( 'Floating Labels:', 'give' ), |
|
| 108 | - 'tooltip' => esc_attr( 'Override the default floating labels setting for this form?', 'give' ), |
|
| 107 | + 'label' => esc_html('Floating Labels:', 'give'), |
|
| 108 | + 'tooltip' => esc_attr('Override the default floating labels setting for this form?', 'give'), |
|
| 109 | 109 | 'options' => array( |
| 110 | - 'enabled' => esc_html( 'Enabled', 'give' ), |
|
| 111 | - 'disabled' => esc_html( 'Disabled', 'give' ), |
|
| 110 | + 'enabled' => esc_html('Enabled', 'give'), |
|
| 111 | + 'disabled' => esc_html('Disabled', 'give'), |
|
| 112 | 112 | ), |
| 113 | 113 | ), |
| 114 | 114 | ); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.3.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) or exit; |
|
| 12 | +defined('ABSPATH') or exit; |
|
| 13 | 13 | |
| 14 | 14 | class Give_Shortcode_Donation_History extends Give_Shortcode_Generator { |
| 15 | 15 | |
@@ -18,9 +18,9 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - $this->shortcode['label'] = esc_html( 'Donation History', 'give' ); |
|
| 21 | + $this->shortcode['label'] = esc_html('Donation History', 'give'); |
|
| 22 | 22 | |
| 23 | - parent::__construct( 'donation_history' ); |
|
| 23 | + parent::__construct('donation_history'); |
|
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | 26 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.3.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) or exit; |
|
| 12 | +defined('ABSPATH') or exit; |
|
| 13 | 13 | |
| 14 | 14 | class Give_Shortcode_Donation_Receipt extends Give_Shortcode_Generator { |
| 15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - $this->shortcode['title'] = esc_html( 'Donation Receipt', 'give' ); |
|
| 22 | - $this->shortcode['label'] = esc_html( 'Donation Receipt', 'give' ); |
|
| 21 | + $this->shortcode['title'] = esc_html('Donation Receipt', 'give'); |
|
| 22 | + $this->shortcode['label'] = esc_html('Donation Receipt', 'give'); |
|
| 23 | 23 | |
| 24 | - parent::__construct( 'give_receipt' ); |
|
| 24 | + parent::__construct('give_receipt'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -34,60 +34,60 @@ discard block |
||
| 34 | 34 | return array( |
| 35 | 35 | array( |
| 36 | 36 | 'type' => 'container', |
| 37 | - 'html' => sprintf( '<p class="strong">%s</p>', esc_html( 'Optional settings', 'give' ) ), |
|
| 37 | + 'html' => sprintf('<p class="strong">%s</p>', esc_html('Optional settings', 'give')), |
|
| 38 | 38 | ), |
| 39 | 39 | array( |
| 40 | 40 | 'type' => 'listbox', |
| 41 | 41 | 'name' => 'price', |
| 42 | - 'label' => esc_html( 'Show Donation Amount:', 'give' ), |
|
| 42 | + 'label' => esc_html('Show Donation Amount:', 'give'), |
|
| 43 | 43 | 'options' => array( |
| 44 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 45 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 44 | + 'true' => esc_html('Show', 'give'), |
|
| 45 | + 'false' => esc_html('Hide', 'give'), |
|
| 46 | 46 | ), |
| 47 | 47 | ), |
| 48 | 48 | array( |
| 49 | 49 | 'type' => 'listbox', |
| 50 | 50 | 'name' => 'donor', |
| 51 | - 'label' => esc_html( 'Show Donor Name:', 'give' ), |
|
| 51 | + 'label' => esc_html('Show Donor Name:', 'give'), |
|
| 52 | 52 | 'options' => array( |
| 53 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 54 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 53 | + 'true' => esc_html('Show', 'give'), |
|
| 54 | + 'false' => esc_html('Hide', 'give'), |
|
| 55 | 55 | ), |
| 56 | 56 | ), |
| 57 | 57 | array( |
| 58 | 58 | 'type' => 'listbox', |
| 59 | 59 | 'name' => 'date', |
| 60 | - 'label' => esc_html( 'Show Date:', 'give' ), |
|
| 60 | + 'label' => esc_html('Show Date:', 'give'), |
|
| 61 | 61 | 'options' => array( |
| 62 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 63 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 62 | + 'true' => esc_html('Show', 'give'), |
|
| 63 | + 'false' => esc_html('Hide', 'give'), |
|
| 64 | 64 | ), |
| 65 | 65 | ), |
| 66 | 66 | array( |
| 67 | 67 | 'type' => 'listbox', |
| 68 | 68 | 'name' => 'payment_key', |
| 69 | - 'label' => esc_html( 'Show Payment Key:', 'give' ), |
|
| 69 | + 'label' => esc_html('Show Payment Key:', 'give'), |
|
| 70 | 70 | 'options' => array( |
| 71 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 72 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 71 | + 'true' => esc_html('Show', 'give'), |
|
| 72 | + 'false' => esc_html('Hide', 'give'), |
|
| 73 | 73 | ), |
| 74 | 74 | ), |
| 75 | 75 | array( |
| 76 | 76 | 'type' => 'listbox', |
| 77 | 77 | 'name' => 'payment_method', |
| 78 | - 'label' => esc_html( 'Show Payment Method:', 'give' ), |
|
| 78 | + 'label' => esc_html('Show Payment Method:', 'give'), |
|
| 79 | 79 | 'options' => array( |
| 80 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 81 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 80 | + 'true' => esc_html('Show', 'give'), |
|
| 81 | + 'false' => esc_html('Hide', 'give'), |
|
| 82 | 82 | ), |
| 83 | 83 | ), |
| 84 | 84 | array( |
| 85 | 85 | 'type' => 'listbox', |
| 86 | 86 | 'name' => 'payment_id', |
| 87 | - 'label' => esc_html( 'Show Payment ID:', 'give' ), |
|
| 87 | + 'label' => esc_html('Show Payment ID:', 'give'), |
|
| 88 | 88 | 'options' => array( |
| 89 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 90 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 89 | + 'true' => esc_html('Show', 'give'), |
|
| 90 | + 'false' => esc_html('Hide', 'give'), |
|
| 91 | 91 | ), |
| 92 | 92 | ), |
| 93 | 93 | ); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 1.3.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) or exit; |
|
| 12 | +defined('ABSPATH') or exit; |
|
| 13 | 13 | |
| 14 | 14 | class Give_Shortcode_Donation_Form_Goal extends Give_Shortcode_Generator { |
| 15 | 15 | |
@@ -18,10 +18,10 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function __construct() { |
| 20 | 20 | |
| 21 | - $this->shortcode['title'] = esc_html( 'Donation Form Goal', 'give' ); |
|
| 22 | - $this->shortcode['label'] = esc_html( 'Donation Form Goal', 'give' ); |
|
| 21 | + $this->shortcode['title'] = esc_html('Donation Form Goal', 'give'); |
|
| 22 | + $this->shortcode['label'] = esc_html('Donation Form Goal', 'give'); |
|
| 23 | 23 | |
| 24 | - parent::__construct( 'give_goal' ); |
|
| 24 | + parent::__construct('give_goal'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | /** |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $create_form_link = sprintf( |
| 35 | 35 | /* translators: %s: create new form URL */ |
| 36 | - __( '<a href="%s">Create</a> a new Donation Form.', 'give' ), |
|
| 37 | - admin_url( 'post-new.php?post_type=give_forms' ) |
|
| 36 | + __('<a href="%s">Create</a> a new Donation Form.', 'give'), |
|
| 37 | + admin_url('post-new.php?post_type=give_forms') |
|
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | return array( |
@@ -44,35 +44,35 @@ discard block |
||
| 44 | 44 | 'post_type' => 'give_forms', |
| 45 | 45 | ), |
| 46 | 46 | 'name' => 'id', |
| 47 | - 'tooltip' => esc_attr( 'Select a Donation Form', 'give' ), |
|
| 48 | - 'placeholder' => esc_attr( '- Select a Form -', 'give' ), |
|
| 47 | + 'tooltip' => esc_attr('Select a Donation Form', 'give'), |
|
| 48 | + 'placeholder' => esc_attr('- Select a Form -', 'give'), |
|
| 49 | 49 | 'required' => array( |
| 50 | - 'alert' => esc_html( 'You must first select a Form!', 'give' ), |
|
| 51 | - 'error' => sprintf( '<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html( 'No donation forms were found!', 'give' ), $create_form_link ), |
|
| 50 | + 'alert' => esc_html('You must first select a Form!', 'give'), |
|
| 51 | + 'error' => sprintf('<p class="strong">%s</p><p class="no-margin">%s</p>', esc_html('No donation forms were found!', 'give'), $create_form_link), |
|
| 52 | 52 | ), |
| 53 | 53 | ), |
| 54 | 54 | array( |
| 55 | 55 | 'type' => 'container', |
| 56 | - 'html' => sprintf( '<p class="strong margin-top">%s</p>', esc_html( 'Optional settings', 'give' ) ), |
|
| 56 | + 'html' => sprintf('<p class="strong margin-top">%s</p>', esc_html('Optional settings', 'give')), |
|
| 57 | 57 | ), |
| 58 | 58 | array( |
| 59 | 59 | 'type' => 'listbox', |
| 60 | 60 | 'name' => 'show_text', |
| 61 | - 'label' => esc_html( 'Show Text:', 'give' ), |
|
| 62 | - 'tooltip' => esc_attr( 'This text displays the amount of income raised compared to the goal.', 'give' ), |
|
| 61 | + 'label' => esc_html('Show Text:', 'give'), |
|
| 62 | + 'tooltip' => esc_attr('This text displays the amount of income raised compared to the goal.', 'give'), |
|
| 63 | 63 | 'options' => array( |
| 64 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 65 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 64 | + 'true' => esc_html('Show', 'give'), |
|
| 65 | + 'false' => esc_html('Hide', 'give'), |
|
| 66 | 66 | ), |
| 67 | 67 | ), |
| 68 | 68 | array( |
| 69 | 69 | 'type' => 'listbox', |
| 70 | 70 | 'name' => 'show_bar', |
| 71 | - 'label' => esc_html( 'Show Progress Bar:', 'give' ), |
|
| 72 | - 'tooltip' => esc_attr( 'Do you want to display the goal\'s progress bar?', 'give' ), |
|
| 71 | + 'label' => esc_html('Show Progress Bar:', 'give'), |
|
| 72 | + 'tooltip' => esc_attr('Do you want to display the goal\'s progress bar?', 'give'), |
|
| 73 | 73 | 'options' => array( |
| 74 | - 'true' => esc_html( 'Show', 'give' ), |
|
| 75 | - 'false' => esc_html( 'Hide', 'give' ), |
|
| 74 | + 'true' => esc_html('Show', 'give'), |
|
| 75 | + 'false' => esc_html('Hide', 'give'), |
|
| 76 | 76 | ), |
| 77 | 77 | ), |
| 78 | 78 | ); |
@@ -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', esc_html( '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', esc_html('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,25 +46,25 @@ 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 | 51 | <p class="give-dashboard-happy-day"><?php |
| 52 | 52 | printf( |
| 53 | 53 | /* translators: %s: day of the week */ |
| 54 | - esc_html( 'Happy %s!', 'give' ), |
|
| 55 | - date( 'l', current_time( 'timestamp' ) ) |
|
| 54 | + esc_html('Happy %s!', 'give'), |
|
| 55 | + date('l', current_time('timestamp')) |
|
| 56 | 56 | ); |
| 57 | 57 | ?></p> |
| 58 | 58 | |
| 59 | - <?php $earnings_today = $stats->get_earnings( 0, 'today', false ); ?> |
|
| 59 | + <?php $earnings_today = $stats->get_earnings(0, 'today', false); ?> |
|
| 60 | 60 | |
| 61 | - <p class="give-dashboard-today-earnings"><?php echo give_currency_filter( give_format_amount( $earnings_today ) ); ?></p> |
|
| 61 | + <p class="give-dashboard-today-earnings"><?php echo give_currency_filter(give_format_amount($earnings_today)); ?></p> |
|
| 62 | 62 | |
| 63 | - <p class="give-orders-today"><?php $donations_today = $stats->get_sales( 0, 'today', false, array( |
|
| 63 | + <p class="give-orders-today"><?php $donations_today = $stats->get_sales(0, 'today', false, array( |
|
| 64 | 64 | 'publish', |
| 65 | 65 | 'revoked' |
| 66 | - ) ); ?><?php echo give_format_amount( $donations_today, false ); ?> |
|
| 67 | - <span><?php echo _x( 'donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give' ); ?></span> |
|
| 66 | + )); ?><?php echo give_format_amount($donations_today, false); ?> |
|
| 67 | + <span><?php echo _x('donations today', 'Displays in WP admin dashboard widget after the day\'s total donations', 'give'); ?></span> |
|
| 68 | 68 | </p> |
| 69 | 69 | |
| 70 | 70 | |
@@ -74,34 +74,34 @@ discard block |
||
| 74 | 74 | <table class="give-table-stats"> |
| 75 | 75 | <thead style="display: none;"> |
| 76 | 76 | <tr> |
| 77 | - <th><?php esc_html_e( 'This Week', 'give' ); ?></th> |
|
| 78 | - <th><?php esc_html_e( 'This Month', 'give' ); ?></th> |
|
| 79 | - <th><?php esc_html_e( 'Past 30 Days', 'give' ); ?></th> |
|
| 77 | + <th><?php esc_html_e('This Week', 'give'); ?></th> |
|
| 78 | + <th><?php esc_html_e('This Month', 'give'); ?></th> |
|
| 79 | + <th><?php esc_html_e('Past 30 Days', 'give'); ?></th> |
|
| 80 | 80 | </tr> |
| 81 | 81 | </thead> |
| 82 | 82 | <tbody> |
| 83 | 83 | <tr id="give-table-stats-tr-1"> |
| 84 | 84 | <td> |
| 85 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_week' ) ) ); ?></p> |
|
| 85 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_week'))); ?></p> |
|
| 86 | 86 | |
| 87 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this week', 'give' ); ?></p> |
|
| 87 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this week', 'give'); ?></p> |
|
| 88 | 88 | </td> |
| 89 | 89 | <td> |
| 90 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_month' ) ) ); ?></p> |
|
| 90 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_month'))); ?></p> |
|
| 91 | 91 | |
| 92 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this month', 'give' ); ?></p> |
|
| 92 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this month', 'give'); ?></p> |
|
| 93 | 93 | </td> |
| 94 | 94 | </tr> |
| 95 | 95 | <tr id="give-table-stats-tr-2"> |
| 96 | 96 | <td> |
| 97 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'last_month' ) ) ) ?></p> |
|
| 97 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'last_month'))) ?></p> |
|
| 98 | 98 | |
| 99 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'last month', 'give' ); ?></p> |
|
| 99 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('last month', 'give'); ?></p> |
|
| 100 | 100 | </td> |
| 101 | 101 | <td> |
| 102 | - <p class="give-dashboard-stat-total"><?php echo give_currency_filter( give_format_amount( $stats->get_earnings( 0, 'this_year', false ) ) ) ?></p> |
|
| 102 | + <p class="give-dashboard-stat-total"><?php echo give_currency_filter(give_format_amount($stats->get_earnings(0, 'this_year', false))) ?></p> |
|
| 103 | 103 | |
| 104 | - <p class="give-dashboard-stat-total-label"><?php esc_html_e( 'this year', 'give' ); ?></p> |
|
| 104 | + <p class="give-dashboard-stat-total-label"><?php esc_html_e('this year', 'give'); ?></p> |
|
| 105 | 105 | </td> |
| 106 | 106 | </tr> |
| 107 | 107 | </tbody> |
@@ -121,25 +121,25 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return array |
| 123 | 123 | */ |
| 124 | -function give_dashboard_at_a_glance_widget( $items ) { |
|
| 125 | - $num_posts = wp_count_posts( 'give_forms' ); |
|
| 124 | +function give_dashboard_at_a_glance_widget($items) { |
|
| 125 | + $num_posts = wp_count_posts('give_forms'); |
|
| 126 | 126 | |
| 127 | - if ( $num_posts && $num_posts->publish ) { |
|
| 127 | + if ($num_posts && $num_posts->publish) { |
|
| 128 | 128 | |
| 129 | 129 | $text = sprintf( |
| 130 | 130 | /* translators: 1: number of posts published 2: forms singular label 3: forms plural label */ |
| 131 | - _n( '%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give' ), |
|
| 131 | + _n('%1$s Give %2$s', '%1$s Give %3$s', $num_posts->publish, 'give'), |
|
| 132 | 132 | $num_posts->publish, |
| 133 | 133 | give_get_forms_label_singular(), |
| 134 | 134 | give_get_forms_label_plural() |
| 135 | 135 | ); |
| 136 | 136 | |
| 137 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
| 137 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
| 138 | 138 | |
| 139 | - if ( current_user_can( 'edit_give_forms', get_current_user_id() ) ) { |
|
| 140 | - $text = sprintf( '<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text ); |
|
| 139 | + if (current_user_can('edit_give_forms', get_current_user_id())) { |
|
| 140 | + $text = sprintf('<a class="give-forms-count" href="edit.php?post_type=give_forms">%1$s</a>', $text); |
|
| 141 | 141 | } else { |
| 142 | - $text = sprintf( '<span class="give-forms-count">%1$s</span>', $text ); |
|
| 142 | + $text = sprintf('<span class="give-forms-count">%1$s</span>', $text); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $items[] = $text; |
@@ -148,4 +148,4 @@ discard block |
||
| 148 | 148 | return $items; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | -add_filter( 'dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
|
| 151 | +add_filter('dashboard_glance_items', 'give_dashboard_at_a_glance_widget', 1, 1); |
|
@@ -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 | |
@@ -29,31 +29,31 @@ discard block |
||
| 29 | 29 | global $give_settings_page, $give_payments_page, $give_reports_page, $give_add_ons_page, $give_upgrades_screen, $give_donors_page; |
| 30 | 30 | |
| 31 | 31 | //Payments |
| 32 | - $give_payment = get_post_type_object( 'give_payment' ); |
|
| 33 | - $give_payments_page = add_submenu_page( 'edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page' ); |
|
| 32 | + $give_payment = get_post_type_object('give_payment'); |
|
| 33 | + $give_payments_page = add_submenu_page('edit.php?post_type=give_forms', $give_payment->labels->name, $give_payment->labels->menu_name, 'edit_give_payments', 'give-payment-history', 'give_payment_history_page'); |
|
| 34 | 34 | |
| 35 | 35 | //Donors |
| 36 | - $give_donors_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Donors', 'give' ), esc_html( 'Donors', 'give' ), 'view_give_reports', 'give-donors', 'give_customers_page' ); |
|
| 36 | + $give_donors_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Donors', 'give'), esc_html('Donors', 'give'), 'view_give_reports', 'give-donors', 'give_customers_page'); |
|
| 37 | 37 | |
| 38 | 38 | //Reports` |
| 39 | - $give_reports_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Donation Reports', 'give' ), esc_html( 'Reports', 'give' ), 'view_give_reports', 'give-reports', 'give_reports_page' ); |
|
| 39 | + $give_reports_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Donation Reports', 'give'), esc_html('Reports', 'give'), 'view_give_reports', 'give-reports', 'give_reports_page'); |
|
| 40 | 40 | |
| 41 | 41 | //Settings |
| 42 | - $give_settings_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Give Settings', 'give' ), esc_html( 'Settings', 'give' ), 'manage_give_settings', 'give-settings', array( |
|
| 42 | + $give_settings_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Give Settings', 'give'), esc_html('Settings', 'give'), 'manage_give_settings', 'give-settings', array( |
|
| 43 | 43 | Give()->give_settings, |
| 44 | 44 | 'admin_page_display' |
| 45 | - ) ); |
|
| 45 | + )); |
|
| 46 | 46 | |
| 47 | 47 | //Add-ons |
| 48 | - $give_add_ons_page = add_submenu_page( 'edit.php?post_type=give_forms', esc_html( 'Give Add-ons', 'give' ), esc_html( 'Add-ons', 'give' ), 'install_plugins', 'give-addons', 'give_add_ons_page' ); |
|
| 48 | + $give_add_ons_page = add_submenu_page('edit.php?post_type=give_forms', esc_html('Give Add-ons', 'give'), esc_html('Add-ons', 'give'), 'install_plugins', 'give-addons', 'give_add_ons_page'); |
|
| 49 | 49 | |
| 50 | 50 | //Upgrades |
| 51 | - $give_upgrades_screen = add_submenu_page( null, esc_html( 'Give Upgrades', 'give' ), esc_html( 'Give Upgrades', 'give' ), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen' ); |
|
| 51 | + $give_upgrades_screen = add_submenu_page(null, esc_html('Give Upgrades', 'give'), esc_html('Give Upgrades', 'give'), 'manage_give_settings', 'give-upgrades', 'give_upgrades_screen'); |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | -add_action( 'admin_menu', 'give_add_options_links', 10 ); |
|
| 56 | +add_action('admin_menu', 'give_add_options_links', 10); |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * Determines whether the current admin page is a Give admin page. |
@@ -68,224 +68,224 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @return bool True if Give admin page. |
| 70 | 70 | */ |
| 71 | -function give_is_admin_page( $passed_page = '', $passed_view = '' ) { |
|
| 71 | +function give_is_admin_page($passed_page = '', $passed_view = '') { |
|
| 72 | 72 | |
| 73 | 73 | global $pagenow, $typenow; |
| 74 | 74 | |
| 75 | 75 | $found = false; |
| 76 | - $post_type = isset( $_GET['post_type'] ) ? strtolower( $_GET['post_type'] ) : false; |
|
| 77 | - $action = isset( $_GET['action'] ) ? strtolower( $_GET['action'] ) : false; |
|
| 78 | - $taxonomy = isset( $_GET['taxonomy'] ) ? strtolower( $_GET['taxonomy'] ) : false; |
|
| 79 | - $page = isset( $_GET['page'] ) ? strtolower( $_GET['page'] ) : false; |
|
| 80 | - $view = isset( $_GET['view'] ) ? strtolower( $_GET['view'] ) : false; |
|
| 81 | - $tab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : false; |
|
| 76 | + $post_type = isset($_GET['post_type']) ? strtolower($_GET['post_type']) : false; |
|
| 77 | + $action = isset($_GET['action']) ? strtolower($_GET['action']) : false; |
|
| 78 | + $taxonomy = isset($_GET['taxonomy']) ? strtolower($_GET['taxonomy']) : false; |
|
| 79 | + $page = isset($_GET['page']) ? strtolower($_GET['page']) : false; |
|
| 80 | + $view = isset($_GET['view']) ? strtolower($_GET['view']) : false; |
|
| 81 | + $tab = isset($_GET['tab']) ? strtolower($_GET['tab']) : false; |
|
| 82 | 82 | |
| 83 | - switch ( $passed_page ) { |
|
| 83 | + switch ($passed_page) { |
|
| 84 | 84 | case 'give_forms': |
| 85 | - switch ( $passed_view ) { |
|
| 85 | + switch ($passed_view) { |
|
| 86 | 86 | case 'list-table': |
| 87 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' ) { |
|
| 87 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php') { |
|
| 88 | 88 | $found = true; |
| 89 | 89 | } |
| 90 | 90 | break; |
| 91 | 91 | case 'edit': |
| 92 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post.php' ) { |
|
| 92 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post.php') { |
|
| 93 | 93 | $found = true; |
| 94 | 94 | } |
| 95 | 95 | break; |
| 96 | 96 | case 'new': |
| 97 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'post-new.php' ) { |
|
| 97 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'post-new.php') { |
|
| 98 | 98 | $found = true; |
| 99 | 99 | } |
| 100 | 100 | break; |
| 101 | 101 | default: |
| 102 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) || 'give_forms' === $post_type || ( 'post-new.php' == $pagenow && 'give_forms' === $post_type ) ) { |
|
| 102 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) || 'give_forms' === $post_type || ('post-new.php' == $pagenow && 'give_forms' === $post_type)) { |
|
| 103 | 103 | $found = true; |
| 104 | 104 | } |
| 105 | 105 | break; |
| 106 | 106 | } |
| 107 | 107 | break; |
| 108 | 108 | case 'categories': |
| 109 | - switch ( $passed_view ) { |
|
| 109 | + switch ($passed_view) { |
|
| 110 | 110 | case 'list-table': |
| 111 | 111 | case 'new': |
| 112 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy ) { |
|
| 112 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_category' === $taxonomy) { |
|
| 113 | 113 | $found = true; |
| 114 | 114 | } |
| 115 | 115 | break; |
| 116 | 116 | case 'edit': |
| 117 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy ) { |
|
| 117 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_category' === $taxonomy) { |
|
| 118 | 118 | $found = true; |
| 119 | 119 | } |
| 120 | 120 | break; |
| 121 | 121 | default: |
| 122 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy ) { |
|
| 122 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_category' === $taxonomy) { |
|
| 123 | 123 | $found = true; |
| 124 | 124 | } |
| 125 | 125 | break; |
| 126 | 126 | } |
| 127 | 127 | break; |
| 128 | 128 | case 'tags': |
| 129 | - switch ( $passed_view ) { |
|
| 129 | + switch ($passed_view) { |
|
| 130 | 130 | case 'list-table': |
| 131 | 131 | case 'new': |
| 132 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy ) { |
|
| 132 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' !== $action && 'give_forms_tag' === $taxonomy) { |
|
| 133 | 133 | $found = true; |
| 134 | 134 | } |
| 135 | 135 | break; |
| 136 | 136 | case 'edit': |
| 137 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy ) { |
|
| 137 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'edit' === $action && 'give_forms_tag' === $taxonomy) { |
|
| 138 | 138 | $found = true; |
| 139 | 139 | } |
| 140 | 140 | break; |
| 141 | 141 | default: |
| 142 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy ) { |
|
| 142 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit-tags.php' && 'give_forms_tag' === $taxonomy) { |
|
| 143 | 143 | $found = true; |
| 144 | 144 | } |
| 145 | 145 | break; |
| 146 | 146 | } |
| 147 | 147 | break; |
| 148 | 148 | case 'payments': |
| 149 | - switch ( $passed_view ) { |
|
| 149 | + switch ($passed_view) { |
|
| 150 | 150 | case 'list-table': |
| 151 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view ) { |
|
| 151 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && false === $view) { |
|
| 152 | 152 | $found = true; |
| 153 | 153 | } |
| 154 | 154 | break; |
| 155 | 155 | case 'edit': |
| 156 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view ) { |
|
| 156 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page && 'view-order-details' === $view) { |
|
| 157 | 157 | $found = true; |
| 158 | 158 | } |
| 159 | 159 | break; |
| 160 | 160 | default: |
| 161 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-payment-history' === $page ) { |
|
| 161 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-payment-history' === $page) { |
|
| 162 | 162 | $found = true; |
| 163 | 163 | } |
| 164 | 164 | break; |
| 165 | 165 | } |
| 166 | 166 | break; |
| 167 | 167 | case 'reports': |
| 168 | - switch ( $passed_view ) { |
|
| 168 | + switch ($passed_view) { |
|
| 169 | 169 | // If you want to do something like enqueue a script on a particular report's duration, look at $_GET[ 'range' ] |
| 170 | 170 | case 'earnings': |
| 171 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && ( 'earnings' === $view || '-1' === $view || false === $view ) ) { |
|
| 171 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && ('earnings' === $view || '-1' === $view || false === $view)) { |
|
| 172 | 172 | $found = true; |
| 173 | 173 | } |
| 174 | 174 | break; |
| 175 | 175 | case 'donors': |
| 176 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view ) { |
|
| 176 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'customers' === $view) { |
|
| 177 | 177 | $found = true; |
| 178 | 178 | } |
| 179 | 179 | break; |
| 180 | 180 | case 'gateways': |
| 181 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view ) { |
|
| 181 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'gateways' === $view) { |
|
| 182 | 182 | $found = true; |
| 183 | 183 | } |
| 184 | 184 | break; |
| 185 | 185 | case 'export': |
| 186 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view ) { |
|
| 186 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'export' === $view) { |
|
| 187 | 187 | $found = true; |
| 188 | 188 | } |
| 189 | 189 | break; |
| 190 | 190 | case 'logs': |
| 191 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view ) { |
|
| 191 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page && 'logs' === $view) { |
|
| 192 | 192 | $found = true; |
| 193 | 193 | } |
| 194 | 194 | break; |
| 195 | 195 | default: |
| 196 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 196 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 197 | 197 | $found = true; |
| 198 | 198 | } |
| 199 | 199 | break; |
| 200 | 200 | } |
| 201 | 201 | break; |
| 202 | 202 | case 'settings': |
| 203 | - switch ( $passed_view ) { |
|
| 203 | + switch ($passed_view) { |
|
| 204 | 204 | case 'general': |
| 205 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && ( 'general' === $tab || false === $tab ) ) { |
|
| 205 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && ('general' === $tab || false === $tab)) { |
|
| 206 | 206 | $found = true; |
| 207 | 207 | } |
| 208 | 208 | break; |
| 209 | 209 | case 'gateways': |
| 210 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab ) { |
|
| 210 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'gateways' === $tab) { |
|
| 211 | 211 | $found = true; |
| 212 | 212 | } |
| 213 | 213 | break; |
| 214 | 214 | case 'emails': |
| 215 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab ) { |
|
| 215 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'emails' === $tab) { |
|
| 216 | 216 | $found = true; |
| 217 | 217 | } |
| 218 | 218 | break; |
| 219 | 219 | case 'display': |
| 220 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab ) { |
|
| 220 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'display' === $tab) { |
|
| 221 | 221 | $found = true; |
| 222 | 222 | } |
| 223 | 223 | break; |
| 224 | 224 | case 'licenses': |
| 225 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab ) { |
|
| 225 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'licenses' === $tab) { |
|
| 226 | 226 | $found = true; |
| 227 | 227 | } |
| 228 | 228 | break; |
| 229 | 229 | case 'api': |
| 230 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab ) { |
|
| 230 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'api' === $tab) { |
|
| 231 | 231 | $found = true; |
| 232 | 232 | } |
| 233 | 233 | break; |
| 234 | 234 | case 'advanced': |
| 235 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab ) { |
|
| 235 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'advanced' === $tab) { |
|
| 236 | 236 | $found = true; |
| 237 | 237 | } |
| 238 | 238 | break; |
| 239 | 239 | case 'system_info': |
| 240 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab ) { |
|
| 240 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page && 'system_info' === $tab) { |
|
| 241 | 241 | $found = true; |
| 242 | 242 | } |
| 243 | 243 | break; |
| 244 | 244 | default: |
| 245 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-settings' === $page ) { |
|
| 245 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-settings' === $page) { |
|
| 246 | 246 | $found = true; |
| 247 | 247 | } |
| 248 | 248 | break; |
| 249 | 249 | } |
| 250 | 250 | break; |
| 251 | 251 | case 'addons': |
| 252 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-addons' === $page ) { |
|
| 252 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-addons' === $page) { |
|
| 253 | 253 | $found = true; |
| 254 | 254 | } |
| 255 | 255 | break; |
| 256 | 256 | case 'donors': |
| 257 | - switch ( $passed_view ) { |
|
| 257 | + switch ($passed_view) { |
|
| 258 | 258 | case 'list-table': |
| 259 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view ) { |
|
| 259 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && false === $view) { |
|
| 260 | 260 | $found = true; |
| 261 | 261 | } |
| 262 | 262 | break; |
| 263 | 263 | case 'overview': |
| 264 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view ) { |
|
| 264 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'overview' === $view) { |
|
| 265 | 265 | $found = true; |
| 266 | 266 | } |
| 267 | 267 | break; |
| 268 | 268 | case 'notes': |
| 269 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view ) { |
|
| 269 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page && 'notes' === $view) { |
|
| 270 | 270 | $found = true; |
| 271 | 271 | } |
| 272 | 272 | break; |
| 273 | 273 | default: |
| 274 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-donors' === $page ) { |
|
| 274 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-donors' === $page) { |
|
| 275 | 275 | $found = true; |
| 276 | 276 | } |
| 277 | 277 | break; |
| 278 | 278 | } |
| 279 | 279 | break; |
| 280 | 280 | case 'reports': |
| 281 | - if ( ( 'give_forms' == $typenow || 'give_forms' === $post_type ) && $pagenow == 'edit.php' && 'give-reports' === $page ) { |
|
| 281 | + if (('give_forms' == $typenow || 'give_forms' === $post_type) && $pagenow == 'edit.php' && 'give-reports' === $page) { |
|
| 282 | 282 | $found = true; |
| 283 | 283 | } |
| 284 | 284 | break; |
| 285 | 285 | default: |
| 286 | 286 | global $give_payments_page, $give_settings_page, $give_reports_page, $give_system_info_page, $give_add_ons_page, $give_settings_export, $give_upgrades_screen, $give_customers_page; |
| 287 | 287 | |
| 288 | - $admin_pages = apply_filters( 'give_admin_pages', array( |
|
| 288 | + $admin_pages = apply_filters('give_admin_pages', array( |
|
| 289 | 289 | $give_payments_page, |
| 290 | 290 | $give_settings_page, |
| 291 | 291 | $give_reports_page, |
@@ -294,18 +294,18 @@ discard block |
||
| 294 | 294 | $give_upgrades_screen, |
| 295 | 295 | $give_settings_export, |
| 296 | 296 | $give_customers_page |
| 297 | - ) ); |
|
| 298 | - if ( 'give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow ) { |
|
| 297 | + )); |
|
| 298 | + if ('give_forms' == $typenow || 'index.php' == $pagenow || 'post-new.php' == $pagenow || 'post.php' == $pagenow) { |
|
| 299 | 299 | $found = true; |
| 300 | - if ( 'give-upgrades' === $page ) { |
|
| 300 | + if ('give-upgrades' === $page) { |
|
| 301 | 301 | $found = false; |
| 302 | 302 | } |
| 303 | - } elseif ( in_array( $pagenow, $admin_pages ) ) { |
|
| 303 | + } elseif (in_array($pagenow, $admin_pages)) { |
|
| 304 | 304 | $found = true; |
| 305 | 305 | } |
| 306 | 306 | break; |
| 307 | 307 | } |
| 308 | 308 | |
| 309 | - return (bool) apply_filters( 'give_is_admin_page', $found, $page, $view, $passed_page, $passed_view ); |
|
| 309 | + return (bool) apply_filters('give_is_admin_page', $found, $page, $view, $passed_page, $passed_view); |
|
| 310 | 310 | |
| 311 | 311 | } |
| 312 | 312 | \ No newline at end of file |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | // Exit if accessed directly |
| 11 | -if ( ! defined( 'ABSPATH' ) ) { |
|
| 11 | +if ( ! defined('ABSPATH')) { |
|
| 12 | 12 | exit; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @param $_banner_details |
| 28 | 28 | */ |
| 29 | - function __construct( $_banner_details ) { |
|
| 29 | + function __construct($_banner_details) { |
|
| 30 | 30 | |
| 31 | 31 | global $current_user; |
| 32 | 32 | $this->banner_details = $_banner_details; |
| 33 | - $this->test_mode = ( $this->banner_details['testing'] == 'true' ) ? true : false; |
|
| 34 | - $this->nag_meta_key = 'give_addon_activation_ignore_' . sanitize_title( $this->banner_details['name'] ); |
|
| 33 | + $this->test_mode = ($this->banner_details['testing'] == 'true') ? true : false; |
|
| 34 | + $this->nag_meta_key = 'give_addon_activation_ignore_'.sanitize_title($this->banner_details['name']); |
|
| 35 | 35 | |
| 36 | 36 | //Get current user |
| 37 | 37 | $this->user_id = $current_user->ID; |
@@ -50,13 +50,13 @@ discard block |
||
| 50 | 50 | public function init() { |
| 51 | 51 | |
| 52 | 52 | //Testing? |
| 53 | - if ( $this->test_mode ) { |
|
| 54 | - delete_user_meta( $this->user_id, $this->nag_meta_key ); |
|
| 53 | + if ($this->test_mode) { |
|
| 54 | + delete_user_meta($this->user_id, $this->nag_meta_key); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | //Get the current page to add the notice to |
| 58 | - add_action( 'current_screen', array( $this, 'give_addon_notice_ignore' ) ); |
|
| 59 | - add_action( 'admin_notices', array( $this, 'give_addon_activation_admin_notice' ) ); |
|
| 58 | + add_action('current_screen', array($this, 'give_addon_notice_ignore')); |
|
| 59 | + add_action('admin_notices', array($this, 'give_addon_activation_admin_notice')); |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | } |
@@ -71,13 +71,13 @@ discard block |
||
| 71 | 71 | global $pagenow; |
| 72 | 72 | |
| 73 | 73 | //Make sure we're on the plugins page. |
| 74 | - if ( $pagenow !== 'plugins.php' ) { |
|
| 74 | + if ($pagenow !== 'plugins.php') { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // If the user hasn't already dismissed our alert, |
| 79 | 79 | // Output the activation banner |
| 80 | - if ( ! get_user_meta( $this->user_id, $this->nag_meta_key ) ) { ?> |
|
| 80 | + if ( ! get_user_meta($this->user_id, $this->nag_meta_key)) { ?> |
|
| 81 | 81 | |
| 82 | 82 | <!-- * I output inline styles here |
| 83 | 83 | * because there's no reason to keep these |
@@ -157,15 +157,15 @@ discard block |
||
| 157 | 157 | <h3><?php |
| 158 | 158 | printf( |
| 159 | 159 | /* translators: %s: Add-on name */ |
| 160 | - esc_html( "Thank you for installing Give's %s Add-on!", 'give' ), |
|
| 161 | - '<span>' . $this->banner_details['name'] . '</span>' |
|
| 160 | + esc_html("Thank you for installing Give's %s Add-on!", 'give'), |
|
| 161 | + '<span>'.$this->banner_details['name'].'</span>' |
|
| 162 | 162 | ); |
| 163 | 163 | ?></h3> |
| 164 | 164 | |
| 165 | 165 | <a href="<?php |
| 166 | 166 | //The Dismiss Button |
| 167 | - $nag_admin_dismiss_url = 'plugins.php?' . $this->nag_meta_key . '=0'; |
|
| 168 | - echo admin_url( $nag_admin_dismiss_url ); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
| 167 | + $nag_admin_dismiss_url = 'plugins.php?'.$this->nag_meta_key.'=0'; |
|
| 168 | + echo admin_url($nag_admin_dismiss_url); ?>" class="dismiss"><span class="dashicons dashicons-dismiss"></span></a> |
|
| 169 | 169 | |
| 170 | 170 | <!-- * Now we output a few "actions" |
| 171 | 171 | * that the user can take from here --> |
@@ -173,21 +173,21 @@ discard block |
||
| 173 | 173 | <div class="alert-actions"> |
| 174 | 174 | |
| 175 | 175 | <?php //Point them to your settings page |
| 176 | - if ( isset( $this->banner_details['settings_url'] ) ) { ?> |
|
| 176 | + if (isset($this->banner_details['settings_url'])) { ?> |
|
| 177 | 177 | <a href="<?php echo $this->banner_details['settings_url']; ?>"> |
| 178 | - <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e( 'Go to Settings', 'give' ); ?> |
|
| 178 | + <span class="dashicons dashicons-admin-settings"></span><?php esc_html_e('Go to Settings', 'give'); ?> |
|
| 179 | 179 | </a> |
| 180 | 180 | <?php } ?> |
| 181 | 181 | |
| 182 | 182 | <?php |
| 183 | 183 | // Show them how to configure the Addon |
| 184 | - if ( isset( $this->banner_details['documentation_url'] ) ) { ?> |
|
| 184 | + if (isset($this->banner_details['documentation_url'])) { ?> |
|
| 185 | 185 | <a href="<?php echo $this->banner_details['documentation_url'] ?>" target="_blank"> |
| 186 | 186 | <span class="dashicons dashicons-media-text"></span> |
| 187 | 187 | <?php |
| 188 | 188 | printf( |
| 189 | 189 | /* translators: %s: Add-on name */ |
| 190 | - esc_html( 'Documentation: %s Add-on', 'give' ), |
|
| 190 | + esc_html('Documentation: %s Add-on', 'give'), |
|
| 191 | 191 | $this->banner_details['name'] |
| 192 | 192 | ); |
| 193 | 193 | ?> |
@@ -195,10 +195,10 @@ discard block |
||
| 195 | 195 | <?php } ?> |
| 196 | 196 | <?php |
| 197 | 197 | //Let them signup for plugin updates |
| 198 | - if ( isset( $this->banner_details['support_url'] ) ) { ?> |
|
| 198 | + if (isset($this->banner_details['support_url'])) { ?> |
|
| 199 | 199 | |
| 200 | 200 | <a href="<?php echo $this->banner_details['support_url'] ?>" target="_blank"> |
| 201 | - <span class="dashicons dashicons-sos"></span><?php esc_html_e( 'Get Support', 'give' ); ?> |
|
| 201 | + <span class="dashicons dashicons-sos"></span><?php esc_html_e('Get Support', 'give'); ?> |
|
| 202 | 202 | </a> |
| 203 | 203 | |
| 204 | 204 | <?php } ?> |
@@ -220,13 +220,13 @@ discard block |
||
| 220 | 220 | /* If user clicks to ignore the notice, add that to their user meta the banner then checks whether this tag exists already or not. |
| 221 | 221 | * See here: http://codex.wordpress.org/Function_Reference/add_user_meta |
| 222 | 222 | */ |
| 223 | - if ( isset( $_GET[ $this->nag_meta_key ] ) && '0' == $_GET[ $this->nag_meta_key ] ) { |
|
| 223 | + if (isset($_GET[$this->nag_meta_key]) && '0' == $_GET[$this->nag_meta_key]) { |
|
| 224 | 224 | |
| 225 | 225 | //Get the global user |
| 226 | 226 | global $current_user; |
| 227 | 227 | $user_id = $current_user->ID; |
| 228 | 228 | |
| 229 | - add_user_meta( $user_id, $this->nag_meta_key, 'true', true ); |
|
| 229 | + add_user_meta($user_id, $this->nag_meta_key, 'true', true); |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | |