Exemplo n.º 1
0
 public static function load($old_image = '', $args = null)
 {
     $new_image = false;
     if (isset($args['fancybox']) && $args['fancybox']) {
         unset($args['fancybox']);
     }
     $args = self::process_defaults($args);
     $disable_dragonfly = pls_get_option('pls-disable-dragonfly');
     // use standard default image
     if ($old_image === '' || empty($old_image)) {
         if (!empty($args['null_image'])) {
             $old_image = $args['null_image'];
         } else {
             $old_image = PLS_IMG_URL . "/null/listing-1200x720.jpg";
         }
     } elseif ($args['allow_resize'] && $args['resize']['w'] && $args['resize']['h'] && get_theme_support('pls-dragonfly') && $disable_dragonfly != true) {
         $img_args = array('resize' => $args['resize'], 'old_image' => $old_image);
         $new_image = PLS_Plugin_API::resize_image($img_args);
     }
     if ($args['fancybox'] || $args['as_html']) {
         if ($new_image) {
             $new_image = self::as_html($old_image, $new_image, $args);
         } else {
             $new_image = self::as_html($old_image, null, $args);
         }
     }
     // return the new image if we've managed to create one
     if ($new_image) {
         return $new_image;
     } else {
         return $old_image;
     }
 }
Exemplo n.º 2
0
 public static function update()
 {
     $person_details = $_POST;
     $result = PLS_Plugin_API::update_person_details($person_details);
     echo json_encode($result);
     die;
 }
Exemplo n.º 3
0
 public static function get_brick_listings($listing_params, $featured_option_id)
 {
     // Try to set to featured listings if param is set...
     $brick_listings = $featured_option_id ? PLS_Listing_Helper::get_featured($featured_option_id) : array();
     // If featured listings param is false OR there are no featured listings, chose some randomly...
     if (empty($brick_listings['listings'])) {
         $brick_listings = PLS_Plugin_API::get_listings($listing_params);
     }
     return $brick_listings['listings'];
 }
Exemplo n.º 4
0
 public static function get_listings()
 {
     $response = array();
     //exact addresses should be shown.
     $_POST['address_mode'] = 'exact';
     // Sorting
     $columns = array('location.address');
     $_POST['sort_by'] = $columns[$_POST['iSortCol_0']];
     $_POST['sort_type'] = $_POST['sSortDir_0'];
     if (isset($_POST['agency_only']) && $_POST['agency_only'] == 'on') {
         $_POST['agency_only'] = 1;
     }
     if (isset($_POST['non_import']) && $_POST['non_import'] == 'on') {
         $_POST['non_import'] = 1;
     }
     // text searching on address
     // $_POST['location']['address'] = @$_POST['sSearch'];
     $_POST['location']['address_match'] = 'like';
     // Pagination
     $_POST['limit'] = $_POST['iDisplayLength'];
     $_POST['offset'] = $_POST['iDisplayStart'];
     // Get listings from model
     $api_response = PLS_Plugin_API::get_listings($_POST, false);
     // build response for datatables.js
     $listings = array();
     foreach ($api_response['listings'] as $key => $listing) {
         $listings[$key][] = $listing['location']['address'] . ', ' . $listing['location']['locality'] . ' ' . $listing['location']['region'];
         $listings[$key][] = !empty($listing['images']) ? '<a id="listing_image" href="' . $listing['images'][0]['url'] . '"  style="display: inline-block" onclick=\'return false;\'>Preview</a>' : 'No Image';
         $listings[$key][] = '<a id="pls_add_option_listing" href="#" ref="' . $listing['id'] . '">Make Featured</a>';
     }
     // Required for datatables.js to function properly.
     $response['sEcho'] = $_POST['sEcho'];
     $response['aaData'] = $listings;
     $response['iTotalRecords'] = $api_response['total'];
     $response['iTotalDisplayRecords'] = $api_response['total'];
     echo json_encode($response);
     //wordpress echos out a 0 randomly. die prevents it.
     die;
 }
Exemplo n.º 5
0
    public function widget($args, $instance)
    {
        // Widget output
        ?>
		<?php 
        extract($args);
        ?>

    <?php 
        $agent = PLS_Plugin_API::get_user_details();
        ?>
   
		<section class="widget pls-map widget-pls-map" itemscope itemtype="http://schema.org/LocalBusiness">
			<?php 
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        ?>
			<?php 
        $subtitle = empty($instance['subtitle']) ? ' ' : apply_filters('subtitle', $instance['subtitle']);
        ?>
			<?php 
        $street_address = empty($instance['street_address']) ? ' ' : apply_filters('street_address', $instance['street_address']);
        ?>
			<?php 
        $city_state_zip = empty($instance['city_state_zip']) ? ' ' : apply_filters('city_state_zip', $instance['city_state_zip']);
        ?>
			<?php 
        $lat = empty($instance['lat']) ? ' ' : apply_filters('lat', $instance['lat']);
        ?>
			<?php 
        $lng = empty($instance['lng']) ? ' ' : apply_filters('lng', $instance['lng']);
        ?>
			<?php 
        $width = empty($instance['width']) ? ' ' : apply_filters('width', $instance['width']);
        ?>
			<?php 
        $height = empty($instance['height']) ? ' ' : apply_filters('height', $instance['height']);
        ?>

			<h3><?php 
        echo $title;
        ?>
</h3>

			<section id="map-widget">

        <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>

				<script type="text/javascript">
					jQuery(document).ready(function () {

								var myOptions = {
									center: new google.maps.LatLng(<?php 
        echo $lat;
        ?>
, <?php 
        echo $lng;
        ?>
),
									zoom: 12,
									mapTypeId: google.maps.MapTypeId.ROADMAP
								};
							
								var map = new google.maps.Map(document.getElementById("simple_map"),
									myOptions);
							
								var position = new google.maps.LatLng(<?php 
        echo $lat;
        ?>
, <?php 
        echo $lng;
        ?>
);
								var marker = new google.maps.Marker({
									position: position,
									map: map,
								});
						});
				</script>

			<div id="simple_map" style="width: <?php 
        echo $width;
        ?>
px; height: <?php 
        echo $height;
        ?>
px;"></div>

        <span itemprop="name" style="display:none;"><?php 
        echo $agent['provider']['name'];
        ?>
</span>
				<p class="office p4" itemprop="description"><?php 
        echo $subtitle;
        ?>
</p>
				<p class="address h5" itemprop="address"><?php 
        echo $street_address;
        ?>
 <br><?php 
        echo $city_state_zip;
        ?>
</p>

			</section><!-- /#map-widget -->

		</section><!-- /.widget-pls-quick-search -->
		<?php 
    }
Exemplo n.º 6
0
 public static function get($args = array())
 {
     $cache = new PLS_Cache('nbh');
     if ($result = $cache->get($args)) {
         return $result;
     }
     extract(self::process_args($args), EXTR_SKIP);
     $subject = array();
     if ($street) {
         $subject += array('taxonomy' => 'street', 'term' => $street, 'api_field' => 'address');
     } elseif ($neighborhood) {
         $subject += array('taxonomy' => 'neighborhood', 'term' => $neighborhood, 'api_field' => 'neighborhood');
     } elseif ($zip) {
         $subject += array('taxonomy' => 'zip', 'term' => $zip, 'api_field' => 'postal');
     } elseif ($city) {
         $subject += array('taxonomy' => 'city', 'term' => $city, 'api_field' => 'locality');
     } elseif ($state) {
         $subject += array('taxonomy' => 'state', 'term' => $state, 'api_field' => 'region');
     }
     $term = get_term_by('slug', $subject['term'], $subject['taxonomy'], ARRAY_A);
     $custom_data = array();
     foreach (self::$custom_meta as $meta) {
         $custom_data[$meta['id']] = get_tax_meta($term['term_id'], $meta['id']);
     }
     $term = wp_parse_args($term, $custom_data);
     $term['api_field'] = $subject['api_field'];
     //if there's a polygon, use that to get listings. Otherwise, use the name of the neighborhood
     $polygon = PLS_Plugin_API::get_taxonomies_by_slug($subject['term']);
     if (is_array($polygon) && !empty($polygon[0])) {
         $polygon[0]['neighborhood_polygons'] = $polygon[0]['name'];
         $listings_raw = PLS_Plugin_API::get_polygon_listings($polygon[0]);
         $term['listings'] = PLS_Partials::get_listings("limit=5&context=home&neighborhood_polygons=" . $polygon[0]['name']);
     } else {
         $listings_raw = PLS_Plugin_API::get_listings("location[" . $term['api_field'] . "]=" . $term['name']);
         $term['listings'] = PLS_Partials::get_listings("limit=5&context=home&request_params=location[" . $term['api_field'] . "]=" . $term['name']);
     }
     $term['areas'] = array('locality' => array(), 'postal' => array(), 'neighborhood' => array(), 'address' => array());
     $locality_tree = array('city' => array('postal', 'neighborhood', 'address'), 'zip' => array('neighborhood', 'address'), 'neighborhood' => array('address'), 'street' => array());
     $term['listings_raw'] = $listings_raw['listings'];
     //assemble all the photos
     $api_translations = array('locality' => 'city', 'neighborhood' => 'neighborhood', 'postal' => 'zip', 'address' => 'street');
     $term['listing_photos'] = array();
     $count = 0;
     if (isset($listings_raw['listings'])) {
         foreach ($listings_raw['listings'] as $key => $listing) {
             if (!empty($listing['images'])) {
                 foreach ($listing['images'] as $image) {
                     if ($count > $image_limit) {
                         break;
                     }
                     $term['listing_photos'][] = array('full_address' => $listing['location']['full_address'], 'image_url' => $image['url'], 'listing_url' => $listing['cur_data']['url']);
                     $count++;
                 }
             }
             if (isset($locality_tree[$subject['taxonomy']])) {
                 foreach ($locality_tree[$subject['taxonomy']] as $locality) {
                     $link = array('name' => $listing['location'][$locality], 'permalink' => get_term_link($listing['location'][$locality], $api_translations[$locality]));
                     if (is_string($link['permalink'])) {
                         $term['areas'][$locality][] = $link;
                     }
                 }
             }
         }
     }
     $term['polygon'] = PLS_Plugin_API::get_polygon_detail(array('tax' => $term['api_field'], 'slug' => $subject['term']));
     $cache->save($term);
     return $term;
 }
Exemplo n.º 7
0
function tampa_custom_home_listing_list($listing_html, $listing_data)
{
    // pls_dump($listing_data);
    ob_start();
    ?>
		<section class="list-unit">

			<section class="lu-left">
				<?php 
    if (isset($listing_data['images']) && is_array($listing_data['images'])) {
        ?>
		      	<?php 
        echo PLS_Image::load($listing_data['images'][0]['url'], array('resize' => array('w' => 144, 'h' => 93, 'method' => 'crop'), 'fancybox' => true));
        ?>
					<?php 
    } else {
        ?>
					<?php 
        echo PLS_Image::load('', array('resize' => array('w' => 144, 'h' => 93, 'method' => 'crop'), 'fancybox' => true));
        ?>
		     <?php 
    }
    ?>

     		<?php 
    if (isset($listing_data['rets']['mls_id']) && $listing_data['rets']['mls_id']) {
        ?>
       		<p class="mls"><span>MLS #:</span> <?php 
        echo $listing_data['rets']['mls_id'];
        ?>
</p>
       		<?php 
    }
    ?>

			</section>	

			<section class="lu-right">
				<div class="lu-address">
					<h4><a href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><?php 
    echo $listing_data['location']['address'];
    ?>
</a></h4>
					<p class="area"><?php 
    echo $listing_data['location']['locality'];
    ?>
, <?php 
    echo $listing_data['location']['region'];
    ?>
</p>
				</div><!--lu-address-->

				<div class="lu-price">
					<p class="price"><strong><?php 
    echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
    ?>
</strong><?php 
    if ($listing_data['cur_data']['lse_trms'] != null) {
        echo $listing_data['cur_data']['lse_trms'];
    }
    ?>
</p>
					<p class="rent-label"><?php 
    if (isset($listing_data['purchase_types'][0])) {
        echo ucwords($listing_data['purchase_types'][0]);
    }
    ?>
</p>
				</div><!--lu-price-->

				<div class="lu-main">
				<?php 
    if (isset($listing_data['cur_data']['desc'])) {
        echo '<p>';
        if (strlen($listing_data['cur_data']['desc']) < 200) {
            echo $listing_data['cur_data']['desc'];
        } else {
            $position = strrpos(substr($listing_data['cur_data']['desc'], 0, 200), ' ');
            echo substr($listing_data['cur_data']['desc'], 0, $position) . '...';
        }
        echo '</p>';
    }
    ?>
					<p class="info"><span><?php 
    echo $listing_data['cur_data']['beds'];
    ?>
</span> Bedrooms | <span><?php 
    echo $listing_data['cur_data']['baths'];
    ?>
</span> Bathrooms 
						<?php 
    if ($listing_data['cur_data']['sqft'] != null) {
        echo '| <span>' . PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false)) . '</span> sqft';
    }
    ?>
</p>
					<!-- <a class="fav" href="#">Add to Favorites</a> -->					
				<?php 
    $api_whoami = PLS_Plugin_API::get_user_details();
    ?>

				<?php 
    if (pls_get_option('pls-user-email')) {
        ?>
					<a class="info-bt" href="mailto:<?php 
        echo pls_get_option('pls-user-email');
        ?>
" target="_blank"><?php 
        _e('Request Information', 'tampa');
        ?>
</a>
				<?php 
    } else {
        ?>
					<a class="info-bt" href="mailto:<?php 
        echo $api_whoami['user']['email'];
        ?>
" target="_blank"><?php 
        _e('Request Information', 'tampa');
        ?>
</a>
				<?php 
    }
    ?>
					<a class="see-details-link details-bt" href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><?php 
    _e('See Details', 'tampa');
    ?>
</a>
				</div><!--lu-main-->
			</section><!--lu-right-->
    <?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'inline_search', 'agent_name' => $listing_data['rets']['aname'], 'office_name' => $listing_data['rets']['oname'], 'office_phone' => PLS_Format::phone($listing_data['contact']['phone']), 'agent_license' => isset($listing_data['rets']['alicense']) ? $listing_data['rets']['alicense'] : false, 'co_agent_name' => isset($listing_data['rets']['aconame']) ? $listing_data['rets']['aconame'] : false, 'co_office_name' => isset($listing_data['rets']['oconame']) ? $listing_data['rets']['oconame'] : false));
    ?>
			<div class="clr"></div>

		</section><!--list-unit-->
     <?php 
    $listing_html = ob_get_clean();
    return $listing_html;
}
Exemplo n.º 8
0
<?php

$email = pls_get_option('pls-user-email');
$phone = pls_get_option('pls-user-phone');
$email_str = $phone_str = $contact_str = '';
$street = pls_get_option('pls-company-street');
$locality = pls_get_option('pls-company-locality');
$region = pls_get_option('pls-company-region');
$postal = pls_get_option('pls-company-postal');
$street_str = $address_str = '';
$agent = PLS_Plugin_API::get_user_details();
$email = strval($email ? $email : $agent['user']['email']);
$phone = strval($phone ? $phone : $agent['user']['phone']);
$street = strval($street ? $street : $agent['location']['address']);
$locality = strval($locality ? $locality : $agent['location']['locality']);
$region = strval($region ? $region : $agent['location']['region']);
$postal = strval($postal ? $postal : $agent['location']['postal']);
if ($email) {
    $email_str = sprintf(__('Email: <a href="mailto:%s">%s</a><br />', 'manchester'), esc_attr($email), esc_html($email));
}
if ($phone) {
    $phone_str = sprintf(__('Phone: <strong>%s</strong>', 'manchester'), esc_html($phone));
}
if ($email_str || $phone_str) {
    $contact_str = sprintf('<p class="contact">%s%s</p>', $email_str, $phone_str);
}
if ($street) {
    $street_str = esc_html($street) . '<br />';
}
if ($street || $locality || $region || $postal) {
    $address_str = sprintf('<p class="address">%s %s %s %s<br /></p>', $street_str, esc_html($locality), esc_html($region), esc_html($postal));
<?php

if (is_user_logged_in() && class_exists('Placester_Contact_Widget')) {
    ?>
	<?php 
    extract(PLS_Plugin_API::get_person_details());
    ?>
	<?php 
    //pls_dump(PLS_Plugin_API::get_person_details());
    ?>

<aside class="grid_4 omega sidebar">

	<section class="widget widget-pls-recent-posts">

		<div id="edit_profile" style="display:none;">
			<div id="edit_profile_message"></div>
			<form id="edit_profile_form">
				<div>
					<label>Name</label>	
					<input type="text" name="metadata[name]" value="<?php 
    echo @$cur_data['name'];
    ?>
" >
				</div>
				<div>
					<label>Company</label>	
					<input type="text" name="metadata[company]" value="<?php 
    echo @$cur_data['company'];
    ?>
">
Exemplo n.º 10
0
function manchester_custom_home_listing_list($listing_html, $listing_data)
{
    // pls_dump($listing_data);
    ob_start();
    ?>

<section class="list-item">                                                  
	
	<section class="list-pic">

		<div class="thumbs">
			<?php 
    if (isset($listing_data['images']) && is_array($listing_data['images'])) {
        ?>
        	<?php 
        echo PLS_Image::load($listing_data['images'][0]['url'], array('resize' => array('w' => 144, 'h' => 93, 'method' => 'crop'), 'fancybox' => true));
        ?>
    	
				<?php 
    } else {
        ?>
				<?php 
        echo PLS_Image::load('', array('resize' => array('w' => 144, 'h' => 93, 'method' => 'crop'), 'fancybox' => true));
        ?>
       <?php 
    }
    ?>
		</div>

		<?php 
    if (isset($listing_data['rets']['mls_id'])) {
        ?>
  		<p class="nrm-txt"><?php 
        _e('MLS', 'manchester');
        ?>
 #: <?php 
        echo $listing_data['rets']['mls_id'];
        ?>
</p>
  	<?php 
    }
    ?>

	</section>

	<section class="list-txt">

		<section class="list-info">

			<h5><a href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><?php 
    echo $listing_data['location']['address'];
    ?>
</a></h5>
			<h6><?php 
    echo $listing_data['location']['locality'];
    ?>
, <?php 
    echo $listing_data['location']['region'];
    ?>
</h6>
				<?php 
    if (isset($listing_data['cur_data']['desc'])) {
        echo '<p class="nrm-txt">';
        if (strlen($listing_data['cur_data']['desc']) < 150) {
            echo $listing_data['cur_data']['desc'];
        } else {
            $position = strrpos(substr($listing_data['cur_data']['desc'], 0, 150), ' ');
            echo substr($listing_data['cur_data']['desc'], 0, $position) . '...';
        }
        echo '</p>';
    }
    ?>

			<p class="nrm-txt">
				<b><?php 
    echo $listing_data['cur_data']['beds'];
    ?>
</b> <span class="beds-n-baths"><?php 
    _e('Beds', 'manchester');
    ?>
</span> | 
				<b><?php 
    echo $listing_data['cur_data']['baths'];
    ?>
</b> <span class="beds-n-baths"><?php 
    _e('Baths', 'manchester');
    ?>
</span> 
				<?php 
    if (isset($listing_data['cur_data']['sqft'])) {
        echo '| <b>' . PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false)) . '</b><span class="beds-n-baths"> ' . __('sqft', 'manchester') . '</span>';
    }
    ?>
			</p>

		</section><!-- /list-info -->

		<section class="list-price">
			
			<span class="green"><b><?php 
    echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false));
    ?>
</b>
			<?php 
    if ($listing_data['cur_data']['lse_trms'] != null) {
        // translate lease terms to human form
        echo PLS_Format::translate_lease_terms($listing_data);
    }
    ?>
			</span><br />
			
			<span class="nrm-txt">
				<?php 
    if ($listing_data['property_type'] == "fam_home") {
        echo __("Single Family Home", 'manchester');
    } else {
        $prop_type_frmttd = is_array($listing_data['property_type']) ? implode($listing_data['property_type']) : $listing_data['property_type'];
        echo ucwords($prop_type_frmttd);
    }
    ?>
			</span>

		</section><!-- /list-price -->

		<section class="list-links">

			<!-- <section class="list-fav"><a href="#">Add to favorites</a></section> -->
			<?php 
    $api_whoami = PLS_Plugin_API::get_user_details();
    if (pls_get_option('pls-user-email')) {
        ?>
			<section class="list-req">
				<a href="mailto:<?php 
        echo pls_get_option('pls-user-email');
        ?>
" target="_blank"><?php 
        _e('Request more info', 'manchester');
        ?>
</a>
			</section>
			<?php 
    } else {
        ?>
			<section class="list-req">
				<a href="mailto:<?php 
        echo $api_whoami['user']['email'];
        ?>
"><?php 
        _e('Request more info', 'manchester');
        ?>
</a>
			</section>
			<?php 
    }
    ?>

			<section class="list-btn1">
				<div class="img_btn">
					<a href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><input type="submit" Value="<?php 
    _e('See Details', 'manchester');
    ?>
" class="button b-blue medium" /></a>
				</div>
			</section>

		</section><!-- /list-links -->

	</section><!-- /list-text -->

    <?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'inline_search', 'agent_name' => $listing_data['rets']['aname'], 'office_name' => $listing_data['rets']['oname'], 'office_phone' => PLS_Format::phone($listing_data['contact']['phone']), 'agent_license' => isset($listing_data['rets']['alicense']) ? $listing_data['rets']['alicense'] : false, 'co_agent_name' => isset($listing_data['rets']['aconame']) ? $listing_data['rets']['aconame'] : false, 'co_office_name' => isset($listing_data['rets']['oconame']) ? $listing_data['rets']['oconame'] : false));
    ?>
	
</section><!-- /list-item -->

<div class="separator-1-sma"></div>

<?php 
    // END FOR EACH
    ?>

     <?php 
    $listing_html = ob_get_clean();
    return $listing_html;
}
Exemplo n.º 11
0
    public static function get($args = array())
    {
        // Store this for use in the final output/response...
        $sEcho = isset($_POST['sEcho']) ? $_POST['sEcho'] : 0;
        unset($_POST['sEcho']);
        $context_orig = isset($_POST['context']) ? $_POST['context'] : '';
        unset($_POST['context']);
        // If length is not set for number of listings to return, set it to our Theme Options default
        $_POST['limit'] = isset($_POST['iDisplayLength']) ? $_POST['iDisplayLength'] : pls_get_option('listings_default_list_length');
        unset($_POST['iDisplayLength']);
        $_POST['offset'] = isset($_POST['iDisplayStart']) ? $_POST['iDisplayStart'] : 0;
        unset($_POST['iDisplayStart']);
        $saved_search_lookup = isset($_POST['saved_search_lookup']) ? $_POST['saved_search_lookup'] : null;
        unset($_POST['saved_search_lookup']);
        // Remove this so it doesn't accidentally end up as a superfluous argument of an API call...
        unset($_POST['action']);
        // Handle location edge-case...
        if (!empty($_POST['location']) && !empty($_POST['location']['address']) && empty($_POST['location']['address_match'])) {
            $_POST['location']['address_match'] = 'like';
        }
        // Handle saved search...
        if (!is_null($saved_search_lookup)) {
            // Attempt to retrieve search filters associated with the given saved search lookup ID...
            // NOTE: If no filters exist for the passed ID,
            $filters = PLS_Plugin_API::get_saved_search_filters($saved_search_lookup);
            if (empty($filters) || !is_array($filters)) {
                PLS_Plugin_API::save_search($saved_search_lookup, $_POST);
            } else {
                // For backwards compatibility, handle older fields that are no longer stored as saved search filters...
                $old_field_map = array('sEcho' => false, 'context' => false, 'iDisplayLength' => 'limit', 'iDisplayStart' => 'offset', 'saved_search_lookup' => false, 'action' => false);
                foreach ($old_field_map as $old => $new) {
                    if (isset($filters[$old])) {
                        if ($new !== false) {
                            $filters[$new] = $filters[$old];
                        }
                        unset($filters[$old]);
                    }
                }
                // Swap all existing POST filters for the ones associated with the retrieved saved search...
                $_POST = $filters;
            }
        }
        // Define the default argument array
        $defaults = array('loading_img' => admin_url('images/wpspin_light.gif'), 'image_width' => 100, 'crop_description' => 0, 'sort_type' => pls_get_option('listings_default_sort_type'), 'listings_per_page' => pls_get_option('listings_default_list_length'), 'context' => $context_orig, 'context_var' => NULL, 'append_to_map' => true, 'search_query' => $_POST, 'property_ids' => isset($_POST['property_ids']) ? $_POST['property_ids'] : '', 'allow_id_empty' => false);
        // Resolve function args with default ones (which include any existing POST fields)...
        $merged_args = wp_parse_args($args, $defaults);
        $cache = new PLS_Cache('list');
        if ($cached_response = $cache->get($merged_args)) {
            // This field must match the one passed in with this request...
            $cached_response['sEcho'] = $sEcho;
            echo json_encode($cached_response);
            die;
        }
        // Extract the arguments after they merged with the defaults
        extract($merged_args, EXTR_SKIP);
        // Start off with a placeholder in case the plugin is not active or there is no API key...
        $api_response = PLS_Listing_Helper::$default_listing;
        // If plugin is active, grab listings intelligently...
        if (!pls_has_plugin_error()) {
            // Get the listings list markup and JS
            if (!empty($property_ids) || $allow_id_empty) {
                // Sometimes property_ids are passed in as a flat screen from the JS post object
                if (is_string($property_ids)) {
                    $property_ids = explode(',', $property_ids);
                }
                $api_response = PLS_Plugin_API::get_listing_details(array('property_ids' => $property_ids, 'limit' => $_POST['limit'], 'offset' => $_POST['offset']));
            } elseif (isset($search_query['neighborhood_polygons']) && !empty($search_query['neighborhood_polygons'])) {
                $api_response = PLS_Plugin_API::get_polygon_listings($search_query);
            } else {
                $api_response = PLS_Plugin_API::get_listings($search_query);
            }
        }
        $response = array();
        // Build response for datatables.js
        $listings = array();
        $listings_cache = new PLS_Cache('Listing Thumbnail');
        foreach ($api_response['listings'] as $key => $listing) {
            // Check for cached listing thumbnail...
            $cache_id = array('context' => $context, 'listing_id' => $listing['id']);
            if (!($item_html = $listings_cache->get($cache_id))) {
                // Handle case of zero listing images...
                if (empty($listing['images'])) {
                    $listing['images'][0]['url'] = '';
                }
                ob_start();
                ?>
                    <div class="listing-item grid_8 alpha" itemscope itemtype="http://schema.org/Offer" data-listing="<?php 
                echo $listing['id'];
                ?>
">
                        <div class="listing-thumbnail grid_3 alpha">
                            <?php 
                $property_images = is_array($listing['images']) ? $listing['images'] : array();
                usort($property_images, array(__CLASS__, 'order_images'));
                ?>
                              
                             <a href="<?php 
                echo @$listing['cur_data']['url'];
                ?>
" itemprop="url">
                                <?php 
                echo PLS_Image::load($property_images[0]['url'], array('resize' => array('w' => 210, 'h' => 140), 'fancybox' => true, 'as_html' => true, 'html' => array('alt' => $listing['location']['full_address'], 'itemprop' => 'image', 'placeholder' => PLS_IMG_URL . "/null/listing-300x180.jpg")));
                ?>
                            </a>
                        </div>

                        <div class="listing-item-details grid_5 omega">
                            <header>
                                <p class="listing-item-address h4" itemprop="name">
                                    <a href="<?php 
                echo PLS_Plugin_API::get_property_url($listing['id']);
                ?>
" rel="bookmark" title="<?php 
                echo $listing['location']['address'];
                ?>
" itemprop="url">
                                        <?php 
                echo $listing['location']['address'] . ', ' . $listing['location']['locality'] . ' ' . $listing['location']['region'] . ' ' . $listing['location']['postal'];
                ?>
                                    </a>
                                </p>
                            </header>

                            <div class="basic-details">
                                <ul>
                                  	<?php 
                if (!empty($listing['cur_data']['beds'])) {
                    ?>
                                  		<li class="basic-details-beds p1"><span>Beds:</span> <?php 
                    echo @$listing['cur_data']['beds'];
                    ?>
</li>
                                  	<?php 
                }
                ?>

                                  	<?php 
                if (!empty($listing['cur_data']['baths'])) {
                    ?>
                                  		<li class="basic-details-baths p1"><span>Baths:</span> <?php 
                    echo @$listing['cur_data']['baths'];
                    ?>
</li>
                                  	<?php 
                }
                ?>

                                  	<?php 
                if (!empty($listing['cur_data']['half_baths'])) {
                    ?>
                                  		<li class="basic-details-half-baths p1"><span>Half Baths:</span> <?php 
                    echo @$listing['cur_data']['half_baths'];
                    ?>
</li>
                                  	<?php 
                }
                ?>

                                  	<?php 
                if (!empty($listing['cur_data']['price'])) {
                    ?>
                                  		<li class="basic-details-price p1" itemprop="price"><span>Price:</span> <?php 
                    echo PLS_Format::number($listing['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
                    ?>
</li>
                                  	<?php 
                }
                ?>

                                  	<?php 
                if (!empty($listing['cur_data']['sqft'])) {
                    ?>
                                  		<li class="basic-details-sqft p1"><span>Sqft:</span> <?php 
                    echo PLS_Format::number($listing['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false));
                    ?>
</li>
                                  	<?php 
                }
                ?>

                                    <?php 
                if (!empty($listing['rets']['mls_id'])) {
                    ?>
                                        <li class="basic-details-mls p1"><span>MLS ID:</span> <?php 
                    echo @$listing['rets']['mls_id'];
                    ?>
</li>
                                    <?php 
                }
                ?>
                                </ul>
                            </div>

                            <p class="listing-description p4" itemprop="description">
                                <?php 
                echo substr($listing['cur_data']['desc'], 0, 300);
                ?>
                            </p>

                        </div>

                        <div class="actions">
                            <a class="more-link" href="<?php 
                echo PLS_Plugin_API::get_property_url($listing['id']);
                ?>
" itemprop="url">View Property Details</a>
                            <?php 
                echo PLS_Plugin_API::placester_favorite_link_toggle(array('property_id' => $listing['id']));
                ?>
                        </div>

                        <?php 
                PLS_Listing_Helper::get_compliance(array('context' => 'inline_search', 'agent_name' => @$listing['rets']['aname'], 'office_name' => @$listing['rets']['oname']));
                ?>
                    </div>
                <?php 
                $item_html = ob_get_clean();
                $item_html = apply_filters(pls_get_merged_strings(array("pls_listings_list_ajax_item_html", $context), '_', 'pre', false), htmlspecialchars_decode($item_html), $listing, $context_var);
                $listings_cache->save($item_html);
            }
            $listings[$key][] = $item_html;
            $listings[$key][] = $listing;
        }
        // Required for datatables.js to function properly...
        $response['sFirst'] = 'Previous';
        $response['sPrevious'] = 'Next';
        $response['sEcho'] = $sEcho;
        $response['aaData'] = $listings;
        $api_total = isset($api_response['total']) ? $api_response['total'] : 0;
        $response['iTotalRecords'] = $api_total;
        $response['iTotalDisplayRecords'] = $api_total;
        $cache->save($response);
        ob_start("ob_gzhandler");
        echo json_encode($response);
        // Wordpress echos out a "0" randomly -- die prevents this...
        die;
    }
Exemplo n.º 12
0
    /**
     * Returns a list of properties listed formated in a default html.
     *
     * This function takes the raw properties data returned by the plugin and
     * formats wrapps it in html. The returned html is filterable in multiple
     * ways.
     *
     * The defaults are as follows:
     *     'width' - Default 100. The listing image width. If set to 0,
     *          width is not added.
     *     'height' - Default false. The listing image height. If set to 0,
     *          width is not added.
     *     'placeholder_img' - Defaults to placeholder image. The path to the
     *          listing image that should be use if the listing has no images.
     *     'context' - An execution context for the function. Used when the
     *          filters are created.
     *     'context_var' - Any variable that needs to be passed to the filters
     *          when function is executed.
     *     'limit' - Default is 5. Total number of listings to retrieve. Maximum
     *          set to 50.
     * Defines the following filters:
     * pls_listings_request[_context] - Filters the request parameters.
     * pls_listing[_context] - Filters the individual listing html.
     * pls_listings[_context] - Filters the complete listings list html.
     *
     * @static
     * @param array|string $args Optional. Overrides defaults.
     * @return string The html with the list of properties.
     * @since 0.0.1
     */
    public static function init($args = '')
    {
        $cache = new PLS_Cache('list');
        if ($result = $cache->get($args)) {
            // return $result;
        }
        /** Define the default argument array. */
        $defaults = array('width' => 100, 'height' => 0, 'context' => '', 'context_var' => false, 'featured_option_id' => false, 'limit' => 5, 'sort_type' => 'asc', 'request_params' => '', 'neighborhood_polygons' => false);
        /** Merge the arguments with the defaults. */
        $args = wp_parse_args($args, $defaults);
        /** Extract the arguments after they merged with the defaults. */
        extract($args, EXTR_SKIP);
        // Sanitize the width
        if ($width) {
            $width = absint($width);
        }
        /** Sanitize the height. */
        if ($height) {
            $height = absint($height);
        }
        $request_params = wp_parse_args($args, array('limit' => $limit, 'sort_type' => $sort_type));
        // Filter the request parameters
        $request_params = apply_filters(pls_get_merged_strings(array('pls_listings_request', $context), '_', 'pre', false), $request_params, $context_var);
        // Start off with a placeholder in case the plugin is not active or there is no API key...
        $listings_raw = PLS_Listing_Helper::$default_listing;
        // If plugin is active, grab listings intelligently...
        if (!pls_has_plugin_error()) {
            $listings_raw = false;
            if ($featured_option_id) {
                $listings_raw = PLS_Listing_Helper::get_featured($featured_option_id, $args);
            }
            if ($neighborhood_polygons) {
                $listings_raw = PLS_Plugin_API::get_polygon_listings(array('neighborhood_polygons' => $neighborhood_polygons));
            }
            if ($listings_raw === false || isset($listings_raw['listings']) && empty($listings_raw['listings'])) {
                $listings_raw = PLS_Plugin_API::get_listings($request_params);
            }
        }
        /** Define variable which will contain the html string with the listings. */
        $return = '';
        /** Set the listing image attributes. */
        $listing_img_attr = array();
        if ($width) {
            $listing_img_attr['width'] = $width;
        }
        if ($height) {
            $listing_img_attr['height'] = $height;
        }
        /** Collect the html for each listing. */
        $listings_html = array();
        // filter listings before output
        if (isset($featured_listing_id)) {
            $listings_raw = apply_filters($context . '_partial_get_listings', $listings_raw, $featured_listing_id);
        }
        // For repeated use in the loop...
        $listing_cache = new PLS_Cache('Listing');
        // Curate the listing_data...
        foreach ($listings_raw['listings'] as $listing_data) {
            // Ignore featured listings without images
            if (!empty($args['featured_option_id']) && empty($listing_data['images'])) {
                continue;
            }
            $listing_html = '';
            $cache_id = array('context' => $context, 'featured_option_id' => $featured_option_id, 'listing_id' => $listing_data['id']);
            if ($cached_listing_html = $listing_cache->get($cache_id)) {
                $listing_html = $cached_listing_html;
            }
            if (empty($listing_html)) {
                // Use the placeholder image if the property has no photo
                if (!$listing_data['images']) {
                    $listing_data['images'][0]['url'] = '';
                    $listing_data['images'][0]['order'] = 0;
                }
                // Remove the ID for each image (not needed by theme developers) and add the image HTML
                foreach ($listing_data['images'] as $image) {
                    unset($image['id']);
                    $image['html'] = pls_h_img($image['url'], $listing_data['location']['address'], $listing_img_attr);
                }
                $location = $listing_data['location'];
                $full_address = $location['address'] . ' ' . $location['region'] . ', ' . $location['locality'] . ' ' . $location['postal'];
                ob_start();
                ?>
                <div class="listing-item grid_8 alpha" itemscope itemtype="http://schema.org/Offer">

                  <div class="listing-thumbnail grid_3 alpha">
                    <a href="<?php 
                echo @$listing_data['cur_data']['url'];
                ?>
">

                      <?php 
                $property_images = is_array($listing_data['images']) ? $listing_data['images'] : array();
                usort($property_images, array(__CLASS__, 'order_listing_images'));
                ?>
                      
                      <?php 
                echo PLS_Image::load($property_images[0]['url'], array('resize' => array('w' => 210, 'h' => 140), 'fancybox' => true, 'as_html' => true, 'html' => array('alt' => $listing_data['location']['full_address'], 'itemprop' => 'image')));
                ?>
                    

                    </a>
                  </div>

                  <div class="listing-item-details grid_5 omega">
                    <p class="listing-item-address h4" itemprop="name">
                      <a href="<?php 
                echo PLS_Plugin_API::get_property_url($listing_data['id']);
                ?>
" rel="bookmark" title="<?php 
                echo $listing_data['location']['address'];
                ?>
" itemprop="url">
                        <?php 
                echo $listing_data['location']['address'] . ', ' . $listing_data['location']['locality'] . ' ' . $listing_data['location']['region'] . ' ' . $listing_data['location']['postal'];
                ?>
                      </a>
                    </p>

                    <div class="basic-details">
                      <ul>
                        <?php 
                if (!empty($listing_data['cur_data']['beds'])) {
                    ?>
                          <li class="basic-details-beds p1"><span>Beds:</span> <?php 
                    echo @$listing_data['cur_data']['beds'];
                    ?>
</li>
                        <?php 
                }
                ?>

                        <?php 
                if (!empty($listing_data['cur_data']['baths'])) {
                    ?>
                          <li class="basic-details-baths p1"><span>Baths:</span> <?php 
                    echo @$listing_data['cur_data']['baths'];
                    ?>
</li>
                        <?php 
                }
                ?>

                        <?php 
                if (!empty($listing_data['cur_data']['half_baths'])) {
                    ?>
                          <li class="basic-details-half-baths p1"><span>Half Baths:</span> <?php 
                    echo @$listing_data['cur_data']['half_baths'];
                    ?>
</li>
                        <?php 
                }
                ?>

                        <?php 
                if (!empty($listing_data['cur_data']['price'])) {
                    ?>
                          <li class="basic-details-price p1" itemprop="price"><span>Price:</span> <?php 
                    echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
                    ?>
</li>
                        <?php 
                }
                ?>

                        <?php 
                if (!empty($listing_data['cur_data']['sqft'])) {
                    ?>
                          <li class="basic-details-sqft p1"><span>Sqft:</span> <?php 
                    echo PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false));
                    ?>
</li>
                        <?php 
                }
                ?>

                        <?php 
                if (!empty($listing_data['rets']['mls_id'])) {
                    ?>
                          <li class="basic-details-mls p1"><span>MLS ID:</span> <?php 
                    echo @$listing_data['rets']['mls_id'];
                    ?>
</li>
                        <?php 
                }
                ?>
                      </ul>
                    </div>

                    <p class="listing-description p4">
                      <?php 
                echo substr($listing_data['cur_data']['desc'], 0, 300);
                ?>
                    </p>

                  </div>

                  <div class="actions">
                    <a class="more-link" href="<?php 
                echo PLS_Plugin_API::get_property_url($listing_data['id']);
                ?>
" itemprop="url">View Property Details</a>
                    <?php 
                echo PLS_Plugin_API::placester_favorite_link_toggle(array('property_id' => $listing_data['id']));
                ?>
                  </div>

                  <?php 
                PLS_Listing_Helper::get_compliance(array('context' => 'inline_search', 'agent_name' => @$listing_data['rets']['aname'], 'office_name' => @$listing_data['rets']['oname']));
                ?>

                </div>
                <?php 
                // Store the output...
                $listing_html = ob_get_clean();
                // Filter (pls_listing[_context]) the resulting HTML for a single listing
                $listing_html = apply_filters(pls_get_merged_strings(array('pls_listing', $context), '_', 'pre', false), $listing_html, $listing_data, $request_params, $context_var);
                // Cache the result...
                $listing_cache->save($listing_html, PLS_Cache::TTL_LOW);
            }
            // Append the HTML to an array -- this will be passed to the final filter
            $listings_html[] = $listing_html;
            // Merge all the listings HTML
            $return .= $listing_html;
        }
        // Wrap the listings HTML
        $return = pls_h('section', array('class' => "pls-listings pls-listings " . pls_get_merged_strings(array('pls-listing', $context), '-', 'pre', false)), $return);
        // Filter (pls_listings[_context]) the resulting HTML that contains the collection of listings
        $return = apply_filters(pls_get_merged_strings(array('pls_listings', $context), '_', 'pre', false), $return, $listings_raw, $listings_html, $request_params, $context_var);
        $cache->save($return);
        return $return;
    }
Exemplo n.º 13
0
 class="option-pls-site-subtitle"><?php 
    bloginfo('description');
    ?>
</h2>
									<?php 
}
?>

                </hgroup>

                <?php 
pls_do_atomic('header');
?>

                <div class="header-membership"><?php 
echo PLS_Plugin_API::placester_lead_control_panel(array('separator' => '|'));
?>
</div>

            </div>

            <?php 
pls_do_atomic('before_nav');
?>

            <?php 
PLS_Route::get_template_part('menu', 'primary');
// Loads the menu-primary.php template.
?>

            <?php 
Exemplo n.º 14
0
 private static function empty_slides_and_add_random_listings()
 {
     $slides = array();
     $api_response = PLS_Plugin_API::get_listings(array('limit' => 6, 'offset' => 10));
     foreach ($api_response['listings'] as $listing) {
         $slides[] = array('type' => 'listing', $listing['id'] => $listing['location']['address']);
     }
     return $slides;
 }
Exemplo n.º 15
0
 public static function determine_appropriate_tags()
 {
     // Check for memoized return value...
     if (!empty(self::$page_tags)) {
         return self::$page_tags;
     }
     global $post;
     $tags = array();
     // get page template
     $page_template = self::determine_page_template();
     // determine $meta_tag_designations
     switch ($page_template) {
         case 'neighborhood':
             // Neighborhood / City Page
             $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
             $tags['title'] = $term->name;
             $tags['address'] = "";
             $descrip = strip_tags($term->description);
             $descrip_more = '';
             if (strlen($descrip) > 155) {
                 $descrip = substr($descrip, 0, 155);
                 $descrip_more = ' ...';
             }
             $descrip = str_replace('"', '', $descrip);
             $descrip = str_replace("'", '', $descrip);
             $descripwords = preg_split('/[\\n\\r\\t ]+/', $descrip, -1, PREG_SPLIT_NO_EMPTY);
             array_pop($descripwords);
             $tags['description'] = implode(' ', $descripwords) . $descrip_more;
             $image_array = get_tax_meta($term->term_id, 'image_1');
             $tags['image'] = isset($image_array['src']) ? $image_array['src'] : '';
             break;
         case 'search':
             $tags['itemtype'] = 'http://schema.org/LocalBusiness';
             $tags['title'] = 'Search results for: ' . get_search_query();
             break;
         case 'category':
             $category = get_the_category();
             $tags['title'] = $category[0]->cat_name;
             $tags['description'] = $category[0]->description;
             break;
         case 'date':
             if (is_day()) {
                 $tags['title'] = get_the_date() . ' Archives';
             } elseif (is_month()) {
                 $tags['title'] = get_the_date('F Y') . ' Archives';
             } elseif (is_year()) {
                 $tags['title'] = get_the_date('Y') . ' Archives';
             } else {
                 $tags['title'] = 'Blog Archives';
             }
             break;
         case 'tag':
             $tag = single_tag_title('', false);
             $tags['title'] = $tag . ' tagged posts';
             $tags['itemtype'] = 'http://schema.org/Blog';
             $tags['description'] = tag_description();
             break;
         case 'author':
             $tags['author'] = get_the_author();
             $tags['itemtype'] = 'http://schema.org/Blog';
             $tags['title'] = 'Author Archives: ' . get_the_author_meta('display_name', get_query_var('author'));
             // $image - should be author's face is one is set... could also check for same name in agent's list too.
             $tags['description'] = tag_description();
             break;
         case 'property':
             $content = get_option('placester_listing_layout');
             if (isset($content) && $content != '') {
                 return $content;
             }
             $html = '';
             $listing = PLS_Plugin_API::get_listing_in_loop();
             if (is_null($listing)) {
                 break;
             }
             // Single Property
             $tags['itemtype'] = 'http://schema.org/Offer';
             if (isset($listing['location']['unit']) && $listing['location']['unit'] != null) {
                 $tags['title'] = @$listing['location']['address'] . ', ' . $listing['location']['unit'] . ' ' . @$listing['location']['locality'] . ', ' . @$listing['location']['region'];
                 $tags['address'] = @$listing['location']['address'] . ', ' . $listing['location']['unit'] . ' ' . @$listing['location']['locality'] . ', ' . @$listing['location']['region'];
             } else {
                 $tags['title'] = @$listing['location']['address'] . ' ' . @$listing['location']['locality'] . ', ' . @$listing['location']['region'];
                 $tags['address'] = @$listing['location']['address'] . ' ' . @$listing['location']['locality'] . ', ' . @$listing['location']['region'];
             }
             $tags['image'] = @$listing['images']['0']['url'];
             $tags['description'] = esc_html(strip_tags($listing['cur_data']['desc']));
             break;
         case 'agent':
             $tags['itemtype'] = 'http://schema.org/RealEstateAgent';
             $tags['title'] = $post->post_title;
             break;
         case 'service':
             $tags['itemtype'] = 'http://schema.org/ProfessionalService';
             $tags['title'] = $post->post_title;
             break;
         case 'testimonial':
             $tags['itemtype'] = 'http://schema.org/Review';
             $tags['title'] = $post->post_title;
             break;
         case 'community':
             $tags['title'] = $post->post_title;
             $tags['description'] = PLS_Format::shorten_excerpt($post, 155);
             break;
         case 'single':
             $tags['itemtype'] = 'http://schema.org/BlogPosting';
             $tags['title'] = $post->post_title;
             if (has_post_thumbnail($post->ID)) {
                 $post_image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
                 $tags['image'] = $post_image[0];
             }
             $tags['description'] = PLS_Format::shorten_excerpt($post, 155);
             $tags['address'] = @pls_get_option('pls-company-street') . " " . @pls_get_option('pls-company-locality') . ", " . @pls_get_option('pls-company-region');
             $tags['author'] = $post->post_author;
             break;
         case 'other':
         default:
             // Home and other pages
             $tags['itemtype'] = 'http://schema.org/LocalBusiness';
             if (is_home()) {
                 $tags['title'] = pls_get_option('pls-company-name');
             } elseif (isset($post)) {
                 $values = get_post_custom($post->ID);
                 // give Yoast SEO a hand setting the title
                 $tags['title'] = !empty($values['_yoast_wpseo_title'][0]) ? $values['_yoast_wpseo_title'][0] : $post->post_title;
             } else {
                 $tags['title'] = '';
             }
             break;
     }
     $meta_data = self::process_defaults($tags);
     // Memoize this output...
     self::$page_tags = $meta_data;
     return $meta_data;
 }
Exemplo n.º 16
0
function custom_side_agent_widget_html($post_item, $post_html)
{
    //pls_dump($post_html);
    $agent = PLS_Plugin_API::get_user_details();
    ob_start();
    ?>

	<section class="agent">
		<?php 
    if (pls_get_option('pls-user-image')) {
        ?>
			<img src="<?php 
        echo pls_get_option('pls-user-image');
        ?>
" alt="<?php 
        _e('agent photo', 'tampa');
        ?>
" height=120>
		<?php 
    } else {
        if (isset($agent['user']['headshot']) && $agent['user']['headshot']) {
            ?>
			<img src="<?php 
            echo $agent['user']['headshot'];
            ?>
" alt="<?php 
            _e('agent photo', 'tampa');
            ?>
" height=120>
		<?php 
        }
    }
    ?>

		<?php 
    if (pls_get_option('pls-user-name')) {
        ?>
			<h4><?php 
        echo pls_get_option('pls-user-name');
        ?>
</h4>
		<?php 
    } else {
        ?>
			<h4><?php 
        echo $agent['user']['first_name'] . ' ' . $agent['user']['last_name'];
        ?>
</h4>
		<?php 
    }
    ?>

		<?php 
    if (pls_get_option('pls-user-phone')) {
        ?>
			<span><?php 
        echo pls_get_option('pls-user-phone');
        ?>
</span>
		<?php 
    } else {
        ?>
			<span><?php 
        echo $agent['user']['phone'];
        ?>
</span
		<?php 
    }
    ?>

		<?php 
    if (pls_get_option('pls-user-email')) {
        ?>
			<span><a href="mailto:<?php 
        echo pls_get_option('pls-user-email');
        ?>
"><?php 
        echo pls_get_option('pls-user-email');
        ?>
</a></span>
		<?php 
    } else {
        ?>
			<span><a href="mailto:<?php 
        echo $agent['user']['email'];
        ?>
"><?php 
        echo $agent['user']['email'];
        ?>
</a></span>
		<?php 
    }
    ?>

		<?php 
    if (pls_get_option('pls-user-description')) {
        ?>
			<p><?php 
        echo pls_get_option('pls-user-description');
        ?>
</p>
		<?php 
    }
    ?>

	</section>

<?php 
    return trim(ob_get_clean());
}
				<?php 
$cities = PLS_Plugin_API::get_location_list('locality');
if (!empty($cities)) {
    foreach ($cities as $key => $v) {
        echo '<option value="' . $key . '">' . $v . '</option>';
    }
}
?>
			</select>
		</div>

		<div class="featured-listing-form-zip option">
			<label for="featured-listing-zip-filter">Zip Code</label>
			<select id="featured-listing-zip-filter" name="location[postal]">
				<?php 
$zip = PLS_Plugin_API::get_location_list('postal');
if (!empty($zip)) {
    foreach ($zip as $key => $v) {
        echo '<option value="' . $key . '">' . $v . '</option>';
    }
}
?>
			</select>
		</div>

		<div class="featured-listing-form-beds option">
			<label for="featured-listing-beds-filter">Beds</label>
			<input id="featured-listing-beds-filter" type="text" name="metadata[beds]">
		</div>

		<div class="featured-listing-form-beds option">
Exemplo n.º 18
0
    public function widget($args, $instance)
    {
        global $post;
        if (!empty($post) && isset($post->post_type) && $post->post_type == 'property') {
            $data = PLS_Plugin_API::get_listing_in_loop();
        } else {
            $data = array();
        }
        // Labels and Values
        $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
        $success_message = apply_filters('success_message', empty($instance['success_message']) ? 'Thank you for the email, we\'ll get back to you shortly' : $instance['success_message']);
        $submit_value = apply_filters('button', empty($instance['button']) ? 'Send' : $instance['button']);
        $email_label = apply_filters('email_label', !isset($instance['email_label']) ? 'Email Address (required)' : $instance['email_label']);
        $email_value = apply_filters('email_value', !isset($instance['email_value']) ? 'Email Address' : $instance['email_value']);
        $phone_label = apply_filters('phone_label', !isset($instance['phone_label']) ? 'Phone Number (required)' : $instance['phone_label']);
        $phone_value = apply_filters('phone_value', !isset($instance['phone_value']) ? 'Phone Number' : $instance['phone_value']);
        $subject_label = apply_filters('subject_label', !isset($instance['subject_label']) ? 'Subject' : $instance['subject_label']);
        $subject_value = apply_filters('subject_value', !isset($instance['subject_value']) ? 'Subject' : $instance['subject_value']);
        $departments_label = apply_filters('departments_label', !isset($instance['departments_label']) ? 'Department' : $instance['departments_label']);
        $departments_value = apply_filters('departments_value', !isset($instance['departments_value']) ? 'Department' : $instance['departments_value']);
        $include_name = isset($instance['include_name']) && $instance['include_name'] == "false" ? false : true;
        $name_label = apply_filters('name_label', !isset($instance['name_label']) ? 'Name (required)' : $instance['name_label']);
        $name_value = apply_filters('name_value', !isset($instance['name_value']) ? 'Name' : $instance['name_value']);
        $question_label = apply_filters('question_label', !isset($instance['question_label']) ? 'Questions/Comments' : $instance['question_label']);
        $question_value = apply_filters('question_value', !isset($instance['question_value']) ? 'Any questions for us?' : $instance['question_value']);
        $custom_link = apply_filters('custom_link', !isset($instance['custom_link']) ? '' : $instance['custom_link']);
        $custom_link_target = apply_filters('custom_link_target', !isset($instance['custom_link_target']) ? '_blank' : $instance['custom_link_target']);
        $form_title = apply_filters('form_title', !isset($instance['form_title']) ? '' : $instance['form_title']);
        // Reguired Attribute
        $name_required = isset($instance['name_required']) && $instance['name_required'] == "false" ? false : true;
        $email_required = isset($instance['email_required']) && $instance['email_required'] == "false" ? true : true;
        $phone_required = isset($instance['phone_required']) && $instance['phone_required'] == "true" ? true : false;
        $subject_required = isset($instance['subject_required']) && $instance['subject_required'] == "true" ? true : false;
        $question_required = isset($instance['question_required']) && $instance['question_required'] == "false" ? false : true;
        // Error Messages
        $name_error = isset($instance['name_error']) && $instance['name_error'] != "" ? $instance['name_error'] : "Your name is required.";
        $email_error = isset($instance['email_error']) && $instance['email_error'] != "" ? $instance['email_error'] : "A valid email is required.";
        $phone_error = isset($instance['phone_error']) && $instance['phone_error'] != "" ? $instance['phone_error'] : "A valid phone is required.";
        $question_error = isset($instance['question_error']) && $instance['question_error'] != "" ? $instance['question_error'] : "Don't forget to leave a question or comment.";
        $subject_error = isset($instance['subject_error']) && $instance['subject_error'] != "" ? $instance['subject_error'] : "What subject would you like to speak about?";
        // Classes
        $container_class = apply_filters('container_class', empty($instance['container_class']) ? '' : $instance['container_class']);
        $inner_class = apply_filters('inner_class', empty($instance['inner_class']) ? '' : $instance['inner_class']);
        $inner_containers = apply_filters('inner_containers', empty($instance['inner_containers']) ? '' : $instance['inner_containers']);
        $textarea_container = apply_filters('textarea_container', !isset($instance['textarea_container']) ? $inner_containers : $instance['textarea_container']);
        $button_class = apply_filters('button_class', !isset($instance['button_class']) ? 'button-primary' : $instance['button_class']);
        // Send To Options
        $email_confirmation = apply_filters('email_confirmation', empty($instance['email_confirmation']) ? false : $instance['email_confirmation']);
        $send_to_email = apply_filters('send_to_email', !isset($instance['send_to_email']) ? '' : $instance['send_to_email']);
        $cc_value = apply_filters('cc_value', !isset($instance['cc_value']) ? '' : $instance['cc_value']);
        $bcc_value = apply_filters('bcc_value', !isset($instance['bcc_value']) ? '' : $instance['bcc_value']);
        // Lead Capture Cookie
        $lead_capture_cookie = apply_filters('lead_capture_cookie', !isset($instance['lead_capture_cookie']) ? '' : $instance['lead_capture_cookie']);
        // Form Options
        // Get lead capture's force-back theme option from admin
        $back_on_lc_cancel_option = pls_get_option('pd-lc-force-back');
        if (!empty($instance['back_on_lc_cancel'])) {
            // if option has been set in the contact form call
            $back_on_lc_cancel = apply_filters('back_on_lc_cancel', !isset($instance['back_on_lc_cancel']) ? '' : $instance['back_on_lc_cancel']);
        } elseif (isset($back_on_lc_cancel_option)) {
            // Elseif the theme option is set, let the theme option set the force-back for canceling the lead capture form
            $back_on_lc_cancel = $back_on_lc_cancel_option;
        } else {
            // else, don't force users back
            $back_on_lc_cancel = 0;
        }
        $show_property = isset($instance['show_property']) && !empty($instance['show_property']) ? 1 : 0;
        $template_url = get_template_directory_uri();
        /** Define the default argument array. */
        $defaults = array('before_widget' => '<section class="side-ctnr placester_contact ' . $container_class . ' widget">', 'after_widget' => '</section>', 'title' => '', 'before_title' => '<h3>', 'after_title' => '</h3>');
        /** Merge the arguments with the defaults. */
        $args = wp_parse_args($args, $defaults);
        extract($args, EXTR_SKIP);
        ?>
        
          <?php 
        pls_do_atomic('contact_form_before_widget');
        ?>
          
          <?php 
        echo $before_widget;
        ?>

              <?php 
        pls_do_atomic('contact_form_before_title');
        ?>
              
              <?php 
        echo $before_title . $title . $after_title;
        ?>
              
              <?php 
        pls_do_atomic('contact_form_after_title');
        ?>
              
              <section class="<?php 
        echo $inner_class;
        ?>
 common-side-cont placester_contact_form clearfix">

                  <div class="success"><?php 
        echo $success_message;
        ?>
</div>

                  <form name="widget_contact" action="" method="post">

                    <?php 
        //this must be included to get additional user data;
        ?>
                    <input type="hidden" name="ip" value="<?php 
        print $ip = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
        ?>
"/>
                    <input type="hidden" name="user_agent" value="<?php 
        print $_SERVER['HTTP_USER_AGENT'];
        ?>
"/>
                    <input type="hidden" name="url" value="<?php 
        print 'https://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
        ?>
"/>
                    
                    <?php 
        if (isset($lead_capture_cookie) && $lead_capture_cookie == true) {
            ?>
                      <input type="hidden" name="lead_capture_cookie" value="true">
                    <?php 
        }
        ?>
                    
                    <input type="hidden" name="id" value="<?php 
        if (isset($data['id'])) {
            echo $data['id'];
        }
        ?>
">
                    <input type="hidden" name="fullAddress" value="<?php 
        echo @self::_get_full_address($data);
        ?>
">
                    <input type="hidden" name="email_confirmation" value="<?php 
        echo $email_confirmation;
        ?>
">
                    <input type="hidden" name="send_to_email" value="<?php 
        echo $send_to_email;
        ?>
">
                    <input type="hidden" name="cc_value" value="<?php 
        echo @$cc_value;
        ?>
">
                    <input type="hidden" name="bcc_value" value="<?php 
        echo @$bcc_value;
        ?>
">
                    <input type="hidden" name="back_on_lc_cancel" value="<?php 
        echo @$back_on_lc_cancel;
        ?>
">
                    <input type="hidden" name="form_submitted" value="0">
                    <input type="hidden" name="custom_link" value="<?php 
        echo @$custom_link;
        ?>
">
                    <input type="hidden" name="custom_link_target" value="<?php 
        echo @$custom_link_target;
        ?>
">
                    <input type="hidden" name="form_title" value="<?php 
        echo @$form_title;
        ?>
">
                    
                    <?php 
        if (!empty($include_name)) {
            ?>
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '<div class="' . $instance['inner_containers'] . '">';
            ?>
                      <label class="required" for="name"><?php 
            echo $name_label;
            ?>
</label>
                      <input class="required" id="name" placeholder="<?php 
            echo $name_value;
            ?>
" type="text" name="name" <?php 
            echo $name_required == true ? 'required="required"' : '';
            ?>
 <?php 
            echo !empty($name_error) ? 'data-message="' . $name_error . '"' : '';
            ?>
 />
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '</div>';
            ?>
                    <?php 
        }
        ?>

                    <?php 
        echo empty($instance['inner_containers']) ? '' : '<div class="' . $instance['inner_containers'] . '">';
        ?>
                    <label class="required" for="email"><?php 
        echo $email_label;
        ?>
</label><input class="required" id="email" placeholder="<?php 
        echo $email_value;
        ?>
" type="email" name="email" <?php 
        echo $email_required == true ? 'required="required"' : '';
        ?>
 <?php 
        echo !empty($email_error) ? 'data-message="' . $email_error . '"' : '';
        ?>
 />
                    <?php 
        echo empty($instance['inner_containers']) ? '' : '</div>';
        ?>

                    <?php 
        if (!empty($instance['phone_number'])) {
            ?>
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '<div class="' . $instance['inner_containers'] . '">';
            ?>
                      <label class="required" for="phone"><?php 
            echo $phone_label;
            ?>
</label><input class="required" id="phone" placeholder="<?php 
            echo $phone_value;
            ?>
" type="text" name="phone" <?php 
            echo $phone_required == true ? 'required="required"' : '';
            ?>
 <?php 
            echo !empty($phone_error) ? 'data-message="' . $phone_error . '"' : '';
            ?>
 />
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '</div>';
            ?>
                    <?php 
        }
        ?>

                    <?php 
        if (!empty($instance['subject'])) {
            ?>
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '<div class="' . $instance['inner_containers'] . '">';
            ?>
                      <label class="required" for="subject"><?php 
            echo $subject_label;
            ?>
</label><input class="required" id="subject" placeholder="<?php 
            echo $subject_value;
            ?>
" type="text" name="subject" <?php 
            echo $subject_required == true ? 'required="required"' : '';
            ?>
 <?php 
            echo !empty($subject_error) ? 'data-message="' . $subject_error . '"' : '';
            ?>
 />
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '</div>';
            ?>
                    <?php 
        }
        ?>

                    <?php 
        if (!empty($instance['departments'])) {
            ?>
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '<div class="' . $instance['inner_containers'] . '">';
            ?>
                      <label class="required" for="department"><?php 
            echo $departments_label;
            ?>
</label>
                      <?php 
            $departments = explode(',', $instance['departments']);
            ?>
                      <select id="department" placeholder="<?php 
            echo $departments_value;
            ?>
" name="department">
                        <?php 
            foreach ($departments as $department) {
                ?>
                          <option value="<?php 
                echo $department;
                ?>
"><?php 
                echo $department;
                ?>
</option>
                        <?php 
            }
            ?>
                      </select>
                      <?php 
            echo empty($instance['inner_containers']) ? '' : '</div>';
            ?>
                    <?php 
        }
        ?>

                    <?php 
        if ($show_property == 1) {
            ?>
                      <?php 
            $full_address = @self::_get_full_address($data);
            if (!empty($full_address)) {
                ?>
                        <?php 
                echo empty($instance['inner_containers']) ? '' : '<div class="' . $instance['inner_containers'] . '">';
                ?>
                        <label>Property</label><span class="info"><?php 
                echo str_replace("\n", " ", $full_address);
                ?>
</span>
                        <?php 
                echo empty($instance['inner_containers']) ? '' : '</div>';
                ?>
                      
                      <?php 
            }
            ?>
                    <?php 
        }
        ?>

                    <?php 
        echo empty($instance['textarea_container']) ? '' : '<div class="' . $instance['textarea_container'] . '">';
        ?>
                    <label for="question"><?php 
        echo $question_label;
        ?>
</label>
                    <textarea rows="5" id="question" name="question" placeholder="<?php 
        echo $question_value;
        ?>
" <?php 
        echo $question_required == true ? 'required="required"' : '';
        ?>
 <?php 
        echo !empty($question_error) ? 'data-message="' . $question_error . '"' : '';
        ?>
></textarea>
                    <?php 
        echo empty($instance['textarea_container']) ? '' : '</div>';
        ?>
                    

                  <input type="submit" value="<?php 
        echo $submit_value;
        ?>
" class="<?php 
        echo $button_class;
        ?>
" />
                  
                  <div class="pls-contact-form-loading" style='display:none;'>
                    <div id="medium-spinner"><div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div><div class="bar5"></div><div class="bar6"></div><div class="bar7"></div><div class="bar8"></div></div>
                  </div>
                  
                </form>
                
              </section>
              <div class="separator"></div>

            <?php 
        echo $after_widget;
        ?>

            <?php 
        pls_do_atomic('contact_form_after_widget');
        ?>
            
    <?php 
    }
Exemplo n.º 19
0
    public static function init($content)
    {
        global $post;
        if ($post->post_type == 'property') {
            $html = '';
            $listing_data = PLS_Plugin_API::get_listing_in_loop();
            // re-order images by assigned order
            $property_images = is_array($listing_data['images']) ? $listing_data['images'] : array();
            usort($property_images, array('PLS_Partials_Property_Details', 'sort_images_by_order'));
            // reset the images
            $listing_data['images'] = $property_images;
            // Problems with API key or inconsistent data lead to notices due to null listings
            if (!is_null($listing_data)) {
                $listing_data['location']['full_address'] = $listing_data['location']['address'] . ' ' . $listing_data['location']['locality'] . ' ' . $listing_data['location']['region'];
                // This has to happen here to ensure it's not filtered out by whatever might be filtering this output...
                echo PLS_Plugin_API::log_snippet_js('listing_view', array('prop_id' => $listing_data['id']));
                ob_start();
                ?>
					<h2 itemprop="name" itemscope itemtype="http://schema.org/PostalAddress">
						<span itemprop="streetAdress"><?php 
                echo $listing_data['location']['address'];
                ?>
</span> <span itemprop="addressLocality"><?php 
                echo $listing_data['location']['locality'];
                ?>
</span>, <span itemprop="addressRegion"><?php 
                echo $listing_data['location']['region'];
                ?>
</span>
					</h2>
	
					<?php 
                echo PLS_Plugin_API::placester_favorite_link_toggle(array('property_id' => $listing_data['id'], 'add_text' => 'Add To Favorites', 'remove_text' => 'Remove From Favorites'));
                ?>
	
					<p itemprop="price"><?php 
                echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
                ?>
 <span><?php 
                echo PLS_Format::translate_lease_terms($listing_data);
                ?>
</span></p>
	
					<p class="listing_type"><?php 
                if (isset($listing_data['zoning_types'][0]) && isset($listing_data['purchase_types'][0])) {
                    echo ucwords(@$listing_data['zoning_types'][0] . ' ' . @$listing_data['purchase_types'][0]);
                }
                ?>
</p>

					<div class="clearfix"></div>
	
					<?php 
                if ($listing_data['images']) {
                    ?>
						<div class="theme-default property-details-slideshow">
							<?php 
                    echo PLS_Image::load($listing_data['images'][0]['url'], array('resize' => array('w' => 590, 'h' => 300), 'fancybox' => false, 'as_html' => true, 'html' => array('itemprop' => 'image')));
                    ?>
							<?php 
                    // echo PLS_Slideshow::slideshow( array( 'anim_speed' => 1000, 'pause_time' => 15000, 'control_nav' => true, 'width' => 620, 'height' => 300, 'context' => 'home', 'data' => PLS_Slideshow::prepare_single_listing($listing_data) ) );
                    ?>
						</div>

						<div class="details-wrapper grid_8 alpha">
							<div id="slideshow" class="clearfix theme-default left bottomborder">
								<div class="grid_8 alpha">
									<ul class="property-image-gallery grid_8 alpha">
										<?php 
                    foreach ($listing_data['images'] as $images) {
                        ?>
											<li><?php 
                        echo PLS_Image::load($images['url'], array('resize' => array('w' => 100, 'h' => 75), 'fancybox' => true, 'as_html' => true, 'html' => array('itemprop' => 'image')));
                        ?>
</li>
										<?php 
                    }
                    ?>
									</ul>
								</div>

							</div>
						</div>
					<?php 
                }
                ?>
	                
	                <div class="basic-details grid_8 alpha">
	                    <ul>
	                        <li><span>Beds: </span><?php 
                echo $listing_data['cur_data']['beds'];
                ?>
</li>
	                        <li><span>Baths: </span><?php 
                echo $listing_data['cur_data']['baths'];
                ?>
</li>
	                        <?php 
                if (isset($listing_data['cur_data']['half_baths']) && $listing_data['cur_data']['half_baths'] != null) {
                    ?>
	                        	<li><span>Half Baths: </span><?php 
                    echo $listing_data['cur_data']['half_baths'];
                    ?>
</li>
	                        <?php 
                }
                ?>
	                        <li><span>Square Feet: </span><?php 
                echo PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false));
                ?>
</li>
	                        <?php 
                if (isset($listing_data['cur_data']['avail_on']) && $listing_data['cur_data']['avail_on'] != null) {
                    ?>
	                        	<li itemprop="availability"><span>Available: </span><?php 
                    echo @$listing_data['cur_data']['avail_on'];
                    ?>
</li>
	                        <?php 
                }
                ?>
	                        <li>Property Type: <?php 
                echo PLS_Format::translate_property_type($listing_data);
                ?>
</li>
	                        <?php 
                if (isset($listing_data['rets']) && isset($listing_data['rets']['mls_id'])) {
                    ?>
	                        	<li><span>MLS #: </span><?php 
                    echo $listing_data['rets']['mls_id'];
                    ?>
</li>	
	                        <?php 
                }
                ?>
	                    </ul>
	                </div>
	
	                <div class="details-wrapper grid_8 alpha">
	                    <h3>Property Description</h3>
	                    <?php 
                if (!empty($listing_data['cur_data']['desc'])) {
                    ?>
	                        <p itemprop="description"><?php 
                    echo $listing_data['cur_data']['desc'];
                    ?>
</p>
	                    <?php 
                } else {
                    ?>
	                        <p> No description available </p>
	                    <?php 
                }
                ?>
	                </div>
	
	                
	
	                <?php 
                $amenities = PLS_Format::amenities_but($listing_data, array('half_baths', 'beds', 'baths', 'url', 'sqft', 'avail_on', 'price', 'desc'));
                ?>
	               
	                <?php 
                if (!empty($amenities['list'])) {
                    ?>
	                  <div class="amenities-section grid_8 alpha">
	                    <h3>Listing Amenities</h3>
	                    <ul>
	                    <?php 
                    $amenities['list'] = PLS_Format::translate_amenities($amenities['list']);
                    ?>
	                      <?php 
                    foreach ($amenities['list'] as $amenity => $value) {
                        ?>
	                        <li><span><?php 
                        echo $amenity;
                        ?>
</span> <?php 
                        echo $value;
                        ?>
</li>
	                      <?php 
                    }
                    ?>
	                    </ul>
		                </div>	
	                <?php 
                }
                ?>
	                <?php 
                if (!empty($amenities['ngb'])) {
                    ?>
		                <div class="amenities-section grid_8 alpha">
		                  <h3>Local Amenities</h3>
	                    <ul>
		                  <?php 
                    $amenities['ngb'] = PLS_Format::translate_amenities($amenities['ngb']);
                    ?>
		                    <?php 
                    foreach ($amenities['ngb'] as $amenity => $value) {
                        ?>
		                      <li><span><?php 
                        echo $amenity;
                        ?>
</span> <?php 
                        echo $value;
                        ?>
</li>
		                    <?php 
                    }
                    ?>
		                  </ul>
		                </div>
	                <?php 
                }
                ?>
	                
	                <?php 
                if (!empty($amenities['uncur'])) {
                    ?>
		                <div class="amenities-section grid_8 alpha">
		                  <h3>Custom Amenities</h3>
	                    <ul>
		                  <?php 
                    $amenities['uncur'] = PLS_Format::translate_amenities($amenities['uncur']);
                    ?>
		                    <?php 
                    foreach ($amenities['uncur'] as $amenity => $value) {
                        ?>
		                      <li><span><?php 
                        echo $amenity;
                        ?>
</span> <?php 
                        echo $value;
                        ?>
</li>
		                    <?php 
                    }
                    ?>
	                    </ul>
		                </div>	
	                <?php 
                }
                ?>
	
		            <div class="map-wrapper grid_8 alpha">
		                <h3>Property Map</h3>
                        <script type="text/javascript">
                          jQuery(document).ready(function( $ ) {
                            var map = new Map();
                            var listing = new Listings({
                              single_listing : <?php 
                echo json_encode($listing_data);
                ?>
,
                              map: map
                            });
                            map.init({
                              type: 'single_listing', 
                              listings: listing,
                              lat : <?php 
                echo json_encode($listing_data['location']['coords'][0]);
                ?>
,
                              lng : <?php 
                echo json_encode($listing_data['location']['coords'][1]);
                ?>
,
                              zoom : 14
                            });
                            listing.init();
                          });
     	                </script>
	                    <div class="map">
     	                  <?php 
                echo PLS_Map::dynamic($listing_data, array('lat' => $listing_data['location']['coords'][0], 'lng' => $listing_data['location']['coords'][1], 'height' => 250, 'zoom' => 16));
                ?>
	                    </div>
		            </div>
	              
	              	<?php 
                PLS_Listing_Helper::get_compliance(array('context' => 'listings', 'agent_name' => @$listing_data['rets']['aname'], 'office_name' => @$listing_data['rets']['oname']));
                ?>
	
		      	<?php 
                // Store output...
                $html = ob_get_clean();
            }
            // Enable Lead Capture
            $lead_capture_enable = pls_get_option('pd-lc-enable');
            if ($lead_capture_enable == 1) {
                ob_start();
                ?>
	                <!-- Lead Capture Shortcode -->
	                <div style="display:none;" href="#" id="property-details-lead-capture">
	                  <?php 
                do_shortcode('[lead_capture_template 
	                        lead_capture_cookie="true" 
	                        name_required="true" 
	                        question_required="false" 
	                        width="440"]');
                ?>
	                </div>
                <?php 
                // Store output...
                $lead_capture_block = ob_get_clean();
            }
            $html = apply_filters('property_details_filter', $html, $listing_data);
            // Add lead capture block to HTML
            if (isset($lead_capture_block)) {
                $html = $lead_capture_block . $html;
            }
            return $html;
        }
        // Post is not of type property, so just return what was initially passed in...
        return $content;
    }
Exemplo n.º 20
0
<?php

/**
 * Template Name: About Us
 *
 * This is the template for the About Us page
 *
 */
$company_details = PLS_Plugin_API::get_company_details();
$comma_str = $company_details['location']['locality'] && $company_details['location']['region'] ? ', ' : '';
?>

<div id="main">
	<div class="user-generated">
    <h2><?php 
printf(__('About %s', 'tampa'), stripslashes($company_details['name']));
?>
</h2>
    <p id="company-phone"><?php 
echo PLS_Format::phone($company_details['phone']);
?>
</p>
    <p id="company-address"><?php 
echo $company_details['location']['address'] . ' ' . $company_details['location']['unit'];
?>
</p>
    <p id="company-city-state">
    <?php 
printf('%s%s%s', $company_details['location']['locality'], $comma_str, $company_details['location']['region']);
?>
    </p>
Exemplo n.º 21
0
 public static function get_search_count()
 {
     $response = PLS_Plugin_API::get_listings($_POST);
     echo json_encode(array('count' => $response['total']));
     die;
 }
Exemplo n.º 22
0
 public static function get_score($lat, $lng, $address, $ws_api_key)
 {
     $args = array('lat' => $lat, 'lng' => $lng, 'address' => $address, 'ws_api_key' => $ws_api_key);
     return PLS_Plugin_API::get_walkscore($args);
 }
Exemplo n.º 23
0
function custom_side_agent_widget_html($post_item, $post_html)
{
    //pls_dump($post_html);
    $agent = PLS_Plugin_API::get_user_details();
    ob_start();
    ?>

<section class="side-bin">

	<section class="agent">

		<section class="agent-thumb">
			<?php 
    if (pls_get_option('pls-user-image')) {
        ?>
				<img src="<?php 
        echo pls_get_option('pls-user-image');
        ?>
" alt="<?php 
        _e('Agent photo', 'manchester');
        ?>
" width=90 />
			<?php 
    } elseif (!empty($agent['user']['headshot'])) {
        ?>
				<img src="<?php 
        echo $agent['user']['headshot'];
        ?>
" alt="<?php 
        _e('Agent photo', 'manchester');
        ?>
" width=90 />
			<?php 
    }
    ?>
		</section>

		<section class="agent-text">
			
			<?php 
    if (pls_get_option('pls-user-name')) {
        ?>
				<h6 class="blue"><?php 
        echo pls_get_option('pls-user-name');
        ?>
</h6>
				<?php 
    } else {
        ?>
				<h6 class="blue"><?php 
        echo $agent['user']['first_name'] . ' ' . $agent['user']['last_name'];
        ?>
</h6>
			<?php 
    }
    ?>
			
			<?php 
    if (pls_get_option('pls-user-description')) {
        ?>
				<p class="nrm-txt"><?php 
        echo pls_get_option('pls-user-description');
        ?>
</p>
			<?php 
    }
    ?>
			<div class="divider"></div>

			<p class="nrm-txt">
				<?php 
    if (pls_get_option('pls-user-email')) {
        ?>
					<a href="mailto:<?php 
        echo pls_get_option('pls-user-email');
        ?>
"><?php 
        echo pls_get_option('pls-user-email');
        ?>
</a><br />
				<?php 
    } else {
        ?>
					<a href="mailto:<?php 
        echo $agent['user']['email'];
        ?>
"><?php 
        echo $agent['user']['email'];
        ?>
</a><br />
				<?php 
    }
    ?>

				<?php 
    if (pls_get_option('pls-user-phone')) {
        ?>
					<?php 
        echo pls_get_option('pls-user-phone');
        ?>
				<?php 
    } else {
        ?>
					<?php 
        echo $agent['user']['phone'];
        ?>
				<?php 
    }
    ?>
			</p>
		
		
		</section>

	</section>

</section>

<?php 
    return trim(ob_get_clean());
}
Exemplo n.º 24
0
 public static function translate_amenities($amenities)
 {
     $local_dictionary = array('half_baths' => 'Half Baths', 'price' => 'Price', 'sqft' => 'Square Feet', 'baths' => 'Baths', 'avail_on' => 'Available On', 'cons_stts' => 'Construction Status', 'beds' => 'Beds', 'url' => 'Link', 'desc' => 'Description', 'lt_sz' => 'Lot Size', 'ngb_shop' => 'Local Shopping', 'ngb_hgwy' => 'Local Highway Access', 'grnt_tops' => 'Granite Counter Tops', 'ngb_med' => 'Local Medical Facilities', 'ngb_trails' => 'Local Walk/Jog Trails', 'cent_ht' => 'Central Heat', 'pk_spce' => 'Parking Spaces Included', 'park_type' => "Parking Type", 'air_cond' => 'Air Conditioning', 'air_conditioning' => 'Air Conditioning', 'price_unit' => 'Unit Price', 'lt_sz_unit' => 'Unit Lot Size', 'lse_trms' => 'Lease Terms', 'lse_type' => "Lease Type", 'ngb_trans' => 'Local Public Transportation', 'off_den' => 'Office / Den', 'frnshed' => 'Furnished', 'refrig' => 'Refrigerator', 'deposit' => 'Deposit', 'ngb_pubsch' => 'Local Public Schools', 'beds_avail' => 'Beds Available', 'hoa_fee' => 'Home Owners Assocation Fee', 'floors' => 'Floors', 'bns_rec_rm' => 'Basement Rec Room', 'fm_lv_rm' => 'Family Rec Room', 'yard' => 'Has Yard', 'hdwdflr' => 'Hardwood Floors', 'sauna' => 'Sauna', 'year_blt' => 'Year Built', "oid" => "Office ID", "aid" => "Agent ID", "mls_id" => "MLS ID", "oname" => "Office Name", "aname" => "Agent Name", "aemail" => "Agent Email", "assofee" => "Association Fee", "assocation_fee" => "Association Fee", "association_fee_per" => "Association Fee Per", "garagetype" => "Garage Type", "foundlength" => "Foundation Length", "foundation_length" => "Foundation Length", "foundwidth" => "Foundation Width", "foundation_width" => "Foundation Width", "assessment" => "Assessment", "assessed_value" => "Assessed Value", "lender_owned" => "Lender Owned", "retaxes" => "Real Estate Taxes", "tax_amount" => "Tax Amount", "real_estate_tax" => "Real Estate Taxes", "lotfrontage" => "Waterfront", "lot_frontage" => "Waterfront", "taxyear" => "Tax Year", "tax_year" => "Tax Year", "heat1" => "Heat", "room" => "Rooms", "rooms" => "Rooms", "floor" => "Floors", "flooring" => "Flooring", "belowgroundlsqf" => "Below Ground Sqft", "below_ground_sqft" => "Below Ground Sqft", "above_ground_sqft" => "Above Ground Sqft", "pricesqft_abv_gr" => "Price/sqft Above Ground", "approx_acres" => "Approximate Acres", "approx_lot_sqft" => "Approximate Lot Sqft", "fire_district_tax" => "Fire District Tax", "garage_description" => "Garage Description", "garage_spaces" => "Garage Spaces", "insulation" => "Insulation", "tank_type" => "Tank Type", "tank_size" => "Tank Size", "number_of_rooms" => "Number of Rooms", "energy_features" => "Energy Features", "exterior_constr" => "Exterior Construction", "occupancyclose" => "Occupancy Close", "zone_desc" => "Zone Description", "assessment_amount" => "Assessment Amount", "assessor_plat" => "Assessor Plat", "assessor_lot" => "Assessor Lot", "occupancy" => "Occupancy", "pets" => "Pets", "historic" => "Historic", "blc_deck_pt" => "Balcony/Deck/Patio", "dryer" => "Dryer", "washer" => "Washer", "status" => "Status", "appliances" => "Appliances", "appliances_included" => "Appliances", "oid" => "Office ID", "aid" => "Agent ID", "mls_id" => "MLS ID", "oname" => "Office Name", "aname" => "Agent Name", "aemail" => "Agent Email", "assofee" => "Association Fee", "garagetype" => "Garage Type", "historic" => "Historic", "age_years" => "Age in Years", "foundation" => "Foundation", "foundlength" => "Foundation Length", "foundwidth" => "Foundation Width", "assessment" => "Assessment", "retaxes" => "Real Estate Taxes", "lotfrontage" => "Waterfront", "taxyear" => "Tax Year", "heat1" => "Heat", "total_rooms" => "Total Rooms", "total_fireplaces" => "Total Fireplaces", "total_closets" => "Total Closets", "fencing" => "Fencing", "construction" => "Construction", "floor" => "Floors", "occupancy" => "Occupancy", "belowgroundlsqf" => "Below Ground Sqft", "insulation" => "Insulation", "approx_head_cost" => "Approximate Head Cost", "approx_lot_sqft" => "4791", "cooling" => "Cooling", "basement" => "Basement", "basemnt" => "Basement", "building_levels" => "Building Levels", "levels" => "Levels", "utility_room" => "Utility Room", "room_areas" => "Room Areas", "water_heater" => "Water Heater", "other_rooms" => "Other Rooms", "fence" => "Fence", "fireplace_details" => "Fireplace Details", "lot_number" => "Lot Number", "water_heaters" => "Water Heaters", "kitchen_equipment" => "Kitchen Equipment", "living_areas" => "Living Areas", "electric" => "Electric", "first_floor_rooms" => "First Floor Rooms", "second_floor_rooms" => "Second Floor Rooms", "third_floor_rooms" => "Third Floor Rooms", "flooring" => "Flooring", "fireplace" => "Fireplace", "heating_fuel" => "Heating Fuel", "garage_description" => "Garage Description", "heat_system" => "Heat System", "hot_water" => "Hot Water", "living_room_length" => "Living Room Length", "list_of_rooms" => "List of Rooms", "living_room_width" => "Living Room Width", "lot_description" => "Lot Description", "lower_level_rooms" => "Lower Level Rooms", "master_bedroom_l" => "Master Bedroom Length", "master_bedroom_w" => "Master Bedroom Width", "number_of_fireplaces" => "Number of Fireplaces", "number_of_rooms" => "Number of Rooms", "near" => "Near", "plumbing" => "Plumbing", "pricesqft_abv_gr" => "Price per Sqft Above Ground", "tank_size" => "Tank Size", "sewer" => "Sewer", "tank_type" => "Tank Type", "type" => "Type", "wall_description" => "Wall Description", "water_supply" => "Water Supply", "approx_heat_cost" => "Approximate Heat Cost", "association_fee" => "Association Fee", "exterior" => "Exterior", "exterior_features" => "Exterior Features", "interior" => "Interior", "Interior_features" => "Interior Features", "water_amenities" => "Water Amenities", "acres" => "Acres", "master_bath" => "Master Bath", "park_type" => "Parking Type", "property_type" => "Property Type", "built_to_suit" => "Built to Suit", "mobile_homes_allowed" => "Mobile Homes Allowed", "basemnt" => "Basement", "move_in" => "Move In", "bld_name" => "Building Name", "tl_earn" => "Total Earned", "style" => "Style", "company" => "Company", "landing_select" => "Advertising Style", "bld_suit" => "Build to Suit", "cent_ac" => "Central A/C", "frplce" => "Fireplace", "hv_ceil" => "High/Vaulted Ceiling", "wlk_clst" => "Walk-In Closet", "tle_flr" => "Tile Floor", "lft_lyout" => "Loft Layout", "off_den" => "Office/Den", "dng_rm" => "Dining Room", "brkfst_nk" => "Breakfast Nook", "dshwsher" => "Dishwasher", "refrig" => "Refrigerator", "stve_ovn" => "Stove/Oven", "stnstl_app" => "Stainless Steel Appliances", "attic" => "Attic", "washer" => "Washer", "dryer" => "Dryer", "lndry_in" => "Laundry Area - Inside", "lndry_gar" => "Laundry Area - Garage", "blc_deck_pt" => "Balcony/Deck/Patio", "yard" => "Yard", "swm_pool" => "Swimming Pool", "jacuzzi" => "Jacuzzi/Whirlpool", "sauna" => "Sauna", "cble_rdy" => "Cable-ready", "hghspd_net" => "High-speed Internet", "lt_sz" => "Lot Size", "lt_sz_unit" => "Lot Unit Type", "accoms" => "Accommodates", "avail_info" => "Availability", "hoa_mand" => "HOA Mandatory", "hoa_fee" => "HOA Fee", "hoa_fee_desc" => "HOA Fee Description", "lndr_own" => "Lender Owned", "ngb_trans" => "Public Transportation", "ngb_shop" => "Shopping", "ngb_pool" => "Swimming Pool", "ngb_court" => "Tennis Court", "ngb_park" => "Park", "ngb_trails" => "Walk/Jog Trails", "ngb_stbles" => "Stables", "ngb_golf" => "Golf Courses", "ngb_med" => "Medical Facilities", "ngb_bike" => "Bike Path", "ngb_cons" => "Conservation Area", "ngb_hgwy" => "Highway Access", "ngb_mar" => "Marina", "ngb_pvtsch" => "Private School", "ngb_pubsch" => "Public School", "school_district" => "School District", "zone" => "Zone", "road_surface" => "Road Surface", "utilities" => "Utilities", "restrictions" => "Restrictions", "ngb_uni" => "University", "cats" => "Cats", "dogs" => "Dogs", "pk_lease" => "Parking Lease", "lease_type" => "Lease Type", "master_bath" => "Master Bath", "area" => "Area", "prop_type" => "Property Type", "prop_name" => "Property Name", "bld_sz" => "Building Size", "max_cont" => "Maximum Contiguous", "min_div" => "Minimum Divisible", "lst_dte" => "List Date", "dom" => "Days on Market", "construction_type" => "Construction Type", "design" => "Construction Type", "floor_desc" => "Construction Type", "heating_desc" => "Construction Type", "parking_description" => "Parking Description", "sewer_desc" => "Sewer Description", "water_desc" => "Water Description", "cooling_desc" => "Cooling Description", "front_exposure" => "Front Exposure", "roof_desc" => "Roof Description", "view" => "View");
     $local_values_dictionary = array("per_ngt" => "per night", "per_mnt" => "per month", "per_yr" => "per year", "per_wk" => "per week", "exstng" => "existing", "und_prop" => "under construction / proposed", "fl_srv" => "full service", "ind_grs" => "industrial gross", "mod_grs" => "modified gross", "mod_net" => "industrial net", "na" => "n/a", "Atch_gar" => "attached garage", "amt_mnt" => "amount/month", "amt_yr" => "amount/year", "sqft_mnt" => "sqft/month", "sqft_yr" => "sqft/year");
     $api_dictionary = PLS_Plugin_API::get_translations();
     $local_dictionary = array_merge($local_dictionary, $api_dictionary);
     global $pls_custom_amenity_dictionary;
     if (isset($pls_custom_amenity_dictionary) && !empty($pls_custom_amenity_dictionary)) {
         $local_dictionary = wp_parse_args($pls_custom_amenity_dictionary, $local_dictionary);
     }
     foreach ($amenities as $key => $value) {
         // if exists in local dictionary, translate value first
         $value = isset($local_values_dictionary[trim($value)]) ? $local_values_dictionary[trim($value)] : $value;
         if ($value == '1') {
             $value = 'Yes';
         } elseif ($value == '0') {
             $value = 'No';
         }
         if (isset($local_dictionary[$key])) {
             if ($key == 'style') {
                 $style_values = array("bungal" => "Bungalow", "cape" => "Cape Cod", "colonial" => "Colonial", "contemp" => "Contemporary", "cott" => "Cottage", "farmh" => "Farmhouse", "fnt_bk_splt" => "Front to Back Split", "gamb_dutc" => "Gambrel/Dutch", "garrison" => "Garrison", "greek_rev" => "Greek Revival", "loft_splt" => "Lofted Split", "mult_lvl" => "Multi-level", "rai_ranch" => "Raised Ranch", "ranch" => "Ranch", "saltb" => "Saltbox", "split_ent" => "Split Entry", "tudor" => "Tudor", "victor" => "Victorian", "antiq" => "antique");
                 if (isset($style_values[$value])) {
                     $value = $style_values[$value];
                 }
             }
             unset($amenities[$key]);
             $amenities[$local_dictionary[$key]] = ucwords($value);
         }
     }
     return $amenities;
 }
Exemplo n.º 25
0
 /**
  * Outputs and filters the widget.
  * 
  * The widget connects to the plugin using the framework plugin api class. 
  * If the class returns false, this means that either the plugin is 
  * missing, either the it has no API key set.
  *
  * @since 0.0.1
  */
 public function widget($args, $instance)
 {
     list($args, $instance) = self::process_defaults($args, $instance);
     /** Extract the arguments into separate variables. */
     extract($args, EXTR_SKIP);
     /** Get the agent information from the plugin. */
     $agent = PLS_Plugin_API::get_user_details();
     $agent_array = array();
     // pls_dump($agent);
     /** If the plugin is active, and has an API key set... */
     if ($agent) {
         /* Output the theme's $before_widget wrapper. */
         echo $before_widget;
         /* If a title was input by the user, display it. */
         $widget_title = '';
         if (!empty($instance['title'])) {
             $widget_title = $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
         }
         /** This array will hold the html for the agent info sections and will be passed to the filters. */
         $agent_html = $instance;
         unset($agent_html['title']);
         // Add Name
         if (!empty($instance['name_custom'])) {
             // if admin set custom name
             $agent_html['name'] = self::checkForCustom($instance, 'name');
             $agent_array['name'] = $instance['name_custom'];
         } else {
             // otherwise use admin's name
             if (!empty($instance['name']) && (!empty($agent['user']['first_name']) || !empty($agent['user']['last_name']))) {
                 $agent_html['name'] = pls_h_p(trim($agent['user']['first_name'] . ' ' . $agent['user']['last_name']), array('class' => 'fn h5', 'itemprop' => 'name'));
                 $agent_array['name'] = $agent['user']['first_name'] . ' ' . $agent['user']['last_name'];
             } else {
                 $agent_html['name'] = '';
                 $agent_array['name'] = '';
             }
         }
         // Add Email
         if (!empty($instance['email_custom'])) {
             // if admin set custom email
             $agent_html['email'] = self::checkForCustom($instance, 'email');
             $agent_array['email'] = $instance['email_custom'];
         } else {
             // otherwise use admin's email
             if (!empty($instance['email']) && !empty($agent['user']['email'])) {
                 $agent_html['email'] = pls_h_p(pls_h_a("mailto:{$agent['user']['email']}", $agent['user']['email']), array('class' => 'email', 'itemprop' => 'email'));
                 $agent_array['email'] = $agent['user']['email'];
             } else {
                 $agent_html['email'] = '';
                 $agent_array['email'] = '';
             }
         }
         // Add Phone
         if (!empty($instance['phone_custom'])) {
             // if admin set custom phone
             $agent_html['phone'] = self::checkForCustom($instance, 'phone');
             $agent_array['phone'] = $instance['phone_custom'];
         } else {
             // otherwise use admin's phone
             if (!empty($instance['phone']) && !empty($agent['user']['phone'])) {
                 $agent_html['phone'] = pls_h_p(PLS_Format::phone($agent['user']['phone']), array('class' => 'phone', 'itemprop' => 'phone'));
                 $agent_array['phone'] = PLS_Format::phone($agent['user']['phone'], array('class' => 'phone', 'itemprop' => 'phone'));
             } else {
                 $agent_html['phone'] = '';
                 $agent_array['phone'] = '';
             }
         }
         // Add Description
         if (!empty($instance['description_custom'])) {
             // if admin set custom description
             $agent_html['description'] = self::checkForCustom($instance, 'description');
             $agent_array['description'] = $instance['description_custom'];
         } else {
             // otherwise use admin's descriptions
             if (!empty($instance['description']) && pls_get_option('pls-user-description')) {
                 $agent_bio = pls_get_option('pls-user-description');
                 $agent_html['description'] = pls_h_p($agent_bio, array('class' => 'desc p4', 'itemprop' => 'description'));
                 $agent_array['description'] = $agent_bio;
             } else {
                 $agent_html['description'] = '';
                 $agent_array['description'] = '';
             }
         }
         // Add Photo
         if (!empty($instance['image_uri'])) {
             // if admin set custom photo
             self::checkForCustom($instance, 'photo');
             $agent_array['photo'] = $instance['image_uri'];
         } else {
             // otherwise use admin's photo
             $user_image_option = pls_get_option('pls-user-image');
             if (!empty($instance['photo']) && !empty($user_image_option)) {
                 $agent_html['photo'] = pls_h_img(@pls_get_option('pls-user-image'), trim($agent['user']['first_name'] . ' ' . $agent['user']['last_name']), array('class' => 'photo', 'itemprop' => 'image') + array() + array());
                 $agent_array['photo'] = $user_image_option;
             } else {
                 if (isset($agent['user']['headshot'])) {
                     $agent_html['photo'] = pls_h_img($agent['user']['headshot'], trim($agent['user']['first_name'] . ' ' . $agent['user']['last_name']), array('class' => 'photo', 'itemprop' => 'image') + array() + array());
                     $agent_array['photo'] = $agent['user']['headshot'];
                 } else {
                     $agent_array['photo'] = '';
                 }
             }
         }
         // Form the HTML elements
         // photo
         $agent_html['photo'] = '<img class="pls-agent-phone" src="' . esc_url($instance['image_uri']) . '" />';
         // texts
         $agent_info = array('name', 'email', 'phone', 'description');
         foreach ($agent_info as $value) {
             $agent_html[$value] = pls_h_p($agent_html[$value], array('class' => 'pls-agent-' . $value));
         }
         /** Combine the agent information. */
         $widget_body = $agent_html['photo'] . $agent_html['name'] . $agent_html['email'] . $agent_html['phone'] . $agent_html['description'];
         /** Wrap the agent information in a section element. */
         $widget_body = apply_filters('pls_widget_agent_inner', $widget_body, $agent_html, $agent_array, $instance, $agent, $widget_id);
         /** Apply a filter on the whole widget */
         echo apply_filters('pls_widget_agent', $widget_title . $widget_body, $widget_title, $before_title, $after_title, $widget_body, $agent_html, $agent, $instance, $widget_id);
         /* Close the theme's widget wrapper. */
         if ($args['clearfix']) {
             echo '<div class="clearfix"></div>';
         }
         echo $after_widget;
     } elseif (current_user_can('administrator')) {
         /** Display an error message if the user is admin. */
         // echo pls_get_no_plugin_placeholder( $widget_id );
     }
 }
Exemplo n.º 26
0
 public static function make_markers($listings, $marker_args, $map_args)
 {
     self::$markers = array();
     if (isset($listings[0])) {
         foreach ($listings as $listing) {
             self::make_marker($listing, $marker_args);
         }
     } elseif (!empty($listings)) {
         self::make_marker($listings, $marker_args);
     } elseif ($map_args['featured_id']) {
         $api_response = PLS_Listing_Helper::get_featured($featured_option_id);
         foreach ($api_response['listings'] as $listing) {
             self::make_marker($listing, $marker_args);
         }
     } elseif ($map_args['auto_load_listings']) {
         $api_response = PLS_Plugin_API::get_listings($map_args['request_params']);
         foreach ($api_response['listings'] as $listing) {
             self::make_marker($listing, $marker_args);
         }
     }
 }
 /**
  * Returns a form that can be used to search for listings.
  * 
  * The defaults are as follows:
  *     'ajax' - Default is false. Wether the resulting form should use ajax 
  *          or not. If ajax is set to true, then for the form to work, the 
  *          results container should be defined on the page. 
  *          {@link PLS_Partials::get_listings_list_ajax()} should be used.
  *     'context' - An execution context for the function. Used when the 
  *          filters are created.
  *     'context_var' - Any variable that needs to be passed to the filters 
  *          when function is executed.
  * Defines the following hooks.
  *      pls_listings_search_form_bedrooms_array[_context] - Filters the 
  *          array with the data used to generate the select.
  *      pls_listings_search_form_bathrooms_array[_context]
  *      pls_listings_search_form_available_on_array[_context]
  *      pls_listings_search_form_cities_array[_context]
  *      pls_listings_search_form_min_price_array[_context]
  *      pls_listings_search_form_max_price_array[_context]
  *      
  *      pls_listings_search_form_bedrooms_attributes[_context] - Filters 
  *          the attribute array for the select. If extra attributes need to 
  *          be added to the select element, they should be provided in 
  *          a array( $attribute_key => $attribute_value ) form.
  *      pls_listings_search_form_bathrooms_attributes[_context]
  *      pls_listings_search_form_available_on_attributes[_context]
  *      pls_listings_search_form_cities_attributes[_context]
  *      pls_listings_search_form_min_price_attributes[_context]
  *      pls_listings_search_form_max_price_attributes[_context]
  *      
  *      pls_listings_search_form_bedrooms_html[_context] - Filters the html 
  *          for this option. Can be used to add extra containers.
  *      pls_listings_search_form_bathrooms_html[_context]
  *      pls_listings_search_form_available_on_html[_context]
  *      pls_listings_search_form_cities_html[_context]
  *      pls_listings_search_form_min_price_html[_context]
  *      pls_listings_search_form_max_price_html[_context]
  *      
  *      pls_listings_search_form_submit[_context] - Filters the form submit 
  *          button.
  *
  *      pls_listings_search_form_inner[_context] - Filters the form inner html.
  *      pls_listings_search_form_outer[_context] - Filters the form html.
  *
  * @static
  * @param array $args Optional. Overrides defaults.
  * @return string The html for the listings search form.
  * @since 0.0.1
  */
 public static function init($args = '')
 {
     // Define the default argument array
     $defaults = array('ajax' => false, 'class' => 'pls_search_form_listings', 'context' => '', 'theme_option_id' => '', 'context_var' => null, 'bedrooms' => 1, 'min_beds' => 1, 'max_beds' => 1, 'bathrooms' => 1, 'min_baths' => 1, 'max_baths' => 1, 'price' => 1, 'half_baths' => 1, 'property_type' => 1, 'listing_types' => 1, 'zoning_types' => 1, 'purchase_types' => 1, 'available_on' => 1, 'cities' => 1, 'multi_cities' => 0, 'states' => 1, 'multi_states' => 0, 'zips' => 1, 'neighborhood' => 1, 'multi_neighborhoods' => 0, 'county' => 1, 'min_price' => 1, 'max_price' => 1, 'min_price_rental' => 1, 'max_price_rental' => 1, 'min_price_sales' => 1, 'max_price_sales' => 1, 'neighborhood_polygons' => 0, 'neighborhood_polygons_type' => false, 'min_sqft' => 1, 'max_sqft' => 1, 'include_submit' => true, 'pls_empty_value' => array());
     $args = wp_parse_args($args, $defaults);
     $cache_id = $args;
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $cache_id['$_POST'] = $_POST;
     }
     $cache = new PLS_Cache('Search Form');
     if ($result = $cache->get($cache_id)) {
         return $result;
     }
     $form_options = array();
     // Set Form Defaults for params onload, set in Theme Options
     $form_options['location']['locality'] = pls_get_option('form_default_options_locality');
     $form_options['location']['region'] = pls_get_option('form_default_options_region');
     $form_options['location']['postal'] = pls_get_option('form_default_options_postal');
     $form_options['location']['neighborhood'] = pls_get_option('form_default_options_neighborhood');
     $form_options['location']['county'] = pls_get_option('form_default_options_county');
     $form_options['property_type'] = pls_get_option('form_default_options_property_type');
     $_POST = wp_parse_args($_POST, $form_options);
     //respect user settings, unless they are all empty.
     $user_search_params = pls_get_option($args['theme_option_id']);
     if (isset($user_search_params['hide_all']) && $user_search_params['hide_all'] == 1) {
         return '';
     }
     $args = wp_parse_args($args, $user_search_params);
     /** Extract the arguments after they merged with the defaults. */
     extract(wp_parse_args($args, $defaults), EXTR_SKIP);
     // Set the default empty values for the all the form elements.
     // Dev can change defaults via a filter in process defaults.
     $pls_empty_value = self::process_default_value_array($pls_empty_value, $context);
     /**
      * Elements options arrays. Used to generate the HTML.
      */
     /** Prepend the default empty valued element. */
     $user_beds_start = pls_get_option('pls-option-bed-min');
     $user_beds_end = pls_get_option('pls-option-bed-max');
     if (is_numeric($user_beds_start) && is_numeric($user_beds_end)) {
         $beds_range = range($user_beds_start, $user_beds_end);
         $form_options['bedrooms'] = array('pls_empty_value' => $pls_empty_value['bedrooms']) + array_combine($beds_range, $beds_range);
     } else {
         $form_options['bedrooms'] = array('pls_empty_value' => $pls_empty_value['bedrooms']) + range(0, 16);
     }
     /** Prepend the default empty valued element. */
     $user_baths_start = pls_get_option('pls-option-bath-min');
     $user_baths_end = pls_get_option('pls-option-bath-max');
     if (is_numeric($user_baths_start) && is_numeric($user_baths_end)) {
         $baths_range = range($user_baths_start, $user_baths_end);
         $form_options['bathrooms'] = array('pls_empty_value' => $pls_empty_value['bathrooms']) + array_combine($baths_range, $baths_range);
     } else {
         $form_options['bathrooms'] = array('pls_empty_value' => $pls_empty_value['bathrooms']) + range(0, 10);
     }
     /** Prepend the default empty valued element. */
     $user_half_baths_start = pls_get_option('pls-option-half-bath-min');
     $user_half_baths_end = pls_get_option('pls-option-half-bath-max');
     if (is_numeric($user_half_baths_start) && is_numeric($user_half_baths_end)) {
         $half_bath_range = range($user_half_baths_start, $user_half_baths_end);
         $form_options['half_baths'] = array('pls_empty_value' => $pls_empty_value['half_baths']) + array_combine($half_bath_range, $half_bath_range);
     } else {
         $form_options['half_baths'] = array('pls_empty_value' => $pls_empty_value['half_baths']) + range(0, 10);
     }
     /** Generate an array with the next 12 months. */
     $current_month = (int) date('m');
     for ($i = $current_month; $i < $current_month + 12; $i++) {
         $form_options['available_on'][date('d-m-Y', mktime(0, 0, 0, $i, 1))] = date('F Y', mktime(0, 0, 0, $i, 1));
     }
     /** Get the property type options */
     $get_type_response = PLS_Plugin_API::get_type_list();
     // error_log("GET_TYPE_RESPONSE\n" . serialize($get_type_response) . "\n");
     if (empty($get_type_response)) {
         $form_options['property_type'] = array('pls_empty_value' => $pls_empty_value['property_type']);
     } else {
         // if API serves up 'false' key in the array, remove it, because we're going to add one.
         if (isset($get_type_response['false'])) {
             unset($get_type_response['false']);
         }
         $form_options['property_type'] = array_merge(array('pls_empty_value' => $pls_empty_value['property_type']), $get_type_response);
     }
     /** Get the listing type options. */
     $form_options['listing_types'] = array('pls_empty_value' => $pls_empty_value['listing_types']) + PLS_Plugin_API::get_type_values('listing');
     /** Get the zoning type options. */
     $form_options['zoning_types'] = array('pls_empty_value' => $pls_empty_value['zoning_types']) + PLS_Plugin_API::get_type_values('zoning');
     // removed "All" - it's not giving all listings. jquery needs to change to not include "[]"s
     // $form_options['zoning_types'] = PLS_Plugin_API::get_type_values( 'zoning' ); // for Multiple, not for single, see below
     /** Get the purchase type options. */
     $form_options['purchase_types'] = array('pls_empty_value' => $pls_empty_value['purchase_types']) + PLS_Plugin_API::get_type_values('purchase');
     // removed "All" - it's not giving all listings. jquery needs to change to not include "[]"s
     // $form_options['purchase_types'] = PLS_Plugin_API::get_type_values( 'purchase' );
     /** Prepend the default empty valued element. */
     $form_options['available_on'] = array('pls_empty_value' => $pls_empty_value['available_on']) + $form_options['available_on'];
     /** Prepend the default empty valued element. */
     $locations = PLS_Plugin_API::get_location_list();
     $neighborhood_polygons_options = PLS_Plugin_API::get_location_list_polygons($neighborhood_polygons_type);
     if (empty($locations['locality'])) {
         $form_options['cities'] = array('pls_empty_value' => $pls_empty_value['cities']);
     } else {
         unset($locations['locality']['false']);
         sort($locations['locality']);
         $form_options['cities'] = array('pls_empty_value' => $pls_empty_value['cities']) + $locations['locality'];
     }
     if (empty($locations['region'])) {
         $form_options['states'] = array('pls_empty_value' => $pls_empty_value['states']);
     } else {
         unset($locations['region']['false']);
         sort($locations['region']);
         $form_options['states'] = array('pls_empty_value' => $pls_empty_value['states']) + $locations['region'];
     }
     if (empty($locations['postal'])) {
         $form_options['zips'] = array('pls_empty_value' => $pls_empty_value['zips']);
     } else {
         unset($locations['postal']['false']);
         sort($locations['postal']);
         $form_options['zips'] = array('pls_empty_value' => $pls_empty_value['zips']) + $locations['postal'];
     }
     if (empty($locations['neighborhood'])) {
         $form_options['neighborhood'] = array('pls_empty_value' => $pls_empty_value['neighborhoods']);
     } else {
         unset($locations['neighborhood']['false']);
         sort($locations['neighborhood']);
         $form_options['neighborhood'] = array('pls_empty_value' => $pls_empty_value['neighborhoods']) + $locations['neighborhood'];
     }
     if (empty($locations['county'])) {
         $form_options['county'] = array('pls_empty_value' => $pls_empty_value['county']);
     } else {
         unset($locations['county']['false']);
         sort($locations['county']);
         $form_options['county'] = array('pls_empty_value' => $pls_empty_value['county']) + $locations['county'];
     }
     if (empty($neighborhood_polygons_options)) {
         $form_options['neighborhood_polygons'] = array('pls_empty_value' => $pls_empty_value['neighborhood_polygons']);
     } else {
         unset($neighborhood_polygons_options['false']);
         sort($neighborhood_polygons_options);
         $form_options['neighborhood_polygons'] = array('pls_empty_value' => $pls_empty_value['neighborhood_polygons']) + $neighborhood_polygons_options;
     }
     // Min/Max Sqft
     /** Define the minimum price options array. */
     $form_options['min_sqft'] = array('pls_empty_value' => $pls_empty_value['min_sqft'], '200' => '200', '400' => '400', '600' => '600', '800' => '800', '1000' => '1,000', '1200' => '1,200', '1400' => '1,400', '1600' => '1,600', '1800' => '1,800', '2000' => '2,000', '2200' => '2,200', '2400' => '2,400', '2600' => '2,600', '2800' => '2,800', '3000' => '3,000', '3500' => '3,500', '4000' => '4,000', '4500' => '4,500', '5000' => '5,000', '6000' => '6,000', '7000' => '7,000', '8000' => '8,000');
     $user_start_sqft = pls_get_option('pls-option-sqft-min') ? pls_get_option('pls-option-sqft-min') : 0;
     $user_end_sqft = pls_get_option('pls-option-sqft-max');
     $user_inc_sqft = pls_get_option('pls-option-sqft-inc');
     if (is_numeric($user_start_sqft) && is_numeric($user_end_sqft) && is_numeric($user_inc_sqft)) {
         // Handle when increment is larger than the range from start to end
         if ($user_inc_sqft > $user_end_sqft - $user_start_sqft) {
             $user_inc_sqft = $user_end_sqft - $user_start_sqft;
         }
         $range = range($user_start_sqft, $user_end_sqft, $user_inc_sqft);
         $form_options['min_sqft'] = array();
         foreach ($range as $sqft_value) {
             $form_options['min_sqft'][$sqft_value] = PLS_Format::number($sqft_value, array('abbreviate' => false));
         }
     }
     /** Set the maximum price options array. */
     $form_options['max_sqft'] = $form_options['min_sqft'];
     /* max_sqft default needs to be set too */
     $form_options['max_sqft']['pls_empty_value'] = __($pls_empty_value['max_sqft'], pls_get_textdomain());
     // Price Ranges
     /** Define the minimum price options array. */
     $form_options['min_price'] = array('pls_empty_value' => __($pls_empty_value['min_price'], pls_get_textdomain()), '0' => '$0', '400' => '$400', '500' => '$500', '2000' => '$2,000', '3000' => '$3,000', '4000' => '$4,000', '5000' => '$5,000', '50000' => '$50,000', '100000' => '$100,000', '200000' => '$200,000', '350000' => '$350,000', '400000' => '$400,000', '450000' => '$450,000', '500000' => '$500,000', '600000' => '$600,000', '700000' => '$700,000', '800000' => '$800,000', '900000' => '$900,000', '1000000' => '$1,000,000');
     /* Set the maximum price options array + its default */
     $form_options['max_price'] = $form_options['min_price'];
     $form_options['max_price']['pls_empty_value'] = __($pls_empty_value['max_price'], pls_get_textdomain());
     $user_price_start = pls_get_option('pls-option-price-min') ? pls_get_option('pls-option-price-min') : 0;
     $user_price_end = pls_get_option('pls-option-price-max');
     $user_price_inc = pls_get_option('pls-option-price-inc');
     if (is_numeric($user_price_start) && is_numeric($user_price_end) && is_numeric($user_price_inc)) {
         $range = range($user_price_start, $user_price_end, $user_price_inc);
         // Create empty arrays
         $form_options['min_price'] = array();
         $form_options['max_price'] = array();
         // set empty values
         $form_options['min_price']['pls_empty_value'] = __($pls_empty_value['min_price'], pls_get_textdomain());
         $form_options['max_price']['pls_empty_value'] = __($pls_empty_value['max_price'], pls_get_textdomain());
         foreach ($range as $price_value) {
             $form_options['min_price'][$price_value] = PLS_Format::number($price_value, array('abbreviate' => false));
             $form_options['max_price'][$price_value] = PLS_Format::number($price_value, array('abbreviate' => false));
         }
     }
     // Price for Rentals
     /** Define the minimum price options array. */
     $form_options['min_price_rental'] = array('pls_empty_value' => __($pls_empty_value['min_price_rental'], pls_get_textdomain()), '200' => '$200', '400' => '$400', '600' => '$600', '800' => '$800', '1000' => '$1,000', '1100' => '$1,100', '1200' => '$1,200', '1300' => '$1,300', '1400' => '$1,400', '1500' => '$1,500', '1600' => '$1,600', '1700' => '$1,700', '1800' => '$1,800', '1900' => '$1,900', '2000' => '$2,000', '2100' => '$2,100', '2200' => '$2,200', '2300' => '$2,300', '2400' => '$2,400', '2500' => '$2,500', '2600' => '$2,600', '2700' => '$2,700', '2800' => '$2,800', '2900' => '$2,900', '3000' => '$3,000', '3500' => '$3,500', '4000' => '$4,000', '4500' => '$4,500', '5000' => '$5,000', '6000' => '$6,000', '7000' => '$7,000', '8000' => '$8,000');
     /* Set the maximum price rental options array + its default */
     $form_options['max_price_rental'] = $form_options['min_price_rental'];
     $form_options['max_price_rental']['pls_empty_value'] = __($pls_empty_value['max_price_rental'], pls_get_textdomain());
     $user_price_start_rental = pls_get_option('pls-option-rental-price-min') ? pls_get_option('pls-option-rental-price-min') : 0;
     $user_price_end_rental = pls_get_option('pls-option-rental-price-max');
     $user_price_inc_rental = pls_get_option('pls-option-rental-price-inc');
     if (is_numeric($user_price_start_rental) && is_numeric($user_price_end_rental) && is_numeric($user_price_inc_rental)) {
         // Handle when increment is larger than the range from start to end
         if ($user_price_inc_rental > $user_price_end_rental - $user_price_start_rental) {
             $user_price_inc_rental = $user_price_end_rental - $user_price_start_rental;
         }
         $range = range($user_price_start_rental, $user_price_end_rental, $user_price_inc_rental);
         // Create empty arrays
         $form_options['min_price_rental'] = array();
         $form_options['max_price_rental'] = array();
         // set empty values
         $form_options['min_price_rental']['pls_empty_value'] = __($pls_empty_value['min_price_rental'], pls_get_textdomain());
         $form_options['max_price_rental']['pls_empty_value'] = __($pls_empty_value['max_price_rental'], pls_get_textdomain());
         foreach ($range as $price_value) {
             $form_options['min_price_rental'][$price_value] = PLS_Format::number($price_value, array('abbreviate' => false));
             $form_options['max_price_rental'][$price_value] = PLS_Format::number($price_value, array('abbreviate' => false));
         }
     }
     // Price for Sales
     /** Define the minimum price options array. */
     $form_options['min_price_sales'] = array('pls_empty_value' => __($pls_empty_value['min_price_sales'], pls_get_textdomain()), '20000' => '$20,000', '40000' => '$40,000', '60000' => '$60,000', '80000' => '$80,000', '100000' => '$100,000', '120000' => '$120,000', '140000' => '$140,000', '160000' => '$160,000', '180000' => '$180,000', '200000' => '$200,000', '250000' => '$250,000', '300000' => '$300,000', '350000' => '$350,000', '400000' => '$400,000', '450000' => '$450,000', '500000' => '$500,000', '550000' => '$550,000', '600000' => '$600,000', '650000' => '$650,000', '700000' => '$700,000', '750000' => '$750,000', '800000' => '$800,000', '850000' => '$850,000', '900000' => '$900,000', '950000' => '$950,000', '1000000' => '$1,000,000');
     /* Set the maximum price sales options array + its default */
     $form_options['max_price_sales'] = $form_options['min_price_sales'];
     $form_options['max_price_sales']['pls_empty_value'] = __($pls_empty_value['max_price_sales'], pls_get_textdomain());
     $user_price_start_sales = pls_get_option('pls-option-sales-price-min') ? pls_get_option('pls-option-sales-price-min') : 0;
     $user_price_end_sales = pls_get_option('pls-option-sales-price-max');
     $user_price_inc_sales = pls_get_option('pls-option-sales-price-inc');
     if (is_numeric($user_price_start_sales) && is_numeric($user_price_end_sales) && is_numeric($user_price_inc_sales)) {
         // Handle when increment is larger than the range from start to end
         if ($user_price_inc_sales > $user_price_end_sales - $user_price_start_sales) {
             $user_price_inc_sales = $user_price_end_sales - $user_price_start_sales;
         }
         $range = range($user_price_start_sales, $user_price_end_sales, $user_price_inc_sales);
         // Create empty arrays
         $form_options['min_price_sales'] = array();
         $form_options['max_price_sales'] = array();
         // set empty values
         $form_options['min_price_sales']['pls_empty_value'] = __($pls_empty_value['min_price_sales'], pls_get_textdomain());
         $form_options['max_price_sales']['pls_empty_value'] = __($pls_empty_value['max_price_sales'], pls_get_textdomain());
         foreach ($range as $price_value) {
             $form_options['min_price_sales'][$price_value] = PLS_Format::number($price_value, array('abbreviate' => false));
             $form_options['max_price_sales'][$price_value] = PLS_Format::number($price_value, array('abbreviate' => false));
         }
     }
     // Set min_beds/max_beds form element
     $form_options['min_beds'] = array('pls_empty_value' => __($pls_empty_value['min_beds'], pls_get_textdomain()), '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10', '11' => '11', '12' => '12', '13' => '13', '14' => '14', '15' => '15');
     $user_bed_start = pls_get_option('pls-option-bed-min') ? pls_get_option('pls-option-bed-min') : 0;
     $user_bed_end = pls_get_option('pls-option-bed-max') ? pls_get_option('pls-option-bed-max') : 15;
     $user_bed_inc = pls_get_option('pls-option-bed-inc') ? pls_get_option('pls-option-bed-inc') : 1;
     if (is_numeric($user_bed_start) && is_numeric($user_bed_end) && is_numeric($user_bed_inc)) {
         $range = range($user_bed_start, $user_bed_end, $user_bed_inc);
         $form_options['min_beds'] = array();
         foreach ($range as $bed_value) {
             $form_options['min_beds'][$bed_value] = $bed_value;
         }
         $form_options['min_beds'] = array('pls_empty_value' => $pls_empty_value['min_beds']) + $form_options['min_beds'];
     }
     /** Set the max beds array too. */
     $form_options['max_beds'] = $form_options['min_beds'];
     // Set min_baths/max_baths form element
     $form_options['min_baths'] = array('pls_empty_value' => __($pls_empty_value['min_baths'], pls_get_textdomain()), '0' => '0', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10');
     $user_bath_start = pls_get_option('pls-option-bath-min') ? pls_get_option('pls-option-bath-min') : 0;
     $user_bath_end = pls_get_option('pls-option-bath-max') ? pls_get_option('pls-option-bath-max') : 10;
     $user_bath_inc = pls_get_option('pls-option-bath-inc') ? pls_get_option('pls-option-bath-inc') : 1;
     if (is_numeric($user_bath_start) && is_numeric($user_bath_end) && is_numeric($user_bath_inc)) {
         $range = range($user_bath_start, $user_bath_end, $user_bath_inc);
         $form_options['min_baths'] = array();
         foreach ($range as $bath_value) {
             $form_options['min_baths'][$bath_value] = $bath_value;
         }
         $form_options['min_baths'] = array('pls_empty_value' => $pls_empty_value['min_baths']) + $form_options['min_baths'];
     }
     /** Set the max baths array too. */
     $form_options['max_baths'] = $form_options['min_baths'];
     /** Define an array for extra attributes. */
     $form_opt_attr = array();
     /** Filter form fields. */
     $form_option_keys = array_keys($form_options);
     $form_options_count = count($form_option_keys);
     // foreach( $form_options as $option_name => &$opt_array ) {
     // replace the foreach with for to provide reference update functionality in the loop
     for ($i = 0; $i < $form_options_count; $i++) {
         $option_name = $form_option_keys[$i];
         $opt_array = $form_options[$option_name];
         /** Filter each of the fields options arrays. */
         $opt_array = apply_filters(pls_get_merged_strings(array("pls_listings_search_form_{$option_name}_array", $context), '_', 'pre', false), $opt_array, $context_var);
         /** Form options array. */
         $form_opt_attr[$option_name] = apply_filters(pls_get_merged_strings(array("pls_listings_search_form_{$option_name}_attributes", $context), '_', 'pre', false), array(), $context_var);
         /** Make sure it is an array. */
         if (!is_array($form_opt_attr[$option_name])) {
             $form_opt_attr[$option_name] = array();
         }
         /** Append the data-placeholder attribute. */
         if (isset($opt_array['pls_empty_value'])) {
             $form_opt_attr[$option_name] = $form_opt_attr[$option_name] + array('data-placeholder' => $opt_array['pls_empty_value']);
         }
         $form_options[$option_name] = $opt_array;
     }
     if (!isset($_POST['metadata'])) {
         $_POST['metadata'] = array();
     }
     /**
      * Elements HTML.
      */
     /** Add the bedrooms select element. */
     if ($bedrooms == 1) {
         $selected_beds = isset($_POST['metadata']['beds']) ? wp_kses_post($_POST['metadata']['beds']) : false;
         $form_html['bedrooms'] = pls_h('select', array('name' => 'metadata[beds]') + $form_opt_attr['bedrooms'], pls_h_options($form_options['bedrooms'], $selected_beds));
     }
     /** Add the bedrooms select element. */
     if ($min_beds == 1) {
         $selected_min_beds = isset($_POST['metadata']['min_beds']) ? $_POST['metadata']['min_beds'] : false;
         $form_html['min_beds'] = pls_h('select', array('name' => 'metadata[min_beds]') + $form_opt_attr['min_beds'], pls_h_options($form_options['min_beds'], $selected_min_beds));
     }
     /** Add the bedrooms select element. */
     if ($max_beds == 1) {
         $selected_max_beds = isset($_POST['metadata']['max_beds']) ? $_POST['metadata']['max_beds'] : false;
         $form_html['max_beds'] = pls_h('select', array('name' => 'metadata[max_beds]') + $form_opt_attr['max_beds'], pls_h_options($form_options['max_beds'], $selected_max_beds));
     }
     /** Add the bathroms select element. */
     if ($bathrooms == 1) {
         $selected_baths = isset($_POST['metadata']['baths']) ? wp_kses_post($_POST['metadata']['baths']) : false;
         $form_html['bathrooms'] = pls_h('select', array('name' => 'metadata[baths]') + $form_opt_attr['bathrooms'], pls_h_options($form_options['bathrooms'], $selected_baths));
     }
     /** Add the min baths select element. */
     if ($min_baths == 1) {
         $selected_min_baths = isset($_POST['metadata']['min_baths']) ? $_POST['metadata']['min_baths'] : false;
         $form_html['min_baths'] = pls_h('select', array('name' => 'metadata[min_baths]') + $form_opt_attr['min_baths'], pls_h_options($form_options['min_baths'], $selected_min_baths));
     }
     /** Add the max baths select element. */
     if ($max_baths == 1) {
         $selected_max_baths = isset($_POST['metadata']['max_baths']) ? $_POST['metadata']['max_baths'] : false;
         $form_html['max_baths'] = pls_h('select', array('name' => 'metadata[max_baths]') + $form_opt_attr['max_baths'], pls_h_options($form_options['max_baths'], $selected_max_baths));
     }
     /** Add the bathroms select element. */
     if ($half_baths == 1) {
         $selected_half_baths = isset($_POST['metadata']['half_baths']) ? wp_kses_post($_POST['metadata']['half_baths']) : false;
         $form_html['half_baths'] = pls_h('select', array('name' => 'metadata[half_baths]') + $form_opt_attr['half_baths'], pls_h_options($form_options['half_baths'], $selected_half_baths));
     }
     /** Add the property type select element. */
     if ($property_type == 1) {
         $selected_property_type = isset($_POST['property_type']) ? wp_kses_post($_POST['property_type']) : false;
         $form_html['property_type'] = pls_h('select', array('name' => 'property_type') + $form_opt_attr['property_type'], pls_h_options($form_options['property_type'], $selected_property_type));
     }
     /** Add the listing type select element. */
     if ($listing_types == 1) {
         $selected_listing_types = isset($_POST['listing_types']) ? wp_kses_post($_POST['listing_types']) : false;
         $form_html['listing_types'] = pls_h('select', array('name' => 'listing_types') + $form_opt_attr['listing_types'], pls_h_options($form_options['listing_types'], $selected_listing_types));
     }
     /** Add the zoning type select element. */
     if ($zoning_types == 1) {
         $selected_zoning_types = isset($_POST['zoning_types']) ? wp_kses_post($_POST['zoning_types']) : false;
         $form_html['zoning_types'] = pls_h('select', array('name' => 'zoning_types[]') + $form_opt_attr['zoning_types'], pls_h_options($form_options['zoning_types'], $selected_zoning_types));
     }
     /** Add the purchase type select element. */
     if ($purchase_types == 1) {
         $default_purchase_types = @pls_get_option('default_form_options_purchase_types');
         // Set Default
         if (empty($_POST['purchase_types'])) {
             $purchase_types_select = array($default_purchase_types);
         } else {
             $purchase_types_select = wp_kses_post($_POST['purchase_types']);
         }
         $form_html['purchase_types'] = pls_h('select', array('name' => 'purchase_types[]') + $form_opt_attr['purchase_types'], pls_h_options($form_options['purchase_types'], $purchase_types_select));
     }
     /** Add the availability select element. */
     if ($available_on == 1) {
         $selected_avail_on = isset($_POST['metadata']['avail_on']) ? wp_kses_post($_POST['metadata']['avail_on']) : false;
         $form_html['available_on'] = pls_h('select', array('name' => 'metadata[avail_on]') + $form_opt_attr['available_on'], pls_h_options($form_options['available_on'], $selected_avail_on));
     }
     /** Add the cities select element. */
     if ($multi_cities == 1) {
         // multi-city select option enabled
         $selected_locality = isset($_POST['location']['locality']) ? wp_kses_post($_POST['location']['locality']) : false;
         $form_html['cities'] = pls_h('select', array('name' => 'location[locality][]', 'multiple' => 'multiple') + $form_opt_attr['cities'], pls_h_options($form_options['cities'], $selected_locality, true));
     } elseif ($cities == 1) {
         $selected_locality = isset($_POST['location']['locality']) ? wp_kses_post($_POST['location']['locality']) : false;
         $form_html['cities'] = pls_h('select', array('name' => 'location[locality]') + $form_opt_attr['cities'], pls_h_options($form_options['cities'], $selected_locality, true));
     }
     /** Add the cities select element. */
     if ($multi_states == 1) {
         // multi-state select option enabled
         $selected_region = isset($_POST['location']['region']) ? wp_kses_post($_POST['location']['region']) : false;
         $form_html['states'] = pls_h('select', array('name' => 'location[region][]', 'multiple' => 'multiple') + $form_opt_attr['states'], pls_h_options($form_options['states'], $selected_region, true));
     } elseif ($states == 1) {
         $selected_region = isset($_POST['location']['region']) ? wp_kses_post($_POST['location']['region']) : false;
         $form_html['states'] = pls_h('select', array('name' => 'location[region]') + $form_opt_attr['states'], pls_h_options($form_options['states'], $selected_region, true));
     }
     /** Add the cities select element. */
     if ($zips == 1) {
         $selected_postal = isset($_POST['location']['postal']) ? wp_kses_post($_POST['location']['postal']) : false;
         $form_html['zips'] = pls_h('select', array('name' => 'location[postal]') + $form_opt_attr['zips'], pls_h_options($form_options['zips'], $selected_postal, true));
     }
     /** Add the neighborhood select element. */
     if ($multi_neighborhoods == 1) {
         // multi-neighborhood select option enabled
         $selected_neighborhood = isset($_POST['location']['neighborhood']) ? wp_kses_post($_POST['location']['neighborhood']) : false;
         $form_html['neighborhood'] = pls_h('select', array('name' => 'location[neighborhood][]', 'multiple' => 'multiple') + $form_opt_attr['neighborhood'], pls_h_options($form_options['neighborhood'], $selected_neighborhood, true));
     } elseif ($neighborhood == 1) {
         $selected_neighborhood = isset($_POST['location']['neighborhood']) ? wp_kses_post($_POST['location']['neighborhood']) : false;
         $form_html['neighborhood'] = pls_h('select', array('name' => 'location[neighborhood]') + $form_opt_attr['neighborhood'], pls_h_options($form_options['neighborhood'], $selected_neighborhood, true));
     }
     /** Add the county select element. */
     if ($county == 1) {
         $selected_county = isset($_POST['location']['county']) ? wp_kses_post($_POST['location']['county']) : false;
         $form_html['county'] = pls_h('select', array('name' => 'location[county]') + $form_opt_attr['county'], pls_h_options($form_options['county'], $selected_county, true));
     }
     /** Add the neighborhood / neighborhood_polygon select element. */
     if ($neighborhood_polygons == 1) {
         if (count($form_options['neighborhood_polygons']) > 1) {
             $selected_polygons = isset($_POST['neighborhood_polygons']) ? wp_kses_post($_POST['neighborhood_polygons']) : false;
             $form_html['neighborhood_polygons'] = pls_h('select', array('name' => 'neighborhood_polygons') + $form_opt_attr['neighborhood_polygons'], pls_h_options($form_options['neighborhood_polygons'], $selected_polygons, true));
         } else {
             // default to MLS data for neighborhoods if no polygons are set
             $selected_polygons = isset($_POST['location']['neighborhood']) ? wp_kses_post($_POST['location']['neighborhood']) : false;
             $form_html['neighborhood_polygons'] = pls_h('select', array('name' => 'location[neighborhood]') + $form_opt_attr['neighborhood'], pls_h_options($form_options['neighborhood'], $selected_neighborhood, true));
         }
     }
     /** Add the minimum sqft select element. */
     if ($min_sqft == 1) {
         $selected_min_sqft = isset($_POST['metadata']['min_sqft']) ? wp_kses_post($_POST['metadata']['min_sqft']) : false;
         $form_html['min_sqft'] = pls_h('select', array('name' => 'metadata[min_sqft]') + $form_opt_attr['min_sqft'], pls_h_options($form_options['min_sqft'], $selected_min_sqft));
     }
     /** Add the minimum price select element. */
     if ($max_sqft == 1) {
         $selected_max_sqft = isset($_POST['metadata']['max_sqft']) ? wp_kses_post($_POST['metadata']['max_sqft']) : false;
         $form_html['max_sqft'] = pls_h('select', array('name' => 'metadata[max_sqft]') + $form_opt_attr['max_sqft'], pls_h_options($form_options['max_sqft'], $selected_max_sqft));
     }
     /** Add the minimum price select element. */
     if ($min_price == 1) {
         $selected_min_price = isset($_POST['metadata']['min_price']) ? wp_kses_post($_POST['metadata']['min_price']) : false;
         $form_html['min_price'] = pls_h('select', array('name' => 'metadata[min_price]') + $form_opt_attr['min_price'], pls_h_options($form_options['min_price'], $selected_min_price));
     }
     /** Add the maximum price select element. */
     if ($max_price == 1) {
         $selected_max_price = isset($_POST['metadata']['max_price']) ? wp_kses_post($_POST['metadata']['max_price']) : false;
         $form_html['max_price'] = pls_h('select', array('name' => 'metadata[max_price]') + $form_opt_attr['max_price'], pls_h_options($form_options['max_price'], $selected_max_price));
     }
     /** Add the minimum price select element. */
     if ($min_price_rental == 1) {
         $selected_min_price = isset($_POST['metadata']['min_price']) ? wp_kses_post($_POST['metadata']['min_price']) : false;
         $form_html['min_price_rental'] = pls_h('select', array('name' => 'metadata[min_price]') + $form_opt_attr['min_price'], pls_h_options($form_options['min_price_rental'], $selected_min_price));
     }
     /** Add the maximum price select element. */
     if ($max_price_rental == 1) {
         $selected_max_price = isset($_POST['metadata']['max_price']) ? wp_kses_post($_POST['metadata']['max_price']) : false;
         $form_html['max_price_rental'] = pls_h('select', array('name' => 'metadata[max_price]') + $form_opt_attr['max_price'], pls_h_options($form_options['max_price_rental'], $selected_max_price));
     }
     /** Add the minimum price select element. */
     if ($min_price_sales == 1) {
         $selected_min_price = isset($_POST['metadata']['min_price']) ? wp_kses_post($_POST['metadata']['min_price']) : false;
         $form_html['min_price_sales'] = pls_h('select', array('name' => 'metadata[min_price]') + $form_opt_attr['min_price'], pls_h_options($form_options['min_price_sales'], $selected_min_price));
     }
     /** Add the maximum price select element. */
     if ($max_price_sales == 1) {
         $selected_max_price = isset($_POST['metadata']['max_price']) ? wp_kses_post($_POST['metadata']['max_price']) : false;
         $form_html['max_price_sales'] = pls_h('select', array('name' => 'metadata[max_price]') + $form_opt_attr['max_price'], pls_h_options($form_options['max_price_sales'], $selected_max_price));
     }
     $section_title = array('bedrooms' => 'Beds', 'min_beds' => 'Min Beds', 'max_beds' => 'Max Beds', 'bathrooms' => 'Baths', 'min_baths' => 'Min Baths', 'max_baths' => 'Max Baths', 'half_baths' => 'Half Baths', 'property_type' => 'Property Type', 'zoning_types' => 'Zoning Type', 'listing_types' => 'Listing Type', 'purchase_types' => 'Purchase Type', 'available_on' => 'Available', 'cities' => 'Near', 'states' => 'State', 'zips' => 'Zip Code', 'min_price' => 'Min Price', 'max_price' => 'Max Price', 'neighborhood' => 'Neighborhood', 'county' => 'County', 'min_beds' => 'Min Beds', 'max_beds' => 'Max Beds', 'min_price_rental' => 'Min Price Rental', 'max_price_rental' => 'Max Price Rental', 'min_price_sales' => 'Min Price Sales', 'max_price_sales' => 'Max Price Sales', 'neighborhood_polygons' => 'Neighborhood Polygon', 'min_sqft' => 'Min Sqft', 'max_sqft' => 'Max Sqft');
     // In case user somehow disables all filters.
     if (empty($form_html)) {
         return '';
     }
     /** Apply filters on all the form elements html. */
     $form_html_keys = array_keys($form_html);
     $form_html_count = count($form_html_keys);
     // foreach( $form_html as $option_name => &$opt_html ) {
     for ($i = 0; $i < $form_html_count; $i++) {
         $option_name = $form_html_keys[$i];
         $opt_html = $form_html[$option_name];
         $opt_html = apply_filters(pls_get_merged_strings(array("pls_listings_search_form_{$option_name}_html", $context), '_', 'pre', false), $opt_html, $form_options[$option_name], $section_title[$option_name], $context_var);
         $form_html[$option_name] = $opt_html;
     }
     /** Combine the form elements. */
     $form = '';
     foreach ($form_html as $label => $select) {
         $form .= pls_h('section', array('class' => $label . ' pls_search_form'), pls_h_label($section_title[$label], $label) . $select);
     }
     /** Add the filtered submit button. */
     if ($include_submit) {
         $form_html['submit'] = apply_filters(pls_get_merged_strings(array("pls_listings_search_submit", $context), '_', 'pre', false), pls_h('input', array('class' => 'pls_search_button', 'type' => 'submit', 'value' => 'Search')), $context_var);
         /** Append the form submit. */
         $form .= $form_html['submit'];
     }
     /** Wrap the combined form content in the form element and filter it. */
     $form_id = pls_get_merged_strings(array('pls-listings-search-form', $context), '-', 'pre', false);
     $form = pls_h('form', array('action' => @$form_data->action, 'method' => 'post', 'id' => $form_id, 'class' => $class), @$form_data->hidden_field . apply_filters(pls_get_merged_strings(array("pls_listings_search_form_inner", $context), '_', 'pre', false), $form, $form_html, $form_options, $section_title, $context_var));
     /** Filter the form. */
     $result = apply_filters(pls_get_merged_strings(array("pls_listings_search_form_outer", $context), '_', 'pre', false), $form, $form_html, $form_options, $section_title, @$form_data, $form_id, $context_var);
     // Load the filters.js script...
     $result .= '<script type="text/javascript" src="' . trailingslashit(PLS_JS_URL) . 'scripts/filters.js"></script>';
     $cache->save($result);
     return $result;
 }
Exemplo n.º 28
0
"><?php 
    bloginfo('name');
    ?>
</a></h1>
					<p id="slogan"><?php 
    bloginfo('description');
    ?>
</p>
				<?php 
}
?>

			</section>

			<?php 
$api_whoami = PLS_Plugin_API::get_user_details();
?>

			<?php 
if ($email || $phone) {
    ?>

			<section class="contact-info">

				<?php 
    if ($email) {
        ?>

				<section class="email"><?php 
        _e('Email', 'manchester');
        ?>
Exemplo n.º 29
0
</h4>	
						<a class="pls_view_search" href="<?php 
        echo $saved_search['url'];
        ?>
" >View Search</a> 
						<a class="pls_remove_search" href="<?php 
        echo $saved_search_hash;
        ?>
">Remove Search</a>
					</div>
					<ul class="saved_search_items">
						<?php 
        foreach ($saved_search['filters'] as $key => $value) {
            ?>
							<li><span><?php 
            echo PLS_Plugin_API::translate_key($key);
            ?>
:</span> <?php 
            echo $value;
            ?>
</li>
						<?php 
        }
        ?>
					</ul>
				</li>
			<?php 
    }
    ?>
		</ul>
	<?php