/wp-content/plugins/broken-link-checker/modules/extras/youtube-embed.php
PHP | 40 lines | 18 code | 7 blank | 15 comment | 1 complexity | 6c13c8b447abbd787d7dba93489434cb MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
- <?php
- /*
- Plugin Name: Embedded YouTube videos (old embed code)
- Description: Parse embedded videos from YouTube
- Version: 1.0
- Author: Janis Elsts
- ModuleCategory: parser
- ModuleClassName: blcYouTubeEmbed
- ModuleContext: on-demand
- ModuleLazyInit: true
- ModulePriority: 110
- */
- if ( !class_exists('blcEmbedParserBase') ){
- require 'embed-parser-base.php';
- }
- class blcYouTubeEmbed extends blcEmbedParserBase {
-
- function init(){
- parent::init();
- $this->short_title = __('YouTube Video', 'broken-link-checker');
- $this->long_title = __('Embedded YouTube video', 'broken-link-checker');
- $this->url_search_string = 'youtube.com/v/';
- }
-
- function link_url_from_src($src){
- //Extract video ID from the SRC. The ID is always 11 characters.
- $video_id = substr( end(explode('/', $src)), 0, 11 );
-
- //Reconstruct the video permalink based on the ID
- $url = 'http://www.youtube.com/watch?v='.$video_id;
-
- return $url;
- }
- }
- ?>