| @@ -27,21 +27,68 @@ | ||
| 27 | 27 | <th>' . esc_html(__( 'Price', 'propertyhive' )) . '</th> |
| 28 | 28 | <th>' . esc_html(__( 'Status', 'propertyhive' )) . '</th> |
| 29 | 29 | </tr> |
| 30 | 30 | '; |
| 31 | - foreach ($properties as $property) | |
| 31 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable included through the account rendering helper scope. | |
| 32 | + foreach ( $properties as $property ) | |
| 32 | 33 | { |
| 33 | - $link_prefix = ( ( $property->on_market == 'yes' ) ? '<a href="' . esc_url(get_permalink( $property->id )) . '">' : '' ); | |
| 34 | - $link_suffix = ( ( $property->on_market == 'yes' ) ? '</a>' : '' ); | |
| 34 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable included through the account rendering helper scope. | |
| 35 | + $property_url = ( 'yes' === $property->on_market ) | |
| 36 | + ? get_permalink( $property->id ) | |
| 37 | + : ''; | |
| 35 | 38 | |
| 36 | - $image = $property->get_main_photo_src(); | |
| 39 | + // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template-local variable included through the account rendering helper scope. | |
| 40 | + $image = $property->get_main_photo_src(); | |
| 37 | 41 | |
| 38 | - echo '<tr> | |
| 39 | - <td>' . ( ( $image !== false ) ? $link_prefix . '<img src="' . esc_url($image) . '" width="75" alt="' . esc_attr(get_the_title( $property->id )) . '">' : '' ) . $link_suffix . '</td> | |
| 40 | - <td>' . $link_prefix . esc_html(get_the_title( $property->id )) . $link_suffix . '</td> | |
| 41 | - <td>' . $property->get_formatted_price() . '</td> | |
| 42 | - <td>' . esc_html($property->availability) . '<br>' . esc_html( ( $property->on_market == 'yes' ) ? 'On Market' : 'Not On Market' ) . '</td> | |
| 43 | - </tr>'; | |
| 42 | + echo '<tr>'; | |
| 43 | + | |
| 44 | + echo '<td>'; | |
| 45 | + | |
| 46 | + if ( false !== $image ) | |
| 47 | + { | |
| 48 | + if ( $property_url ) | |
| 49 | + { | |
| 50 | + echo '<a href="' . esc_url( $property_url ) . '">'; | |
| 51 | + } | |
| 52 | + | |
| 53 | + echo '<img src="' . esc_url( $image ) . '" width="75" alt="' . esc_attr( get_the_title( $property->id ) ) . '">'; | |
| 54 | + | |
| 55 | + if ( $property_url ) | |
| 56 | + { | |
| 57 | + echo '</a>'; | |
| 58 | + } | |
| 59 | + } | |
| 60 | + | |
| 61 | + echo '</td>'; | |
| 62 | + | |
| 63 | + echo '<td>'; | |
| 64 | + | |
| 65 | + if ( $property_url ) | |
| 66 | + { | |
| 67 | + echo '<a href="' . esc_url( $property_url ) . '">'; | |
| 68 | + } | |
| 69 | + | |
| 70 | + echo esc_html( get_the_title( $property->id ) ); | |
| 71 | + | |
| 72 | + if ( $property_url ) | |
| 73 | + { | |
| 74 | + echo '</a>'; | |
| 75 | + } | |
| 76 | + | |
| 77 | + echo '</td>'; | |
| 78 | + | |
| 79 | + echo '<td>' . wp_kses_post( $property->get_formatted_price() ) . '</td>'; | |
| 80 | + | |
| 81 | + echo '<td>' . | |
| 82 | + esc_html( $property->availability ) . | |
| 83 | + '<br>' . | |
| 84 | + ( 'yes' === $property->on_market | |
| 85 | + ? esc_html__( 'On Market', 'propertyhive' ) | |
| 86 | + : esc_html__( 'Not On Market', 'propertyhive' ) | |
| 87 | + ) . | |
| 88 | + '</td>'; | |
| 89 | + | |
| 90 | + echo '</tr>'; | |
| 44 | 91 | } |
| 45 | 92 | echo '</table>'; |
| 46 | 93 | } |
| 47 | 94 | else |