WordPress.org

Plugin Directory

Changeset 594685


Ignore:
Timestamp:
09/05/12 00:44:08 (20 months ago)
Author:
batmoo
Message:

Sync 1.1 from github:

  • Backwards compatibility for 3.4
  • Support for non-pretty permalinks
  • Support for permalinks without trailing slashes
  • Fix preview tab
Location:
liveblog/trunk
Files:
4 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • liveblog/trunk/classes/class-wpcom-liveblog-entry-query.php

    r593247 r594685  
    99class WPCOM_Liveblog_Entry_Query { 
    1010 
     11    var $legacy_mode = false; // should we include backwards compat for 3.4? 
     12 
    1113    /** 
    1214     * Set the post ID and key when a new object is created 
     
    1820        $this->post_id = $post_id; 
    1921        $this->key     = $key; 
     22 
     23        // Backwards-compat for 3.4 
     24        if ( ! function_exists( 'get_edit_user_link' ) ) { 
     25            $this->legacy_mode = true; 
     26            add_filter( 'comments_clauses', array( $this, '_comments_clauses' ) ); 
     27        } 
    2028    } 
    2129 
     
    3240            'order'   => 'DESC', 
    3341            'type'    => $this->key, 
    34             'comment_approved' => $this->key, 
    3542        ); 
     43 
     44        // 3.4 compat 
     45        if ( ! $this->legacy_mode ) { 
     46            $defaults['comment_approved'] = $this->key; 
     47        } else { 
     48            $defaults['status'] = $this->key; // just used to make the cache key more unique to avoid pollution 
     49        } 
     50 
    3651        $args     = wp_parse_args( $args, $defaults ); 
    3752        $comments = get_comments( $args ); 
     53 
    3854        return self::entries_from_comments( $comments ); 
    3955    } 
     
    164180        return $result; 
    165181    } 
     182 
     183    /** 
     184     * Filter the comments query to include the special comment_approved status. 
     185     * Required for backwards-compatibility with 3.4.x 
     186     * 
     187     * @param array $clauses 
     188     * @return array 
     189     */ 
     190    public function _comments_clauses( $clauses = array() ) { 
     191        global $wpdb; 
     192 
     193        // Setup the search clauses 
     194        $needle   = $wpdb->prepare( "comment_type = %s", $this->key ); 
     195        $haystack = !empty( $clauses['where'] ) ? $clauses['where'] : ''; 
     196 
     197        // Bail if not a liveblog query 
     198        if ( ! strstr( $haystack, $needle ) ) 
     199            return $clauses; 
     200 
     201        $clauses['where'] = $wpdb->prepare( "comment_approved = %s AND comment_post_ID = %d AND comment_type = %s", $this->key, $this->post_id, $this->key ); 
     202 
     203        return $clauses; 
     204    } 
    166205} 
  • liveblog/trunk/js/liveblog-publisher.js

    r593247 r594685  
    2727 
    2828    liveblog.publisher.preview_select = function( e, ui ) { 
    29         if (1 != ui.index) { 
     29        if (2 != ui.index) { 
    3030            return; 
    3131        } 
     
    3333        var entry_content = liveblog.publisher.$entry_text.val(); 
    3434        if ( !entry_content ) { 
    35             return false; 
     35            return; 
    3636        } 
    3737 
     
    4444        liveblog.publisher.disable_posting_interface(); 
    4545        liveblog.publisher.$preview.html('Loading preview…'); 
    46         liveblog.ajax_request( liveblog_settings.endpoint_url + '/preview', data, liveblog.publisher.preview_entry_success, liveblog.publisher.preview_entry_error, 'POST' ); 
     46        liveblog.ajax_request( liveblog_settings.endpoint_url + 'preview', data, liveblog.publisher.preview_entry_success, liveblog.publisher.preview_entry_error, 'POST' ); 
    4747    }; 
    4848 
     
    8686        liveblog.publisher.disable_posting_interface(); 
    8787        liveblog.publisher.show_spinner(); 
    88         liveblog.ajax_request( liveblog_settings.endpoint_url + '/insert', data, liveblog.publisher.insert_entry_success, liveblog.publisher.insert_entry_error, 'POST' ); 
     88        liveblog.ajax_request( liveblog_settings.endpoint_url + 'insert', data, liveblog.publisher.insert_entry_success, liveblog.publisher.insert_entry_error, 'POST' ); 
    8989    }; 
    9090 
     
    114114        liveblog.publisher.disable_posting_interface(); 
    115115        liveblog.publisher.show_spinner(); 
    116         liveblog.ajax_request( liveblog_settings.endpoint_url + '/insert', data, liveblog.publisher.insert_entry_success, liveblog.publisher.insert_entry_error, 'POST' ); 
     116        liveblog.ajax_request( liveblog_settings.endpoint_url + 'insert', data, liveblog.publisher.insert_entry_success, liveblog.publisher.insert_entry_error, 'POST' ); 
    117117    }; 
    118118 
  • liveblog/trunk/js/liveblog.js

    r593247 r594685  
    6363        var to         = liveblog.latest_response_server_timestamp + local_diff; 
    6464 
    65         url += '/' + from + '/' + to + '/'; 
     65        url += from + '/' + to + '/'; 
    6666        liveblog.show_spinner(); 
    6767        liveblog.ajax_request( url, {}, liveblog.get_recent_entries_success, liveblog.get_recent_entries_error ); 
  • liveblog/trunk/liveblog.php

    r594319 r594685  
    55 * Plugin URI: http://wordpress.org/extend/plugins/liveblog/ 
    66 * Description: Blogging: at the speed of live. 
    7  * Version:     1.0 
     7 * Version:     1.1 
    88 * Author:      WordPress.com VIP, Automattic 
    99 * Author URI: http://vip.wordpress.com/ 
     
    3535    /** Constants *************************************************************/ 
    3636 
    37     const version          = '1.0'; 
     37    const version          = '1.1'; 
    3838    const rewrites_version = 1; 
    3939    const key              = 'liveblog'; 
     
    319319 
    320320        // Look for timestamps and bail if none 
    321         $stamps = get_query_var( self::url_endpoint ); 
     321        $stamps = rtrim( get_query_var( self::url_endpoint ), '/' ); 
    322322        if ( empty( $stamps ) ) 
    323323            return array( false, false ); 
     
    531531     */ 
    532532    private static function get_entries_endpoint_url() { 
    533         return get_permalink( self::$post_id ) . self::url_endpoint; 
     533        if ( get_option( 'permalink_structure' ) ) 
     534            $url = trailingslashit( trailingslashit( get_permalink( self::$post_id ) ) . self::url_endpoint ); // returns something like /2012/01/01/post/liveblog/ 
     535        else 
     536            $url = add_query_arg( self::url_endpoint, '', get_permalink( self::$post_id ) ) . '='; // returns something like ?p=1&liveblog= 
     537 
     538        return $url; 
    534539    } 
    535540 
  • liveblog/trunk/readme.txt

    r594574 r594685  
    22Contributors: automattic, nbachiyski, batmoo, johnjamesjacoby 
    33Tags: liveblog 
    4 Requires at least: 3.5 
     4Requires at least: 3.4.1 
    55Tested up to: 3.5 
    6 Stable tag: 1.0 
     6Stable tag: 1.1 
    77License: GPLv2 or later 
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html 
     
    4646== Changelog == 
    4747 
     48= 1.1 = 
     49* Backwards compatibility for 3.4 
     50* Support for non-pretty permalinks 
     51* Support for permalinks without trailing slashes 
     52* Fix preview tab 
     53 
    4854= 1.0 = 
    4955* Initial release 
Note: See TracChangeset for help on using the changeset viewer.