在wordpress上播放在线视频要怎么设置呢?有了这款Smartideo视频插件就简单多了,它可以帮助你快速在wordpress添加在线视频,支持手机、平板的HTML5播放,它支持优酷、搜狐视频、土豆、56、腾讯视频、新浪视频、酷6、华数、乐视等热门网站的视频。
<?php
/*
PluginName:Smartideo
PluginURI:http://www.fengziliu.com/
Description:Smartideo是为WordPress添加对在线视频支持的一款插件(支持手机、平板等设备HTML5播放)。目前支持优酷、搜狐视频、土豆、56、腾讯视频、新浪视频、酷6、华数、乐视等网站。
Version:1.2
Author:FensLiu
AuthorURI:http://www.fengziliu.com/smartideo-for-wordpress.html
*/
define('SMARTIDEO_VERSION','1.0');
define('SMARTIDEO_URL',plugins_url('',__FILE__));
define('SMARTIDEO_PATH',dirname(__FILE__));
$smartideo=newsmartideo();
classsmartideo{
private$width='100%';
private$height='500';
private$mobile_width='100%';
private$mobile_height='250';
publicfunction__construct(){
if(is_admin()){
add_action('admin_menu',array($this,'admin_menu'));
}
$option=get_option('smartideo_option');
if(!empty($option)){
$option=json_decode($option,true);
}else{
$option=array();
}
extract($option);
if(!empty($width)){
$this->width=$width;
}
if(!empty($height)){
$this->height=$height;
}
if(!empty($mobile_width)){
$this->mobile_width=$mobile_width;
}
if(!empty($mobile_height)){
$this->mobile_height=$mobile_height;
}
wp_embed_register_handler('smartideo_tudou',
'#https?://(?:www.)?tudou.com/(?:programs/view|listplay/(?<list_id>[a-z0-9_=-]+))/(?<video_id>[a-z0-9_=-]+)#i',
array($this,'smartideo_embed_handler_tudou'));
wp_embed_register_handler('smartideo_56',
'#https?://(?:www.)?56.com/[a-z0-9]+/(?:play_album-aid-[0-9]+_vid-(?<video_id1>[a-z0-9_=-]+)|v_(?<video_id2>[a-z0-9_=-]+))#i',
array($this,'smartideo_embed_handler_56'));
wp_embed_register_handler('smartideo_youku',
'#https?://v.youku.com/v_show/id_(?<video_id>[a-z0-9_=-]+)#i',
array($this,'smartideo_embed_handler_youku'));
wp_embed_register_handler('smartideo_qq',
'#https?://v.qq.com/(?:cover/g/[a-z0-9_.]+?vid=(?<video_id1>[a-z0-9_=-]+)|(?:[a-z0-9/]+)/(?<video_id2>[a-z0-9_=-]+))#i',
array($this,'smartideo_embed_handler_qq'));
wp_embed_register_handler('smartideo_sohu',
'#https?://my.tv.sohu.com/us/(?:d+)/(?<video_id>d+)#i',
array($this,'smartideo_embed_handler_sohu'));
wp_embed_register_handler('smartideo_wasu',
'#https?://www.wasu.cn/play/show/id/(?<video_id>d+)#i',
array($this,'smartideo_embed_handler_wasu'));
wp_embed_register_handler('smartideo_yinyuetai',
'#https?://v.yinyuetai.com/video/(?<video_id>d+)#i',
array($this,'smartideo_embed_handler_yinyuetai'));
wp_embed_register_handler('smartideo_ku6',
'#https?://v.ku6.com/show/(?<video_id>[a-z0-9-_.]+).html#i',
array($this,'smartideo_embed_handler_ku6'));
wp_embed_register_handler('smartideo_letv',
'#https?://www.letv.com/ptv/vplay/(?<video_id>d+)#i',
array($this,'smartideo_embed_handler_letv'));
}
publicfunctionsmartideo_embed_handler_tudou($matches,$attr,$url,$rawattr){
if(wp_is_mobile()){
$embed=$this->get_iframe("http://www.tudou.com/programs/view/html5embed.action?type=0&code={$matches['video_id']}");
}else{
$embed=$this->get_embed("http://www.tudou.com/v/{$matches['video_id']}/&resourceId=0_05_05_99&bid=05/v.swf");
}
returnapply_filters('embed_tudou',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_56($matches,$attr,$url,$rawattr){
$matches['video_id']=$matches['video_id1']==''?$matches['video_id2']:$matches['video_id1'];
if(wp_is_mobile()){
$embed=$this->get_iframe("http://www.56.com/iframe/{$matches['video_id']}");
}else{
$embed=$this->get_embed("http://player.56.com/v_{$matches['video_id']}.swf");
}
returnapply_filters('embed_56',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_youku($matches,$attr,$url,$rawattr){
if(wp_is_mobile()){
$embed=$this->get_iframe("http://player.youku.com/embed/{$matches['video_id']}");
}else{
$embed=$this->get_embed("http://player.youku.com/player.php/sid/{$matches['video_id']}/v.swf");
}
returnapply_filters('embed_youku',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_qq($matches,$attr,$url,$rawattr){
$matches['video_id']=$matches['video_id1']==''?$matches['video_id2']:$matches['video_id1'];
if(wp_is_mobile()){
$embed=$this->get_iframe("http://v.qq.com/iframe/player.html?vid={$matches['video_id']}");
}else{
$embed=$this->get_embed("http://static.video.qq.com/TPout.swf?vid={$matches['video_id']}");
}
returnapply_filters('embed_qq',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_sohu($matches,$attr,$url,$rawattr){
if(wp_is_mobile()){
$embed=$this->get_iframe("http://tv.sohu.com/upload/static/share/share_play.html#{$matches['video_id']}_0_0_9001_0");
}else{
$embed=$this->get_embed("http://share.vrs.sohu.com/my/v.swf&topBar=1&id={$matches['video_id']}&autoplay=false&xuid=&from=page");
}
returnapply_filters('embed_sohu',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_wasu($matches,$attr,$url,$rawattr){
if(wp_is_mobile()){
$embed=$this->get_iframe("http://www.wasu.cn/Play/iframe/id/{$matches['video_id']}");
}else{
$embed=$this->get_embed("http://s.wasu.cn/portal/player/20141216/WsPlayer.swf?mode=3&vid={$matches['video_id']}&auto=0&ad=4228");
}
returnapply_filters('embed_wasu',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_yinyuetai($matches,$attr,$url,$rawattr){
$embed=$this->get_embed("http://player.yinyuetai.com/video/player/{$matches['video_id']}/v_0.swf");
returnapply_filters('embed_yinyuetai',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_ku6($matches,$attr,$url,$rawattr){
$embed=$this->get_embed("http://player.ku6.com/refer/{$matches['video_id']}/v.swf");
returnapply_filters('embed_ku6',$embed,$matches,$attr,$url,$rawattr);
}
publicfunctionsmartideo_embed_handler_letv($matches,$attr,$url,$rawattr){
$embed=$this->get_embed("http://i7.imgs.letv.com/player/swfPlayer.swf?id={$matches['video_id']}&autoplay=0");
returnapply_filters('embed_letv',$embed,$matches,$attr,$url,$rawattr);
}
privatefunctionget_embed($url){
$embed=sprintf(
'<embedsrc="%1$s"allowFullScreen="true"quality="high"width="%2$s"height="%3$s"allowScriptAccess="always"type="application/x-shockwave-flash"></embed>',
$url,$this->width,$this->height);
return$embed;
}
privatefunctionget_iframe($url){
$iframe=sprintf(
'<iframesrc="%1$s"width="%2$s"height="%3$s"frameborder="0"allowfullscreen="true"></iframe>',
$url,$this->mobile_width,$this->mobile_height);
return$iframe;
}
publicfunctionadmin_menu(){
add_plugins_page('Smartideo设置','Smartideo设置','manage_options','smartideo_settings',array($this,'admin_settings'));
}
publicfunctionadmin_settings(){
if($_POST['smartideo_submit']=='保存'){
$param=array('width','height','mobile_width','mobile_height');
$json=array();
foreach($_POSTas$key=>$val){
if(in_array($key,$param)){
$json[$key]=$val;
}
}
$json=json_encode($json);
update_option('smartideo_option',$json);
}
$option=get_option('smartideo_option');
if(!empty($option)){
$option=json_decode($option,true);
}
if(empty($option['width'])){
$option['width']='100%';
}
if(empty($option['height'])){
$option['height']='500';
}
if(empty($option['mobile_width'])){
$option['mobile_width']='100%';
}
if(empty($option['mobile_height'])){
$option['mobile_height']='250';
}
echo'<h2>Smartideo设置</h2>';
echo'<formaction=""method="post">
<tableclass="form-table">
<trvalign="top">
<thscope="row">播放器宽度</th>
<td>
<label><inputtype="text"class="regular-textcode"name="width"value="'.$option['width'].'"></label>
<br/>
<pclass="description">默认宽度为100%</p>
</td>
</tr>
<trvalign="top">
<thscope="row">播放器高度</th>
<td>
<label><inputtype="text"class="regular-textcode"name="height"value="'.$option['height'].'"></label>
<br/>
<pclass="description">默认高度为500px</p>
</td>
</tr>
<trvalign="top">
<thscope="row">移动设备播放器宽度</th>
<td>
<label><inputtype="text"class="regular-textcode"name="mobile_width"value="'.$option['mobile_width'].'"></label>
<br/>
<pclass="description">手机、平板等设备访问时,默认宽度为100%</p>
</td>
</tr>
<trvalign="top">
<thscope="row">移动设备播放器高度</th>
<td>
<label><inputtype="text"class="regular-textcode"name="mobile_height"value="'.$option['mobile_height'].'"></label>
<br/>
<pclass="description">手机、平板等设备访问时,默认高度为250px</p>
</td>
</tr>
</table>
<pclass="submit"><inputtype="submit"name="smartideo_submit"id="submit"class="button-primary"value="保存"></p>
</form>';
}
}
WordPress视频播放插件(Smartideo)安装方法
你可以在后台插件管理页面中直接搜索Smartideo并安装.

或者上传文件夹smartideo至/wp-content/plugins/目录.
在插件管理页面中激活Smartideo.

[WordPress插件怎样安装WordPress插件安装方法]
Smartideo插件使用方法九乐棋牌手机官方下载
你可以直接粘贴视频播放也完整的URL到编辑器(单独一行),就可以加载视频播放器。
URL地址格式如下
http://v.youku.com/v_show/id_XMTYzNTgxNTMy.html
http://www.tudou.com/programs/view/YBdHhxJqrLY/
http://www.56.com/u35/v_MTEwMjM5NDcy.html
http://v.qq.com/page/o/9/f/o0142tt1m9f.html
http://v.qq.com/cover/t/tyeqdw6rof7t5ow/p0015kjlai9.html
http://my.tv.sohu.com/us/94469256/77228432.shtml
http://www.wasu.cn/Play/show/id/5079941
http://v.yinyuetai.com/video/2207109
http://v.ku6.com/show/P0Ib_pTne6-FBSa1AbtKUQ...html
http://www.letv.com/ptv/vplay/20932037.html
展开内容
8.7/409.9M
MotoGP摩托车越野赛是一款精彩纷呈的摩托车赛车游戏,提供了多种赛事和模式、各种特殊地形和障碍物,需要玩家不断提高技巧和反应速度。同时,游戏的社交功能也为玩家...
7.6/1,710.1M
可以通过看天气预报领取大量的红包,查看天气的种类是非常之多的,不仅可以查看台风天气,而且各种天气预报也是可以查看的,通过查看天气可以每日领取红包金额,而且金额达...
8.9/1,705.5M
宝宝巴士熊猫餐厅游戏一款厨房美食烹饪模拟小游戏,画面丰富有趣,孩子喜欢,制作美食的第一步是找到食材,再对食材进行处理,最后做出一顿丰富的大餐,非常有趣,赶快来下...
9.5/318.7M
战友商会app是一款以服务退役军人创新创业的网络平台。战友商会也叫作战友合作人,在这里,只要你是退役军人,都可以享受超多优惠政策!这里不仅仅是你的第二个家,还能...
7.7/974.8M
蒜瓣Learning是一款涵盖各种知识分享类的平台,大家可以在这里学到很多不同的知识,全都是短视频的方式呈现给大家,内容丰富且有趣,适合每一个求知的人,感兴趣的...
9.0/1,479.3M
244玩游戏盒子是一款很好用的手机游戏盒子app。这里有着海量的手游可以选择,每天都有更新。喜欢玩手游的小伙伴福利来了,想玩什么类型的游戏都可以在这里找到哦。快...
8.6/1,468.4M
贪婪地宫HD游戏带有暗黑魔幻元素的卡牌地牢冒险游戏,多重竞技系统的设定,注重阵容的合理搭配部署,策略战术的开发会决定战局,玩家需要组建和培养自己的一套角色阵容,...
9.6/681.5M
很多用户都习惯把一些资源上传在网盘上,然后通过分享的方式给其他人下载。然而有时我们下载网盘上的文件时,由于文件太大会导致网络错误,下载中断,这样很浪费时间,如果...
8.6/1,059.6M
Autodesk3dsMax2018是一款建模和渲染软件,可以轻松制作生成高品质三维动画,小编带来的是Autodesk3dsMax2018中文免费版本,需要的朋...
9.6/1,794.0M
激斗尸魂界是一款和动漫联合的动作格斗游戏,二次元的游戏画风,玩家在游戏中操控动漫人物战斗,紧张刺激的任务挑战,故事线紧凑,丰富的副本任务让你一次玩个够,更多隐藏...
8.4/622.1M
UUUTalk口语APP是款非常棒的英语口语学习软件,软件中能帮助用户更加高效的进行英语学习,无论你是初涉英语学习领域,连基础问候语都说不利索的零基础小白,还是...
8.7/1,825.3M
乐清人才网官方版极为优质的线上求职软件,能够为你更好的找到各色的工作机会,一键求职众多优质企业任由你去选择,工作类型丰富且齐全,绝对有一份工作能符合你的心意,如...
7.6/1,766.8M
Windows键盘可视化工具(keycastow)汉化版是keycastow最新的汉化中文版,非常好用,让屏幕显示你的键盘鼠标操作,电脑实用软件,需要的快来下载...
8.7/499.4M
屏幕录像oCam是一款非常使用的录像软件,使用过这款软件的玩家都知道这款软件到底有多好用吧?而且小编这次为大家带来的版本还是去广告绿色版哟!如果你有需要,就快来...
9.9/149.2M
诡异樱校传说是一款充满悬疑与挑战的解谜类手游,您将化身为一名少女,穿梭于不同场景之间,探索隐藏的线索与神秘道具,解开层层谜题与机关。游戏通过精心设计的场景与剧情...
7.9/1,650.6M
超级Web漏洞扫描器是一款Web漏洞扫描器,基于C#进行扫描,扫目录不错,不过有点多,稍微慢点。速度非常快,支持批量域名扫描,支持延时扫描对付防火墙。超级Web...
9.0/1,720.4M
V1短剧是一款免费的短剧播放平台,在这里大家能看到各种类型的短剧,言情、悬疑、龙王等自由选择,轻松看各种热门短剧,海量好剧免费观看,最重要的是没有任何广告骚扰,...
7.9/1,388.3M
开拓者越野手游是一款赛车竞速类型游戏,非常多的跑道可以选择,开启不一样的竞速模式,你可以积累金币获得更多的赛车,良好的游戏体验感!开拓者越野介绍开拓者越野是一款...
8.8/1,888.1M
呵呵动漫是一个新的看网络漫画的软件,小编推荐给大家的理由很简单,这里的漫画资源不仅多而且新,最主要都是免费的,里面有国内动漫漫画,也有国外的,大家可以来这里找找...
8.1/65.9M
时光倒转摄像机,时光倒转摄像机非常的神器,它可以让你的拍摄的视频全部时间翻转,比如你拍朋友喝果汁,结果放出来是全部又吐出来,非常搞笑和好玩。时光倒转摄像机点评时...
9.9/1,136.1M
这款软件是一款游戏盒子软件,包含了众多h5和变态破解的游戏,并且你还可以与其他人进行分享,直接的进行交流,让玩游戏更加有趣!87游戏盒子app介绍软件集合了众多...
9.6/1,924.0M
齐天记定制版是款全新以西游题材为背景的大型3DARPG手游,华丽多样的技能招式,绚丽的全身换装系统,紧张刺激的闯关副本,多种特色玩法给玩家带来无穷的探索神秘感。...
7.9/1,068.5M
互盾CAJ转Word转换器是一款可以将caj转换成word文档的caj转换器。有了它,用户可以轻松把caj转换成word文档,转换后word文档不改变原来的格式...
8.6/1,265.4M
绿萝软文编辑器是一款图文排版编辑器,无需安装,无需注册,永久免费使用,帮助文字编辑工作者提高编辑效率,大大节省了编辑文章的时间,缩减了编辑的工作流程,并且尽可能...
9.3/403.7M
《王者国度》感受全新超高爆率游戏内容玩法,气势磅礴感受对战竞技设定,即时强力pk对战模式,丰富装备系统内容,多样化场景设计游戏体验,实时对抗战斗竞技玩法,上线体...