@@ -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 | */ |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * |
269 | 269 | * Verify permissions. Check expected $_POST. Parse args, then send to process_delete_notes |
270 | 270 | * |
271 | - * @since 1.17 |
|
271 | + * @since 1.17 |
|
272 | 272 | * |
273 | 273 | * @see process_delete_notes |
274 | 274 | * |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | 'subject-label' => __( 'Subject', 'gravityview' ), |
422 | 422 | 'subject' => __( 'Email subject', 'gravityview' ), |
423 | 423 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), |
424 | - 'email-footer' => __( 'This note was sent from {url}', 'gravityview' ), |
|
424 | + 'email-footer' => __( 'This note was sent from {url}', 'gravityview' ), |
|
425 | 425 | 'also-email' => __( 'Also email this note to', 'gravityview' ), |
426 | 426 | 'error-add-note' => __( 'There was an error adding the note.', 'gravityview' ), |
427 | 427 | 'error-invalid' => __( 'The request was invalid. Refresh the page and try again.', 'gravityview' ), |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | 'gv-note-to-custom' => '', |
711 | 711 | 'gv-note-subject' => '', |
712 | 712 | 'gv-note-content' => '', |
713 | - 'current-url' => '', |
|
713 | + 'current-url' => '', |
|
714 | 714 | ); |
715 | 715 | |
716 | 716 | $current_user = wp_get_current_user(); |
@@ -762,9 +762,9 @@ discard block |
||
762 | 762 | $message .= $this->get_email_footer( $email_footer, $is_html, $email_data ); |
763 | 763 | |
764 | 764 | /** |
765 | - * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format |
|
765 | + * @filter `gravityview/field/notes/wpautop_email` Should the message content have paragraphs added automatically, if using HTML message format |
|
766 | 766 | * @since 1.18 |
767 | - * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true) |
|
767 | + * @param bool $wpautop_email True: Apply wpautop() to the email message if using; False: Leave as entered (Default: true) |
|
768 | 768 | */ |
769 | 769 | $wpautop_email = apply_filters( 'gravityview/field/notes/wpautop_email', true ); |
770 | 770 | |
@@ -784,12 +784,12 @@ discard block |
||
784 | 784 | } |
785 | 785 | |
786 | 786 | /** |
787 | - * Get the footer for Entry Note emails |
|
788 | - * |
|
789 | - * `{url}` is replaced by the URL of the page where the note form was embedded |
|
790 | - * |
|
791 | - * @since 1.18 |
|
792 | - * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer' |
|
787 | + * Get the footer for Entry Note emails |
|
788 | + * |
|
789 | + * `{url}` is replaced by the URL of the page where the note form was embedded |
|
790 | + * |
|
791 | + * @since 1.18 |
|
792 | + * @see GravityView_Field_Notes::strings The default value of $message_footer is set here, with the key 'email-footer' |
|
793 | 793 | * |
794 | 794 | * @param string $email_footer The message footer value |
795 | 795 | * @param bool $is_html True: Email is being sent as HTML; False: sent as text |
@@ -798,10 +798,10 @@ discard block |
||
798 | 798 | */ |
799 | 799 | private function get_email_footer( $email_footer = '', $is_html = true, $email_data = array() ) { |
800 | 800 | |
801 | - $output = ''; |
|
801 | + $output = ''; |
|
802 | 802 | |
803 | 803 | if( ! empty( $email_footer ) ) { |
804 | - $url = rgar( $email_data, 'current-url' ); |
|
804 | + $url = rgar( $email_data, 'current-url' ); |
|
805 | 805 | $url = html_entity_decode( $url ); |
806 | 806 | $url = site_url( $url ); |
807 | 807 |
@@ -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( ! 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( ! isset( $_POST['action'] ) ) { |
|
171 | + if ( ! isset( $_POST[ 'action' ] ) ) { |
|
172 | 172 | return; |
173 | 173 | } |
174 | 174 | |
175 | - if( 'gv_note_add' === $_POST['action'] ) { |
|
175 | + if ( 'gv_note_add' === $_POST[ 'action' ] ) { |
|
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 ); |
@@ -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 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $gv_modifiers = array( |
54 | 54 | 'maxwords:(\d+)' => 'modifier_maxwords', /** @see modifier_maxwords */ |
55 | 55 | 'wpautop' => 'modifier_wpautop', /** @see modifier_wpautop */ |
56 | - 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
56 | + 'timestamp' => 'modifier_timestamp', /** @see modifier_timestamp */ |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | $return = $value; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | |
254 | 254 | $atts = array( |
255 | 255 | 'format' => self::get_format_from_modifiers( $exploded, false ), |
256 | - 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
256 | + 'human' => in_array( 'human', $exploded ), // {date_created:human} |
|
257 | 257 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
258 | 258 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
259 | 259 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
@@ -216,7 +216,7 @@ |
||
216 | 216 | * @param bool $url_encode Whether to URL-encode output |
217 | 217 | * @param bool $esc_html Whether to apply `esc_html()` to output |
218 | 218 | * |
219 | - * @return mixed |
|
219 | + * @return string |
|
220 | 220 | */ |
221 | 221 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
222 | 222 |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public static function process_modifiers( $value, $merge_tag, $modifier, $field, $raw_value ) { |
46 | 46 | |
47 | 47 | // No modifier was set or the raw value was empty |
48 | - if( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
48 | + if ( 'all_fields' === $merge_tag || '' === $modifier || ! is_string( $raw_value ) || '' === $raw_value ) { |
|
49 | 49 | return $value; |
50 | 50 | } |
51 | 51 | |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | foreach ( $gv_modifiers as $gv_modifier => $method ) { |
62 | 62 | |
63 | 63 | // Only match the regex if it's the first modifer; this allows us to enforce our own modifier structure |
64 | - preg_match( '/^' . $gv_modifier .'/ism', $modifier, $matches ); |
|
64 | + preg_match( '/^' . $gv_modifier . '/ism', $modifier, $matches ); |
|
65 | 65 | |
66 | - if( ! empty( $matches ) ) { |
|
66 | + if ( ! empty( $matches ) ) { |
|
67 | 67 | // The called method is passed the raw value and the full matches array |
68 | 68 | $return = self::$method( $raw_value, $matches ); |
69 | 69 | break; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | */ |
88 | 88 | private static function modifier_timestamp( $raw_value, $matches ) { |
89 | 89 | |
90 | - if( empty( $matches[0] ) ) { |
|
90 | + if ( empty( $matches[ 0 ] ) ) { |
|
91 | 91 | return $raw_value; |
92 | 92 | } |
93 | 93 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private static function modifier_wpautop( $raw_value, $matches ) { |
113 | 113 | |
114 | - if( empty( $matches[0] ) || ! function_exists( 'wpautop' ) ) { |
|
114 | + if ( empty( $matches[ 0 ] ) || ! function_exists( 'wpautop' ) ) { |
|
115 | 115 | return $raw_value; |
116 | 116 | } |
117 | 117 | |
@@ -135,11 +135,11 @@ discard block |
||
135 | 135 | */ |
136 | 136 | private static function modifier_maxwords( $raw_value, $matches ) { |
137 | 137 | |
138 | - if( ! is_string( $raw_value ) || empty( $matches[1] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
138 | + if ( ! is_string( $raw_value ) || empty( $matches[ 1 ] ) || ! function_exists( 'wp_trim_words' ) ) { |
|
139 | 139 | return $raw_value; |
140 | 140 | } |
141 | 141 | |
142 | - $max = intval( $matches[1] ); |
|
142 | + $max = intval( $matches[ 1 ] ); |
|
143 | 143 | |
144 | 144 | $more_placeholder = '[GVMORE]'; |
145 | 145 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @param bool $esc_html Pass return value through `esc_html()` |
172 | 172 | * @return string Text with variables maybe replaced |
173 | 173 | */ |
174 | - public static function replace_variables($text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
174 | + public static function replace_variables( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = true ) { |
|
175 | 175 | |
176 | 176 | /** |
177 | 177 | * @filter `gravityview_do_replace_variables` Turn off merge tag variable replacements.\n |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | * @internal Fixed $form['title'] in Gravity Forms |
197 | 197 | * @see https://github.com/gravityforms/gravityforms/pull/27/files |
198 | 198 | */ |
199 | - $form['title'] = isset( $form['title'] ) ? $form['title'] : ''; |
|
200 | - $form['id'] = isset( $form['id'] ) ? $form['id'] : ''; |
|
201 | - $form['fields'] = isset( $form['fields'] ) ? $form['fields'] : array(); |
|
199 | + $form[ 'title' ] = isset( $form[ 'title' ] ) ? $form[ 'title' ] : ''; |
|
200 | + $form[ 'id' ] = isset( $form[ 'id' ] ) ? $form[ 'id' ] : ''; |
|
201 | + $form[ 'fields' ] = isset( $form[ 'fields' ] ) ? $form[ 'fields' ] : array(); |
|
202 | 202 | |
203 | 203 | return GFCommon::replace_variables( $text, $form, $entry, $url_encode, $esc_html ); |
204 | 204 | } |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | */ |
221 | 221 | public static function replace_gv_merge_tags( $text, $form = array(), $entry = array(), $url_encode = false, $esc_html = false ) { |
222 | 222 | |
223 | - if( '' === $text ) { |
|
223 | + if ( '' === $text ) { |
|
224 | 224 | return $text; |
225 | 225 | } |
226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | * @see GFCommon::replace_variables_prepopulate() |
231 | 231 | * @todo Remove eventually: Gravity Forms fixed this issue in 1.9.14 |
232 | 232 | */ |
233 | - if( false === $form ) { |
|
233 | + if ( false === $form ) { |
|
234 | 234 | return $text; |
235 | 235 | } |
236 | 236 | |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'diff' => in_array( 'diff', $exploded ), // {date_created:diff} |
265 | 265 | 'raw' => in_array( 'raw', $exploded ), // {date_created:raw} |
266 | 266 | 'timestamp' => in_array( 'timestamp', $exploded ), // {date_created:timestamp} |
267 | - 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
267 | + 'time' => in_array( 'time', $exploded ), // {date_created:time} |
|
268 | 268 | ); |
269 | 269 | |
270 | 270 | $formatted_date = GVCommon::format_date( $date_created, $atts ); |
@@ -341,8 +341,8 @@ discard block |
||
341 | 341 | return $original_text; |
342 | 342 | } |
343 | 343 | |
344 | - foreach ( (array) $matches as $match ) { |
|
345 | - $full_tag = $match[0]; |
|
344 | + foreach ( (array)$matches as $match ) { |
|
345 | + $full_tag = $match[ 0 ]; |
|
346 | 346 | $modifier = rgar( $match, 2, 'permalink' ); |
347 | 347 | |
348 | 348 | $replacement = false; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $replacement = esc_html( $replacement ); |
361 | 361 | } |
362 | 362 | |
363 | - if( $url_encode ) { |
|
363 | + if ( $url_encode ) { |
|
364 | 364 | $replacement = urlencode( $replacement ); |
365 | 365 | } |
366 | 366 | |
@@ -400,14 +400,14 @@ discard block |
||
400 | 400 | preg_match_all( "/{get:(.*?)}/ism", $text, $matches, PREG_SET_ORDER ); |
401 | 401 | |
402 | 402 | // If there are no matches OR the Entry `created_by` isn't set or is 0 (no user) |
403 | - if( empty( $matches ) ) { |
|
403 | + if ( empty( $matches ) ) { |
|
404 | 404 | return $text; |
405 | 405 | } |
406 | 406 | |
407 | 407 | foreach ( $matches as $match ) { |
408 | 408 | |
409 | - $full_tag = $match[0]; |
|
410 | - $property = $match[1]; |
|
409 | + $full_tag = $match[ 0 ]; |
|
410 | + $property = $match[ 1 ]; |
|
411 | 411 | |
412 | 412 | $value = stripslashes_deep( rgget( $property ) ); |
413 | 413 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @since 1.15 |
432 | 432 | * @param bool $esc_html Whether to esc_html() the value. Default: `true` |
433 | 433 | */ |
434 | - $esc_html = apply_filters('gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
434 | + $esc_html = apply_filters( 'gravityview/merge_tags/get/esc_html/' . $property, true ); |
|
435 | 435 | |
436 | 436 | $value = $esc_html ? esc_html( $value ) : $value; |
437 | 437 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @param[in] array $form Gravity Forms form array |
443 | 443 | * @param[in] array $entry Entry array |
444 | 444 | */ |
445 | - $value = apply_filters('gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
445 | + $value = apply_filters( 'gravityview/merge_tags/get/value/' . $property, $value, $text, $form, $entry ); |
|
446 | 446 | |
447 | 447 | $text = str_replace( $full_tag, $value, $text ); |
448 | 448 | } |