Advertisement
Nenesse

my-videotag.php_v0.3

May 17th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 29.41 KB | None | 0 0
  1. <?php /*
  2. **************************************************************************
  3.  
  4. Plugin Name: My Videotag
  5. Plugin URI: http://toxigeek.com/plugin-my-videotag
  6. Description: This Plugin will add a Tag called "video", which automatically identifies videos from sites like: youtube, googlevideo, dailymotion, metacafe, myspace, yahoo, megavideo, vimeo, tu.tv, etc... and add them to your Wordpress post.
  7. Version: 1.1.1
  8. Author: giObanii
  9. Author URI: http://toxigeek.com
  10. @copyright Copyright (c) 2010, giObanii
  11.  
  12. *************************************************************************
  13.  
  14. Copyright (C) 2010 giObanii
  15.  
  16. This program is free software: you can redistribute it and/or modify
  17. it under the terms of the GNU General Public License as published by
  18. the Free Software Foundation, either version 3 of the License, or
  19. (at your option) any later version.
  20.  
  21. This program is distributed in the hope that it will be useful,
  22. but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. GNU General Public License for more details.
  25.  
  26. You should have received a copy of the GNU General Public License
  27. along with this program. If not, see <http://www.gnu.org/licenses/>.
  28.  
  29. **************************************************************************/
  30.  
  31. function mvt_url( $path = '' ) {
  32. global $wp_version;
  33. if ( version_compare( $wp_version, '3.0', '<' ) ) { // Using WordPress 3.0
  34. $folder = dirname( plugin_basename( __FILE__ ) );
  35. if ( '.' != $folder )
  36. $path = path_join( ltrim( $folder, '/' ), $path );
  37.  
  38. return plugins_url( $path );
  39. }
  40. return plugins_url( $path, __FILE__ );
  41. }
  42. //on activation, your My VideoTag options will be populated. Here a single option is used which is actually an array of multiple options
  43. function activate_mvt() {
  44. $mvt_opts1 = get_option('mvt_options');
  45. $mvt_opts2 =array('width' => '640',
  46. 'height' => '390');
  47. if ($mvt_opts1) {
  48. $mvt = $mvt_opts1 + $mvt_opts2;
  49. update_option('mvt_options',$mvt);
  50. }
  51. else {
  52. $mvt_opts1 = array();
  53. $mvt = $mvt_opts1 + $mvt_opts2;
  54. add_option('mvt_options',$mvt);
  55. }
  56. }
  57.  
  58. register_activation_hook( __FILE__, 'activate_mvt' );
  59. global $mvt;
  60. $mvt = get_option('mvt_options');
  61. define("MVT_VER","1.1.1",false);
  62. define('MVT_URLPATH', trailingslashit( WP_PLUGIN_URL . '/' . plugin_basename( dirname(__FILE__) ) ) );
  63. include_once (dirname (__FILE__) . '/tinymce/tinymce.php');
  64. //External CSS in the header
  65. //function mvt_scripts_styles() {
  66. //global $mvt;
  67. // wp_enqueue_style( 'mvt_css_file', mvt_url( 'css/mvt.css' ),
  68. // false, MVT_VER, 'all');
  69. //}
  70. // add_action( 'init', 'mvt_scripts_styles' );
  71.  
  72. // function for adding settings page to wp-admin
  73. function mvt_settings() {
  74. // Add a new submenu under Options:
  75. add_options_page('Settings', 'My VideoTag', 9, basename(__FILE__), 'mvt_settings_page');
  76. }
  77.  
  78. // This function displays the page content for the My VideoTag Options submenu
  79. function mvt_settings_page() {
  80. ?>
  81. <div class="wrap">
  82. <h2>My VideoTag Settings</h2>
  83. <strong>Supported Sites:</strong> youtube, googlevideo, dailymotion, metacafe, myspace, yahoo, megavideo, vimeo, gamevideos, tu.tv, godtube, myvideo, collegehumor, comedycentral, colbertnation, revver, de.sevenload, clipfish ... Soon more.
  84.  
  85. <div style="clear:both;"></div>
  86. <form method="post" action="options.php">
  87. <div id="poststuff" class="metabox-holder has-right-sidebar">
  88.  
  89. <div style="float:left;width:55%;">
  90. <?php
  91. settings_fields('mvt-group');
  92. $mvt = get_option('mvt_options');
  93. ?>
  94. <h2>Dimensions of the videos</h2>
  95. <p>Enter the dimensions of the videos depending upon the width of your theme</p>
  96.  
  97. <table class="form-table">
  98.  
  99. <tr valign="top">
  100. <th scope="row"><label for="mvt_options[width]">Width</label></th>
  101. <td><input type="text" name="mvt_options[width]" class="small-text" value="<?php echo $mvt['width']; ?>" />&nbsp;px</td>
  102. </tr>
  103.  
  104. <tr valign="top">
  105. <th scope="row"><label for="mvt_options[height]">Height</label></th>
  106. <td><input type="text" name="mvt_options[height]" class="small-text" value="<?php echo $mvt['height']; ?>" />&nbsp;px</td>
  107. </tr>
  108. </table>
  109.  
  110. <p class="submit">
  111. <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
  112. </p>
  113.  
  114. </div>
  115.  
  116. <style>
  117. #twitter {clear: both;height: auto;width: auto;}
  118. #twitterinner {padding: 5px;}
  119. #twitter #twitter-heading {clear: both;height: 39px;width: auto;background-image: url(<?php echo MVT_URLPATH ?>images/twitter.png);background-repeat: no-repeat;background-position: left top;padding-top: 0px;padding-right: 0px;padding-bottom: 5px;padding-left: 55px;font-size: 10px;border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #d5d5d5;margin-top: 5px;margin-right: 0px;margin-bottom: 0px;margin-left: 0px;line-height: 39px;font-weight: bold;}
  120. #twitter #twitter-heading a {color: #00CCFF;text-decoration: none;text-transform: uppercase;}
  121. #twitter #twitter-heading a:hover {text-decoration: underline;}
  122. #twitter_update_list {width: auto;clear: both;height: auto;margin: 0px;padding: 5px;}
  123. #twitter_update_list p {width: 100%;display: block;clear: both;height: auto;font-size: 10px;line-height: 14px;margin-top: 0px;margin-right: 0px;margin-bottom: 5px;margin-left: 0px;border-bottom-width: 1px;border-bottom-style: solid;border-bottom-color: #d5d5d5;padding-top: 0px;padding-right: 0px;padding-bottom: 5px;padding-left: 0px;}
  124. #twitter_update_list span {margin: 0px;padding: 0px;}
  125. #twitter_update_list a {color: #00CCFF;text-decoration: none;font-weight: bold;}
  126. #twitter_update_list a:hover {text-decoration: underline;}
  127. #twitter_update_list li {list-style: none outside none;}
  128. </style>
  129.  
  130. <div id="side-info-column" class="inner-sidebar">
  131. <div class="postbox">
  132. <h3 class="hndle"><span>About this Plugin:</span></h3>
  133. <div class="inside">
  134. <ul>
  135. <li><a href="http://toxigeek.com/" title="Author Page" >About the Author</a></li>
  136. <li><a href="http://toxigee.com/plugin-my-videotag" title="My VideoTag" >Plugin Homepage</a></li>
  137. <li><a href="http://wordpress.org/extend/plugins/my-videotag/" title="" >Wordpress plugin site</a></li>
  138. <li><a href="http://toxigeek.com/help/support-plugins-group7/my-videotag-youtube-googlevideo-dailymotion-etc-forum9" title="Support Plugin" >Support Plugin</a></li>
  139. <li></li>
  140. <li><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=3motronik%40gmail%2ecom&lc=US&item_name=Plugin%20My%2dVideoTag&no_note=0&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHostedGuest" target="_blank" rel="nofollow"><img src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" /></a></li>
  141. </ul>
  142. </div>
  143. </div>
  144. </div>
  145.  
  146. <div id="side-info-column" class="inner-sidebar">
  147. <div class="postbox">
  148. <h3 class="hndle"><span>What's New in My Twitter!:</span></h3>
  149. <div class="inside">
  150. <div id="twitter">
  151. <div id="twitter-heading">Follow to <a href="http://twitter.com/giObanii" target="_blank">giObanii</a> on Twitter</div>
  152. <div id="twitter_update_list">
  153. <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
  154. <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/giObanii.json?callback=twitterCallback2&amp;count=3"></script>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159.  
  160. </div> <!--end of poststuff -->
  161.  
  162. </form>
  163. </div> <!--end of float wrap -->
  164. <?php
  165. }
  166. // Hook for adding admin menus
  167. if ( is_admin() ){ // admin actions
  168. add_action('admin_menu', 'mvt_settings');
  169. add_action( 'admin_init', 'register_mvt_settings' );
  170. }
  171. function register_mvt_settings() { // whitelist options
  172. register_setting( 'mvt-group', 'mvt_options' );
  173. }
  174.  
  175.  
  176. // Shortcode *******************
  177. class MyTagVideo {
  178. function MyTagVideo() {
  179. if ( !function_exists('add_shortcode') ) return;
  180. add_shortcode( 'video' , array(&$this, 'shortcode_video') );
  181. }
  182. function attributefix( $atts = array() ) {
  183. if ( empty($atts[0]) ) return $atts;
  184. if ( 0 !== preg_match( '#=("|\')(.*?)("|\')#', $atts[0], $match ) )
  185. $atts[0] = $match[2];
  186. return $atts;
  187. }
  188. function shortcode_video( $atts = array(), $content = NULL ) {
  189. if ( NULL === $content ) return '';
  190. return '' .get_video($content). '';
  191. }
  192. }
  193. add_action( 'plugins_loaded', create_function( '', 'global $MyTagVideo; $MyTagVideo = new MyTagVideo();' ) );
  194.  
  195. function get_video($content){
  196. global $mvt;
  197. $values = array (
  198. //youtube.com
  199. array('/youtube.*v=([^&]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://www.youtube.com/v/{ID_VIDEO}&feature=player_embedded&version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/{ID_VIDEO}&feature=player_embedded&version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="'.$mvt['width'].'" height="'.$mvt['height'].'"></embed></object>'),
  200.  
  201. array('/youtube.*?p=(.*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://www.youtube.com/p/{ID_VIDEO}?hl=es_ES&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/p/{ID_VIDEO}?hl=es_ES&fs=1" type="application/x-shockwave-flash" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowscriptaccess="always" allowfullscreen="true"></embed></object>'),
  202.  
  203. //video.google.com
  204. array('/video.google.*docid=([^&]*)/i', '<embed id="VideoPlayback" style="width:'.$mvt['width'].'px;height:'.$mvt['height'].'px" allowFullScreen="true" flashvars="fs=true" src="http://video.google.com/googleplayer.swf?docid={ID_VIDEO}" type="application/x-shockwave-flash"></embed>'),
  205.  
  206. //dailymotion.com
  207. array('/dailymotion\.com\/video\/([^_]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://www.dailymotion.com/swf/video/{ID_VIDEO}?additionalInfos=0"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/{ID_VIDEO}?additionalInfos=0" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowfullscreen="true" allowscriptaccess="always"></embed></object>'),
  208.  
  209. //metacafe.com
  210. array('/metacafe\.com\/watch\/(.*)/i', '<div style="background:#000000;width:'.$mvt['width'].'px;height:'.$mvt['height'].'px"><embed flashVars="playerVars=showStats=yes|autoPlay=no" src="http://www.metacafe.com/fplayer/{ID_VIDEO}.swf" width="'.$mvt['width'].'" height="'.$mvt['height'].'" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_5384657" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed></div>'),
  211.  
  212. //allocine.fr
  213. array('/allocine\.fr\/video\/player_gen_cmedia=([^&]*)/i', '<div id="allocine_blog" style="width:'.$mvt['width'].'px; height:'.$mvt['height'].'px"><object height='.$mvt['height'].'px width="100%"><param name="movie" value="http://www.allocine.fr/blogvision/{ID_VIDEO}"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.allocine.fr/blogvision/{ID_VIDEO}" type="application/x-shockwave-flash" width="100%" height="100%" allowFullScreen="true" allowScriptAccess="always"></embed></object></div>'),
  214.  
  215. //commeaucinema.com
  216. array('/commeaucinema.*bandes-annonces=([^&]*)/i', '<div><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="FLVPlayer" width="'.$mvt['width'].'" height="'.$mvt['height'].'" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab"><param name="movie" value="http://www.commeaucinema.com/flvplayerprx.php" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="flashvars" value="id={ID_VIDEO}&vid=0&baid=0" /><embed src="http://www.commeaucinema.com/flvplayerprx.php" quality="high" width="'.$mvt['width'].'" height="'.$mvt['height'].'" name="FLVPlayer" align="middle" wmode="transparent" play="true" loop="false" quality="high" allowScriptAccess="always" flashvars="id={ID_VIDEO}&vid=0&baid=0" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer"></embed></object><br />&nbsp;&nbsp;<a href="http://www.commeaucinema.com" title="Toute l actu Cinema est sur Commeaucinema.com" style="font-size:9px;font-family:Arial">Comme Au Cinema</a></div>'),
  217.  
  218. //Myspace
  219. //myspace.com
  220. array('/myspace\.com.*?videoID=([^&]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'" ><param name="allowFullScreen" value="true"/><param name="wmode" value="transparent"/><param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m={ID_VIDEO},t=1,mt=video"/><embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m={ID_VIDEO},t=1,mt=video" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"></embed></object>'),
  221. //vids.myspace.com
  222. array('/vids\.myspace\.com.*?videoID=([^&]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'" ><param name="allowFullScreen" value="true"/><param name="wmode" value="transparent"/><param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m={ID_VIDEO},t=1,mt=video"/><embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m={ID_VIDEO},t=1,mt=video" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"></embed></object>'),
  223. //myspacetv.com
  224. array('/myspacetv\.com.*?videoID=([^&]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="wmode" value="transparent"/><param name="allowscriptaccess" value="always"/><param name="movie" value="http://lads.myspace.com/videos/vplayer.swf"/><param name="flashvars" value="m={ID_VIDEO}"/><embed src="http://lads.myspace.com/videos/vplayer.swf" width="'.$mvt['width'].'" height="'.$mvt['height'].'" flashvars="m={ID_VIDEO}" type="application/x-shockwave-flash" allowscriptaccess="always" /></object>'),
  225.  
  226. //video.yahoo.com
  227. array('/video\.yahoo.*v=([^&]*)/i','<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.2" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="id={DOWNLOAD%/so\.addVariable\("id", "(.*?)"\);/%}&vid={ID_VIDEO}&thumbUrl={DOWNLOAD%/so\.addVariable\("thumbUrl", "(.*?)"\);/%}&embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.2" type="application/x-shockwave-flash" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowFullScreen="true" flashVars="id={DOWNLOAD%/so\.addVariable\("id", "(.*?)"\);/%}&vid={ID_VIDEO}&thumbUrl={DOWNLOAD%/so\.addVariable\("thumbUrl", "(.*?)"\);/%}&embed=1" ></embed></object>'),
  228. //video.yahoo.com/watch/
  229. array('/video\.yahoo\.com\/watch\/([^\/]*)/i','<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.2" /><param name="allowFullScreen" value="true" /><param name="flashVars" value="id={DOWNLOAD%/so\.addVariable\("id", "(.*?)"\);/%}&vid={ID_VIDEO}&thumbUrl={DOWNLOAD%/so\.addVariable\("thumbUrl", "(.*?)"\);/%}&embed=1" /><embed src="http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf?ver=2.2.2" type="application/x-shockwave-flash" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowFullScreen="true" flashVars="id={DOWNLOAD%/so\.addVariable\("id", "(.*?)"\);/%}&vid={ID_VIDEO}&thumbUrl={DOWNLOAD%/so\.addVariable\("thumbUrl", "(.*?)"\);/%}&embed=1" ></embed></object>'),
  230.  
  231. //megavideo.com
  232. array ('/megavideo.*v=(.*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://www.megavideo.com/v/{ID_VIDEO}"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/{ID_VIDEO}" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$mvt['width'].'" height="'.$mvt['height'].'"></embed></object>'),
  233.  
  234. //vimeo.com
  235. array ('/vimeo\.com\/([^&]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id={ID_VIDEO}&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id={ID_VIDEO}&amp;server=vimeo.com&amp;show_title=0&amp;show_byline=0&amp;show_portrait=0&amp;color=00ADEF&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'.$mvt['width'].'" height="'.$mvt['height'].'"></embed></object>'),
  236.  
  237. //gamevideos.1up.com
  238. array ('/gamevideos.1up.com\/video\/id\/(.*)/i', '<div style="width:500px; text-align:center"><embed type="application/x-shockwave-flash" width="'.$mvt['width'].'" height="'.$mvt['height'].'" src="http://gamevideos.1up.com/swf/gamevideos12.swf?embedded=1&amp;fullscreen=1&amp;autoplay=0&amp;src=http://gamevideos.1up.com/do/videoListXML%3Fid%3D{ID_VIDEO}%26adPlay%3Dtrue" align="middle"></embed></div>'),
  239.  
  240. //tu.tv
  241. array ('/(tu\.tv)/i', '{DOWNLOAD%/<input name="html".*value=\'(.*?)\'/%}'),
  242.  
  243. //godtube.com
  244. array ('/godtube\.com.*v=(.*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'" type="application/x-shockwave-flash" data="http://www.godtube.com/resource/mediaplayer/player-licensed.swf" id="tempIdforMediaPlayer" style="visibility: visible;"><param name="allowacriptaccess" value="always"><param name="allowfullscreen" value="true"><param name="wmode" value="transparent"><param name="flashvars" value="screencolor=000000&amp;controlbar=over&amp;type=video&amp;autostart=false&amp;playonce=false&amp;skin=http://www.godtube.com/resource/mediaplayer/skin/dangdang/dangdang.swf&amp;plugins=http://www.godtube.com/resource/mediaplayer/plugins/ova/ova.swf,http://www.godtube.com/resource/mediaplayer/plugins/d-related/d-related.swf&amp;config=http://www.godtube.com/resource/mediaplayer/{ID_VIDEO}.xml&amp;logo.link=undefined&amp;logo.position=top-left&amp;logo.hide=false&amp;logo.file=http://media.salemwebnetwork.com/spacer.gif"></object>'),
  245.  
  246. //myvideo.de
  247. array ('/myvideo\.de\/watch\/(.*)\//i', '<object style="width:'.$mvt['width'].'px;height:'.$mvt['height'].'px;" width="'.$mvt['width'].'" height="'.$mvt['height'].'" data="http://www.myvideo.de/movie/{ID_VIDEO}"><embed src="http://www.myvideo.de/movie/{ID_VIDEO}" width="'.$mvt['width'].'" height="'.$mvt['height'].'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true"></embed><param name="movie" value="http://www.myvideo.de/movie/{ID_VIDEO}"/><param name="AllowFullscreen" value="true"></param><param name="AllowScriptAccess" value="always"></param></object>'),
  248.  
  249. //collegehumor.com
  250. array ('/collegehumor.*video:(.*)/i', '<object type="application/x-shockwave-flash" data="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id={ID_VIDEO}&fullscreen=1" width="'.$mvt['width'].'" height="'.$mvt['height'].'" ><param name="allowfullscreen" value="true" /><param name="movie" quality="best" value="http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id={ID_VIDEO}&fullscreen=1" /></object>'),
  251.  
  252. //comedycentral.com
  253. array ('/comedycentral.*videoId=([^&]*)/i', '<embed style="display:block" src="http://media.mtvnservices.com/mgid:cms:item:comedycentral.com:{ID_VIDEO}" width="'.$mvt['width'].'" height="'.$mvt['height'].'" type="application/x-shockwave-flash" wmode="window" allowFullscreen="true" flashvars="autoPlay=false" allowscriptaccess="always" allownetworking="all" bgcolor="#000000"></embed>'),
  254.  
  255. //revver.com
  256. array ('/revver\.com\/video\/([^\/]*)/i', '<script src="http://flash.revver.com/player/1.0/player.js?mediaId:{ID_VIDEO};width:'.$mvt['width'].';height:'.$mvt['height'].';" type="text/javascript"></script>'),
  257.  
  258. //clipfish.de
  259. array ('/clipfish\.de\/video\/([^\/]*)/i', '<object codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'.$mvt['width'].'" height="'.$mvt['height'].'" > <param name="allowScriptAccess" value="always" /> <param name="movie" value="http://www.clipfish.de/cfng/flash/clipfish_player_3.swf?as=0&vid={ID_VIDEO}&r=1&area=e&c=990000" /> <param name="bgcolor" value="#ffffff" /> <param name="allowFullScreen" value="true" /> <embed src="http://www.clipfish.de/cfng/flash/clipfish_player_3.swf?as=0&vid={ID_VIDEO}&r=1&area=e&c=990000" quality="high" bgcolor="#990000" width="'.$mvt['width'].'" height="'.$mvt['height'].'" name="player" align="middle" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object>'),
  260.  
  261. //aniboom.com
  262. array ('/aniboom\.com\/animation-video\/([^\/]*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="movie" value="http://api.aniboom.com/e/{ID_VIDEO}" /><param name="allowScriptAccess" value="sameDomain" /><param name="allowfullscreen" value="true" /><param name="quality" value="high" /><embed src="http://api.aniboom.com/e/{ID_VIDEO}" quality="high" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowscriptaccess="sameDomain" allowfullscreen="true" type="application/x-shockwave-flash"></embed></object>'),
  263.  
  264. //facebook.com
  265. array ('/facebook.*v=([^&]*)/i', '<object type="application/x-shockwave-flash"
  266. data="http://www.facebook.com/v/{ID_VIDEO}\" width="'.$mvt['width'].'"
  267. height="'.$mvt['height'].'"><param name="autostart" value="false" /><param
  268. name="movie" value="http://www.facebook.com/v/{ID_VIDEO}" /></object>'),
  269.  
  270. //funnyordie.com
  271. array ('/funnyordie\.com\/videos\/(.*)\//i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="ordie_player_ef76e75bcf"><param name="movie" value="http://player.ordienetworks.com/flash/fodplayer.swf" /><param name="flashvars" value="key={ID_VIDEO}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always"></param><embed width="'.$mvt['width'].'" height="'.$mvt['height'].'" flashvars="key={ID_VIDEO}" allowfullscreen="true" allowscriptaccess="always" quality="high" src="http://player.ordienetworks.com/flash/fodplayer.swf" name="ordie_player_{ID_VIDEO}" type="application/x-shockwave-flash"></embed></object>'),
  272.  
  273. //dotsub.com
  274. array ('/dotsub\.com\/view\/(.*)/i', '<object width="'.$mvt['width'].'" height="'.$mvt['height'].'" type="application/x-shockwave-flash" id="mpl" name="mpl" data="http://dotsub.com/static/players/portalplayer.swf?v=2886"><param name="swliveconnect" value="true"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="flashvars" value="uuid={ID_VIDEO}&amp;lang=spa&amp;type=flv&amp;plugins=dotsub&amp;tid=UA-3684979-1&amp;debug=none&amp;embedded=false"></object>'),
  275.  
  276. //dorkly.com
  277. array ('/dorkly\.com\/video\/(.*)\//i', '<object type="application/x-shockwave-flash" data="http://www.dorkly.com/moogaloop/noobtube.swf?clip_id={ID_VIDEO}&fullscreen=1" width="'.$mvt['width'].'" height="'.$mvt['height'].'"><param name="allowfullscreen" value="true"/><param name="wmode" value="transparent"/><param name="allowScriptAccess" value="always"/><param name="movie" quality="best" value="http://www.dorkly.com/moogaloop/noobtube.swf?clip_id={ID_VIDEO}&fullscreen=1"/><embed src="http://www.dorkly.com/moogaloop/noobtube.swf?clip_id={ID_VIDEO}&fullscreen=1" type="application/x-shockwave-flash" wmode="transparent" width="'.$mvt['width'].'" height="'.$mvt['height'].'" allowScriptAccess="always"></embed></object>'),
  278.  
  279. //scribd.com
  280. array ('/cribd\.com\/doc\/([^\/]*)/i', '<object height="'.$mvt['height'].'" width="'.$mvt['width'].'" type="application/x-shockwave-flash" data="http://d1.scribdassets.com/ScribdViewer.swf" style="outline:none;" ><param name="movie" value="http://d1.scribdassets.com/ScribdViewer.swf"><param name="wmode" value="opaque"> <param name="bgcolor" value="#ffffff"><param name="allowFullScreen" value="true"><param name="allowScriptAccess" value="always"><param name="FlashVars" value="document_id={ID_VIDEO}&access_key=key-w2khk4pt761e0d60hb2&page=1&viewMode=slideshow"><embed src="http://d1.scribdassets.com/ScribdViewer.swf?document_id={ID_VIDEO}&access_key=key-w2khk4pt761e0d60hb2&page=1&viewMode=slideshow" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="'.$mvt['height'].'" width="'.$mvt['width'].'" wmode="opaque" bgcolor="#ffffff"></embed></object>'),
  281.  
  282. //justin.tv
  283. array ('/justin\.tv\/(.*)/i', '<object type="application/x-shockwave-flash" height="'.$mvt['height'].'" width="'.$mvt['width'].'" id="live_embed_player_flash" data="http://www.justin.tv/widgets/live_embed_player.swf?channel={ID_VIDEO}" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.justin.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="channel={ID_VIDEO}&auto_play=false&start_volume=25" /></object>'),
  284.  
  285. //citytv.com.co
  286. array ('/citytv\.com\.co\/videos\/(.*)\//i', '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" id="videocom_{ID_VIDEO}" height="'.$mvt['height'].'" width="'.$mvt['width'].'"><param name="movie" value="http://www.citytv.com.co/media/swf/Videocom.swf"></param><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="flashvars" value="videoID={ID_VIDEO}&showTools=false&autoPlay=false"></param><param name=wmode value=transparent><embed wmode=transparent name="videocom_{ID_VIDEO}" src="http://www.citytv.com.co/media/swf/Videocom.swf" flashvars= "videoID={ID_VIDEO}&showTools=false&autoPlay=false" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="'.$mvt['height'].'" width="'.$mvt['width'].'"/></embed></object>'),
  287.  
  288. array ('/citytv\.com\.co\/videos\/(.*)/i', '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0" id="videocom_{ID_VIDEO}" height="'.$mvt['height'].'" width="'.$mvt['width'].'"><param name="movie" value="http://www.citytv.com.co/media/swf/Videocom.swf"></param><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="flashvars" value="videoID={ID_VIDEO}&showTools=false&autoPlay=false"></param><param name=wmode value=transparent><embed wmode=transparent name="videocom_{ID_VIDEO}" src="http://www.citytv.com.co/media/swf/Videocom.swf" flashvars= "videoID={ID_VIDEO}&showTools=false&autoPlay=false" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" height="'.$mvt['height'].'" width="'.$mvt['width'].'"/></embed></object>'),
  289.  
  290. );
  291.  
  292. foreach ($values as $value){
  293. if (preg_match($value[0], $content, $matches)){
  294. $id_video=$matches[1];
  295. return preg_replace_callback('/{.*?}/', create_function('$matches', 'switch (true){
  296. case preg_match("/\{ID_VIDEO\}/", $matches[0]):
  297. return "'.$id_video.'";
  298. break;
  299. case preg_match("/\{LINK\}/", $matches[0]):
  300. return "'.$content.'";
  301. break;
  302. case preg_match("/\{DOWNLOAD(.*?)%(.*?)%(.*?)\}/", $matches[0], $matches2):
  303. if (empty($matches2[1])) $matches2[1]="'.$content.'";
  304. preg_match($matches2[2], file_get_contents(str_replace(" ","+",$matches2[1])), $matches3);
  305. if (empty($matches2[3])){
  306. return $matches3[1];
  307. }else{
  308. $t=$matches3[1];
  309. foreach(explode("|", $matches2[3]) as $e){
  310. eval(\'$t=\'.$e.\'($t);\');
  311. }
  312. return $t;
  313. }
  314. break;
  315. }
  316. return $matches[0];'), $value[1]);
  317. }
  318. }
  319. return 'Sorry, site not recognized - - Lo sentimos, no se reconoce el sitio';
  320. }
  321.  
  322. //Add quick tag for normal editor
  323. function myvideotag_quicktag_footer(){
  324. echo '<script type="text/javascript">'."\n";
  325. echo "\t".'function insertmyvideotag_qt( myField ) {'."\n";
  326. echo "\t\t".'var myvideotag_startPos = myField.selectionStart;'."\n";
  327. echo "\t\t".'var myvideotag_endPos = myField.selectionEnd;'."\n";
  328. echo "\t\t".'var myvideotag_selection = myField.value.substring( myvideotag_startPos, myvideotag_endPos );'."\n";
  329. echo "\t\t".'edInsertContent(myField, "[video]" + myvideotag_selection + "[/video]");'."\n";
  330. echo "\t".'}'."\n";
  331. echo "\t".'if(document.getElementById("ed_toolbar")){'."\n";
  332. echo "\t\t".'qt_toolbar = document.getElementById("ed_toolbar");'."\n";
  333. echo "\t\t".'edButtons[edButtons.length] = new edButton("ed_myvideotag","myvideotag","","","");'."\n";
  334. echo "\t\t".'var qt_button = qt_toolbar.lastChild;'."\n";
  335. echo "\t\t".'while (qt_button.nodeType != 1){'."\n";
  336. echo "\t\t"."\t".'qt_button = qt_button.previousSibling;'."\n";
  337. echo "\t".'}'."\n";
  338. echo "\t".'qt_button = qt_button.cloneNode(true);'."\n";
  339. echo "\t".'qt_button.value = "video";'."\n";
  340. echo "\t".'qt_button.title = "Insert myvideotag Tag";'."\n";
  341. echo "\t".'qt_button.onclick = function () { insertmyvideotag_qt( edCanvas); }'."\n";
  342. echo "\t".'qt_button.id = "ed_myvideotag";'."\n";
  343. echo "\t".'qt_toolbar.appendChild(qt_button);'."\n";
  344. echo "\t".'}'."\n";
  345. echo '</script>'."\n";
  346. }
  347. add_action('admin_footer', 'myvideotag_quicktag_footer');
  348. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement