← All changes
|
includes/admin/views/html-admin-matching-applicants.php
+229
-67
1.4.49
→
2.4.0
View file →
| @@ -1,7 +1,13 @@ | ||
| 1 | +<?php | |
| 2 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 3 | + exit; | |
| 4 | +} | |
| 5 | +?> | |
| 6 | + | |
| 1 | 7 | <div class="wrap propertyhive"> |
| 2 | 8 | |
| 3 | - <h1>Matching Applicants For <?php echo $property->get_formatted_full_address(); ?> (<?php echo count($applicants); ?>)</h1> | |
| 9 | + <h1>Matching Applicants For <?php echo esc_html($property->get_formatted_full_address()); ?> (<?php echo count($applicants); ?>)</h1> | |
| 4 | 10 | |
| 5 | 11 | <form method="post" id="mainform" action="" enctype="multipart/form-data"> |
| 6 | 12 | |
| 7 | 13 | <div id="poststuff"> |
| @@ -8,11 +14,31 @@ | ||
| 8 | 14 | |
| 9 | 15 | <?php |
| 10 | 16 | if ( !empty($applicants) ) |
| 11 | 17 | { |
| 12 | - // var_dump($applicants); | |
| 18 | + // 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. | |
| 19 | + $select_all_actions = array( | |
| 20 | + 'email' => __( 'Email', 'propertyhive' ), | |
| 21 | + 'not_interested' => __( 'Not Suitable', 'propertyhive' ) | |
| 22 | + ); | |
| 23 | + | |
| 24 | + // 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. | |
| 25 | + $select_all_actions = apply_filters( 'propertyhive_matching_select_all_actions', $select_all_actions ); | |
| 26 | + ?> | |
| 27 | + <div class="select-actions" style="padding-bottom:15px"> | |
| 28 | + <span style="display:inline-block; vertical-align:middle;"><?php echo esc_html(__( 'Select', 'propertyhive' )); ?>:</span> <?php | |
| 29 | + // 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 | + foreach ( $select_all_actions as $key => $value ) | |
| 31 | + { | |
| 32 | + echo '<a href="javascript:;" class="button" id="select_all_' . esc_attr(sanitize_title($key)) . '" style="display:inline-block; vertical-align:middle;">All - ' . esc_html($value) . '</a> '; | |
| 33 | + } | |
| 34 | + ?> | |
| 35 | + <a href="javascript:;" class="button" id="select_none" style="display:inline-block; vertical-align:middle;">None</a> | |
| 36 | + </div> | |
| 37 | + <?php | |
| 13 | 38 | echo '<table width="100%">'; |
| 14 | 39 | |
| 40 | + // 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 | 41 | $columns = array( |
| 16 | 42 | 'name' => 'Name', |
| 17 | 43 | 'contact_details' => 'Contact Details', |
| 18 | 44 | 'requirements' => 'Requirements' |
| @@ -17,15 +43,17 @@ | ||
| 17 | 43 | 'contact_details' => 'Contact Details', |
| 18 | 44 | 'requirements' => 'Requirements' |
| 19 | 45 | ); |
| 20 | 46 | |
| 47 | + // 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. | |
| 21 | 48 | $columns = apply_filters( 'propertyhive_matching_applicants_row_headings', $columns ); |
| 22 | 49 | |
| 23 | 50 | echo '<thead> |
| 24 | 51 | <tr>'; |
| 52 | + // 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. | |
| 25 | 53 | foreach ( $columns as $key => $column ) |
| 26 | 54 | { |
| 27 | - echo '<th style="text-align:left">' . $column . '</th>'; | |
| 55 | + echo '<th style="text-align:left">' . esc_html($column) . '</th>'; | |
| 28 | 56 | } |
| 29 | 57 | echo ' |
| 30 | 58 | <th style="text-align:left">Actions</th> |
| 31 | 59 | </tr> |
| @@ -32,112 +60,226 @@ | ||
| 32 | 60 | </thead> |
| 33 | 61 | <tbody> |
| 34 | 62 | '; |
| 35 | 63 | |
| 64 | + // 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. | |
| 36 | 65 | $percentage_lower = get_option( 'propertyhive_applicant_match_price_range_percentage_lower', '' ); |
| 66 | + // 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 | 67 | $percentage_higher = get_option( 'propertyhive_applicant_match_price_range_percentage_higher', '' ); |
| 38 | 68 | |
| 69 | + // 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. | |
| 39 | 70 | foreach ( $applicants as $applicant ) |
| 40 | 71 | { |
| 72 | + // 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. | |
| 41 | 73 | $previously_sent = array(); |
| 74 | + | |
| 75 | + // 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. | |
| 76 | + $currency = '£'; | |
| 77 | + if ( isset($applicant['applicant_profile']['currency']) && !empty($applicant['applicant_profile']['currency']) ) | |
| 78 | + { | |
| 79 | + // 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. | |
| 80 | + $PH_Countries = new PH_Countries(); | |
| 81 | + // 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. | |
| 82 | + $selected_currency = $PH_Countries->get_currency($applicant['applicant_profile']['currency']); | |
| 83 | + if ( $selected_currency !== false ) | |
| 84 | + { | |
| 85 | + // 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. | |
| 86 | + $currency = $selected_currency['currency_symbol']; | |
| 87 | + } | |
| 88 | + } | |
| 42 | 89 | |
| 90 | + // 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. | |
| 43 | 91 | $applicant_profile_match_history = get_post_meta( $applicant['contact_id'], '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '_match_history', TRUE ); |
| 44 | 92 | if ( isset($applicant_profile_match_history[$property->id]) && is_array($applicant_profile_match_history[$property->id]) && !empty($applicant_profile_match_history[$property->id]) ) |
| 45 | 93 | { |
| 94 | + // 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. | |
| 46 | 95 | $previously_sent = $applicant_profile_match_history[$property->id]; |
| 47 | 96 | } |
| 48 | 97 | |
| 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. | |
| 49 | 99 | $email_address = get_post_meta( $applicant['contact_id'], '_email_address', TRUE ); |
| 100 | + // 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. | |
| 50 | 101 | $forbidden_contact_methods = get_post_meta( $applicant['contact_id'], '_forbidden_contact_methods', TRUE ); |
| 102 | + // 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. | |
| 51 | 103 | $do_not_email = false; |
| 52 | 104 | if ( is_array($forbidden_contact_methods) && in_array('email', $forbidden_contact_methods) ) |
| 53 | 105 | { |
| 106 | + // 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. | |
| 54 | 107 | $do_not_email = true; |
| 55 | 108 | } |
| 56 | 109 | |
| 110 | + // 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. | |
| 57 | 111 | $requirements = array(); |
| 58 | - if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' ) | |
| 112 | + if ( | |
| 113 | + isset($applicant['applicant_profile']['department']) && | |
| 114 | + ( $applicant['applicant_profile']['department'] == 'residential-sales' || ph_get_custom_department_based_on($applicant['applicant_profile']['department']) == 'residential-sales' | |
| 115 | + ) | |
| 116 | + ) | |
| 59 | 117 | { |
| 60 | - $requirements[] = 'Max Price: £' . number_format($applicant['applicant_profile']['max_price']); | |
| 61 | - } | |
| 62 | - if ( $percentage_lower != '' && $percentage_higher != '' ) | |
| 63 | - { | |
| 64 | - $match_price_range_lower = ''; | |
| 65 | - if ( !isset($applicant['applicant_profile']['match_price_range_lower_actual']) || ( isset($applicant['applicant_profile']['match_price_range_lower_actual']) && $applicant['applicant_profile']['match_price_range_lower_actual'] == '' ) ) | |
| 118 | + if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' ) | |
| 66 | 119 | { |
| 67 | - if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' ) | |
| 120 | + // 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. | |
| 121 | + $requirements[] = array( | |
| 122 | + 'label' => __( 'Maximum Price', 'propertyhive' ), | |
| 123 | + 'value' => $currency . esc_html( ph_display_price_field($applicant['applicant_profile']['max_price']) ), | |
| 124 | + ); | |
| 125 | + } | |
| 126 | + if ( $percentage_lower != '' && $percentage_higher != '' ) | |
| 127 | + { | |
| 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. | |
| 129 | + $match_price_range_lower = ''; | |
| 130 | + if ( | |
| 131 | + !isset($applicant['applicant_profile']['match_price_range_lower_actual']) || | |
| 132 | + ( isset($applicant['applicant_profile']['match_price_range_lower_actual']) && $applicant['applicant_profile']['match_price_range_lower_actual'] == '' ) | |
| 133 | + ) | |
| 68 | 134 | { |
| 69 | - $match_price_range_lower = $applicant['applicant_profile']['max_price_actual'] - ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_lower / 100 ) ); | |
| 135 | + if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' ) | |
| 136 | + { | |
| 137 | + // 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. | |
| 138 | + $match_price_range_lower = (float) $applicant['applicant_profile']['max_price'] - ( (float) $applicant['applicant_profile']['max_price'] * ( (float) $percentage_lower / 100 ) ); | |
| 139 | + } | |
| 70 | 140 | } |
| 71 | - } | |
| 72 | - else | |
| 73 | - { | |
| 74 | - $match_price_range_lower = $applicant['applicant_profile']['match_price_range_lower_actual']; | |
| 75 | - } | |
| 141 | + else | |
| 142 | + { | |
| 143 | + // 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. | |
| 144 | + $match_price_range_lower = $applicant['applicant_profile']['match_price_range_lower']; | |
| 145 | + } | |
| 76 | 146 | |
| 77 | - $match_price_range_higher = ''; | |
| 78 | - if ( !isset($applicant['applicant_profile']['match_price_range_higher_actual']) || ( isset($applicant['applicant_profile']['match_price_range_higher_actual']) && $applicant['applicant_profile']['match_price_range_higher_actual'] == '' ) ) | |
| 79 | - { | |
| 80 | - if ( isset($applicant['applicant_profile']['max_price_actual']) && $applicant['applicant_profile']['max_price_actual'] != '' ) | |
| 147 | + // 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. | |
| 148 | + $match_price_range_higher = ''; | |
| 149 | + if ( | |
| 150 | + !isset($applicant['applicant_profile']['match_price_range_higher_actual']) || | |
| 151 | + ( isset($applicant['applicant_profile']['match_price_range_higher_actual']) && $applicant['applicant_profile']['match_price_range_higher_actual'] == '' ) | |
| 152 | + ) | |
| 81 | 153 | { |
| 82 | - $match_price_range_higher = $applicant['applicant_profile']['max_price_actual'] + ( $applicant['applicant_profile']['max_price_actual'] * ( $percentage_higher / 100 ) ); | |
| 154 | + if ( isset($applicant['applicant_profile']['max_price']) && $applicant['applicant_profile']['max_price'] != '' ) | |
| 155 | + { | |
| 156 | + // 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. | |
| 157 | + $match_price_range_higher = (float) $applicant['applicant_profile']['max_price'] + ( (float) $applicant['applicant_profile']['max_price'] * ( (float) $percentage_higher / 100 ) ); | |
| 158 | + } | |
| 83 | 159 | } |
| 160 | + else | |
| 161 | + { | |
| 162 | + // 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. | |
| 163 | + $match_price_range_higher = $applicant['applicant_profile']['match_price_range_higher']; | |
| 164 | + } | |
| 165 | + | |
| 166 | + if ( | |
| 167 | + $match_price_range_lower != '' && $match_price_range_higher != '' | |
| 168 | + ) | |
| 169 | + { | |
| 170 | + // 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. | |
| 171 | + $requirements[] = array( | |
| 172 | + 'label' => __( 'Maximum Price Range', 'propertyhive' ), | |
| 173 | + 'value' => $currency . esc_html( ph_display_price_field($match_price_range_lower) ) . ' to ' . $currency . esc_html( ph_display_price_field($match_price_range_higher) ), | |
| 174 | + ); | |
| 175 | + } | |
| 84 | 176 | } |
| 85 | - else | |
| 86 | - { | |
| 87 | - $match_price_range_higher = $applicant['applicant_profile']['match_price_range_higher_actual']; | |
| 88 | - } | |
| 177 | + } | |
| 89 | 178 | |
| 90 | - if ( | |
| 91 | - $match_price_range_lower != '' && $match_price_range_higher != '' | |
| 92 | - ) | |
| 179 | + if ( | |
| 180 | + isset($applicant['applicant_profile']['department']) && | |
| 181 | + ( $applicant['applicant_profile']['department'] == 'residential-lettings' || ph_get_custom_department_based_on($applicant['applicant_profile']['department']) == 'residential-lettings' | |
| 182 | + ) | |
| 183 | + ) | |
| 184 | + { | |
| 185 | + if ( isset($applicant['applicant_profile']['max_rent']) && $applicant['applicant_profile']['max_rent'] != '' ) | |
| 93 | 186 | { |
| 94 | - $requirements[] = 'Match Price Range: £' . number_format($match_price_range_lower) . ' to £' . number_format($match_price_range_higher); | |
| 187 | + // 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. | |
| 188 | + $requirements[] = array( | |
| 189 | + 'label' => __( 'Maximum Rent', 'propertyhive' ), | |
| 190 | + 'value' => $currency . esc_html( ph_display_price_field($applicant['applicant_profile']['max_rent']) ) . ' ' . esc_html( $applicant['applicant_profile']['rent_frequency'] ) | |
| 191 | + ); | |
| 95 | 192 | } |
| 96 | 193 | } |
| 194 | + | |
| 97 | 195 | if ( isset($applicant['applicant_profile']['min_beds']) && $applicant['applicant_profile']['min_beds'] != '' ) |
| 98 | 196 | { |
| 99 | - $requirements[] = 'Min Beds: ' . $applicant['applicant_profile']['min_beds']; | |
| 197 | + // 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. | |
| 198 | + $requirements[] = array( | |
| 199 | + 'label' => __( 'Minimum Beds', 'propertyhive' ), | |
| 200 | + 'value' => esc_html( $applicant['applicant_profile']['min_beds'] ), | |
| 201 | + ); | |
| 100 | 202 | } |
| 203 | + | |
| 101 | 204 | if ( isset($applicant['applicant_profile']['property_types']) && is_array($applicant['applicant_profile']['property_types']) && !empty($applicant['applicant_profile']['property_types']) ) |
| 102 | 205 | { |
| 103 | 206 | //$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price']; |
| 104 | 207 | } |
| 105 | - if ( isset($applicant['applicant_profile']['locations']) && is_array($applicant['applicant_profile']['locations']) && !empty($applicant['applicant_profile']['locations']) ) | |
| 208 | + | |
| 209 | + if ( get_option('propertyhive_applicant_locations_type') == 'text' && isset($applicant['applicant_profile']['location_text']) && $applicant['applicant_profile']['location_text'] != '') | |
| 106 | 210 | { |
| 107 | - //$requirements[] = 'Max Price: ' . $applicant['applicant_profile']['max_price']; | |
| 211 | + // 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. | |
| 212 | + $location_value = $applicant['applicant_profile']['location_text']; | |
| 213 | + | |
| 214 | + if ( isset($applicant['applicant_profile']['location_radius']) && $applicant['applicant_profile']['location_radius'] != '' ) | |
| 215 | + { | |
| 216 | + // 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. | |
| 217 | + $location_value .= ' (Within '. $applicant['applicant_profile']['location_radius'] .' Miles)'; | |
| 218 | + } | |
| 219 | + | |
| 220 | + // 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. | |
| 221 | + $requirements[] = array( | |
| 222 | + 'label' => __( 'Location', 'propertyhive' ), | |
| 223 | + 'value' => esc_html( $location_value ), | |
| 224 | + ); | |
| 108 | 225 | } |
| 226 | + | |
| 227 | + // 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. | |
| 228 | + $requirements = apply_filters( 'propertyhive_applicant_requirements_display', $requirements, $applicant['contact_id'], $applicant['applicant_profile'] ); | |
| 229 | + | |
| 109 | 230 | if ( isset($applicant['applicant_profile']['notes']) && $applicant['applicant_profile']['notes'] != '' ) |
| 110 | 231 | { |
| 111 | - $requirements[] = 'Notes: ' . nl2br($applicant['applicant_profile']['notes']); | |
| 232 | + // 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. | |
| 233 | + $requirements[] = array( | |
| 234 | + 'label' => __( 'Notes', 'propertyhive' ), | |
| 235 | + 'value' => nl2br( esc_html( wp_strip_all_tags($applicant['applicant_profile']['notes']) ) ), | |
| 236 | + ); | |
| 112 | 237 | } |
| 113 | - $requirements = implode("<br>", $requirements); | |
| 114 | - if ( $requirements == '' ) | |
| 238 | + | |
| 239 | + // 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. | |
| 240 | + $requirements_output = ''; | |
| 241 | + if ( empty($requirements) ) | |
| 115 | 242 | { |
| 116 | - $requirements = '-'; | |
| 243 | + // 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. | |
| 244 | + $requirements_output = '-'; | |
| 117 | 245 | } |
| 246 | + else | |
| 247 | + { | |
| 248 | + // 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. | |
| 249 | + foreach ( $requirements as $requirement ) | |
| 250 | + { | |
| 251 | + // 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. | |
| 252 | + $requirements_output .= esc_html( $requirement['label'] ) . ': ' . $requirement['value'] . '<br>'; | |
| 253 | + } | |
| 254 | + } | |
| 118 | 255 | |
| 256 | + // 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. | |
| 119 | 257 | $columns = array( |
| 120 | - 'name' => '<a href="' . get_edit_post_link($applicant['contact_id']) . '" target="_blank">' . get_the_title($applicant['contact_id']) . '</a>', | |
| 121 | - 'contact_details' => 'T: ' . get_post_meta( $applicant['contact_id'], '_telephone_number', TRUE ) . '<br>E: ' . $email_address, | |
| 122 | - 'requirements' => $requirements, | |
| 258 | + 'name' => '<strong><a href="' . esc_url(get_edit_post_link($applicant['contact_id'])) . '" target="_blank">' . esc_html(get_the_title($applicant['contact_id'])) . '</a>' . ( ( isset($applicant['applicant_profile']['grading']) && $applicant['applicant_profile']['grading'] == 'hot' ) ? '<br><span style="color:#C00;">('. esc_html(__( 'Hot Applicant', 'propertyhive' )) . ')</span>' : '' ) . '</strong>', | |
| 259 | + 'contact_details' => 'T: ' . esc_html(get_post_meta( $applicant['contact_id'], '_telephone_number', TRUE )) . '<br>E: ' . esc_html($email_address), | |
| 260 | + 'requirements' => $requirements_output, | |
| 123 | 261 | ); |
| 124 | 262 | |
| 263 | + // 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. | |
| 125 | 264 | $columns = apply_filters( 'propertyhive_matching_applicants_row_data', $columns, $applicant, $property->id ); |
| 126 | 265 | |
| 127 | - echo '<tr id="matching_contact_' . $applicant['contact_id'] . '_applicant_profile_' . $applicant['applicant_profile']['applicant_profile_id'] . '">'; | |
| 266 | + echo '<tr id="matching_contact_' . (int)$applicant['contact_id'] . '_applicant_profile_' . (int)$applicant['applicant_profile']['applicant_profile_id'] . '">'; | |
| 267 | + // 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. | |
| 128 | 268 | foreach ( $columns as $key => $column ) |
| 129 | 269 | { |
| 270 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Built-in row text and requirement labels/values are escaped above; preserve trusted currency, requirement and propertyhive_matching_applicants_row_data HTML filters. | |
| 130 | 271 | echo '<td style="border-bottom:1px solid #CCC; padding:5px 0;">' . $column . '</td>'; |
| 131 | 272 | } |
| 132 | 273 | echo '<td style="border-bottom:1px solid #CCC; padding:5px 0;">'; |
| 133 | 274 | |
| 134 | - echo '<label><input type="checkbox" name="email_contact_applicant_profile_id[]" value="' . $applicant['contact_id'] . '|' . $applicant['applicant_profile']['applicant_profile_id'] . '" '; | |
| 275 | + echo '<label><input type="checkbox" name="email_contact_applicant_profile_id[]" value="' . (int)$applicant['contact_id'] . '|' . (int)$applicant['applicant_profile']['applicant_profile_id'] . '" '; | |
| 135 | 276 | |
| 277 | + // 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. | |
| 136 | 278 | $post_tip = ''; |
| 137 | 279 | if ( strpos($email_address, '@') === FALSE ) |
| 138 | 280 | { |
| 139 | - echo ' disabled title="Invalid email address: ' . $email_address . '"'; | |
| 281 | + echo ' disabled title="Invalid email address: ' . esc_attr($email_address) . '"'; | |
| 140 | 282 | //$post_tip = 'Invalid email address: ' . $email_address; |
| 141 | 283 | } |
| 142 | 284 | elseif ( $do_not_email ) |
| 143 | 285 | { |
| @@ -147,9 +289,10 @@ | ||
| 147 | 289 | else |
| 148 | 290 | { |
| 149 | 291 | if ( !empty($previously_sent) ) |
| 150 | 292 | { |
| 151 | - $post_tip = 'Sent previously via ' . $previously_sent[count($previously_sent) - 1]['method'] . ' on ' . date("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date'])); | |
| 293 | + // 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. | |
| 294 | + $post_tip = 'Sent previously via ' . $previously_sent[count($previously_sent) - 1]['method'] . ' on ' . gmdate("jS F Y", strtotime($previously_sent[count($previously_sent) - 1]['date'])); | |
| 152 | 295 | |
| 153 | 296 | if ( |
| 154 | 297 | $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] || |
| 155 | 298 | $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] |
| @@ -156,13 +299,15 @@ | ||
| 156 | 299 | ) |
| 157 | 300 | { |
| 158 | 301 | if ( $price_change_date > $previously_sent[count($previously_sent) - 1]['date'] ) |
| 159 | 302 | { |
| 160 | - $post_tip .= ', however a price change occurred on ' . date("jS F Y", strtotime($price_change_date)); | |
| 303 | + // 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. | |
| 304 | + $post_tip .= ', however a price change occurred on ' . gmdate("jS F Y", strtotime($price_change_date)); | |
| 161 | 305 | } |
| 162 | 306 | elseif ( $on_market_change_date > $previously_sent[count($previously_sent) - 1]['date'] ) |
| 163 | 307 | { |
| 164 | - $post_tip .= ', however a change to the on market status occurred on ' . date("jS F Y", strtotime($on_market_change_date)); | |
| 308 | + // 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. | |
| 309 | + $post_tip .= ', however a change to the on market status occurred on ' . gmdate("jS F Y", strtotime($on_market_change_date)); | |
| 165 | 310 | } |
| 166 | 311 | echo ' checked'; |
| 167 | 312 | } |
| 168 | 313 | } |
| @@ -171,15 +316,15 @@ | ||
| 171 | 316 | echo ' checked'; |
| 172 | 317 | } |
| 173 | 318 | } |
| 174 | 319 | |
| 175 | - echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . $post_tip : '' ) . '</span></label> | |
| 320 | + echo '> Email Property To Applicant<span style="font-weight:400;">' . ( ($post_tip != '') ? ' - ' . esc_html($post_tip) : '' ) . '</span></label> | |
| 176 | 321 | |
| 177 | 322 | <br>'; |
| 178 | 323 | |
| 179 | 324 | do_action( 'propertyhive_property_match_send_methods', $applicant['contact_id'], $applicant['applicant_profile']['applicant_profile_id'], $property->id ); |
| 180 | 325 | |
| 181 | - echo '<label><input type="checkbox" name="not_interested_contact_applicant_profile_id[]" value="' . $applicant['contact_id'] . '|' . $applicant['applicant_profile']['applicant_profile_id'] . '"> Property Not Suitable</label>'; | |
| 326 | + echo '<label><input type="checkbox" name="not_interested_contact_applicant_profile_id[]" value="' . (int)$applicant['contact_id'] . '|' . (int)$applicant['applicant_profile']['applicant_profile_id'] . '"> Property Not Suitable</label>'; | |
| 182 | 327 | |
| 183 | 328 | echo '</td>'; |
| 184 | 329 | echo '</tr>'; |
| 185 | 330 | } |
| @@ -190,17 +335,17 @@ | ||
| 190 | 335 | '; |
| 191 | 336 | } |
| 192 | 337 | else |
| 193 | 338 | { |
| 194 | - echo __( 'No matching applicants found', 'propertyhive' ); | |
| 339 | + echo esc_html__( 'No matching applicants found', 'propertyhive' ); | |
| 195 | 340 | } |
| 196 | 341 | ?> |
| 197 | 342 | |
| 198 | 343 | <p class="submit"> |
| 199 | 344 | |
| 200 | - <input name="save" class="button-primary" type="submit" value="<?php echo __( 'Continue', 'propertyhive' ); ?>" /> | |
| 345 | + <input name="save" class="button-primary" type="submit" value="<?php echo esc_html(__( 'Continue', 'propertyhive' )); ?>" /> | |
| 201 | 346 | |
| 202 | - <a href="<?php echo get_edit_post_link((int)$_GET['property_id']); ?>" class="button"><?php _e( 'Cancel', 'propertyhive' ); ?></a> | |
| 347 | + <a href="<?php echo esc_url(get_edit_post_link( (int) $property_id )); ?>" class="button"><?php echo esc_html(__( 'Cancel', 'propertyhive' )); ?></a> | |
| 203 | 348 | |
| 204 | 349 | <input type="hidden" name="step" value="one" /> |
| 205 | 350 | <?php wp_nonce_field( 'propertyhive-matching-applicants' ); ?> |
| 206 | 351 | |
| @@ -206,9 +351,9 @@ | ||
| 206 | 351 | |
| 207 | 352 | </p> |
| 208 | 353 | |
| 209 | 354 | <p> |
| 210 | - <?php echo __( "If you've opted to email any of the applicants you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' ); ?> | |
| 355 | + <?php echo esc_html(__( "If you've opted to email any of the applicants you'll have the ability to edit the contents of the email in the next step.", 'propertyhive' )); ?> | |
| 211 | 356 | </p> |
| 212 | 357 | |
| 213 | 358 | </div> |
| 214 | 359 | |
| @@ -217,27 +362,44 @@ | ||
| 217 | 362 | </div> |
| 218 | 363 | |
| 219 | 364 | <script> |
| 220 | 365 | |
| 221 | - jQuery('body').on('change', 'input[name=\'not_interested_contact_applicant_profile_id[]\']', function() | |
| 366 | + jQuery(document).ready(function() | |
| 222 | 367 | { |
| 223 | - var applicant_contact_profile_id = jQuery(this).val(); | |
| 224 | - var applicant_contact_profile_id_split = applicant_contact_profile_id.split('|'); | |
| 368 | + jQuery('body').on('change', 'input[name=\'not_interested_contact_applicant_profile_id[]\']', function() | |
| 369 | + { | |
| 370 | + var applicant_contact_profile_id = jQuery(this).val(); | |
| 371 | + var applicant_contact_profile_id_split = applicant_contact_profile_id.split('|'); | |
| 225 | 372 | |
| 226 | - jQuery('input[name=\'email_contact_applicant_profile_id[]\'][value=\'' + applicant_contact_profile_id + '\']').attr('checked', false); | |
| 373 | + jQuery('input[name=\'email_contact_applicant_profile_id[]\'][value=\'' + applicant_contact_profile_id + '\']').attr('checked', false); | |
| 227 | 374 | |
| 228 | - opacity = 0.4; | |
| 229 | - if ( !jQuery(this).is(':checked') ) | |
| 375 | + opacity = 0.4; | |
| 376 | + if ( !jQuery(this).is(':checked') ) | |
| 377 | + { | |
| 378 | + opacity = 1; | |
| 379 | + } | |
| 380 | + jQuery('#matching_contact_' + applicant_contact_profile_id_split[0] + '_applicant_profile_' + applicant_contact_profile_id_split[1]).animate({ | |
| 381 | + opacity: opacity | |
| 382 | + }, | |
| 383 | + { | |
| 384 | + duration: 250 | |
| 385 | + }); | |
| 386 | + | |
| 387 | + return false; | |
| 388 | + }); | |
| 389 | + | |
| 390 | + jQuery('.select-actions a').click(function(e) | |
| 230 | 391 | { |
| 231 | - opacity = 1; | |
| 232 | - } | |
| 233 | - jQuery('#matching_contact_' + applicant_contact_profile_id_split[0] + '_applicant_profile_' + applicant_contact_profile_id_split[1]).animate({ | |
| 234 | - opacity: opacity | |
| 235 | - }, | |
| 236 | - { | |
| 237 | - duration: 250 | |
| 392 | + e.preventDefault(); | |
| 393 | + | |
| 394 | + var id = jQuery(this).attr('id').replace("select_all_", ""); | |
| 395 | + | |
| 396 | + jQuery('input[name$=\'_contact_applicant_profile_id[]\']').prop('checked', false); | |
| 397 | + | |
| 398 | + if ( id != 'select_none' ) | |
| 399 | + { | |
| 400 | + jQuery('input[name=\'' + id + '_contact_applicant_profile_id[]\']').prop('checked', 'checked'); | |
| 401 | + } | |
| 238 | 402 | }); |
| 239 | - | |
| 240 | - return false; | |
| 241 | 403 | }); |
| 242 | 404 | |
| 243 | 405 | </script> |