Plugin Directory

Changeset 1785778


Ignore:
Timestamp:
12/12/2017 09:26:21 PM (8 years ago)
Author:
displetdev
Message:

More accurately determine the "date_last_updated" merge tag (based on when the related boards were last updated).

Location:
displetreader-wordpress-plugin/trunk/instance
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • displetreader-wordpress-plugin/trunk/instance/api/class-displet-rets-idx-residentials-api.php

    r1484175 r1785778  
    9393            }
    9494            $residentials = array(
     95                'disclaimers' => $this->_response->disclaimers,
    9596                'listings' => $listings,
    9697                'meta' => $this->_response->meta,
  • displetreader-wordpress-plugin/trunk/instance/class-displet-rets-idx-templates.php

    r1484175 r1785778  
    104104            'is_search_results_page' => false,
    105105            'is_shortcode' => false,
    106             'last_updated' => apply_filters( 'displetretsidx_disclaimer_date_last_updated', date( 'Y-m-d', strtotime( '-12 hours' ) ) ),
     106            'last_updated' => self::_get_last_updated( $args ),
    107107            'layout' => !empty( self::$_options['listings_layout'] ) ? self::$_options['listings_layout'] : 'default',
    108108            'num_listings' => !empty( self::$_options['listings_per_page'] ) ? intval( self::$_options['listings_per_page'] ) : 10,
     
    119119        ) );
    120120    }
     121
     122    private static function _get_last_updated( $args ) {
     123        $last_updated = 'Unknown';
     124
     125        if ( is_array( $args ) && is_array( $args['disclaimers'] ) && ! empty( $args['disclaimers'] ) ) {
     126            foreach ( $args['disclaimers'] as $disclaimer ) {
     127                $last_updated = strtotime( $disclaimer->board_updated_at ) > strtotime( $last_updated )
     128                    ? $disclaimer->board_updated_at
     129                    : $last_updated;
     130            }
     131        }
     132
     133        if ( strtotime( $last_updated ) ) {
     134            $last_updated = date( 'm/d/Y \a\t H:i:s T', strtotime( $last_updated ) );
     135        }
     136
     137        return apply_filters( 'displetretsidx_disclaimer_date_last_updated', $last_updated );
     138    }
    121139}
    122140
Note: See TracChangeset for help on using the changeset viewer.