Plugin Directory

Changeset 1280539


Ignore:
Timestamp:
11/05/2015 05:27:29 PM (10 years ago)
Author:
Placester
Message:

Releasing v1.3.3

Location:
placester/trunk
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • placester/trunk/blueprint/extensions/options-framework/js/options-custom.js

    r754259 r1280539  
    55
    66jQuery(document).ready(function($) {
    7    
     7
    88    // Fade out the save message
    99    $('.fade').delay(1000).fadeOut(1000);
    10    
     10
    1111    // Color Picker
    12     $('.colorSelector').each(function(){
     12    $('.colorSelector').each(function() {
    1313        var Othis = this; //cache a copy of the this variable for use inside nested function
    1414        var initialColor = $(Othis).next('input').attr('value');
    1515        $(this).ColorPicker({
    16         color: initialColor,
    17         onShow: function (colpkr) {
    18         $(colpkr).fadeIn(500);
    19         return false;
    20         },
    21         onHide: function (colpkr) {
    22         $(colpkr).fadeOut(500);
    23         return false;
    24         },
    25         onChange: function (hsb, hex, rgb) {
    26         $(Othis).children('div').css('backgroundColor', '#' + hex);
    27         $(Othis).next('input').attr('value','#' + hex);
    28     }
    29     });
     16            color: initialColor,
     17            onShow: function (colpkr) {
     18                $(colpkr).fadeIn(500);
     19                return false;
     20            },
     21            onHide: function (colpkr) {
     22                $(colpkr).fadeOut(500);
     23                return false;
     24            },
     25            onChange: function (hsb, hex, rgb) {
     26                $(Othis).children('div').css('backgroundColor', '#' + hex);
     27                $(Othis).next('input').attr('value','#' + hex);
     28            }
     29        });
    3030    }); //end color picker
    3131   
     
    3333    $('.group').hide();
    3434    var activetab = '';
    35     if (typeof(localStorage) != 'undefined' ) {
    36         activetab = localStorage.getItem("activetab");
    37     }
    38     if (activetab != '' && $(activetab).length ) {
    39         $(activetab).fadeIn();
    40     } else {
     35    if (typeof(localStorage) != 'undefined')
     36        activetab = localStorage.getItem('activetab');
     37
     38    if ($(activetab).filter('.group').length)
     39        $(activetab).filter('.group').fadeIn();
     40    else
    4141        $('.group:first').fadeIn();
    42     }
    43     $('.group .collapsed').each(function(){
     42
     43    $('.group .collapsed').each(function() {
    4444        $(this).find('input:checked').parent().parent().parent().nextAll().each(
    45             function(){
     45            function() {
    4646                if ($(this).hasClass('last')) {
    4747                    $(this).removeClass('hidden');
     
    5151            });
    5252    });
    53    
    54     if (activetab != '' && $(activetab + '-tab').length ) {
     53
     54    if (activetab != '' && $(activetab + '-tab').length)
    5555        $(activetab + '-tab').addClass('nav-tab-active');
    56     }
    57     else {
     56    else
    5857        $('.nav-tab-wrapper a:first').addClass('nav-tab-active');
    59     }
     58
    6059    $('.nav-tab-wrapper a').click(function(evt) {
    6160        $('.nav-tab-wrapper a').removeClass('nav-tab-active');
    6261        $(this).addClass('nav-tab-active').blur();
    6362        var clicked_group = $(this).attr('href');
    64         if (typeof(localStorage) != 'undefined' ) {
    65             localStorage.setItem("activetab", $(this).attr('href'));
    66         }
     63
     64        if (typeof(localStorage) != 'undefined' )
     65            localStorage.setItem('activetab', $(this).attr('href'));
     66
    6767        $('.group').hide();
    6868        $(clicked_group).fadeIn();
    6969        evt.preventDefault();
    7070    });
    71                            
     71
    7272    $('.group .collapsed input:checkbox').click(unhideHidden);
    7373               
    74     function unhideHidden(){
     74    function unhideHidden() {
    7575        if ($(this).attr('checked')) {
    7676            $(this).parent().parent().parent().nextAll().removeClass('hidden');
     
    8181                if ($(this).filter('.last').length) {
    8282                    $(this).addClass('hidden');
    83                     return false;       
     83                    return false;
    8484                    }
    8585                $(this).addClass('hidden');
    8686            });
    87                            
    8887        }
    8988    }
    9089   
    9190    // Image Options
    92     $('.of-radio-img-img').click(function(){
     91    $('.of-radio-img-img').click(function() {
    9392        $(this).parent().parent().find('.of-radio-img-img').removeClass('of-radio-img-selected');
    94         $(this).addClass('of-radio-img-selected');     
     93        $(this).addClass('of-radio-img-selected');
    9594    });
    9695       
     
    111110    $('.fls-add-listing').live('click', function (event) {
    112111        event.preventDefault();
     112
    113113        var key = $(this).parent().children('select').val();
    114114        var iterator = $(this).parent().children('select').attr('ref');
    115115        var text = $(this).parent().find('option:selected').text();
    116116        $(this).parent().find('option:selected').remove();
     117
    117118        var option_name = $(this).parent().find('#option-name').val();
    118119        var listing_box = $(this).parent().parent().find('.fls-option');
    119120        if ($(this).hasClass('for_slideshow')) {
    120             var html = "<li style='float:left; list-style-type: none;'><div id='pls-featured-text' style='width: 200px; float: left;'>" + text + "</div><a style='float:left;' href='#' id='pls-option-remove-listing'>Remove</a><input type='hidden' name='" +option_name+ "["+iterator+"]["+key+"]=' value='"+text+"' /></li>";   
     121            var html = "<li style='float:left; list-style-type: none;'><div id='pls-featured-text' style='width: 200px; float: left;'>" + text
     122                + "</div><a style='float:left;' href='#' id='pls-option-remove-listing'>Remove</a><input type='hidden' name='"
     123                + option_name + "[" + iterator + "][" + key + "]=' value='" + text + "' /></li>";
    121124        } else {
    122             var html = "<li style='float:left; list-style-type: none;'><div id='pls-featured-text' style='width: 200px; float: left;'>" + text + "</div><a style='float:left;' href='#' id='pls-option-remove-listing'>Remove</a><input type='hidden' name='" +option_name+ "["+key+"]=' value='"+text+"' /></li>";
    123         };
    124        
     125            var html = "<li style='float:left; list-style-type: none;'><div id='pls-featured-text' style='width: 200px; float: left;'>" + text
     126                + "</div><a style='float:left;' href='#' id='pls-option-remove-listing'>Remove</a><input type='hidden' name='"
     127                + option_name + "[" + key + "]=' value='" + text + "' /></li>";
     128        }
     129
    125130        listing_box.append(html);
    126131    });
     
    132137        var select = $(this).parent().parent().parent().find('select').prepend('<option value="'+key+'">'+text+'</option>');
    133138        $(this).parent().remove();
    134 
    135139    });
    136140
     
    143147            data[field.name] = field.value;
    144148        });
     149
    145150        $.post(ajaxurl, data, function(data) {
    146151            if (data) {
     
    155160        $(this).parent().parent().children('.type_controls').hide();
    156161        $(this).parent().parent().children('.type_controls#' + $(this).val() + '_type').show();
    157        
    158162    });
    159163    $('.slideshow_type').trigger('change');
    160    
     164
    161165    if( window.location.hash !== undefined && window.location.hash !== '' ) {
    162166        var window_hash = window.location.hash;
     
    176180    $('#theme_option_file').live('change', function(event) {
    177181        event.preventDefault();
    178 
    179182        if (!confirm('Are you sure you want to overwrite your existing Theme Options?'))
    180         { return; }
     183            return;
    181184
    182185        //Retrieve the first (and only!) File from the FileList object
    183         var file = event.target.files[0];
    184 
    185         console.log(file);
    186         //return;
    187 
    188         if (file) {
    189           var r = new FileReader();
    190           r.onload = function(e) {
    191              var contents = e.target.result;
    192              // alert( "Got the file.\n"
    193              //      + "name: " + file.name + "\n"
    194              //      + "type: " + file.type + "\n"
    195              //      + "size: " + file.size + " bytes\n"
    196              //      + "starts with: " + contents.substr(1, 50)
    197              // ); 
    198 
    199             var data = { action: 'import_theme_options',
    200                          options_raw: contents };
    201             console.log(data);
    202 
    203             $.post(ajaxurl, data, function(response) {
    204               if (response) {
    205                 // console.log(response);
    206               }
    207 
    208               // Refresh theme options to reflect newly imported settings...
    209               location.reload() 
    210             });
    211           }
    212           r.readAsText(file);
    213         }
    214         else {
    215           alert("Failed to load file");
    216         }
     186        var file = event.target.files[0];
     187        console.log(file);
     188
     189        if (file) {
     190            var r = new FileReader();
     191            r.onload = function(e) {
     192                var contents = e.target.result;
     193                var data = {
     194                    action: 'import_theme_options',
     195                    options_raw: contents
     196                };
     197                console.log(data);
     198
     199                $.post(ajaxurl, data, function(response) {
     200                    if (response) {
     201                        // console.log(response);
     202                    }
     203
     204                    // Refresh theme options to reflect newly imported settings...
     205                    location.reload()
     206                });
     207            }
     208            r.readAsText(file);
     209        }
     210        else {
     211            alert("Failed to load file");
     212        }
    217213    });
    218214
    219215    $('#btn_def_opts').live('click', function(event) {
    220216        event.preventDefault();
    221 
    222217        if (!confirm('Are you sure you want to overwrite your existing Theme Options?'))
    223         { return; }
    224 
    225         var data = { action: 'import_default_options',
    226                      name: $('#def_theme_opts option:selected').val() }
    227         // console.log(data);
     218            return;
     219
     220        var data = {
     221            action: 'import_default_options',
     222            name: $('#def_theme_opts option:selected').val()
     223        }
    228224
    229225        $.post(ajaxurl, data, function(response) {
    230           if (response) {
    231             // console.log(response);
    232           }
    233 
    234           // Refresh theme options to reflect newly imported settings...
    235           window.location.reload(true);
     226            if (response) {
     227                // console.log(response);
     228            }
     229
     230            // Refresh theme options to reflect newly imported settings...
     231            window.location.reload(true);
    236232        });
    237233    });
     
    239235    $('#export_link').live('click', function() {
    240236        var filename = $('#export_txt').val();
    241 
    242237        if (filename) {
    243238            var new_href = $(this).attr('href') + '&filename=' + filename;
     
    245240        }
    246241    });
    247                
    248 }); 
     242
     243});
  • placester/trunk/blueprint/functions/widgets/agent.php

    r759440 r1280539  
    3636
    3737        /* Create the widget. */
    38         parent::__construct( "pls-agent", 'Placester: Agent Widget', $widget_options );
     38        parent::__construct( "pls-agent", 'Placester: Agent Widget', $widget_options );
    3939    }
    4040
     
    4242    /**
    4343     * Outputs and filters the widget.
    44      *
    45      * The widget connects to the plugin using the framework plugin api class.
    46      * If the class returns false, this means that either the plugin is
    47      * missing, either the it has no API key set.
    48      *
    4944     * @since 0.0.1
    5045     */
    5146    public function widget( $args, $instance ) {
    5247
    53         list($args, $instance) = self::process_defaults($args, $instance);
    54 
    55         /** Extract the arguments into separate variables. */
    56         extract( $args, EXTR_SKIP );
    57 
    58         /** Get the agent information from the plugin. */
    59         $agent = PLS_Plugin_API::get_user_details();
    60 
    61         $agent_array = array();
    62 
    63         // pls_dump($agent);
    64         /** If the plugin is active, and has an API key set... */
    65         if ( $agent ) {
    66 
    67             /* Output the theme's $before_widget wrapper. */
    68             echo $before_widget;
    69 
    70             /* If a title was input by the user, display it. */
    71             $widget_title = '';
    72             if ( !empty( $instance['title'] ) )
    73                 $widget_title = $before_title . apply_filters( 'widget_title',  $instance['title'], $instance, $this->id_base ) . $after_title;
    74 
    75             /** This array will hold the html for the agent info sections and will be passed to the filters. */
    76             $agent_html = $instance;
    77 
    78             unset( $agent_html['title'] );
    79 
    80             // Add Name
    81             if ( !empty($instance['name_custom']) ) {
    82               // if admin set custom name
    83               $agent_html['name'] = self::checkForCustom($instance, 'name');
    84               $agent_array['name'] = $instance['name_custom'];
    85             } else {
    86               // otherwise use admin's name
    87               if ( ! empty( $instance['name'] ) && ( ! empty( $agent['user']['first_name'] ) || ! empty( $agent['user']['last_name'] ) ) ) {
    88                   $agent_html['name'] = pls_h_p(trim( $agent['user']['first_name'] . ' ' . $agent['user']['last_name'] ), array( 'class' => 'fn h5', 'itemprop' => 'name'  ) );
    89                   $agent_array['name'] = $agent['user']['first_name'] . ' ' . $agent['user']['last_name'];
    90               } else {
    91                   $agent_html['name'] = '';
    92                   $agent_array['name'] = '';
    93               }
    94             }
    95            
    96             // Add Email
    97             if ( !empty($instance['email_custom']) ) {
    98               // if admin set custom email
    99               $agent_html['email'] = self::checkForCustom($instance, 'email');
    100               $agent_array['email'] = $instance['email_custom'];
    101             } else {
    102               // otherwise use admin's email
    103               if ( ! empty( $instance['email'] ) && ! empty( $agent['user']['email'] ) ) {
    104                   $agent_html['email'] = pls_h_p(pls_h_a( "mailto:{$agent['user']['email']}", $agent['user']['email'] ), array( 'class' => 'email', 'itemprop' => 'email' ) );
    105                   $agent_array['email'] = $agent['user']['email'];
    106               } else {
    107                   $agent_html['email'] = '';
    108                   $agent_array['email'] = '';
    109               }
    110             }
    111            
    112             // Add Phone
    113             if ( !empty($instance['phone_custom']) ) {
    114               // if admin set custom phone
    115               $agent_html['phone'] = self::checkForCustom($instance, 'phone');
    116               $agent_array['phone'] = $instance['phone_custom'];
    117             } else {
    118               // otherwise use admin's phone
    119               if ( ! empty( $instance['phone'] ) && ! empty( $agent['user']['phone'] ) ) {
    120                   $agent_html['phone'] = pls_h_p(PLS_Format::phone($agent['user']['phone']), array( 'class' => 'phone', 'itemprop' => 'phone' ) );
    121                   $agent_array['phone'] = PLS_Format::phone( $agent['user']['phone'], array( 'class' => 'phone', 'itemprop' => 'phone' ) );
    122               } else {
    123                   $agent_html['phone'] = '';
    124                   $agent_array['phone'] = '';
    125               }
    126             }
    127            
    128             // Add Description
    129             if ( !empty($instance['description_custom']) ) {
    130               // if admin set custom description
    131               $agent_html['description'] = self::checkForCustom($instance, 'description');
    132               $agent_array['description'] = $instance['description_custom'];
    133             } else {
    134               // otherwise use admin's descriptions
    135               if ( ! empty( $instance['description']) && pls_get_option('pls-user-description') ) {
    136                   $agent_bio = pls_get_option('pls-user-description');
    137                   $agent_html['description'] = pls_h_p($agent_bio, array( 'class' => 'desc p4', 'itemprop' => 'description' ) );
    138                   $agent_array['description'] = $agent_bio;
    139               } else {
    140                   $agent_html['description'] = '';
    141                   $agent_array['description'] = '';
    142               }
    143             }
    144 
    145 
    146             // Add Photo
    147             if ( !empty($instance['image_uri']) ) {
    148               // if admin set custom photo
    149               self::checkForCustom($instance, 'photo');
    150               $agent_array['photo'] = $instance['image_uri'];
    151             } else {
    152               // otherwise use admin's photo
    153               $user_image_option = pls_get_option('pls-user-image');
    154               if ( ! empty( $instance['photo'] ) && ! empty( $user_image_option ) ) {
    155                   $agent_html['photo'] = pls_h_img( @pls_get_option('pls-user-image'), trim( $agent['user']['first_name'] . ' ' . $agent['user']['last_name'] ), array( 'class' => 'photo', 'itemprop' => 'image' ) + array() + array() );
    156                   $agent_array['photo'] = $user_image_option;
    157               } else {
    158                 if (isset($agent['user']['headshot'])) {
    159                   $agent_html['photo'] = pls_h_img( $agent['user']['headshot'], trim( $agent['user']['first_name'] . ' ' . $agent['user']['last_name'] ), array( 'class' => 'photo', 'itemprop' => 'image' ) + array() + array() );
    160                   $agent_array['photo'] = $agent['user']['headshot'];
    161                 } else {
    162                   $agent_array['photo'] = '';
    163                 }
    164               }
    165             }
    166 
    167             // Form the HTML elements
    168             // photo
    169             $agent_html['photo'] = '<img class="pls-agent-phone" src="'.esc_url($instance['image_uri']).'" />';
    170             // texts
    171             $agent_info = array('name', 'email', 'phone', 'description');
    172             foreach ($agent_info as $value) {
    173               $agent_html[$value] = pls_h_p(
    174                 $agent_html[$value],
    175                 array(
    176                   'class' => 'pls-agent-'.$value
    177                 )
    178               );
    179             }
    180            
    181            
    182             /** Combine the agent information. */
    183             $widget_body = $agent_html['photo'] . $agent_html['name'] . $agent_html['email'] . $agent_html['phone'] . $agent_html['description'];
    184 
    185             /** Wrap the agent information in a section element. */
    186             $widget_body = apply_filters( 'pls_widget_agent_inner', $widget_body, $agent_html, $agent_array, $instance, $agent, $widget_id );
    187 
    188             /** Apply a filter on the whole widget */
    189             echo apply_filters( 'pls_widget_agent', $widget_title . $widget_body, $widget_title, $before_title, $after_title, $widget_body, $agent_html, $agent,  $instance, $widget_id );
    190 
    191             /* Close the theme's widget wrapper. */
    192             if ($args['clearfix']) {
    193                 echo '<div class="clearfix"></div>';
    194             }
    195            
    196             echo $after_widget;
    197 
    198         } elseif ( current_user_can( 'administrator' ) ) {
    199 
    200             /** Display an error message if the user is admin. */
    201             // echo pls_get_no_plugin_placeholder( $widget_id );
    202         }
     48        list($args, $instance) = self::process_defaults($args, $instance);
     49        extract( $args, EXTR_SKIP );
     50
     51
     52        $agent_array = array();
     53
     54        // Get the default agent information from theme options, if available
     55        if($name_option = pls_get_option('pls-user-name')) {
     56            $agent_array['name'] = $name_option;
     57            $agent_array['email'] = pls_get_option('pls-user-email');
     58            $agent_array['phone'] = pls_get_option('pls-user-phone');
     59        }
     60
     61        // Otherwise, try the plugin's registered owner
     62        else if($whoami = PLS_Plugin_API::get_user_details()) {
     63            $agent_array['name'] = trim($whoami['user']['first_name'] . ' ' . $whoami['user']['last_name']);
     64            $agent_array['email'] = $whoami['user']['email'];
     65            $agent_array['phone'] = PLS_Format::phone($whoami['user']['phone']);
     66            $agent_array['photo'] = $whoami['user']['headshot'];
     67        }
     68
     69        // Pull this info from options, regardless
     70        if(($description_option = pls_get_option('pls-user-description-widget')) || ($description_option = pls_get_option('pls-user-description')))
     71            $agent_array['description'] = $description_option;
     72        if($photo_option = pls_get_option('pls-user-image'))
     73            $agent_array['photo'] = $photo_option;
     74
     75
     76        // Handle widget overrides and flags
     77        if($instance['name_custom'])
     78            $agent_array['name'] = $instance['name_custom'];
     79        else if(!$instance['name'])
     80            unset($agent_array['name']);
     81
     82        if($instance['email_custom'])
     83            $agent_array['email'] = $instance['email_custom'];
     84        else if(!$instance['email'])
     85            unset($agent_array['email']);
     86
     87        if($instance['phone_custom'])
     88            $agent_array['phone'] = $instance['phone_custom'];
     89        else if(!$instance['phone'])
     90            unset($agent_array['phone']);
     91
     92        if($instance['description_custom'])
     93            $agent_array['description'] = $instance['description_custom'];
     94        else if(!$instance['description'])
     95            unset($agent_array['description']);
     96
     97        if($instance['image_uri'])
     98            $agent_array['photo'] = $instance['image_uri'];
     99        else if(!$instance['photo'])
     100            unset($agent_array['photo']);
     101
     102
     103        // Build the html output
     104        $agent_html = array();
     105        if($agent_array['name'])
     106            $agent_html['name'] = pls_h_p($agent_array['name'], array('class' => 'pls-agent-name', 'itemprop' => 'name'));
     107        if($agent_array['email'])
     108            $agent_html['email'] = pls_h_p(pls_h_a("mailto:{$agent_array['email']}", $agent_array['email']), array('class' => 'pls-agent-email', 'itemprop' => 'email'));
     109        if($agent_array['phone'])
     110            $agent_html['phone'] = pls_h_p($agent_array['phone'], array('class' => 'pls-agent-phone', 'itemprop' => 'phone'));
     111        if($agent_array['description'])
     112            $agent_html['description'] = pls_h_p($agent_array['description'], array('class' => 'pls-agent-description', 'itemprop' => 'description'));
     113        if($agent_array['photo'])
     114            $agent_html['photo'] = pls_h_img($agent_array['photo'], $agent_array['name'], array('class' => 'pls-agent-photo', 'itemprop' => 'image'));
     115
     116
     117        // Apply filters
     118        $widget_title = $instance['title'];
     119        if($widget_title)
     120            $widget_title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     121
     122        $widget_body = $agent_html['photo'] . $agent_html['name'] . $agent_html['email'] . $agent_html['phone'] . $agent_html['description'];
     123        if($widget_body)
     124            $widget_body = apply_filters('pls_widget_agent_inner', $widget_body, $agent_html, $agent_array, $instance);
     125
     126
     127        // Output
     128        echo $before_widget;
     129        echo apply_filters('pls_widget_agent', $before_title . $widget_title . $after_title . $widget_body, $instance, $this->id_base);
     130        if ($args['clearfix'])
     131            echo '<div class="clearfix"></div>';
     132        echo $after_widget;
    203133    }
    204134
    205135    /**
    206136     * Updates the widget control options for the particular instance of the widget.
    207      *
    208137     * @since 0.0.1
    209138     */
    210139    public function update( $new_instance, $old_instance ) {
    211140
    212         $instance = $old_instance;
    213 
    214         $instance['title'] = strip_tags( $new_instance['title'] );
    215         $instance['name'] = ( isset( $new_instance['name'] ) ? 1 : 0 );
    216         $instance['name_custom'] = strip_tags( $new_instance['name_custom'] );
    217         $instance['email'] = ( isset( $new_instance['email'] ) ? 1 : 0 );
    218         $instance['email_custom'] = strip_tags( $new_instance['email_custom'] );
    219         $instance['phone'] = ( isset( $new_instance['phone'] ) ? 1 : 0 );
    220         $instance['phone_custom'] = strip_tags( $new_instance['phone_custom'] );
    221         $instance['description'] = ( isset( $new_instance['description'] ) ? 1 : 0 );
    222         $instance['description_custom'] = strip_tags( $new_instance['description_custom'] );
    223         $instance['photo'] = ( isset( $new_instance['photo'] ) ? 1 : 0 );
    224         $instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
     141        $instance = $old_instance;
     142
     143        $instance['title'] = strip_tags( $new_instance['title'] );
     144        $instance['name'] = ( isset( $new_instance['name'] ) ? 1 : 0 );
     145        $instance['name_custom'] = strip_tags( $new_instance['name_custom'] );
     146        $instance['email'] = ( isset( $new_instance['email'] ) ? 1 : 0 );
     147        $instance['email_custom'] = strip_tags( $new_instance['email_custom'] );
     148        $instance['phone'] = ( isset( $new_instance['phone'] ) ? 1 : 0 );
     149        $instance['phone_custom'] = strip_tags( $new_instance['phone_custom'] );
     150        $instance['description'] = ( isset( $new_instance['description'] ) ? 1 : 0 );
     151        $instance['description_custom'] = strip_tags( $new_instance['description_custom'] );
     152        $instance['photo'] = ( isset( $new_instance['photo'] ) ? 1 : 0 );
     153        $instance['image_uri'] = strip_tags( $new_instance['image_uri'] );
    225154
    226155        return $instance;
     
    229158    /**
    230159     * Displays the widget control options in the Widgets admin screen.
    231      *
    232160     * @since 0.0.1
    233161     */
     
    236164        /** Set up the default form values. */
    237165        $defaults = array(
    238             'title' => 'Agent',
    239             'name' => true,
    240             'name_custom' => '',
    241             'email' => true,
    242             'email_custom' => '',
    243             'phone' => true,
    244             'phone_custom' => '',
    245             'description' => false,
    246             'description_custom' => '',
    247             'photo' => true,
    248             'image_uri' => ''
     166            'title' => 'Agent',
     167            'name' => true,
     168            'name_custom' => '',
     169            'email' => true,
     170            'email_custom' => '',
     171            'phone' => true,
     172            'phone_custom' => '',
     173            'description' => false,
     174            'description_custom' => '',
     175            'photo' => true,
     176            'image_uri' => ''
    249177        );
    250178
     
    252180        $instance = wp_parse_args( (array) $instance, $defaults );
    253181
    254         /** Print the backend widget form. */
    255         echo pls_h_div(
    256             /** Print the Title input */
    257             pls_h_p(
    258                 pls_h_label(
    259                     'Title' . ':' .
    260                     pls_h(
    261                         'input',
    262                         array(
    263                             'type' => 'text',
    264                             'class' => 'widefat',
    265                             'id' => $this->get_field_id( 'title' ),
    266                             'name' => $this->get_field_name( 'title' ),
    267                             'value' => esc_attr( $instance['title'] ),
    268                             'style' => 'font-weight:normal'
    269                         )
    270                     ),
    271                     $this->get_field_id( 'title' ),
    272                     array('style' => 'font-weight:bold')
    273                 )
    274             ) .
    275             // Name checkbox and override input
    276             pls_h_p(
    277                 pls_h_label(
    278                     pls_h_checkbox(
    279                         checked( $instance['name'], true, false ),
    280                         array(
    281                             'id' => $this->get_field_id( 'name' ),
    282                             'name' => $this->get_field_name( 'name' ),
    283                         )
    284                     ) .
    285                     ' ' . 'Include Name',
    286                     $this->get_field_id( 'name' )
    287                 )
    288             ) .
    289             pls_h_p(
    290                 pls_h_label(
    291                     'Override Name:' .
    292                     pls_h(
    293                         'input',
    294                         array(
    295                             'type' => 'text',
    296                             'class' => 'widefat',
    297                             'id' => $this->get_field_id( 'name_custom' ),
    298                             'name' => $this->get_field_name( 'name_custom' ),
    299                             'value' => esc_attr( $instance['name_custom'] ),
    300                             'style' => 'font-weight:normal'
    301                         )
    302                     ),
    303                     $this->get_field_id( 'name_custom' ),
    304                     array('style' => 'font-weight:bold')
    305                 )
    306             ) .
    307             // Email checkbox and override input
    308             pls_h_p(
    309                 pls_h_label(
    310                     pls_h_checkbox(
    311                         checked( $instance['email'], true, false ),
    312                         array(
    313                             'id' => $this->get_field_id( 'email' ),
    314                             'name' => $this->get_field_name( 'email' ),
    315                         )
    316                     ) .
    317                     ' ' . 'Include Email',
    318                     $this->get_field_id( 'email' )
    319                 )
    320             ) .
    321             pls_h_p(
    322                 pls_h_label(
    323                     'Override Email:' .
    324                     pls_h(
    325                         'input',
    326                         array(
    327                             'type' => 'text',
    328                             'class' => 'widefat',
    329                             'id' => $this->get_field_id( 'email_custom' ),
    330                             'name' => $this->get_field_name( 'email_custom' ),
    331                             'value' => esc_attr( $instance['email_custom'] ),
    332                             'style' => 'font-weight:normal'
    333                         )
    334                     ),
    335                     $this->get_field_id( 'email_custom' ),
    336                     array('style' => 'font-weight:bold')
    337                 )
    338             ) .
    339             // Phone checkbox and override input
    340             pls_h_p(
    341                 pls_h_label(
    342                     pls_h_checkbox(
    343                         checked( $instance['phone'], true, false ),
    344                         array(
    345                             'id' => $this->get_field_id( 'phone' ),
    346                             'name' => $this->get_field_name( 'phone' ),
    347                         )
    348                     ) .
    349                     ' ' . 'Include Phone',
    350                     $this->get_field_id( 'phone' )
    351                 )
    352             ) .
    353             pls_h_p(
    354                 pls_h_label(
    355                     'Override Phone:' .
    356                     pls_h(
    357                         'input',
    358                         array(
    359                             'type' => 'text',
    360                             'class' => 'widefat',
    361                             'id' => $this->get_field_id( 'phone_custom' ),
    362                             'name' => $this->get_field_name( 'phone_custom' ),
    363                             'value' => esc_attr( $instance['phone_custom'] ),
    364                             'style' => 'font-weight:normal'
    365                         )
    366                     ),
    367                     $this->get_field_id( 'phone_custom' ),
    368                     array('style' => 'font-weight:bold')
    369                 )
    370             ) .
    371             // Description checkbox and override input
    372             pls_h_p(
    373                 pls_h_label(
    374                     pls_h_checkbox(
    375                         checked( $instance['description'], true, false ),
    376                         array(
    377                             'id' => $this->get_field_id( 'description' ),
    378                             'name' => $this->get_field_name( 'description' ),
    379                         )
    380                     ) .
    381                     ' ' . 'Include Description',
    382                     $this->get_field_id( 'description' )
    383                 )
    384             ) .
    385             pls_h_p(
    386                 pls_h_label(
    387                     'Override Description:' .
    388                     pls_h(
    389                         'input',
    390                         array(
    391                             'type' => 'text',
    392                             'class' => 'widefat',
    393                             'id' => $this->get_field_id( 'description_custom' ),
    394                             'name' => $this->get_field_name( 'description_custom' ),
    395                             'value' => esc_attr( $instance['description_custom'] ),
    396                             'style' => 'font-weight:normal;height:'
    397                         )
    398                     ),
    399                     $this->get_field_id( 'description_custom' ),
    400                     array('style' => 'font-weight:bold')
    401                 )
    402             ) .
    403 
    404 
    405             /** Print the Photo checkbox */
    406             pls_h_p(
    407                 pls_h_label(
    408                     pls_h_checkbox(
    409                         checked( $instance['photo'], true, false ),
    410                         array(
    411                             'id' => $this->get_field_id( 'photo' ),
    412                             'name' => $this->get_field_name( 'photo' ),
    413                         )
    414                     ) .
    415                     ' ' . 'Photo',
    416                     $this->get_field_id( 'photo' )
    417                 )
    418             ) .
    419             pls_h_p(
    420               pls_h_label(
    421                 'Image'
    422                 // array(
    423                 //   'for' => $this->get_field_id('image_uri'),
    424                 //   'value' => esc_attr( $instance['image_uri'] ),
    425                 //   'id' => "image_tag-". esc_attr( $this->get_field_id('image_uri') ),
    426                 // )
    427               ) .
    428               pls_h(
    429                 'input',
    430                 array(
    431                   'name' => $this->get_field_name('image_uri'),
    432                   'type' => 'text',
    433                   'id' => "image-". esc_attr( $this->get_field_id('image_uri') ),
    434                   'value' => $instance['image_uri'],
    435                   'class' => '.agent-widget-img-text-input'
    436                 )
    437               ) .
    438               pls_h(
    439                 'img',
    440                 array(
    441                   'id' => "image_tag-" . esc_attr( $this->get_field_id("image_uri") ),
    442                   'src' => $instance['image_uri'],
    443                   'class' => '.agent-widget-img-tag'
    444                 )
    445               ) .
    446               pls_h(
    447                 'input',
    448                 array(
    449                   'type' => 'button',
    450                   'id' => 'select-img-' . $this->get_field_id("image_uri"),
    451                   'value' => 'Select Image',
    452                   'class' => 'agent-widget-img-button'
    453                 )
    454               )
    455             )
    456 
    457         );
    458        
     182        /** Print the backend widget form. */
     183        echo pls_h_div(
     184        /** Print the Title input */
     185            pls_h_p(
     186                pls_h_label(
     187                    'Title' . ':' .
     188                    pls_h(
     189                        'input',
     190                        array(
     191                            'type' => 'text',
     192                            'class' => 'widefat',
     193                            'id' => $this->get_field_id( 'title' ),
     194                            'name' => $this->get_field_name( 'title' ),
     195                            'value' => esc_attr( $instance['title'] ),
     196                            'style' => 'font-weight:normal'
     197                        )
     198                    ),
     199                    $this->get_field_id( 'title' ),
     200                    array('style' => 'font-weight:bold')
     201                )
     202            ) .
     203            // Name checkbox and override input
     204            pls_h_p(
     205                pls_h_label(
     206                    pls_h_checkbox(
     207                        checked( $instance['name'], true, false ),
     208                        array(
     209                            'id' => $this->get_field_id( 'name' ),
     210                            'name' => $this->get_field_name( 'name' ),
     211                        )
     212                    ) .
     213                    ' ' . 'Include Name',
     214                    $this->get_field_id( 'name' )
     215                )
     216            ) .
     217            pls_h_p(
     218                pls_h_label(
     219                    'Override Name:' .
     220                    pls_h(
     221                        'input',
     222                        array(
     223                            'type' => 'text',
     224                            'class' => 'widefat',
     225                            'id' => $this->get_field_id( 'name_custom' ),
     226                            'name' => $this->get_field_name( 'name_custom' ),
     227                            'value' => esc_attr( $instance['name_custom'] ),
     228                            'style' => 'font-weight:normal'
     229                        )
     230                    ),
     231                    $this->get_field_id( 'name_custom' ),
     232                    array('style' => 'font-weight:bold')
     233                )
     234            ) .
     235            // Email checkbox and override input
     236            pls_h_p(
     237                pls_h_label(
     238                    pls_h_checkbox(
     239                        checked( $instance['email'], true, false ),
     240                        array(
     241                            'id' => $this->get_field_id( 'email' ),
     242                            'name' => $this->get_field_name( 'email' ),
     243                        )
     244                    ) .
     245                    ' ' . 'Include Email',
     246                    $this->get_field_id( 'email' )
     247                )
     248            ) .
     249            pls_h_p(
     250                pls_h_label(
     251                    'Override Email:' .
     252                    pls_h(
     253                        'input',
     254                        array(
     255                            'type' => 'text',
     256                            'class' => 'widefat',
     257                            'id' => $this->get_field_id( 'email_custom' ),
     258                            'name' => $this->get_field_name( 'email_custom' ),
     259                            'value' => esc_attr( $instance['email_custom'] ),
     260                            'style' => 'font-weight:normal'
     261                        )
     262                    ),
     263                    $this->get_field_id( 'email_custom' ),
     264                    array('style' => 'font-weight:bold')
     265                )
     266            ) .
     267            // Phone checkbox and override input
     268            pls_h_p(
     269                pls_h_label(
     270                    pls_h_checkbox(
     271                        checked( $instance['phone'], true, false ),
     272                        array(
     273                            'id' => $this->get_field_id( 'phone' ),
     274                            'name' => $this->get_field_name( 'phone' ),
     275                        )
     276                    ) .
     277                    ' ' . 'Include Phone',
     278                    $this->get_field_id( 'phone' )
     279                )
     280            ) .
     281            pls_h_p(
     282                pls_h_label(
     283                    'Override Phone:' .
     284                    pls_h(
     285                        'input',
     286                        array(
     287                            'type' => 'text',
     288                            'class' => 'widefat',
     289                            'id' => $this->get_field_id( 'phone_custom' ),
     290                            'name' => $this->get_field_name( 'phone_custom' ),
     291                            'value' => esc_attr( $instance['phone_custom'] ),
     292                            'style' => 'font-weight:normal'
     293                        )
     294                    ),
     295                    $this->get_field_id( 'phone_custom' ),
     296                    array('style' => 'font-weight:bold')
     297                )
     298            ) .
     299            // Description checkbox and override input
     300            pls_h_p(
     301                pls_h_label(
     302                    pls_h_checkbox(
     303                        checked( $instance['description'], true, false ),
     304                        array(
     305                            'id' => $this->get_field_id( 'description' ),
     306                            'name' => $this->get_field_name( 'description' ),
     307                        )
     308                    ) .
     309                    ' ' . 'Include Description',
     310                    $this->get_field_id( 'description' )
     311                )
     312            ) .
     313            pls_h_p(
     314                pls_h_label(
     315                    'Override Description:' .
     316                    pls_h(
     317                        'input',
     318                        array(
     319                            'type' => 'text',
     320                            'class' => 'widefat',
     321                            'id' => $this->get_field_id( 'description_custom' ),
     322                            'name' => $this->get_field_name( 'description_custom' ),
     323                            'value' => esc_attr( $instance['description_custom'] ),
     324                            'style' => 'font-weight:normal;height:'
     325                        )
     326                    ),
     327                    $this->get_field_id( 'description_custom' ),
     328                    array('style' => 'font-weight:bold')
     329                )
     330            ) .
     331
     332
     333            /** Print the Photo checkbox */
     334            pls_h_p(
     335                pls_h_label(
     336                    pls_h_checkbox(
     337                        checked( $instance['photo'], true, false ),
     338                        array(
     339                            'id' => $this->get_field_id( 'photo' ),
     340                            'name' => $this->get_field_name( 'photo' ),
     341                        )
     342                    ) .
     343                    ' ' . 'Photo',
     344                    $this->get_field_id( 'photo' )
     345                )
     346            ) .
     347            pls_h_p(
     348                pls_h_label(
     349                    'Image'
     350                // array(
     351                //   'for' => $this->get_field_id('image_uri'),
     352                //   'value' => esc_attr( $instance['image_uri'] ),
     353                //   'id' => "image_tag-". esc_attr( $this->get_field_id('image_uri') ),
     354                // )
     355                ) .
     356                pls_h(
     357                    'input',
     358                    array(
     359                        'name' => $this->get_field_name('image_uri'),
     360                        'type' => 'text',
     361                        'id' => "image-". esc_attr( $this->get_field_id('image_uri') ),
     362                        'value' => $instance['image_uri'],
     363                        'class' => '.agent-widget-img-text-input'
     364                    )
     365                ) .
     366                pls_h(
     367                    'img',
     368                    array(
     369                        'id' => "image_tag-" . esc_attr( $this->get_field_id("image_uri") ),
     370                        'src' => $instance['image_uri'],
     371                        'class' => '.agent-widget-img-tag'
     372                    )
     373                ) .
     374                pls_h(
     375                    'input',
     376                    array(
     377                        'type' => 'button',
     378                        'id' => 'select-img-' . $this->get_field_id("image_uri"),
     379                        'value' => 'Select Image',
     380                        'class' => 'agent-widget-img-button'
     381                    )
     382                )
     383            )
     384
     385        );
     386
    459387    }
    460388
    461389
    462     private static function process_defaults ($args, $instance) {
    463 
    464         /** Define the default argument array. */
    465         $arg_defaults = array(
    466             'title' => 'Have any questions?',
    467             'before_title' => '<h3>',
    468             'after_title' => '</h3>',
    469             'before_widget' => '<section id="pls-agent-3" class="widget pls-agent widget-pls-agent" itemscope="" itemtype="http://schema.org/RealEstateAgent">',
    470             'after_widget' => '</section>',
    471             'widget_id' => '',
    472             'clearfix' => true
    473         );
    474 
    475 
    476         /** Merge the arguments with the defaults. */
    477         $args = wp_parse_args( $args, $arg_defaults );
    478 
    479         /** Define the default argument array. */
    480         $instance_defaults = array(
    481             'name' => true,
    482             'name_custom' => false,
    483             'email' => true,
    484             'email_custom' => false,
    485             'phone' => true,
    486             'phone_custom' => false,
    487             'description' => true,
    488             'description_custom' => false,
    489             'photo' => false,
    490             'image_uri' => false,
    491             'widget_id' => ''
    492         );
    493 
    494         /** Merge the arguments with the defaults. */
    495         $instance = wp_parse_args( $instance, $instance_defaults );
    496 
    497         return array($args, $instance);
    498     }
    499 
    500     public function checkForCustom ($instance, $attribute) {
    501         if ( !empty( $instance[$attribute.'_custom'] ) ) {
    502             $agent_html[$attribute] = $instance[$attribute.'_custom'];
    503         } else {
    504             $agent_html[$attribute] = '';
    505         }
    506         return $agent_html[$attribute];
    507     }
    508    
    509    
    510 } // end of class
     390    private static function process_defaults ($args, $instance) {
     391
     392        /** Define the default argument array. */
     393        $arg_defaults = array(
     394            'title' => 'Have any questions?',
     395            'before_title' => '<h3>',
     396            'after_title' => '</h3>',
     397            'before_widget' => '<section id="pls-agent-3" class="widget pls-agent widget-pls-agent" itemscope="" itemtype="http://schema.org/RealEstateAgent">',
     398            'after_widget' => '</section>',
     399            'widget_id' => '',
     400            'clearfix' => true
     401        );
     402
     403
     404        /** Merge the arguments with the defaults. */
     405        $args = wp_parse_args( $args, $arg_defaults );
     406
     407        /** Define the default argument array. */
     408        $instance_defaults = array(
     409            'name' => true,
     410            'name_custom' => false,
     411            'email' => true,
     412            'email_custom' => false,
     413            'phone' => true,
     414            'phone_custom' => false,
     415            'description' => true,
     416            'description_custom' => false,
     417            'photo' => true,
     418            'image_uri' => false,
     419            'widget_id' => ''
     420        );
     421
     422        /** Merge the arguments with the defaults. */
     423        $instance = wp_parse_args( $instance, $instance_defaults );
     424
     425        return array($args, $instance);
     426    }
     427}
     428
    511429
    512430// queue up the necessary js
     431add_action('admin_enqueue_scripts', 'upload_js_enqueue');
    513432function upload_js_enqueue() {
    514   wp_enqueue_style('thickbox');
    515   wp_enqueue_script('media-upload');
     433    wp_enqueue_style('thickbox');
     434    wp_enqueue_script('media-upload');
    516435}
    517436
    518 add_action('admin_enqueue_scripts', 'upload_js_enqueue');
    519 
     437add_action('admin_footer-widgets.php', 'agent_image_js', false, true);
    520438function agent_image_js () {
    521   ob_start();
    522   ?>
    523     <script>
    524       var image_field;
    525       var input_field;
    526       jQuery(function($){
    527         $(document).on('click', 'input.agent-widget-img-button', function(evt){
    528           var image_id = $(this).attr('id');
    529 
    530           var partial_image_id = image_id.substr(image_id.indexOf('widget-pls-agent'));
    531           input_field = $(this).siblings('#image-' + partial_image_id);
    532           image_field = $(this).siblings('#image_tag-' + partial_image_id);
    533           tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
    534           return false;
    535         });
    536         window.send_to_editor = function(html) {
    537           imgurl = $('img', html).attr('src');
    538           image_field.attr('src',imgurl);
    539           input_field.val(imgurl);
    540           tb_remove();
    541         }
    542       });
    543     </script>
    544   <?php
    545   echo ob_get_clean();
     439    ob_start();
     440    ?>
     441    <script>
     442        var image_field;
     443        var input_field;
     444        jQuery(function($){
     445            $(document).on('click', 'input.agent-widget-img-button', function(evt){
     446                var image_id = $(this).attr('id');
     447
     448                var partial_image_id = image_id.substr(image_id.indexOf('widget-pls-agent'));
     449                input_field = $(this).siblings('#image-' + partial_image_id);
     450                image_field = $(this).siblings('#image_tag-' + partial_image_id);
     451                tb_show('', 'media-upload.php?type=image&amp;TB_iframe=true');
     452                return false;
     453            });
     454            window.send_to_editor = function(html) {
     455                imgurl = $('img', html).attr('src');
     456                image_field.attr('src',imgurl);
     457                input_field.val(imgurl);
     458                tb_remove();
     459            }
     460        });
     461    </script>
     462    <?php
     463    echo ob_get_clean();
    546464}
    547 add_action('admin_footer-widgets.php', 'agent_image_js', false, true);
  • placester/trunk/blueprint/js/scripts/filters.js

    r1229357 r1280539  
    1414        this.listener = {};
    1515        this.listener.elements = params.listener.elements || this.className + ', #sort_by, #sort_dir';
    16         this.listener.events = params.listener.events || 'change submit';
     16        this.listener.events = params.listener.events || 'change submit reset';
    1717    } else {
    1818        this.listener = {};
    1919        this.listener.elements = this.className + ', #sort_by, #sort_dir';
    20         this.listener.events = 'change submit';
     20        this.listener.events = 'change submit reset';
    2121    }
    2222}
     
    2525    var that = this;
    2626    jQuery(this.listener.elements).on(this.listener.events, function (event) {
    27         event.preventDefault();
    28 
    29         // Check to see if a meaningful change to search criteria (i.e., not sort or pagination) triggered this call...
    30         var search_criteria_changed = (this.className.split(" ").indexOf(that.className.replace('.', '')) >= 0);
    31         that.listings.get(search_criteria_changed);
     27        if(event.type == 'submit') {
     28            event.preventDefault();
     29            that.listings.get(true);
     30        }
     31        else if(event.type == 'reset') {
     32            // the reset event comes before the form values are actually reset, so fire the listings call after returning
     33            setTimeout(function () { that.listings.get(true); }, 0)
     34        }
     35        else {
     36            // Check to see if a meaningful change to search criteria (i.e., not sort or pagination) triggered this call...
     37            var search_criteria_changed = (this.className.split(" ").indexOf(that.className.replace('.', '')) >= 0);
     38            that.listings.get(search_criteria_changed);
     39        }
    3240    });
    3341}
  • placester/trunk/blueprint/js/scripts/listing-list.js

    r1243489 r1280539  
    3535        },
    3636        'oLanguage': {
     37            "sProcessing": "Processing...",
    3738            "sInfo": "Showing _START_ to _END_ of _TOTAL_ entries",
    3839            "sInfoEmpty": "Showing 0 to 0 of 0 entries",
  • placester/trunk/blueprint/options/compliance.php

    r935428 r1280539  
    44    "name" => "MLS Compliance",
    55    "type" => "heading"));
     6
     7    PLS_Style::add(array(
     8        "name" => "Limit Search Results Displayed",
     9        "desc" => "Enter a maximum number of listings that may be displayed on search pages.",
     10        "id" => "pls-mls-listing-limit",
     11        "std" => "",
     12        "type" => "text"));
    613
    714    PLS_Style::add(array(
     
    1623        "desc" => "Locality and region (city and state) are shown for each listing.  This option enables the inclusion of postal codes.",
    1724        "id" => "pls-display-postal",
    18         "std" => "",
     25        "std" => false,
    1926        "type" => "checkbox"));
    2027
     
    2330        "desc" => "If selected, the '&#174;' symbol will appear whenever the MLS acronym is used in listing data.",
    2431        "id" => "pls-mls-trademarked",
    25         "std" => "",
     32        "std" => false,
    2633        "type" => "checkbox"));
    2734
    28 PLS_Style::add(array(
    29     "name" => "Disable Map Info for Properties",
    30     "desc" => "Check this box if your MLS disallows the display of listing data in the format used in the search maps.",
    31     "id" => "pls-disable-map-info",
    32     "std" => "",
    33     "type" => "checkbox"));
     35    PLS_Style::add(array(
     36        "name" => "Disable Map Info for Properties",
     37        "desc" => "Check this box if your MLS disallows the display of listing data in the format used in the search maps.",
     38        "id" => "pls-disable-map-info",
     39        "std" => false,
     40        "type" => "checkbox"));
    3441
    35 PLS_Style::add(array(
    36     "name" => "Disable Auto-Image Resizing",
    37     "desc" => "Placester makes sure your listing images aren't distorted by automatically resizing them. This option disables resizing.",
    38     "id" => "pls-disable-dragonfly",
    39     "std" => "",
    40     "type" => "checkbox"));
     42    PLS_Style::add(array(
     43        "name" => "Disable Auto-Image Resizing",
     44        "desc" => "Placester makes sure your listing images aren't distorted by automatically resizing them. This option disables resizing.",
     45        "id" => "pls-disable-dragonfly",
     46        "std" => false,
     47        "type" => "checkbox"));
  • placester/trunk/blueprint/partials/get-listings-ajax.php

    r1243489 r1280539  
    296296        // If plugin is active, grab listings intelligently...
    297297        if (!pls_has_plugin_error()) {
     298
     299            // Set a hard limit on the number of listings retrievable in search results -- an MLS requirement
     300            if($mls_limit = pls_get_option('pls-mls-listing-limit')) {
     301                if($search_query['limit'] == 0 || $search_query['offset'] + $search_query['limit'] >= $mls_limit)
     302                    $search_query['limit'] = $mls_limit - $search_query['offset'];
     303            }
     304            if($search_query['limit'] <= 0)
     305                $api_response = array('total' => $mls_limit . '+', 'offset' => $_POST['offset'], 'limit' => $_POST['limit'] ?: 150, 'count' => 0, 'listings' => array());
     306            else
     307
    298308            // Get the listings list markup and JS
    299309            if (!empty($property_ids) || $allow_id_empty) {
     
    311321                $api_response = PLS_Plugin_API::get_listings($search_query);
    312322            }
     323
     324            // When using an MLS limit use that as a maximum for search result total
     325            if($mls_limit && $api_response['total'] > $mls_limit) $api_response['total'] = $mls_limit . '+';
     326
    313327        }
    314328
  • placester/trunk/config/api/listings.php

    r1243489 r1280539  
    348348        'create' => array(
    349349            'request' => array(
    350                 'url' => 'https://api.placester.com/v2/listings',
     350                'url' => "$PL_API_SERVER/v2/listings",
    351351                'type' => 'POST'
    352352            ),
     
    516516        'temp_image' => array(
    517517            'request' => array(
    518                 'url' => 'https://api.placester.com/v2/listings/media/temp/image',
     518                'url' => "$PL_API_SERVER/v2/listings/media/temp/image",
    519519                'type' => 'POST'
    520520            ),
     
    526526        'update' => array(
    527527            'request' => array(
    528                 'url' => 'https://api.placester.com/v2/listings',
     528                'url' => "$PL_API_SERVER/v2/listings",
    529529                'type' => 'PUT'
    530530            ),
     
    534534        'delete' => array(
    535535            'request' => array(
    536                 'url' => 'https://api.placester.com/v2/listings',
     536                'url' => "$PL_API_SERVER/v2/listings",
    537537                'type' => 'DELETE'
    538538            ),
     
    544544        'get.locations' => array(
    545545            'request' => array(
    546                 'url' => 'https://api.placester.com/v2/listings/locations/',
     546                'url' => "$PL_API_SERVER/v2/listings/locations/",
    547547                'type' => 'GET'
    548548            ),
     
    563563        'get.aggregate' => array(
    564564            'request' => array(
    565                 'url' => 'https://api.placester.com/v2.1/listings/aggregate/',
     565                'url' => "$PL_API_SERVER/v2.1/listings/aggregate/",
    566566                'type' => 'GET'
    567567            ),
  • placester/trunk/helpers/css.php

    r1024603 r1280539  
    88        // add_action( 'admin_init', array( __CLASS__, 'admin' ));
    99        add_action( 'admin_enqueue_scripts', array( __CLASS__, 'admin' ) );
    10         add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'customizer' ) );
     10//      add_action( 'customize_controls_enqueue_scripts', array( __CLASS__, 'customizer' ) );
    1111    }
    1212
  • placester/trunk/helpers/js.php

    r1024603 r1280539  
    99        add_action( 'wp_enqueue_scripts', array( __CLASS__, 'frontend') );
    1010        add_action( 'admin_head', array(__CLASS__, 'admin_menu_url') );
    11         add_action( 'customize_controls_enqueue_scripts', array(__CLASS__, 'customizer') );
     11//      add_action( 'customize_controls_enqueue_scripts', array(__CLASS__, 'customizer') );
    1212    }
    1313
     
    165165
    166166    public static function frontend () {
    167         self::register_enqueue_if_not('general', trailingslashit(PL_JS_PUB_URL) . 'general.js', array('jquery'));
     167        //self::register_enqueue_if_not('general', trailingslashit(PL_JS_PUB_URL) . 'general.js', array('jquery'));
    168168        // listings
    169169        self::register_enqueue_if_not('datatables', trailingslashit(PL_JS_LIB_URL) . 'datatables/jquery.dataTables.js', array('jquery'));
  • placester/trunk/helpers/listing.php

    r1024603 r1280539  
    5252            }
    5353        }
    54        
     54
    5555        // fetch single inactive listing if specifically requested
    5656        if (!empty($args['listing_ids']) && count($args['listing_ids']) == 1 && !isset($args['include_disabled'])) {
     
    6767        }
    6868
    69         /* REMOVE */
    70         // if ($global_filters) {
    71         //  error_log("\n[[[AFTER:]]]\n" . var_export($args, true));
    72         // }
    73 
    74         // Respect block address setting if it's already set, otherwise, defer to the plugin setting...
    75         if (empty($args['address_mode'])) {
    76             $args['address_mode'] = ( PL_Option_Helper::get_block_address() ? 'polygon' : 'exact' );
    77         }
     69        // Avoid the data server's address_mode functionality
     70        $address_mode = $args['address_mode'] ?: (PL_Option_Helper::get_block_address() ? 'polygon' : 'exact');
     71        $args['address_mode'] = 'exact'; // this overrides the server-side account setting
    7872
    7973        // Call the API with the given args...
    8074        $listings = PL_Listing::get($args);
     75
    8176        // Make sure it contains listings, then process accordingly...
    8277        if (!empty($listings['listings'])) {
    8378            foreach ($listings['listings'] as $key => $listing) {
    84                 $listings['listings'][$key]['cur_data']['url'] = PL_Pages::get_url($listing['id'], $listing);
    85                 // add unit number to address: if unit has a space assume it contains a unit descriptor. handle case where it has # already
    86                 // TODO: consider moving to mls import
    87                 $listings['listings'][$key]['location']['address'] = $listing['location']['address'] . (empty($listing['location']['unit']) || strpos($listing['location']['address'], $listing['location']['unit'].' ')===0 ? '' : (strpos($listing['location']['unit'],' ')===false && substr($listing['location']['unit'], 0, 1)!='#' ? ' #' : ' ') . $listing['location']['unit']);
    88                 $listings['listings'][$key]['location']['full_address'] = $listings['listings'][$key]['location']['address'] . ' ' . $listing['location']['locality'] . ' ' . $listing['location']['region'];
     79
     80                // if the user wants "block" addresses, remove the street number (trying to catch known variations)
     81                if($address_mode == 'polygon') {
     82                    $listing['location']['address'] = self::obscure_address($listing['location']['address']);
     83                }
     84                else if($listing['location']['unit']) {
     85                    $listing['location']['address'] = self::append_address_unit($listing['location']['address'], $listing['location']['unit']);
     86                }
     87
     88                $listing['cur_data']['url'] = PL_Pages::get_url($listing['id'], $listing);
     89                $listing['location']['full_address'] = $listing['location']['address'] . ' ' . $listing['location']['locality'] . ' ' . $listing['location']['region'];
     90                $listings['listings'][$key] = $listing;
    8991            }
    9092        }
     
    9698
    9799        return $listings;
     100    }
     101
     102    public static function obscure_address($address) {
     103        return preg_replace('{^([0-9]|# ?)([0-9A-Za-z]| ?([\#\&\-\/\,\.]|and) ?)* ([A-DF-MO-RT-Za-df-mo-rt-z] )?}', '', $address);
     104    }
     105
     106    public static function append_address_unit($address, $unit) {
     107        if(strpos($address, $unit . ' ') !== 0)
     108            $address .= (strpos($unit, ' ') === false && substr($unit, 0, 1) != '#' ? ' #' : ' ') . $unit;
     109
     110        return $address;
    98111    }
    99112
  • placester/trunk/helpers/member-search.php

    r1243489 r1280539  
    425425                    </div>
    426426                </li>
    427             <?php }
    428         }
     427            <?php } ?>
     428            </ul>
     429        <?php }
    429430        else { ?>
    430431            <p>You haven't saved any favorite searches.</p>
  • placester/trunk/js/public/membership.js

    r1243489 r1280539  
    4949            $('div#pl_add_remove_lead_favorites,.pl_add_remove_lead_favorites').show();     
    5050        }
     51
     52        // These allow Login/Register links to be manually added to WP nav menus
     53        $('li.pl_register_lead_link > a').addClass('pl_register_lead_link');
     54        $('li.pl_register_lead_link').removeClass('pl_register_lead_link');
     55        $('li.pl_login_link > a').addClass('pl_login_link');
     56        $('li.pl_login_link').removeClass('pl_login_link');
    5157
    5258        // Register Form Fancybox
  • placester/trunk/lib/component_entities.php

    r1121611 r1280539  
    12601260        if( ! empty( $atts ) ) {
    12611261
    1262             if( ! empty( $atts['hide_sort_by'] ) && $atts['hide_sort_by'] == 'true' ) {
    1263                 $css .= '.sort_wrapper .sort_item:first-child { display: none; } ';
    1264             }
    1265             if( ! empty( $atts['hide_sort_direction'] ) && $atts['hide_sort_direction'] == 'true' ) {
    1266                 $css .= '.sort_wrapper .sort_item:last-child { display: none; } ';
    1267             }
    1268             if( ! empty( $atts['hide_num_results'] ) && $atts['hide_num_results'] == 'true' ) {
     1262            if( $atts['hide_sort_by'] == 'true' && $atts['hide_sort_direction'] == 'true') {
     1263                $css .= '.sort_wrapper { display: none !important; } ';
     1264            }
     1265            if( $atts['hide_sort_by'] == 'true' ) {
     1266                $css .= '.sort_wrapper .sort_item:first-child { display: none !important; } ';
     1267            }
     1268            if( $atts['hide_sort_direction'] == 'true' ) {
     1269                $css .= '.sort_wrapper .sort_item:last-child { display: none !important; } ';
     1270            }
     1271            if( $atts['hide_num_results'] == 'true' ) {
    12691272                $css .= '#placester_listings_list_length { display: none; } ';
    12701273            }
  • placester/trunk/lib/membership.php

    r1229357 r1280539  
    383383            ob_start();
    384384            ?>
    385             <div style="display:none;">
     385
     386            <?php if($USE_GRAVITY = false) : ?>
     387
     388                <div class="am_register" style="display:none;">
     389                    <div id="pl_lead_register_form" name="pl_lead_register_form" class="pl_login_reg_form pl_lead_register_form"><h3>Register:</h3>
     390                        <?php gravity_form( 3, false, false, false, '', false ); ?>
     391                    </div>
     392                </div>
     393
     394            <?php else : ?>
     395
     396                <div style="display:none;">
    386397                <form method="post" action="#<?php echo $role; ?>" id="pl_lead_register_form" name="pl_lead_register_form" class="pl_login_reg_form pl_lead_register_form" autocomplete="off">
    387 
    388398                    <div style="display:none" class="success">You have been successfully signed up. This page will refresh momentarily.</div>
    389 
    390399                    <div id="pl_lead_register_form_inner_wrapper">
    391400
     
    427436
    428437                    </div>
    429 
    430438                </form>
    431             </div>
     439                </div>
     440
     441            <?php endif; ?>
     442
    432443            <?php
    433444            $result = ob_get_clean();
     
    458469            ob_start();
    459470            ?>
    460             <div style='display:none;'>
     471
     472            <?php if($USE_GRAVITY = false) : ?>
     473
     474                <div class="am_login" style="display:none;">
     475                    <div id="pl_login_form" name="pl_login_form" class="pl_login_reg_form"><h3>Login:</h3>
     476                        <?php gravity_form( 2, false, false, false, '', false ); ?>
     477                    </div>
     478                </div>
     479
     480            <?php else : ?>
     481
     482                <div style='display:none;'>
    461483                <form name="pl_login_form" id="pl_login_form" action="<?php echo home_url(); ?>/wp-login.php" method="post" class="pl_login_reg_form">
     484
    462485                    <?php pls_do_atomic( 'login_form_before_title' ); ?>
    463486
    464487                    <div id="pl_login_form_inner_wrapper">
    465488                        <h2>Login</h2>
    466                         <!-- redirect-uri="<?php //echo $_SERVER["HTTP_REFERER"]; ?>" -->
    467                         <!-- <fb:registration fields="name,location,email" width="260"></fb:registration> -->
    468489
    469490                        <?php pls_do_atomic( 'login_form_before_email' ); ?>
     
    499520
    500521                </form>
    501             </div>
     522                </div>
     523
     524            <?php endif; ?>
     525
    502526            <?php
    503527            $result = ob_get_clean();
  • placester/trunk/lib/shortcodes.php

    r1229357 r1280539  
    9595
    9696    public static function init() {
    97         //pulls in all the macro shortcodes, static list defined above
     97        // pulls in all the macro shortcodes, static list defined above
    9898        foreach (self::$codes as $shortcode) {
    9999            add_shortcode($shortcode, array(__CLASS__, $shortcode . '_shortcode_handler'));         
     
    101101
    102102        // For any shortcodes that use subcodes, register them to a single handler that bears the shortcode's name
     103        /* no, these can't be used as standalones, outside of their proper context
    103104        foreach (self::$subcodes as $code => $subs) {
    104           foreach ($subs as $sub) {
    105             add_shortcode($sub, array(__CLASS__, $code . '_sub_shortcode_handler'));
    106           }
    107         }
     105            foreach ($subs as $sub) {
     106                add_shortcode($sub, array(__CLASS__, $code . '_sub_shortcode_handler'));
     107            }
     108        }
     109        */
    108110
    109111        // register several helpful shortcodes for filters, for metadata, locaiton and common
  • placester/trunk/lib/shortcodes/sc_base.php

    r1229357 r1280539  
    345345                $multiple = 'multiple';
    346346            case 'select':
    347                 $options = self::_option_explode($attr['options']);
     347                $options = self::_option_explode($attr['options'], in_array($item, array('price', 'min_price', 'max_price')));
    348348                $value = is_array($request_value) ? $request_value : self::_value_explode($value);
    349349                ?>
     
    394394    }
    395395
    396     private static function _option_explode($option) {
    397         if(!is_scalar($option)) return array();
    398 
    399         $options = array();
    400         $pairs = array_map('trim', explode(',', $option));
    401         foreach ($pairs as $pair) {
    402             $parts = array_map('trim', explode('|', $pair, 2));
    403             if (empty($parts[1])) $parts[1] = $parts[0];
    404             $options[$parts[0]] = $parts[1];
    405         }
    406         return $options;
     396    private static function _array_explode($string) {
     397        $result = array();
     398
     399        if(is_scalar($string)) {
     400            $tokens = preg_split("/^ +|( *[,|] *)| +$/", $string, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
     401            $value = array(); $pointer = 0; $quoted = false;
     402
     403            foreach($tokens as $token) {
     404                if(is_null($value[$pointer]) || $value[$pointer] === '') {
     405                    if($token[0] == "'" || $token[0] == '"')
     406                        $quoted = $token[0];
     407                }
     408
     409                if(!$quoted && strpos($token, ',') !== false) {
     410                    $result[$value[0]] = $value[1];
     411                    $value = array(); $pointer = 0;
     412                }
     413
     414                else if(!$quoted && strpos($token, '|') !== false) {
     415                    $value[++$pointer] = '';
     416                }
     417
     418                else {
     419                    $value[$pointer] .= $token;
     420                    if($quoted && substr($token, -1) == $quoted) {
     421                        $value[$pointer] = trim($value[$pointer], "'" . '"');
     422                        $quoted = false;
     423                    }
     424                }
     425            }
     426            $result[$value[0]] = $value[1];
     427        }
     428
     429        return $result;
     430    }
     431
     432    private static function _option_explode($option, $prices = false) {
     433        $result = self::_array_explode($option);
     434        foreach ($result as $key => &$value) {
     435            if(is_null($value))
     436                $value = ($prices ? PLS_Format::number($key, array('abbreviate' => false)) : $key);
     437        }
     438        return $result;
    407439    }
    408440
    409441    private static function _value_explode($value) {
    410         if(!is_scalar($value)) return array();
    411 
    412         $values = array();
    413         $pairs = array_map('trim', explode(',', $value));
    414         foreach ($pairs as $pair) {
    415             $parts = array_map('trim', explode('|', $pair, 2));
    416             $values[] = $parts[0];
    417         }
    418         return $values;
     442        return array_keys(self::_array_explode($value));
    419443    }
    420444}
  • placester/trunk/lib/sitemaps.php

    r1229357 r1280539  
    1313        add_action('init', array(__CLASS__, 'register_sitemaps'));
    1414        add_filter('wpseo_sitemap_index', array(__CLASS__, 'append_sub_sitemaps'));
    15         add_action('wpseo_xmlsitemaps_config', array(__CLASS__, 'configure_sitemaps'));
     15        //add_action('wpseo_xmlsitemaps_config', array(__CLASS__, 'configure_sitemaps'));
    1616    }
    1717
     
    4141
    4242        // Make an API call to determine the total number of listings in a feed...
    43         $response = PL_Listing_Helper::results(array('agency_only'=>1, 'limit'=>1, 'cachebuster'=>time()));
     43        $response = PL_Listing_Helper::results(array('limit'=>1, 'cachebuster'=>time()));
    4444        $total = isset($response['total']) ? $response['total'] : 0;
    4545
     
    116116
    117117        while ($rem > 0) {
    118             $args = array('agency_only'=>1, 'offset'=>$offset, 'limit'=>min($rem, self::$max_prop_entries), 'sort_by'=>'total_images', 'sort_type'=>'desc');
     118            $args = array('offset'=>$offset, 'limit'=>min($rem, self::$max_prop_entries), 'sort_by'=>'total_images', 'sort_type'=>'desc');
    119119            $response = PL_Listing_Helper::results($args);
    120120
  • placester/trunk/placester.php

    r1243489 r1280539  
    142142include_once('lib/component_entities.php');
    143143include_once('lib/shortcodes.php');
    144 include_once('lib/customizer.php');
     144//include_once('lib/customizer.php');
    145145//include_once('lib/social_networks.php');
    146146include_once('lib/analytics.php');
     
    184184include_once('helpers/member-search.php');
    185185include_once('helpers/lead-capture.php');
    186 include_once('helpers/customizer.php');
     186//include_once('helpers/customizer.php');
    187187include_once('helpers/logging.php');
    188188
  • placester/trunk/readme.txt

    r1230742 r1280539  
    44Requires at least: 3.9
    55Tested up to: 4.3
    6 Stable tag: 1.3.2
     6Stable tag: 1.3.3
    77
    88Easily create and manage real estate sites powered by WordPress.
     
    142142
    143143== Changelog ==
     144
     145= 1.3.3 =
     146* Fixed broken customization functionality
     147* Fixed agent widget option handling and theme compatibility
     148* Provisions for specialized data server configurations
     149* Eliminated server-side block addresses, added local address obfuscation feature
     150* Improved compatibility with recent versions of Yoast SEO
     151* Added currency formatting and escape sequence handling for shortcode custom select menus
     152* Eliminated conflict with WordPress [gallery] shortcode
     153* Added developer hooks for custom login and registration forms
     154* Improved search permalink handling and added user saved search capability
    144155
    145156= 1.3.2 =
  • placester/trunk/views/admin/settings/general.php

    r819211 r1280539  
    116116            <li>
    117117                <input id="block_address" type="checkbox" name="block_address" <?php echo $block_address ? 'checked="checked"' : '' ?>>
    118                 <label for="block_address">Use <b>Block Addresses</b> rather than exact addresses. Using block addresses will switch over all the addresses in your website to the nearest block or a close-by address, rather than exact address.</label>
     118                <label for="block_address">Use <b>Block Addresses</b> rather than exact addresses. Using block addresses will suppress the display of exact street addresses for all properties on your website.</label>
    119119            </li>
    120120            <li>
  • placester/trunk/views/shortcodes/search_listings/twocolumn.php

    r1024603 r1280539  
    190190}
    191191.pl-tpl-sl-twocolumn .dataTables_length {
     192    display: none !important;
    192193    float: right !important;
    193194    margin: -2.35em 1em 0 0 !important;
  • placester/trunk/views/shortcodes/static_listings/twocolumn.php

    r1024603 r1280539  
    192192}
    193193.pl-tpl-stl-twocolumn .dataTables_length {
     194    display: none !important;
    194195    float: right !important;
    195196    margin: -2.35em 1em 0 0 !important;
Note: See TracChangeset for help on using the changeset viewer.