← All changes
|
includes/admin/views/html-contact-viewings-meta-box.php
+24
-1
2.2.2
→
2.4.0
View file →
| @@ -2,8 +2,9 @@ | ||
| 2 | 2 | if ( ! defined( 'ABSPATH' ) ) { |
| 3 | 3 | exit; |
| 4 | 4 | } |
| 5 | 5 | |
| 6 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 6 | 7 | $meta_query = array( |
| 7 | 8 | array( |
| 8 | 9 | 'key' => '_applicant_contact_id', |
| 9 | 10 | 'value' => $post_id |
| @@ -11,23 +12,30 @@ | ||
| 11 | 12 | ); |
| 12 | 13 | |
| 13 | 14 | if ( isset($selected_status) && !empty($selected_status) ) |
| 14 | 15 | { |
| 16 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 15 | 17 | $meta_query = add_viewing_status_meta_query( $meta_query, $selected_status ); |
| 16 | 18 | } |
| 17 | 19 | |
| 20 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 18 | 21 | $args = array( |
| 19 | 22 | 'post_type' => 'viewing', |
| 20 | 23 | 'nopaging' => true, |
| 21 | 24 | 'orderby' => 'meta_value', |
| 22 | 25 | 'order' => 'DESC', |
| 26 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key -- The CRM grid orders all linked records by their stored event date; keep metadata ordering for existing display and export parity. | |
| 23 | 27 | 'meta_key' => '_start_date_time', |
| 24 | 28 | 'post_status' => 'publish', |
| 29 | + // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Required relationship/status metadata restricts this grid to the selected contact; retain existing result and status-filter semantics. | |
| 25 | 30 | 'meta_query' => $meta_query, |
| 26 | 31 | ); |
| 32 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 27 | 33 | $viewings_query = new WP_Query( $args ); |
| 34 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 28 | 35 | $viewings_count = $viewings_query->found_posts; |
| 29 | 36 | |
| 37 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 30 | 38 | $columns = array( |
| 31 | 39 | 'date_time' => __( 'Date', 'propertyhive' ) . ' / ' . __( 'Time', 'propertyhive' ), |
| 32 | 40 | 'property' => __( 'Property', 'propertyhive' ), |
| 33 | 41 | 'negotiators' => __( 'Attending Negotiator(s)', 'propertyhive' ), |
| @@ -33,8 +41,9 @@ | ||
| 33 | 41 | 'negotiators' => __( 'Attending Negotiator(s)', 'propertyhive' ), |
| 34 | 42 | 'status' => __( 'Status', 'propertyhive' ), |
| 35 | 43 | ); |
| 36 | 44 | |
| 45 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 37 | 46 | $columns = apply_filters( 'propertyhive_contact_viewings_columns', $columns ); |
| 38 | 47 | ?> |
| 39 | 48 | |
| 40 | 49 | <div class="tablenav top"> |
| @@ -41,10 +50,12 @@ | ||
| 41 | 50 | <div class="alignleft actions"> |
| 42 | 51 | <select name="_status" id="_viewing_status_filter"> |
| 43 | 52 | <option value=""><?php echo esc_html(__( 'All Statuses', 'propertyhive' )); ?></option> |
| 44 | 53 | <?php |
| 54 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 45 | 55 | $viewing_statuses = ph_get_viewing_statuses(); |
| 46 | 56 | |
| 57 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 47 | 58 | foreach ( $viewing_statuses as $status => $display_status ) |
| 48 | 59 | { |
| 49 | 60 | ?> |
| 50 | 61 | <option value="<?php echo esc_attr($status); ?>" <?php selected( $status, $selected_status ); ?>><?php echo esc_html($display_status); ?></option> |
| @@ -63,9 +74,11 @@ | ||
| 63 | 74 | <table class="wp-list-table widefat fixed striped posts"> |
| 64 | 75 | <thead> |
| 65 | 76 | <tr> |
| 66 | 77 | <?php |
| 78 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 67 | 79 | $column_i = 0; |
| 80 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 68 | 81 | foreach ( $columns as $column_key => $column ) |
| 69 | 82 | { |
| 70 | 83 | ?> |
| 71 | 84 | <th scope="col" id='<?php echo esc_attr($column_key); ?>' class='manage-column column-<?php echo esc_attr($column_key); echo ($column_i == 0 ? ' column-primary' : ''); ?>'><?php echo esc_html($column); ?></th> |
| @@ -81,30 +94,39 @@ | ||
| 81 | 94 | { |
| 82 | 95 | while ( $viewings_query->have_posts() ) |
| 83 | 96 | { |
| 84 | 97 | $viewings_query->the_post(); |
| 98 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 85 | 99 | $the_viewing = new PH_Viewing( get_the_ID() ); |
| 86 | 100 | |
| 101 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 87 | 102 | $edit_link = get_edit_post_link( get_the_ID() ); |
| 88 | 103 | |
| 104 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 89 | 105 | $column_data = array( |
| 90 | - 'date_time' => '<a href="' . esc_url($edit_link) . '" target="' . esc_attr(apply_filters('propertyhive_subgrid_link_target', '')) . '" class="viewing-lightbox" data-viewing-id="' . esc_attr(get_the_ID()) . '">' . esc_html(date("H:i jS F Y", strtotime($the_viewing->_start_date_time))) . '</a>', | |
| 106 | + 'date_time' => '<a href="' . esc_url($edit_link) . '" target="' . esc_attr(apply_filters('propertyhive_subgrid_link_target', '')) . '" class="viewing-lightbox" data-viewing-id="' . esc_attr(get_the_ID()) . '">' . esc_html(gmdate("H:i jS F Y", strtotime($the_viewing->_start_date_time))) . '</a>', | |
| 91 | 107 | 'property' => $the_viewing->get_property_address(), |
| 92 | 108 | 'negotiators' => esc_html($the_viewing->get_negotiators()), |
| 93 | 109 | 'status' => $the_viewing->get_status(), |
| 94 | 110 | ); |
| 95 | 111 | |
| 112 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 96 | 113 | $row_classes = array( 'status-' . $the_viewing->_status ); |
| 97 | 114 | if ( $the_viewing->_status == 'carried_out' ) |
| 98 | 115 | { |
| 116 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 99 | 117 | $row_classes[] = 'applicant-feedback-status-' . $the_viewing->_feedback_status; |
| 100 | 118 | } |
| 119 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 101 | 120 | $row_classes = apply_filters( 'propertyhive_contact_viewings_row_classes', $row_classes, get_the_ID(), $the_viewing ); |
| 121 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 102 | 122 | $row_classes = is_array($row_classes) ? array_map( 'sanitize_html_class', array_map( 'strtolower', $row_classes ) ) : array(); |
| 103 | 123 | ?> |
| 104 | 124 | <tr class="<?php echo esc_attr(implode(" ", $row_classes)); ?>" > |
| 105 | 125 | <?php |
| 126 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 106 | 127 | $column_i = 0; |
| 128 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable in an admin view; PHPCS analyzes the view file standalone even though WordPress includes it inside a method/function scope. | |
| 107 | 129 | foreach ( $columns as $column_key => $column ) |
| 108 | 130 | { |
| 109 | 131 | echo '<td class="' . esc_attr($column_key) . ' column-' . esc_attr($column_key) . ($column_i == 0 ? ' column-primary' : '') . '" data-colname="' . esc_attr($column) . '">'; |
| 110 | 132 | |
| @@ -109,8 +131,9 @@ | ||
| 109 | 131 | echo '<td class="' . esc_attr($column_key) . ' column-' . esc_attr($column_key) . ($column_i == 0 ? ' column-primary' : '') . '" data-colname="' . esc_attr($column) . '">'; |
| 110 | 132 | |
| 111 | 133 | if ( isset( $column_data[$column_key] ) ) |
| 112 | 134 | { |
| 135 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Core cells are escaped HTML assembled above or by the reviewed PH model formatters; preserve trusted PHP contact-detail filter markup and links. | |
| 113 | 136 | echo $column_data[$column_key]; |
| 114 | 137 | } |
| 115 | 138 | |
| 116 | 139 | do_action( 'propertyhive_contact_viewings_custom_column', $column_key ); |