WordPress.org

Plugin Directory

Changeset 1817238


Ignore:
Timestamp:
02/07/18 11:11:11 (13 days ago)
Author:
slimndap
Message:

0.15.30

Location:
theatre/tags/0.15
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • theatre/tags/0.15/functions/event/class-theater-event-order.php

    r1591061 r1817238  
    3737        add_action( 'updated_post_meta', array( __CLASS__, 'update_order_index_when_event_date_is_updated' ), 20 ,4 ); 
    3838        add_action( 'added_post_meta', array( __CLASS__, 'update_order_index_when_event_date_is_updated' ), 20 ,4 ); 
     39        add_action( 'deleted_post_meta', array( __CLASS__, 'update_order_index_when_event_date_is_unlinked' ), 20, 4 ); 
    3940        add_filter( 'pre_get_posts', array( __CLASS__, 'sort_events' ) ); 
    4041        add_action( 'wpt_cron', array( __CLASS__, 'update_order_indexes' ) ); 
     
    141142 
    142143    /** 
     144     * Gets the timestamp of the last successful update of the order indexes. 
     145     *  
     146     * @since   0.15.30 
     147     * @return  int     The timestamp of the last successful update of the order indexes. 
     148     */ 
     149    static function get_last_succesful_update_order_indexes_timestamp() { 
     150        $last_succesful_update_order_indexes_timestamp = get_option( 'theater_last_succesful_update_order_indexes_timestamp', -1 ); 
     151        return $last_succesful_update_order_indexes_timestamp; 
     152    } 
     153 
     154    /** 
    143155     * Sets the order index of events and events dates. 
    144156     * 
     
    182194     * @since   0.15.15 Use THEATER_ORDER_INDEX_KEY for meta key. 
    183195     * @since   0.15.16 No longer sort queries that also query non-event post types. 
     196     * @since   0.15.30 Set 'orderby' to 'meta_value_num'. Fixes #265. 
    184197     * 
    185198     * @uses    Theater_Event_Order::get_event_post_types() to get the post types for events and event dates. 
     
    212225 
    213226        $query->set( 'meta_key',THEATER_ORDER_INDEX_KEY ); 
    214         $query->set( 'orderby','meta_value' ); 
     227        $query->set( 'orderby','meta_value_num' ); 
     228    } 
     229 
     230    /** 
     231     * Updates the order index of an event whenever one of it's event dates is unlinked from it. 
     232     * 
     233     * Eg. when an event date is deleted. 
     234     *  
     235     * @since   0.15.30 
     236     * @uses    Theater_Event_Order::set_order_index() to set the order index of events. 
     237     * @param   int     $meta_id    ID of updated metadata entry. 
     238     * @param   int     $object_id  Object ID. 
     239     * @param   string  $meta_key   Meta key. 
     240     * @param   mixed   $meta_value Meta value. 
     241     * @return  void 
     242     */ 
     243    static function update_order_index_when_event_date_is_unlinked( $meta_id, $object_id, $meta_key, $meta_value ) { 
     244         
     245        if ( WPT_Event::post_type_name != get_post_type( $object_id ) ) { 
     246            return; 
     247        } 
     248         
     249        if ( WPT_Production::post_type_name != $meta_key ) {             
     250            return; 
     251        } 
     252         
     253        self::set_order_index( $meta_value );    
     254                 
    215255    } 
    216256 
     
    247287     * @since   0.6.2 
    248288     * @since   0.15.13 No longer updates the order index of non-event post types. 
     289     *          0.15.30 Only update the order index of events that expire after the last time that the update ran. 
     290     *                  'pre_get_posts'-hook is now re-activated before Theater_Event_Order::set_order_index() is called. 
     291     *                  Fixes #269. 
    249292     * 
    250293     * @uses    Theater_Event_Order::get_event_post_types() to get the post types for events and event dates. 
    251294     * @uses    Theater_Event_Order::set_order_index() to set the order index for events and event dates. 
     295     * @uses    Theater_Event_Order::get_last_succesful_update_order_indexes_timestamp() to get the timestamp of  
     296     *          the last successful update of the order indexes. 
    252297     * 
    253298     */ 
     
    263308            'post_status' => 'any', 
    264309            'nopaging' => true, 
     310            'meta_query' => array( 
     311                array( 
     312                     
     313                    'key' => THEATER_ORDER_INDEX_KEY, 
     314                    'value' => self::get_last_succesful_update_order_indexes_timestamp(), 
     315                    'compare' => '>=', 
     316                ), 
     317            ), 
    265318        ); 
    266319        $posts = get_posts( $args ); 
    267  
    268         foreach ( $posts as $post ) { 
    269             self::set_order_index( $post->ID ); 
    270         } 
    271320 
    272321        /** 
     
    274323         */ 
    275324        add_filter( 'pre_get_posts', array( __CLASS__, 'sort_events' ) ); 
     325 
     326        foreach ( $posts as $post ) { 
     327            self::set_order_index( $post->ID ); 
     328        } 
     329 
     330        // Update was successfull, update the timestamp. 
     331        update_option( 'theater_last_succesful_update_order_indexes_timestamp', time() ); 
     332 
    276333    } 
    277334 
  • theatre/tags/0.15/functions/template/wpt_template_placeholder_filter.php

    r1497660 r1817238  
    101101     * @since   0.12.1 
    102102     * @since   0.15.11.1   Added support for next day start time offset. 
     103     * @since   0.15.30     Don't use next day start time offset to determine time. 
     104     *                      Fixes #266. 
    103105     * @uses    Theater_Helpers_Time::get_next_day_start_time_offset() to get the next day start time offset. 
    104106     * 
     
    111113    protected function callback_date($content, $object, $format = '') { 
    112114        if ( ! empty($format) ) { 
     115             
    113116            if ( is_numeric( $content ) ) { 
    114117                $timestamp = $content; 
     
    116119                $timestamp = strtotime( $content ); 
    117120            } 
     121             
     122            /** 
     123             * Use next day start time offset to determine day. 
     124             */ 
     125            $day = date(  
     126                'Y-m-d',  
     127                $timestamp + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS - Theater_Helpers_Time::get_next_day_start_time_offset() 
     128            ); 
     129             
     130            /** 
     131             * Don't use next day start time offset to determine time. 
     132             */ 
     133            $time = date( 'H:i:s', $timestamp + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ); 
     134             
    118135            $content = date_i18n( 
    119136                $format, 
    120                 $timestamp + get_option( 'gmt_offset' ) * HOUR_IN_SECONDS - Theater_Helpers_Time::get_next_day_start_time_offset() 
    121             ); 
     137                strtotime( $day.' '.$time ) 
     138            ); 
     139             
    122140        } 
    123141        return $content; 
  • theatre/tags/0.15/readme.txt

    r1731634 r1817238  
    146146    * Added a new `{{tags}}` placeholder for events (0.15.27). See the updated [docs](https://github.com/slimndap/wp-theatre/wiki/Shortcodes). Thank you [Raymond van Melzen](https://www.vanmelzen.com/)! 
    147147    * Internal changes to further improve performance of importers (0.15.27). 
    148     * Added CSS classes to the event editor to make it easier for developer to customize (0.15.29). Thank you [joost de keijzer](https://dekeijzer.org/)! 
     148    * Added CSS classes to the event editor to make it easier for developer to customise (0.15.29). Thank you [joost de keijzer](https://dekeijzer.org/)! 
     149    * Performance improvements when ordering events on websites with _a lot_ of events (0.15.30). 
    149150 
    150151* Bugfix 
     
    167168    * Fixed a conflict with WP-CLI. (0.15.24). 
    168169    * Fixed an [issue](https://github.com/slimndap/wp-theatre/pull/242) with the fallback of custom field values of events. Thank you [joost de keijzer](https://dekeijzer.org/)! 
     170    * Fixed an [issue](https://github.com/slimndap/wp-theatre/issues/269) where sometimes events are shown in the wrong order. 
    169171     
    170172     
     
    250252== Upgrade Notice == 
    251253 
     254= 0.15.30 = 
     255Fixed an issue where sometimes events are shown in the wrong order. 
     256 
    252257= 0.15.29 = 
    253258Made it easier for developers to customize the event editor. 
  • theatre/tags/0.15/theater.php

    r1731634 r1817238  
    66    Description: Turn your Wordpress website into a theater website. 
    77    Author: Jeroen Schmit 
    8     Version: 0.15.29 
     8    Version: 0.15.30 
    99    Author URI: http://slimndap.com/ 
    1010    Text Domain: theatre 
     
    2929if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly 
    3030     
    31 $wpt_version = '0.15.29'; 
     31$wpt_version = '0.15.30'; 
    3232 
    3333class WP_Theatre { 
Note: See TracChangeset for help on using the changeset viewer.