@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | |
170 | 170 | if( 'gv_note_add' === $_POST['action'] ) { |
171 | 171 | |
172 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
173 | - do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
|
174 | - return; |
|
175 | - } |
|
172 | + if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
173 | + do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
|
174 | + return; |
|
175 | + } |
|
176 | 176 | |
177 | 177 | $post = wp_unslash( $_POST ); |
178 | 178 | |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | * |
273 | 273 | * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes |
274 | 274 | * |
275 | - * @since 1.17 |
|
275 | + * @since 1.17 |
|
276 | 276 | * |
277 | 277 | * @see process_delete_notes |
278 | 278 | * |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | 'subject-label' => __( 'Subject', 'gravityview' ), |
426 | 426 | 'subject' => __( 'Email subject', 'gravityview' ), |
427 | 427 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
428 | - 'email-footer' => __( 'This note was sent from {url}', 'gravityview' ), |
|
428 | + 'email-footer' => __( 'This note was sent from {url}', 'gravityview' ), |
|
429 | 429 | 'also-email' => __( 'Also email this note to', 'gravityview' ), |
430 | 430 | 'error-add-note' => __( 'There was an error adding the note.', 'gravityview' ), |
431 | 431 | 'error-invalid' => __( 'The request was invalid. Refresh the page and try again.', 'gravityview' ), |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | 'gv-note-to-custom' => '', |
718 | 718 | 'gv-note-subject' => '', |
719 | 719 | 'gv-note-content' => '', |
720 | - 'current-url' => '', |
|
720 | + 'current-url' => '', |
|
721 | 721 | ); |
722 | 722 | |
723 | 723 | $current_user = wp_get_current_user(); |
@@ -769,9 +769,9 @@ discard block |
||
769 | 769 | $message .= $this->get_email_footer( $email_footer, $is_html, $email_data ); |
770 | 770 | |
771 | 771 | /** |
772 | - * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format |
|
772 | + * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format |
|
773 | 773 | * @since 1.18 |
774 | - * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true) |
|
774 | + * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true) |
|
775 | 775 | */ |
776 | 776 | $wpautop_email = apply_filters( 'gravityview/field/notes/wpautop_email', true ); |
777 | 777 | |
@@ -791,12 +791,12 @@ discard block |
||
791 | 791 | } |
792 | 792 | |
793 | 793 | /** |
794 | - * Get the footer for Entry Note emails |
|
795 | - * |
|
796 | - * `{url}` is replaced by the URL of the page where the note form was embedded |
|
797 | - * |
|
798 | - * @since 1.18 |
|
799 | - * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer' |
|
794 | + * Get the footer for Entry Note emails |
|
795 | + * |
|
796 | + * `{url}` is replaced by the URL of the page where the note form was embedded |
|
797 | + * |
|
798 | + * @since 1.18 |
|
799 | + * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer' |
|
800 | 800 | * |
801 | 801 | * @param string $email_footer The message footer value |
802 | 802 | * @param bool $is_html True: Email is being sent as HTML; False: sent as text |
@@ -805,10 +805,10 @@ discard block |
||
805 | 805 | */ |
806 | 806 | private function get_email_footer( $email_footer = '', $is_html = true, $email_data = array() ) { |
807 | 807 | |
808 | - $output = ''; |
|
808 | + $output = ''; |
|
809 | 809 | |
810 | 810 | if( ! empty( $email_footer ) ) { |
811 | - $url = rgar( $email_data, 'current-url' ); |
|
811 | + $url = rgar( $email_data, 'current-url' ); |
|
812 | 812 | $url = html_entity_decode( $url ); |
813 | 813 | $url = site_url( $url ); |
814 | 814 |
@@ -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,26 +163,26 @@ discard block |
||
163 | 163 | */ |
164 | 164 | function maybe_add_note() { |
165 | 165 | |
166 | - if( ! isset( $_POST['action'] ) ) { |
|
166 | + if ( ! isset( $_POST[ 'action' ] ) ) { |
|
167 | 167 | return; |
168 | 168 | } |
169 | 169 | |
170 | - if( 'gv_note_add' === $_POST['action'] ) { |
|
170 | + if ( 'gv_note_add' === $_POST[ 'action' ] ) { |
|
171 | 171 | |
172 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
172 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
173 | 173 | do_action( 'gravityview_log_error', __METHOD__ . ': The user isnt allowed to add entry notes.' ); |
174 | 174 | return; |
175 | 175 | } |
176 | 176 | |
177 | 177 | $post = wp_unslash( $_POST ); |
178 | 178 | |
179 | - if( $this->doing_ajax ) { |
|
180 | - parse_str( $post['data'], $data ); |
|
179 | + if ( $this->doing_ajax ) { |
|
180 | + parse_str( $post[ 'data' ], $data ); |
|
181 | 181 | } else { |
182 | 182 | $data = $post; |
183 | 183 | } |
184 | 184 | |
185 | - $this->process_add_note( (array) $data ); |
|
185 | + $this->process_add_note( (array)$data ); |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | |
@@ -209,23 +209,23 @@ discard block |
||
209 | 209 | $error = false; |
210 | 210 | $success = false; |
211 | 211 | |
212 | - if( empty( $data['entry-slug'] ) ) { |
|
212 | + if ( empty( $data[ 'entry-slug' ] ) ) { |
|
213 | 213 | |
214 | - $error = self::strings('error-invalid'); |
|
214 | + $error = self::strings( 'error-invalid' ); |
|
215 | 215 | do_action( 'gravityview_log_error', __METHOD__ . ': The note is missing an Entry ID.' ); |
216 | 216 | |
217 | 217 | } else { |
218 | 218 | |
219 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); |
|
219 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); |
|
220 | 220 | |
221 | 221 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); |
222 | 222 | |
223 | - if( ! $has_cap ) { |
|
223 | + if ( ! $has_cap ) { |
|
224 | 224 | $error = self::strings( 'error-cap-add' ); |
225 | 225 | do_action( 'gravityview_log_error', __METHOD__ . ': Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); |
226 | 226 | } elseif ( $valid ) { |
227 | 227 | |
228 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); |
|
228 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); |
|
229 | 229 | |
230 | 230 | $added = $this->add_note( $entry, $data ); |
231 | 231 | |
@@ -243,22 +243,22 @@ discard block |
||
243 | 243 | $this->maybe_send_entry_notes( $note, $entry, $data ); |
244 | 244 | |
245 | 245 | if ( $note ) { |
246 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); |
|
247 | - do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact('note', 'data') ); |
|
246 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); |
|
247 | + do_action( 'gravityview_log_debug', __METHOD__ . ': The note was successfully created', compact( 'note', 'data' ) ); |
|
248 | 248 | } else { |
249 | - $error = self::strings('error-add-note'); |
|
250 | - do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact('note', 'data') ); |
|
249 | + $error = self::strings( 'error-add-note' ); |
|
250 | + do_action( 'gravityview_log_error', __METHOD__ . ': The note was not successfully created', compact( 'note', 'data' ) ); |
|
251 | 251 | } |
252 | 252 | } |
253 | 253 | } else { |
254 | - $error = self::strings('error-invalid'); |
|
254 | + $error = self::strings( 'error-invalid' ); |
|
255 | 255 | do_action( 'gravityview_log_error', __METHOD__ . ': Nonce validation failed; the note was not created' ); |
256 | 256 | } |
257 | 257 | } |
258 | 258 | |
259 | 259 | |
260 | - if( $this->doing_ajax ) { |
|
261 | - if( $success ) { |
|
260 | + if ( $this->doing_ajax ) { |
|
261 | + if ( $success ) { |
|
262 | 262 | wp_send_json_success( array( 'html' => $success ) ); |
263 | 263 | } else { |
264 | 264 | $error = $error ? $error : self::strings( 'error-invalid' ); |
@@ -284,11 +284,11 @@ discard block |
||
284 | 284 | return; |
285 | 285 | } |
286 | 286 | |
287 | - if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { |
|
287 | + if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { |
|
288 | 288 | |
289 | 289 | $post = wp_unslash( $_POST ); |
290 | 290 | if ( $this->doing_ajax ) { |
291 | - parse_str( $post['data'], $data ); |
|
291 | + parse_str( $post[ 'data' ], $data ); |
|
292 | 292 | } else { |
293 | 293 | $data = $post; |
294 | 294 | } |
@@ -319,18 +319,18 @@ discard block |
||
319 | 319 | */ |
320 | 320 | function process_delete_notes( $data ) { |
321 | 321 | |
322 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); |
|
322 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); |
|
323 | 323 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); |
324 | 324 | $success = false; |
325 | 325 | |
326 | 326 | if ( $valid && $has_cap ) { |
327 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); |
|
327 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); |
|
328 | 328 | $success = true; |
329 | 329 | } |
330 | 330 | |
331 | - if( $this->doing_ajax ) { |
|
331 | + if ( $this->doing_ajax ) { |
|
332 | 332 | |
333 | - if( $success ) { |
|
333 | + if ( $success ) { |
|
334 | 334 | wp_send_json_success(); |
335 | 335 | } else { |
336 | 336 | if ( ! $valid ) { |
@@ -363,13 +363,13 @@ discard block |
||
363 | 363 | |
364 | 364 | public function field_options( $field_options, $template_id, $field_id, $context, $input_type ) { |
365 | 365 | |
366 | - unset( $field_options['show_as_link'] ); |
|
366 | + unset( $field_options[ 'show_as_link' ] ); |
|
367 | 367 | |
368 | 368 | $notes_options = array( |
369 | 369 | 'notes' => array( |
370 | 370 | 'type' => 'checkboxes', |
371 | - 'label' => __('Note Settings', 'gravityview'), |
|
372 | - '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>' ), |
|
371 | + 'label' => __( 'Note Settings', 'gravityview' ), |
|
372 | + '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>' ), |
|
373 | 373 | 'options' => array( |
374 | 374 | 'view' => array( |
375 | 375 | 'label' => __( 'Display notes?', 'gravityview' ), |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | 'processing' => __( 'Processing…', 'gravityview' ), |
422 | 422 | 'other-email' => __( 'Other email address', 'gravityview' ), |
423 | 423 | 'email-label' => __( 'Email address', 'gravityview' ), |
424 | - 'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), |
|
424 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), |
|
425 | 425 | 'subject-label' => __( 'Subject', 'gravityview' ), |
426 | 426 | 'subject' => __( 'Email subject', 'gravityview' ), |
427 | 427 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | */ |
442 | 442 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); |
443 | 443 | |
444 | - if( $key ) { |
|
444 | + if ( $key ) { |
|
445 | 445 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; |
446 | 446 | } |
447 | 447 | |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | static public function display_note( $note, $show_delete = false ) { |
462 | 462 | |
463 | - if( ! is_object( $note ) ) { |
|
463 | + if ( ! is_object( $note ) ) { |
|
464 | 464 | return ''; |
465 | 465 | } |
466 | 466 | |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $note_row = ob_get_clean(); |
502 | 502 | |
503 | 503 | $replacements = array( |
504 | - '{note_id}' => $note_content['note_id'], |
|
504 | + '{note_id}' => $note_content[ 'note_id' ], |
|
505 | 505 | '{row_class}' => 'gv-note', |
506 | 506 | '{note_detail}' => $note_detail_html |
507 | 507 | ); |
@@ -533,13 +533,13 @@ discard block |
||
533 | 533 | |
534 | 534 | $user_data = get_userdata( $current_user->ID ); |
535 | 535 | |
536 | - $note_content = trim( $data['gv-note-content'] ); |
|
536 | + $note_content = trim( $data[ 'gv-note-content' ] ); |
|
537 | 537 | |
538 | - if( empty( $note_content ) ) { |
|
538 | + if ( empty( $note_content ) ) { |
|
539 | 539 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); |
540 | 540 | } |
541 | 541 | |
542 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
542 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); |
|
543 | 543 | |
544 | 544 | return $return; |
545 | 545 | } |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | */ |
556 | 556 | public static function get_add_note_part() { |
557 | 557 | |
558 | - if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
558 | + if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { |
|
559 | 559 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); |
560 | 560 | return ''; |
561 | 561 | } |
@@ -571,19 +571,19 @@ discard block |
||
571 | 571 | |
572 | 572 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); |
573 | 573 | $entry = $gravityview_view->getCurrentEntry(); |
574 | - $entry_slug = GravityView_API::get_entry_slug( $entry['id'], $entry ); |
|
574 | + $entry_slug = GravityView_API::get_entry_slug( $entry[ 'id' ], $entry ); |
|
575 | 575 | $nonce_field = wp_nonce_field( 'gv_note_add_' . $entry_slug, 'gv_note_add', false, false ); |
576 | 576 | |
577 | 577 | // Only generate the dropdown if the field settings allow it |
578 | 578 | $email_fields = ''; |
579 | - if( ! empty( $visibility_settings['email'] ) ) { |
|
579 | + if ( ! empty( $visibility_settings[ 'email' ] ) ) { |
|
580 | 580 | $email_fields = self::get_note_email_fields( $entry_slug ); |
581 | 581 | } |
582 | 582 | |
583 | 583 | $add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); |
584 | 584 | $add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); |
585 | - $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings['delete'] ), $add_note_html ); |
|
586 | - $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
585 | + $add_note_html = str_replace( '{show_delete}', intval( $visibility_settings[ 'delete' ] ), $add_note_html ); |
|
586 | + $add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); |
|
587 | 587 | $add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html ); |
588 | 588 | |
589 | 589 | return $add_note_html; |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | $note_emails = array(); |
609 | 609 | |
610 | 610 | foreach ( $email_fields as $email_field ) { |
611 | - if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { |
|
612 | - $note_emails[] = $entry["{$email_field->id}"]; |
|
611 | + if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { |
|
612 | + $note_emails[ ] = $entry[ "{$email_field->id}" ]; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); |
623 | 623 | |
624 | - return (array) $note_emails; |
|
624 | + return (array)$note_emails; |
|
625 | 625 | } |
626 | 626 | |
627 | 627 | /** |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | */ |
638 | 638 | private static function get_note_email_fields( $entry_slug = '' ) { |
639 | 639 | |
640 | - if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
640 | + if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
641 | 641 | do_action( 'gravityview_log_error', __METHOD__ . ': User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); |
642 | 642 | return ''; |
643 | 643 | } |
@@ -659,27 +659,27 @@ discard block |
||
659 | 659 | |
660 | 660 | if ( ! empty( $note_emails ) || $include_custom ) { ?> |
661 | 661 | <div class="gv-note-email-container"> |
662 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> |
|
662 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> |
|
663 | 663 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> |
664 | - <option value=""><?php echo $strings['also-email']; ?></option> |
|
664 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> |
|
665 | 665 | <?php foreach ( $note_emails as $email ) { |
666 | 666 | ?> |
667 | 667 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> |
668 | 668 | <?php } |
669 | - if( $include_custom ) { ?> |
|
670 | - <option value="custom"><?php echo self::strings('other-email'); ?></option> |
|
669 | + if ( $include_custom ) { ?> |
|
670 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> |
|
671 | 671 | <?php } ?> |
672 | 672 | </select> |
673 | 673 | <fieldset class="gv-note-to-container"> |
674 | - <?php if( $include_custom ) { ?> |
|
674 | + <?php if ( $include_custom ) { ?> |
|
675 | 675 | <div class='gv-note-to-custom-container'> |
676 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> |
|
677 | - <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="" /> |
|
676 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> |
|
677 | + <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="" /> |
|
678 | 678 | </div> |
679 | 679 | <?php } ?> |
680 | 680 | <div class='gv-note-subject-container'> |
681 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> |
|
682 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
681 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> |
|
682 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> |
|
683 | 683 | </div> |
684 | 684 | </fieldset> |
685 | 685 | </div> |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | */ |
703 | 703 | private function maybe_send_entry_notes( $note = false, $entry, $data ) { |
704 | 704 | |
705 | - if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { |
|
705 | + if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { |
|
706 | 706 | do_action( 'gravityview_log_debug', __METHOD__ . ': User doesnt have "gravityview_email_entry_notes" cap, or $note is empty', $note ); |
707 | 707 | return; |
708 | 708 | } |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | do_action( 'gravityview_log_debug', __METHOD__ . ': $data', $data ); |
711 | 711 | |
712 | 712 | //emailing notes if configured |
713 | - if ( ! empty( $data['gv-note-to'] ) ) { |
|
713 | + if ( ! empty( $data[ 'gv-note-to' ] ) ) { |
|
714 | 714 | |
715 | 715 | $default_data = array( |
716 | 716 | 'gv-note-to' => '', |
@@ -720,11 +720,11 @@ discard block |
||
720 | 720 | 'current-url' => '', |
721 | 721 | ); |
722 | 722 | |
723 | - $current_user = wp_get_current_user(); |
|
723 | + $current_user = wp_get_current_user(); |
|
724 | 724 | $email_data = wp_parse_args( $data, $default_data ); |
725 | 725 | |
726 | - $from = $current_user->user_email; |
|
727 | - $to = $email_data['gv-note-to']; |
|
726 | + $from = $current_user->user_email; |
|
727 | + $to = $email_data[ 'gv-note-to' ]; |
|
728 | 728 | |
729 | 729 | /** |
730 | 730 | * Documented in get_note_email_fields |
@@ -732,8 +732,8 @@ discard block |
||
732 | 732 | */ |
733 | 733 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); |
734 | 734 | |
735 | - if( 'custom' === $to && $include_custom ) { |
|
736 | - $to = $email_data['gv-note-to-custom']; |
|
735 | + if ( 'custom' === $to && $include_custom ) { |
|
736 | + $to = $email_data[ 'gv-note-to-custom' ]; |
|
737 | 737 | do_action( 'gravityview_log_debug', __METHOD__ . ': Sending note to a custom email address: ' . $to ); |
738 | 738 | } |
739 | 739 | |
@@ -744,13 +744,13 @@ discard block |
||
744 | 744 | |
745 | 745 | $bcc = false; |
746 | 746 | $reply_to = $from; |
747 | - $subject = trim( $email_data['gv-note-subject'] ); |
|
747 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); |
|
748 | 748 | |
749 | 749 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF |
750 | 750 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; |
751 | - $message = $email_data['gv-note-content']; |
|
751 | + $message = $email_data[ 'gv-note-content' ]; |
|
752 | 752 | $email_footer = self::strings( 'email-footer' ); |
753 | - $from_name = $current_user->display_name; |
|
753 | + $from_name = $current_user->display_name; |
|
754 | 754 | $message_format = 'html'; |
755 | 755 | |
756 | 756 | /** |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | |
782 | 782 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); |
783 | 783 | |
784 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); |
|
784 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); |
|
785 | 785 | |
786 | 786 | /** |
787 | 787 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | |
808 | 808 | $output = ''; |
809 | 809 | |
810 | - if( ! empty( $email_footer ) ) { |
|
810 | + if ( ! empty( $email_footer ) ) { |
|
811 | 811 | $url = rgar( $email_data, 'current-url' ); |
812 | 812 | $url = html_entity_decode( $url ); |
813 | 813 | $url = site_url( $url ); |