| @@ -49,7 +49,7 @@ | ||
| 49 | 49 | * | 
| 50 | 50 | * @param array $items Scripts or styles to exclude from no-conflict | 
| 51 | 51 | * | 
| 52 | - * @return array | |
| 52 | + * @return string[] | |
| 53 | 53 | */ | 
| 54 | 54 |  	public function register_noconflict( $items ) { | 
| 55 | 55 | |
| @@ -63,19 +63,19 @@ 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 | add_filter( 'gravityview/template/fields_template_paths', array( $this, 'add_template_path' ) ); | 
| 77 | 77 | |
| 78 | - add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts') ); | |
| 78 | + add_action( 'wp_enqueue_scripts', array( $this, 'register_scripts' ) ); | |
| 79 | 79 | add_action( 'gravityview/field/notes/scripts', array( $this, 'enqueue_scripts' ) ); | 
| 80 | 80 | |
| 81 | 81 | add_filter( 'gravityview_entry_default_fields', array( $this, 'add_entry_default_field' ), 10, 3 ); | 
| @@ -97,8 +97,8 @@ discard block | ||
| 97 | 97 | */ | 
| 98 | 98 |  	public function add_entry_default_field( $entry_default_fields, $form, $zone ) { | 
| 99 | 99 | |
| 100 | -		if( in_array( $zone, array( 'directory', 'single' ) ) ) { | |
| 101 | - $entry_default_fields['notes'] = array( | |
| 100 | +		if ( in_array( $zone, array( 'directory', 'single' ) ) ) { | |
| 101 | + $entry_default_fields[ 'notes' ] = array( | |
| 102 | 102 | 'label' => __( 'Entry Notes', 'gravityview' ), | 
| 103 | 103 | 'type' => 'notes', | 
| 104 | 104 | 'desc' => __( 'Display, add, and delete notes for an entry.', 'gravityview' ), | 
| @@ -131,23 +131,23 @@ discard block | ||
| 131 | 131 |  	public function enqueue_scripts() { | 
| 132 | 132 | global $wp_actions; | 
| 133 | 133 | |
| 134 | -		if( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { | |
| 134 | +		if ( ! wp_script_is( 'gravityview-notes', 'enqueued' ) ) { | |
| 135 | 135 | wp_enqueue_style( 'gravityview-notes' ); | 
| 136 | 136 | wp_enqueue_script( 'gravityview-notes' ); | 
| 137 | 137 | } | 
| 138 | 138 | |
| 139 | -		if( ! wp_script_is( 'gravityview-notes', 'done' ) ) { | |
| 139 | +		if ( ! wp_script_is( 'gravityview-notes', 'done' ) ) { | |
| 140 | 140 | |
| 141 | 141 | $strings = self::strings(); | 
| 142 | 142 | |
| 143 | 143 | wp_localize_script( 'gravityview-notes', 'GVNotes', array( | 
| 144 | 144 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), | 
| 145 | 145 | 'text' => array( | 
| 146 | - 'processing' => $strings['processing'], | |
| 147 | - 'delete_confirm' => $strings['delete-confirm'], | |
| 148 | - 'note_added' => $strings['added-note'], | |
| 149 | - 'error_invalid' => $strings['error-invalid'], | |
| 150 | - 'error_empty_note' => $strings['error-empty-note'], | |
| 146 | + 'processing' => $strings[ 'processing' ], | |
| 147 | + 'delete_confirm' => $strings[ 'delete-confirm' ], | |
| 148 | + 'note_added' => $strings[ 'added-note' ], | |
| 149 | + 'error_invalid' => $strings[ 'error-invalid' ], | |
| 150 | + 'error_empty_note' => $strings[ 'error-empty-note' ], | |
| 151 | 151 | ), | 
| 152 | 152 | ) ); | 
| 153 | 153 | } | 
| @@ -163,7 +163,7 @@ discard block | ||
| 163 | 163 | * @return void | 
| 164 | 164 | */ | 
| 165 | 165 |  	function maybe_add_note() { | 
| 166 | -		if ( ! isset( $_POST['action'] ) || 'gv_note_add' !== $_POST['action'] ) { | |
| 166 | +		if ( ! isset( $_POST[ 'action' ] ) || 'gv_note_add' !== $_POST[ 'action' ] ) { | |
| 167 | 167 | return; | 
| 168 | 168 | } | 
| 169 | 169 | |
| @@ -176,12 +176,12 @@ discard block | ||
| 176 | 176 | $post = wp_unslash( $_POST ); | 
| 177 | 177 | |
| 178 | 178 |  		if ( $this->doing_ajax ) { | 
| 179 | - parse_str( $post['data'], $data ); | |
| 179 | + parse_str( $post[ 'data' ], $data ); | |
| 180 | 180 |  		} else { | 
| 181 | 181 | $data = $post; | 
| 182 | 182 | } | 
| 183 | 183 | |
| 184 | - $this->process_add_note( (array) $data ); | |
| 184 | + $this->process_add_note( (array)$data ); | |
| 185 | 185 | } | 
| 186 | 186 | |
| 187 | 187 | /** | 
| @@ -207,23 +207,23 @@ discard block | ||
| 207 | 207 | $error = false; | 
| 208 | 208 | $success = false; | 
| 209 | 209 | |
| 210 | -		if( empty( $data['entry-slug'] ) ) { | |
| 210 | +		if ( empty( $data[ 'entry-slug' ] ) ) { | |
| 211 | 211 | |
| 212 | -			$error = self::strings('error-invalid'); | |
| 212 | + $error = self::strings( 'error-invalid' ); | |
| 213 | 213 | gravityview()->log->error( 'The note is missing an Entry ID.' ); | 
| 214 | 214 | |
| 215 | 215 |  		} else { | 
| 216 | 216 | |
| 217 | - $valid = wp_verify_nonce( $data['gv_note_add'], 'gv_note_add_' . $data['entry-slug'] ); | |
| 217 | + $valid = wp_verify_nonce( $data[ 'gv_note_add' ], 'gv_note_add_' . $data[ 'entry-slug' ] ); | |
| 218 | 218 | |
| 219 | 219 | $has_cap = GVCommon::has_cap( 'gravityview_add_entry_notes' ); | 
| 220 | 220 | |
| 221 | -			if( ! $has_cap ) { | |
| 221 | +			if ( ! $has_cap ) { | |
| 222 | 222 | $error = self::strings( 'error-cap-add' ); | 
| 223 | 223 | gravityview()->log->error( 'Adding a note failed: the user does not have the "gravityview_add_entry_notes" capability.' ); | 
| 224 | 224 |  			} elseif ( $valid ) { | 
| 225 | 225 | |
| 226 | - $entry = gravityview_get_entry( $data['entry-slug'], true, false ); | |
| 226 | + $entry = gravityview_get_entry( $data[ 'entry-slug' ], true, false ); | |
| 227 | 227 | |
| 228 | 228 | $added = $this->add_note( $entry, $data ); | 
| 229 | 229 | |
| @@ -241,22 +241,22 @@ discard block | ||
| 241 | 241 | $this->maybe_send_entry_notes( $note, $entry, $data ); | 
| 242 | 242 | |
| 243 | 243 |  					if ( $note ) { | 
| 244 | - $success = self::display_note( $note, ! empty( $data['show-delete'] ) ); | |
| 244 | + $success = self::display_note( $note, ! empty( $data[ 'show-delete' ] ) ); | |
| 245 | 245 | gravityview()->log->debug( 'The note was successfully created', array( 'data' => compact( 'note', 'data' ) ) ); | 
| 246 | 246 |  					} else { | 
| 247 | -						$error = self::strings('error-add-note'); | |
| 247 | + $error = self::strings( 'error-add-note' ); | |
| 248 | 248 | gravityview()->log->error( 'The note was not successfully created', array( 'data' => compact( 'note', 'data' ) ) ); | 
| 249 | 249 | } | 
| 250 | 250 | } | 
| 251 | 251 |  			} else { | 
| 252 | -				$error = self::strings('error-invalid'); | |
| 252 | + $error = self::strings( 'error-invalid' ); | |
| 253 | 253 | gravityview()->log->error( 'Nonce validation failed; the note was not created' ); | 
| 254 | 254 | } | 
| 255 | 255 | } | 
| 256 | 256 | |
| 257 | 257 | |
| 258 | -		if( $this->doing_ajax ) { | |
| 259 | -			if( $success ) { | |
| 258 | +		if ( $this->doing_ajax ) { | |
| 259 | +			if ( $success ) { | |
| 260 | 260 | wp_send_json_success( array( 'html' => $success ) ); | 
| 261 | 261 |  			} else { | 
| 262 | 262 | $error = $error ? $error : self::strings( 'error-invalid' ); | 
| @@ -282,11 +282,11 @@ discard block | ||
| 282 | 282 | return; | 
| 283 | 283 | } | 
| 284 | 284 | |
| 285 | -		if ( isset( $_POST['action'] ) && 'gv_delete_notes' === $_POST['action'] ) { | |
| 285 | +		if ( isset( $_POST[ 'action' ] ) && 'gv_delete_notes' === $_POST[ 'action' ] ) { | |
| 286 | 286 | |
| 287 | 287 | $post = wp_unslash( $_POST ); | 
| 288 | 288 |  			if ( $this->doing_ajax ) { | 
| 289 | - parse_str( $post['data'], $data ); | |
| 289 | + parse_str( $post[ 'data' ], $data ); | |
| 290 | 290 |  			} else { | 
| 291 | 291 | $data = $post; | 
| 292 | 292 | } | 
| @@ -317,18 +317,18 @@ discard block | ||
| 317 | 317 | */ | 
| 318 | 318 |  	function process_delete_notes( $data ) { | 
| 319 | 319 | |
| 320 | - $valid = wp_verify_nonce( $data['gv_delete_notes'], 'gv_delete_notes_' . $data['entry-slug'] ); | |
| 320 | + $valid = wp_verify_nonce( $data[ 'gv_delete_notes' ], 'gv_delete_notes_' . $data[ 'entry-slug' ] ); | |
| 321 | 321 | $has_cap = GVCommon::has_cap( 'gravityview_delete_entry_notes' ); | 
| 322 | 322 | $success = false; | 
| 323 | 323 | |
| 324 | 324 |  		if ( $valid && $has_cap ) { | 
| 325 | - GravityView_Entry_Notes::delete_notes( $data['note'] ); | |
| 325 | + GravityView_Entry_Notes::delete_notes( $data[ 'note' ] ); | |
| 326 | 326 | $success = true; | 
| 327 | 327 | } | 
| 328 | 328 | |
| 329 | -		if( $this->doing_ajax ) { | |
| 329 | +		if ( $this->doing_ajax ) { | |
| 330 | 330 | |
| 331 | -			if( $success ) { | |
| 331 | +			if ( $success ) { | |
| 332 | 332 | wp_send_json_success(); | 
| 333 | 333 |  			} else { | 
| 334 | 334 |  				if ( ! $valid ) { | 
| @@ -361,13 +361,13 @@ discard block | ||
| 361 | 361 | |
| 362 | 362 |  	public function field_options( $field_options, $template_id, $field_id, $context, $input_type, $form_id ) { | 
| 363 | 363 | |
| 364 | - unset( $field_options['show_as_link'] ); | |
| 364 | + unset( $field_options[ 'show_as_link' ] ); | |
| 365 | 365 | |
| 366 | 366 | $notes_options = array( | 
| 367 | 367 | 'notes' => array( | 
| 368 | 368 | 'type' => 'checkboxes', | 
| 369 | -				'label' => __('Note Settings', 'gravityview'), | |
| 370 | -				'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 | + 'label' => __( 'Note Settings', 'gravityview' ), | |
| 370 | + '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 | 371 | 'options' => array( | 
| 372 | 372 | 'view' => array( | 
| 373 | 373 | 'label' => __( 'Display notes?', 'gravityview' ), | 
| @@ -419,7 +419,7 @@ discard block | ||
| 419 | 419 | 'processing' => __( 'Processing…', 'gravityview' ), | 
| 420 | 420 | 'other-email' => __( 'Other email address', 'gravityview' ), | 
| 421 | 421 | 'email-label' => __( 'Email address', 'gravityview' ), | 
| 422 | -			'email-placeholder' => _x('[email protected]', 'Example email address used as a placeholder', 'gravityview'), | |
| 422 | + 'email-placeholder' => _x( '[email protected]', 'Example email address used as a placeholder', 'gravityview' ), | |
| 423 | 423 | 'subject-label' => __( 'Subject', 'gravityview' ), | 
| 424 | 424 | 'subject' => __( 'Email subject', 'gravityview' ), | 
| 425 | 425 | 'default-email-subject' => __( 'New entry note', 'gravityview' ), | 
| @@ -439,7 +439,7 @@ discard block | ||
| 439 | 439 | */ | 
| 440 | 440 | $strings = gv_map_deep( apply_filters( 'gravityview/field/notes/strings', $strings ), 'esc_html' ); | 
| 441 | 441 | |
| 442 | -		if( $key ) { | |
| 442 | +		if ( $key ) { | |
| 443 | 443 | return isset( $strings[ $key ] ) ? $strings[ $key ] : ''; | 
| 444 | 444 | } | 
| 445 | 445 | |
| @@ -461,7 +461,7 @@ discard block | ||
| 461 | 461 | */ | 
| 462 | 462 |  	static public function display_note( $note, $show_delete = false, $context = null ) { | 
| 463 | 463 | |
| 464 | -		if( ! is_object( $note ) ) { | |
| 464 | +		if ( ! is_object( $note ) ) { | |
| 465 | 465 | return ''; | 
| 466 | 466 | } | 
| 467 | 467 | |
| @@ -516,7 +516,7 @@ discard block | ||
| 516 | 516 | } | 
| 517 | 517 | |
| 518 | 518 | $replacements = array( | 
| 519 | -			'{note_id}' => $note_content['note_id'], | |
| 519 | +			'{note_id}' => $note_content[ 'note_id' ], | |
| 520 | 520 |  			'{row_class}' => 'gv-note', | 
| 521 | 521 |  			'{note_detail}' => $note_detail_html | 
| 522 | 522 | ); | 
| @@ -548,13 +548,13 @@ discard block | ||
| 548 | 548 | |
| 549 | 549 | $user_data = get_userdata( $current_user->ID ); | 
| 550 | 550 | |
| 551 | - $note_content = trim( $data['gv-note-content'] ); | |
| 551 | + $note_content = trim( $data[ 'gv-note-content' ] ); | |
| 552 | 552 | |
| 553 | -		if( empty( $note_content ) ) { | |
| 553 | +		if ( empty( $note_content ) ) { | |
| 554 | 554 | return new WP_Error( 'gv-add-note-empty', __( 'The note is empty.', 'gravityview' ) ); | 
| 555 | 555 | } | 
| 556 | 556 | |
| 557 | - $return = GravityView_Entry_Notes::add_note( $entry['id'], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); | |
| 557 | + $return = GravityView_Entry_Notes::add_note( $entry[ 'id' ], $user_data->ID, $user_data->display_name, $note_content, 'gravityview/field/notes' ); | |
| 558 | 558 | |
| 559 | 559 | return $return; | 
| 560 | 560 | } | 
| @@ -574,7 +574,7 @@ discard block | ||
| 574 | 574 | |
| 575 | 575 | $atts = shortcode_atts( array( 'entry' => null ), $atts ); | 
| 576 | 576 | |
| 577 | -		if( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { | |
| 577 | +		if ( ! GVCommon::has_cap( 'gravityview_add_entry_notes' ) ) { | |
| 578 | 578 |  			gravityview()->log->error( 'User does not have permission to add entry notes ("gravityview_add_entry_notes").' ); | 
| 579 | 579 | return ''; | 
| 580 | 580 | } | 
| @@ -596,8 +596,8 @@ discard block | ||
| 596 | 596 | |
| 597 | 597 | $visibility_settings = $gravityview_view->getCurrentFieldSetting( 'notes' ); | 
| 598 | 598 | |
| 599 | -			if ( $atts['entry'] ) { | |
| 600 | - $entry = GFAPI::get_entry( $atts['entry'] ); | |
| 599 | +			if ( $atts[ 'entry' ] ) { | |
| 600 | + $entry = GFAPI::get_entry( $atts[ 'entry' ] ); | |
| 601 | 601 | } | 
| 602 | 602 | |
| 603 | 603 |  			if ( ! isset( $entry ) || ! $entry ) { | 
| @@ -615,14 +615,14 @@ discard block | ||
| 615 | 615 | |
| 616 | 616 | // Only generate the dropdown if the field settings allow it | 
| 617 | 617 | $email_fields = ''; | 
| 618 | -		if( ! empty( $visibility_settings['email'] ) ) { | |
| 618 | +		if ( ! empty( $visibility_settings[ 'email' ] ) ) { | |
| 619 | 619 | $email_fields = self::get_note_email_fields( $entry_slug ); | 
| 620 | 620 | } | 
| 621 | 621 | |
| 622 | 622 |  		$add_note_html = str_replace( '{entry_slug}', $entry_slug, $add_note_html ); | 
| 623 | 623 |  		$add_note_html = str_replace( '{nonce_field}', $nonce_field, $add_note_html ); | 
| 624 | -		$add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings['delete'] ) ? 0 : $visibility_settings['delete'] ), $add_note_html ); | |
| 625 | -		$add_note_html   = str_replace( '{email_fields}', $email_fields, $add_note_html ); | |
| 624 | +		$add_note_html = str_replace( '{show_delete}', intval( empty( $visibility_settings[ 'delete' ] ) ? 0 : $visibility_settings[ 'delete' ] ), $add_note_html ); | |
| 625 | +		$add_note_html = str_replace( '{email_fields}', $email_fields, $add_note_html ); | |
| 626 | 626 |  		$add_note_html = str_replace( '{url}', esc_url_raw( add_query_arg( array() ) ), $add_note_html ); | 
| 627 | 627 | |
| 628 | 628 | return $add_note_html; | 
| @@ -647,8 +647,8 @@ discard block | ||
| 647 | 647 | $note_emails = array(); | 
| 648 | 648 | |
| 649 | 649 |  		foreach ( $email_fields as $email_field ) { | 
| 650 | -			if ( ! empty( $entry["{$email_field->id}"] ) && is_email( $entry["{$email_field->id}"] ) ) { | |
| 651 | -				$note_emails[] = $entry["{$email_field->id}"]; | |
| 650 | +			if ( ! empty( $entry[ "{$email_field->id}" ] ) && is_email( $entry[ "{$email_field->id}" ] ) ) { | |
| 651 | +				$note_emails[ ] = $entry[ "{$email_field->id}" ]; | |
| 652 | 652 | } | 
| 653 | 653 | } | 
| 654 | 654 | |
| @@ -660,7 +660,7 @@ discard block | ||
| 660 | 660 | */ | 
| 661 | 661 | $note_emails = apply_filters( 'gravityview/field/notes/emails', $note_emails, $entry ); | 
| 662 | 662 | |
| 663 | - return (array) $note_emails; | |
| 663 | + return (array)$note_emails; | |
| 664 | 664 | } | 
| 665 | 665 | |
| 666 | 666 | /** | 
| @@ -676,7 +676,7 @@ discard block | ||
| 676 | 676 | */ | 
| 677 | 677 |  	private static function get_note_email_fields( $entry_slug = '' ) { | 
| 678 | 678 | |
| 679 | -		if( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { | |
| 679 | +		if ( ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { | |
| 680 | 680 |  			gravityview()->log->error( 'User does not have permission to email entry notes ("gravityview_email_entry_notes").' ); | 
| 681 | 681 | return ''; | 
| 682 | 682 | } | 
| @@ -698,27 +698,27 @@ discard block | ||
| 698 | 698 | |
| 699 | 699 |  		if ( ! empty( $note_emails ) || $include_custom ) { ?> | 
| 700 | 700 | <div class="gv-note-email-container"> | 
| 701 | - <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings['also-email']; ?></label> | |
| 701 | + <label for="gv-note-email-to-<?php echo $entry_slug_esc; ?>" class="screen-reader-text"><?php echo $strings[ 'also-email' ]; ?></label> | |
| 702 | 702 | <select class="gv-note-email-to" name="gv-note-to" id="gv-note-email-to-<?php echo $entry_slug_esc; ?>"> | 
| 703 | - <option value=""><?php echo $strings['also-email']; ?></option> | |
| 703 | + <option value=""><?php echo $strings[ 'also-email' ]; ?></option> | |
| 704 | 704 |  					<?php foreach ( $note_emails as  $email ) { | 
| 705 | 705 | ?> | 
| 706 | 706 | <option value="<?php echo esc_attr( $email ); ?>"><?php echo esc_html( $email ); ?></option> | 
| 707 | 707 | <?php } | 
| 708 | -					if( $include_custom ) { ?> | |
| 709 | -					<option value="custom"><?php echo self::strings('other-email'); ?></option> | |
| 708 | +					if ( $include_custom ) { ?> | |
| 709 | + <option value="custom"><?php echo self::strings( 'other-email' ); ?></option> | |
| 710 | 710 | <?php } ?> | 
| 711 | 711 | </select> | 
| 712 | 712 | <fieldset class="gv-note-to-container"> | 
| 713 | -					<?php if( $include_custom ) { ?> | |
| 713 | +					<?php if ( $include_custom ) { ?> | |
| 714 | 714 | <div class='gv-note-to-custom-container'> | 
| 715 | - <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings['email-label']; ?></label> | |
| 716 | - <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="" /> | |
| 715 | + <label for="gv-note-email-to-custom-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'email-label' ]; ?></label> | |
| 716 | + <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="" /> | |
| 717 | 717 | </div> | 
| 718 | 718 | <?php } ?> | 
| 719 | 719 | <div class='gv-note-subject-container'> | 
| 720 | - <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings['subject-label']; ?></label> | |
| 721 | - <input type="text" name="gv-note-subject" placeholder="<?php echo $strings['subject']; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> | |
| 720 | + <label for="gv-note-subject-<?php echo $entry_slug_esc; ?>"><?php echo $strings[ 'subject-label' ]; ?></label> | |
| 721 | + <input type="text" name="gv-note-subject" placeholder="<?php echo $strings[ 'subject' ]; ?>" id="gv-note-subject-<?php echo $entry_slug_esc; ?>" value="" /> | |
| 722 | 722 | </div> | 
| 723 | 723 | </fieldset> | 
| 724 | 724 | </div> | 
| @@ -741,7 +741,7 @@ discard block | ||
| 741 | 741 | */ | 
| 742 | 742 |  	private function maybe_send_entry_notes( $note = false, $entry, $data ) { | 
| 743 | 743 | |
| 744 | -		if( ! $note || ! GVCommon::has_cap('gravityview_email_entry_notes') ) { | |
| 744 | +		if ( ! $note || ! GVCommon::has_cap( 'gravityview_email_entry_notes' ) ) { | |
| 745 | 745 | gravityview()->log->debug( 'User doesn\'t have "gravityview_email_entry_notes" cap, or $note is empty', array( 'data' => $note ) ); | 
| 746 | 746 | return; | 
| 747 | 747 | } | 
| @@ -749,7 +749,7 @@ discard block | ||
| 749 | 749 | gravityview()->log->debug( '$data', array( 'data' => $data ) ); | 
| 750 | 750 | |
| 751 | 751 | //emailing notes if configured | 
| 752 | -		if ( ! empty( $data['gv-note-to'] ) ) { | |
| 752 | +		if ( ! empty( $data[ 'gv-note-to' ] ) ) { | |
| 753 | 753 | |
| 754 | 754 | $default_data = array( | 
| 755 | 755 | 'gv-note-to' => '', | 
| @@ -759,11 +759,11 @@ discard block | ||
| 759 | 759 | 'current-url' => '', | 
| 760 | 760 | ); | 
| 761 | 761 | |
| 762 | - $current_user = wp_get_current_user(); | |
| 762 | + $current_user = wp_get_current_user(); | |
| 763 | 763 | $email_data = wp_parse_args( $data, $default_data ); | 
| 764 | 764 | |
| 765 | - $from = $current_user->user_email; | |
| 766 | - $to = $email_data['gv-note-to']; | |
| 765 | + $from = $current_user->user_email; | |
| 766 | + $to = $email_data[ 'gv-note-to' ]; | |
| 767 | 767 | |
| 768 | 768 | /** | 
| 769 | 769 | * Documented in get_note_email_fields | 
| @@ -771,8 +771,8 @@ discard block | ||
| 771 | 771 | */ | 
| 772 | 772 | $include_custom = apply_filters( 'gravityview/field/notes/custom-email', true ); | 
| 773 | 773 | |
| 774 | -			if( 'custom' === $to && $include_custom ) { | |
| 775 | - $to = $email_data['gv-note-to-custom']; | |
| 774 | +			if ( 'custom' === $to && $include_custom ) { | |
| 775 | + $to = $email_data[ 'gv-note-to-custom' ]; | |
| 776 | 776 |  				gravityview()->log->debug( 'Sending note to a custom email address: {to}' . array( 'to' => $to ) ); | 
| 777 | 777 | } | 
| 778 | 778 | |
| @@ -783,13 +783,13 @@ discard block | ||
| 783 | 783 | |
| 784 | 784 | $bcc = false; | 
| 785 | 785 | $reply_to = $from; | 
| 786 | - $subject = trim( $email_data['gv-note-subject'] ); | |
| 786 | + $subject = trim( $email_data[ 'gv-note-subject' ] ); | |
| 787 | 787 | |
| 788 | 788 | // We use empty() here because GF uses empty to check against, too. `0` isn't a valid subject to GF | 
| 789 | 789 | $subject = empty( $subject ) ? self::strings( 'default-email-subject' ) : $subject; | 
| 790 | - $message = $email_data['gv-note-content']; | |
| 790 | + $message = $email_data[ 'gv-note-content' ]; | |
| 791 | 791 | $email_footer = self::strings( 'email-footer' ); | 
| 792 | - $from_name = $current_user->display_name; | |
| 792 | + $from_name = $current_user->display_name; | |
| 793 | 793 | $message_format = 'html'; | 
| 794 | 794 | |
| 795 | 795 | /** | 
| @@ -820,7 +820,7 @@ discard block | ||
| 820 | 820 | |
| 821 | 821 | GVCommon::send_email( $from, $to, $bcc, $reply_to, $subject, $message, $from_name, $message_format, '', $entry, false ); | 
| 822 | 822 | |
| 823 | - $form = isset( $entry['form_id'] ) ? GFAPI::get_form( $entry['form_id'] ) : array(); | |
| 823 | + $form = isset( $entry[ 'form_id' ] ) ? GFAPI::get_form( $entry[ 'form_id' ] ) : array(); | |
| 824 | 824 | |
| 825 | 825 | /** | 
| 826 | 826 | * @see https://www.gravityhelp.com/documentation/article/10146-2/ It's here for compatibility with Gravity Forms | 
| @@ -846,7 +846,7 @@ discard block | ||
| 846 | 846 | |
| 847 | 847 | $output = ''; | 
| 848 | 848 | |
| 849 | -		if( ! empty( $email_footer ) ) { | |
| 849 | +		if ( ! empty( $email_footer ) ) { | |
| 850 | 850 | $url = \GV\Utils::get( $email_data, 'current-url' ); | 
| 851 | 851 | $url = html_entity_decode( $url ); | 
| 852 | 852 | $url = site_url( $url ); | 
| @@ -33,7 +33,7 @@ | ||
| 33 | 33 | } | 
| 34 | 34 | |
| 35 | 35 |  		if ( 'single' === $context ) { | 
| 36 | - unset( $field_options['new_window'] ); | |
| 36 | + unset( $field_options[ 'new_window' ] ); | |
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 | return $field_options; |