Making WordPress.org

Changeset 8458


Ignore:
Timestamp:
03/13/2019 03:18:18 AM (6 years ago)
Author:
dd32
Message:

WordPress.TV: Remove support for outdated video embeds we no longer support or use.

No current video on WordPress.tv is impacted by this, all videos have been moved to videopress embeds.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.tv/public_html/wp-content/themes/wptv2/functions.php

    r8457 r8458  
    568568
    569569    /**
    570      * Get VodPod Thumbnails, used by the_video_image
    571      *
    572      * @param string $code
    573      * @return string
    574      */
    575     function get_vodpod_thumbnails( $code ) {
    576         preg_match( '/((Groupvideo|ExternalVideo).[0-9]+)/', $code, $matches );
    577         $id = $matches[1];
    578 
    579         if ( ! $id ) {
    580             return get_template_directory_uri() . '/i/notfound.png';
    581         }
    582 
    583         // Argh!!
    584         $xml = file_get_contents( 'http://api.vodpod.com/api/video/details.xml?video_id=' . $id . '&api_key=03519ea5faf6a6ed' );
    585 
    586         if ( preg_match( '/<large>(.*)<\/large>/', $xml, $thevideoid ) ) {
    587             return $thevideoid[1];
    588         } else {
    589             return get_template_directory_uri() . '/i/notfound.png';
    590         }
    591     }
    592 
    593     /**
    594570     * Renders the video or a video thumbnail
    595571     *
     
    623599                $video      = apply_filters( 'the_content', $video );
    624600            }
    625         }
    626 
    627         // SlideShare
    628         preg_match_all( '|\[slideshare (.+?)]|ie', $post->post_content, $matches );
    629         foreach ( $matches[1] as $key => $code ) {
    630             $code = '[slideshare ' . $code . ']';
    631             if ( $thumb ) {
    632                 preg_match( '/id=([0-9]+).*/', $code, $matches );
    633                 $id    = $matches[1];
    634                 $ssxml = file_get_contents( 'https://www.slideshare.net/api/2/get_slideshow/?slideshow_id=' . $id . '&api_key=sM0rzJvp&ts=' . time() . '&hash=' . sha1( 'vHs2uii6' . time() ) );
    635                 preg_match( '/<ThumbnailURL>(.+)<\/ThumbnailURL>/', $ssxml, $matches );
    636                 $image = $matches[1];
    637             } else {
    638                 $slideshare = apply_filters( 'the_content', $code );
    639                 $slideshare = preg_replace( '/height\=\'[0-9]+?\'/', "height='430'", $slideshare );
    640                 $video      = str_replace( "width='425'", "width='648'", $slideshare );
    641             }
    642         }
    643 
    644         // VodPod
    645         preg_match_all( '|\[vodpod (.+?)]|ie', $post->post_content, $matches );
    646         foreach ( $matches[1] as $key => $code ) {
    647             $code   = '[vodpod ' . $code . ']';
    648             $vodpod = apply_filters( 'the_content', $code );
    649             $id     = trim( str_replace( '</div>','', preg_replace( '/.*key\=([^&]+)&.*/', '$1', $vodpod ) ) );
    650 
    651             $image = $this->get_vodpod_thumbnails( $code );
    652             $video = $vodpod;
    653601        }
    654602
     
    686634            $guid = $m[1];
    687635            $ret = video_image_url_by_guid( $guid, 'fmt_dvd' );
    688         }
    689 
    690         preg_match_all( '|\[wporg-screencast (.+?)]|ie', $post->post_content, $matches );
    691         foreach ( $matches[1] as $key => $code ) {
    692             $wporg = apply_filters( 'the_content', '[wporg-screencast ' . $code . ']' );
    693             $ret   = $wporg;
    694         }
    695 
    696         preg_match_all( '|\[slideshare (.+?)]|ie', $post->post_content, $matches );
    697         foreach ( $matches[1] as $key => $code ) {
    698             $code = '[slideshare ' . $code . ']';
    699 
    700             preg_match( '/id=([0-9]+).*/', $code, $matches );
    701             $id    = $matches[1];
    702             $url   = 'https://www.slideshare.net/api/2/get_slideshow/?slideshow_id=' . $id . '&api_key=sM0rzJvp&ts=' . time() . '&hash=' . sha1( 'vHs2uii6' . time() );
    703             $ssxml = wp_remote_retrieve_body( wp_remote_get( esc_url_raw( $url ) ) );
    704             preg_match( '/<ThumbnailURL>(.+)<\/ThumbnailURL>/', $ssxml, $matches );
    705             $ret = $matches[1];
    706         }
    707 
    708         preg_match_all( '|\[vodpod (.+?)]|ie', $post->post_content, $matches );
    709         foreach ( $matches[1] as $key => $code ) {
    710             $code = '[vodpod ' . $code . ']';
    711             $ret  = $this->get_vodpod_thumbnails( $code );
    712636        }
    713637
Note: See TracChangeset for help on using the changeset viewer.