Example #1
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'];
 }
Example #2
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;
}
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;
}
Example #4
0
      <?php 
if (is_home()) {
    ?>
        <?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'listings', 'agent_name' => false, 'office_name' => false));
    ?>
      <?php 
}
?>

      <?php 
if (is_page('Listings') || is_page('listings') || is_page('Open Houses')) {
    ?>
        <?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'search', 'agent_name' => false, 'office_name' => false));
    ?>
      <?php 
}
?>

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

    </footer>

    <?php 
pls_do_atomic('after_footer');
?>
Example #5
0
function custom_property_details_page($html, $listing)
{
    ob_start();
    ?>

<section id="lvl2">
	<div class="wrapper">
		<div id="property">
			<h2><?php 
    _e('Property Details', 'manchester');
    ?>
</h2>
				<section class="property-inf">
					<div class="property-title">
						<span class="blue"><b><?php 
    echo $listing['location']['full_address'];
    ?>
</b></span>
						<p><span><?php 
    echo $listing['cur_data']['beds'];
    ?>
 <?php 
    _e('Bedrooms', 'manchester');
    ?>
</span> <span><?php 
    echo $listing['cur_data']['baths'];
    ?>
 <?php 
    _e('Bathrooms', 'manchester');
    ?>
</span></p>
					</div>
		<div class="property-price">
			<span class="green"><b><?php 
    echo PLS_Format::number($listing['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
    ?>
</b></span>
		</div>
</section>

<section class="property-bin">
	<div class="property-img">
		<div class="img_box">
			<?php 
    if ($listing['images']) {
        ?>
				<?php 
        echo PLS_Image::load($listing['images'][0]['url'], array('resize' => array('w' => 600, 'h' => 250, 'method' => 'crop'), 'fancybox' => false, 'as_html' => true, 'html' => array('img_classes' => 'main-banner')));
        ?>
  
			<?php 
    } else {
        ?>
				<?php 
        echo PLS_Image::load(null, array('resize' => array('w' => 600, 'h' => 250, 'method' => 'crop'), 'fancybox' => false, 'as_html' => true, 'html' => array('img_classes' => 'main-banner')));
        ?>
  
			<?php 
    }
    ?>
		</div>
	</div>
</section>

<!-- sidebar container section -->
<section class="property-map">
	<div class="property-gmap">
		<?php 
    echo PLS_Map::dynamic($listing, array('lat' => $listing['location']['coords'][0], 'lng' => $listing['location']['coords'][1], 'zoom' => '14', 'width' => 338, 'height' => 230, 'canvas_id' => 'map_canvas', 'class' => 'custom_google_map', 'map_js_var' => 'pls_google_map', 'ajax_form_class' => false));
    ?>
	</div>

	<script type="text/javascript">
      jQuery(document).ready(function( $ ) {
        var map = new Map();
        var listing = new Listings({
          single_listing: <?php 
    echo json_encode($listing);
    ?>
,
          map: map
        });
        map.init({
          type: 'single_listing', 
          listings: listing,
          lat : <?php 
    echo json_encode($listing['location']['coords'][0]);
    ?>
,
          lng : <?php 
    echo json_encode($listing['location']['coords'][1]);
    ?>
,
          zoom : 14
        });
        listing.init();
      });
	</script>

	<div class="property-lnks">
		<!-- <section class="list-fav"><a href="#"><?php 
    _e('Add to favorites', 'manchester');
    ?>
</a></section> -->
		<section class="list-req"><a href="<?php 
    echo pls_get_option('pls-user-email');
    ?>
"><?php 
    _e('Request more info', 'manchester');
    ?>
</a></section>
	</div>
</section>

		<!-- </div>
	</div> end of wrapper
</section> -->


<section id="lvl4">
	<div class="wrapper">
		
		<section class="left-content">

			<section class="list2">
				<h5><?php 
    _e('DETAILS', 'manchester');
    ?>
</h5>
				
				<section class="list-item">
					<section class="list-details">

						<section class="list-details-1-2">
							<label><?php 
    _e('Zoning Type', 'manchester');
    ?>
</label>
							<p><?php 
    echo ucwords($listing['zoning_types'][0]);
    ?>
</p>
							<?php 
    if (isset($listing['purchase_types'][0])) {
        ?>
							<label><?php 
        _e('Listing Type', 'manchester');
        ?>
</label>
							<p><?php 
        echo ucwords($listing['purchase_types'][0]);
        ?>
</p>
							<?php 
    }
    ?>
							<?php 
    if ($listing['property_type']) {
        ?>
								<label><?php 
        _e('Property Type', 'manchester');
        ?>
</label>
								<p><?php 
        echo PLS_Format::translate_property_type($listing);
        ?>
</p>
							<?php 
    }
    ?>

							<?php 
    if (isset($listing['rets']['mls_id'])) {
        ?>
								<label><?php 
        _e('MLS#', 'manchester');
        ?>
</label>
								<p><?php 
        echo $listing['rets']['mls_id'];
        ?>
</p>
							<?php 
    } else {
        ?>
								<label><?php 
        _e('Ref #', 'manchester');
        ?>
</label>
								<p><?php 
        echo $listing['id'];
        ?>
</p>
							<?php 
    }
    ?>

						</section>

						<section class="list-details-2-2">
							<label><?php 
    _e('Bedrooms', 'manchester');
    ?>
</label>
							<p><?php 
    echo $listing['cur_data']['beds'];
    ?>
</p>
							<label><?php 
    _e('Bathrooms', 'manchester');
    ?>
</label>
							<p><?php 
    echo $listing['cur_data']['baths'];
    ?>
</p>
							<label><?php 
    _e('Half Baths', 'manchester');
    ?>
</label>
							<p><?php 
    echo $listing['cur_data']['half_baths'];
    ?>
</p>
						</section>

					</section>
				</section>

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

				<?php 
    if ($listing['cur_data']['desc']) {
        ?>
					<h5><?php 
        _e('DESCRIPTION', 'manchester');
        ?>
</h5>
					<section class="list-item">
						<section class="list-details"><?php 
        echo $listing['cur_data']['desc'];
        ?>
</section>
					</section>
				<?php 
    }
    ?>

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

				<?php 
    $amenities = PLS_Format::amenities_but($listing, array('half_baths', 'beds', 'baths', 'url', 'sqft', 'avail_on', 'price', 'desc'));
    ?>

				<?php 
    if (isset($amenities['list']) && $amenities['list'] != null) {
        ?>
					<?php 
        $amenities['list'] = PLS_Format::translate_amenities($amenities['list']);
        ?>
					<h5><?php 
        _e('PROPERTY AMENITIES', 'manchester');
        ?>
</h5>
						<section class="list-item">
							<section class="list-amenity">
								<?php 
        foreach ($amenities['list'] as $amenity => $value) {
            ?>
									<label><span><?php 
            echo $amenity;
            ?>
</span> <?php 
            echo $value;
            ?>
</label>
								<?php 
        }
        ?>
							</section>
						</section>

						<div class="separator-1-sma"></div>
				<?php 
    }
    ?>

				<?php 
    if (isset($amenities['ngb']) && $amenities['ngb'] != null) {
        ?>
					<?php 
        $amenities['ngb'] = PLS_Format::translate_amenities($amenities['ngb']);
        ?>
					<h5><?php 
        _e('NEIGHBORHOOD AMENITIES', 'manchester');
        ?>
</h5>
						<section class="list-item">
							<section class="list-amenity">
								<?php 
        foreach ($amenities['ngb'] as $amenity => $value) {
            ?>
									<label><span><?php 
            echo $amenity;
            ?>
</span> <?php 
            echo $value;
            ?>
</label>
								<?php 
        }
        ?>
							</section>
						</section>

						<div class="separator-1-sma"></div>
				<?php 
    }
    ?>

				<?php 
    if (isset($amenities['uncur']) && $amenities['uncur'] != null) {
        ?>
					<?php 
        $amenities['uncur'] = PLS_Format::translate_amenities($amenities['uncur']);
        ?>
					<h5><?php 
        _e('CUSTOM AMENITIES', 'manchester');
        ?>
</h5>
						<section class="list-item">
							<section class="list-amenity">
								<?php 
        foreach ($amenities['uncur'] as $amenity => $value) {
            ?>
									<label><span><?php 
            echo $amenity;
            ?>
</span> <?php 
            echo $value;
            ?>
</label>
								<?php 
        }
        ?>
							</section>
						</section>

						<div class="separator-1-sma"></div>
				<?php 
    }
    ?>

			</section><!-- /.list2 -->
		</section><!-- /.left-content -->


		<aside class="sidebar">
			<section class="side-bin2">

				<?php 
    if ($listing['images']) {
        ?>
				<h5><?php 
        _e('PHOTO GALLERY', 'manchester');
        ?>
</h5>
				<section class="gallery">
					<?php 
        foreach ($listing['images'] as $image) {
            ?>
							<?php 
            echo PLS_Image::load($image['url'], array('resize' => array('w' => 140, 'h' => 93, 'method' => 'crop'), 'fancybox' => true, 'as_html' => false));
            ?>
					<?php 
        }
        ?>
				</section>
				<?php 
    }
    ?>
			</section>
		</aside>

		<div class="clr"></div>
	
	</div><!-- end of wrapper -->
</section>


<section id="lvl5">
	<div class="wrapper">

		<section class="neighborhood">

			<h5><?php 
    _e('NEIGHBORHOOD', 'manchester');
    ?>
</h5>
			<section class="neighborhood-map">
				<?php 
    echo PLS_Map::dynamic($listing, array('lat' => $listing['location']['coords'][0], 'lng' => $listing['location']['coords'][1], 'zoom' => '13', 'width' => 960, 'height' => 258, 'canvas_id' => 'map_canvas_nbr', 'class' => 'custom_google_map_nbr', 'map_js_var' => 'pls_google_map_nbr', 'ajax_form_class' => false));
    ?>
			</section>

			<script type="text/javascript">
		        jQuery(document).ready(function( $ ) {
		          var map_nbr = new Map();
		          var listing_nbr = new Listings({
		            single_listing: <?php 
    echo json_encode($listing);
    ?>
,
		            map: map_nbr
		          });
		          map_nbr.init({
		            type: 'single_listing', 
		            dom_id: 'map_canvas_nbr',
		            listings: listing_nbr,
		            lat: <?php 
    echo json_encode($listing['location']['coords'][0]);
    ?>
,
		            lng: <?php 
    echo json_encode($listing['location']['coords'][1]);
    ?>
,
		            zoom: 14
		          });
		          listing_nbr.init();
		        });
			</script>
		
		</section>
		

		<?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'listings', 'agent_name' => $listing['rets']['aname'], 'office_name' => $listing['rets']['oname'], 'office_phone' => PLS_Format::phone($listing['contact']['phone']), 'agent_license' => isset($listing['rets']['alicense']) ? $listing['rets']['alicense'] : false, 'co_agent_name' => isset($listing['rets']['aconame']) ? $listing['rets']['aconame'] : false, 'co_office_name' => isset($listing['rets']['oconame']) ? $listing['rets']['oconame'] : false));
    ?>
	</div><!-- end of wrapper -->
</section>

	<?php 
    return ob_get_clean();
}
function custom_listings_search_list($listing_item_html, $listing, $context_var)
{
    // return $listing_item_html;
    /** Start output buffering. The buffered html will be returned to the filter. */
    ob_start();
    // pls_dump($listing);
    ?>

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

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

		</section>

		<section class="list-txt">                               
			<section class="list-info">
				<h5><a href="<?php 
    echo $listing['cur_data']['url'];
    ?>
"><?php 
    echo $listing['location']['address'];
    ?>
</a></h5>
				<h6><?php 
    echo $listing['location']['locality'] . ', ' . $listing['location']['region'];
    ?>
</h6>
				<p class="nrm-txt"><?php 
    echo substr($listing['cur_data']['desc'], 0, 300);
    ?>
</p>
				<p class="nrm-txt">
					<b><?php 
    echo $listing['cur_data']['beds'];
    ?>
</b> <span class="beds-n-baths"><?php 
    _e('Beds', 'manchester');
    ?>
</span> |
					<b><?php 
    echo $listing['cur_data']['baths'];
    ?>
</b> <span class="beds-n-baths"><?php 
    _e('Baths', 'manchester');
    ?>
</span>
					<?php 
    if ($listing['cur_data']['sqft'] != null) {
        ?>
 
						| <b><?php 
        echo PLS_Format::number($listing['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false));
        ?>
</b><span class="beds-n-baths"> <?php 
        _e('sqft', 'manchester');
        ?>
</span>
					<?php 
    }
    ?>
				</p>
			</section>

			<section class="list-price">
				<span class="green"><b><?php 
    echo PLS_Format::number($listing['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
    ?>
</b><?php 
    if (isset($listing['cur_data']['lse_trms'])) {
        echo $listing['cur_data']['lse_trms'];
    }
    ?>
</span><br />
				<?php 
    if (!empty($listing['property_type'])) {
        ?>
					<span class="nrm-txt"><?php 
        echo ucwords($listing['property_type']);
        ?>
</span>
				<?php 
    }
    ?>
			</section>

			<section class="list-links">
				<!-- <section class="list-fav"><a href="#"><?php 
    _e('Add to favorites', 'manchester');
    ?>
</a></section> -->
				<section class="list-req"><a href="mailto:<?php 
    echo pls_get_option('pls-user-email');
    ?>
"><?php 
    _e('Request more info', 'manchester');
    ?>
</a></section>
				<section class="list-btn1">
					<div class="img_btn"><a href="<?php 
    echo $listing['cur_data']['url'];
    ?>
"><input type="submit" value="<?php 
    _e('See Details', 'manchester');
    ?>
" class="button b-blue medium" /></a></div>
				</section>
			</section>
	</section>
	<?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'inline_search', 'agent_name' => $listing['rets']['aname'], 'office_name' => $listing['rets']['oname'], 'office_phone' => PLS_Format::phone($listing['contact']['phone']), 'agent_license' => isset($listing['rets']['alicense']) ? $listing['rets']['alicense'] : false, 'co_agent_name' => isset($listing['rets']['aconame']) ? $listing['rets']['aconame'] : false, 'co_office_name' => isset($listing['rets']['oconame']) ? $listing['rets']['oconame'] : false));
    ?>

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

<?php 
    $html = ob_get_clean();
    // current js build throws a fit when newlines are present
    // will need to strip them.
    // added EMCA tag will solve in the future.
    $html = preg_replace('/[\\n\\r\\t]/', ' ', $html);
    return $html;
}
Example #7
0
function custom_property_details_page($html, $listing)
{
    ob_start();
    // pls_dump($listing);
    ?>
<div id="main">
	
	<section class="property-banner">
		<?php 
    if ($listing['images']) {
        ?>
      <?php 
        echo PLS_Image::load($listing['images'][0]['url'], array('resize' => array('w' => 625, 'h' => 292, 'method' => 'crop'), 'fancybox' => false, 'as_html' => true, 'html' => array('img_classes' => 'main-banner')));
        ?>
  
    <?php 
    } else {
        ?>
      <?php 
        echo PLS_Image::load(null, array('resize' => array('w' => 625, 'h' => 292, 'method' => 'crop'), 'fancybox' => false, 'as_html' => true, 'html' => array('img_classes' => 'main-banner')));
        ?>
    <?php 
    }
    ?>
  	<p class="state"><?php 
    echo $listing['location']['full_address'];
    ?>
 <span class="rent"><?php 
    echo PLS_Format::number($listing['cur_data']['price'], array('abbreviate' => false, 'add-currency-sign' => true));
    ?>
<em></em></span><br><span class="details"><?php 
    echo $listing['cur_data']['beds'];
    ?>
 <?php 
    _e('Bedrooms', 'tampa');
    ?>
 | <?php 
    echo $listing['cur_data']['baths'];
    ?>
 <?php 
    _e('Bathrooms', 'tampa');
    ?>
</span></p>
  </section>

	<section class="user-generated">
		<h3><?php 
    _e('Details', 'tampa');
    ?>
</h3>
		<ul class="list-half">
			<li><?php 
    _e('Listing Type', 'tampa');
    ?>
 <span><?php 
    echo ucwords($listing['purchase_types'][0]);
    ?>
</span></li>
			<li><?php 
    _e('Bedrooms', 'tampa');
    ?>
 <span><?php 
    echo $listing['cur_data']['beds'];
    ?>
</span></li>
			<li><?php 
    _e('Property Type', 'tampa');
    ?>
				<span><?php 
    echo PLS_Format::translate_property_type($listing);
    ?>
</span>
			</li>
			<li><?php 
    _e('Bathrooms', 'tampa');
    ?>
 <span><?php 
    echo $listing['cur_data']['baths'];
    ?>
</span></li>
		  <?php 
    if (isset($listing['rets']['mls_id'])) {
        ?>
		    <li><?php 
        _e('MLS #', 'tampa');
        ?>
    		<span><?php 
        echo $listing['rets']['mls_id'];
        ?>
</span>
        </li>
    	<?php 
    }
    ?>
			<li><?php 
    _e('Half Baths', 'tampa');
    ?>
 <span><?php 
    echo $listing['cur_data']['half_baths'];
    ?>
</span></li>                                                            
		</ul><!--list-half-->
		<div class="clr"></div>
	</section><!--user-generated-->

	<?php 
    if ($listing['cur_data']['desc']) {
        ?>
		<section class="user-generated">
			<h3><?php 
        _e('Description', 'tampa');
        ?>
</h3>
			<p><?php 
        echo $listing['cur_data']['desc'];
        ?>
</p>
		</section>
	<?php 
    }
    ?>

	<?php 
    $amenities = PLS_Format::amenities_but($listing, array('half_baths', 'beds', 'baths', 'url', 'sqft', 'avail_on', 'price', 'desc'));
    ?>

	<?php 
    if (isset($amenities['list']) && $amenities['list'] != null) {
        ?>
		<section class="user-generated">
			<h3><?php 
        _e('Property Amenities', 'tampa');
        ?>
</h3>
			<ul class="list-third">
				<?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 class="clr"></div>
		</section>
	<?php 
    }
    ?>

	<?php 
    if (isset($amenities['ngb']) && $amenities['ngb'] != null) {
        ?>
		<section class="user-generated">
			<h3><?php 
        _e('Neighborhood Amenities', 'tampa');
        ?>
</h3>
			<ul class="list-third">
				<?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 class="clr"></div>
		</section>
	<?php 
    }
    ?>

	<?php 
    if (isset($amenities['uncur']) && $amenities['uncur'] != null) {
        ?>
		<section class="user-generated">
			<h3><?php 
        _e('Property Amenities', 'tampa');
        ?>
</h3>
			<ul class="list-third">
			<?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 class="clr"></div>
		</section>
	<?php 
    }
    ?>


</div><!--main-->
  
<aside>
	<section id="single-property-mini-map">
		<h3><php _e('Location', 'tampa'); ?></h3>
		<?php 
    echo PLS_Map::dynamic($listing, array('lat' => $listing['location']['coords'][0], 'lng' => $listing['location']['coords'][1], 'zoom' => '14', 'width' => 288, 'height' => 217, 'canvas_id' => 'map_canvas', 'class' => 'custom_google_map', 'map_js_var' => 'pls_google_map', 'ajax_form_class' => false));
    ?>

		<script type="text/javascript">
	      jQuery(document).ready(function( $ ) {
	        var map = new Map();
	        var listing = new Listings({
	          single_listing: <?php 
    echo json_encode($listing);
    ?>
,
	          map: map
	        });
	        map.init({
	          type: 'single_listing', 
	          listings: listing,
	          lat : <?php 
    echo json_encode($listing['location']['coords'][0]);
    ?>
,
	          lng : <?php 
    echo json_encode($listing['location']['coords'][1]);
    ?>
,
	          zoom : 14
	        });
	        listing.init();
	      });
    	</script>

	    <div class="map-bar">
	    	<!-- <a class="fav-org" href="#">Add to Favorites</a> -->
	      	<a class="info-org" href="mailto:<?php 
    echo pls_get_option('pls-user-email');
    ?>
"><?php 
    _e('Request More Info', 'tampa');
    ?>
</a>
	      	<div class="clr"></div>
	    </div><!--map-bar-->
	</section>

	<?php 
    if ($listing['images']) {
        ?>
		<section id="gallery">
			<h3><?php 
        _e('Photo Gallery', 'tampa');
        ?>
</h3>    
			<?php 
        foreach ($listing['images'] as $image) {
            ?>
					<?php 
            echo PLS_Image::load($image['url'], array('resize' => array('w' => 120, 'h' => 95, 'method' => 'crop'), 'fancybox' => true, 'as_html' => false));
            ?>
 
			<?php 
        }
        ?>
		</section><!--gallery-->
	<?php 
    }
    ?>

</aside>

<div class="clr"></div>

<section id="full">
  	<section class="user-generated">
	    <h3><?php 
    _e('Neighborhood', 'tampa');
    ?>
</h3>      
	    <?php 
    echo PLS_Map::dynamic($listing, array('lat' => $listing['location']['coords'][0], 'lng' => $listing['location']['coords'][1], 'zoom' => '14', 'width' => 930, 'height' => 260, 'canvas_id' => 'map_canvas_nbr', 'class' => 'custom_google_map_nbr', 'map_js_var' => 'pls_google_map_nbr', 'ajax_form_class' => false));
    ?>
  	</section>

  	<script type="text/javascript">
        jQuery(document).ready(function( $ ) {
          var map_nbr = new Map();
          var listing_nbr = new Listings({
            single_listing: <?php 
    echo json_encode($listing);
    ?>
,
            map: map_nbr
          });
          map_nbr.init({
            type: 'single_listing', 
            dom_id: 'map_canvas_nbr',
            listings: listing_nbr,
            lat: <?php 
    echo json_encode($listing['location']['coords'][0]);
    ?>
,
            lng: <?php 
    echo json_encode($listing['location']['coords'][1]);
    ?>
,
            zoom: 14
          });
          listing_nbr.init();
        });
	</script>
  
	<?php 
    if (isset($listing['cur_data']['mls_number']) && isset($listing['mls_logo'])) {
        ?>
		<section class="user-generated">
		    <h3><?php 
        _e('Listing Supply Source', 'tampa');
        ?>
</h3>
				<p class="p-supply"><?php 
        _e('MLS #', 'tampa');
        ?>
: <?php 
        echo $listing['cur_data']['mls_number'];
        ?>
</p>
		    <div class="clr"></div>
	  	</section>
	<?php 
    }
    ?>
	
	<?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'listings', 'agent_name' => $listing['rets']['aname'], 'office_name' => $listing['rets']['oname'], 'office_phone' => PLS_Format::phone($listing['contact']['phone']), 'agent_license' => isset($listing['rets']['alicense']) ? $listing['rets']['alicense'] : false, 'co_agent_name' => isset($listing['rets']['aconame']) ? $listing['rets']['aconame'] : false, 'co_office_name' => isset($listing['rets']['oconame']) ? $listing['rets']['oconame'] : false));
    ?>
</section><!--full-->

<?php 
    return ob_get_clean();
}
    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;
    }
Example #9
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;
    }
function custom_manchester_widget_html_filter($listing_html, $listing_data)
{
    // pls_dump($listing_data);
    ob_start();
    ?>
		<section class="listing-item">
			<h4>
				<a href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><?php 
    echo $listing_data['location']['address'];
    ?>
</a>
			</h4>
			<section class="details">
				<span class="bed"><strong><?php 
    echo $listing_data['cur_data']['beds'];
    ?>
</strong> <?php 
    _e('Beds', 'manchester');
    ?>
</span>
				<span class="bath"><strong><?php 
    echo $listing_data['cur_data']['baths'];
    ?>
</strong> <?php 
    _e('Baths', 'manchester');
    ?>
</span>
				<span class="area"><strong><?php 
    echo PLS_Format::number($listing_data['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false));
    ?>
</strong> <?php 
    _e('sqft', 'manchester');
    ?>
</span>
			</section>
			<section class="featured-image">
				<?php 
    if (isset($listing_data['images']) && is_array($listing_data['images'])) {
        ?>
					<a href="<?php 
        echo $listing_data['cur_data']['url'];
        ?>
">
			  		<?php 
        echo PLS_Image::load($listing_data['images'][0]['url'], array('resize' => array('w' => 280, 'h' => 170, 'method' => 'crop'), 'fancybox' => true));
        ?>
					</a>
				<?php 
    }
    ?>
			</section>
			<?php 
    if (isset($listing_data['rets']['mls_id'])) {
        ?>
    		<p class="mls"><?php 
        _e('MLS', 'manchester');
        ?>
 #: <?php 
        echo $listing_data['rets']['mls_id'];
        ?>
</p>
    	<?php 
    }
    ?>
			<a class="learn-more" href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><?php 
    _e('Learn More', 'manchester');
    ?>
</a>
    <?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'listings_widget', '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="clearfix"></div>
		</section>
     <?php 
    $listing_html = ob_get_clean();
    return $listing_html;
}
Example #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;
    }
Example #12
0
 /**
  * Slideshow
  * 
  * @param string $args 
  * @param mixed $data 
  * @static
  * @access public
  * @return void
  */
 public static function slideshow($args = '')
 {
     /** Define the default argument array */
     $defaults = array('animation' => 'fade', 'animationSpeed' => 800, 'timer' => true, 'advanceSpeed' => 4000, 'pauseOnHover' => true, 'startClockOnMouseOut' => true, 'startClockOnMouseOutAfter' => 500, 'directionalNav' => true, 'captions' => true, 'captionAnimation' => 'fade', 'captionAnimationSpeed' => 800, 'afterSlideChange' => 'function(){}', 'bullets' => 'false', 'width' => 620, 'height' => 300, 'container_height' => false, 'context' => '', 'context_var' => false, 'featured_option_id' => false, 'allow_user_slides' => false, 'user_slides_header_id' => false, 'listings' => 'limit=5&sort_by=price', 'data' => false, 'post_id' => false, 'post_meta_key' => false, 'fluid' => false);
     $args = wp_parse_args($args, $defaults);
     /** Check cache, return something is there **/
     $cache = new PLS_Cache('slide');
     if ($result = $cache->get($args)) {
         return $result;
     }
     /** Extract all args for easy usage **/
     extract($args, EXTR_SKIP);
     /** If the slideshow data is null or not an array AND the plugin is working, try to fetch the proper data... **/
     if ((!$data || !is_array($data)) && !pls_has_plugin_error()) {
         /** Data assumed to take this form. */
         $data = array('images' => array(), 'links' => array(), 'captions' => array());
         // If the calling theme allows user input, get slideshow config option...
         if ($allow_user_slides && $user_slides_header_id) {
             $slides = pls_get_option($user_slides_header_id, array());
             // Check to see if slides are set to custom, but are empty
             $custom_but_empty = isset($slides[0]) && $slides[0]['type'] == 'custom' && empty($slides[0]['image']);
             // Populate slides when '$custom_but_empty' is true OR when no slides exist...
             if ($custom_but_empty || empty($slides)) {
                 $slides = self::empty_slides_and_add_random_listings();
             }
             foreach ($slides as $index => $slide) {
                 switch ($slide['type']) {
                     case 'listing':
                         unset($slide['html'], $slide['image'], $slide['type'], $slide['link']);
                         // In this case, the slide's remaining key will correspond to it's property ID...
                         $property_id = key($slide);
                         $api_response = PLS_Plugin_API::get_listing_details(array('property_ids' => array($property_id)));
                         if (!empty($api_response['listings']) && $api_response['listings'][0]['id'] === false) {
                             self::$listings_to_delete[] = $property_id;
                         }
                         if ($api_response['total'] == '1') {
                             $listing = $api_response['listings'][0];
                             $first_valid_img_url = null;
                             // Overwrite the placester url with the local url...
                             $listing_url = PLS_Plugin_API::get_property_url($listing['id']);
                             $data['links'][] = $listing_url;
                             // Try to retrieve the image url if order is set...
                             if (is_array($listing['images']) && isset($listing['images'][0]['order'])) {
                                 foreach ($listing['images'] as $key => $image) {
                                     if ($image['order'] == 1) {
                                         $data['images'][$index] = $image['url'];
                                         // break, just in case the listing has more than one '1' in the 'order' param
                                         break;
                                     }
                                     // Record the first valid image URL in case no image has the top order...
                                     if (!isset($first_valid_img_url) && isset($image['url'])) {
                                         $first_valid_img_url = $image['url'];
                                     }
                                 }
                             }
                             // If image still isn't set, use first valid image URL discovered above, or just set to default...
                             if (empty($data['images'][$index])) {
                                 $data['images'][$index] = isset($first_valid_img_url) ? $first_valid_img_url : self::$default_img_url;
                             }
                             $data['type'][] = 'listing';
                             $data['listing'][] = $listing;
                             /** Get the listing caption **/
                             $data['captions'][] = trim(self::render_listing_caption($listing, $index));
                         }
                         break;
                     case 'custom':
                         $is_empty = empty($slide['image']) && empty($slide['link']) && empty($slide['image']) && empty($slide['html']);
                         // Only include a custom slide if it's not entirely empty...
                         if (!$is_empty) {
                             $data['images'][] = $slide['image'];
                             $data['links'][] = $slide['link'];
                             $data['type'][] = 'custom';
                             $data['captions'][] = trim(self::render_custom_caption($slide['html'], $index));
                         }
                         break;
                 }
             }
         } else {
             if (!empty($args['post_id']) && !empty($args['post_meta_key'])) {
                 $api_response = PLS_Listing_Helper::get_featured_from_post($args['post_id'], $args['post_meta_key']);
             } elseif ($featured_option_id) {
                 $api_response = PLS_Listing_Helper::get_featured($featured_option_id);
             }
             if (empty($api_response['listings'])) {
                 $api_response = PLS_Plugin_API::get_listings($listings);
             }
             foreach ($api_response['listings'] as $index => $listing) {
                 if (empty($listing['id'])) {
                     continue;
                 }
                 $listing_url = PLS_Plugin_API::get_property_url($listing['id']);
                 /** Overwrite the placester url with the local url. */
                 $data['links'][] = $listing_url;
                 $data['images'][] = !empty($listing['images']) ? $listing['images'][0]['url'] : self::$default_img_url;
                 $data['listing'][] = $listing;
                 // Get the listing caption
                 $listing_caption = trim(self::render_listing_caption($listing, $index));
                 // Add a filter for a single caption, to be edited via a template
                 $single_caption = apply_filters(pls_get_merged_strings(array('pls_slideshow_single_caption', $context), '_', 'pre', false), $listing_caption, $listing, $context, $context_var, $index);
                 $data['captions'][] = $single_caption;
             }
         }
     }
     /** Filter the data array */
     $data = apply_filters(pls_get_merged_strings(array('pls_slideshow_data', $context), '_', 'pre', false), $data, $context, $context_var);
     /** Create the slideshow */
     $html = array('slides' => '', 'captions' => '');
     if (is_array($data['images'])) {
         foreach ($data['images'] as $index => $slide_src) {
             $extra_attr = array();
             $extra_attr['title'] = '';
             /** Save the caption and the title attribute for the img. */
             if (isset($data['captions'][$index])) {
                 $html['captions'] .= $data['captions'][$index];
                 $extra_attr['title'] = "#caption-{$index}";
             }
             if (isset($data['type'][$index])) {
                 // Get image, but only Dragonfly listing images
                 switch ($data['type'][$index]) {
                     case "listing":
                         $slide_src = PLS_Image::load($slide_src, array('resize' => array('w' => $width, 'h' => $height), 'fancybox' => false, 'as_html' => false));
                         break;
                     case "custom":
                         $slide_src = PLS_Image::load($slide_src, array('allow_resize' => false, 'fancybox' => false, 'as_html' => false));
                         break;
                 }
             }
             /** Create the img element. */
             $slide = pls_h_img($slide_src, false, $extra_attr);
             /** Wrap it in an achor if the anchor exists. */
             if (isset($data['links'][$index])) {
                 $slide = pls_h_a($data['links'][$index], $slide, array('data-caption' => "#caption-{$index}"));
             }
             $html['slides'] .= $slide;
         }
     }
     /** Combine the HTML **/
     $html = pls_h_div($html['slides'], array('id' => 'slider', 'class' => 'orbitSlider')) . $html['captions'];
     /** Filter the HTML array */
     $html = apply_filters(pls_get_merged_strings(array('pls_slideshow_html', $context), '_', 'pre', false), $html, $data, $context, $context_var, $args);
     if (!$container_height) {
         $container_height = $height;
     }
     /** Render the necessary inline CSS... */
     $css_args = array('width' => $width, 'height' => $height, 'container_height' => $container_height);
     $css = self::render_inline_css($css_args);
     /** Render the necessary inline JS... **/
     $args['data'] = is_string($data) ? $data : '';
     // For compatibility...
     $js = self::render_inline_js($args);
     /** Filter inline JS **/
     $js = apply_filters(pls_get_merged_strings(array('pls_slideshow_js', $context), '_', 'pre', false), $js, $html, $data, $context, $context_var);
     /** Filter the final output **/
     $full_slideshow = apply_filters(pls_get_merged_strings(array('pls_slideshow', $context), '_', 'pre', false), $css . $html . $js, $html, $js, $data, $context, $context_var, $args);
     /** Cache rendered slideshow for future retrieval **/
     $cache->save($full_slideshow);
     return $full_slideshow;
 }
Example #13
0
function custom_tampa_widget_html_filter($listing_html, $listing_data)
{
    // pls_dump($listing_data);
    ob_start();
    ?>

	<div class="featured-slot">
			<?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' => 120, 'h' => 90, 'method' => 'crop'), 'fancybox' => true, 'as_html' => false));
        ?>
			<?php 
    } else {
        ?>
				<?php 
        echo PLS_Image::load('', array('resize' => array('w' => 120, 'h' => 90, 'method' => 'crop'), 'fancybox' => false, 'as_html' => true));
        ?>
    	
			<?php 
    }
    ?>
			<h4>
				<a href="<?php 
    echo $listing_data['cur_data']['url'];
    ?>
"><?php 
    echo $listing_data['location']['full_address'];
    ?>
</a>
			</h4>
			<p class="rent-label">
				<span>
					<?php 
    echo PLS_Format::number($listing_data['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
    ?>
					<?php 
    if ($listing_data['cur_data']['lse_trms'] != null) {
        echo '<em>' . $listing_data['cur_data']['lse_trms'] . '</em>';
    }
    ?>
				</span>
					<?php 
    echo ucwords($listing_data['purchase_types'][0]);
    ?>
			</p>
			<?php 
    if (isset($listing_data['rets']['mls_id'])) {
        ?>
    		<p class="mls"><?php 
        _e('MLS #', 'tampa');
        ?>
: <?php 
        echo $listing_data['rets']['mls_id'];
        ?>
</p>
    	<?php 
    }
    ?>
    <?php 
    PLS_Listing_Helper::get_compliance(array('context' => 'listings_widget', '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="clearfix"></div>
	</div><!--featured-slot-->
    
     <?php 
    $listing_html = ob_get_clean();
    return $listing_html;
}
Example #14
0
        ?>
                <li><span><?php 
        echo $amenity;
        ?>
</span> <?php 
        echo $value;
        ?>
</li>
            <?php 
    }
    ?>
        </div>	
    <?php 
}
?>

    <div class="map-wrapper grid_8 alpha">
        <h3>Property Map</h3>
        <div class="map">
            <?php 
echo PLS_Map::dynamic($listing_data, array('lat' => $listing_data['location']['coords'][0], 'lng' => $listing_data['location']['coords'][1], 'width' => 590, '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']));
?>
</article>
<?php 
$html = ob_get_clean();
echo apply_filters('property_details_filter', $html, $listing_data);
Example #15
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);
         }
     }
 }
Example #16
0
<?php

PLS_Listing_Helper::init();
class PLS_Listing_Helper
{
    public static function init()
    {
        add_action('wp_ajax_pls_listings_for_options', array(__CLASS__, 'listings_for_options'));
        add_action('wp_ajax_pls_get_search_count', array(__CLASS__, 'get_search_count'));
        add_action('wp_ajax_nopriv_pls_get_search_count', array(__CLASS__, 'get_search_count'));
        // Set default property URL (can't call functions when declaring class variables)
        self::$default_listing['url'] = PLS_Plugin_API::get_property_url();
    }
    public static function listings_for_options()
    {
        $api_response = PLS_Plugin_API::get_listings($_POST);
        $formatted_listings = '';
        if ($api_response['listings']) {
            foreach ($api_response['listings'] as $listing) {
                if (!empty($listing['location']['unit'])) {
                    $formatted_listings .= '<option value="' . $listing['id'] . '" >' . $listing['location']['address'] . ', #' . $listing['location']['unit'] . ', ' . $listing['location']['locality'] . ', ' . $listing['location']['region'] . '</option>';
                } else {
                    $formatted_listings .= '<option value="' . $listing['id'] . '" >' . $listing['location']['address'] . ', ' . $listing['location']['locality'] . ', ' . $listing['location']['region'] . '</option>';
                }
            }
        } else {
            $formatted_listings .= "No Results. Broaden your search.";
        }
        echo json_encode($formatted_listings);
        die;
    }
Example #17
0
function custom_listings_search_list($listing_item_html, $listing, $context_var)
{
    // return $listing_item_html;
    /** Start output buffering. The buffered html will be returned to the filter. */
    ob_start();
    // pls_dump($listing);
    ?>

<section class="list-unit">

	<section class="lu-left">
		<?php 
    if (!empty($listing['images'])) {
        ?>
			<?php 
        echo PLS_Image::load($listing['images'][0]['url'], array('resize' => array('w' => 149, 'h' => 90, 'method' => 'crop'), 'fancybox' => true, 'as_html' => true));
        ?>
		<?php 
    } else {
        ?>
			<?php 
        echo PLS_Image::load('', array('resize' => array('w' => 149, 'h' => 90, 'method' => 'crop'), 'fancybox' => true, 'as_html' => true));
        ?>
    	
		<?php 
    }
    ?>
	

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

	</section><!--lu-left-->

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

		<div class="lu-price">
			<p class="price"><?php 
    echo PLS_Format::number($listing['cur_data']['price'], array('abbreviate' => false, 'add_currency_sign' => true));
    ?>
</p>
			<p class="month"><?php 
    echo ucwords($listing['purchase_types'][0]);
    ?>
</p>
		</div><!--LU PRICE-->

		<div class="lu-main">
			<p><?php 
    echo substr($listing['cur_data']['desc'], 0, 300);
    ?>
</p>
			<p class="info"><span><?php 
    echo $listing['cur_data']['beds'];
    ?>
</span> <?php 
    _e('Bedrooms', 'tampa');
    ?>
 | <span><?php 
    echo $listing['cur_data']['baths'];
    ?>
</span> <?php 
    _e('Bathrooms', 'tampa');
    ?>
 <?php 
    if ($listing['cur_data']['sqft'] != null) {
        echo '| <span>' . PLS_Format::number($listing['cur_data']['sqft'], array('abbreviate' => false, 'add_currency_sign' => false)) . '</span> ' . __('sqft', 'tampa');
    }
    ?>
</p>
			<!-- <a class="fav" href="#"><?php 
    _e('Add to Favorites', 'tampa');
    ?>
</a> -->
			<a class="info-bt" href="mailto:<?php 
    echo pls_get_option('pls-user-email');
    ?>
"><?php 
    _e('Request Information', 'tampa');
    ?>
</a>
			<a class="see-details-link details-bt" href="<?php 
    echo $listing['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['rets']['aname'], 'office_name' => $listing['rets']['oname'], 'office_phone' => PLS_Format::phone($listing['contact']['phone']), 'agent_license' => isset($listing['rets']['alicense']) ? $listing['rets']['alicense'] : false, 'co_agent_name' => isset($listing['rets']['aconame']) ? $listing['rets']['aconame'] : false, 'co_office_name' => isset($listing['rets']['oconame']) ? $listing['rets']['oconame'] : false));
    ?>
	<div class="clearfix"></div>

</section><!--LIST UNIT-->

<?php 
    $html = ob_get_clean();
    // current js build throws a fit when newlines are present
    // will need to strip them.
    // added EMCA tag will solve in the future.
    $html = preg_replace('/[\\n\\r\\t]/', ' ', $html);
    return $html;
}