<?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>';
}
}
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
[WordPress插件怎样安装WordPress插件安装方法]
在wordpress上播放在线视频要怎么设置呢?有了这款Smartideo视频插件就简单多了,它可以帮助你快速在wordpress添加在线视频,支持手机、平板的HTML5播放,它支持优酷、搜狐视频、土豆、56、腾讯视频、新浪视频、酷6、华数、乐视等热门网站的视频。足球大小球
WordPress视频播放插件(Smartideo)安装方法
你可以在后台插件管理页面中直接搜索Smartideo并安装.

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

展开内容
10.0/1,877.3M
贵州石油app是一款可以帮助你在旅行之时随时随地的查看加油站情况,也可以快速的对石油的价格进行详情的了解,贵州石油下载后可以领取加油福利,让你使用更加爽快!贵州...
7.8/879.6M
喵家设计师游戏是一款可爱风格的模拟类游戏,养一只猫咪或者狗狗,让你能够在这个屋檐之下与自己心爱的人和宠物们度过每一天。花园,客厅,卧室,厨房等房间的各个地方都可...
9.6/1,734.8M
多玩论坛相信大数的游戏人一定不会陌生,这里为您提供的是多玩论坛签到神器,对一般的非游戏用户估计用处不大,但是对那些天天挂游戏,逛论坛的玩家来说,这个工具让你非常...
9.2/1,146.3M
《机动战姬:聚变》是一款日系二次元风格的角色扮演手游,将萌娘和机甲元素完美的融合,给玩家带来无与伦比的对决体验,Q版可爱的画风,一定会让玩家们爱不释手,喜欢的小...
8.4/1,662.4M
鏖战天穹红包版Q萌可爱的养成类游戏,多种不同的玩法等你的加入,探索不断,跨服去完成竞技任务,鏖战天穹玩法十分的精彩,新手上线就有红包提现哟。鏖战天穹红包版乐趣1...
8.5/833.6M
MR761是基于NXP射频读卡芯片设计的桌面式mifare读卡器,可以读取符合ISO14443A或ISO14443B标准的卡片的卡号和卡中数据,并通过USB端口...
8.6/1,881.5M
这是一个非常好用的月经助手软件,女性必备神器,可以检测你的月经周期,管理你的黄体期,可孕期,大姨妈期,了解一些养生知识,姨妈期间注意事项!app介绍菲菲经期助手...
7.7/1,842.1M
蓝月传世是一款非常好玩的手机游戏,这款游戏由传奇游戏改编,这款游戏中完美的还原了传奇游戏中的玩法与特色,同时这款游戏在原有的基础上还增添了新的玩法。喜欢传奇游戏...
9.3/1,450.0M
文明崛起手游是一款烧脑的策略闯关游戏,丰富的关卡,心动的场景,多样化的冒险体验,将救救小狗游戏升级,打造丰富全面的玩法内容哦。这就是文明崛起的全新乐趣,喜欢文明...
8.6/1,810.1M
一款关于医学的学习软件,湘源教育app有很多优秀的老师授课,课程培训、试题练习、药师继续教育等,还有老师在线答疑,解决学习问题。湘源教育app功能1、医学准题库...
8.4/1,488.6M
美啦美妆是一款美女最爱的安卓APP,喜欢化妆的网友们可以在这里找到最潮,最新的化妆品!还可以和网友们交流护肤心得、化妆技巧,解决肌肤问题。需要的网友赶紧来下载吧...
9.6/1,325.0M
《无限暴击9999999》是一款以仙侠题材为背景的角色扮演游戏。游戏中,玩家将扮演一位拥有无限暴击能力的剑仙,踏上复仇之路,挑战各种强大的敌人。游戏特色在于无限...
9.1/560.2M
逍遥春秋飞升版国风唯美意境的仙侠美景,每一帧的画面都十分精美,令人如痴如醉,精彩有趣的多样副本任务,与BOSS展开一场燃情激斗,获胜得丰厚大奖。逍遥春秋飞升版亮...
8.6/98.2M
小李飞刀手游游戏名字大全里面包含了各种各样的手游可以取的名字,有你需要的最新的情侣名字也是有单身狗适合的名字,你要是不知道在小李飞刀手游游戏取什么名字好的话,你...
8.1/1,137.8M
全新像素卡牌冒险手游,登录送超多福利,礼包码:svip9999。抽取自己喜欢的卡牌去进行组合,让我们一起战斗起来吧!萌将世界游戏玩法1、游戏中拥有数百种精灵,精...
7.6/943.6M
小绿货运货主版是为货主所设计的一款高效便捷物流应用,有货运需求的朋友们可以直接发布订单,会有专业货运司机接单,全程流程可查看,非常方便,喜欢的朋友快来下载体验吧...
7.8/913.5M
中匠未来app是一款非常优秀的备考学习软件。它不仅提供了丰富的教育资源,还通过AI技术为用户提供科学、个性化的备考计划和建议。这款软件能够帮助天津地区的用户在备...
8.7/1,588.3M
柚子tv最新电视盒子破解版能做到的就是免除所有广告,无任何弹窗和付费选项,直接接入了新的线路,4K高清秒播体验非常出色。这个TV软件毫无疑问是可以直装在电视上的...
9.8/1,898.3M
是一款为想要从职或者正在任职的产品经理打造的学习软件,用户可以在这里学习产品经理的精髓,帮助你在这里开发自己的点子,做出好的产品。软件简介NPDP产品经理客户端...
7.9/485.8M
逗斗火柴人是有网易官方出品的一款火柴人游戏,游戏是由《StickFight:TheGame》正版IP授权改编的,是一款主打魔性、欢乐战斗主题的多人在线格斗手游。...
9.1/1,521.8M
廊坊都市网是一个互联网生活服务软件,为广大市民朋友带来了编辑的读诗生活资讯,可以了解本地周边商家信息,还可以结交同城好友!软件介绍廊坊都市网是廊坊本土的一款AP...
9.5/1,736.7M
费县首发APP之前叫“视角费县”,更新升级后改名叫费县首发,所以大家可以直接升级之前软件,或者在本站下载最新版本费县首发app。这款软件主要是针对费县民众的,常...
7.9/154.0M
学会宽容,善待他人,本篇为大家带来宽容主题班会课件ppt,适用于各班级的学会宽容主题班会,风格简约有条理,素材精良,欢迎前来下载使用,本ppt完全免费。宽容主题...
8.7/982.0M
金牛期货app是一款期货交易学习软件,用户可以获得最新的期货投资资讯,查看实时行情,给出最精准的分析,帮助你投资!金牛期货app介绍汇聚全球资讯,24小时轮播,...
7.8/446.3M
火龙神器单职业是一款热血的单职业神器传奇手游,游戏加入了全新的神器元素,更强悍的属性和全新的游戏神器技能等你选择,超燃的战斗玩法,热血的竞技模式,在这里玩家可以...