Plugin Directory

Changeset 2890623


Ignore:
Timestamp:
03/30/2023 06:43:21 PM (3 years ago)
Author:
8blocks
Message:

2.33 Update - JS and Ajax fixed

Location:
home-value/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • home-value/trunk/EightB_Home_Value.php

    r2832539 r2890623  
    77Plugin Name:    8b Home Value
    88Plugin URI:     https://homevalueplugin.com
    9 Version:        2.32
     9Version:        2.33
    1010*/
    1111
  • home-value/trunk/readme.txt

    r2872661 r2890623  
    55Requires at least: 4.6
    66Stable tag: trunk
    7 Tested up to: 6.1
     7Tested up to: 6.2
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    7979
    8080== Changelog ==
     81
     82= 2.33 20230330 =
     83
     84* JS field and ajax fix
    8185
    8286= 2.32 20221212 =
  • home-value/trunk/static/js.js

    r2105861 r2890623  
    44    @since      2016-12-23 18:44:35
    55**/
    6 jQuery(function($)
    7 {
    8     $.fn.extend(
    9     {
    10         ajaxify_form : function()
    11         {
    12             return this.each(function ()
    13             {
    14                 var $$ = $(this);
    15 
    16                 var $div = $( '.8b_home_value' );
    17 
    18                 /**
    19                     @brief      Send the form content via ajax, and then replace the page contents with the new contents.
    20                     @since      2016-12-23 19:21:17
    21                 **/
    22                 $$.send_via_ajax = function()
    23                 {
    24                     $.post( {
    25                         'data': $$.serialize(),
    26                         'type': $$.attr('method'),
    27                         'url': $$.attr('action')
    28                     } )
    29                     .done( function( data )
    30                     {
    31                         // Replace the content with the new content.
    32                         var $data = $( data );
    33                         var $new_div = $( '.8b_home_value', $data );
    34                         $div.html( $new_div.html() );
    35                         $div.removeClass( 'busy' );
    36                         // And restart all javascript.
    37                         eightb_home_value();
    38                     } );
    39                 }
    40 
    41                 $$.submit( function( e )
    42                 {
    43                     e.preventDefault();
    44                     $div.addClass( 'busy' );
    45                     $$.send_via_ajax();
    46                 } );
    47             });
    48         }
    49     });
     6jQuery(function ($) {
     7    $.fn.extend(
     8        {
     9            ajaxify_form: function () {
     10                return this.each(function () {
     11                    var $$ = $(this);
     12
     13                    var $div = $('.8b_home_value');
     14
     15                    /**
     16                        @brief      Send the form content via ajax, and then replace the page contents with the new contents.
     17                        @since      2016-12-23 19:21:17
     18                    **/
     19                    $$.send_via_ajax = function () {
     20                        $.post({
     21                            'data': $$.serialize(),
     22                            'type': $$.attr('method'),
     23                            'url': $$.attr('action')
     24                        })
     25                            .done(function (data) {
     26                                // Replace the content with the new content.
     27                                var $data = $(data);
     28                                var $new_div = $('.8b_home_value', $data);
     29                                $div.html($new_div.html());
     30                                $div.removeClass('busy');
     31                                // And restart all javascript.
     32                                eightb_home_value();
     33                            });
     34                    };
     35
     36                    $$.submit(function (e) {
     37                        e.preventDefault();
     38                        // Check if the found_address field has a value
     39                        var $found_address = $('.found_address', $$);
     40                        // check if the found_address exists
     41                        if ($found_address.length != 0) {
     42                            if ($found_address.val().trim() === '') {
     43                                // If the found_address field is empty, do not proceed with the submission
     44                                // console.log('found address is empty');
     45                                return;
     46                            }
     47                        }
     48                        $div.addClass('busy');
     49                        $$.send_via_ajax();
     50                    });
     51                });
     52            }
     53        });
    5054}(jQuery));
    5155;
     
    5458    @since      2016-12-23 19:29:36
    5559**/
    56 jQuery(function($)
    57 {
    58     $.fn.extend(
    59     {
    60         noncify_form : function()
    61         {
    62             return this.each(function ()
    63             {
    64                 var $$ = $(this);
    65 
    66                 // Put the nonce into the form.
    67                 $( '<input>' )
    68                     .prop( 'type', 'hidden' )
    69                     .prop( 'name', '8b_home_value[nonce]' )
    70                     .val( eightb_home_value_data.nonce )
    71                     .appendTo( $$ );
    72             });
    73         }
    74     });
     60jQuery(function ($) {
     61    $.fn.extend(
     62        {
     63            noncify_form: function () {
     64                return this.each(function () {
     65                    var $$ = $(this);
     66
     67                    // Put the nonce into the form.
     68                    $('<input>')
     69                        .prop('type', 'hidden')
     70                        .prop('name', '8b_home_value[nonce]')
     71                        .val(eightb_home_value_data.nonce)
     72                        .appendTo($$);
     73                });
     74            }
     75        });
    7576}(jQuery));
    7677;
     
    7980    @since      2016-12-16 23:08:04
    8081**/
    81 jQuery(function($)
    82 {
    83     $.fn.extend(
    84     {
    85         address_found : function()
    86         {
    87             return this.each(function ()
    88             {
    89                 var $$ = $(this);
    90 
    91                 // Put the nonce into the form.
    92                 var $input = $( '<input>' )
    93                     .prop( 'type', 'hidden' )
    94                     .prop( 'name', '8b_home_value[nonce]' )
    95                     .val( eightb_home_value_data.nonce )
    96                     .appendTo( $( 'form', $$ ) );
    97 
    98                 var $image = $( '.street_view img', $$ );
    99 
    100                 var url = $image.data( 'url' );
    101 
    102                 // Get the dimensions.
    103                 var height = $image.height();
    104                 var width = $image.width();
    105 
    106                 // Replace the resolution in the street view url.
    107                 url = url.replace( 'RESOLUTION', width + 'x' + height );
    108 
    109                 $image.prop( 'src', url );
    110             });
    111         }
    112     });
     82jQuery(function ($) {
     83    $.fn.extend(
     84        {
     85            address_found: function () {
     86                return this.each(function () {
     87                    var $$ = $(this);
     88
     89                    // Put the nonce into the form.
     90                    var $input = $('<input>')
     91                        .prop('type', 'hidden')
     92                        .prop('name', '8b_home_value[nonce]')
     93                        .val(eightb_home_value_data.nonce)
     94                        .appendTo($('form', $$));
     95
     96                    var $image = $('.street_view img', $$);
     97
     98                    var url = $image.data('url');
     99
     100                    // Get the dimensions.
     101                    var height = $image.height();
     102                    var width = $image.width();
     103
     104                    // Replace the resolution in the street view url.
     105                    url = url.replace('RESOLUTION', width + 'x' + height);
     106
     107                    $image.prop('src', url);
     108                });
     109            }
     110        });
    113111}(jQuery));
    114112;
     
    117115    @since      2016-12-11 20:18:44
    118116**/
    119 jQuery(function($)
    120 {
    121     $.fn.extend(
    122     {
    123         ask_for_address : function()
    124         {
    125             return this.each(function ()
    126             {
    127                 var $$ = $(this);
    128 
    129                 var $address = $( 'input.address', $$ );
    130                 var $found_address = $( '.found_address', $$ );
    131 
    132                 autocomplete = new google.maps.places.Autocomplete
    133                 (
    134                     $address[ 0 ],
    135                     {
    136                         types: ['geocode'],
    137                         componentRestrictions: { country: 'us' }
    138                     }
    139                 );
    140 
    141                 google.maps.event.addListener(autocomplete, 'place_changed', function()
    142                 {
    143                     var found_parts = {};
    144                     var needed_parts = {
    145                         0 : 'street_number',
    146                         1 : 'route',
    147                         2 : 'postal_code',
    148                     };
    149 
    150                     var place = this.getPlace();
    151                     var components = place.address_components;
    152 
    153                     for ( var part_number in needed_parts )
    154                     {
    155                         var part_key = needed_parts[ part_number ];
    156 
    157                         for ( var counter = 0; counter < components.length ; counter++ )
    158                             if ( components[ counter ].types[ 0 ] == part_key )
    159                                 found_parts[ part_key ] = components[ counter ].long_name;
    160                     }
    161 
    162                     var found_address = found_parts[ 'street_number' ] + ' ' + found_parts[ 'route' ] + ';' + found_parts[ 'postal_code' ];
    163                     $found_address.val( found_address );
    164                 } );
    165 
    166             });
    167         }
    168     });
     117jQuery(function ($) {
     118    $.fn.extend(
     119        {
     120            ask_for_address: function () {
     121                return this.each(function () {
     122                    var $$ = $(this);
     123
     124                    var $address = $('input.address', $$);
     125                    var $found_address = $('.found_address', $$);
     126
     127                    autocomplete = new google.maps.places.Autocomplete
     128                        (
     129                            $address[0],
     130                            {
     131                                types: ['geocode'],
     132                                componentRestrictions: { country: 'us' }
     133                            }
     134                        );
     135
     136                    google.maps.event.addListener(autocomplete, 'place_changed', function () {
     137                        var found_parts = {};
     138                        var needed_parts = {
     139                            0: 'street_number',
     140                            1: 'route',
     141                            2: 'postal_code',
     142                        };
     143
     144                        var place = this.getPlace();
     145                        var components = place.address_components;
     146
     147                        for (var part_number in needed_parts) {
     148                            var part_key = needed_parts[part_number];
     149
     150                            for (var counter = 0; counter < components.length; counter++)
     151                                if (components[counter].types[0] == part_key)
     152                                    found_parts[part_key] = components[counter].long_name;
     153                        }
     154
     155                        var found_address = found_parts['street_number'] + ' ' + found_parts['route'] + ';' + found_parts['postal_code'];
     156                        $found_address.val(found_address);
     157                    });
     158
     159                });
     160            }
     161        });
    169162}(jQuery));
    170163;
     
    173166    @since      2015-07-11 19:47:46
    174167**/
    175 ;(function( $ )
    176 {
    177     $.fn.extend(
    178     {
    179         plainview_form_auto_tabs : function()
    180         {
    181             return this.each( function()
    182             {
    183                 var $this = $(this);
    184 
    185                 if ( $this.hasClass( 'auto_tabbed' ) )
    186                     return;
    187 
    188                 $this.addClass( 'auto_tabbed' );
    189 
    190                 var $fieldsets = $( 'div.fieldset', $this );
    191                 if ( $fieldsets.length < 1 )
    192                     return;
    193 
    194                 $this.prepend( '<div style="clear: both"></div>' );
    195                 // Create the "tabs", which are normal Wordpress tabs.
    196                 var $subsubsub = $( '<ul class="subsubsub">' )
    197                     .prependTo( $this );
    198 
    199                 $.each( $fieldsets, function( index, item )
    200                 {
    201                     var $item = $(item);
    202                     var $h3 = $( 'h3.title', $item );
    203                     var $a = $( '<a href="#">' ).html( $h3.html() );
    204                     $h3.remove();
    205                     var $li = $( '<li>' );
    206                     $a.appendTo( $li );
    207                     $li.appendTo( $subsubsub );
    208 
    209                     // We add a separator if we are not the last li.
    210                     if ( index < $fieldsets.length - 1 )
    211                         $li.append( '<span class="sep">&emsp;|&emsp;</span>' );
    212 
    213                     // When clicking on a tab, show it
    214                     $a.click( function()
    215                     {
    216                         $( 'li a', $subsubsub ).removeClass( 'current' );
    217                         $(this).addClass( 'current' );
    218                         $fieldsets.hide();
    219                         $item.show();
    220                     } );
    221 
    222                 } );
    223 
    224                 $( 'li a', $subsubsub ).first().click();
    225             } ); // return this.each( function()
    226         } // plugin: function()
    227     } ); // $.fn.extend({
    228 } )( jQuery );
     168; (function ($) {
     169    $.fn.extend(
     170        {
     171            plainview_form_auto_tabs: function () {
     172                return this.each(function () {
     173                    var $this = $(this);
     174
     175                    if ($this.hasClass('auto_tabbed'))
     176                        return;
     177
     178                    $this.addClass('auto_tabbed');
     179
     180                    var $fieldsets = $('div.fieldset', $this);
     181                    if ($fieldsets.length < 1)
     182                        return;
     183
     184                    $this.prepend('<div style="clear: both"></div>');
     185                    // Create the "tabs", which are normal Wordpress tabs.
     186                    var $subsubsub = $('<ul class="subsubsub">')
     187                        .prependTo($this);
     188
     189                    $.each($fieldsets, function (index, item) {
     190                        var $item = $(item);
     191                        var $h3 = $('h3.title', $item);
     192                        var $a = $('<a href="#">').html($h3.html());
     193                        $h3.remove();
     194                        var $li = $('<li>');
     195                        $a.appendTo($li);
     196                        $li.appendTo($subsubsub);
     197
     198                        // We add a separator if we are not the last li.
     199                        if (index < $fieldsets.length - 1)
     200                            $li.append('<span class="sep">&emsp;|&emsp;</span>');
     201
     202                        // When clicking on a tab, show it
     203                        $a.click(function () {
     204                            $('li a', $subsubsub).removeClass('current');
     205                            $(this).addClass('current');
     206                            $fieldsets.hide();
     207                            $item.show();
     208                        });
     209
     210                    });
     211
     212                    $('li a', $subsubsub).first().click();
     213                }); // return this.each( function()
     214            } // plugin: function()
     215        }); // $.fn.extend({
     216})(jQuery);
    229217;
    230218/**
     
    232220    @since      2016-12-11 20:19:08
    233221**/
    234 eightb_home_value = function()
    235 {
    236     $( '.8b_home_value .ask_for_address' ).ask_for_address();
    237     $( '.8b_home_value .address_found' ).address_found();
    238     $( '.8b_home_value form' ).ajaxify_form();
    239     $( '.8b_home_value form' ).noncify_form();
    240     $( 'form.plainview_form_auto_tabs' ).plainview_form_auto_tabs();
    241 }
    242 
    243 jQuery( document ).ready( function( jQuery )
    244 {
     222eightb_home_value = function () {
     223    $('.8b_home_value .ask_for_address').ask_for_address();
     224    $('.8b_home_value .address_found').address_found();
     225    $('.8b_home_value form').ajaxify_form();
     226    $('.8b_home_value form').noncify_form();
     227    $('form.plainview_form_auto_tabs').plainview_form_auto_tabs();
     228};
     229
     230jQuery(document).ready(function (jQuery) {
    245231    $ = jQuery;
    246232    eightb_home_value();
    247    
    248     if($(".input_itself input[type=range][name=home_extra_value]").length > 0 )
    249     {
    250     //add range output box after range element :ky 06/07/2019
    251     $(".input_itself input[type=range][name=home_extra_value]").each(function(){
    252             if(!$(this).next(".range-output").length)
    253             {
     233
     234    if ($(".input_itself input[type=range][name=home_extra_value]").length > 0) {
     235        //add range output box after range element :ky 06/07/2019
     236        $(".input_itself input[type=range][name=home_extra_value]").each(function () {
     237            if (!$(this).next(".range-output").length) {
    254238                $(this).after('<span class="range-output" id="range-output"></span>');
    255239            }
    256    });
    257     //update range value data in output box : KY 06/08/2019
    258     var slider = document.getElementById("plainview_sdk_eightb_home_value_form2_inputs_range_home_extra_value");
    259     var output = document.getElementById("range-output");
    260     output.innerHTML = slider.value + '%';
    261     //update range value data in output box on onchange: KY 06/08/2019
    262     slider.oninput = function() {
    263       output.innerHTML = this.value + '%';
     240        });
     241        //update range value data in output box : KY 06/08/2019
     242        var slider = document.getElementById("plainview_sdk_eightb_home_value_form2_inputs_range_home_extra_value");
     243        var output = document.getElementById("range-output");
     244        output.innerHTML = slider.value + '%';
     245        //update range value data in output box on onchange: KY 06/08/2019
     246        slider.oninput = function () {
     247            output.innerHTML = this.value + '%';
     248        };
    264249    }
    265     }
    266 } );
    267 ;
    268 
     250});
     251;
     252
  • home-value/trunk/vendor/eightb/home_plugin_1/client/email_trait.php

    r2312907 r2890623  
    66    @brief      Handle all e-mailing
    77    @since      2017-03-05 14:20:12
    8 **/
     8 **/
    99trait email_trait
    1010{
     
    1212        @brief      Send this lead to the specified e-mails.
    1313        @since      2016-12-09 22:10:23
    14     **/
    15     public function send_lead( $lead, $shortcodes )
     14     **/
     15    public function send_lead($lead, $shortcodes)
    1616    {
    17        
     17
    1818        $mail = $this->mail();
    1919
    20         $sender_email = $this->get_local_or_site_option( 'email_new_lead_sender_email' );
    21         $sender_email = do_shortcode( $sender_email );
    22         if ( $sender_email == '' )
    23         // Send from the admin
    24         $sender_email = get_option( 'admin_email', true );
    25         $sender_name = $this->get_local_or_site_option( 'email_new_lead_sender_name' );
    26         $sender_name = do_shortcode( $sender_name );
     20        $sender_email = $this->get_local_or_site_option('email_new_lead_sender_email');
     21        $sender_email = do_shortcode($sender_email);
     22        if ($sender_email == '')
     23            // Send from the admin
     24            $sender_email = get_option('admin_email', true);
     25        $sender_name = $this->get_local_or_site_option('email_new_lead_sender_name');
     26        $sender_name = do_shortcode($sender_name);
    2727        //$mail->from( $sender_email, $sender_name );
    2828
    29         $recipients = $this->get_local_or_site_option( 'email_new_lead_recipients' );
     29        $recipients = $this->get_local_or_site_option('email_new_lead_recipients');
    3030        // Allow shortcodes in the recipients.
    31         $recipients = do_shortcode( $recipients );
    32         $recipients = $this->string_to_emails( $recipients );
     31        $recipients = do_shortcode($recipients);
     32        $recipients = $this->string_to_emails($recipients);
    3333        /*Custom Code Start 2019/03/09 I have added conditional code for send email to lead_email */
    34         if( isset( $lead->meta ) && isset( $lead->meta->lead_email ) )
    35         {
     34        if (isset($lead->meta) && isset($lead->meta->lead_email)) {
    3635            $recipients[$lead->meta->lead_email] = $lead->meta->lead_email;
    3736        }
    3837        /*Custom Code End 2019/03/09*/
    3938        $to_array = [];
    40         foreach( $recipients as $rec )
    41         {
     39        foreach ($recipients as $rec) {
    4240            //$mail->to( $rec );
    4341            $to_array[] = $rec;
    4442        }
    45            
     43
    4644
    4745        $texts = [];
    48         $texts[ 'subject' ] = $this->get_local_or_site_option( 'email_new_lead_subject' );
    49         $texts[ 'text' ] = $this->get_local_or_site_option( 'email_new_lead_text' );
     46        $texts['subject'] = $this->get_local_or_site_option('email_new_lead_subject');
     47        $texts['text'] = $this->get_local_or_site_option('email_new_lead_text');
    5048
    5149        // Replace lead shortcodes.
    52         foreach( $texts as $index => $string )
    53             $texts[ $index ] = $this->replace_shortcodes( $texts[ $index ], $shortcodes );
     50        foreach ($texts as $index => $string)
     51            $texts[$index] = $this->replace_shortcodes($texts[$index], $shortcodes);
    5452
    5553        /**
    5654            @brief      Compatibility for version 2.1 that does not have properly prefixed lead shortcodes.
    5755            @since      2017-02-28 19:04:00
    58         **/
    59         foreach( $shortcodes as $key => $value )
    60             foreach( $texts as $index => $string )
    61                 $texts[ $index ] = str_replace( '[' . $key . ']', $value, $texts[ $index ] );
    62 
     56         **/
     57        foreach ($shortcodes as $key => $value)
     58            foreach ($texts as $index => $string) {
     59                // edited by bill bailey 3/29/2023
     60                // if $value is not a string or number we don't want to replace it.
     61                if (!is_string($value) && !is_numeric($value)) {
     62                    continue;
     63                }
     64                $texts[$index] = str_replace('[' . $key . ']', $value, $texts[$index]);
     65            }
    6366        //$mail->subject( $texts[ 'subject' ] );
    6467        //$mail->html( $texts[ 'text' ] );
    65         $headers[] = 'From: '.$sender_name.' <'.$sender_email.'>' . "\r\n";
     68        $headers[] = 'From: ' . $sender_name . ' <' . $sender_email . '>' . "\r\n";
    6669        $headers[] = 'Content-Type: text/html; charset=UTF-8';
    67         $subject = $texts[ 'subject' ];
    68         $html = $texts[ 'text' ];
     70        $subject = $texts['subject'];
     71        $html = $texts['text'];
    6972
    7073        //add_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ) );
    7174
    72         foreach( $to_array as $to )
    73         {
    74             wp_mail( $to, $subject, $html, $headers );
     75        foreach ($to_array as $to) {
     76            wp_mail($to, $subject, $html, $headers);
    7577        }
    7678        //remove_filter( 'wp_mail_content_type', array( $this, 'set_html_content_type' ) );
     
    8284    }*/
    8385}
    84 
  • home-value/trunk/vendor/eightb/home_plugin_1/client/shortcodes_trait.php

    r2105861 r2890623  
    66    @brief      Handles shortcode functions.
    77    @since      2017-03-05 11:32:31
    8 **/
     8 **/
    99trait shortcodes_trait
    1010{
     
    1313        @details    For example: 8b_home_value_
    1414        @since      2017-03-05 11:33:05
    15     **/
     15     **/
    1616    public function get_plugin_prefix()
    1717    {
    18         $this->wp_die( 'Please override this function: %s\%s', __CLASS__, __FUNCTION__ );
     18        $this->wp_die('Please override this function: %s\%s', __CLASS__, __FUNCTION__);
    1919    }
    2020
     
    2323        @details    The default is the plugin prefix.
    2424        @since      2017-03-07 22:27:42
    25     **/
     25     **/
    2626    public function get_shortcode_name()
    2727    {
     
    3333        @details    The default is shortcode_PLUGINPREFIX
    3434        @since      2017-03-07 22:27:51
    35     **/
     35     **/
    3636    public function get_shortcode_function()
    3737    {
     
    4444        @brief      Replace the shortcodes in this text.
    4545        @since      2017-02-24 23:54:27
    46     **/
    47     public function replace_shortcodes( $text, $replacements )
     46     **/
     47    public function replace_shortcodes($text, $replacements)
    4848    {
    4949        $prefix = $this->get_plugin_prefix();
    50         foreach( $replacements as $find => $replacement )
    51             $text = str_replace( '[' . $prefix . '_' . $find . ']', $replacement, $text );
    52        
    53        
     50        foreach ($replacements as $find => $replacement) {
     51            // edited by bill bailey 3/29/2023
     52            // if $replacement is not a string or number we don't want to replace it.
     53            if (!is_string($replacement) && !is_numeric($replacement)) {
     54                continue;
     55            }
     56            $text = str_replace('[' . $prefix . '_' . $find . ']', $replacement, $text);
     57        }
     58
     59
    5460        /*Custom Code Start 2019/03/09 Add comparables data template file.*/
    5561        $comparables_text = '<h5 class="hv-recent-sales">Recent Local Sales</h5>';
    56         if( isset( $replacements["comparables"] ) && count( $replacements["comparables"] ) > 0)
    57         {
     62        if (isset($replacements["comparables"]) && count($replacements["comparables"]) > 0) {
    5863            $temp_comp_array = $replacements["comparables"];
    59             usort($temp_comp_array, function($a, $b) {
     64            usort($temp_comp_array, function ($a, $b) {
    6065                return $a->attributes->saleDate < $b->attributes->saleDate;
    6166            });
    62            
    63            
    64             $comparables_looop_count=0;
    65            
    66            
    67             $found_check=0;
     67
     68
     69            $comparables_looop_count = 0;
     70
     71
     72            $found_check = 0;
    6873            $map_location_data = array();
    6974            $map_location_data_str = "";
    70             $map_location_center_data="";
     75            $map_location_center_data = "";
    7176            //print_r( $temp_comp_array);
    72             for($count = 0; $count < count($temp_comp_array ); $count++ )
    73             {
    74                 if( strtotime("-6 months") < $temp_comp_array[$count]->attributes->saleDate  && isset( $temp_comp_array[$count]->attributes->salePrice ) && $temp_comp_array[$count]->attributes->salePrice > 0 )
    75                 {
    76                     if( $map_location_center_data == "" )
    77                     {
    78                         $map_location_center_data = "lat: ".$temp_comp_array[$count]->coordinates->latitude.", lng: ".$temp_comp_array[$count]->coordinates->longitude;
     77            for ($count = 0; $count < count($temp_comp_array); $count++) {
     78                if (strtotime("-6 months") < $temp_comp_array[$count]->attributes->saleDate  && isset($temp_comp_array[$count]->attributes->salePrice) && $temp_comp_array[$count]->attributes->salePrice > 0) {
     79                    if ($map_location_center_data == "") {
     80                        $map_location_center_data = "lat: " . $temp_comp_array[$count]->coordinates->latitude . ", lng: " . $temp_comp_array[$count]->coordinates->longitude;
    7981                    }
    8082                    setlocale(LC_MONETARY, 'en_US');
    81                     $map_location_data[] = array('<div class="show_value"><p class="hv_address">'.$temp_comp_array[$count]->address->deliveryLine.'</p><p class="hv_address">Sale Price: $'.$this->number_format( $temp_comp_array[$count]->attributes->salePrice ).'</p><p class="hv_address">Sale Date: '.date("m/d/Y",$temp_comp_array[$count]->attributes->saleDate).'</p></div>',$temp_comp_array[$count]->coordinates->latitude,$temp_comp_array[$count]->coordinates->longitude,($found_check+1));
     83                    $map_location_data[] = array('<div class="show_value"><p class="hv_address">' . $temp_comp_array[$count]->address->deliveryLine . '</p><p class="hv_address">Sale Price: $' . $this->number_format($temp_comp_array[$count]->attributes->salePrice) . '</p><p class="hv_address">Sale Date: ' . date("m/d/Y", $temp_comp_array[$count]->attributes->saleDate) . '</p></div>', $temp_comp_array[$count]->coordinates->latitude, $temp_comp_array[$count]->coordinates->longitude, ($found_check + 1));
    8284                    $comparables_text .= '';
    8385                    $found_check++;
    8486                    $comparables_looop_count++;
    85                     if( $comparables_looop_count >= 10 )
    86                     {
     87                    if ($comparables_looop_count >= 10) {
    8788                        break;
    8889                    }
     
    9596                    var map = new google.maps.Map(document.getElementById("home_value_map"), {
    9697                        zoom: 15,
    97                         center: {'.$map_location_center_data.'},
     98                        center: {' . $map_location_center_data . '},
    9899                        mapTypeId: google.maps.MapTypeId.ROADMAP
    99100                    });
     
    101102                }
    102103                function setMarkers(map) {
    103                     var locations = '.json_encode($map_location_data).';
     104                    var locations = ' . json_encode($map_location_data) . ';
    104105                    var image = {
    105106                        url: "https://maps.gstatic.com/mapfiles/ms2/micons/red-dot.png",
     
    129130                }
    130131                </script>';
    131             if( $found_check > 0)
    132             {
    133                 $text = str_replace( '[' . $prefix . '_data_comparables]', $comparables_text, $text );
     132            if ($found_check > 0) {
     133                $text = str_replace('[' . $prefix . '_data_comparables]', $comparables_text, $text);
     134            } else {
     135                $text = str_replace('[' . $prefix . '_data_comparables]', "", $text);
    134136            }
    135             else
    136             {
    137                 $text = str_replace( '[' . $prefix . '_data_comparables]', "", $text );
    138             }
    139         }
    140         else
    141         {
    142             $text = str_replace( '[' . $prefix . '_data_comparables]', "", $text );
     137        } else {
     138            $text = str_replace('[' . $prefix . '_data_comparables]', "", $text);
    143139        }
    144140        /*Custom Code End 2019/03/09*/
    145        
     141
    146142        return $text;
    147143    }
Note: See TracChangeset for help on using the changeset viewer.