PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-content/plugins/broken-link-checker/modules/extras/vimeo-embed.php

https://bitbucket.org/lgorence/quickpress
PHP | 49 lines | 28 code | 8 blank | 13 comment | 4 complexity | 79c04f9741bb95479b5689a2dc693d66 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.0
  1. <?php
  2. /*
  3. Plugin Name: Embedded Vimeo videos
  4. Description: Parse embedded videos from Vimeo
  5. Version: 1.0
  6. Author: Janis Elsts
  7. ModuleCategory: parser
  8. ModuleClassName: blcVimeoEmbed
  9. ModuleContext: on-demand
  10. ModuleLazyInit: true
  11. */
  12. if ( !class_exists('blcEmbedParserBase') ){
  13. require 'embed-parser-base.php';
  14. }
  15. class blcVimeoEmbed extends blcEmbedParserBase {
  16. var $supported_formats = array('html');
  17. function init(){
  18. parent::init();
  19. $this->url_search_string = 'vimeo.com/moogaloop.swf?';
  20. $this->short_title = __('Vimeo Video', 'broken-link-checker');
  21. $this->long_title = __('Embedded Vimeo video', 'broken-link-checker');
  22. }
  23. function link_url_from_src($src){
  24. //Extract video ID from the SRC
  25. $components = @parse_url($src);
  26. if ( empty($components['query']) ) {
  27. return '';
  28. }
  29. parse_str($components['query'], $query);
  30. if ( empty($query['clip_id']) ){
  31. return '';
  32. } else {
  33. $video_id = $query['clip_id'];
  34. }
  35. //Reconstruct the video permalink based on the ID
  36. $url = 'http://vimeo.com/'.$video_id;
  37. return $url;
  38. }
  39. }
  40. ?>