WordPress.org

Plugin Directory

Changeset 1553150


Ignore:
Timestamp:
12/12/16 23:21:11 (2 months ago)
Author:
automattic
Message:

Update to version 1.0.12.

  • Bump test to version to 4.7.
  • Fix iframe heights.
  • Add full uploaded logo to event object.
  • Improve page template handling.
Location:
eventbrite-api/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • eventbrite-api/trunk/inc/class-eventbrite-manager.php

    r1261156 r1553150  
    360360        $event['url']           = ( isset( $api_event->url ) )               ? $api_event->url               : ''; 
    361361        $event['logo_url']      = ( isset( $api_event->logo->url ) )         ? $api_event->logo->url         : ''; 
     362        $event['logo']          = ( isset( $api_event->logo ) )              ? $api_event->logo              : ''; 
    362363        $event['start']         = ( isset( $api_event->start ) )             ? $api_event->start             : ''; 
    363364        $event['end']           = ( isset( $api_event->end ) )               ? $api_event->end               : ''; 
  • eventbrite-api/trunk/inc/class-eventbrite-templates.php

    r1216555 r1553150  
    1616        add_filter( 'query_vars', array( $this, 'add_query_vars' ) ); 
    1717        add_filter( 'rewrite_rules_array', array( $this, 'add_rewrite_rules' ) ); 
    18         add_filter( 'page_attributes_dropdown_pages_args', array( $this, 'inject_page_template' ) ); 
    19         add_filter( 'wp_insert_post_data', array( $this, 'inject_page_template' ) ); 
     18        add_filter( 'theme_page_templates', array( $this, 'inject_page_template' ), 10, 3 ); 
    2019        add_action( 'template_include', array( $this, 'check_templates' ) ); 
    2120        add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); 
     
    8382 
    8483    /** 
    85      * Force our way into the theme's cache of page template listings. Gah. 
    86      * Based on code by Harri Bell-Thomas: https://github.com/wpexplorer/page-templater 
    87      * 
    88      * @access public 
    89      * 
    90      * @param  array $params List of available page templates, or data being saved via wp_insert_post_data. 
    91      * @return array $params Same as input. The hook is just used to manipulate the page template cache. 
    92      */ 
    93     public function inject_page_template( $params ) { 
    94         // Create the key used for the themes cache 
    95         $cache_key = 'page_templates-' . md5( trailingslashit( get_theme_root() ) . get_stylesheet() ); 
    96  
    97         // Retrieve the cache listing. Prepare an empty array if it's empty. 
    98         $templates = wp_get_theme()->get_page_templates(); 
    99         if ( empty( $templates ) ) { 
    100                 $templates = array(); 
    101         } 
    102  
    103         // Remove the original cache. 
    104         wp_cache_delete( $cache_key , 'themes'); 
    105  
    106         // Add our template to any existing templates. 
    107         $templates['eventbrite-index.php'] = 'Eventbrite Events'; 
    108  
    109         // Update the cache that includes our template. 
    110         wp_cache_add( $cache_key, $templates, 'themes', 1800 ); 
    111  
    112         return $params; 
     84     * Make the Eventbrite Events page template available to the templates dropdown. 
     85     * 
     86     * @access public 
     87     * 
     88     * @param  array $templates The theme's registered page templates. 
     89     * @return array $templates Page templates with the Eventbrite index template added. 
     90     */ 
     91    public function inject_page_template( $templates ) { 
     92        $templates['eventbrite-index.php'] = __( 'Eventbrite Events', 'eventbrite-api' ); 
     93        return $templates; 
    11394    } 
    11495 
  • eventbrite-api/trunk/inc/functions.php

    r1427030 r1553150  
    426426 */ 
    427427function eventbrite_get_ticket_form_widget_height() { 
    428     // Set the minimum height (essentially iframe chrome). 
    429     $height = 56; 
     428    $sales_open = false; 
     429 
     430    // Set the starting height: includes the header (50), dates/sales (39+23), and call-to-action (75). 
     431    $height = 190; 
    430432 
    431433    // Get tickets for the current event. 
    432434    $tickets = get_post()->tickets; 
    433435 
    434     // Move along if the event has no ticket information. 
    435     if ( ! $tickets ) { 
    436         return $height + 45; 
    437     } 
    438  
    439     // Add height for various ticket table elements. 
    440     $height += 123; 
    441  
    442     // Check each ticket. 
    443     foreach ( $tickets as $ticket ) { 
    444         // Add height for each visible ticket type. 
    445         if ( ! isset( $ticket->hidden ) || true != $ticket->hidden ) { 
    446             $height += 45; 
     436    if ( is_array( $tickets ) ) { 
     437        $tickets_height = 0; 
     438        $sales_end = array(); 
     439 
     440        foreach ( $tickets as $ticket ) { 
     441            // Add height for each ticket type. 
     442            $tickets_height += 85; 
     443            // Note if any ticket types are still available. 
     444            if ( 'AVAILABLE' === $ticket->on_sale_status ) { 
     445                $sales_open = true; 
     446                $sales_end[] = $ticket->sales_end; 
     447            } 
    447448        } 
    448449 
    449         // Check if any visible sales are still open. 
    450         if ( ( ! isset( $ticket->sales_end ) || time() < mysql2date( 'U', $ticket->sales_end ) ) && ( ! isset( $ticket->hidden ) || true != $ticket->hidden ) ) { 
    451             $sales_open = true; 
     450        // Adjust for no active ticket sales. 
     451        if ( ! $sales_open ) { 
     452            // Remove Sales End date. 
     453            $height -= 22; 
     454            // Add Sales Ended graphic. 
     455            $height += 190; 
     456            // Remove call-to-action section. 
     457            $height -= 75; 
     458        } else { 
     459            // At least one ticket type is available, so add the ticket heights (accounting for same sales end times or not). 
     460            $sales_end = array_unique( $sales_end ); 
     461            if ( 2 <= count( $sales_end ) ) { 
     462                $tickets_height += count( $tickets ) * 18; 
     463                $height -= 23; 
     464            } 
     465            $height += $tickets_height; 
    452466        } 
    453     } 
    454  
    455     // Remove call-to-action spacing if no tickets are still on sale. 
    456     if ( ! isset( $sales_open ) ) { 
    457         $height -= 74; 
     467    } else { 
     468        // No ticket info to go by, we'll return a safe assumption of two ticket types with the same sales end time. 
     469        $height += ( 2 * 85 ); 
    458470    } 
    459471 
  • eventbrite-api/trunk/readme.txt

    r1478868 r1553150  
    22Contributors: jkudish, kwight 
    33Tags: eventbrite, events, api, WordPress.com 
    4 Requires at least: 3.8 
    5 Tested up to: 4.6 
    6 Stable tag: 1.0.11 
     4Requires at least: 4.4 
     5Tested up to: 4.7 
     6Stable tag: 1.0.12 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    8787== Changelog == 
    8888 
     89= 1.0.12 - December 12, 2016 = 
     90* Fix display of Eventbrite ticket iframes. 
     91* Improve page template handling. 
     92* Make the full uploaded logo available in the event object. 
     93 
    8994= 1.0.11 - May 30, 2016 = 
    9095* Support the `status` parameter in Eventbrite_Query when displaying private events. 
    9196* Have date formats reflect the admin settings. 
    92 * Improve the URL format to avoid ocaccional issues with the Eventbrite API. 
     97* Improve the URL format to avoid occasional issues with the Eventbrite API. 
    9398 
    9499= 1.0.10 - October 7, 2015 = 
Note: See TracChangeset for help on using the changeset viewer.