@@ -40,11 +40,11 @@ |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | $field_options['link_phone'] = array( |
43 | - 'type' => 'checkbox', |
|
44 | - 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
46 | - 'value' => true, |
|
47 | - ); |
|
43 | + 'type' => 'checkbox', |
|
44 | + 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
|
45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
46 | + 'value' => true, |
|
47 | + ); |
|
48 | 48 | |
49 | 49 | return $field_options; |
50 | 50 | } |
@@ -35,14 +35,14 @@ |
||
35 | 35 | */ |
36 | 36 | function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
37 | 37 | |
38 | - if( 'edit' === $context ) { |
|
38 | + if ( 'edit' === $context ) { |
|
39 | 39 | return $field_options; |
40 | 40 | } |
41 | 41 | |
42 | - $field_options['link_phone'] = array( |
|
42 | + $field_options[ 'link_phone' ] = array( |
|
43 | 43 | 'type' => 'checkbox', |
44 | 44 | 'label' => __( 'Make Phone Number Clickable', 'gravityview' ), |
45 | - 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview'), |
|
45 | + 'desc' => __( 'Allow dialing a number by clicking it?', 'gravityview' ), |
|
46 | 46 | 'value' => true, |
47 | 47 | ); |
48 | 48 |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * |
124 | 124 | * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes |
125 | 125 | * |
126 | - * @since 1.17 |
|
126 | + * @since 1.17 |
|
127 | 127 | * |
128 | 128 | * @see process_delete_notes |
129 | 129 | * |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | * |
317 | 317 | * @param array $file_paths List of template paths ordered |
318 | 318 | * |
319 | - * @return array File paths with `./` and `./partials/` paths added |
|
319 | + * @return string[] File paths with `./` and `./partials/` paths added |
|
320 | 320 | */ |
321 | 321 | public function add_template_path( $file_paths ) { |
322 | 322 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @param array $entry |
486 | 486 | * @param array $data Note details array |
487 | 487 | * |
488 | - * @return int|WP_Error |
|
488 | + * @return integer |
|
489 | 489 | */ |
490 | 490 | private function add_note( $entry, $data ) { |
491 | 491 | global $current_user, $wpdb; |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | * |
585 | 585 | * @since 1.17 |
586 | 586 | * |
587 | - * @param int|string $entry_slug Current entry unique ID |
|
587 | + * @param string $entry_slug Current entry unique ID |
|
588 | 588 | * |
589 | 589 | * @return string HTML output |
590 | 590 | */ |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | |
64 | 64 | add_shortcode( 'gv_note_add', array( 'GravityView_Field_Notes', 'get_add_note_part' ) ); |
65 | 65 | |
66 | - add_action( 'wp', array( $this, 'maybe_delete_notes'), 1000 ); |
|
67 | - add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
68 | - add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes') ); |
|
66 | + add_action( 'wp', array( $this, 'maybe_delete_notes' ), 1000 ); |
|
67 | + add_action( 'wp_ajax_nopriv_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
68 | + add_action( 'wp_ajax_gv_delete_notes', array( $this, 'maybe_delete_notes' ) ); |
|
69 | 69 | |
70 | - add_action( 'wp', array( $this, 'maybe_add_note'), 1000 ); |
|
71 | - add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note') ); |
|
72 | - add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note') ); |
|
70 | + add_action( 'wp', array( $this, 'maybe_add_note' ), 1000 ); |
|
71 | + add_action( 'wp_ajax_nopriv_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
72 | + add_action( 'wp_ajax_gv_note_add', array( $this, 'maybe_add_note' ) ); |
|
73 | 73 | |
74 | 74 | // add template path to check for field |
75 | 75 | add_filter( 'gravityview_template_paths', array( $this, 'add_template_path' ) ); |
76 | 76 | |
77 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); |
|
77 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); |
|
78 | 78 | add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) ); |
79 | 79 | |
80 | 80 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 ); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public function add_entry_default_field( $entry_default_fields, $form, $zone ) { |
98 | 98 | |
99 | - if( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
100 | - $entry_default_fields['notes'] = array( |
|
99 | + if ( in_array( $zone, array( 'directory', 'single' ) ) ) { |
|
100 | + $entry_default_fields[ 'notes' ] = array( |
|
101 | 101 | 'label' => __( 'Entry Notes', 'gravityview' ), |
102 | 102 | 'type' => 'notes', |
103 | 103 | 'desc' => __( 'Display, add, and delete notes for an entry.', 'gravityview' ), |
@@ -130,23 +130,23 @@ discard block |
||
130 | 130 | public function enqueue_scripts() { |
131 | 131 | global $wp_actions; |
132 | 132 | |
133 | - if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
133 | + if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { |
|
134 | 134 | wp_enqueue_style( 'gravityview-notes' ); |
135 | 135 | wp_enqueue_script( 'gravityview-notes' ); |
136 | 136 | } |
137 | 137 | |
138 | - if( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
138 | + if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) { |
|
139 | 139 | |
140 | 140 | $strings = self::strings(); |
141 | 141 | |
142 | 142 | wp_localize_script( 'gravityview-notes', 'GVNotes', array( |
143 | 143 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
144 | 144 | 'text' => array( |
145 | - 'processing' => $strings['processing'], |
|
146 | - 'delete_confirm' => $strings['delete-confirm'], |
|
147 | - 'note_added' => $strings['added-note'], |
|
148 | - 'error_invalid' => $strings['error-invalid'], |
|
149 | - 'error_empty_note' => $strings['error-empty-note'], |
|
145 | + 'processing' => $strings[ 'processing' ], |
|
146 | + 'delete_confirm' => $strings[ 'delete-confirm' ], |
|
147 | + 'note_added' => $strings[ 'added-note' ], |
|
148 | + 'error_invalid' => $strings[ 'error-invalid' ], |
|
149 | + 'error_empty_note' => $strings[ 'error-empty-note' ], |
|
150 | 150 | ), |
151 | 151 | ) ); |
152 | 152 | } |
@@ -163,22 +163,22 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function maybe_add_note() { |
165 | 165 | |
166 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
166 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
167 | 167 | do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - if( 'gv_note_add' === rgpost('action') ) { |
|
171 | + if ( 'gv_note_add' === rgpost( 'action' ) ) { |
|
172 | 172 | |
173 | 173 | $post = wp_unslash( $_POST ); |
174 | 174 | |
175 | - if( $this->doing_ajax ) { |
|
176 | - parse_str( $post['data'], $data ); |
|
175 | + if ( $this->doing_ajax ) { |
|
176 | + parse_str( $post[ 'data' ], $data ); |
|
177 | 177 | } else { |
178 | 178 | $data = $post; |
179 | 179 | } |
180 | 180 | |
181 | - $this->process_add_note( (array) $data ); |
|
181 | + $this->process_add_note( (array)$data ); |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
@@ -205,23 +205,23 @@ discard block |
||
205 | 205 | $error = false; |
206 | 206 | $success = false; |
207 | 207 | |
208 | - if( empty( $data['entry-slug'] ) ) { |
|
208 | + if ( empty( $data[ 'entry-slug' ] ) ) { |
|
209 | 209 | |
210 | - $error = self::strings('error-invalid'); |
|
210 | + $error = self::strings( 'error-invalid' ); |
|
211 | 211 | do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' ); |
212 | 212 | |
213 | 213 | } else { |
214 | 214 | |
215 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); |
|
215 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); |
|
216 | 216 | |
217 | 217 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); |
218 | 218 | |
219 | - if( ! $has_cap ) { |
|
219 | + if ( ! $has_cap ) { |
|
220 | 220 | $error = self::strings( 'error-cap-add' ); |
221 | 221 | do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); |
222 | 222 | } elseif ( $valid ) { |
223 | 223 | |
224 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); |
|
224 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); |
|
225 | 225 | |
226 | 226 | $added = $this->add_note( $entry, $data ); |
227 | 227 | |
@@ -239,22 +239,22 @@ discard block |
||
239 | 239 | $this->maybe_send_entry_notes( $note, $entry, $data ); |
240 | 240 | |
241 | 241 | if ( $note ) { |
242 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); |
|
243 | - do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') ); |
|
242 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); |
|
243 | + do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) ); |
|
244 | 244 | } else { |
245 | - $error = self::strings('error-add-note'); |
|
246 | - do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') ); |
|
245 | + $error = self::strings( 'error-add-note' ); |
|
246 | + do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) ); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | } else { |
250 | - $error = self::strings('error-invalid'); |
|
250 | + $error = self::strings( 'error-invalid' ); |
|
251 | 251 | do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' ); |
252 | 252 | } |
253 | 253 | } |
254 | 254 | |
255 | 255 | |
256 | - if( $this->doing_ajax ) { |
|
257 | - if( $success ) { |
|
256 | + if ( $this->doing_ajax ) { |
|
257 | + if ( $success ) { |
|
258 | 258 | wp_send_json_success( array( 'html' => $success ) ); |
259 | 259 | } else { |
260 | 260 | $error = $error ? $error : self::strings( 'error-invalid' ); |
@@ -280,11 +280,11 @@ discard block |
||
280 | 280 | return; |
281 | 281 | } |
282 | 282 | |
283 | - if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { |
|
283 | + if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { |
|
284 | 284 | |
285 | 285 | $post = wp_unslash( $_POST ); |
286 | 286 | if ( $this->doing_ajax ) { |
287 | - parse_str( $post['data'], $data ); |
|
287 | + parse_str( $post[ 'data' ], $data ); |
|
288 | 288 | } else { |
289 | 289 | $data = $post; |
290 | 290 | } |
@@ -315,18 +315,18 @@ discard block |
||
315 | 315 | */ |
316 | 316 | function process_delete_notes( $data ) { |
317 | 317 | |
318 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); |
|
318 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); |
|
319 | 319 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); |
320 | 320 | $success = false; |
321 | 321 | |
322 | 322 | if ( $valid && $has_cap ) { |
323 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); |
|
323 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); |
|
324 | 324 | $success = true; |
325 | 325 | } |
326 | 326 | |
327 | - if( $this->doing_ajax ) { |
|
327 | + if ( $this->doing_ajax ) { |
|
328 | 328 | |
329 | - if( $success ) { |
|
329 | + if ( $success ) { |
|
330 | 330 | wp_send_json_success(); |
331 | 331 | } else { |
332 | 332 | if ( ! $valid ) { |
@@ -359,13 +359,13 @@ discard block |
||
359 | 359 | |
360 | 360 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
361 | 361 | |
362 | - unset( $field_options['show_as_link'] ); |
|
362 | + unset( $field_options[ 'show_as_link' ] ); |
|
363 | 363 | |
364 | 364 | $notes_options = array( |
365 | 365 | 'notes' => array( |
366 | 366 | 'type' => 'checkboxes', |
367 | - 'label' => __('Note Settings', 'gravityview'), |
|
368 | - 'desc' => sprintf( _x('Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
367 | + 'label' => __( 'Note Settings', 'gravityview' ), |
|
368 | + 'desc' => sprintf( _x( 'Only users with specific capabilities will be able to view, add and delete notes. %sRead more%s.', '%s is opening and closing HTML link', 'gravityview' ), '<a href="https://docs.gravityview.co/article/311-gravityview-capabilities">', '</a>' ), |
|
369 | 369 | 'options' => array( |
370 | 370 | 'view' => array( |
371 | 371 | 'label' => __( 'Display notes?', 'gravityview' ), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | 'processing' => __( 'Processing…', 'gravityview' ), |
418 | 418 | 'other-email' => __( 'Other email address', 'gravityview' ), |
419 | 419 | 'email-label' => __( 'Email address', 'gravityview' ), |
420 | - 'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), |
|
420 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), |
|
421 | 421 | 'subject-label' => __( 'Subject', 'gravityview' ), |
422 | 422 | 'subject' => __( 'Email subject', 'gravityview' ), |
423 | 423 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | */ |
437 | 437 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); |
438 | 438 | |
439 | - if( $key ) { |
|
439 | + if ( $key ) { |
|
440 | 440 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; |
441 | 441 | } |
442 | 442 | |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | */ |
456 | 456 | static public function display_note( $note, $show_delete = false ) { |
457 | 457 | |
458 | - if( ! is_object( $note ) ) { |
|
458 | + if ( ! is_object( $note ) ) { |
|
459 | 459 | return ''; |
460 | 460 | } |
461 | 461 | |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | $note_row = ob_get_clean(); |
497 | 497 | |
498 | 498 | $replacements = array( |
499 | - '{note_id}' => $note_content['note_id'], |
|
499 | + '{note_id}' => $note_content[ 'note_id' ], |
|
500 | 500 | '{row_class}' => 'gv-note', |
501 | 501 | '{note_detail}' => $note_detail_html |
502 | 502 | ); |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | |
529 | 529 | $user_data = get_userdata( $current_user->ID ); |
530 | 530 | |
531 | - $note_content = trim( $data['gv-note-content'] ); |
|
531 | + $note_content = trim( $data[ 'gv-note-content' ] ); |
|
532 | 532 | |
533 | - if( empty( $note_content ) ) { |
|
533 | + if ( empty( $note_content ) ) { |
|
534 | 534 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); |
535 | 535 | } |
536 | 536 | |
537 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
537 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
538 | 538 | |
539 | 539 | return $return; |
540 | 540 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public static function get_add_note_part() { |
552 | 552 | |
553 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
553 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
554 | 554 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); |
555 | 555 | return ''; |
556 | 556 | } |
@@ -563,19 +563,19 @@ discard block |
||
563 | 563 | |
564 | 564 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
565 | 565 | $entry = $gravityview_view->getCurrentEntry(); |
566 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
566 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
567 | 567 | $nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false ); |
568 | 568 | |
569 | 569 | // Only generate the dropdown if the field settings allow it |
570 | 570 | $email_fields = ''; |
571 | - if( ! empty( $visibility_settings['email'] ) ) { |
|
571 | + if ( ! empty( $visibility_settings[ 'email' ] ) ) { |
|
572 | 572 | $email_fields = self::get_note_email_fields( $entry_slug ); |
573 | 573 | } |
574 | 574 | |
575 | 575 | $add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); |
576 | 576 | $add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); |
577 | - $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html ); |
|
578 | - $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
577 | + $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html ); |
|
578 | + $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
579 | 579 | |
580 | 580 | return $add_note_html; |
581 | 581 | } |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | $note_emails = array(); |
600 | 600 | |
601 | 601 | foreach ( $email_fields as $email_field ) { |
602 | - if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { |
|
603 | - $note_emails[] = $entry["{$email_field->id}"]; |
|
602 | + if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { |
|
603 | + $note_emails[ ] = $entry[ "{$email_field->id}" ]; |
|
604 | 604 | } |
605 | 605 | } |
606 | 606 | |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | */ |
613 | 613 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); |
614 | 614 | |
615 | - return (array) $note_emails; |
|
615 | + return (array)$note_emails; |
|
616 | 616 | } |
617 | 617 | |
618 | 618 | /** |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | */ |
629 | 629 | private static function get_note_email_fields( $entry_slug = '' ) { |
630 | 630 | |
631 | - if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
631 | + if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
632 | 632 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); |
633 | 633 | return ''; |
634 | 634 | } |
@@ -650,27 +650,27 @@ discard block |
||
650 | 650 | |
651 | 651 | if ( ! empty( $note_emails ) || $include_custom ) { ?> |
652 | 652 | <div class="gv-note-email-container"> |
653 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> |
|
653 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> |
|
654 | 654 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> |
655 | - <option value=""><?php echo $strings['also-email']; ?></option> |
|
655 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> |
|
656 | 656 | <?php foreach ( $note_emails as $email ) { |
657 | 657 | ?> |
658 | 658 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> |
659 | 659 | <?php } |
660 | - if( $include_custom ) { ?> |
|
661 | - <option value="custom"><?php echo self::strings('other-email'); ?></option> |
|
660 | + if ( $include_custom ) { ?> |
|
661 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> |
|
662 | 662 | <?php } ?> |
663 | 663 | </select> |
664 | 664 | <fieldset class="gv-note-to-container"> |
665 | - <?php if( $include_custom ) { ?> |
|
665 | + <?php if ( $include_custom ) { ?> |
|
666 | 666 | <div class='gv-note-to-custom-container'> |
667 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> |
|
668 | - <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings['email-placeholder']; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
667 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> |
|
668 | + <input type="text" name="gv-note-to-custom" placeholder="<?php echo $strings[ 'email-placeholder' ]; ?>" id="gv-note-to-custom-<?php echo $entry_slug_esc; ?>" value="" /> |
|
669 | 669 | </div> |
670 | 670 | <?php } ?> |
671 | 671 | <div class='gv-note-subject-container'> |
672 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> |
|
673 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
672 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> |
|
673 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
674 | 674 | </div> |
675 | 675 | </fieldset> |
676 | 676 | </div> |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | */ |
694 | 694 | private function maybe_send_entry_notes( $note = false, $entry, $data ) { |
695 | 695 | |
696 | - if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { |
|
696 | + if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
697 | 697 | do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note ); |
698 | 698 | return; |
699 | 699 | } |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data ); |
702 | 702 | |
703 | 703 | //emailing notes if configured |
704 | - if ( ! empty( $data['gv-note-to'] ) ) { |
|
704 | + if ( ! empty( $data[ 'gv-note-to' ] ) ) { |
|
705 | 705 | |
706 | 706 | $default_data = array( |
707 | 707 | 'gv-note-to' => '', |
@@ -710,11 +710,11 @@ discard block |
||
710 | 710 | 'gv-note-content' => '', |
711 | 711 | ); |
712 | 712 | |
713 | - $current_user = wp_get_current_user(); |
|
713 | + $current_user = wp_get_current_user(); |
|
714 | 714 | $email_data = wp_parse_args( $data, $default_data ); |
715 | 715 | |
716 | - $from = $current_user->user_email; |
|
717 | - $to = $email_data['gv-note-to']; |
|
716 | + $from = $current_user->user_email; |
|
717 | + $to = $email_data[ 'gv-note-to' ]; |
|
718 | 718 | |
719 | 719 | /** |
720 | 720 | * Documented in get_note_email_fields |
@@ -722,8 +722,8 @@ discard block |
||
722 | 722 | */ |
723 | 723 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); |
724 | 724 | |
725 | - if( 'custom' === $to && $include_custom ) { |
|
726 | - $to = $email_data['gv-note-to-custom']; |
|
725 | + if ( 'custom' === $to && $include_custom ) { |
|
726 | + $to = $email_data[ 'gv-note-to-custom' ]; |
|
727 | 727 | do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to ); |
728 | 728 | } |
729 | 729 | |
@@ -734,12 +734,12 @@ discard block |
||
734 | 734 | |
735 | 735 | $bcc = false; |
736 | 736 | $reply_to = $from; |
737 | - $subject = trim( $email_data['gv-note-subject'] ); |
|
737 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); |
|
738 | 738 | |
739 | 739 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF |
740 | 740 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; |
741 | - $message = $email_data['gv-note-content']; |
|
742 | - $from_name = $current_user->display_name; |
|
741 | + $message = $email_data[ 'gv-note-content' ]; |
|
742 | + $from_name = $current_user->display_name; |
|
743 | 743 | $message_format = 'html'; |
744 | 744 | |
745 | 745 | /** |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | |
755 | 755 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); |
756 | 756 | |
757 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); |
|
757 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); |
|
758 | 758 | |
759 | 759 | /** |
760 | 760 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | // Make sure the keys are all set |
68 | 68 | $note = wp_parse_args( $note, $default_note ); |
69 | 69 | |
70 | - GFFormsModel::add_note( intval( $note['lead_id'] ), intval( $note['user_id'] ), esc_attr( $note['user_name'] ), $note['note'], esc_attr( $note['note_type'] ) ); |
|
70 | + GFFormsModel::add_note( intval( $note[ 'lead_id' ] ), intval( $note[ 'user_id' ] ), esc_attr( $note[ 'user_name' ] ), $note[ 'note' ], esc_attr( $note[ 'note_type' ] ) ); |
|
71 | 71 | |
72 | 72 | // If last_error is empty string, there was no error. |
73 | - if( empty( $wpdb->last_error ) ) { |
|
73 | + if ( empty( $wpdb->last_error ) ) { |
|
74 | 74 | $return = $wpdb->insert_id; |
75 | 75 | } else { |
76 | 76 | $return = new WP_Error( 'gravityview-add-note', $wpdb->last_error ); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | public static function delete_notes( $note_ids = array() ) { |
98 | 98 | |
99 | - if( !is_array( $note_ids ) ) { |
|
99 | + if ( ! is_array( $note_ids ) ) { |
|
100 | 100 | |
101 | 101 | do_action( 'gravityview_log_error', __METHOD__ . ' - Note IDs not an array. Not processing delete request.', $note_ids ); |
102 | 102 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | ) |
152 | 152 | ); |
153 | 153 | |
154 | - return $results ? $results[0] : false; |
|
154 | + return $results ? $results[ 0 ] : false; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | /** |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | */ |
165 | 165 | public static function filter_avatar( $avatar = '', $note ) { |
166 | 166 | |
167 | - if( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
168 | - $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
167 | + if ( 'gravityview' === $note->note_type && -1 === (int)$note->user_id ) { |
|
168 | + $avatar = sprintf( '<img src="%s" width="48" height="48" alt="GravityView" class="avatar avatar-48 gravityview-avatar" />', esc_url_raw( plugins_url( 'assets/images/floaty-avatar.png', GRAVITYVIEW_FILE ) ) ); |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | return $avatar; |
@@ -21,10 +21,10 @@ |
||
21 | 21 | {email_fields} |
22 | 22 | |
23 | 23 | <div class="gv-note-content-container"> |
24 | - <label for="gv-note-content-{entry_slug}" class="screen-reader-text"><?php echo GravityView_Field_Notes::strings('content-label'); ?></label> |
|
24 | + <label for="gv-note-content-{entry_slug}" class="screen-reader-text"><?php echo GravityView_Field_Notes::strings( 'content-label' ); ?></label> |
|
25 | 25 | <textarea name="gv-note-content" id="gv-note-content-{entry_slug}"></textarea> |
26 | 26 | </div> |
27 | 27 | |
28 | - <button type="submit" class="button gv-add-note-submit"><?php echo GravityView_Field_Notes::strings('add-note'); ?></button> |
|
28 | + <button type="submit" class="button gv-add-note-submit"><?php echo GravityView_Field_Notes::strings( 'add-note' ); ?></button> |
|
29 | 29 | </div> |
30 | 30 | </form> |
31 | 31 | \ No newline at end of file |
@@ -21,7 +21,7 @@ |
||
21 | 21 | * @return string |
22 | 22 | */ |
23 | 23 | function get_field_desc() { |
24 | - return !empty( $this->field['desc'] ) ? $this->field['desc'] : ''; |
|
24 | + return ! empty( $this->field[ 'desc' ] ) ? $this->field[ 'desc' ] : ''; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | function render_input( $override_input = null ) { |
25 | - if( isset( $override_input ) ) { |
|
25 | + if ( isset( $override_input ) ) { |
|
26 | 26 | echo $override_input; |
27 | 27 | return; |
28 | 28 | } |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | ?> |
31 | 31 | <ul class="gv-setting-list"> |
32 | 32 | <?php |
33 | - foreach( $this->field['options'] as $value => $label ) { ?> |
|
34 | - <li <?php if( isset( $label['requires'] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label['requires'] ); } ?>> |
|
33 | + foreach ( $this->field[ 'options' ] as $value => $label ) { ?> |
|
34 | + <li <?php if ( isset( $label[ 'requires' ] ) ) { printf( 'class="gv-sub-setting" data-requires="%s"', $label[ 'requires' ] ); } ?>> |
|
35 | 35 | <label> |
36 | 36 | <input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" type="hidden" |
37 | 37 | value="0"/> |
38 | 38 | <input name="<?php printf( '%s[%s]', esc_attr( $this->name ), esc_attr( $value ) ); ?>" |
39 | 39 | id="<?php echo $this->get_field_id(); ?>" type="checkbox" |
40 | 40 | value="1" <?php checked( ! empty( $this->value[ $value ] ) ); ?> /> |
41 | - <?php echo esc_html( $label['label'] ); ?> |
|
41 | + <?php echo esc_html( $label[ 'label' ] ); ?> |
|
42 | 42 | </label> |
43 | - <?php if( ! empty( $label['desc'] ) ) { |
|
44 | - printf( '<span class="howto">%s</span>', $label['desc'] ); |
|
43 | + <?php if ( ! empty( $label[ 'desc' ] ) ) { |
|
44 | + printf( '<span class="howto">%s</span>', $label[ 'desc' ] ); |
|
45 | 45 | } |
46 | 46 | ?> |
47 | 47 | </li> |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | $gravityview_view = GravityView_View::getInstance(); |
10 | 10 | |
11 | 11 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
12 | -$show_notes_logged_out = ( ! empty( $visibility_settings['view'] ) && ! empty( $visibility_settings['view_loggedout'] ) ); |
|
12 | +$show_notes_logged_out = ( ! empty( $visibility_settings[ 'view' ] ) && ! empty( $visibility_settings[ 'view_loggedout' ] ) ); |
|
13 | 13 | |
14 | -if( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
14 | +if ( ! GVCommon::has_cap( array( 'gravityview_view_entry_notes', 'gravityview_add_entry_notes', 'gravityview_delete_entry_notes' ) ) && ! $show_notes_logged_out ) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | do_action( 'gravityview/field/notes/scripts' ); |
26 | 26 | |
27 | 27 | $entry = $gravityview_view->getCurrentEntry(); |
28 | -$notes = GravityView_Entry_Notes::get_notes( $entry['id'] ); |
|
28 | +$notes = GravityView_Entry_Notes::get_notes( $entry[ 'id' ] ); |
|
29 | 29 | $strings = GravityView_Field_Notes::strings(); |
30 | -$entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
30 | +$entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
31 | 31 | |
32 | -$show_add = ! empty( $visibility_settings['add'] ); |
|
33 | -$show_delete = ( ! empty( $visibility_settings['delete'] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
34 | -$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings['view'] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
32 | +$show_add = ! empty( $visibility_settings[ 'add' ] ); |
|
33 | +$show_delete = ( ! empty( $visibility_settings[ 'delete' ] ) && GVCommon::has_cap( 'gravityview_delete_entry_notes' ) ); |
|
34 | +$show_notes = $show_notes_logged_out || ( ! empty( $visibility_settings[ 'view' ] ) && GVCommon::has_cap( 'gravityview_view_entry_notes' ) ); |
|
35 | 35 | |
36 | 36 | $container_class = ( sizeof( $notes ) > 0 ? 'gv-has-notes' : 'gv-no-notes' ); |
37 | 37 | $container_class .= $show_notes ? ' gv-show-notes' : ' gv-hide-notes'; |
38 | 38 | ?> |
39 | 39 | <div class="gv-notes <?php echo $container_class; ?>"> |
40 | 40 | <?php |
41 | - if( $show_notes ) { |
|
41 | + if ( $show_notes ) { |
|
42 | 42 | ?> |
43 | 43 | <form method="post" class="gv-notes-list"> |
44 | 44 | <?php if ( $show_delete ) { wp_nonce_field( 'gv_delete_notes_' . $entry_slug, 'gv_delete_notes' ); } ?> |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | <input type="hidden" name="action" value="gv_delete_notes" /> |
47 | 47 | <input type="hidden" name="entry-slug" value="<?php echo esc_attr( $entry_slug ); ?>" /> |
48 | 48 | <table> |
49 | - <caption><?php echo $strings['caption']; ?></caption> |
|
49 | + <caption><?php echo $strings[ 'caption' ]; ?></caption> |
|
50 | 50 | <?php |
51 | 51 | if ( $show_delete ) { |
52 | 52 | ?> |
53 | 53 | <thead> |
54 | 54 | <tr> |
55 | 55 | <th colspan="2"> |
56 | - <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings['toggle-notes']; ?>"><span class="screen-reader-text"><?php echo $strings['toggle-notes']; ?></span></label> |
|
57 | - <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings['delete']; ?></button> |
|
56 | + <label><input type="checkbox" value="" class="gv-notes-toggle" title="<?php echo $strings[ 'toggle-notes' ]; ?>"><span class="screen-reader-text"><?php echo $strings[ 'toggle-notes' ]; ?></span></label> |
|
57 | + <button type="submit" class="button button-small gv-notes-delete"><?php echo $strings[ 'delete' ]; ?></button> |
|
58 | 58 | </th> |
59 | 59 | </tr> |
60 | 60 | </thead> |
61 | 61 | <?php } ?> |
62 | 62 | <tbody> |
63 | - <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings['no-notes']; ?></td></tr> |
|
63 | + <tr class="gv-notes-no-notes"><td colspan="2"><?php echo $strings[ 'no-notes' ]; ?></td></tr> |
|
64 | 64 | <?php |
65 | 65 | foreach ( $notes as $note ) { |
66 | 66 | echo GravityView_Field_Notes::display_note( $note, $show_delete ); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <?php |
74 | 74 | } // End if can view notes |
75 | 75 | |
76 | - if( $show_add ) { |
|
76 | + if ( $show_add ) { |
|
77 | 77 | echo do_shortcode( '[gv_note_add]' ); |
78 | 78 | } |
79 | 79 | ?> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $signature_fields = GFAPI::get_fields_by_type( $form, 'signature' ); |
54 | 54 | |
55 | 55 | foreach ( $signature_fields as $field ) { |
56 | - unset( $_POST["input_{$field->id}"] ); |
|
56 | + unset( $_POST[ "input_{$field->id}" ] ); |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
@@ -72,19 +72,19 @@ discard block |
||
72 | 72 | */ |
73 | 73 | function edit_entry_field_input( $field_content = '', $field, $value = '', $lead_id = 0, $form_id = 0 ) { |
74 | 74 | |
75 | - $context = function_exists('gravityview_get_context') ? gravityview_get_context() : ''; |
|
75 | + $context = function_exists( 'gravityview_get_context' ) ? gravityview_get_context() : ''; |
|
76 | 76 | |
77 | - if( 'signature' !== $field->type || 'edit' !== $context ) { |
|
77 | + if ( 'signature' !== $field->type || 'edit' !== $context ) { |
|
78 | 78 | return $field_content; |
79 | 79 | } |
80 | 80 | |
81 | 81 | // We need to fetch a fresh version of the entry, since the saved entry hasn't refreshed in GV yet. |
82 | 82 | $entry = GravityView_View::getInstance()->getCurrentEntry(); |
83 | - $entry = GFAPI::get_entry( $entry['id'] ); |
|
83 | + $entry = GFAPI::get_entry( $entry[ 'id' ] ); |
|
84 | 84 | $entry_value = rgar( $entry, $field->id ); |
85 | 85 | |
86 | - $_POST["input_{$field->id}"] = $entry_value; // Used when Edit Entry form *is* submitted |
|
87 | - $_POST["input_{$form_id}_{$field->id}_signature_filename"] = $entry_value; // Used when Edit Entry form *is not* submitted |
|
86 | + $_POST[ "input_{$field->id}" ] = $entry_value; // Used when Edit Entry form *is* submitted |
|
87 | + $_POST[ "input_{$form_id}_{$field->id}_signature_filename" ] = $entry_value; // Used when Edit Entry form *is not* submitted |
|
88 | 88 | |
89 | 89 | return ''; // Return empty string to force using $_POST values instead |
90 | 90 | } |
@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | public function if_gravityview_return_true( $has_content = false ) { |
52 | 52 | |
53 | - if( ! class_exists( 'GravityView_frontend' ) ) { |
|
53 | + if ( ! class_exists( 'GravityView_frontend' ) ) { |
|
54 | 54 | return $has_content; |
55 | 55 | } |
56 | 56 |