Plugin Directory

Changeset 873686


Ignore:
Timestamp:
03/11/2014 11:16:18 PM (12 years ago)
Author:
sutherlandboswell
Message:

Translation ready

Location:
video-thumbnails
Files:
4 added
2 deleted
3 edited
27 copied

Legend:

Unmodified
Added
Removed
  • video-thumbnails/tags/2.7/css/bulk.css

    r837855 r873686  
    5656
    5757#vt-bulk-scan-results .stats {
     58    width: 100%;
    5859    margin-top: 1em;
    5960    text-align: center;
     61}
     62
     63#vt-bulk-scan-results .stats .scanned,
     64#vt-bulk-scan-results .stats .found-new,
     65#vt-bulk-scan-results .stats .found-existing {
     66    font-size: 24px;
     67    font-weight: bold;
     68    width: 33%;
    6069}
    6170
  • video-thumbnails/tags/2.7/js/bulk.js

    r850958 r873686  
    1313        this.logList            = $('#vt-bulk-scan-results .log');
    1414        this.progressBar        = $('#vt-bulk-scan-results .progress-bar');
     15        this.language           = video_thumbnails_bulk_language;
    1516    }
    1617
     
    3536        var self = this;
    3637        this.disableSubmit();
    37         $('#queue-count').text('working...');
     38        $('#queue-count').text(this.language.working);
    3839        $.post(ajaxurl, data, function(response) {
    3940            self.posts = $.parseJSON( response );
    40             $('#queue-count').text(self.posts.length+' posts in queue');
     41            if ( self.posts.length == 1 ) {
     42                queueText = self.language.queue_singular;
     43            } else {
     44                queueText = self.language.queue_plural.replace('%d',self.posts.length);
     45            }
     46            $('#queue-count').text(queueText);
    4147            if ( self.posts.length > 0 ) {
    4248                self.enableSubmit();
     
    4955        this.paused = false;
    5056        if ( this.currentItem == 0 ) {
    51             this.log( 'Started Scanning' );
     57            this.log( this.language.started );
    5258            this.progressBar.show();
    5359            this.resetProgressBar();
    5460            $('#video-thumbnails-bulk-scan-options').slideUp();
    5561        } else {
    56             this.log( 'Resumed Scanning' );
     62            this.log( this.language.resumed );
    5763        }
    5864        this.scanCurrentItem();
     
    6268        this.clearSchedule();
    6369        this.paused = true;
    64         this.log( 'Paused Scanning' );
     70        this.log( this.language.paused );
    6571    };
    6672
     
    7480
    7581    VideoThumbnailsBulkScanner.prototype.scanCompleted = function() {
    76         this.log( 'Done! Scanned ' + this.posts.length + ' posts' );
     82        if ( this.posts.length == 1 ) {
     83            message = this.language.done + ' ' + this.language.final_count_singular;
     84        } else {
     85            message = this.language.done + ' ' + this.language.final_count_plural.replace('%d',this.posts.length);
     86        }
     87        this.log( message );
    7788    };
    7889
     
    89100        console.log( percentage = ( this.currentItem + 1 ) / this.posts.length );
    90101        if ( percentage == 1 ) {
    91             progressText = 'Done!';
     102            progressText = this.language.done;
    92103            this.scanCompleted();
    93104        } else {
     
    99110
    100111    VideoThumbnailsBulkScanner.prototype.updateCounter = function() {
    101         $('#vt-bulk-scan-results .stats .scanned').html( 'Scanned ' + (this.currentItem+1) + ' of ' + this.posts.length );
    102         $('#vt-bulk-scan-results .stats .found').html( 'Found ' + this.newThumbnails + ' new thumbnails and ' + this.existingThumbnails + ' existing thumbnails' );
     112        $('#vt-bulk-scan-results .stats .scanned').html( (this.currentItem+1) + '/' + this.posts.length );
     113        $('#vt-bulk-scan-results .stats .found-new').html( this.newThumbnails );
     114        $('#vt-bulk-scan-results .stats .found-existing').html( this.existingThumbnails );
    103115    }
    104116
     
    128140        if ( this.currentItem < this.posts.length ) {
    129141
    130             this.log( '[' + this.posts[this.currentItem] + '] Scanning ' + (this.currentItem+1) + ' of ' + this.posts.length );
     142            this.log( '[ID: ' + this.posts[this.currentItem] + '] ' + this.language.scanning_of.replace('%1$s',this.currentItem+1).replace('%2$s',this.posts.length) );
    131143
    132144            var data = {
     
    142154                    var result = $.parseJSON( response );
    143155                    if ( result.length == 0 ) {
    144                         self.log( '[' + self.posts[self.currentItem] + '] No thumbnail' );
     156                        self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + self.language.no_thumbnail );
    145157                    } else {
    146                         self.log( '[' + self.posts[self.currentItem] + '] ' + result.url + ' (' + result.type + ')' );
     158                        if ( result.type == 'new' ) {
     159                            resultText = self.language.new_thumbnail;
     160                        } else {
     161                            resultText = self.language.existing_thumbnail;
     162                        }
     163                        self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + resultText + ' ' + result.url );
    147164                        if ( result.type == 'new' ) {
    148165                            self.newThumbnails++;
     
    155172                },
    156173                error: function(jqXHR, textStatus, errorThrown) {
    157                     self.log( '[' + self.posts[self.currentItem] + '] Error: ' + errorThrown );
     174                    self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + self.language.error + ' ' + errorThrown );
    158175                    self.updateStats();
    159176                    self.scheduleNextItem();
  • video-thumbnails/tags/2.7/js/settings.js

    r862503 r873686  
    1111                $('#custom_field').val(response);
    1212            } else {
    13                 alert('We were unable to find a video in the custom fields of your most recently updated post.');
     13                alert(video_thumbnails_settings_language.detection_failed);
    1414            }
    1515        });
     
    2323        action: 'video_thumbnail_' + test_type + '_test'
    2424    };
    25     document.getElementById( test_type + '-test' ).innerHTML = 'Working...';
     25    document.getElementById( test_type + '-test' ).innerHTML = video_thumbnails_settings_language.working;
    2626    jQuery.post(ajaxurl, data, function(response){
    2727        document.getElementById( test_type + '-test' ).innerHTML = response;
     
    3434        markup: jQuery('#markup-input').val()
    3535    };
    36     document.getElementById( 'markup-test-result' ).innerHTML = '<p>Working...</p>';
     36    document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
    3737    jQuery.post(ajaxurl, data, function(response){
    3838        document.getElementById( 'markup-test-result' ).innerHTML = response;
     
    4242// Clear all video thumbnails
    4343function clear_all_video_thumbnails( nonce ) {
    44     var confimation_result = confirm("Are you sure you want to clear all video thumbnails? This cannot be undone.");
     44    var confimation_result = confirm(video_thumbnails_settings_language.clear_all_confirmation);
    4545    if (confimation_result){
    4646        var data = {
     
    4848            nonce: nonce
    4949        };
    50         document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = '<p>Working...</p>';
     50        document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
    5151        jQuery.post(ajaxurl, data, function(response){
    5252            document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = response;
  • video-thumbnails/tags/2.7/php/class-video-thumbnails-settings.php

    r862503 r873686  
    127127    function admin_menu() {
    128128        add_options_page(
    129             'Video Thumbnail Options',
    130             'Video Thumbnails',
     129            __( 'Video Thumbnails Options', 'video-thumbnails' ),
     130            __( 'Video Thumbnails', 'video-thumbnails' ),
    131131            'manage_options',
    132132            'video_thumbnails',
     
    137137    function admin_scripts() {
    138138        wp_enqueue_script( 'video_thumbnails_settings', plugins_url( 'js/settings.js' , VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php' ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
     139        wp_localize_script( 'video_thumbnails_settings', 'video_thumbnails_settings_language', array(
     140            'detection_failed'       => __( 'We were unable to find a video in the custom fields of your most recently updated post.', 'video-thumbnails' ),
     141            'working'                => __( 'Working...', 'video-thumbnails' ),
     142            'clear_all_confirmation' => __( 'Are you sure you want to clear all video thumbnails? This cannot be undone.', 'video-thumbnails' ),
     143        ) );
    139144    }
    140145
     
    183188            echo '<p><span style="color:green">&#10004;</span> ' . sprintf( _n( '1 custom field cleared', '%s custom fields cleared', $custom_fields_cleared, 'video-thumbnails' ), $custom_fields_cleared ) . '</p>';
    184189        } else {
    185             echo '<p><span style="color:red">&#10006;</span> <strong>Error</strong>: Could not verify nonce.</p>';
     190            echo '<p><span style="color:red">&#10006;</span> ' . __( '<strong>Error</strong>: Could not verify nonce.', 'video-thumbnails' ) . '</p>';
    186191        }
    187192
     
    207212                <thead>
    208213                    <tr>
    209                         <th>Name</th>
    210                         <th>Pass/Fail</th>
    211                         <th>Result</th>
     214                        <th><?php _e( 'Name', 'video-thumbnails' ); ?></th>
     215                        <th><?php _e( 'Pass/Fail', 'video-thumbnails' ); ?></th>
     216                        <th><?php _e( 'Result', 'video-thumbnails' ); ?></th>
    212217                    </tr>
    213218                </thead>
     
    217222            $failed = 0;
    218223            foreach ( $video_thumbnails->providers as $provider ) {
    219                 foreach ( $provider->test_cases as $test_case ) {
     224                foreach ( $provider->get_test_cases() as $test_case ) {
    220225                    echo '<tr>';
    221226                    echo '<td><strong>' . $provider->service_name . '</strong> - ' . $test_case['name'] . '</td>';
     
    223228                    if ( is_wp_error( $result ) ) {
    224229                        $error_string = $result->get_error_message();
    225                         echo '<td style="color:red;">&#10007; Failed</td>';
     230                        echo '<td style="color:red;">&#10007; ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
    226231                        echo '<td>';
    227232                        echo '<div class="error"><p>' . $error_string . '</p></div>';
     
    240245                       
    241246                        if ( $matched ) {
    242                             echo '<td style="color:green;">&#10004; Passed</td>';
     247                            echo '<td style="color:green;">&#10004; ' . __( 'Passed', 'video-thumbnails' ) . '</td>';
    243248                            $passed++;
    244249                        } else {
    245                             echo '<td style="color:red;">&#10007; Failed</td>';
     250                            echo '<td style="color:red;">&#10007; ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
    246251                            $failed++;
    247252                        }
    248253                        echo '<td>';
    249254                        if ( $result ) {
    250                             echo '<a href="' . $result . '">View Image</a>';
     255                            echo '<a href="' . $result . '">' . __( 'View Image', 'video-thumbnails' ) . '</a>';
    251256                        }
    252257                        if ( $result_hash ) {
     
    277282            echo '<p><span style="color:red;">&#10006;</span> ' . $attachment_id->get_error_message() . '</p>';
    278283        } else {
    279             echo '<p><span style="color:green;">&#10004;</span>Attachment created with an ID of ' . $attachment_id . '</p>';
     284            echo '<p><span style="color:green;">&#10004;</span> ' . sprintf( __( 'Attachment created with an ID of %d', 'video-thumbnails' ), $attachment_id ) . '</p>';
    280285            wp_delete_attachment( $attachment_id, true );
    281             echo '<p><span style="color:green;">&#10004;</span>Attachment with an ID of ' . $attachment_id . ' deleted</p>';           
     286            echo '<p><span style="color:green;">&#10004;</span> ' . sprintf( __( 'Attachment with an ID of %d deleted', 'video-thumbnails' ), $attachment_id ) . '</p>';           
    282287        }
    283288
     
    295300        if ( $new_thumbnail == null ) {
    296301            // No thumbnail
    297             echo '<p><span style="color:red;">&#10006;</span> No thumbnail found</p>';
     302            echo '<p><span style="color:red;">&#10006;</span> ' . __( 'No thumbnail found', 'video-thumbnails' ) . '</p>';
    298303        } elseif ( is_wp_error( $new_thumbnail ) ) {
    299304            // Error finding thumbnail
    300             echo '<p><span style="color:red;">&#10006;</span> Error: ' . $new_thumbnail->get_error_message() . '</p>';
     305            echo '<p><span style="color:red;">&#10006;</span> ' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $new_thumbnail->get_error_message() . '</p>';
    301306        } else {
    302307            // Found a thumbnail
     
    304309            if ( is_wp_error( $remote_response ) ) {
    305310                // WP Error trying to read image from remote server
    306                 echo '<p><span style="color:red;">&#10006;</span> Thumbnail found, but there was an error retrieving the URL.</p>';
    307                 echo '<p>Error Details: ' . $remote_response->get_error_message() . '</p>';
     311                echo '<p><span style="color:red;">&#10006;</span> ' . __( 'Thumbnail found, but there was an error retrieving the URL.', 'video-thumbnails' ) . '</p>';
     312                echo '<p>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $remote_response->get_error_message() . '</p>';
    308313            } elseif ( $remote_response['response']['code'] != '200' ) {
    309314                // Response code isn't okay
    310                 echo '<p><span style="color:red;">&#10006;</span> Thumbnail found, but it may not exist on the source server. If opening the URL below in your web browser returns an error, the source is providing an invalid URL.</p>';
    311                 echo '<p>Thumbnail URL: <a href="' . $new_thumbnail . '" target="_blank">' . $new_thumbnail . '</a>';
     315                echo '<p><span style="color:red;">&#10006;</span> ' . __( 'Thumbnail found, but it may not exist on the source server. If opening the URL below in your web browser returns an error, the source is providing an invalid URL.', 'video-thumbnails' ) . '</p>';
     316                echo '<p>' . __( 'Thumbnail URL:', 'video-thumbnails' ) . ' <a href="' . $new_thumbnail . '" target="_blank">' . $new_thumbnail . '</a>';
    312317            } else {
    313318                // Everything is okay!
    314                 echo '<p><span style="color:green;">&#10004;</span> Thumbnail found! Image should appear below. <a href="' . $new_thumbnail . '" target="_blank">View full size</a></p>';
     319                echo '<p><span style="color:green;">&#10004;</span> ' . __( 'Thumbnail found! Image should appear below.', 'video-thumbnails' ) . ' <a href="' . $new_thumbnail . '" target="_blank">' . __( 'View full size', 'video-thumbnails' ) . '</a></p>';
    315320                echo '<p><img src="' . $new_thumbnail . '" style="max-width: 500px;"></p>';
    316321            }
     
    323328        add_settings_section( 
    324329            'general_settings_section',
    325             'General Settings',
     330            __( 'General Settings', 'video-thumbnails' ),
    326331            array( &$this, 'general_settings_callback' ),
    327332            'video_thumbnails'
     
    329334        $this->add_checkbox_setting(
    330335            'save_media',
    331             'Save Thumbnails to Media Library',
    332             'Checking this option will download video thumbnails to your server'
     336            __( 'Save Thumbnails to Media Library', 'video-thumbnails' ),
     337            __( 'Checking this option will download video thumbnails to your server', 'video-thumbnails' )
    333338        );
    334339        $this->add_checkbox_setting(
    335340            'set_featured',
    336             'Automatically Set Featured Image',
    337             'Check this option to automatically set video thumbnails as the featured image (requires saving to media library)'
     341            __( 'Automatically Set Featured Image', 'video-thumbnails' ),
     342            __( 'Check this option to automatically set video thumbnails as the featured image (requires saving to media library)', 'video-thumbnails' )
    338343        );
    339344        // Get post types
     
    343348        $this->add_multicheckbox_setting(
    344349            'post_types',
    345             'Post Types',
     350            __( 'Post Types', 'video-thumbnails' ),
    346351            $post_types
    347352        );
    348353        $this->add_text_setting(
    349354            'custom_field',
    350             'Custom Field (optional)',
    351             '<a href="#" class="button" id="vt_detect_custom_field">Automatically Detect</a> Enter the name of the custom field where your embed code or video URL is stored.'
     355            __( 'Custom Field (optional)', 'video-thumbnails' ),
     356            '<a href="#" class="button" id="vt_detect_custom_field">' . __( 'Automatically Detect', 'video-thumbnails' ) . '</a> ' . __( 'Enter the name of the custom field where your embed code or video URL is stored.', 'video-thumbnails' )
    352357        );
    353358        register_setting( 'video_thumbnails', 'video_thumbnails', array( &$this, 'sanitize_callback' ) );
     
    379384
    380385    function general_settings_callback() { 
    381         echo '<p>These options configure where the plugin will search for videos and what to do with thumbnails once found.</p>'; 
     386        echo '<p>' . __( 'These options configure where the plugin will search for videos and what to do with thumbnails once found.', 'video-thumbnails' ) . '</p>'; 
    382387    }
    383388
     
    452457
    453458        if ( ! current_user_can( 'manage_options' ) ) {
    454             wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
     459            wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
    455460        }
    456461
    457462        ?><div class="wrap">
    458463
    459             <div id="icon-options-general" class="icon32"></div><h2>Video Thumbnails Options</h2>
     464            <div id="icon-options-general" class="icon32"></div><h2><?php _e( 'Video Thumbnails Options', 'video-thumbnails' ); ?></h2>
    460465
    461466            <?php $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general_settings'; ?>
    462467            <h2 class="nav-tab-wrapper">
    463                 <a href="?page=video_thumbnails&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>">General</a>
    464                 <a href="?page=video_thumbnails&tab=provider_settings" class="nav-tab <?php echo $active_tab == 'provider_settings' ? 'nav-tab-active' : ''; ?>">Providers</a>
    465                 <a href="?page=video_thumbnails&tab=mass_actions" class="nav-tab <?php echo $active_tab == 'mass_actions' ? 'nav-tab-active' : ''; ?>">Mass Actions</a>
    466                 <a href="?page=video_thumbnails&tab=debugging" class="nav-tab <?php echo $active_tab == 'debugging' ? 'nav-tab-active' : ''; ?>">Debugging</a>
    467                 <a href="?page=video_thumbnails&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?>">Support</a>
     468                <a href="?page=video_thumbnails&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'General', 'video-thumbnails' ); ?></a>
     469                <a href="?page=video_thumbnails&tab=provider_settings" class="nav-tab <?php echo $active_tab == 'provider_settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Providers', 'video-thumbnails' ); ?></a>
     470                <a href="?page=video_thumbnails&tab=mass_actions" class="nav-tab <?php echo $active_tab == 'mass_actions' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Mass Actions', 'video-thumbnails' ); ?></a>
     471                <a href="?page=video_thumbnails&tab=debugging" class="nav-tab <?php echo $active_tab == 'debugging' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Debugging', 'video-thumbnails' ); ?></a>
     472                <a href="?page=video_thumbnails&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Support', 'video-thumbnails' ); ?></a>
    468473            </h2>
    469474
     
    472477            if ( $active_tab == 'general_settings' ) {
    473478            ?>
    474             <h3>Getting started</h3>
    475 
    476             <p>If your theme supports post thumbnails, just leave "Save Thumbnails to Media Library" and "Automatically Set Featured Image" enabled, then select what post types you'd like scanned for videos.</p>
    477 
    478             <p>For more detailed instructions, check out the page for <a href="http://wordpress.org/extend/plugins/video-thumbnails/">Video Thumbnails on the official plugin directory</a>.</p>
     479            <h3><?php _e( 'Getting started', 'video-thumbnails' ); ?></h3>
     480
     481            <p><?php _e( 'If your theme supports post thumbnails, just leave "Save Thumbnails to Media Library" and "Automatically Set Featured Image" enabled, then select what post types you\'d like scanned for videos.', 'video-thumbnails' ); ?></p>
     482
     483            <p><?php _e( 'For more detailed instructions, check out the page for <a href="http://wordpress.org/extend/plugins/video-thumbnails/">Video Thumbnails on the official plugin directory</a>.', 'video-thumbnails' ); ?></p>
    479484
    480485            <form method="post" action="options.php"> 
     
    504509            if ( $active_tab == 'mass_actions' ) {
    505510            ?>
    506             <h3>Scan All Posts</h3>
    507 
    508             <p>Scan all of your past posts for video thumbnails. Be sure to save any settings before running the scan.</p>
    509 
    510             <p><a class="button-primary" href="<?php echo admin_url( 'tools.php?page=video-thumbnails-bulk' ); ?>">Scan Past Posts</a></p>
    511 
    512             <h3>Clear all Video Thumbnails</h3>
    513 
    514             <p>This will clear the video thumbnail field for all posts and delete any video thumbnail attachments. Note: This only works for attachments added using version 2.0 or later.</p>
    515 
    516             <p><input type="submit" class="button-primary" onclick="clear_all_video_thumbnails('<?php echo wp_create_nonce( 'clear_all_video_thumbnails' ); ?>');" value="Clear Video Thumbnails" /></p>
     511            <h3><?php _e( 'Scan All Posts', 'video-thumbnails' ); ?></h3>
     512
     513            <p><?php _e( 'Scan all of your past posts for video thumbnails. Be sure to save any settings before running the scan.', 'video-thumbnails' ); ?></p>
     514
     515            <p><a class="button-primary" href="<?php echo admin_url( 'tools.php?page=video-thumbnails-bulk' ); ?>"><?php _e( 'Scan Past Posts', 'video-thumbnails' ); ?></a></p>
     516
     517            <h3><?php _e( 'Clear all Video Thumbnails', 'video-thumbnails' ); ?></h3>
     518
     519            <p><?php _e( 'This will clear the video thumbnail field for all posts and delete any video thumbnail attachments. Note: This only works for attachments added using version 2.0 or later.', 'video-thumbnails' ); ?></p>
     520
     521            <p><input type="submit" class="button-primary" onclick="clear_all_video_thumbnails('<?php echo wp_create_nonce( 'clear_all_video_thumbnails' ); ?>');" value="<?php esc_attr_e( 'Clear Video Thumbnails', 'video-thumbnails' ); ?>" /></p>
    517522
    518523            <div id="clear-all-video-thumbnails-result"></div>
     
    525530            ?>
    526531
    527             <p>Use these tests to help diagnose any problems. Please include results when requesting support.</p>
    528 
    529             <h3>Test Thumbnail Providers</h3>
    530 
    531             <p>This test automatically searches a sample for every type of video supported and compares it to the expected value. Sometimes tests may fail due to API rate limits.</p>
     532            <p><?php _e( 'Use these tests to help diagnose any problems. Please include results when requesting support.', 'video-thumbnails' ); ?></p>
     533
     534            <h3><?php _e( 'Test Video Providers', 'video-thumbnails' ); ?></h3>
     535
     536            <p><?php _e( 'This test automatically searches a sample for every type of video supported and compares it to the expected value. Sometimes tests may fail due to API rate limits.', 'video-thumbnails' ); ?></p>
    532537
    533538            <div id="provider-test">
    534                 <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('provider');" value="Test Providers" /></p>
     539                <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('provider');" value="<?php esc_attr_e( 'Test Video Providers', 'video-thumbnails' ); ?>" /></p>
    535540            </div>
    536541
    537             <h3>Test Markup for Video</h3>
    538 
    539             <p>Copy and paste an embed code below to see if a video is detected.</p>
     542            <h3><?php _e( 'Test Markup for Video', 'video-thumbnails' ); ?></h3>
     543
     544            <p><?php _e( 'Copy and paste an embed code below to see if a video is detected.', 'video-thumbnails' ); ?></p>
    540545
    541546            <textarea id="markup-input" cols="50" rows="5"></textarea>
    542547
    543             <p><input type="submit" class="button-primary" onclick="test_video_thumbnail_markup_detection();" value="Scan For Thumbnail" /></p>
     548            <p><input type="submit" class="button-primary" onclick="test_video_thumbnail_markup_detection();" value="<?php esc_attr_e( 'Scan For Thumbnail', 'video-thumbnails' ); ?>" /></p>
    544549
    545550            <div id="markup-test-result"></div>
    546551
    547             <h3>Test Saving to Media Library</h3>
    548 
    549             <p>This test checks for issues with the process of saving a remote thumbnail to your local media library.</p>
    550 
    551             <p>Also be sure to test that you can manually upload an image to your site. If you're unable to upload images, you may need to <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a>.</p>
     552            <h3><?php _e( 'Test Saving to Media Library', 'video-thumbnails' ); ?></h3>
     553
     554            <p><?php _e( 'This test checks for issues with the process of saving a remote thumbnail to your local media library.', 'video-thumbnails' ); ?></p>
     555
     556            <p><?php _e( 'Also be sure to test that you can manually upload an image to your site. If you\'re unable to upload images, you may need to <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a>.', 'video-thumbnails' ); ?></p>
    552557
    553558            <div id="saving_media-test">
    554                 <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('saving_media');" value="Test Image Downloading" /></p>
     559                <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('saving_media');" value="<?php esc_attr_e( 'Test Image Downloading', 'video-thumbnails' ); ?>" /></p>
    555560            </div>
    556561
    557             <h3>Installation Information</h3>
     562            <h3><?php _e( 'Installation Information', 'video-thumbnails' ); ?></h3>
    558563            <table class="widefat">
    559564                <thead>
     
    566571                <tbody>
    567572                    <tr>
    568                         <td><strong>WordPress Version</strong></td>
     573                        <td><strong><?php _e( 'WordPress Version', 'video-thumbnails' ); ?></strong></td>
    569574                        <td><?php echo get_bloginfo( 'version' ); ?></td>
    570575                        <td></td>
    571576                    </tr>
    572577                    <tr>
    573                         <td><strong>Video Thumbnails Version</strong></td>
     578                        <td><strong><?php _e( 'Video Thumbnails Version', 'video-thumbnails' ); ?></strong></td>
    574579                        <td><?php echo VIDEO_THUMBNAILS_VERSION; ?></td>
    575580                        <td></td>
    576581                    </tr>
    577582                    <tr>
    578                         <td><strong>Video Thumbnails Settings Version</strong></td>
     583                        <td><strong><?php _e( 'Video Thumbnails Settings Version', 'video-thumbnails' ); ?></strong></td>
    579584                        <td><?php echo $this->options['version']; ?></td>
    580585                        <td></td>
    581586                    </tr>
    582587                    <tr>
    583                         <td><strong>PHP Version</strong></td>
     588                        <td><strong><?php _e( 'PHP Version', 'video-thumbnails' ); ?></strong></td>
    584589                        <td><?php echo PHP_VERSION; ?></td>
    585590                        <td></td>
    586591                    </tr>
    587592                    <tr>
    588                         <td><strong>Post Thumbnails</strong></td>
    589                         <td><?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?><span style="color:green">&#10004;</span> Your theme supports post thumbnails.<?php else: ?><span style="color:red">&#10006;</span> Your theme doesn't support post thumbnails, you'll need to make modifications or switch to a different theme. <a href="http://codex.wordpress.org/Post_Thumbnails">More info</a><?php endif; ?></td>
     593                        <td><strong><?php _e( 'Post Thumbnails', 'video-thumbnails' ); ?></strong></td>
     594                        <td><?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?><span style="color:green">&#10004;</span> <?php _e( 'Your theme supports post thumbnails.', 'video-thumbnails' ); ?><?php else: ?><span style="color:red">&#10006;</span> <?php _e( 'Your theme does not support post thumbnails, you\'ll need to make modifications or switch to a different theme. <a href="http://codex.wordpress.org/Post_Thumbnails">More info</a>', 'video-thumbnails' ); ?><?php endif; ?></td>
    590595                        <td></td>
    591596                    </tr>
    592597                    <tr>
    593                         <td><strong>Providers</strong></td>
     598                        <td><strong><?php _e( 'Video Providers', 'video-thumbnails' ); ?></strong></td>
    594599                        <td>
    595600                            <?php global $video_thumbnails; ?>
     
    630635        <div style="width: 250px; margin: 20px 0; padding: 0 20px; background: #fff; border: 1px solid #dfdfdf; text-align: center;">
    631636            <div>
    632                 <p>Support video thumbnails and unlock additional features</p>
    633                 <p><a href="https://refactored.co/plugins/video-thumbnails" class="button button-primary button-large">Go Pro</a></p>
     637                <p><?php _e( 'Support video thumbnails and unlock additional features', 'video-thumbnails' ); ?></p>
     638                <p><a href="https://refactored.co/plugins/video-thumbnails" class="button button-primary button-large"><?php _e( 'Go Pro', 'video-thumbnails' ); ?></a></p>
    634639            </div>
    635640        </div>
  • video-thumbnails/tags/2.7/php/providers/class-blip-thumbnails.php

    r837855 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'blip_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $json = json_decode( $response['body'] );
    4949            if ( isset( $json->error ) ) {
    50                 $result = new WP_Error( 'blip_invalid_url', __( 'Error retrieving video information for <a href="' . $url . '">' . $url . '</a>. Check to be sure this is a valid Blip video URL.' ) );
     50                $result = new WP_Error( 'blip_invalid_url', sprintf( __( 'Error retrieving video information for <a href="%1$s">%1$s</a>. Check to be sure this is a valid Blip video URL.', 'video-thumbnails' ), $url ) );
    5151            } else {
    5252                $result = $json->thumbnail_url;
     
    5757
    5858    // Test cases
    59     public $test_cases = array(
    60         array(
    61             'markup'        => 'http://blip.tv/cranetv/illustrator-katie-scott-6617917',
    62             'expected'      => 'http://a.images.blip.tv/CraneTV-IllustratorKatieScott610.jpg',
    63             'expected_hash' => '26a622f72bd4bdb3f8189f85598dd95d',
    64             'name'          => 'Video URL'
    65         ),
    66         array(
    67             'markup'        => '<iframe src="http://blip.tv/play/AYL1uFkC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYL1uFkC" style="display:none"></embed>',
    68             'expected'      => 'http://a.images.blip.tv/ReelScience-TheScientificMethodOfOz139.jpg',
    69             'expected_hash' => 'bd2f58c2bc874e3a017167e74e5c842f',
    70             'name'          => 'iFrame player'
    71         ),
    72         array(
    73             'markup'        => '<iframe src="http://blip.tv/play/AYLz%2BEsC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYLz+EsC" style="display:none"></embed>',
    74             'expected'      => 'http://a.images.blip.tv/GeekCrashCourse-TheAvengersMarvelMovieCatchUpGeekCrashCourse331.png',
    75             'expected_hash' => '87efa9f6b0d9111b0826ae4fbdddec1b',
    76             'name'          => 'iFrame player (special characters in ID)'
    77         ),
    78     );
     59    public static function get_test_cases() {
     60        return array(
     61            array(
     62                'markup'        => 'http://blip.tv/cranetv/illustrator-katie-scott-6617917',
     63                'expected'      => 'http://a.images.blip.tv/CraneTV-IllustratorKatieScott610.jpg',
     64                'expected_hash' => '26a622f72bd4bdb3f8189f85598dd95d',
     65                'name'          => __( 'Video URL', 'video-thumbnails' )
     66            ),
     67            array(
     68                'markup'        => '<iframe src="http://blip.tv/play/AYLz%2BEsC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYLz+EsC" style="display:none"></embed>',
     69                'expected'      => 'http://a.images.blip.tv/GeekCrashCourse-TheAvengersMarvelMovieCatchUpGeekCrashCourse331.png',
     70                'expected_hash' => '87efa9f6b0d9111b0826ae4fbdddec1b',
     71                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     72            ),
     73        );
     74    }
    7975
    8076}
  • video-thumbnails/tags/2.7/php/providers/class-collegehumor-thumbnails.php

    r837855 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'collegehumor_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $result = json_decode( $response['body'] );
     
    5353
    5454    // Test cases
    55     public $test_cases = array(
    56         array(
    57             'markup'        => '<iframe src="http://www.collegehumor.com/e/6830834" width="600" height="338" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe><div style="padding:5px 0; text-align:center; width:600px;"><p><a href="http://www.collegehumor.com/videos/most-viewed/this-year">CollegeHumor\'s Favorite Funny Videos</a></p></div>',
    58             'expected'      => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
    59             'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
    60             'name'          => 'Embed'
    61         ),
    62         array(
    63             'markup'        => 'http://www.collegehumor.com/video/6830834/mitt-romney-style-gangnam-style-parody',
    64             'expected'      => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
    65             'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
    66             'name'          => 'URL'
    67         ),
    68     );
     55    public static function get_test_cases() {
     56        return array(
     57            array(
     58                'markup'        => '<iframe src="http://www.collegehumor.com/e/6830834" width="600" height="338" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe><div style="padding:5px 0; text-align:center; width:600px;"><p><a href="http://www.collegehumor.com/videos/most-viewed/this-year">CollegeHumor\'s Favorite Funny Videos</a></p></div>',
     59                'expected'      => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
     60                'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
     61                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     62            ),
     63            array(
     64                'markup'        => 'http://www.collegehumor.com/video/6830834/mitt-romney-style-gangnam-style-parody',
     65                'expected'      => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
     66                'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
     67                'name'          => __( 'Video URL', 'video-thumbnails' )
     68            ),
     69        );
     70    }
    6971
    7072}
  • video-thumbnails/tags/2.7/php/providers/class-dailymotion-thumbnails.php

    r837855 r873686  
    4646        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4747        if( is_wp_error( $response ) ) {
    48             $result = new WP_Error( 'dailymotion_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     48            $result = $this->construct_info_retrieval_error( $request, $response );
    4949        } else {
    5050            $result = json_decode( $response['body'] );
     
    5555
    5656    // Test cases
    57     public $test_cases = array(
    58         array(
    59             'markup'        => '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xqlhts"></iframe><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
    60             'expected'      => 'http://s1.dmcdn.net/AMjdy.jpg',
    61             'expected_hash' => '077888b97839254892a377f51c06e642',
    62             'name'          => 'iFrame player'
    63         ),
    64         array(
    65             'markup'        => '<object width="480" height="270"><param name="movie" value="http://www.dailymotion.com/swf/video/xqlhts"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/xqlhts" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"></embed></object><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
    66             'expected'      => 'http://s1.dmcdn.net/AMjdy.jpg',
    67             'expected_hash' => '077888b97839254892a377f51c06e642',
    68             'name'          => 'Flash player'
    69         ),
    70     );
     57    public static function get_test_cases() {
     58        return array(
     59            array(
     60                'markup'        => '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xqlhts"></iframe><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
     61                'expected'      => 'http://s1.dmcdn.net/AMjdy.jpg',
     62                'expected_hash' => '077888b97839254892a377f51c06e642',
     63                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     64            ),
     65            array(
     66                'markup'        => '<object width="480" height="270"><param name="movie" value="http://www.dailymotion.com/swf/video/xqlhts"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/xqlhts" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"></embed></object><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
     67                'expected'      => 'http://s1.dmcdn.net/AMjdy.jpg',
     68                'expected_hash' => '077888b97839254892a377f51c06e642',
     69                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     70            ),
     71        );
     72    }
    7173
    7274}
  • video-thumbnails/tags/2.7/php/providers/class-facebook-thumbnails.php

    r837855 r873686  
    4646
    4747    // Test cases
    48     public $test_cases = array(
    49         array(
    50             'markup'        => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
    51             'expected'      => 'https://graph.facebook.com/2560032632599/picture',
    52             'expected_hash' => '619591ec126ad889799ad992a227c75e',
    53             'name'          => 'Flash Embed'
    54         ),
    55         array(
    56             'markup'        => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
    57             'expected'      => 'https://graph.facebook.com/2560032632599/picture',
    58             'expected_hash' => '619591ec126ad889799ad992a227c75e',
    59             'name'          => 'iFrame Embed'
    60         ),
    61     );
     48    public static function get_test_cases() {
     49        return array(
     50            array(
     51                'markup'        => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
     52                'expected'      => 'https://graph.facebook.com/2560032632599/picture',
     53                'expected_hash' => '619591ec126ad889799ad992a227c75e',
     54                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     55            ),
     56            array(
     57                'markup'        => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
     58                'expected'      => 'https://graph.facebook.com/2560032632599/picture',
     59                'expected_hash' => '619591ec126ad889799ad992a227c75e',
     60                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     61            ),
     62        );
     63    }
    6264
    6365}
  • video-thumbnails/tags/2.7/php/providers/class-funnyordie-thumbnails.php

    r837855 r873686  
    4545        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4646        if( is_wp_error( $response ) ) {
    47             $result = new WP_Error( 'funnyordie_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     47            $result = $this->construct_info_retrieval_error( $request, $response );
    4848        } else {
    4949            $result = json_decode( $response['body'] );
     
    5454
    5555    // Test cases
    56     public $test_cases = array(
    57         array(
    58             'markup'        => '<iframe src="http://www.funnyordie.com/embed/5325b03b52" width="640" height="400" frameborder="0"></iframe>',
    59             'expected'      => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
    60             'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
    61             'name'          => 'iFrame player'
    62         ),
    63         array(
    64             'markup'        => '<object width="640" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="ordie_player_5325b03b52"><param name="movie" value="http://player.ordienetworks.com/flash/fodplayer.swf" /><param name="flashvars" value="key=5325b03b52" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always"><embed width="640" height="400" flashvars="key=5325b03b52" allowfullscreen="true" allowscriptaccess="always" quality="high" src="http://player.ordienetworks.com/flash/fodplayer.swf" name="ordie_player_5325b03b52" type="application/x-shockwave-flash"></embed></object>',
    65             'expected'      => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
    66             'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
    67             'name'          => 'Flash player'
    68         ),
    69     );
     56    public static function get_test_cases() {
     57        return array(
     58            array(
     59                'markup'        => '<iframe src="http://www.funnyordie.com/embed/5325b03b52" width="640" height="400" frameborder="0"></iframe>',
     60                'expected'      => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
     61                'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
     62                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     63            ),
     64            array(
     65                'markup'        => '<object width="640" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="ordie_player_5325b03b52"><param name="movie" value="http://player.ordienetworks.com/flash/fodplayer.swf" /><param name="flashvars" value="key=5325b03b52" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always"><embed width="640" height="400" flashvars="key=5325b03b52" allowfullscreen="true" allowscriptaccess="always" quality="high" src="http://player.ordienetworks.com/flash/fodplayer.swf" name="ordie_player_5325b03b52" type="application/x-shockwave-flash"></embed></object>',
     66                'expected'      => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
     67                'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
     68                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     69            ),
     70        );
     71    }
    7072
    7173}
  • video-thumbnails/tags/2.7/php/providers/class-googledrive-thumbnails.php

    r869386 r873686  
    6161            $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    6262            if( is_wp_error( $response ) ) {
    63                 $result = new WP_Error( 'googledrive_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     63                $result = $this->construct_info_retrieval_error( $request, $response );
    6464            } else {
    6565                $json = json_decode( $response['body'] );
     
    6868            }
    6969        } else {
    70             $result = new WP_Error( 'googledrive_api_key', __( 'You must enter an API key in the <a href="' . admin_url( 'options-general.php?page=video_thumbnails&tab=provider_settings' ) . '">provider settings</a> to retrieve thumbnails from Google Drive.' ) );
     70            $result = new WP_Error( 'googledrive_api_key', __( 'You must enter an API key in the <a href="' . admin_url( 'options-general.php?page=video_thumbnails&tab=provider_settings' ) . '">provider settings</a> to retrieve thumbnails from Google Drive.', 'video-thumbnails' ) );
    7171        }
    7272        return $result;
     
    7474
    7575    // Test cases
    76     public $test_cases = array(
    77         array(
    78             'markup'        => '<iframe src="https://docs.google.com/file/d/0B2tG5YeQL99ZUHNja3l6am9jSGM/preview?pli=1" width="640" height="385"></iframe>',
    79             'expected'      => 'https://lh3.googleusercontent.com/QL3d7Wh7V_qcXnMpXT6bio77RS0veyCZZ0zQbMX6gd-qH7aeIXBkXlcSJVDEyftiiA=s480',
    80             'expected_hash' => '3bc674d8d77b342e633ab9e93e345462',
    81             'name'          => 'iFrame embed'
    82         ),
    83         array(
    84             'markup'        => '<iframe height="385" src="https://docs.google.com/a/svpanthers.org/file/d/0BxQsabDaO6USYUgxSUJ3T0ZBa3M/preview" width="100%"></iframe>',
    85             'expected'      => 'https://lh6.googleusercontent.com/WeOdCsaplJ3am25To1uLZiVYkyrilAQ5rxzhjnyyFc5GAF4QeCF1eq3EMpbP7O5dFg=s480',
    86             'expected_hash' => 'f120755bbd1d35e381cb84a829ac0dfa',
    87             'name'          => 'iFrame embed (Apps account)'
    88         ),
    89         array(
    90             'markup'        => '<object width="500" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed width="500" height="385" type="application/x-shockwave-flash" src="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object>',
    91             'expected'      => 'https://lh3.googleusercontent.com/U_lqaX1o7E9iU75XwCrHZ4pdSi-Vch2F_GK5Ib7WAxgwKTvTl0kMHXm2GxKo1Pcp3Q=s480',
    92             'expected_hash' => '31cf8e05f981c1beb6e04823ad54d267',
    93             'name'          => 'Flash embed'
    94         ),
    95         array(
    96             'markup'        => '<object style="" id="" data="https://youtube.com/get_player?el=leaf" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" height="720px" width="1280px"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess"><param value="opaque" name="wmode"><param value="allow_embed=0&partnerid=30&autoplay=1&showinfo=0&docid=0B9VJd4kStxIVellHZEdXdmdSamM&el=leaf" name="flashvars"></object>',
    97             'expected'      => 'https://lh5.googleusercontent.com/mHn5gESachhZHi-kbPCRbR6RVXZm3bR7oNNXL97LyYjpzV3Eqty71J2Waw0DPnXKKw=s480',
    98             'expected_hash' => '2d0ad4881e4b38de0510a103d2f40dd1',
    99             'name'          => 'Flash embed (YouTube player)'
    100         ),
    101     );
     76    public static function get_test_cases() {
     77        return array(
     78            array(
     79                'markup'        => '<iframe src="https://docs.google.com/file/d/0B2tG5YeQL99ZUHNja3l6am9jSGM/preview?pli=1" width="640" height="385"></iframe>',
     80                'expected'      => 'https://lh3.googleusercontent.com/QL3d7Wh7V_qcXnMpXT6bio77RS0veyCZZ0zQbMX6gd-qH7aeIXBkXlcSJVDEyftiiA=s480',
     81                'expected_hash' => '3bc674d8d77b342e633ab9e93e345462',
     82                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     83            ),
     84            array(
     85                'markup'        => '<iframe height="385" src="https://docs.google.com/a/svpanthers.org/file/d/0BxQsabDaO6USYUgxSUJ3T0ZBa3M/preview" width="100%"></iframe>',
     86                'expected'      => 'https://lh6.googleusercontent.com/WeOdCsaplJ3am25To1uLZiVYkyrilAQ5rxzhjnyyFc5GAF4QeCF1eq3EMpbP7O5dFg=s480',
     87                'expected_hash' => 'f120755bbd1d35e381cb84a829ac0dfa',
     88                'name'          => __( 'iFrame Embed (Apps account)', 'video-thumbnails' )
     89            ),
     90            array(
     91                'markup'        => '<object width="500" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed width="500" height="385" type="application/x-shockwave-flash" src="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object>',
     92                'expected'      => 'https://lh3.googleusercontent.com/U_lqaX1o7E9iU75XwCrHZ4pdSi-Vch2F_GK5Ib7WAxgwKTvTl0kMHXm2GxKo1Pcp3Q=s480',
     93                'expected_hash' => '31cf8e05f981c1beb6e04823ad54d267',
     94                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     95            ),
     96            array(
     97                'markup'        => '<object style="" id="" data="https://youtube.com/get_player?el=leaf" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" height="720px" width="1280px"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess"><param value="opaque" name="wmode"><param value="allow_embed=0&partnerid=30&autoplay=1&showinfo=0&docid=0B9VJd4kStxIVellHZEdXdmdSamM&el=leaf" name="flashvars"></object>',
     98                'expected'      => 'https://lh5.googleusercontent.com/mHn5gESachhZHi-kbPCRbR6RVXZm3bR7oNNXL97LyYjpzV3Eqty71J2Waw0DPnXKKw=s480',
     99                'expected_hash' => '2d0ad4881e4b38de0510a103d2f40dd1',
     100                'name'          => __( 'Flash Embed (YouTube player)', 'video-thumbnails' )
     101            ),
     102        );
     103    }
    102104
    103105}
  • video-thumbnails/tags/2.7/php/providers/class-justintv-thumbnails.php

    r837855 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'justintv_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $xml = new SimpleXMLElement( $response['body'] );
     
    5353
    5454    // Test cases
    55     public $test_cases = array(
    56         array(
    57             'markup'        => '<object type="application/x-shockwave-flash" height="300" width="400" id="clip_embed_player_flash" data="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" bgcolor="#000000"><param name="movie" value="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="auto_play=false&start_volume=25&title=Title&channel=scamschoolbrian&archive_id=392481524" /></object>',
    58             'expected'      => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-392481524-320x240.jpg',
    59             'expected_hash' => '7f260a2ce6ae75a3c2e5012108f161b7',
    60             'name'          => 'Embed'
    61         ),
    62     );
     55    public static function get_test_cases() {
     56        return array(
     57            array(
     58                'markup'        => '<object type="application/x-shockwave-flash" height="300" width="400" id="clip_embed_player_flash" data="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" bgcolor="#000000"><param name="movie" value="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="auto_play=false&start_volume=25&title=Title&channel=scamschoolbrian&archive_id=392481524" /></object>',
     59                'expected'      => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-392481524-320x240.jpg',
     60                'expected_hash' => '7f260a2ce6ae75a3c2e5012108f161b7',
     61                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     62            ),
     63        );
     64    }
    6365
    6466}
  • video-thumbnails/tags/2.7/php/providers/class-kaltura-thumbnails.php

    r837855 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'kaltura_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $xml = new SimpleXMLElement( $response['body'] );
     
    5151            $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    5252            if( is_wp_error( $response ) ) {
    53                 $result = new WP_Error( 'kaltura_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     53                $result = $this->construct_info_retrieval_error( $request, $response );
    5454            } else {
    5555                $xml = new SimpleXMLElement( $response['body'] );
     
    6161
    6262    // Test cases
    63     public $test_cases = array(
    64         array(
    65             'markup'   => '<script type="text/javascript" src="http://cdnapi.kaltura.com/p/1374841/sp/137484100/embedIframeJs/uiconf_id/12680902/partner_id/1374841?entry_id=1_y7xzqsxw&playerId=kaltura_player_1363589321&cache_st=1363589321&autoembed=true&width=400&height=333&"></script>',
    66             'expected' => 'http://example.com/thumbnail.jpg',
    67             'name'     => 'Auto embed'
    68         ),
    69     );
     63    public static function get_test_cases() {
     64        return array(
     65            array(
     66                'markup'   => '<script type="text/javascript" src="http://cdnapi.kaltura.com/p/1374841/sp/137484100/embedIframeJs/uiconf_id/12680902/partner_id/1374841?entry_id=1_y7xzqsxw&playerId=kaltura_player_1363589321&cache_st=1363589321&autoembed=true&width=400&height=333&"></script>',
     67                'expected' => 'http://example.com/thumbnail.jpg',
     68                'name'     => __( 'Auto Embed', 'video-thumbnails' )
     69            ),
     70        );
     71    }
    7072
    7173}
  • video-thumbnails/tags/2.7/php/providers/class-metacafe-thumbnails.php

    r837855 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'metacafe_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $xml = new SimpleXMLElement( $response['body'] );
     
    5454
    5555    // Test cases
    56     public $test_cases = array(
    57         array(
    58             'markup'        => '<embed flashVars="playerVars=autoPlay=no" src="http://www.metacafe.com/fplayer/8456223/men_in_black_3_trailer_2.swf" width="440" height="248" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_8456223" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>',
    59             'expected'      => 'http://s4.mcstatic.com/thumb/8456223/22479418/4/catalog_item5/0/1/men_in_black_3_trailer_2.jpg',
    60             'expected_hash' => 'df46215fef1d9fb68eea64ba3ed9a4fd',
    61             'name'          => 'Embed'
    62         ),
    63     );
     56    public static function get_test_cases() {
     57        return array(
     58            array(
     59                'markup'        => '<embed flashVars="playerVars=autoPlay=no" src="http://www.metacafe.com/fplayer/8456223/men_in_black_3_trailer_2.swf" width="440" height="248" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_8456223" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>',
     60                'expected'      => 'http://s4.mcstatic.com/thumb/8456223/22479418/4/catalog_item5/0/1/men_in_black_3_trailer_2.jpg',
     61                'expected_hash' => 'df46215fef1d9fb68eea64ba3ed9a4fd',
     62                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     63            ),
     64        );
     65    }
    6466
    6567}
  • video-thumbnails/tags/2.7/php/providers/class-mpora-thumbnails.php

    r837855 r873686  
    4646
    4747    // Test cases
    48     public $test_cases = array(
    49         array(
    50             'markup'        => '<object width="480" height="270" id="mporaplayer_wEr2CBooV_N" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" ><param name="movie" value="http://video.mpora.com/ep/wEr2CBooV/"></param><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><embed src="http://video.mpora.com/ep/wEr2CBooV/" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>',
    51             'expected'      => 'http://ugc4.mporatrons.com/thumbs/wEr2CBooV_640x360_0000.jpg',
    52             'expected_hash' => '95075bd4941251ebecbab3b436a90c49',
    53             'name'          => 'Flash player'
    54         ),
    55         array(
    56             'markup'        => '<iframe width="640" height="360" src="http://mpora.com/videos/AAdfegovdop0/embed" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
    57             'expected'      => 'http://ugc4.mporatrons.com/thumbs/AAdfegovdop0_640x360_0000.jpg',
    58             'expected_hash' => '45db22a2ba5ef20163f52ba562b89259',
    59             'name'          => 'iFrame player'
    60         ),
    61     );
     48    public static function get_test_cases() {
     49        return array(
     50            array(
     51                'markup'        => '<object width="480" height="270" id="mporaplayer_wEr2CBooV_N" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" ><param name="movie" value="http://video.mpora.com/ep/wEr2CBooV/"></param><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><embed src="http://video.mpora.com/ep/wEr2CBooV/" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>',
     52                'expected'      => 'http://ugc4.mporatrons.com/thumbs/wEr2CBooV_640x360_0000.jpg',
     53                'expected_hash' => '95075bd4941251ebecbab3b436a90c49',
     54                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     55            ),
     56            array(
     57                'markup'        => '<iframe width="640" height="360" src="http://mpora.com/videos/AAdfegovdop0/embed" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
     58                'expected'      => 'http://ugc4.mporatrons.com/thumbs/AAdfegovdop0_640x360_0000.jpg',
     59                'expected_hash' => '45db22a2ba5ef20163f52ba562b89259',
     60                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     61            ),
     62        );
     63    }
     64
    6265}
    6366
  • video-thumbnails/tags/2.7/php/providers/class-rutube-thumbnails.php

    r837855 r873686  
    4545        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4646        if( is_wp_error( $response ) ) {
    47             $result = new WP_Error( 'rutube_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     47            $result = $this->construct_info_retrieval_error( $request, $response );
    4848        } else {
    4949            $result = json_decode( $response['body'] );
     
    5454
    5555    // Test cases
    56     public $test_cases = array(
    57         array(
    58             'markup'        => 'http://rutube.ru/video/ca8607cd4f7ef28516e043dde0068564/',
    59             'expected'      => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
    60             'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
    61             'name'          => 'Video link'
    62         ),
    63         array(
    64             'markup'        => '<iframe width="720" height="405" src="//rutube.ru/video/embed/6608735" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
    65             'expected'      => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
    66             'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
    67             'name'          => 'iFrame embed'
    68         ),
    69     );
     56    public static function get_test_cases() {
     57        return array(
     58            array(
     59                'markup'        => 'http://rutube.ru/video/ca8607cd4f7ef28516e043dde0068564/',
     60                'expected'      => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
     61                'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
     62                'name'          => __( 'Video URL', 'video-thumbnails' )
     63            ),
     64            array(
     65                'markup'        => '<iframe width="720" height="405" src="//rutube.ru/video/embed/6608735" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
     66                'expected'      => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
     67                'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
     68                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     69            ),
     70        );
     71    }
    7072
    7173}
  • video-thumbnails/tags/2.7/php/providers/class-twitch-thumbnails.php

    r837855 r873686  
    4545        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4646        if( is_wp_error( $response ) ) {
    47             $result = new WP_Error( 'twitch_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     47            $result = $this->construct_info_retrieval_error( $request, $response );
    4848        } else {
    4949            $result = json_decode( $response['body'] );
     
    5454
    5555    // Test cases
    56     public $test_cases = array(
    57         array(
    58             'markup'        => 'http://www.twitch.tv/vanillatv/c/1537974',
    59             'expected'      => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
    60             'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
    61             'name'          => 'Video link'
    62         ),
    63         array(
    64             'markup'        => '<object bgcolor="#000000" data="http://www.twitch.tv/widgets/archive_embed_player.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/widgets/archive_embed_player.swf"><param name="allowScriptAccess" value="always"><param name="allowNetworking" value="all"><param name="allowFullScreen" value="true"><param name="flashvars" value="title=VanillaTV%2B-%2BSweden%2Bvs%2BRussia%2B-%2BETF2L%2BNations%2BCup%2B-%2BSnakewater%2B%255BMap3%255D%2B-%2BPart%2B3&amp;channel=vanillatv&amp;auto_play=false&amp;start_volume=25&amp;chapter_id=1537974"></object>',
    65             'expected'      => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
    66             'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
    67             'name'          => 'Flash embed'
    68         ),
    69     );
     56    public static function get_test_cases() {
     57        return array(
     58            array(
     59                'markup'        => 'http://www.twitch.tv/vanillatv/c/1537974',
     60                'expected'      => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
     61                'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
     62                'name'          => __( 'Video URL', 'video-thumbnails' )
     63            ),
     64            array(
     65                'markup'        => '<object bgcolor="#000000" data="http://www.twitch.tv/widgets/archive_embed_player.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/widgets/archive_embed_player.swf"><param name="allowScriptAccess" value="always"><param name="allowNetworking" value="all"><param name="allowFullScreen" value="true"><param name="flashvars" value="title=VanillaTV%2B-%2BSweden%2Bvs%2BRussia%2B-%2BETF2L%2BNations%2BCup%2B-%2BSnakewater%2B%255BMap3%255D%2B-%2BPart%2B3&amp;channel=vanillatv&amp;auto_play=false&amp;start_volume=25&amp;chapter_id=1537974"></object>',
     66                'expected'      => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
     67                'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
     68                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     69            ),
     70        );
     71    }
    7072
    7173}
  • video-thumbnails/tags/2.7/php/providers/class-video-thumbnails-providers.php

    r859638 r873686  
    8282    }
    8383
     84    /**
     85     * Constructs a WP_Error object after failed API retrieval
     86     * @param  string   $request  The URL wp_remote_get() failed to retrieve
     87     * @param  WP_Error $response A WP_Error object returned by the failed wp_remote_get()
     88     * @return WP_Error           An error object with a descriptive message including troubleshooting instructions
     89     */
     90    function construct_info_retrieval_error( $request, $response ) {
     91        $code = $this->service_slug . '_info_retrieval';
     92        $message = sprintf( __( 'Error retrieving video information from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $request ) . '<br />' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message();
     93        return new WP_Error( $code, $message );
     94    }
     95
    8496    // // Requires PHP 5.3.0+   
    8597    // public static function register_provider( $providers ) {
  • video-thumbnails/tags/2.7/php/providers/class-vimeo-thumbnails.php

    r862503 r873686  
    8888            $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    8989            if( is_wp_error( $response ) ) {
    90                 $result = new WP_Error( 'vimeo_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     90                $result = $this->construct_info_retrieval_error( $request, $response );
    9191            } elseif ( $response['response']['code'] == 404 ) {
    92                 $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 404 error.<br />Details: ' . $response['response']['message'] ) );
     92                $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 404 error.<br />Details: ' . $response['response']['message'], 'video-thumbnails' ) );
    9393            } elseif ( $response['response']['code'] == 403 ) {
    94                 $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 403 error.<br />This can occur when a video has embedding disabled or restricted to certain domains. Try entering API credentials in the provider settings.' ) );
     94                $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 403 error.<br />This can occur when a video has embedding disabled or restricted to certain domains. Try entering API credentials in the provider settings.', 'video-thumbnails' ) );
    9595            } else {
    9696                $result = json_decode( $response['body'] );
     
    102102
    103103    // Test cases
    104     public $test_cases = array(
    105         array(
    106             'markup'        => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
    107             'expected'      => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
    108             'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
    109             'name'          => 'iFrame'
    110         ),
    111         array(
    112             'markup'        => '<object width="500" height="281"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
    113             'expected'      => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
    114             'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
    115             'name'          => 'Old embed'
    116         ),
    117         array(
    118             'markup'        => 'https://vimeo.com/channels/soundworkscollection/44520894',
    119             'expected'      => 'http://b.vimeocdn.com/ts/313/130/313130530_640.jpg',
    120             'expected_hash' => 'e9fd72872a39272f6c540ee66b1ecf28',
    121             'name'          => 'Channel URL'
    122         ),
    123     );
     104    public static function get_test_cases() {
     105        return array(
     106            array(
     107                'markup'        => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
     108                'expected'      => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
     109                'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
     110                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     111            ),
     112            array(
     113                'markup'        => '<object width="500" height="281"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
     114                'expected'      => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
     115                'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
     116                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     117            ),
     118            array(
     119                'markup'        => 'https://vimeo.com/channels/soundworkscollection/44520894',
     120                'expected'      => 'http://b.vimeocdn.com/ts/313/130/313130530_640.jpg',
     121                'expected_hash' => 'e9fd72872a39272f6c540ee66b1ecf28',
     122                'name'          => __( 'Channel URL', 'video-thumbnails' )
     123            ),
     124        );
     125    }
    124126
    125127}
  • video-thumbnails/tags/2.7/php/providers/class-vine-thumbnails.php

    r837855 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'vine_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $doc = new DOMDocument();
     
    6161
    6262    // Test cases
    63     public $test_cases = array(
    64         array(
    65             'markup'        => '<iframe class="vine-embed" src="https://vine.co/v/bpj7Km0T3d5/embed/simple" width="600" height="600" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>',
    66             'expected'      => 'https://v.cdn.vine.co/v/thumbs/D6DDE013-F8DA-4929-9BED-49568F424343-184-00000008A20C1AEC_1.0.6.mp4.jpg',
    67             'expected_hash' => '7cca5921108abe15b8c1c1f884a5b3ac',
    68             'name'          => 'Embed/Video URL'
    69         ),
    70     );
     63    public static function get_test_cases() {
     64        return array(
     65            array(
     66                'markup'        => '<iframe class="vine-embed" src="https://vine.co/v/bpj7Km0T3d5/embed/simple" width="600" height="600" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>',
     67                'expected'      => 'https://v.cdn.vine.co/v/thumbs/D6DDE013-F8DA-4929-9BED-49568F424343-184-00000008A20C1AEC_1.0.6.mp4.jpg',
     68                'expected_hash' => '7cca5921108abe15b8c1c1f884a5b3ac',
     69                'name'          => __( 'iFrame Embed/Video URL', 'video-thumbnails' )
     70            ),
     71        );
     72    }
    7173
    7274}
  • video-thumbnails/tags/2.7/php/providers/class-vk-thumbnails.php

    r859790 r873686  
    4444        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4545        if( is_wp_error( $response ) ) {
    46             $result = new WP_Error( 'vk_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     46            $result = $this->construct_info_retrieval_error( $request, $response );
    4747        } else {
    4848            $doc = new DOMDocument();
     
    6161
    6262    // Test cases
    63     public $test_cases = array(
    64         array(
    65             'markup'        => '<iframe src="http://vk.com/video_ext.php?oid=157000410&id=164106383&hash=0fdb5f49218be7c2&hd=1" width="607" height="360" frameborder="0"></iframe>',
    66             'expected'      => 'http://cs513416.vk.me/u157000410/video/l_73b292cc.jpg',
    67             'expected_hash' => '6d4b086ff1a55c9b48f56bc7848e6c84',
    68             'name'          => 'iFrame'
    69         ),
    70     );
     63    public static function get_test_cases() {
     64        return array(
     65            array(
     66                'markup'        => '<iframe src="http://vk.com/video_ext.php?oid=157000410&id=164106383&hash=0fdb5f49218be7c2&hd=1" width="607" height="360" frameborder="0"></iframe>',
     67                'expected'      => 'http://cs513416.vk.me/u157000410/video/l_73b292cc.jpg',
     68                'expected_hash' => '6d4b086ff1a55c9b48f56bc7848e6c84',
     69                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     70            ),
     71        );
     72    }
    7173
    7274}
  • video-thumbnails/tags/2.7/php/providers/class-wistia-thumbnails.php

    r840515 r873686  
    6666        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    6767        if( is_wp_error( $response ) ) {
    68             $result = new WP_Error( 'wistia_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     68            $result = $this->construct_info_retrieval_error( $request, $response );
    6969        } else {
    7070            $result = json_decode( $response['body'] );
     
    7777
    7878    // Test cases
    79     public $test_cases = array(
    80         array(
    81             'markup'        => '<iframe src="http://fast.wistia.net/embed/iframe/po4utu3zde?controlsVisibleOnLoad=true&version=v1&videoHeight=360&videoWidth=640&volumeControl=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" width="640" height="360"></iframe>',
    82             'expected'      => 'https://embed-ssl.wistia.com/deliveries/6928fcba8355e38de4d95863a659e1de23cb2071.jpg',
    83             'expected_hash' => 'bc4a2cec9ac97e2ccdae2c7387a01cb4',
    84             'name'          => 'Inline player'
    85         ),
    86         array(
    87             'markup'        => '<div class=\'wistia_embed\' data-video-height=\'312\' data-video-width=\'499\' id=\'wistia_j1qd2lvys1\'></div> <script charset=\'ISO-8859-1\' src=\'http://fast.wistia.com/static/concat/E-v1.js\'></script> <script> var platform = ( Modernizr.touch ) ? "html5" : "flash"; wistiaEmbed = Wistia.embed("j1qd2lvys1", { version: "v1", videoWidth: 499, videoHeight: 312, playButton: Modernizr.touch, smallPlayButton: Modernizr.touch, playbar: Modernizr.touch, platformPreference: platform, chromeless: Modernizr.touch ? false : true, fullscreenButton: false, autoPlay: !Modernizr.touch, videoFoam: true }); </script>',
    88             'expected'      => 'https://embed-ssl.wistia.com/deliveries/a086707fe096e7f3fbefef1d1dcba1488d23a3e9.jpg',
    89             'expected_hash' => '4c63d131604bfc07b5178413ab245813',
    90             'name'          => 'JavaScript API embedding'
    91         ),
    92     );
     79    public static function get_test_cases() {
     80        return array(
     81            array(
     82                'markup'        => '<iframe src="http://fast.wistia.net/embed/iframe/po4utu3zde?controlsVisibleOnLoad=true&version=v1&videoHeight=360&videoWidth=640&volumeControl=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" width="640" height="360"></iframe>',
     83                'expected'      => 'https://embed-ssl.wistia.com/deliveries/6928fcba8355e38de4d95863a659e1de23cb2071.jpg',
     84                'expected_hash' => 'bc4a2cec9ac97e2ccdae2c7387a01cb4',
     85                'name'          => __( 'iFrame Embed', 'video-thumbnails' )
     86            ),
     87            array(
     88                'markup'        => '<div class=\'wistia_embed\' data-video-height=\'312\' data-video-width=\'499\' id=\'wistia_j1qd2lvys1\'></div> <script charset=\'ISO-8859-1\' src=\'http://fast.wistia.com/static/concat/E-v1.js\'></script> <script> var platform = ( Modernizr.touch ) ? "html5" : "flash"; wistiaEmbed = Wistia.embed("j1qd2lvys1", { version: "v1", videoWidth: 499, videoHeight: 312, playButton: Modernizr.touch, smallPlayButton: Modernizr.touch, playbar: Modernizr.touch, platformPreference: platform, chromeless: Modernizr.touch ? false : true, fullscreenButton: false, autoPlay: !Modernizr.touch, videoFoam: true }); </script>',
     89                'expected'      => 'https://embed-ssl.wistia.com/deliveries/a086707fe096e7f3fbefef1d1dcba1488d23a3e9.jpg',
     90                'expected_hash' => '4c63d131604bfc07b5178413ab245813',
     91                'name'          => __( 'JavaScript Embed', 'video-thumbnails' )
     92            ),
     93        );
     94    }
    9395
    9496}
  • video-thumbnails/tags/2.7/php/providers/class-youku-thumbnails.php

    r837855 r873686  
    4545        $response = wp_remote_get( $request, array( 'sslverify' => false ) );
    4646        if( is_wp_error( $response ) ) {
    47             $result = new WP_Error( 'youku_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     47            $result = $this->construct_info_retrieval_error( $request, $response );
    4848        } else {
    4949            $result = json_decode( $response['body'] );
     
    5454
    5555    // Test cases
    56     public $test_cases = array(
    57         array(
    58             'markup'        => '<embed src="http://player.youku.com/player.php/sid/XMzQyMzk5MzQ4/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" allowFullscreen="true" type="application/x-shockwave-flash"></embed>',
    59             'expected'      => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
    60             'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
    61             'name'          => 'Flash embed'
    62         ),
    63         array(
    64             'markup'        => 'http://v.youku.com/v_show/id_XMzQyMzk5MzQ4.html',
    65             'expected'      => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
    66             'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
    67             'name'          => 'Link'
    68         ),
    69     );
     56    public static function get_test_cases() {
     57        return array(
     58            array(
     59                'markup'        => '<embed src="http://player.youku.com/player.php/sid/XMzQyMzk5MzQ4/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" allowFullscreen="true" type="application/x-shockwave-flash"></embed>',
     60                'expected'      => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
     61                'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
     62                'name'          => __( 'Flash Embed', 'video-thumbnails' )
     63            ),
     64            array(
     65                'markup'        => 'http://v.youku.com/v_show/id_XMzQyMzk5MzQ4.html',
     66                'expected'      => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
     67                'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
     68                'name'          => __( 'Video URL', 'video-thumbnails' )
     69            ),
     70        );
     71    }
    7072
    7173}
  • video-thumbnails/tags/2.7/php/providers/class-youtube-thumbnails.php

    r840515 r873686  
    5656
    5757    // Test cases
    58     public $test_cases = array(
    59         array(
    60             'markup'        => '<iframe width="560" height="315" src="http://www.youtube.com/embed/Fp0U2Vglkjw" frameborder="0" allowfullscreen></iframe>',
    61             'expected'      => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
    62             'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
    63             'name'          => 'iFrame HD'
    64         ),
    65         array(
    66             'markup'        => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
    67             'expected'      => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
    68             'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
    69             'name'          => 'Old embed HD'
    70         ),
    71         array(
    72             'markup'        => '<iframe width="560" height="315" src="http://www.youtube.com/embed/vv_AitYPjtc" frameborder="0" allowfullscreen></iframe>',
    73             'expected'      => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
    74             'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
    75             'name'          => 'iFrame SD'
    76         ),
    77         array(
    78             'markup'        => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
    79             'expected'      => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
    80             'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
    81             'name'          => 'Old embed SD'
    82         ),
    83     );
     58    public static function get_test_cases() {
     59        return array(
     60            array(
     61                'markup'        => '<iframe width="560" height="315" src="http://www.youtube.com/embed/Fp0U2Vglkjw" frameborder="0" allowfullscreen></iframe>',
     62                'expected'      => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
     63                'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
     64                'name'          => __( 'iFrame Embed HD', 'video-thumbnails' )
     65            ),
     66            array(
     67                'markup'        => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
     68                'expected'      => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
     69                'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
     70                'name'          => __( 'Flash Embed HD', 'video-thumbnails' )
     71            ),
     72            array(
     73                'markup'        => '<iframe width="560" height="315" src="http://www.youtube.com/embed/vv_AitYPjtc" frameborder="0" allowfullscreen></iframe>',
     74                'expected'      => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
     75                'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
     76                'name'          => __( 'iFrame Embed SD', 'video-thumbnails' )
     77            ),
     78            array(
     79                'markup'        => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
     80                'expected'      => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
     81                'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
     82                'name'          => __( 'Flash Embed SD', 'video-thumbnails' )
     83            ),
     84        );
     85    }
    8486
    8587}
  • video-thumbnails/tags/2.7/readme.txt

    r869386 r873686  
    55Requires at least: 3.2
    66Tested up to: 3.8.1
    7 Stable tag: 2.6.3
     7Stable tag: 2.7
    88
    99Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
     
    118118
    119119== Changelog ==
     120
     121= 2.7 =
     122* Video Thumbnails is now translation ready and looking for volunteers
    120123
    121124= 2.6.3 =
  • video-thumbnails/tags/2.7/video-thumbnails.php

    r869386 r873686  
    66Author: Sutherland Boswell
    77Author URI: http://sutherlandboswell.com
    8 Version: 2.6.3
     8Version: 2.7
    99License: GPL2
     10Text Domain: video-thumbnails
     11Domain Path: /languages/
    1012*/
    1113/*  Copyright 2014 Sutherland Boswell  (email : [email protected])
     
    2931define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
    3032define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
    31 define( 'VIDEO_THUMBNAILS_VERSION', '2.6.3' );
     33define( 'VIDEO_THUMBNAILS_VERSION', '2.7' );
    3234
    3335// Providers
     
    4850
    4951    function __construct() {
     52
     53        // Load translations
     54        add_action( 'plugins_loaded', array( &$this, 'plugin_textdomain' ));
    5055
    5156        // Create provider array
     
    8691
    8792    /**
     93     * Load language files
     94     */
     95    function plugin_textdomain() {
     96        load_plugin_textdomain( 'video-thumbnails', false, VIDEO_THUMBNAILS_PATH . '/languages/' );
     97    }
     98
     99    /**
    88100     * Adds the admin menu items
    89101     */
    90102    function admin_menu() {
    91         add_management_page( 'Bulk Video Thumbnails', 'Bulk Video Thumbs', 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
     103        add_management_page( __( 'Bulk Video Thumbnails', 'video-thumbnails' ), __( 'Bulk Video Thumbs', 'video-thumbnails' ), 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
    92104    }
    93105
     
    96108        if ( 'tools_page_video-thumbnails-bulk' == $hook ) {
    97109            wp_enqueue_script( 'video-thumbnails-bulk-js', plugins_url( '/js/bulk.js' , __FILE__ ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
     110            wp_localize_script( 'video-thumbnails-bulk-js', 'video_thumbnails_bulk_language', array(
     111                'working'              => __( 'Working...', 'video-thumbnails' ),
     112                'started'              => __( 'Started Scanning', 'video-thumbnails' ),
     113                'resumed'              => __( 'Resumed Scanning', 'video-thumbnails' ),
     114                'paused'               => __( 'Paused Scanning', 'video-thumbnails' ),
     115                'done'                 => __( 'Done!', 'video-thumbnails' ),
     116                'final_count_singular' => __( 'Scanned 1 post', 'video-thumbnails' ),
     117                'final_count_plural'   => __( 'Scanned %d posts', 'video-thumbnails' ),
     118                'queue_singular'       => __( '1 post in queue', 'video-thumbnails' ),
     119                'queue_plural'         => __( '%d posts in queue', 'video-thumbnails' ),
     120                'scanning_of'          => __( 'Scanning %1$s of %2$s', 'video-thumbnails' ),
     121                'no_thumbnail'         => __( 'No thumbnail', 'video-thumbnails' ),
     122                'new_thumbnail'        => __( 'New thumbnail:', 'video-thumbnails' ),
     123                'existing_thumbnail'   => __( 'Existing thumbnail:', 'video-thumbnails' ),
     124                'error'                => __( 'Error:', 'video-thumbnails' ),
     125            ) );
    98126            wp_enqueue_style( 'video-thumbnails-bulk-css', plugins_url('/css/bulk.css', __FILE__), false, VIDEO_THUMBNAILS_VERSION );
    99127        }
     
    116144        ?>
    117145        <div id="video-thumbnail-not-found-troubleshooting" style="display:none;">
    118             <h2><?php _e( 'Troubleshooting Video Thumbnails' ); ?></h2>
     146            <h2><?php _e( 'Troubleshooting Video Thumbnails', 'video-thumbnails' ); ?></h2>
    119147            <?php $this->no_video_thumbnail_troubleshooting_instructions(); ?>
    120148        </div>
     
    128156        if ( get_post_status() == 'publish' || get_post_status() == 'private' ) {
    129157            if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
    130                 echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">Reset Video Thumbnail</a></p>';
     158                echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Reset Video Thumbnail', 'video-thumbnails' ) . '</a></p>';
    131159            } else {
    132                 echo '<p id="video-thumbnails-preview">No video thumbnail for this post.</p>';
    133                 echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">Search Again</a> <a href="#TB_inline?width=400&height=600&inlineId=video-thumbnail-not-found-troubleshooting" class="thickbox" style="float:right;">Troubleshoot<a/></p>';
     160                echo '<p id="video-thumbnails-preview">' . __( 'No video thumbnail for this post.', 'video-thumbnails' ) . '</p>';
     161                echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Search Again', 'video-thumbnails' ) . '</a> <a href="#TB_inline?width=400&height=600&inlineId=video-thumbnail-not-found-troubleshooting" class="thickbox" style="float:right;">' . __( 'Troubleshoot', 'video-thumbnails' ) . '<a/></p>';
    134162            }
    135163        } else {
    136164            if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
    137                 echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">Reset Video Thumbnail</a></p>';
     165                echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Reset Video Thumbnail', 'video-thumbnails' ) . '</a></p>';
    138166            } else {
    139                 echo '<p>A video thumbnail will be found for this post when it is published.</p>';
     167                echo '<p>' . __( 'A video thumbnail will be found for this post when it is published.', 'video-thumbnails' ) . '</p>';
    140168            }
    141169        }
     
    147175    public static function no_video_thumbnail_troubleshooting_instructions() {
    148176        ?>
    149         <h3>Fixing "No video thumbnail for this post"</h3>
     177        <h3><?php _e( 'Fixing "No video thumbnail for this post"', 'video-thumbnails' ); ?></h3>
    150178        <ol>
    151             <li>Ensure you have saved any changes to your post.</li>
    152             <li>If you are using a a plugin or theme that stores videos in a special location other than the main post content area, be sure you've entered the correct custom field on the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails' ); ?>">settings page</a>. If you don't know the name of the field your video is being saved in, please contact the developer of that theme or plugin.</li>
    153             <li>Copy and paste your embed code into the "Test Markup for Video" section of the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ); ?>">Debugging page</a>. If this doesn't find the thumbnail, you'll want to be sure to include the embed code you scanned when you request support. If it does find a thumbnail, please double check that you have the Custom Field set correctly in the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails' ); ?>">settings page</a> if you are using a a plugin or theme that stores videos in a special location.</li>
    154             <li>Go to the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ); ?>">Debugging page</a> and click "Test Image Downloading" to test your server's ability to save an image from a video source.</li>
    155             <li>Try posting a video from other sources to help narrow down the problem.</li>
    156             <li>Search the <a href="http://wordpress.org/support/plugin/video-thumbnails">support threads</a> to see if anyone has had the same issue.</li>
    157             <li>If you are still unable to resolve the problem, <a href="http://wordpress.org/support/plugin/video-thumbnails">start a thread</a> with a <strong>good descriptive</strong> title ("Error" or "No thumbnails" is a <strong>bad</strong> title) and be sure to include the results of your testing as well. Also be sure to include the <strong>name of your theme</strong>, any <strong>video plugins</strong> you're using, and any other details you can think of.</li>
     179            <li><?php _e( 'Ensure you have saved any changes to your post.', 'video-thumbnails' ); ?></li>
     180            <li><?php echo sprintf( __( 'If you are using a a plugin or theme that stores videos in a special location other than the main post content area, be sure you\'ve entered the correct custom field on the <a href="%s">settings page</a>. If you don\'t know the name of the field your video is being saved in, please contact the developer of that theme or plugin.', 'video-thumbnails' ), admin_url( 'options-general.php?page=video_thumbnails' ) ); ?></li>
     181            <li><?php echo sprintf( __( 'Copy and paste your embed code into the "Test Markup for Video" section of the <a href="%1$s">Debugging page</a>. If this doesn\'t find the thumbnail, you\'ll want to be sure to include the embed code you scanned when you request support. If it does find a thumbnail, please double check that you have the Custom Field set correctly in the <a href="%2$s">settings page</a> if you are using a a plugin or theme that stores videos in a special location.', 'video-thumbnails' ), admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ), admin_url( 'options-general.php?page=video_thumbnails' ) ); ?></li>
     182            <li><?php echo sprintf( __( 'Go to the <a href="%s">Debugging page</a> and click "Test Image Downloading" to test your server\'s ability to save an image from a video source.', 'video-thumbnails' ), admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ) ); ?></li>
     183            <li><?php _e( 'Try posting a video from other sources to help narrow down the problem.', 'video-thumbnails' ); ?></li>
     184            <li><?php _e( 'Search the <a href="http://wordpress.org/support/plugin/video-thumbnails">support threads</a> to see if anyone has had the same issue.', 'video-thumbnails' ); ?></li>
     185            <li><?php _e( 'If you are still unable to resolve the problem, <a href="http://wordpress.org/support/plugin/video-thumbnails">start a thread</a> with a <strong>good descriptive</strong> title ("Error" or "No thumbnails" is a <strong>bad</strong> title) and be sure to include the results of your testing as well. Also be sure to include the <strong>name of your theme</strong>, any <strong>video plugins</strong> you\'re using, and any other details you can think of.', 'video-thumbnails' ); ?></li>
    158186        </ol>
    159187        <?php
     
    316344        $response = wp_remote_get( $image_url, array( 'sslverify' => false ) );
    317345        if( is_wp_error( $response ) ) {
    318             $error = new WP_Error( 'thumbnail_retrieval', __( 'Error retrieving a thumbnail from the URL <a href="' . $image_url . '">' . $image_url . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
     346            $error = new WP_Error( 'thumbnail_retrieval', sprintf( __( 'Error retrieving a thumbnail from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $image_url ) . '<br>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message() );
    319347        } else {
    320348            $image_contents = $response['body'];
     
    334362                $image_extension = '.gif';
    335363            } else {
    336                 return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:' ) . ' ' . $image_type );
     364                return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
    337365            }
    338366
     
    347375            // Stop for any errors while saving the data or else continue adding the image to the media library
    348376            if ( $upload['error'] ) {
    349                 $error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:' ) . ' ' . $upload['error'] );
     377                $error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
    350378                return $error;
    351379            } else {
     
    391419        echo '    post_id: id' . PHP_EOL;
    392420        echo '  };' . PHP_EOL;
    393         echo '  document.getElementById(\'video-thumbnails-preview\').innerHTML=\'Working... <img src="' . home_url( 'wp-admin/images/loading.gif' ) . '"/>\';' . PHP_EOL;
     421        echo '  document.getElementById(\'video-thumbnails-preview\').innerHTML=\'' . __( 'Working...', 'video-thumbnails' ) . ' <img src="' . home_url( 'wp-admin/images/loading.gif' ) . '"/>\';' . PHP_EOL;
    394422        echo '  jQuery.post(ajaxurl, data, function(response){' . PHP_EOL;
    395423        echo '    document.getElementById(\'video-thumbnails-preview\').innerHTML=response;' . PHP_EOL;
     
    414442            echo '<img src="' . $video_thumbnail . '" style="max-width:100%;" />';
    415443        } else {
    416             echo 'No video thumbnail for this post.';
     444            echo __( 'No video thumbnail for this post.', 'video-thumbnails' );
    417445        }
    418446
     
    469497
    470498        if ( ! current_user_can( 'manage_options' ) ) {
    471             wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
     499            wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
    472500        }
    473501
     
    475503        <div class="wrap">
    476504
    477             <div id="icon-tools" class="icon32"></div><h2>Bulk Video Thumbnail Generator</h2>
    478 
    479             <p>Use this tool to scan all of your posts for Video Thumbnails.</p>
     505            <div id="icon-tools" class="icon32"></div><h2><?php _e( 'Bulk Video Thumbnail Generator', 'video-thumbnails' ); ?></h2>
     506
     507            <p><?php _e( 'Use this tool to scan all of your posts for Video Thumbnails.', 'video-thumbnails' ); ?></p>
    480508
    481509            <form id="video-thumbnails-bulk-scan-options">
     
    486514                            <th scope="row"><span id="queue-count">...</span></th>
    487515                            <td>
    488                                 <input type="submit" value="Scan Now" class="button button-primary">
     516                                <input type="submit" value="<?php esc_attr_e( 'Scan Now', 'video-thumbnails' ); ?>" class="button button-primary">
    489517                            </td>
    490518                        </tr>
     
    498526                    <div class="progress-bar">&nbsp;</div>
    499527                </div>
    500                 <div class="stats">
    501                     <div class="scanned"></div>
    502                     <div class="found"></div>
    503                 </div>
     528                <table class="stats">
     529                    <thead>
     530                        <tr>
     531                            <th><?php _e( 'Scanned', 'video-thumbnails' ); ?></th>
     532                            <th><?php _e( 'New Thumbnails', 'video-thumbnails' ); ?></th>
     533                            <th><?php _e( 'Existing', 'video-thumbnails' ); ?></th>
     534                        </tr>
     535                    </thead>
     536                    <tr>
     537                        <td class="scanned">0</td>
     538                        <td class="found-new">0</td>
     539                        <td class="found-existing">0</td>
     540                    </tr>
     541                </table>
    504542                <ul class="log"></ul>
    505543            </div>
  • video-thumbnails/trunk/readme.txt

    r869386 r873686  
    55Requires at least: 3.2
    66Tested up to: 3.8.1
    7 Stable tag: 2.6.3
     7Stable tag: 2.7
    88
    99Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
     
    118118
    119119== Changelog ==
     120
     121= 2.7 =
     122* Video Thumbnails is now translation ready and looking for volunteers
    120123
    121124= 2.6.3 =
  • video-thumbnails/trunk/video-thumbnails.php

    r870830 r873686  
    66Author: Sutherland Boswell
    77Author URI: http://sutherlandboswell.com
    8 Version: 2.6.3
     8Version: 2.7
    99License: GPL2
    1010Text Domain: video-thumbnails
     
    3131define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
    3232define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
    33 define( 'VIDEO_THUMBNAILS_VERSION', '2.6.3' );
     33define( 'VIDEO_THUMBNAILS_VERSION', '2.7' );
    3434
    3535// Providers
     
    5050
    5151    function __construct() {
     52
     53        // Load translations
     54        add_action( 'plugins_loaded', array( &$this, 'plugin_textdomain' ));
    5255
    5356        // Create provider array
     
    8588        add_action('wp_ajax_video_thumbnails_get_thumbnail_for_post', array( &$this, 'get_thumbnail_for_post_callback' ) );
    8689
     90    }
     91
     92    /**
     93     * Load language files
     94     */
     95    function plugin_textdomain() {
     96        load_plugin_textdomain( 'video-thumbnails', false, VIDEO_THUMBNAILS_PATH . '/languages/' );
    8797    }
    8898
Note: See TracChangeset for help on using the changeset viewer.