[WordPress插件怎样安装WordPress插件安装方法]
<?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上播放在线视频要怎么设置呢?有了这款Smartideo视频插件就简单多了,它可以帮助你快速在wordpress添加在线视频,支持手机、平板的HTML5播放,它支持优酷、搜狐视频、土豆、56、腾讯视频、新浪视频、酷6、华数、乐视等热门网站的视频。
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
展开内容
9.2/769.8M
网口打印机测试程序是一款能够对各种网口打印机进行检测的实用软件,网口打印机都需要进行网口设置,但是很多人都不知道如何使用,本软件能够对网口打印机进行检测,判断是...
7.5/1,443.9M
ACDSee是一款专为摄影室工作室打造的专业图像管理软件,小编为你各位带来ACDSee摄影工作室旗舰版2018汉化补丁,支持标准版、专业版、旗舰版,完全汉化,使...
9.3/1,817.7M
小米云相册助手是款最新的照片管理软件,不但能够支持任意电脑文件的上传,而且它传输的速度也更非常快,能够满足很多的人需要,想要的都可以来此下载!小米云相册助手有什...
8.7/1,283.6M
微管是一款团队工作交流平台软件,软件功能强大,适合公司内部使用,你可以在这里直接了解到员工的情况,作为员工,你可以在这里努力的学习和发展自己,微管旨在建立一个快...
9.7/405.0M
当你和你的好友聊天时,实然想和你的好友分享一段你刚找到的一个非常精彩的视频剪辑,或者是自已刚刚制作的,想听听好友的意见。那么你可以试试Video2Webcam。...
7.8/1,497.3M
今天是11.9日,是一年一度的119消防宣传日。掌上119消防安全知识竞赛活动已经开启了,本次活动覆盖朝阳区5300多家中小企业,很好的宣传了企业消防知识,小编...
8.0/1,205.5M
现在很多公司都是使用钉钉上班考勤打卡,快要迟到了怎么办?钉钉定位精灵app采用虚拟定位技术,直接定位到你想要去的地方,随时的进行远程打卡,需要的朋友快来下载吧。...
8.1/1,553.0M
幼儿园孩子的家长专用孩子了解请款以及管理软件,在这里可以和孩子的老师沟通交流以及反馈请款,还可以了解自己孩子在幼儿园的情况等等,需要注意的是,家长的账号注册是需...
7.6/950.9M
gpstools软件超实用的地铁导航定位软件,能够为你的日常生活一键制定最佳的路线导航,随时随地在线守护亲人的安全,软件功能十分的强大,定位准确且稳定,还有众多...
9.9/1,170.3M
农夫天气app是一款语音自动播报天气软件,支持定时自动播报天气,支持实时播报天气动态,支持自动开关wifi等多种便利功能,方便大家随时了解天气状况!软件介绍全自...
7.5/1,045.6M
苍天帝陵1.0.7正式版是一款新出炉的防守魔兽地图,地图支持1-5人同时在线游戏,最新版地图新增3个游戏难度,修复了许多已知bug。本站为大家带来最新版地图资源...
7.8/1,037.9M
《月风魔传》是此前日本KONAMI公司在1987年7月7日推出的FC游戏卡,注意这个是一款ARPG游戏,也就是动作角色扮演类游戏。月风魔传不死之月Steam正版...
8.7/71.9M
THE加班是一款由扑家工作室全新推出的逃脱休闲手游。游戏还有很有意思的,以在公司工作为题材,玩家需要从公司中逃出去。丰富的游戏内容,新颖的玩法,给你不一样的游戏...
8.2/855.9M
万千图库插件是针对千图网和千库网打造的一款下载插件,支持图片,海报模板,视频模板等素材下载,解除所有的会员限制,免费下载所有VIP素材。安装方法下载解压后运行,...
7.9/1,232.6M
足球是很多的朋友都喜欢看的体育赛事,那么现在小编就给你的手机上推荐一款很不错的世界杯播放工具--指尖世界杯,让你可以轻松的知道现在世界杯的情况!指尖世界杯介绍指...
8.7/556.9M
autocad2010是一款优秀的制图软件,东坡为大家带来了autocad201064位的下载,32位系统请勿下载,还附带了序列号和密钥!软件介绍CAD2010...
8.2/1,602.8M
AutodeskRevitMEP2012是一款非常专业的图像处理软件,这个软件属于水暖电工程设计软件,可以为水暖电工程设计的朋友提供非常便捷的制图服务!软件相比...
8.8/1,611.2M
平板和ipad之类的在现在是很流行了,那么这些东西都是需要有一款不错的浏览器的,那么小编觉得qq浏览器hd就是你不错的选择,有需要的可以下载看看!qq浏览器hd...
9.4/1,446.6M
CAD看图王是一款专业看图软件,在软件内容对于专业制图者来说,看图是很常见的事情,但同时也是麻烦的一键式,该软件轻松的解决了,看图的麻烦工程看图一目了然,还有可...
7.8/1,216.2M
想必大家都知道小米智能手环有什么用处吧,毕竟用过了。那么如果你不知道的话,也没关系,这份小米智能手环使用说明书里面就给你讲解的很清楚,还有一些小米智能手环的保养...
8.1/1,132.7M
酷奇信息框窗口单词即时点击翻译工具是一款很实用方便的软件,该软件小巧,最大的功能就是能够快速的实现即时翻译,那么这款软件都有哪些特点呢?接下类介绍一下酷奇信息框...
8.1/722.8M
每日水印王app是一款能够轻松解决所有视频图片上的水印app,app上涵盖的功能非常的强大,能够轻松的提取无水印视频和图片,还有非常强大的水印相机功能,帮助用户...
9.6/1,919.3M
锦鲤好省app是一款十分不错的网购省钱利器工具,汇集了很多优质的商品,满足了大家一站式的购物需求,提供了超多丰富的福利,让用户可以享受生活消费特权,领取锦鲤好省...
9.1/155.9M
不管你在这个公司干的怎么样,当你要辞职的时候,一定要写一份辞职申请,来简述自己离职的理由,毕竟有时候,辞职申请还是非常有必要的。这份员工辞职申请书表格模板,就送...
8.9/1,678.3M
动态指纹二维码制作生成器是一款可以帮你制作非常高端大气上档次的长按指纹二维码生成工具,简单好用,带你装逼带你飞,快来下载使用吧!动态指纹二维码制作生成器介绍微信...