Changeset 935428
- Timestamp:
- 06/19/2014 10:30:41 PM (12 years ago)
- Location:
- placester/trunk
- Files:
-
- 4 added
- 3 deleted
- 20 edited
-
blueprint/blueprint.php (modified) (1 diff)
-
blueprint/extensions/options-framework/css/.sass-cache (deleted)
-
blueprint/extensions/slideshow.php (modified) (2 diffs)
-
blueprint/functions/form.php (modified) (2 diffs)
-
blueprint/functions/formatting.php (modified) (2 diffs)
-
blueprint/functions/lead-capture.php (modified) (3 diffs)
-
blueprint/functions/listings.php (modified) (4 diffs)
-
blueprint/functions/widgets/contact.php (modified) (2 diffs)
-
blueprint/functions/widgets/quick-search.php (modified) (1 diff)
-
blueprint/js/libs/spinner/preview_load_spin.gif (added)
-
blueprint/js/libs/spinner/spinner.css (deleted)
-
blueprint/js/libs/spinner/spinner.js (modified) (1 diff)
-
blueprint/js/libs/spinner/spinner.sass (deleted)
-
blueprint/js/libs/underscore (added)
-
blueprint/js/libs/underscore/underscore-min.js (added)
-
blueprint/js/scripts.php (modified) (2 diffs)
-
blueprint/js/scripts/contact.widget.ajax.js (modified) (1 diff)
-
blueprint/options/compliance.php (added)
-
blueprint/partials/get-listings-ajax.php (modified) (1 diff)
-
blueprint/partials/get-listings.php (modified) (4 diffs)
-
helpers/listing.php (modified) (1 diff)
-
helpers/option.php (modified) (4 diffs)
-
js/admin/my-listings.js (modified) (1 diff)
-
lib/caching.php (modified) (1 diff)
-
lib/component_entities.php (modified) (1 diff)
-
placester.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
placester/trunk/blueprint/blueprint.php
r867277 r935428 279 279 'datatable' => array('script' => true, 'style' => true), 280 280 'jquery-ui' => array('script' => true, 'style' => true), 281 'spinner' => array( 'script' => true , 'style' => true),281 'spinner' => array( 'script' => true ), 282 282 'masonry' => array('script' => true, 'style' => false), 283 283 'jquery-tools' => array('script' => true, 'style' => false), -
placester/trunk/blueprint/extensions/slideshow.php
r867277 r935428 88 88 'post_id' => false, 89 89 'post_meta_key' => false, 90 'fluid' => false 90 'fluid' => false, 91 'span_not_img' => false 91 92 ); 92 93 $args = wp_parse_args( $args, $defaults ); … … 241 242 } 242 243 243 /** Create the img element. */ 244 $slide = pls_h_img($slide_src, false, $extra_attr); 244 /** Create the img or span element. */ 245 if ($span_not_img) { 246 $slide = '<span style="background-image: url(' . $slide_src . ');"></span>'; 247 } else { 248 $slide = pls_h_img($slide_src, false, $extra_attr); 249 } 250 245 251 246 252 /** Wrap it in an achor if the anchor exists. */ -
placester/trunk/blueprint/functions/form.php
r754259 r935428 134 134 'title' => '', 135 135 'title_visible' => false, 136 'success_message' => 'Thank you for the email, we\'ll get back to you shortly',136 'success_message' => "Thank you for the email! We'll get back to you shortly.", 137 137 'name_value' => 'Full Name', 138 138 'email_value' => 'Email Address', … … 168 168 'title' => '', 169 169 'title_visible' => false, 170 'success_message' => 'Thank you for the email, we\'ll get back to you shortly',170 'success_message' => "Thank you for the email! We'll get back to you shortly.", 171 171 'name_value' => 'Full Name', 172 172 'email_value' => 'Email Address', -
placester/trunk/blueprint/functions/formatting.php
r918887 r935428 595 595 "ngb_pubsch" => "Public School", 596 596 "school_district" => "School District", 597 "sch_elm" => "Elementary School", 598 "sch_hgh" => "High School", 599 "sch_jnr" => "Junior High School", 597 600 "zone" => "Zone", 598 601 "road_surface" => "Road Surface", … … 740 743 $url = str_replace(' ', '+', $url); 741 744 $result = wp_remote_get($url); 742 if (!is_array($result) || !isset($result['body']) || !$result['body']) { 743 return; 744 } 745 $source = $result['body']; 746 $obj = json_decode($source); 747 $lat_lng_array['lat'] = $obj->results[0]->geometry->location->lat; 748 $lat_lng_array['lng'] = $obj->results[0]->geometry->location->lng; 749 return $lat_lng_array; 750 } 751 745 746 $body = json_decode($result['body']); 747 if(isset($body->results) && isset($body->results[0]) && isset($body->results[0]->geometry)) { 748 return array( 749 'lat' => $body->results[0]->geometry->location->lat, 750 'lng' => $body->results[0]->geometry->location->lng); 751 } 752 753 return null; 754 } 755 752 756 //end of class 753 757 } -
placester/trunk/blueprint/functions/lead-capture.php
r867277 r935428 17 17 $title_text = pls_get_option('pd-lc-form-title'); 18 18 $description = pls_get_option('pd-lc-form-description'); 19 $success_message = htmlspecialchars(pls_get_option('pd-lc-form-message')); 19 20 20 21 // Default … … 30 31 <?php if ( $description_visible == true && !empty( $description ) ): ?> 31 32 <div class="lc-description"> 32 < ?php echo $description; ?>33 <p><?php echo $description; ?></p> 33 34 </div> 34 35 <?php endif; ?> … … 41 42 "title" => '', 42 43 "title_visible" => $title_visible != false ? true : false, 43 "success_message" => !empty($success_message) ? $success_message : "Thank you for the email , we'll get back to you shortly",44 "success_message" => !empty($success_message) ? $success_message : "Thank you for the email! We'll get back to you shortly.", 44 45 // Name 45 46 "name_value" => $name_placeholder != "Full Name" ? $name_placeholder : "Full Name", -
placester/trunk/blueprint/functions/listings.php
r770408 r935428 3 3 PLS_Listing_Helper::init(); 4 4 class PLS_Listing_Helper { 5 5 6 6 public static function init() { 7 7 add_action('wp_ajax_pls_listings_for_options', array(__CLASS__,'listings_for_options')); … … 19 19 if ($api_response['listings']) { 20 20 foreach ($api_response['listings'] as $listing) { 21 if ( !empty($listing['location']['unit']) ) {21 if ( !empty($listing['location']['unit']) ) { 22 22 $formatted_listings .= '<option value="' . $listing['id'] . '" >' . $listing['location']['address'] . ', #' . $listing['location']['unit'] . ', ' . $listing['location']['locality'] . ', ' . $listing['location']['region'] . '</option>'; 23 23 } … … 38 38 $api_response = array('listings' => array()); 39 39 $option_ids = pls_get_option($featured_option_id); 40 40 41 41 if (!empty($option_ids)) { 42 42 $property_ids = array_keys($option_ids); … … 45 45 $args['property_ids'] = $property_ids; 46 46 } 47 47 48 48 $api_response = PLS_Plugin_API::get_listing_details($args); 49 50 // Remove listings without images...51 foreach ($api_response['listings'] as $key => $listing) {52 if (empty($listing['images'])) {53 unset($api_response['listings'][$key]);54 }55 }49 50 // // Remove listings without images... 51 // foreach ($api_response['listings'] as $key => $listing) { 52 // if (empty($listing['images'])) { 53 // unset($api_response['listings'][$key]); 54 // } 55 // } 56 56 } 57 57 58 58 return $api_response; 59 59 } 60 60 61 61 // Pass in property IDs array 62 62 public static function get_featured_from_post ($post_id, $post_meta_key) { -
placester/trunk/blueprint/functions/widgets/contact.php
r867277 r935428 63 63 // Labels and Values 64 64 $title = apply_filters('widget_title', empty($instance['title']) ? ' ' : $instance['title']); 65 $success_message = apply_filters('success_message', empty($instance['success_message']) ? 'Thank you for the email, we\'ll get back to you shortly': $instance['success_message']);65 $success_message = apply_filters('success_message', empty($instance['success_message']) ? "Thank you for the email! We'll get back to you shortly." : $instance['success_message']); 66 66 $submit_value = apply_filters('button', empty($instance['button']) ? 'Send' : $instance['button']); 67 67 … … 242 242 243 243 <div class="pls-contact-form-loading" style='display:none;'> 244 < div id="medium-spinner"><div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div><div class="bar5"></div><div class="bar6"></div><div class="bar7"></div><div class="bar8"></div></div>244 <img class="spinner" id="spinner" src="/wp-content/plugins/placester/blueprint/js/libs/spinner/preview_load_spin.gif" width="25" /> 245 245 </div> 246 246 -
placester/trunk/blueprint/functions/widgets/quick-search.php
r867277 r935428 31 31 32 32 if (get_theme_support('pls-quick-search-neighborhood-polygon')) { 33 $search_form_filter_string .= '&neighborhood_polygons=1 ';33 $search_form_filter_string .= '&neighborhood_polygons=1&neighborhood_polygons_type=neighborhood'; 34 34 } 35 35 -
placester/trunk/blueprint/js/libs/spinner/spinner.js
r754259 r935428 1 1 jQuery(document).ready(function($) { 2 var spinningBars = '< div id="spinner"><div class="bar1"></div><div class="bar2"></div><div class="bar3"></div><div class="bar4"></div><div class="bar5"></div><div class="bar6"></div><div class="bar7"></div><div class="bar8"></div></div>';2 var spinningBars = '<img id="spinner" src="/wp-content/plugins/placester/blueprint/js/libs/spinner/preview_load_spin.gif" width="50" />'; 3 3 $('.dataTables_processing').html(spinningBars); 4 4 }); -
placester/trunk/blueprint/js/scripts.php
r918887 r935428 68 68 wp_enqueue_script('search-bootloader'); 69 69 70 wp_register_script( 'underscore', trailingslashit( PLS_JS_URL ) . 'libs/underscore/underscore-min.js'); 71 wp_enqueue_script('underscore'); 70 // This is needed for templatized mapinfo popups, which are not currently used in any of our themes 71 // wp_register_script( 'underscore', trailingslashit( PLS_JS_URL ) . 'libs/underscore/underscore-min.js'); 72 // wp_enqueue_script('underscore'); 72 73 73 74 if ( pls_has_plugin_error() ) { … … 114 115 /** Register the script and style. */ 115 116 wp_register_script( 'spinner', trailingslashit( PLS_JS_URL ) . 'libs/spinner/spinner.js' , array( 'jquery'), NULL, true ); 116 wp_register_style( 'spinner', trailingslashit( PLS_JS_URL ) . 'libs/spinner/spinner.css' );117 117 /** Enqueue script and styles only if supported. */ 118 118 if ( is_array( $js[0]['spinner'] ) ) { 119 119 if ( in_array( 'script', $js[0]['spinner'] ) ) { 120 120 wp_enqueue_script( 'spinner' ); 121 wp_enqueue_style( 'spinner' );122 121 } 123 122 } -
placester/trunk/blueprint/js/scripts/contact.widget.ajax.js
r754259 r935428 71 71 $('.placester_contact_form form').slideUp(); 72 72 73 // Show success message74 73 setTimeout(function() { 74 // special handling for lead capture form -- render markup only on success 75 var lc_message_div = $(".lc-contact-form .success"); 76 var lc_message_src = lc_message_div.text(); 77 if(lc_message_src) 78 lc_message_div.html(lc_message_src); 79 80 // show success message 75 81 $(".placester_contact_form .success").show('fast'); 82 76 83 // mark contact form as submitted so lead capture's force-back functionality doesn't fire 77 84 $(".placester_contact_form input[name='form_submitted']").val(1); -
placester/trunk/blueprint/partials/get-listings-ajax.php
r918887 r935428 113 113 114 114 // Ultimately, sort params in the $_POST array take precedence if they exist... 115 $sort_by = isset($_POST['sort_by']) ? $_POST['sort_by'] : $sort_by _dflt;116 $sort_type = isset($_POST['sort_type']) ? $_POST['sort_type'] : $sort_type _dflt;115 $sort_by = isset($_POST['sort_by']) ? $_POST['sort_by'] : $sort_by; 116 $sort_type = isset($_POST['sort_type']) ? $_POST['sort_type'] : $sort_type; 117 117 118 118 ob_start(); -
placester/trunk/blueprint/partials/get-listings.php
r867277 r935428 63 63 { $width = absint($width); } 64 64 65 / ** Sanitize the height. */65 // Sanitize the height 66 66 if ($height) 67 67 { $height = absint($height); } … … 77 77 // If plugin is active, grab listings intelligently... 78 78 if (!pls_has_plugin_error()) { 79 $listings_raw = false; 80 79 81 80 if ($featured_option_id) { 82 81 $listings_raw = PLS_Listing_Helper::get_featured($featured_option_id, $args); 83 } 84 85 if ($neighborhood_polygons) { 82 83 // If the user hasn't set featured listings, get the ones with the most pictures 84 if (empty($listings_raw['listings'])) { 85 $listings_raw = PLS_Plugin_API::get_listings(array_merge($request_params, array('sort_by' => 'total_images', 'sort_type' => 'desc'))); 86 if(is_array($listings_raw['listings'])) { shuffle($listings_raw['listings']); } // make the choices less obviously sorted 87 } 88 } 89 90 elseif ($neighborhood_polygons) { 86 91 $listings_raw = PLS_Plugin_API::get_polygon_listings( array('neighborhood_polygons' => $neighborhood_polygons ) ); 87 } 88 89 if ($listings_raw === false || ( isset($listings_raw['listings']) && empty($listings_raw['listings']) )) { 92 93 // Do we ever fall through to here? And if so, will this give the result we want? 94 if (empty($listings_raw['listings'])) { 95 $listings_raw = PLS_Plugin_API::get_listings($request_params); 96 } 97 } 98 99 else { 90 100 $listings_raw = PLS_Plugin_API::get_listings($request_params); 91 101 } 92 102 } 93 103 94 104 /** Define variable which will contain the html string with the listings. */ 95 105 $return = ''; … … 108 118 // filter listings before output 109 119 if (isset($featured_listing_id)) { 110 $listings_raw = apply_filters( $context . '_partial_get_listings', $listings_raw, $featured_listing_id );111 } 112 120 $listings_raw = apply_filters( $context . '_partial_get_listings', $listings_raw, $featured_listing_id ); 121 } 122 113 123 // For repeated use in the loop... 114 124 $listing_cache = new PLS_Cache('Listing'); … … 116 126 // Curate the listing_data... 117 127 foreach ($listings_raw['listings'] as $listing_data) { 118 // Ignore featured listings without images119 if ( !empty($args['featured_option_id']) && empty($listing_data['images']) ) {120 continue;121 }122 123 128 $listing_html = ''; 124 129 -
placester/trunk/helpers/listing.php
r867277 r935428 207 207 $args['zoning_types'] = false; 208 208 $args['purchase_types'] = false; 209 } 210 } 211 212 // Transfer over control flags... 213 $flags = array('agency_only', 'non_import', 'include_disabled'); 214 foreach ($flags as $key) { 215 if (!empty($_POST[$key])) { 216 $args[$key] = $_POST[$key]; 209 217 } 210 218 } -
placester/trunk/helpers/option.php
r918887 r935428 139 139 140 140 public static function get_default_location () { 141 $r1 = PL_Options::get('pls_default_latitude'); 142 $r2 = PL_Options::get('pls_default_longitude'); 143 if ($r1 && $r2) { return array('lat' => $r1, 'lng' => $r2); } 141 if (($r1 = PL_Options::get('pls_default_latitude')) && ($r2 = PL_Options::get('pls_default_longitude'))) { 142 return array('lat' => $r1, 'lng' => $r2); 143 } 144 145 $geo_default = array('lat' => 42.3596681, 'lng' => -71.0599325); 146 $geo_error = array('lat' => 42.3596680, 'lng' => -71.0599326); 144 147 145 148 $response = PL_Helper_User::whoami(); … … 155 158 } 156 159 157 $address = $loc['address'] . " " . $loc['locality'] . ", " . $loc['region']; 158 if ($geo = self::geocode_address($address)) { 159 self::set_default_location ($geo); 160 return $geo; 160 if($loc['locality'] && $loc['region']) { 161 $address = $loc['address'] . " " . $loc['locality'] . ", " . $loc['region']; 162 163 if (!($geo = self::geocode_address($address))) { 164 $geo = $geo_default; 165 } 161 166 } 162 167 } 163 168 164 169 // company info 165 if ( isset($response['location'])) {170 if (!isset($geo) && isset($response['location'])) { 166 171 $loc = $response['location']; 167 172 $lat = $loc['latitude']; … … 171 176 } 172 177 173 $address = $loc['address'] . " " . $loc['locality'] . ", " . $loc['region']; 174 if ($geo = self::geocode_address($address)) { 175 self::set_default_location ($geo); 176 return $geo; 177 } 178 } 178 if($loc['locality'] && $loc['region']) { 179 $address = $loc['address'] . " " . $loc['locality'] . ", " . $loc['region']; 180 if (!($geo = self::geocode_address($address))) { 181 $geo = $geo_default; 182 } 183 } 184 } 185 } 186 187 // only try to geocode once, whether successful or not 188 if(isset($geo)) { 189 file_put_contents('/var/tmp/geocode-requests.log', date('Y-m-d H:i:s') . ' placester/option.php' . ' ' . implode(', ', $geo) . "\n", LOCK_EX | FILE_APPEND); 190 self::set_default_location ($geo); 191 return $geo; 179 192 } 180 193 181 194 // default 182 return array('lat' => 42.3596681, 'lng' => -71.0599325);195 return $geo_default; 183 196 } 184 197 … … 186 199 $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false'; 187 200 $result = wp_remote_get($url); 188 if (!is_array($result) || !isset($result['body']) || !$result['body']) 189 return null; 190 191 $body = json_decode($result['body']); 192 $loc = array( 193 'lat' => $body->results[0]->geometry->location->lat, 194 'lng' => $body->results[0]->geometry->location->lng); 195 196 if (isset($loc) && isset($loc['lat']) && isset($loc['lng'])) 197 return $loc; 201 202 if (is_array($result) && isset($result['body']) && $result['body']) { 203 $body = json_decode($result['body']); 204 if(isset($body->results) && isset($body->results[0]) && isset($body->results[0]->geometry)) { 205 return array( 206 'lat' => $body->results[0]->geometry->location->lat, 207 'lng' => $body->results[0]->geometry->location->lng); 208 } 209 } 198 210 199 211 return null; -
placester/trunk/js/admin/my-listings.js
r819211 r935428 148 148 var formAdditions = new Array(); 149 149 $.each($('#pls_admin_my_listings:visible').serializeArray(), function(i, field) { 150 if( field.name == 'zoning_types' || field.name == 'listing_types' || field.name == 'purchase_types' ) { 151 // API expects these to be arrays 152 aoData.push({"name" : field.name + "[]", "value" : field.value}); 153 } else { 154 aoData.push({"name" : field.name, "value" : field.value}); 155 } 156 // if this is an array then tell the api to look for multiple values 157 if( field.name.slice(-2) == '[]' ) { 158 if ( $.inArray(field.name, formAdditions) == -1) { 159 formAdditions.push(field.name); 160 var matchname = field.name.slice(0, -2); 161 matchname = matchname.slice(-1) == ']' ? matchname.slice(0,-1)+'_match]' : matchname+'_match'; 162 aoData.push({name: matchname, value: 'in'}); 150 151 // only push the criteria we need for the call 152 if(field.value && field.value != 'false') { 153 if(field.value == 'true') field.value = 1; 154 155 if( field.name == 'zoning_types' || field.name == 'listing_types' || field.name == 'purchase_types' ) { 156 // API expects these to be arrays 157 aoData.push({"name" : field.name + "[]", "value" : field.value}); 158 } else { 159 aoData.push({"name" : field.name, "value" : field.value}); 160 } 161 162 // if this is an array then tell the api to look for multiple values 163 if( field.name.slice(-2) == '[]' ) { 164 if ( $.inArray(field.name, formAdditions) == -1) { 165 formAdditions.push(field.name); 166 var matchname = field.name.slice(0, -2); 167 matchname = matchname.slice(-1) == ']' ? matchname.slice(0,-1)+'_match]' : matchname+'_match'; 168 aoData.push({name: matchname, value: 'in'}); 169 } 163 170 } 164 171 } 165 172 }); 173 166 174 return aoData; 167 175 } -
placester/trunk/lib/caching.php
r918887 r935428 96 96 97 97 public static function allow_caching() { 98 // Allow caching as long as user is not an admin AND is not in the admin panel... 99 // return ( !current_user_can('manage_options') && !is_admin() ); 100 101 // For now, refuse caching for ALL authenticated users + devs with debug turned on... 102 return ( !is_user_logged_in() && !defined('PL_DISABLE_CACHE') ); 98 // Caching is off by default, but enabled within our hosting environment 99 // For now, we disable caching for admins and other authenticated users 100 return ( !is_user_logged_in() && defined('PL_ENABLE_CACHE') ); 103 101 } 104 102 -
placester/trunk/lib/component_entities.php
r918887 r935428 1407 1407 list: list, 1408 1408 <?php endif ?> 1409 disable_saved_search: <?php echo count(self::$shortcode_groups)>1 ? '1' : '0' ?>,1409 disable_saved_search: 1, // always // <?php echo count(self::$shortcode_groups)>1 ? '1' : '0' ?>, 1410 1410 <?php if (!empty($group['map'])):?> 1411 1411 map: map, -
placester/trunk/placester.php
r918887 r935428 5 5 Plugin URI: https://placester.com/ 6 6 Author: Placester.com 7 Version: 1.2. 07 Version: 1.2.1 8 8 Author URI: https://www.placester.com/ 9 9 */ 10 10 11 /* Copyright (c) 2013 Placester, Inc. <[email protected]>11 /* Copyright (c) 2013, 2014 Placester, Inc. <[email protected]> 12 12 All rights reserved. 13 13 … … 28 28 */ 29 29 30 define('PL_PLUGIN_VERSION','1.2. 0');30 define('PL_PLUGIN_VERSION','1.2.1'); 31 31 32 32 define( 'PL_PARENT_DIR', plugin_dir_path(__FILE__) ); -
placester/trunk/readme.txt
r918887 r935428 4 4 Requires at least: 3.0 5 5 Tested up to: 3.9 6 Stable tag: 1.2. 06 Stable tag: 1.2.1 7 7 8 8 Easily create and manage real estate sites powered by WordPress. … … 142 142 143 143 == Changelog == 144 145 = 1.2.1 = 146 * Turned caching off by default for off-hosted users (enabled in wp-config) 147 * Fixed Inactive, Agency, Non-MLS flags on plugin Listings page 148 * Disabled permalink URL generation for shortcodes 149 * Fixed links to Placester.com theme gallery 144 150 145 151 = 1.2.0 =
Note: See TracChangeset
for help on using the changeset viewer.