Plugin Directory

Changeset 3154099


Ignore:
Timestamp:
09/18/2024 07:01:43 PM (17 months ago)
Author:
flexmls
Message:

Flexmls WordPress plugin 3.14.21

Location:
flexmls-idx/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • flexmls-idx/trunk/README.txt

    r3135793 r3154099  
    55Tested up to: 6.7
    66Requires PHP: 7.4
    7 Stable tag: 3.14.20
     7Stable tag: 3.14.21
    88
    99Add Flexmls® IDX listings, market statistics, IDX searches, and a contact form on your web site.
     
    8686
    8787== Changelog ==
     88= 3.14.21 =
     89Efficiency Update
     90* PHP Warnings and Deprecation Notifications Resolved
     91* Updated Block Categories for Gutenberg editor
     92* Listing Not Available page set to noindex and nofollow
     93* Subdivision is now a sticky value in the IDX Search widget
     94* Listing Agent IDX Display Requirement Resolved For V2 Listing Template
     95* Updated Plugin Pages To Use WP get_post Method
     96
    8897= 3.14.20 =
    8998Efficiency Update
  • flexmls-idx/trunk/SparkAPI/Core.php

    r3094799 r3154099  
    8888            'X-SparkApi-User-Agent' => 'flexmls-WordPress-Plugin/' . $this->plugin_version,
    8989            'X-WP-User-Agent'       => $this->user_agent,
    90             'X-WP-Client-IP'        => $this->user_ip
     90            'X-User-IP-Address'     => $this->user_ip
    9191        );
    9292    }
     
    811811        ksort( $params );
    812812        foreach ( $params as $key => $value ) {
     813            $value = ( !is_null($value) ) ? $value : '';
    813814            $security_string .= $key . $value;
    814815            $params[ $key ]   = rawurlencode( $value );
  • flexmls-idx/trunk/components/search.php

    r3059250 r3154099  
    5353
    5454    $all_location_fields = array('City', 'StateOrProvince', 'PostalCode', 'CountyOrParish', 'MLSAreaMajor',
    55       'MLSAreaMinor', 'StreetAddress', 'ListingId', 'Location');
     55      'MLSAreaMinor', 'StreetAddress', 'ListingId', 'Location', 'SubdivisionName');
    5656
    5757    $location_fields = array();
     
    6666    $property_type_enabled = (array_key_exists('property_type_enabled', $settings)) ? trim($settings['property_type_enabled']) : "on" ;
    6767    $property_type = isset($settings['property_type'])? trim($settings['property_type']) : null;
    68     $property_types_selected = explode(",", $property_type);
     68    $property_types_selected = explode(",", $property_type ?? '');
    6969    $std_fields = isset($settings['std_fields'])? trim($settings['std_fields']) : null;
    70     $std_fields_selected = explode(",", $std_fields);
     70    $std_fields_selected = explode(",", $std_fields ?? '');
    7171    $allow_sold_searching = isset($settings['allow_sold_searching']) ? $settings['allow_sold_searching'] : null;
    7272    $allow_pending_searching = array_key_exists('allow_pending_searching',$settings) ? $settings['allow_pending_searching'] : null;
  • flexmls-idx/trunk/components/v2/search.php

    r2926110 r3154099  
    6060
    6161        $all_location_fields = array('City', 'StateOrProvince', 'PostalCode', 'CountyOrParish', 'MLSAreaMajor',
    62             'MLSAreaMinor', 'StreetAddress', 'ListingId', 'Location');
     62            'MLSAreaMinor', 'StreetAddress', 'ListingId', 'Location', 'SubdivisionName');
    6363
    6464        $location_fields = array();
     
    7373        $property_type_enabled = (array_key_exists('property_type_enabled', $settings)) ? trim($settings['property_type_enabled']) : "on" ;
    7474        $property_type = isset($settings['property_type'])? trim($settings['property_type']) : null;
    75         $property_types_selected = explode(",", $property_type);
     75        $property_types_selected = explode(",", $property_type ?? '');
    7676        $std_fields = isset($settings['std_fields'])? trim($settings['std_fields']) : null;
    77         $std_fields_selected = explode(",", $std_fields);
     77        $std_fields_selected = explode(",", $std_fields ?? '');
    7878        $allow_sold_searching = isset($settings['allow_sold_searching']) ? $settings['allow_sold_searching'] : null;
    7979        $allow_pending_searching = array_key_exists('allow_pending_searching',$settings) ? $settings['allow_pending_searching'] : null;
  • flexmls-idx/trunk/flexmls_connect.php

    r3135793 r3154099  
    66Description: Provides Flexmls&reg; Customers with Flexmls&reg; IDX features on their WordPress websites. <strong>Tips:</strong> <a href="admin.php?page=fmc_admin_settings">Activate your Flexmls&reg; IDX plugin</a> on the settings page; <a href="widgets.php">add widgets to your sidebar</a> using the Widgets Admin under Appearance; and include widgets on your posts or pages using the Flexmls&reg; IDX Widget Short-Code Generator on the Visual page editor.
    77Author: FBS
    8 Version: 3.14.20
     8Version: 3.14.21
    99Author URI:  https://www.flexmls.com
    1010Requires at least: 5.0
     
    1717const FMC_API_BASE = 'sparkapi.com';
    1818const FMC_API_VERSION = 'v1';
    19 const FMC_PLUGIN_VERSION = '3.14.20';
     19const FMC_PLUGIN_VERSION = '3.14.21';
    2020
    2121define( 'FMC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
  • flexmls-idx/trunk/lib/base.php

    r3094799 r3154099  
    265265     */
    266266   
    267     $show_link = ( $query_url_parse['host'] == 'link.flexmls.com' ) ? $query_url : flexmlsConnect::get_default_idx_link_url();
     267    $show_link = ( isset($query_url_parse['host']) && $query_url_parse['host'] == 'link.flexmls.com' ) ? $query_url : flexmlsConnect::get_default_idx_link_url();
    268268
    269269    if(strpos($show_link, 'StreetAddress')){
     
    626626    }
    627627
    628     $content = get_page($neigh_template_page_id);
     628    $content = get_post($neigh_template_page_id);
    629629    return $content->post_content;
    630630
     
    727727  static function format_listing_street_address($data) {
    728728
    729     $listing = $data['StandardFields'];
     729    $listing = $data['StandardFields'] ?? [];
    730730    $first_line_address = (flexmlsConnect::is_not_blank_or_restricted($listing['UnparsedFirstLineAddress'])) ? $listing['UnparsedFirstLineAddress'] : "";
    731731    $second_line_address = "";
     
    873873    $AttributionContact = null;
    874874
    875     $GetListingOfficeInfo = $fmc_api->GetAccount($sf['ListOfficeId']);
    876     $GetListingAgentInfo = $fmc_api->GetAccount($sf['ListAgentId']);
    877 
    878     if ( flexmlsConnect::is_not_blank_or_restricted( $sf['AttributionContact'] ) ) {
     875    $GetListingOfficeInfo = $fmc_api->GetAccount($sf['ListOfficeId']) ?? '';
     876    $GetListingAgentInfo = $fmc_api->GetAccount($sf['ListAgentId']) ?? '';
     877
     878    if ( isset( $sf['AttributionContact'] ) && flexmlsConnect::is_not_blank_or_restricted( $sf['AttributionContact'] ) ) {
    879879      $AttributionContact = $sf['AttributionContact'];
    880880    }
    881     elseif ( flexmlsConnect::is_not_blank_or_restricted( $GetListingAgentInfo['AttributionContact'] ) ) {
     881    elseif ( isset( $sf['AttributionContact'] ) && flexmlsConnect::is_not_blank_or_restricted( $GetListingAgentInfo['AttributionContact'] ) ) {
    882882      $AttributionContact = $GetListingAgentInfo['AttributionContact'];
    883883    }
    884     elseif ( flexmlsConnect::is_not_blank_or_restricted( $GetListingOfficeInfo['AttributionContact'] ) ) {
     884    elseif ( isset( $sf['AttributionContact'] ) && flexmlsConnect::is_not_blank_or_restricted( $GetListingOfficeInfo['AttributionContact'] ) ) {
    885885      $AttributionContact = $GetListingOfficeInfo['AttributionContact'];
    886886    }
     
    939939
    940940    return (in_array("ListOfficeName",$compList));
     941  }
     942
     943  static function mls_requires_agent_name_in_search_results() {
     944    global $fmc_api;
     945    $api_system_info = $fmc_api->GetSystemInfo();
     946    $mlsId = $api_system_info["MlsId"];
     947    $compList = ($api_system_info["DisplayCompliance"][$mlsId]["View"]["Summary"]["DisplayCompliance"]);
     948 
     949    return (in_array("ListAgentName", $compList));
    941950  }
    942951
     
    13121321  }
    13131322
     1323  static public function is_portal_on()  {
     1324    global $fmc_api;
     1325
     1326    $portal = $fmc_api->GetPortal();
     1327
     1328    return (bool)$portal[0]['Enabled'];
     1329  }
     1330
    13141331  static function get_portal_slug() {
    13151332    global $fmc_api;
     
    13171334    $portal_slug = null;
    13181335    $portal = $fmc_api->GetPortal();
    1319 
    1320     if( sizeof($portal) > 0 && array_key_exists('DisplayName', $portal[0]) && !empty($portal[0]['DisplayName'])){
     1336    $portal_on = flexmlsConnect::is_portal_on();
     1337
     1338    if ( $portal_on ) {
    13211339      $portal_slug = $portal[0]['DisplayName'];
    13221340    } else {
  • flexmls-idx/trunk/lib/flexmlsAPI/Core.php

    r3135793 r3154099  
    4444        'Accept-Encoding' => "gzip,deflate",
    4545        'Content-Type' => "application/json",
    46         'User-Agent' => "FlexMLS WordPress Plugin/3.14.20",
    47         'X-SparkApi-User-Agent' => "flexmls-WordPress-Plugin/3.14.20"
     46        'User-Agent' => "FlexMLS WordPress Plugin/3.14.21",
     47        'X-SparkApi-User-Agent' => "flexmls-WordPress-Plugin/3.14.21"
    4848    );
    4949
  • flexmls-idx/trunk/lib/gutenberg.php

    r2564556 r3154099  
    103103        return;
    104104
    105     add_filter( 'block_categories', function( $categories, $post ) {
     105    add_filter( 'block_categories_all', function( $categories, $post ) {
    106106        return array_merge(
    107107            $categories,
  • flexmls-idx/trunk/pages/core.php

    r2984660 r3154099  
    3232        $this->standard_fields = $result[0] ?? '';
    3333
     34        $account_mls_id = $this->account->MlsId ?? '';
     35
    3436        //WP-1020 - ORE
    35         $sf_sqft_value = ($this->account->MlsId == "20191104230040909159000000") ? 'LivingArea' : 'BuildingAreaTotal';
     37        $sf_sqft_value = ($account_mls_id == "20191104230040909159000000") ? 'LivingArea' : 'BuildingAreaTotal';
    3638
    3739
     
    453455        $this->build_browse_list( flexmlsConnect::wp_input_get('pg') );
    454456
    455         if ($no_more == false) {
     457        if ( isset( $no_more ) && !$no_more) {
    456458            $this->build_browse_list( flexmlsConnect::wp_input_get('pg') + 1 );
    457459        }
     
    467469        }
    468470
    469         if ( array_key_exists((string) $this_listings_index-1, $this->browse_list) ) {
    470             $previous_listing_url = $this->browse_list[(string) $this_listings_index-1]['Uri'];
    471         }
    472         if ( array_key_exists((string) $this_listings_index+1, $this->browse_list) ) {
    473             $next_listing_url = $this->browse_list[(string) $this_listings_index+1]['Uri'];
     471        $this_listing_minus =  $this_listings_index - 1;
     472        $this_listing_add =  $this_listings_index + 1;
     473
     474        if ( array_key_exists( $this_listing_minus, $this->browse_list) ) {
     475            $previous_listing_url = $this->browse_list[$this_listing_minus]['Uri'];
     476        }
     477
     478        if ( array_key_exists($this_listing_add, $this->browse_list) ) {
     479            $next_listing_url = $this->browse_list[$this_listing_add]['Uri'];
    474480        }
    475481
     
    517523
    518524        $result_count = 0;
    519         foreach ($results as $record) {
    520             $result_count++;
    521 
    522             $this_result_overall_index = ($this->api->page_size * ($this->api->current_page - 1)) + $result_count;
    523 
    524             $link_to_details_criteria = $modified_raw_criteria;
    525             // figure out if there's a previous listing
    526             $link_to_details_criteria['p'] = ($this_result_overall_index != 1) ? 'y' : 'n';
    527 
    528             // figure out if there's a next listing possible
    529             $link_to_details_criteria['n'] = ( $this_result_overall_index < $this->api->last_count ) ? 'y' : 'n';
    530 
    531             if ($link_to_details_criteria['n'] == 'n') {
    532                 $this->no_more = true;
    533             }
    534 
    535             $this->browse_list[(string) $this_result_overall_index] = array(
    536                 'Index' => $this_result_overall_index,
    537                 'Id' => $record['Id'],
    538                 'ListingId' => $record['StandardFields']['ListingId'],
    539                 'Uri' => flexmlsConnect::make_nice_address_url($record, $link_to_details_criteria, $this->type)
    540             );
    541 
    542         }
    543 
    544     }
     525        if ( is_array($results) ) {
     526                foreach ($results as $record) {
     527                    $result_count++;
     528
     529                    $this_result_overall_index = ($this->api->page_size * ($this->api->current_page - 1)) + $result_count;
     530
     531                    $link_to_details_criteria = $modified_raw_criteria;
     532                    // figure out if there's a previous listing
     533                    $link_to_details_criteria['p'] = ($this_result_overall_index != 1) ? 'y' : 'n';
     534
     535                    // figure out if there's a next listing possible
     536                    $link_to_details_criteria['n'] = ( $this_result_overall_index < $this->api->last_count ) ? 'y' : 'n';
     537
     538                    if ($link_to_details_criteria['n'] == 'n') {
     539                        $this->no_more = true;
     540                    }
     541
     542                    $this->browse_list[(string) $this_result_overall_index] = array(
     543                        'Index' => $this_result_overall_index,
     544                        'Id' => $record['Id'],
     545                        'ListingId' => $record['StandardFields']['ListingId'],
     546                        'Uri' => flexmlsConnect::make_nice_address_url($record, $link_to_details_criteria, $this->type)
     547                    );
     548
     549                }
     550
     551            }
     552        }
    545553
    546554    function contact_form_agent_email($standard_fields) {
  • flexmls-idx/trunk/pages/listing-details.php

    r3135793 r3154099  
    1616    add_filter( 'wpseo_title', array( $this, 'wpseo_title' ), 0 );
    1717    add_filter( 'wpseo_canonical', array( $this, 'wpseo_canonical' ), 0 );
    18     add_filter( 'wp_robots', array($this, 'remove_wp_robots_closed_listing'), 0 );
     18    add_filter( 'wp_robots', array($this, 'wp_robots_noindex_listing'), 0 );
    1919
    2020    add_action('wp_head', array($this, 'open_graph_tags'), 0 );
     
    7070    else {
    7171      $page = flexmlsConnect::get_no_listings_page_number();
    72       $page_data = get_page($page);
     72      $page_data = get_post($page);
    7373      $fmc_special_page_caught['page-title'] = "Listing Not Available";
    7474      $fmc_special_page_caught['post-title'] = $page_data->post_title;
     
    9292      if (flexmlsConnect::get_no_listings_pref() == 'page'){
    9393        $page = flexmlsConnect::get_no_listings_page_number();
    94         $page_data = get_page($page);
     94        $page_data = get_post($page);
    9595        remove_filter('the_content', array('flexmlsConnectPage', 'custom_post_content'));
    9696        echo apply_filters('the_content', $page_data->post_content);
     
    702702  }
    703703?>
    704       <?php if ( flexmlsConnect::is_not_blank_or_restricted( $sf['CompensationDisclaimer'] ) ) : ?>
     704  <?php if ( array_key_exists( 'CompensationDisclaimer', $sf ) ) : ?>
     705    <?php if ( flexmlsConnect::is_not_blank_or_restricted( $sf['CompensationDisclaimer'] ) ) : ?>
    705706    <hr />
    706707    <div class="compensation-disclaimer">
     
    709710    <hr />
    710711    <?php endif; ?>
     712  <?php endif; ?>
    711713<?php
    712714      echo "<p>";
     
    755757  }
    756758
    757   function remove_wp_robots_closed_listing($robots) {
    758    
    759     $link_criteria_mls_status = $this->listing_data['StandardFields']['MlsStatus'];
     759  function wp_robots_noindex_listing($robots) {
     760
     761    $link_criteria_mls_status = $this->listing_data['StandardFields']['StandardStatus'] ?? '';
    760762   
    761763    if ( $link_criteria_mls_status == 'Closed' && get_option( 'blog_public' ) != 0 ) {
    762           $robots['noindex'] = true;
    763           $robots['nofollow'] = true;
     764      $robots['noindex'] = true;
     765      $robots['nofollow'] = true;
     766     
    764767      return $robots;
    765     }
    766768 
    767     return $robots;
    768  
    769   }
     769    } 
     770   
     771    elseif ( ! isset( $this->listing_data ) ) {
     772
     773      $robots['noindex'] = true;
     774      $robots['nofollow'] = true;
     775
     776      return $robots;
     777
     778  } else {
     779
     780      return $robots;
     781
     782  }
     783
     784}
    770785
    771786  /**
  • flexmls-idx/trunk/pages/next-listing.php

    r1106081 r3154099  
    11<?php
    22
     3#[AllowDynamicProperties]
    34class flexmlsConnectPageNextListing extends flexmlsConnectPageCore {
    45
  • flexmls-idx/trunk/pages/prev-listing.php

    r1106081 r3154099  
    11<?php
    22
     3#[AllowDynamicProperties]
    34class flexmlsConnectPagePrevListing extends flexmlsConnectPageCore {
    45
  • flexmls-idx/trunk/views/v2/fmcListingDetails.php

    r3135793 r3154099  
    3232                <h2 class="property-title flexmls-title-largest flexmls-primary-color-font flexmls-heading-font"><?php echo esc_html( $one_line_address ); ?></h2>
    3333
    34                 <?php if ( strtotime( $sf['OnMarketDate'] ) > strtotime( '-7 days' ) ) : ?>
    35                     <span class="new-listing-tag">New Listing</span>
     34                <?php if ( $sf['OnMarketDate'] ) : ?>
     35                    <?php if ( strtotime( $sf['OnMarketDate'] ) > strtotime( '-7 days' ) ) : ?>
     36                        <span class="new-listing-tag">New Listing</span>
     37                    <?php endif; ?>
    3638                <?php endif; ?>
    3739            </div>
     
    319321            <?php endforeach; ?>
    320322        <?php endif; ?>
    321 
    322         <?php if ( flexmlsConnect::is_not_blank_or_restricted( $sf['CompensationDisclaimer'] ) ) : ?>
    323         <hr />
    324         <div class="compensation-disclaimer">
    325             <?php echo $sf['CompensationDisclaimer']; ?>
    326         </div>
    327         <hr />
     323       
     324        <?php if ( array_key_exists( 'CompensationDisclaimer', $sf ) ) : ?>
     325            <?php if ( flexmlsConnect::is_not_blank_or_restricted( $sf['CompensationDisclaimer'] ) ) : ?>
     326            <hr />
     327            <div class="compensation-disclaimer">
     328            <?php echo $sf['CompensationDisclaimer']; ?>
     329            </div>
     330            <hr />
     331            <?php endif; ?>
    328332        <?php endif; ?>
    329333
  • flexmls-idx/trunk/views/v2/fmcSearchResults/_listings_list.php

    r3094799 r3154099  
    3333                <?php $main_photo = fmcSearchResults::main_photo_from_collection( $sf['Photos'] ); ?>
    3434                <div class="flexmls-image-wrapper" style="background-image: url('<?php echo esc_url( $main_photo['Uri640'] ); ?>');">
     35                <?php if ( $sf['OnMarketDate'] ) : ?>   
    3536                    <?php if ( strtotime( $sf['OnMarketDate'] ) > strtotime( '-7 days' ) ) : ?>
    3637                        <span class="new-listing-tag">New Listing</span>
     
    3940                        <span class="new-listing-tag open-house">Open House</span>
    4041                    <?php endif; ?>
     42                <?php endif; ?>
    4143                    <?php
    4244
     
    104106                        </span>
    105107                    <?php endif; ?>
     108
     109                    <?php if ( flexmlsConnect::mls_requires_agent_name_in_search_results() ) : ?>
     110                        <div class="flexmls-agent-name-and-label-wrapper">
     111                            <span class="flexmls-agent-name">
     112                                <span class="flexmls-bold-label">Listing Agent: </span>
     113                                <?php echo esc_html( $sf["ListAgentName"] ); ?>
     114                            </span>
     115                        </div>
     116                    <?php endif; ?>
     117                   
    106118                </div>
    107119            </a>
Note: See TracChangeset for help on using the changeset viewer.