/** * 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); /* 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']) && !pls_has_plugin_error()) { $widget_title = $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title; } /** Get the list of listings using the partial. */ $listings_args = array('limit' => $instance['number'], 'width' => $instance['width'], 'height' => $instance['height'], 'placeholder_img' => $instance['placeholder'], 'crop_description' => 1, 'context' => 'widget', 'context_var' => $widget_id, 'featured_option_id' => $featured_option_id); /** If field is empty, remove it so that the function's defaults can be used. */ if (empty($instance['placeholder'])) { unset($listings_args['placeholder_img']); } // set context so filter can customize the layout $listings_args['context'] = 'get_listings_widget'; // pls_dump($listings_args); $widget_body = PLS_Partials::get_listings($listings_args); /** Apply a filter on the whole widget */ echo apply_filters('pls_widget_listings', $widget_title . $widget_body, $widget_title, $before_title, $after_title, $widget_body, $instance, $widget_id, $listings_args); /* Close the theme's widget wrapper. */ echo $after_widget; }
public function widget($args, $instance) { list($args, $instance) = self::process_defaults($args, $instance); extract($args, EXTR_SKIP); $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']); $search_form_filter_string = ''; $search_form_filter_string .= 'context=' . apply_filters('pls_widget_quick_search_context', 'quick_search_widget'); $search_form_filter_string .= apply_filters('pls_widget_quick_search_filter_string', '&ajax=0'); $search_form_filter_string .= '&class=pls_quick_search'; if (get_theme_support('pls-quick-search-neighborhood-polygon')) { $search_form_filter_string .= '&neighborhood_polygons=1'; } echo $before_widget; echo $before_title . $title . $after_title; echo PLS_Partials::get_listings_search_form($search_form_filter_string); echo "<section class='clear'></section>"; // echo "</section>"; echo $after_widget; }
<?php /** * Template Name: Listings Search * * This is the template for "Listings" search results page. * * @package PlacesterBlueprint * @subpackage Template */ ?> <style type="text/css"> #custom { display:none; } </style> <section class="complex-search grid_8 alpha" itemscope itemtype="http://schema.org/SearchResultsPage"> <?php echo PLS_Partials::get_listings_search_form('context=listings&ajax=1&neighborhood_polygons=1&neighborhood_polygons_type=neighborhood'); ?> <div class="clear"></div> <div style="font-size: 16px; font-weight: bold; float: right;" id="pls_listings_search_results"><span id="pls_num_results"></span> listing match your search.</div> </section> <div class="grid_8 alpha" id="content" role="main"> <?php echo PLS_Partials::get_listings_list_ajax('context=listings_search&table_id=placester_listings_list'); ?> </div>
listings.init(); }); </script> <div id="slideshow" class="clearfix theme-default left bottomborder grid_8 alpha"> <?php //echo PLS_Map::lifestyle(array(), array('width' => 590, 'height' => 300, 'life_style_search' => true,'show_lifestyle_controls' => true, 'show_lifestyle_checkboxes' => true, 'show_submit' => true, 'lat' => '41.815594', 'lng' => '-71.413879' ) ); ?> <?php //echo PLS_Map::lifestyle_polygon(array(), array('width' => 590, 'height' => 300, 'life_style_search' => true,'show_lifestyle_controls' => true, 'show_lifestyle_checkboxes' => true, 'show_submit' => true, 'lat' => '41.815594', 'lng' => '-71.413879' ) ); ?> <?php echo PLS_Map::listings(null, array('width' => 950, 'height' => 400)); ?> <?php //echo PLS_Map::polygon(null, array('width' => 590, 'height' => 250, 'zoom' => 16,'map_js_var' => 'test2', 'canvas_id' => 'another2', 'polygon_search' => 'neighborhood', 'search_class' => 'another')); ?> <?php echo PLS_Partials::get_listings_search_form(array('context' => 'home_map', 'search_id' => 'another', 'class' => 'another', 'bedrooms' => 1, 'min_beds' => 0, 'max_beds' => 0, 'bathrooms' => 0, 'min_baths' => 0, 'max_baths' => 0, 'price' => 0, 'half_baths' => 0, 'property_type' => 0, 'listing_types' => 0, 'zoning_types' => 0, 'purchase_types' => 0, 'available_on' => 0, 'cities' => 0, 'states' => 0, 'zips' => 0, 'neighborhood' => 0, 'county' => 0, 'min_price' => 0, 'max_price' => 0, 'min_price_rental' => 0, 'max_price_rental' => 0, 'neighborhood_polygons' => 0)); ?> <?php echo PLS_Partials::get_listings_list_ajax(array('context' => 'custom_listings_search', 'table_id' => 'placester_listings_list', 'map_js_var' => 'test2')); ?> </div> <div id="listing" class="grid_8 alpha"></div> ?>
*/ ?> <section id="slideshow" class="slider-wrapper theme-default"> <?php echo PLS_Slideshow::slideshow(array('animation' => 'fade', 'animationSpeed' => 1000, 'pauseOnHover' => true, 'advanceSpeed' => 4000, 'startClockOnMouseOut' => true, 'startClockOnMouseOutAfter' => 1000, 'directionalNav' => true, 'captions' => true, 'captionAnimation' => 'fade', 'captionAnimationSpeed' => 800, 'afterSlideChange' => 'function(){}', 'width' => 623, 'height' => 300, 'context' => 'home', 'featured_option_id' => 'slideshow-featured-listings', 'listings' => 'limit=5&is_featured=true&sort_by=price')); ?> <script type="text/javascript"> // Hack to alter bullets styling for formerly BP 1.0 themes -- need to do this more intelligently... jQuery(window).load(function () { jQuery('.orbit-bullets').css('margin-top', '-90px'); }); </script> <div class="clr"></div> </section> <section id="listing"> <h3><?php _e('New Listings', 'tampa'); ?> </h3> <?php echo PLS_Partials::get_listings("limit=5&featured_option_id=custom-featured-listings&context=home"); ?> <?php PLS_Listing_Helper::get_compliance(array('context' => 'search', 'agent_name' => false, 'office_name' => false)); ?> </section>
?> <!-- Search List --> <section id="lvl4"> <div class="wrapper"> <section class="left-content"> <section class="list2"> <h5><?php _e('SEARCH RESULTS', 'manchester'); ?> </h5> <?php echo PLS_Partials::get_listings_list_ajax('crop_description=1&context=custom_listings_search'); ?> <?php PLS_Listing_Helper::get_compliance(array('context' => 'search', 'agent_name' => false, 'office_name' => false)); ?> </section> <!-- /list2 --> </section> <!-- /left-content --> <!-- Floating Map --> <aside class="sidebar"> <section id="floating-box"> <div id="float-div"> <section class="side-bin"> <h5><?php _e('MAP', 'manchester');
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; }
<?php /** * This class contains methods that return plugin data wrapped in HTML. * * Each method implements filters that allow the theme developer to modify the returned data contextually. * * @package PlacesterBlueprint * @since 0.0.1 */ PLS_Partials::init(); class PLS_Partials { // Links in all the hooks and includes public static function init() { // All the includes include_once trailingslashit(PLS_PAR_DIR) . 'custom-property-details.php'; include_once trailingslashit(PLS_PAR_DIR) . 'get-listings-ajax.php'; include_once trailingslashit(PLS_PAR_DIR) . 'get-listings-search-form.php'; include_once trailingslashit(PLS_PAR_DIR) . 'get-listings.php'; // This hook allows for listing/property detail pages to be rendered correctly across themes add_filter('the_content', array(__CLASS__, 'custom_property_details_html_filter'), 11); } // Wrapper for calling get listings directly public static function get_listings($args = array()) { return PLS_Partial_Get_Listings::init($args); } // Wrapper for listings search for content public static function get_listings_search_form($args)
/** * Template Name: Client Profile * * This is the template for the loggedin area of clients * * @package PlacesterBlueprint * @subpackage Template */ ?> <style type="text/css"> .dataTables_length { display: none; } </style> <?php if (is_user_logged_in()) { ?> <h1>Your Favorite Listings</h1> <div class="grid_8 alpha" id="content" role="main"> <?php echo PLS_Partials::get_listings_list_ajax('context=listings_search&table_id=placester_fav_list&show_sort=1'); ?> </div> <?php } else { ?> <h1>You need to Login or Sign Up</h1> <?php }