Plugin Directory

Changeset 935428


Ignore:
Timestamp:
06/19/2014 10:30:41 PM (12 years ago)
Author:
Placester
Message:

Update to Real Estate Website Builder, 2014-06-19 18:30:28 -0400

Location:
placester/trunk
Files:
4 added
3 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • placester/trunk/blueprint/blueprint.php

    r867277 r935428  
    279279                'datatable' => array('script' => true, 'style' => true),
    280280                'jquery-ui' => array('script' => true, 'style' => true),
    281                 'spinner' => array( 'script' => true, 'style' => true ),
     281                'spinner' => array( 'script' => true ),
    282282                'masonry' => array('script' => true, 'style' => false),
    283283                'jquery-tools' => array('script' => true, 'style' => false),
  • placester/trunk/blueprint/extensions/slideshow.php

    r867277 r935428  
    8888            'post_id' => false,
    8989            'post_meta_key' => false,
    90             'fluid' => false
     90            'fluid' => false,
     91            'span_not_img' => false
    9192        );
    9293        $args = wp_parse_args( $args, $defaults );
     
    241242                }
    242243               
    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               
    245251   
    246252                /** Wrap it in an achor if the anchor exists. */
  • placester/trunk/blueprint/functions/form.php

    r754259 r935428  
    134134            'title' => '',
    135135            '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.",
    137137            'name_value' => 'Full Name',
    138138            'email_value' => 'Email Address',
     
    168168                'title' => '',
    169169                '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.",
    171171                'name_value' => 'Full Name',
    172172                'email_value' => 'Email Address',
  • placester/trunk/blueprint/functions/formatting.php

    r918887 r935428  
    595595        "ngb_pubsch" => "Public School",
    596596        "school_district" => "School District",
     597        "sch_elm" => "Elementary School",
     598        "sch_hgh" => "High School",
     599        "sch_jnr" => "Junior High School",
    597600        "zone" => "Zone",
    598601        "road_surface" => "Road Surface",
     
    740743        $url = str_replace(' ', '+', $url);
    741744        $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
    752756//end of class
    753757}
  • placester/trunk/blueprint/functions/lead-capture.php

    r867277 r935428  
    1717        $title_text = pls_get_option('pd-lc-form-title');
    1818        $description = pls_get_option('pd-lc-form-description');
     19        $success_message = htmlspecialchars(pls_get_option('pd-lc-form-message'));
    1920
    2021        // Default
     
    3031              <?php if ( $description_visible == true && !empty( $description ) ): ?>
    3132                <div class="lc-description">
    32                   <?php echo $description; ?>
     33                  <p><?php echo $description; ?></p>
    3334                </div>
    3435              <?php endif; ?>
     
    4142                        "title" => '',
    4243                        "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.",
    4445                        // Name
    4546                        "name_value" => $name_placeholder != "Full Name" ? $name_placeholder : "Full Name",
  • placester/trunk/blueprint/functions/listings.php

    r770408 r935428  
    33PLS_Listing_Helper::init();
    44class PLS_Listing_Helper {
    5    
     5
    66    public static function init() {
    77        add_action('wp_ajax_pls_listings_for_options', array(__CLASS__,'listings_for_options'));
     
    1919        if ($api_response['listings']) {
    2020            foreach ($api_response['listings'] as $listing) {
    21                 if ( !empty($listing['location']['unit']) ) {
     21                if ( !empty($listing['location']['unit']) ) {
    2222                    $formatted_listings .= '<option value="' . $listing['id'] . '" >' . $listing['location']['address'] . ', #' . $listing['location']['unit'] . ', ' . $listing['location']['locality'] . ', ' . $listing['location']['region'] . '</option>';
    2323                }
     
    3838        $api_response = array('listings' => array());
    3939        $option_ids = pls_get_option($featured_option_id);
    40        
     40
    4141        if (!empty($option_ids)) {
    4242            $property_ids = array_keys($option_ids);
     
    4545                $args['property_ids'] = $property_ids;
    4646            }
    47            
     47
    4848            $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//          }
    5656        }
    57        
     57
    5858        return $api_response;
    5959    }
    60    
     60
    6161    // Pass in property IDs array
    6262    public static function get_featured_from_post ($post_id, $post_meta_key) {
  • placester/trunk/blueprint/functions/widgets/contact.php

    r867277 r935428  
    6363        // Labels and Values
    6464        $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $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']);
    6666        $submit_value = apply_filters('button', empty($instance['button']) ? 'Send' : $instance['button']);
    6767
     
    242242                 
    243243                  <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" />
    245245                  </div>
    246246                 
  • placester/trunk/blueprint/functions/widgets/quick-search.php

    r867277 r935428  
    3131
    3232        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';
    3434        }
    3535
  • placester/trunk/blueprint/js/libs/spinner/spinner.js

    r754259 r935428  
    11jQuery(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" />';
    33  $('.dataTables_processing').html(spinningBars);
    44});
  • placester/trunk/blueprint/js/scripts.php

    r918887 r935428  
    6868        wp_enqueue_script('search-bootloader');
    6969
    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');
    7273
    7374        if ( pls_has_plugin_error() ) {
     
    114115            /** Register the script and style. */
    115116            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' );
    117117            /** Enqueue script and styles only if supported. */
    118118            if ( is_array( $js[0]['spinner'] ) ) {
    119119                if ( in_array( 'script', $js[0]['spinner'] ) ) {
    120120                    wp_enqueue_script( 'spinner' );
    121                     wp_enqueue_style( 'spinner' );
    122121                }
    123122            }
  • placester/trunk/blueprint/js/scripts/contact.widget.ajax.js

    r754259 r935428  
    7171                  $('.placester_contact_form form').slideUp();
    7272                 
    73                   // Show success message
    7473                  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
    7581                    $(".placester_contact_form .success").show('fast');
     82
    7683                    // mark contact form as submitted so lead capture's force-back functionality doesn't fire
    7784                    $(".placester_contact_form input[name='form_submitted']").val(1);
  • placester/trunk/blueprint/partials/get-listings-ajax.php

    r918887 r935428  
    113113
    114114        // 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;
    117117
    118118        ob_start();
  • placester/trunk/blueprint/partials/get-listings.php

    r867277 r935428  
    6363          { $width = absint($width); }
    6464           
    65         /** Sanitize the height. */
     65        // Sanitize the height
    6666        if ($height)
    6767          { $height = absint($height); }
     
    7777        // If plugin is active, grab listings intelligently...
    7878        if (!pls_has_plugin_error()) {
    79             $listings_raw = false;
    80            
     79
    8180            if ($featured_option_id) {
    8281              $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) {
    8691              $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 {
    90100              $listings_raw = PLS_Plugin_API::get_listings($request_params);
    91101            }
    92102        }
    93      
     103
    94104        /** Define variable which will contain the html string with the listings. */
    95105        $return = '';
     
    108118        // filter listings before output
    109119        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
    113123        // For repeated use in the loop...
    114124        $listing_cache = new PLS_Cache('Listing');
     
    116126        // Curate the listing_data...
    117127        foreach ($listings_raw['listings'] as $listing_data) {
    118             // Ignore featured listings without images
    119             if ( !empty($args['featured_option_id']) && empty($listing_data['images']) ) {
    120                continue;
    121             }
    122 
    123128            $listing_html = '';
    124129
  • placester/trunk/helpers/listing.php

    r867277 r935428  
    207207                    $args['zoning_types'] = false;
    208208                    $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];
    209217            }
    210218        }
  • placester/trunk/helpers/option.php

    r918887 r935428  
    139139
    140140    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);
    144147
    145148        $response = PL_Helper_User::whoami();
     
    155158                }
    156159
    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                    }
    161166                }
    162167            }
    163168
    164169            // company info
    165             if (isset($response['location'])) {
     170            if (!isset($geo) && isset($response['location'])) {
    166171                $loc = $response['location'];
    167172                $lat = $loc['latitude'];
     
    171176                }
    172177
    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;
    179192        }
    180193
    181194        // default
    182         return array('lat' => 42.3596681, 'lng' => -71.0599325);
     195        return $geo_default;
    183196    }
    184197
     
    186199        $url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' . urlencode($address) . '&sensor=false';
    187200        $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        }
    198210
    199211        return null;
  • placester/trunk/js/admin/my-listings.js

    r819211 r935428  
    148148        var formAdditions = new Array();
    149149        $.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                    }
    163170                }
    164171            }
    165172        });
     173
    166174        return aoData;
    167175    }
  • placester/trunk/lib/caching.php

    r918887 r935428  
    9696
    9797    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') );
    103101    }
    104102
  • placester/trunk/lib/component_entities.php

    r918887 r935428  
    14071407                        list: list,
    14081408                        <?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' ?>,
    14101410                        <?php if (!empty($group['map'])):?>
    14111411                        map: map,
  • placester/trunk/placester.php

    r918887 r935428  
    55Plugin URI: https://placester.com/
    66Author: Placester.com
    7 Version: 1.2.0
     7Version: 1.2.1
    88Author URI: https://www.placester.com/
    99*/
    1010
    11 /*  Copyright (c) 2013 Placester, Inc. <[email protected]>
     11/*  Copyright (c) 2013, 2014 Placester, Inc. <[email protected]>
    1212    All rights reserved.
    1313
     
    2828*/
    2929
    30 define('PL_PLUGIN_VERSION','1.2.0');
     30define('PL_PLUGIN_VERSION','1.2.1');
    3131
    3232define( 'PL_PARENT_DIR', plugin_dir_path(__FILE__) );
  • placester/trunk/readme.txt

    r918887 r935428  
    44Requires at least: 3.0
    55Tested up to: 3.9
    6 Stable tag: 1.2.0
     6Stable tag: 1.2.1
    77
    88Easily create and manage real estate sites powered by WordPress.
     
    142142
    143143== 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
    144150
    145151= 1.2.0 =
Note: See TracChangeset for help on using the changeset viewer.