| 1: | <?php |
| 2: | |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | |
| 10: | |
| 11: | |
| 12: | |
| 13: | if ( ! defined( 'ABSPATH' ) ) { |
| 14: | exit; |
| 15: | } |
| 16: | |
| 17: | |
| 18: | |
| 19: | |
| 20: | |
| 21: | |
| 22: | class EPL_Widget_Recent_Property extends WP_Widget { |
| 23: | |
| 24: | |
| 25: | |
| 26: | |
| 27: | |
| 28: | |
| 29: | public function __construct() { |
| 30: | parent::__construct( false, __( 'EPL - Listing', 'easy-property-listings' ), array( 'description' => __( 'Add listings to a sidebar.', 'easy-property-listings' ) ) ); |
| 31: | |
| 32: | } |
| 33: | |
| 34: | |
| 35: | |
| 36: | |
| 37: | |
| 38: | |
| 39: | |
| 40: | |
| 41: | |
| 42: | |
| 43: | public function widget( $args, $instance ) { |
| 44: | $property_types = epl_get_active_post_types(); |
| 45: | if ( ! empty( $property_types ) ) { |
| 46: | $property_types = array_keys( $property_types ); |
| 47: | } |
| 48: | |
| 49: | $defaults = array( |
| 50: | 'title' => '', |
| 51: | 'types' => $property_types, |
| 52: | 'featured' => 0, |
| 53: | 'status' => array( 'current', 'sold', 'leased' ), |
| 54: | 'view' => 'default', |
| 55: | 'display' => 'image', |
| 56: | 'image' => 'thumbnail', |
| 57: | 'archive' => 0, |
| 58: | 'order_rand' => 0, |
| 59: | 'open_house' => 0, |
| 60: | 'd_title' => 0, |
| 61: | |
| 62: | 'more_text' => __( 'Read More', 'easy-property-listings' ), |
| 63: | 'd_excerpt' => 'off', |
| 64: | 'd_suburb' => 'on', |
| 65: | 'd_street' => 'on', |
| 66: | 'd_price' => 'on', |
| 67: | 'd_more' => 'on', |
| 68: | 'd_inspection_time' => 'off', |
| 69: | 'd_ical_link' => 'on', |
| 70: | |
| 71: | 'd_icons' => 'none', |
| 72: | 'p_number' => 1, |
| 73: | 'p_skip' => 0, |
| 74: | |
| 75: | ); |
| 76: | |
| 77: | $defaults = apply_filters( 'epl_recent_property_widget_default_args', $defaults ); |
| 78: | $instance = wp_parse_args( (array) $instance, $defaults ); |
| 79: | |
| 80: | if ( ! is_array( $instance['types'] ) ) { |
| 81: | $instance['types'] = array_map( 'trim', explode( ',', $instance['types'] ) ); |
| 82: | } |
| 83: | if ( ! $instance['p_number'] ) { |
| 84: | $instance['p_number'] = 1; |
| 85: | } |
| 86: | if ( 'beds/baths' === $instance['d_icons'] ) { |
| 87: | $instance['d_icons'] = 'bb'; |
| 88: | } |
| 89: | |
| 90: | $query_args = array( |
| 91: | 'post_type' => $instance['types'], |
| 92: | 'showposts' => absint( $instance['p_number'] ), |
| 93: | 'offset' => absint( $instance['p_skip'] ), |
| 94: | 'paged' => '1', |
| 95: | 'epl_nopaging' => 'true', |
| 96: | ); |
| 97: | |
| 98: | |
| 99: | if ( ! empty( $instance['status'] ) ) { |
| 100: | if ( ! is_array( $instance['status'] ) ) { |
| 101: | $instance['status'] = array_map( 'trim', explode( ',', $instance['status'] ) ); |
| 102: | } |
| 103: | |
| 104: | if ( ! in_array( 'any', $instance['status'], true ) ) { |
| 105: | $query_args['meta_query'][] = array( |
| 106: | 'key' => 'property_status', |
| 107: | 'value' => $instance['status'], |
| 108: | 'compare' => 'IN', |
| 109: | ); |
| 110: | } |
| 111: | } |
| 112: | |
| 113: | if ( 'on' === $instance['featured'] ) { |
| 114: | $query_args['meta_query'][] = array( |
| 115: | 'key' => 'property_featured', |
| 116: | 'value' => 'yes', |
| 117: | ); |
| 118: | } |
| 119: | |
| 120: | |
| 121: | if ( 'on' === $instance['open_house'] ) { |
| 122: | $query_args['meta_query'][] = array( |
| 123: | 'key' => 'property_inspection_times', |
| 124: | 'value' => '^\s*$', |
| 125: | 'compare' => 'NOT REGEXP', |
| 126: | ); |
| 127: | } |
| 128: | |
| 129: | |
| 130: | if ( 'on' === $instance['archive'] && is_post_type_archive() ) { |
| 131: | $get_current_type = get_post_type(); |
| 132: | if ( false !== $get_current_type && in_array( $get_current_type, $property_types, true ) ) { |
| 133: | $query_args['post_type'] = $get_current_type; |
| 134: | } |
| 135: | } |
| 136: | |
| 137: | if ( 'on' === $instance['order_rand'] ) { |
| 138: | $query_args['orderby'] = 'rand'; |
| 139: | } |
| 140: | $query_args['is_epl_widget'] = true; |
| 141: | $query_args['is_epl_recent_property_widget'] = true; |
| 142: | $query_args['epl_widget_instance'] = $this->id; |
| 143: | |
| 144: | $query_args = apply_filters( 'epl_recent_property_widget_query', $query_args, $instance, $args ); |
| 145: | $query = new WP_Query( $query_args ); |
| 146: | |
| 147: | epl_get_template_part( |
| 148: | 'widgets/listing/' . ( strlen( trim( $instance['view'] ) ) ? trim( $instance['view'] ) : 'default' ) . '.php', |
| 149: | array( |
| 150: | 'args' => $args, |
| 151: | 'instance' => $instance, |
| 152: | 'query' => $query, |
| 153: | ) |
| 154: | ); |
| 155: | } |
| 156: | |
| 157: | |
| 158: | |
| 159: | |
| 160: | |
| 161: | |
| 162: | |
| 163: | |
| 164: | |
| 165: | |
| 166: | |
| 167: | |
| 168: | public function update( $new_instance, $old_instance ) { |
| 169: | $instance = $old_instance; |
| 170: | $instance['title'] = wp_strip_all_tags( $new_instance['title'] ); |
| 171: | |
| 172: | $epl_post_types = epl_get_active_post_types(); |
| 173: | if ( isset( $new_instance['types'] ) && is_array( $new_instance['types'] ) ) { |
| 174: | $types = array(); |
| 175: | foreach ( $new_instance['types'] as $type ) { |
| 176: | if ( array_key_exists( $type, $epl_post_types ) ) { |
| 177: | $types[] = $type; |
| 178: | } |
| 179: | } |
| 180: | if ( count( $types ) ) { |
| 181: | $instance['types'] = $types; |
| 182: | } |
| 183: | } |
| 184: | |
| 185: | $listing_statuses = apply_filters( |
| 186: | 'epl_widget_listing_property_status', |
| 187: | array( |
| 188: | 'current' => epl_get_the_status_label( 'current' ), |
| 189: | 'sold' => epl_get_the_status_label( 'sold' ), |
| 190: | 'leased' => epl_get_the_status_label( 'leased' ), |
| 191: | 'withdrawn' => epl_get_the_status_label( 'withdrawn' ), |
| 192: | 'offmarket' => epl_get_the_status_label( 'offmarket' ), |
| 193: | 'deleted' => epl_get_the_status_label( 'deleted' ), |
| 194: | ) |
| 195: | ); |
| 196: | if ( isset( $new_instance['status'] ) && is_array( $new_instance['status'] ) ) { |
| 197: | $statuses = array(); |
| 198: | foreach ( $new_instance['status'] as $status ) { |
| 199: | if ( array_key_exists( $status, $listing_statuses ) ) { |
| 200: | $statuses[] = $status; |
| 201: | } |
| 202: | } |
| 203: | if ( count( $statuses ) ) { |
| 204: | $instance['status'] = $statuses; |
| 205: | } |
| 206: | } |
| 207: | |
| 208: | $all_fields = array( |
| 209: | 'featured', |
| 210: | 'view', |
| 211: | 'display', |
| 212: | 'image', |
| 213: | 'archive', |
| 214: | 'open_house', |
| 215: | 'd_title', |
| 216: | 'more_text', |
| 217: | 'd_excerpt', |
| 218: | 'd_suburb', |
| 219: | 'd_street', |
| 220: | 'd_price', |
| 221: | 'd_more', |
| 222: | 'd_inspection_time', |
| 223: | 'd_ical_link', |
| 224: | 'd_icons', |
| 225: | 'p_number', |
| 226: | 'p_skip', |
| 227: | 'order_rand', |
| 228: | ); |
| 229: | |
| 230: | foreach ( $all_fields as $all_field ) { |
| 231: | |
| 232: | if ( isset( $new_instance[ $all_field ] ) ) { |
| 233: | $instance[ $all_field ] = epl_strip_tags( $new_instance[ $all_field ] ); |
| 234: | } else { |
| 235: | $instance[ $all_field ] = ''; |
| 236: | } |
| 237: | } |
| 238: | |
| 239: | return $instance; |
| 240: | } |
| 241: | |
| 242: | |
| 243: | |
| 244: | |
| 245: | |
| 246: | |
| 247: | |
| 248: | |
| 249: | public function form( $instance ) { |
| 250: | |
| 251: | $defaults = array( |
| 252: | 'title' => '', |
| 253: | 'types' => 'property', |
| 254: | 'featured' => 0, |
| 255: | 'status' => 'any', |
| 256: | 'view' => 'default', |
| 257: | 'display' => 'image', |
| 258: | 'image' => 'thumbnail', |
| 259: | 'archive' => 0, |
| 260: | 'order_rand' => 0, |
| 261: | 'open_house' => 0, |
| 262: | 'd_title' => 0, |
| 263: | |
| 264: | 'more_text' => __( 'Read More', 'easy-property-listings' ), |
| 265: | 'd_excerpt' => 'off', |
| 266: | 'd_suburb' => 'on', |
| 267: | 'd_street' => 'on', |
| 268: | 'd_price' => 'on', |
| 269: | 'd_more' => 'on', |
| 270: | 'd_inspection_time' => 0, |
| 271: | 'd_ical_link' => 1, |
| 272: | |
| 273: | 'd_icons' => 'none', |
| 274: | 'p_number' => 1, |
| 275: | 'p_skip' => 0, |
| 276: | ); |
| 277: | $instance = wp_parse_args( (array) $instance, $defaults ); |
| 278: | |
| 279: | ?> |
| 280: | |
| 281: | <p> |
| 282: | <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'easy-property-listings' ); ?></label> |
| 283: | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /> |
| 284: | </p> |
| 285: | <p> <strong><?php esc_html_e( 'Query Settings', 'easy-property-listings' ); ?></strong></p> |
| 286: | <p> |
| 287: | <label for="<?php echo esc_attr( $this->get_field_id( 'types' ) ); ?>"><?php esc_html_e( 'Listing Type', 'easy-property-listings' ); ?></label> |
| 288: | <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'types' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'types' ) ); ?>[]" multiple="multiple"> |
| 289: | <?php |
| 290: | $options = epl_get_active_post_types(); |
| 291: | if ( ! empty( $options ) ) { |
| 292: | foreach ( $options as $k => $v ) { |
| 293: | if ( is_array( $instance['types'] ) ) { |
| 294: | $selected = in_array( $k, $instance['types'], true ) ? true : false; |
| 295: | } else { |
| 296: | $selected = $k === $instance['types'] ? true : false; |
| 297: | } |
| 298: | echo '<option value="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '"', $selected ? ' selected="selected"' : '', '>', esc_html( $v ), '</option>'; |
| 299: | } |
| 300: | } |
| 301: | ?> |
| 302: | </select> |
| 303: | </p> |
| 304: | |
| 305: | <p> |
| 306: | <label for="<?php echo esc_attr( $this->get_field_id( 'status' ) ); ?>"><?php esc_html_e( 'Listing Status', 'easy-property-listings' ); ?></label> |
| 307: | <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'status' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'status' ) ); ?>[]" multiple="multiple"> |
| 308: | <?php |
| 309: | $options = apply_filters( |
| 310: | 'epl_widget_listing_property_status', |
| 311: | array( |
| 312: | 'current' => epl_get_the_status_label( 'current' ), |
| 313: | 'sold' => epl_get_the_status_label( 'sold' ), |
| 314: | 'leased' => epl_get_the_status_label( 'leased' ), |
| 315: | 'withdrawn' => epl_get_the_status_label( 'withdrawn' ), |
| 316: | 'offmarket' => epl_get_the_status_label( 'offmarket' ), |
| 317: | 'deleted' => epl_get_the_status_label( 'deleted' ), |
| 318: | ) |
| 319: | ); |
| 320: | if ( count( $options ) ) { |
| 321: | foreach ( $options as $key => $value ) { |
| 322: | if ( is_array( $instance['status'] ) ) { |
| 323: | $selected = in_array( $key, $instance['status'], true ) ? true : false; |
| 324: | } else { |
| 325: | $selected = $key === $instance['status'] ? true : false; |
| 326: | } |
| 327: | echo '<option value="' . esc_attr( $key ) . '" id="' . esc_attr( $key ) . '"' . selected( $selected, true, false ) . '>' . esc_html( $value ) . '</option>'; |
| 328: | } |
| 329: | } |
| 330: | ?> |
| 331: | </select> |
| 332: | </p> |
| 333: | |
| 334: | <p> |
| 335: | <select id="<?php echo esc_attr( $this->get_field_id( 'p_number' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'p_number' ) ); ?>"> |
| 336: | <?php |
| 337: | for ( $i = 1;$i <= 20;$i++ ) { |
| 338: | echo '<option value="' . esc_attr( $i ) . '"'; |
| 339: | if ( $i == $instance['p_number'] ) { |
| 340: | echo ' selected="selected"'; |
| 341: | } echo '>' . esc_html( $i ) . '</option>'; |
| 342: | } |
| 343: | ?> |
| 344: | </select> |
| 345: | <label for="<?php echo esc_attr( $this->get_field_id( 'p_number' ) ); ?>"><?php esc_html_e( 'Number of Properties', 'easy-property-listings' ); ?></label> |
| 346: | </p> |
| 347: | |
| 348: | <p> |
| 349: | <select id="<?php echo esc_attr( $this->get_field_id( 'p_skip' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'p_skip' ) ); ?>"> |
| 350: | <?php |
| 351: | for ( $i = 0;$i <= 20;$i++ ) { |
| 352: | echo '<option value="' . esc_attr( $i ) . '"'; |
| 353: | if ( $i == $instance['p_skip'] ) { |
| 354: | echo ' selected="selected"'; |
| 355: | } echo '>' . esc_html( $i ) . '</option>'; |
| 356: | } |
| 357: | ?> |
| 358: | </select> |
| 359: | <label for="<?php echo esc_attr( $this->get_field_id( 'p_skip' ) ); ?>"><?php esc_html_e( 'Properties to Skip', 'easy-property-listings' ); ?></label> |
| 360: | </p> |
| 361: | |
| 362: | <p> |
| 363: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'featured' ) ); ?>" |
| 364: | <?php |
| 365: | if ( $instance['featured'] ) { |
| 366: | echo 'checked="checked"';} |
| 367: | ?> |
| 368: | /> |
| 369: | <label for="<?php echo esc_attr( $this->get_field_id( 'featured' ) ); ?>"><?php esc_html_e( 'Featured Properties', 'easy-property-listings' ); ?></label> |
| 370: | </p> |
| 371: | |
| 372: | <p> |
| 373: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'open_house' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'open_house' ) ); ?>" |
| 374: | <?php |
| 375: | if ( $instance['open_house'] ) { |
| 376: | echo 'checked="checked"';} |
| 377: | ?> |
| 378: | /> |
| 379: | <label for="<?php echo esc_attr( $this->get_field_id( 'open_house' ) ); ?>"><?php echo esc_html( epl_labels( 'label_home_open' ) ) . ' ' . esc_html__( 'Listings', 'easy-property-listings' ); ?></label> |
| 380: | </p> |
| 381: | |
| 382: | <p> |
| 383: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'archive' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'archive' ) ); ?>" |
| 384: | <?php |
| 385: | if ( $instance['archive'] ) { |
| 386: | echo 'checked="checked"';} |
| 387: | ?> |
| 388: | /> |
| 389: | <label for="<?php echo esc_attr( $this->get_field_id( 'archive' ) ); ?>"><?php esc_html_e( 'Dynamic', 'easy-property-listings' ); ?></label> |
| 390: | </p> |
| 391: | |
| 392: | <p> |
| 393: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'order_rand' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'order_rand' ) ); ?>" |
| 394: | <?php |
| 395: | if ( $instance['order_rand'] ) { |
| 396: | echo 'checked="checked"';} |
| 397: | ?> |
| 398: | /> |
| 399: | <label for="<?php echo esc_attr( $this->get_field_id( 'order_rand' ) ); ?>"><?php esc_html_e( 'Random Order', 'easy-property-listings' ); ?></label> |
| 400: | </p> |
| 401: | |
| 402: | <p> <strong><?php esc_html_e( 'Display Settings', 'easy-property-listings' ); ?></strong></p> |
| 403: | |
| 404: | <p> |
| 405: | <label for="<?php echo esc_attr( $this->get_field_id( 'view' ) ); ?>"><?php esc_html_e( 'View', 'easy-property-listings' ); ?></label> |
| 406: | <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'view' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'view' ) ); ?>"> |
| 407: | <?php |
| 408: | $options = apply_filters( 'epl_listing_widget_view', array( 'default' => __( 'Default', 'easy-property-listings' ) ) ); |
| 409: | if ( count( $options ) ) { |
| 410: | foreach ( $options as $key => $value ) { |
| 411: | echo '<option value="' . esc_attr( $key ) . '"' . selected( $key, $instance['view'], false ) . '>' . esc_html( $value ) . '</option>'; |
| 412: | } |
| 413: | } |
| 414: | ?> |
| 415: | </select> |
| 416: | </p> |
| 417: | |
| 418: | <p> |
| 419: | <label for="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>"><?php esc_html_e( 'Display Style', 'easy-property-listings' ); ?></label> |
| 420: | <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'display' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'display' ) ); ?>"> |
| 421: | <?php |
| 422: | |
| 423: | |
| 424: | |
| 425: | |
| 426: | |
| 427: | |
| 428: | |
| 429: | $options = apply_filters( |
| 430: | 'epl_listing_widget_templates', |
| 431: | array( |
| 432: | 'image' => __( 'Image', 'easy-property-listings' ), |
| 433: | 'image-only' => __( 'Image Only', 'easy-property-listings' ), |
| 434: | 'hide-image' => __( 'Hide Image', 'easy-property-listings' ), |
| 435: | 'list' => __( 'List', 'easy-property-listings' ), |
| 436: | ) |
| 437: | ); |
| 438: | foreach ( $options as $option_key => $option_label ) { |
| 439: | echo '<option value="' . esc_attr( $option_key ) . '" id="' . esc_attr( $option_key ) . '"', $instance['display'] === $option_key ? ' selected="selected"' : '', '>', esc_html( $option_label ), '</option>'; |
| 440: | } |
| 441: | ?> |
| 442: | </select> |
| 443: | </p> |
| 444: | |
| 445: | <p> |
| 446: | <label for="<?php echo esc_attr( $this->get_field_id( 'image' ) ); ?>"><?php esc_html_e( 'Image Size', 'easy-property-listings' ); ?></label> |
| 447: | <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'image' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'image' ) ); ?>"> |
| 448: | <?php |
| 449: | $sizes = epl_get_thumbnail_sizes(); |
| 450: | foreach ( $sizes as $k => $v ) { |
| 451: | $v = implode( ' x ', $v ); |
| 452: | echo '<option class="widefat" value="' . esc_attr( $k ) . '" id="' . esc_attr( $k ) . '"', $instance['image'] === $k ? ' selected="selected"' : '', '>', esc_html( $k ) . ' (' . esc_html( $v ) . ' )', '</option>'; |
| 453: | } |
| 454: | ?> |
| 455: | </select> |
| 456: | </p> |
| 457: | |
| 458: | <p> |
| 459: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_icons' ) ); ?>"><?php esc_html_e( 'Icon Style', 'easy-property-listings' ); ?></label> |
| 460: | <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'd_icons' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_icons' ) ); ?>"> |
| 461: | <?php |
| 462: | $options = array( 'none', 'all', 'beds/baths' ); |
| 463: | foreach ( $options as $option ) { |
| 464: | echo '<option value="' . esc_attr( $option ) . '" id="' . esc_attr( $option ) . '"', $instance['d_icons'] === $option ? ' selected="selected"' : '', '>', esc_html( $option ), '</option>'; |
| 465: | } |
| 466: | ?> |
| 467: | </select> |
| 468: | </p> |
| 469: | |
| 470: | |
| 471: | |
| 472: | <p> |
| 473: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_title' ) ); ?>" |
| 474: | <?php |
| 475: | if ( $instance['d_title'] ) { |
| 476: | echo 'checked="checked"';} |
| 477: | ?> |
| 478: | /> |
| 479: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_title' ) ); ?>"><?php esc_html_e( 'Property Headline', 'easy-property-listings' ); ?></label> |
| 480: | </p> |
| 481: | |
| 482: | <p> |
| 483: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_excerpt' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_excerpt' ) ); ?>" |
| 484: | <?php |
| 485: | if ( $instance['d_excerpt'] ) { |
| 486: | echo 'checked="checked"';} |
| 487: | ?> |
| 488: | /> |
| 489: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_excerpt' ) ); ?>"><?php esc_html_e( 'Excerpt', 'easy-property-listings' ); ?></label> |
| 490: | </p> |
| 491: | |
| 492: | <p> |
| 493: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_suburb' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_suburb' ) ); ?>" |
| 494: | <?php |
| 495: | if ( $instance['d_suburb'] ) { |
| 496: | echo 'checked="checked"';} |
| 497: | ?> |
| 498: | /> |
| 499: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_suburb' ) ); ?>"><?php echo esc_html( epl_labels( 'label_suburb' ) ); ?></label> |
| 500: | </p> |
| 501: | |
| 502: | <p> |
| 503: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_street' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_street' ) ); ?>" |
| 504: | <?php |
| 505: | if ( $instance['d_street'] ) { |
| 506: | echo 'checked="checked"';} |
| 507: | ?> |
| 508: | /> |
| 509: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_street' ) ); ?>"><?php esc_html_e( 'Street Address', 'easy-property-listings' ); ?></label> |
| 510: | </p> |
| 511: | |
| 512: | <p> |
| 513: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_price' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_price' ) ); ?>" |
| 514: | <?php |
| 515: | if ( $instance['d_price'] ) { |
| 516: | echo 'checked="checked"';} |
| 517: | ?> |
| 518: | /> |
| 519: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_price' ) ); ?>"><?php esc_html_e( 'Price', 'easy-property-listings' ); ?></label> |
| 520: | </p> |
| 521: | |
| 522: | <p> |
| 523: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_inspection_time' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_inspection_time' ) ); ?>" |
| 524: | <?php |
| 525: | if ( $instance['d_inspection_time'] ) { |
| 526: | echo 'checked="checked"';} |
| 527: | ?> |
| 528: | /> |
| 529: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_inspection_time' ) ); ?>"><?php esc_html_e( 'Inspection Times', 'easy-property-listings' ); ?></label> |
| 530: | </p> |
| 531: | |
| 532: | <p> |
| 533: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_ical_link' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_ical_link' ) ); ?>" |
| 534: | <?php |
| 535: | if ( $instance['d_ical_link'] ) { |
| 536: | echo 'checked="checked"';} |
| 537: | ?> |
| 538: | /> |
| 539: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_ical_link' ) ); ?>"><?php esc_html_e( 'Inspection Time iCal Link', 'easy-property-listings' ); ?></label> |
| 540: | </p> |
| 541: | |
| 542: | <p> |
| 543: | <input type="checkbox" id="<?php echo esc_attr( $this->get_field_id( 'd_more' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'd_more' ) ); ?>" |
| 544: | <?php |
| 545: | if ( $instance['d_more'] ) { |
| 546: | echo 'checked="checked"';} |
| 547: | ?> |
| 548: | /> |
| 549: | <label for="<?php echo esc_attr( $this->get_field_id( 'd_more' ) ); ?>"><?php esc_html_e( 'Read More Button', 'easy-property-listings' ); ?></label> |
| 550: | </p> |
| 551: | |
| 552: | <p> |
| 553: | <label for="<?php echo esc_attr( $this->get_field_id( 'more_text' ) ); ?>"><?php esc_html_e( 'Read More Label', 'easy-property-listings' ); ?></label> |
| 554: | <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'more_text' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'more_text' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['more_text'] ); ?>" /> |
| 555: | </p> |
| 556: | |
| 557: | <?php |
| 558: | } |
| 559: | } |
| 560: | |
| 561: | |
| 562: | |
| 563: | |
| 564: | |
| 565: | |
| 566: | |
| 567: | |
| 568: | |
| 569: | function epl_register_widget_recent_property() { |
| 570: | register_widget( 'EPL_Widget_Recent_Property' ); |
| 571: | } |
| 572: | add_action( 'widgets_init', 'epl_register_widget_recent_property' ); |
| 573: | |
| 574: | |