Plugin Directory

Changeset 1132375


Ignore:
Timestamp:
04/10/2015 09:30:10 PM (11 years ago)
Author:
sutherlandboswell
Message:

Support for TED with foreign languages

Location:
video-thumbnails
Files:
7 deleted
3 edited
37 copied

Legend:

Unmodified
Added
Removed
  • video-thumbnails/tags/2.12.1/php/providers/class-ted-thumbnails.php

    r1072062 r1132375  
    3636    // Regex strings
    3737    public $regexes = array(
    38         '#//embed(?:\-ssl)?\.ted\.com/talks/([A-Za-z0-9_-]+)\.html#', // iFrame SRC
     38        '#//embed(?:\-ssl)?\.ted\.com/talks/(?:lang/[A-Za-z_-]+/)?([A-Za-z0-9_-]+)\.html#', // iFrame SRC
    3939    );
    4040
     
    5757            array(
    5858                'markup'        => '<iframe src="http://embed.ted.com/talks/kitra_cahana_stories_of_the_homeless_and_hidden.html" width="640" height="360" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
    59                 'expected'      => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg',
     59                'expected'      => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg?lang=en',
    6060                'expected_hash' => 'f2a5f6af49e841b4f9c7b95d6ca0372a',
    6161                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     62            ),
     63            array(
     64                'markup'        => '<iframe src="https://embed-ssl.ted.com/talks/lang/fr-ca/shimpei_takahashi_play_this_game_to_come_up_with_original_ideas.html" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen"></iframe>',
     65                'expected'      => 'http://images.ted.com/images/ted/b1f1183311cda4df9e1b65f2b363e0b806bff914_480x360.jpg?lang=en',
     66                'expected_hash' => 'ff47c99c9eb95e3d6c4b986b18991f22',
     67                'name'          => __( 'Custom Language', 'video-thumbnails' )
    6268            ),
    6369        );
  • video-thumbnails/tags/2.12.1/readme.txt

    r1076402 r1132375  
    55Requires at least: 3.2
    66Tested up to: 4.1
    7 Stable tag: 2.12
     7Stable tag: 2.12.1
    88
    99Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
     
    133133
    134134== Changelog ==
     135
     136= 2.12.1 =
     137* Support for TED when using foreign languages
    135138
    136139= 2.12 =
  • video-thumbnails/tags/2.12.1/video-thumbnails.php

    r1076402 r1132375  
    66Author: Sutherland Boswell
    77Author URI: http://sutherlandboswell.com
    8 Version: 2.12
     8Version: 2.12.1
    99License: GPL2
    1010Text Domain: video-thumbnails
     
    3131define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
    3232define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
    33 define( 'VIDEO_THUMBNAILS_VERSION', '2.12' );
     33define( 'VIDEO_THUMBNAILS_VERSION', '2.12.1' );
    3434
    3535// Providers
     
    104104    }
    105105
     106    /**
     107     * Enqueues necessary admin scripts
     108     * @param  string $hook A hook for the current admin page
     109     */
    106110    function admin_scripts( $hook ) {
    107111        // Bulk tool page
     
    128132    }
    129133
    130     // Initialize meta box on edit page
     134    /**
     135     * Initialize meta box on edit page
     136     */
    131137    function meta_box_init() {
    132138        if ( is_array( $this->settings->options['post_types'] ) ) {
     
    137143    }
    138144
    139     // Construct the meta box
     145    /**
     146     * Renders the video thumbnail meta box
     147     */
    140148    function meta_box() {
    141149        global $post;
     
    244252    }
    245253
    246     // The main event
     254    /**
     255     * Finds the video thumbnail for a post, saves/sets as featured image if enabled, saves image URL to custom field and then returns the URL
     256     * @param  int   $post_id An optional post ID (can be left blank in a loop)
     257     * @return mixed          A string with an image URL if successful or null if there is no video thumbnail
     258     */
    247259    function get_video_thumbnail( $post_id = null ) {
    248260
     
    341353    }
    342354
    343     // Saves to media library
     355    /**
     356     * Saves a remote image to the media library
     357     * @param  string $image_url URL of the image to save
     358     * @param  int    $post_id   ID of the post to attach image to
     359     * @return int               ID of the attachment
     360     */
    344361    public static function save_to_media_library( $image_url, $post_id ) {
    345362
     
    419436        return $attach_id;
    420437
    421     } // End of save to media library function
    422 
    423     // Post editor Ajax reset script
     438    }
     439
     440    /**
     441     * Ajax reset script for post editor
     442     */
    424443    function ajax_reset_script() {
    425444        echo '<!-- Video Thumbnails Ajax Search -->' . PHP_EOL;
     
    438457    }
    439458
    440     // Ajax reset callback
     459    /**
     460     * Ajax callback for resetting a video thumbnail in the post editor
     461     */
    441462    function ajax_reset_callback() {
    442463        global $wpdb; // this is how you get access to the database
     
    459480    }
    460481
     482    /**
     483     * Ajax callback used to get all the post IDs to be scanned in bulk
     484     */
    461485    function bulk_posts_query_callback() {
    462486        // Some default args
     
    477501    }
    478502
     503    /**
     504     * Ajax callback used to get the video thumbnail for an individual post in the process of running the bulk tool
     505     */
    479506    function get_thumbnail_for_post_callback() {
    480507
     
    505532    }
    506533
     534    /**
     535     * A function that renders the bulk scanning page
     536     */
    507537    function bulk_scanning_page() {
    508538
  • video-thumbnails/trunk/php/providers/class-ted-thumbnails.php

    r1072062 r1132375  
    3636    // Regex strings
    3737    public $regexes = array(
    38         '#//embed(?:\-ssl)?\.ted\.com/talks/([A-Za-z0-9_-]+)\.html#', // iFrame SRC
     38        '#//embed(?:\-ssl)?\.ted\.com/talks/(?:lang/[A-Za-z_-]+/)?([A-Za-z0-9_-]+)\.html#', // iFrame SRC
    3939    );
    4040
     
    5757            array(
    5858                'markup'        => '<iframe src="http://embed.ted.com/talks/kitra_cahana_stories_of_the_homeless_and_hidden.html" width="640" height="360" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
    59                 'expected'      => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg',
     59                'expected'      => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg?lang=en',
    6060                'expected_hash' => 'f2a5f6af49e841b4f9c7b95d6ca0372a',
    6161                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     62            ),
     63            array(
     64                'markup'        => '<iframe src="https://embed-ssl.ted.com/talks/lang/fr-ca/shimpei_takahashi_play_this_game_to_come_up_with_original_ideas.html" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen"></iframe>',
     65                'expected'      => 'http://images.ted.com/images/ted/b1f1183311cda4df9e1b65f2b363e0b806bff914_480x360.jpg?lang=en',
     66                'expected_hash' => 'ff47c99c9eb95e3d6c4b986b18991f22',
     67                'name'          => __( 'Custom Language', 'video-thumbnails' )
    6268            ),
    6369        );
  • video-thumbnails/trunk/readme.txt

    r1076402 r1132375  
    55Requires at least: 3.2
    66Tested up to: 4.1
    7 Stable tag: 2.12
     7Stable tag: 2.12.1
    88
    99Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
     
    133133
    134134== Changelog ==
     135
     136= 2.12.1 =
     137* Support for TED when using foreign languages
    135138
    136139= 2.12 =
  • video-thumbnails/trunk/video-thumbnails.php

    r1076402 r1132375  
    66Author: Sutherland Boswell
    77Author URI: http://sutherlandboswell.com
    8 Version: 2.12
     8Version: 2.12.1
    99License: GPL2
    1010Text Domain: video-thumbnails
     
    3131define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
    3232define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
    33 define( 'VIDEO_THUMBNAILS_VERSION', '2.12' );
     33define( 'VIDEO_THUMBNAILS_VERSION', '2.12.1' );
    3434
    3535// Providers
     
    104104    }
    105105
     106    /**
     107     * Enqueues necessary admin scripts
     108     * @param  string $hook A hook for the current admin page
     109     */
    106110    function admin_scripts( $hook ) {
    107111        // Bulk tool page
     
    128132    }
    129133
    130     // Initialize meta box on edit page
     134    /**
     135     * Initialize meta box on edit page
     136     */
    131137    function meta_box_init() {
    132138        if ( is_array( $this->settings->options['post_types'] ) ) {
     
    137143    }
    138144
    139     // Construct the meta box
     145    /**
     146     * Renders the video thumbnail meta box
     147     */
    140148    function meta_box() {
    141149        global $post;
     
    244252    }
    245253
    246     // The main event
     254    /**
     255     * Finds the video thumbnail for a post, saves/sets as featured image if enabled, saves image URL to custom field and then returns the URL
     256     * @param  int   $post_id An optional post ID (can be left blank in a loop)
     257     * @return mixed          A string with an image URL if successful or null if there is no video thumbnail
     258     */
    247259    function get_video_thumbnail( $post_id = null ) {
    248260
     
    341353    }
    342354
    343     // Saves to media library
     355    /**
     356     * Saves a remote image to the media library
     357     * @param  string $image_url URL of the image to save
     358     * @param  int    $post_id   ID of the post to attach image to
     359     * @return int               ID of the attachment
     360     */
    344361    public static function save_to_media_library( $image_url, $post_id ) {
    345362
     
    419436        return $attach_id;
    420437
    421     } // End of save to media library function
    422 
    423     // Post editor Ajax reset script
     438    }
     439
     440    /**
     441     * Ajax reset script for post editor
     442     */
    424443    function ajax_reset_script() {
    425444        echo '<!-- Video Thumbnails Ajax Search -->' . PHP_EOL;
     
    438457    }
    439458
    440     // Ajax reset callback
     459    /**
     460     * Ajax callback for resetting a video thumbnail in the post editor
     461     */
    441462    function ajax_reset_callback() {
    442463        global $wpdb; // this is how you get access to the database
     
    459480    }
    460481
     482    /**
     483     * Ajax callback used to get all the post IDs to be scanned in bulk
     484     */
    461485    function bulk_posts_query_callback() {
    462486        // Some default args
     
    477501    }
    478502
     503    /**
     504     * Ajax callback used to get the video thumbnail for an individual post in the process of running the bulk tool
     505     */
    479506    function get_thumbnail_for_post_callback() {
    480507
     
    505532    }
    506533
     534    /**
     535     * A function that renders the bulk scanning page
     536     */
    507537    function bulk_scanning_page() {
    508538
Note: See TracChangeset for help on using the changeset viewer.