Hgta的博客

个人博客

ubuntu 10.10 网易/163升级源

Posted on | 1月 27, 2011 | No Comments

deb http://mirrors.163.com/ubuntu/ maverick main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ maverick-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ maverick-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ maverick-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ maverick-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ maverick main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ maverick-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ maverick-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ maverick-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ maverick-backports main restricted universe multiverse

Godaddy用SSH查看主机信息

Posted on | 1月 26, 2011 | No Comments

首先要开通 Godaddy 的 SSH,具体方法见此贴:http://bbs.idcspy.com/viewthread.php?tid=37098

注意:仅付费 Linux 主机有 SSH,免费的 Linux 空间和 Windows 空间无此功能。 之后用你的账户名登陆 Putty SSH,出现 $ 符号后输入如下:

查看操作系统版本

代码:

$ head -n 1 /etc/issue

我的是 CentOS realeas 5.2 (Final)

查看Linux内核版本

代码:

$ uname -a

查看CPU信息

代码:

$ cat /proc/cpuinfo

查看CPU利用率

代码:

$ vmstat 8

查看内存信息

代码:

$ cat /proc/meminfo

查看内存大小

代码:

$ grep MemTotal /proc/meminfo

查看内存占用率

代码:

$ free -m

查看系统负载

代码:

$ cat /proc/loadavg

查看在线时间

代码:

$ cat /proc/uptime

查看主机名

代码:

$ hostname

其实还有更多更全面的系统信息查看方法,只是 Godaddy 的 SSH 限制太多,而 BlueHost 和 HostMonster 的 SSH 相对宽松一点,能使用的命令也更多一点。

当然,SSH 使用最频繁的还是压缩和 wget 功能,这对于提高 Godaddy 龟速的下载和上传速度很有帮助。

对了,记得退出是

代码:

$ logout

看看自己登陆多久了

代码:

$ w

看看这台机器上现在有几个邻居、他们的登陆时间和在线时间、最后一次登陆IP等等信息

代码:

$ last

我随便看了下就发现2个中国人(名字是汉语拼音),昏…… 中国人真是多

想把用户名慢慢下载下来研究,就把用户名输出到文件里保存

代码:

$ last > users.txt

http://godaddy.idcspy.com/uncategorized/godaddy-linux

检查服务器是否安装vsftpd的命令

Posted on | 1月 26, 2011 | No Comments

rpm -qa vsftpd

Ubuntu Linux上安装SSH和Vsftpd的方法

Posted on | 1月 26, 2011 | No Comments

安装SSH:

sudo apt-get install ssh

用ssh登录主机:

SSH username@ipaddress

eg:admin@10.24.0.2

安装vsftpd:

vsftpd 是可在 Ubuntu 中使用的 FTP 守护程序之一。它在安装、设置和维护方面十分方便。要安装 vsftpd 您可以使用下列命令:

vsftpd – FTP 服务器配置

你可以编辑 vsftpd 配置文件,/etc/vsftpd.conf,来配置缺省设置。缺省状态下只允许匿名 FTP。如果您希望禁用该选项,您可以将下面这行:

anonymous_enable=YES

改为

anonymous_enable=NO

缺省状态下,本地系统用户是不允许登录 FTP 服务器的。要改变该设置,您可以将下面这行反注释:

#local_enable=YES

缺省状态下,允许用户从 FTP 下载文件,但不允许他们上传文件到 FTP 服务器。为了能够上传文件到 FTP 服务器,需要改变该设置,您可以将下面这行反注释掉:

#anon_upload_enable=YES

配置文件包括许多配置参数。关于配置文件中的每个参数的信息都可以得到,或者您可以参考手册页,man 5 vsftpd.conf 说明每个参数的细节。 一旦您配置好了 vsftpd 您就可以运行该守护程序了。您可以执行下列命令来运行vsftpd 守护进程:

sudo /etc/init.d/vsftpd start

linux下 zip压缩用法

Posted on | 1月 26, 2011 | No Comments

linux下 zip压缩用法

1.zip
zip -r myfile.zip ./*
将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件.

2.unzip
unzip -o -d /home/sunny myfile.zip
把myfile.zip文件解压到 /home/sunny/
-o:不提示的情况下覆盖文件;
-d:-d /home/sunny 指明将文件解压缩到/home/sunny目录下;

3.其他
zip -d myfile.zip smart.txt
删除压缩文件中smart.txt文件
zip -m myfile.zip ./rpm_info.txt
向压缩文件中myfile.zip中添加rpm_info.txt文件

ECMS帝国CMS

Posted on | 1月 19, 2011 | No Comments

帝国CMS系统是国内一个功能强大的开源建站工具。

帝国网站管理系统(EmpireCMS)主要特性:
一、超强系统模型扩展功能
EmpireCMS 卓越之处在于:不仅提供了网站管理功能,而且还提供了系统扩展框架,您可以直接在后台通过新建表、自定义字段,然后组成新的系统模型,以实现各种适合用户 自己的系统。如下载系统、音乐系统、商城系统、产品库、分类信息等等……同时,此功能可将信息量分配于不同的信息表,为数据量较大的网站进行数据 部署。因系统模型扩展特性,EmpireCMS又被誉为“万能建站工具”。在4.7以上版本中,此功能又一次得到升华,不仅增强了后台管理系统的可扩展性,而且前台互动性系统的扩展也能发挥得淋漓尽致,在稳定性、扩展性与完善性等诸多方面都得到了更完美的提升!
二、大容量数据结构设计
帝国支持一个栏目一个数据表,有多少栏目就建多少个数据存放表,因此容量是无限级;
并且支持内容存文本,使单个数据表更超容量;
支持信息归档,将过期的信息归档到其它数据表,以减轻主数据表的负担,使系统稳定性与效率更高。
三、系统安全性设计
·系统验证采用随机密码认证,每次登录或退出都会产生新的随机密码,无规律可寻;
·管理员密码采用双重md5加密模式,防止密码泄漏被暴力破解;
·登录新增认证码功能,要同时满足密码跟认证码同时正确才能登录,此功能可防止非法用户知道密码也无法登录;
·登录次数限制采用COOKIE+数据库双重验证;
·登录错误日志记录,使用户第一时间检查非法登录IP,做出及时的非法IP封锁;
·COOKIE认证码验证,为身份认证再加一把锁。
·登陆验证COOKIE变量前缀设置。
四、强大的信息采集功能
本系统无论是内置的系统模型还是用户自定义的模型都有自己相应的采集。自动化内容采集的支持,大大降低了内容维护的工作量,并让网站管理系统与企业的其它信息化系统无缝集成,提高了信息的利用率。

·使用简单:无需会任何程序,只需在相应的采集内容加上相应的标签即可。
·多重过滤:同一链接可设置不重复采集;设置采集关键字(不包含不采集);内容字符替换;广告过滤;整页代码过滤;过滤相似信息;过滤标题相同信息;设置采集记录数。
·采集区域更准确:整体页面区域正则+信息链接区域正则。
·支持多种页面编码转换:支持GB2312、BIG5、UTF8、UNICODE编码转换。
·效率更高:采用分组采集与入库;支持多线程(节点)采集。
·方便性:采集可选是否马上入库(特别对于挂机采,非常方便);填写采集正则后可预览采集结果,可验证采集正则的正确性;复制、清空节点;可选择“选择式”与“全部式”入库;对采集的临时数据进行管理。
·远程保存文件:支持远程保存图片/FLASH/附件,图片加水印。
·其它特性:支持多列表采集、内容分页采集。
五、完善的会员系统
·灵活的会员组功能:通过会员组功能对会员进行权限级别划分,可设置会员级别、收藏夹数、每天下载最大次数、短信息数等;后台直接增加、编辑与删除。
·会员字段自定义,不同会员组都可以有不同的会员信息表单。如:可以分为个人注册与公司注册。
·会员空间功能:
支持不同会员选择不同的会员空间模板。(模板后台直接增加与管理)。
·完善的会员收费机制:
可按“会员有效期(包年/季/月)”、“点数”等形式对会员收费。
·在线支付与充值系统:支持“点卡充值”、“在线网银支付充值”等多种充值方式,可充值“有效期”、“会员级别”、“点数”。
·会员消费机制:会员通过权限级别、有效期、点数可在网站各个系统中查看信息、下载资料、发布信息与购买商品进行消费。发布信息支持增加积分或扣除积分、支持级别限制。
·站内信息功能:会员可拥有自己的“收件箱”、“发件箱”,并且可向各会员进行信息发送与相互交流。
·前台信息投稿与管理:所有会员均可发布与管理后台开放投稿的系统模型数据。后台可设置发布会员级别、扣除或增加点数、是否可管理信息、发布是否需要审核等等。
·收藏夹功能:会员可对网站的所有信息进行收藏与分类。
·查看消费记录:会员可查看自己的充值点卡与下载扣除点数记录。
·购物车与定单查询
六、万能会员整合接口
通过“万能会员整合接口”可整合任意语言开发的mysql的系统;配置简易,支持会员组与点数的整合。
七、可视化模板制作完全标签化
·制作门槛低:只需会网页编辑软件(如Dreamweaver、Frontpage)即可制作各种出色的模板,无需会任何程序代码,甚至HTML也无需懂。
·内置非常灵活的万能调用标签与灵动标签:能实现各式各样的效果,随心所欲,适用于所有模型。
·每个栏目都可拥有自己的风格:所有栏目或专题页面都可以有自己的页面模板、列表模板、内容模板、JS模板与搜索模板。
·多个网站风格并存:用户可对网站风格进行导入、导出与管理,网站使用哪个风格,只需点击设为默认网站风格即可。
·自定义模板变量:可将一些共用的模块放到公共变量,调用时只需加上变量标签即可,以后修改变量的值即可修改所有显示这个变量标签的内容。
·模板批量操作:可对模板内容进行批量替换、批量导入栏目模板、批量更换列表模板与批量更换内容模板。
·内置完整与全面的模板调用标签:内置众多的标签足以满足各类网站模板制作需求。
·模板标签支持多种操作类型:内置标签支持调用的操作类型:可按“所有信息/栏目/专题/数据表”调用“最新/热门/推荐/评论排行/头条信息/下载排行”的信息,并且支持按SQL语句调用信息;支持多栏目/专题调用:多个调用栏目/专题的ID用”,”隔开即可。
·自定义标签:系统不仅提供了内置的模板标签调用,还提供了标签扩展功能。拥有此功能,用户可自己写函数,然后后台增加标签,就能得到模板解析。一般用于显示系统以外的数据,如:论坛数据、环保监测站中的实时显示数据等等。
·支持多个EmpireCMS系统使用同一数据,可设置默认使用的模板组
八、所见即所得的编辑功能
EmpireCMS 的系统界面与Word 等Office产品紧密集成,可直接从Word里粘贴到EmpireCMS中来。用户也可以在EmpireCMS里直接进行文字的排版处理,还可以在线对 图片进行简单处理。系统支持插入图片、Flash、附件、音频视频、超链接、表格等等。系统会自动将插入的图片、Flash 等文件上传到系统中指定的目录,直接从网上粘贴的文章其图片可以自动保存到本地服务器,可以在图片的指定位置添加指定的水印,这一切都是自动的。
九、信息内容支持存放文本
对 于数据量非常大的信息内容,如小说、论文或其它大型的内容数据来说,存放数据库是非常不适合的。如果存放数据库,单表容量很容易爆增,从而影响数据库效 率。因而帝国引入了此功能,可以将这些大型数据存储到文本文件里,并且系统对文件加密,安全性得到保障。信息内容越大,此方案效果越佳。
十、多级用户权限与内容管理支持
可以通过用户组,把不同的后台管理权限分配给不同的用户,可设置用户只能管理一个或多个栏目的信息与附件,可设置添加、编辑、删除权限分配。管理员可直接后台增加/修改/删除用户组。
十一、全面的操作日志记录
系统会记录用户的登陆日志与操作日志,便于对用户行为的跟踪和对价值数据的发掘,并且可设置是否开启记录日志。
十二、专题及专题组合
·专题:对 于新闻类网站,当一些突发事件发生时,来不及专门新开栏目,这时可以将有关该事件的内容整理成一个专题。EmpireCMS允许编辑自行根据情况随时增加 新的专题,在第一时间给网站的访问者提供丰富的相关信息。专题中的内容即可以是从其它频道里挑选出来的,也可以直接让编辑往该专题里录入内容。
·专题组合:可对已录入的信息依不同条件组合到相应的专题。专题组合支持按关键字查询、SQL条件、相应栏目、发布时间范围、信息ID范围、是否头条/推荐/标题图片等条件进行筛选组合。并且可保存专题组合设置参数,随时可调用。
十三、内置强健、稳定的备份恢复系统
·采用分组备份,系统自动将数据库分成多部分进入导出.理论上不限数据库大小,均可备份与恢复.
·安全性:备份文件均生成*.php文件,并且采用登陆验证,只有登陆的管理员才能进行数据恢复.
·稳定性:系统采集分组备份,每组备份数据大小后台直接设置.
·使用方便:备份文件在线打包、下载与删除.
·灵活性:备份目录、压缩目录在线自定义.
·在线建立、删除数据库,优化、修复、清空、删除数据表功能.
·在线直接恢复数据
·备份EmpireCMS整站非常简单:只需备份数据库+“d”附件目录即可完全备份,其它信息均可后台直接恢复与全站更新。
十四、强大的广告管理插件
·支持广告类型:图片广告、FLASH广告、文字广告、HTML代码广告、弹出广告
·支持广告效果:普通显示、满屏浮动显示、上下浮动显示(左/右)、全屏幕渐隐消失、可移动对话框、对联式广告
·支持标签与JS调用,如果用JS调用,以后只需后台修改广告即可更新广告;可设置广告过期时间,广告管理员更换广告。
十五、自定义信息反馈表单
·多分类的信息反馈系统:后台可增加无限个信息反馈表单。
·自定义反馈表单字段:不同反馈分类的表单都可以有不同的提交字段。后台直接增加、修改与删除反馈字段。
·提交权限控制:可设置哪些级别的会员才可提交反馈。如:设置游客可反馈、设置VIP会员才可反馈等等。
·表单模板:每个分类都可以拥有自己的表单模板。
·管理信息反馈:后台可查看与管理反馈的信息。
十六、内置一些实用的插件
·投票插件:无限投票项目个数、支持单选/多选、可限制IP投票、可设置投票期限;支持标签与JS调用
·友情链接插件:支持多分类
·多分类留言板:可在不同的栏目设置不同的留言板(增加留言分类即可);留言可设置是否需审核;留言可回复;留言权限设置。
·防采集插件:原理是给页面加上各种规则的采集正则,防采集字符越多,采集的难度越大。
十七、内置部分完善的模型
除了用户可自定义系统模型外,系统还内置了部分模型,以后会陆续增加,用户可选装:
·新闻系统模型:系统默认的模型。附带信息来源管理、作者管理、内容关键字管理、过滤字符管理
·下载系统模型:附带下载服务器管理、删除下载记录管理、错误报告管理、批量替换地址权限等功能;防盗链方面:采用定时更新下载验证码+定时更换下载服务器+定时更换下载地址相结合。
·影视系统模型:同下载系统模型,不过它同时支持在线观看多媒体的信息;防盗链方面:采用定时更新下载验证码+定时更换下载服务器+定时更换下载地址相结合、并且在线观看采用更严密的加密方式,保护多媒体地址
·图库系统模型支持单图片与图片集。
·FLASH系统模型
·商城系统模型:附带支付方式管理、配送方式管理、订单管理;支持各种支付方式。
·文章系统模型(存放文本):此模型与数据库式的新闻模型不同的是,它将信息内容存放于文本文件,用户可依不同情况选用。
·信息分类系统模型
十八、无限级栏目分类
系统支持无限级栏目分类;各栏目可绑定相应的二级域名。
十九、远程发布功能
远程发布即用户可以将机器装于127.0.0.1下,然后将信息发布到远程的服务器的功能。目前是采集WEB方式发布,以后版本会考虑采用.exe的形式发布,效率更高。
二十、信息签发功能
此功能一般用于政府或事业单位。即信息需要通过多个管理人员签名才能发布,对于重要信息是很有必要的,减少出错率。
二十一、文件管理模块
文件管理支持数据库式与目录式管理;附件可按栏目进行管理;用户可在信息增加时选择已上传的图片/FLASH/多媒体/附件等;删除相应的信息,系统会删除隶属于此信息的附件;清理失效附件功能。
二十二、前台全生成静态页面
EmpireCMS 将网站内容全部生成静态HTML文件,这样可以极大地节约主机资源,提高系统性能,全静态处理技术是做为构建大型站点的必要条件。无论是再强大的CPU, 再高明的数据库,在大量用户访问的情况下也会当机的,而使用我们的程序会避免此类问题发生。这也就是为什么“新浪”“网易”甚至包括SOHU的网站界面都 是静态发布的原因了。
二十三、计划任务
1、刷新任务:可设置定时更新首页/栏目页面;只要后台开着,系统自己会执行相应的任务;
2、计划任务,定义执行特定脚本,如定义刷新页面、采集等。
二十四、后台多界面样式
不同用户可选择不同的后台操作界面,并且用户可以自己制作后台界面,然后添加到后台界面管理里。
二十五、动态发布
列表页支持动态显示
内容页支持触发刷新
通过动态发布与系统模型相结合,可实现各种交互性更强的系统,如:供求系统,分类信息,人才招骋等系统。
二十六、前台支持会员发布与管理信息
EmpireCMS4.7版在保持原有完善的后台管理系统基础上,融入了Web2.0互动元素,不仅增强了后台管理系统的可扩展性,而且前台互动性系统的扩展也能发挥得淋漓尽致。只要是后台可投稿的系统模型,前台会员均可发布与管理信息,其有以下功能设置:
·权限设置:设置可以提交信息的会员级别。
·信息审核:可设置发布信息是否需要审核,设为审核增加信息后系统直接生成内容静态页面。
·发布信息消费:设置发布信息需要增加或扣除的点数。
·发布信息自动刷新静态页面:提交信息后可设置是否直接刷新首页、父栏目页与当前栏目页。
·管理信息:可设置投稿信息是否能管理/未审核信息是否可管理。
·所有系统模型均支持前台会员发布信息,无论是系统内置还是用户自定义的系统模型
此功能的应用范围:如分类信息系统、房产系统等互动性系统的扩展。
二十七、信息归档
对于一些旧的信息,用户可以采用信息归档功能,将其归档到其它数据表,以减轻主数据表的负担,使系统稳定性与效率更高。
(1)、可按各种条件设置归档
(2)、增加栏目时设置归档时间
(3)、对归档的信息进行管理,并且可还原归档
二十八、更多特性
·支持WAP、RSS、XML、ATOM等浏览方式
·用户自定义JS功能

·自定义信息列表功能:通过SQL语句,自己组合各种列表,如报刊中按日期分类等。
·用户自定义页面功能:像公司介绍、联系方式等页面是不需要新建栏目的,定义一个页面即可,并且自定义页面支持所有标签。
·语言包:通过修改语言包就可以更换成其它语言
·系统模型的导入与导出
·标签的导入与导出
·模板组的导入与导出

·支持右键菜单:更方便的管理
·发布信息分卷保存目录可定制性:可按/2008/10/01/*.html、/2008-10-01/*.html或直接*.html等形式的目录结构,文件扩展名可后台直接设置
·信息html保存目录可定制性:可存于各栏目目录,也可以自定义存放目录任意目录
·图片支持加水印(支持文字/图片水印)、生成缩略图;图片/flash/多媒体/附件均支持远程保存
·批量替换字段值功能:可替换任何数据表的字段值
·可按不同条件刷新信息(按数据表/栏目/时间范围/信息ID范围等条件进行刷新),而不是全部信息一起刷新,一般增加信息后,只需刷新单天的信息即可;可设置是否重复刷新信息,如果生成过一次后,信息是不重复刷新,大大提高效率;栏目/专题刷新支持选择式多页面刷新或全部刷新
·搜索关键字排行后台直接管理
·对所有信息进行统计
·安装非常容易:只需运行e/install文件,然后下一步、下一步即可完成系统安装
·安装EmpireCMS的运行环境全是免费程序,如:apache、PHP、mysql均为免费软件,降低成本。

ErlyVideo简介

Posted on | 1月 19, 2011 | No Comments

ErlyVideo一个使用Erlang语言编写的FMS替代品,支持HTTP MPEG-TS流、RTMP流和IPhone流。

Erlyvideo是一个RTMP的flash流媒体服务器,用Erlang编写的。它可以替代Adobe Flash媒体服务器,Red5或Wowza。它具有比Red5更自由,比其他流媒体服务器更便宜的特色。它可以利用1GB的带宽,用一台服务器支撑4000甚至更多的客户。

它可以从视频文件(带授权点播),来自Flash视频直播的流,使用RTSP像Wirecast,QuickTime Broadcaster的来源或H.264摄像机,restream的MPEG – TS源(在互联网提供的DVB – S信道可用)中提取视频。

目前支持:

1.

RTMP, RTMPT, RTMPE

2.

MPEG-TS, iPhone, iPad

3.

RTSP, Wirecast, surveillance cameras

4.

Shoutcast, internet radio

5.

H.264/AAC

6.

Live transcoding from Flash to G.711/G.726

http://erlyvideo.org/

修改WordPress文章发布流程

Posted on | 1月 3, 2011 | No Comments

实现Wordpress文章发布完成后,直接跳转到文章列表页

如何定制wordpress控制面板

Posted on | 1月 3, 2011 | 1 Comment

WordPress is one of the best CMSs out there — if not the best (but of course, I’m biased because I’m a WordPress fanatic). It has loads of handy features that make site administration a breeze. WordPress is a publishing platform with a comment system, a GUI for creating, editing and managing posts and pages, handy built-in tools like the “Export” feature to back up your content, user roles and permissions, and more.

But how much of these features do we really use? Though already simple and user-friendly by default, we might want to customize the WordPress Admin interface to make it even simpler and more manageable for our clients, our co-authors, and ourselves.

Why Customize the WordPress Admin Interface?

Lately, WordPress has reached phenomenally high usage rates. There are over 25 million publishers[1] who use WordPress, making it a popular publishing platform. This means that its use has been extended outside of just a blogging platform (although it was certainly built for bloggers at the start) to other types of sites such as portfolios, business sites, image galleries, and even e-commerce sites.

Here is the problem, though. A robust publishing platform like WordPress has way more features than a regular user would ever need. Take the “Comments” panel for instance: Not everyone is going to need all the moderation privileges it has. Some sites might not even need commenting capabilities on their content. For example, a static informational site that doesn’t have a blog section might not want people to be able to comment on static pages like their About and Contact Us page.

The following image shows the default WordPress Dashboard — the first page you’ll see when you log into the Admin area. For tech-savvy folks and power users, it’s great. But imagine a person (such as a paying client of yours) who doesn’t need half of the things they see in this screen. All they want to do is publish a post. Maybe edit it if they make a mistake. That’s it. Nothing else.

The Solution

Luckily, WordPress has a solution. A good one. A completely modular and reversible one, in case you want to quickly revert back to the way things were.

The solution is called Hooks, also known as “Filters” and “Actions”. These guys allow us to “hook” into the WordPress core without modifying its files so that we can safely make changes without compromising the integrity of our installation.

We are going to use WordPress’s different actions and some of the available filters to remove features we do not need. We will also make some basic customization changes to brand our WordPress Admin area for our clients.

The snippets we will be using are mostly from my site, WP Snippets, a searchable repository of WordPress snippets (check it out when you have the time).

WordPress’s functions.php

Let’s get started. The first thing you need to do is open up functions.php in your theme’s directory. If you don’t have a functions.php file, then just create one using your favorite text editor.

functions.php is the file where we will put all our code in. WordPress automatically checks this file, allowing you to customize just about everything before it’s rendered on the screen.

Sounds fuzzy? Here’s how it works. Try out the following code. Don’t worry; it will only affect the Admin area — so your site visitors won’t see it. However, I do want to advise you to experiment offline by installing WordPress on your computer (it’s easier than you think).

<php
function testing() {
  echo 'Hello World!';
}

add_action( 'admin_head', 'testing' ); 
?>

Explanation

The code should print ‘Hello World!’ inside the <head> tags in the Admin panel, which isn’t valid HTML code and therefore is printed out at the top of the web page.

The testing() function is our code that we want to run. To hook into WordPress core, we use the add_action() function. In this situation, we pass in two parameters. The first parameter is the name of the action you want to hook into ('admin_head'). The second parameter is the name of the function you want to run ('testing').

After you try this code snippet out, be sure to remove this code from your functions.php file (we’re done with it).

Disable Dashboard Widgets

The first thing people will see when logging into the Admin area is the Dashboard. There, you’ll find widgets like “WordPress Blog,” “Other WordPress News,” and “Incoming Links”. Not very interesting for the average user.

We will be using the wp_dashboard_setup action to remove them. In the function we want to execute, we will use the unset() function to remove the Dashboard widgets we don’t want to display. Then all we need to do is call add_action() using 'wp_dashboard_setup' as the first parameter as well as our function, named remove_dashboard_widgets, as the second parameter.

function remove_dashboard_widgets(){
  global$wp_meta_boxes;
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); 
}

add_action('wp_dashboard_setup', 'remove_dashboard_widgets');

Check out the WordPress docs entry on removing dashboard widgets for more information.

Disable Standard Widgets

WordPress comes with 12 standard widgets. Some of these default widgets include Calender (WP_Widget_Calendar), Search (WP_Widget_Search) and Recent Comments (WP_Widget_Recent_Comments).

You might want to disable the widgets that aren’t needed for your WordPress installation, again, to simplify and declutter your publishing platform. For example, you might not need the calendar, or maybe you’ve used a third-party search service such as Google Custom Search for your client’s WordPress installation.

For this one, we will be using widgets_init action. We will name our function simply as remove_some_wp_widgets. In our function, we will use WordPress’s unregister_widget() function using the names of the widgets we don’t want to use as the parameter.

Then, like before, we just call add_action. What you’ll see in this code snippet is a third parameter ('1'). The third parameter is the priority of the action. 10 is the default priority, meaning that if you don’t pass a value for this optional parameter, it will assume the value is 10. The lower the number, the higher the priority. So at 1, this is one of the top priority functions that will be called first no matter what its position is in functions.php.

function remove_some_wp_widgets(){
  unregister_widget('WP_Widget_Calendar');
  unregister_widget('WP_Widget_Search');
  unregister_widget('WP_Widget_Recent_Comments');
}

add_action('widgets_init',remove_some_wp_widgets', 1);

Learn more about the Widgets API to see other cool stuff you can do with it.

Removing Menu Items

You might want to remove menu items in the Admin panel to simplify the interface.

This is how you disable top-level menu items such as “Posts,” “Media,” “Appearance,” and “Tools”:

function remove_menu_items() {
  global $menu;
  $restricted = array(__('Links'), __('Comments'), __('Media'),
  __('Plugins'), __('Tools'), __('Users'));
  end ($menu);
  while (prev($menu)){
    $value = explode(' ',$menu[key($menu)][0]);
    if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){
      unset($menu[key($menu)]);}
    }
  }

add_action('admin_menu', 'remove_menu_items');

This is how you would remove submenu items under the top-level navigation (for example, the “Theme” link under “Appearance”):

function remove_submenus() {
  global $submenu;
  unset($submenu['index.php'][10]); // Removes 'Updates'.
  unset($submenu['themes.php'][5]); // Removes 'Themes'.
  unset($submenu['options-general.php'][15]); // Removes 'Writing'.
  unset($submenu['options-general.php'][25]); // Removes 'Discussion'.
  unset($submenu['edit.php'][16]); // Removes 'Tags'.  
}

add_action('admin_menu', 'remove_submenus');

To find what the submenu names are, just go to wp-admin/menu.php and search for the item you want to disable.

Remove the Editor Submenu Item

The Editor link (a submenu item under “Appearance”) is a bit tricky to disable. It doesn’t respond to the unset() function used above. Thus, if we wanted to remove it from the menu, we’d have to remove the action that displays it.

We will use the remove_action() function which simply removes the action from our theme.

function remove_editor_menu() {
  remove_action('admin_menu', '_add_themes_utility_last', 101);
}

add_action('_admin_menu', 'remove_editor_menu', 1);

Disable Meta Boxes in the Editing Pages

The “Add New” and “Edit” pages — the GUI for creating and editing posts and pages — is probably the most used feature in the Admin area. This is what you and/or your clients will be most exposed to. It serves us well if we try to clean these pages up by removing things that we do not need.

For example, do you use any Custom fields or do you use the Excerpts field? If not, just remove them from this view.

The following code snippet uses the remove_meta_box() function. The first parameter is the meta box’s HTML ID attribute you want to remove.

To find out the ID, just inspect the source code or use a tool like the Web Developer Toolbar to determine the ID attribute value of the section’s containing <div>. For example, the Custom Fields’ ID is #postcustom, so the parameter we use is 'postcustom'.

The second parameter refers to the page you want to remove the meta box from (it can be either 'post', 'page', or 'link').

We are going to remove the custom field, Trackbacks checkbox (because most of the time, we either enable or disable it in all of our posts), the comments status option, tags (if you don’t tag your posts with keywords, why have this input field?), and so on.

function customize_meta_boxes() {
  /* Removes meta boxes from Posts */
  remove_meta_box('postcustom','post','normal');
  remove_meta_box('trackbacksdiv','post','normal');
  remove_meta_box('commentstatusdiv','post','normal');
  remove_meta_box('commentsdiv','post','normal');
  remove_meta_box('tagsdiv-post_tag','post','normal');
  remove_meta_box('postexcerpt','post','normal');
  /* Removes meta boxes from pages */
  remove_meta_box('postcustom','page','normal');
  remove_meta_box('trackbacksdiv','page','normal');
  remove_meta_box('commentstatusdiv','page','normal');
  remove_meta_box('commentsdiv','page','normal'); 
}

add_action('admin_init','customize_meta_boxes');

Remove Items from the Post and Page Columns

WordPress’s Admin area often has tables that give you a quick overview of a listing of your content. If you wanted to remove columns from these views, you can.

This time, we will use the add_filter() WordPress function to add a filter instead of an action. A filter is simply a function that watches out for data being called from the database. When it sees something that we want to remove (or modify), it executes the filter first before rendering the data on the web page.

In the example below, we will remove the comments count from the Edit Pages and Edit Posts pages.

function custom_post_columns($defaults) {
  unset($defaults['comments']);
  return $defaults;
}

add_filter('manage_posts_columns', 'custom_post_columns');

function custom_pages_columns($defaults) {
  unset($defaults['comments']);
  return $defaults;
}

add_filter('manage_pages_columns', 'custom_pages_columns');

Customize the Favorites Dropdown

Sitting at the top bar of the Admin area is a dropdown called “favorites” that just lists commonly used Admin tasks such as “New Post,” “Comments” (which takes you to the comment moderation page), and so on — for easy access.

If we wanted to remove items in this menu, we can easily do so. (Of course, we can also add stuff here too.) We can do this by adding another filter and unsetting the link, which is contained in a PHP array called $actions.

function custom_favorite_actions($actions) {
  unset($actions['edit-comments.php']);
  return $actions;
}

add_filter('favorite_actions', 'custom_favorite_actions');

The Final Stretch: Miscellaneous Modifications

Everything we have done so far is to disable stuff we don’t need. Now we’ll modify a few things.

Customize the Footer

The footer text in WordPress Admin contains links to the Documentation and to WordPress. Let’s change that.

This snippet just prints out some footer text.

function modify_footer_admin () {
  echo 'Created by <a href="http://example.com">Filip</a>.';
  echo 'Powered by<a href="http://WordPress.org">WordPress</a>.';
}

add_filter('admin_footer_text', 'modify_footer_admin');

Change the Logo

This one’s an old trick, but a good one nonetheless. You can change the logo for the login page and the one in the top left located at the WordPress Admin area pages.

The subsequent code snippet just prints out the CSS (that will be printed inside the <head> tags of Admin pages) that hooks into the div of the logo; it has an ID of #header-logo in the admin pages and it is the h1 > a element for the login page.

For the url property of the style rules, we just feed it the image location of our logo. If the image is inside your WordPress theme’s directory, you can simply use the get_bloginfo('template_directory') template tag to get the relative path to it, followed by the location of the images directory (in this case, it’s called “images”) and then the file name of your image (in this case, admin_logo.png and login_logo.png).

function custom_logo() {
  echo '<style type="text/css">
    #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/admin_logo.png) !important; }
    </style>';
}

add_action('admin_head', 'custom_logo');

function custom_login_logo() {
  echo '<style type="text/css">
    h1 a { background-image:url('.get_bloginfo('template_directory').'/images/login_logo.png) !important; }
    </style>';
}

add_action('login_head', 'custom_login_logo');

Hide the Upgrade Notice to Recent Versions

There’s no guarantee that your theme will support the next version of WordPress, so to prevent your clients from updating their website, you can ask WordPress to hide this notification.

First, I have to say that this isn’t advisable. WordPress core developers put this notification there for a huge reason: Security updates. But if you must remove it (or modify it), all you have to do is to add a filter for it.

add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );

Customize the WYSIWYG Editor’s CSS

If you wanted to customize the appearance of the WYSIWYG editor (maybe to match the theme of your site), you can create a custom stylesheet for it (you can call it something like editor-style.css) and then study the HTML markup to see how you can hook into the classes and IDs of the editor. Then to add your custom stylesheet, you can use the add_editor_style() function.

add_editor_style('css/editor-style.css');

The reason why you’d want to do this instead of modifying the global.css stylesheet that comes with WordPress is ease of updating the core and modularity. If there’s one major theme to take away in this guide, it’s that you should never modify WordPress core files — there are plenty of ways to hook into them.

The Outcome

Using these snippets of code, you can customize and reduce the Admin area’s features down to just the essentials, permitting us to benefit from the advantages of minimalism and reductionism principles in our work.

This is what I’ve been doing, and my clients love that all the clutter that they don’t need isn’t there.

Here’s a final image of my result (for the “Add New Post” page):

Your Turn

Now it’s your turn to talk. Do you customize WordPress in any way for your customers, and if so, how? The depth of WordPress is incredible, and I would love to see more tips and tricks about how to make it even simpler — share your tips and tricks in the comments.

英文版原文:

http://sixrevisions.com/wordpress/how-to-customize-the-wordpress-admin-area/

中文版:

http://www.zhaokunyao.com/archives/1257

Post video players, slideshow albums, photo galleries and music / podcast playlist

Posted on | 1月 2, 2011 | No Comments

正想找几款wordpress插件,解决

1. 视频上传的问题

2.想实现类似 http://sports.qq.com/a/20101226/000488.htm#p=1

或 这样 http://sports.163.com/10/1226/17/6ORJAQL100051C8V.html#p=6ORIGEBR00DE0005  的文章多图浏览效果

今看到wp上推荐了这款听起来能解决很多问题的插件,好像不错 试用看看

One professional plugin for all your multi-media needs – Free Visit Site >> :

*  Add Image galleries
*  Add Slideshows and photo albums
*  Add Video
*  Add Music playlists
*  Add Podcast and mp3
*  Add Menus and much more
*  Media Library
  • 44 skins and more – slideshow, video players, playlists, flash, full-screen, Cooliris, lightbox and wedding skins etc
  • Automatic uploading and hosting
  • Automatic resizing of photos
  • Automatic video transcoding to flv/3gp/mp4
  • Complete analytics of your traffic
  • Support iPhone, iPad, blackberry automatically and other smart and mobile phones
  • Hosting and delivering your media on Amazon S3 Web Services ensure scalability and reliability.
  • Video hosting, video serving, video streaming and pseudo streaming (progressive download) solutions
  • Managment of the galleries is simple and straight forward
  • Many types of players to choose from including JW, flowplay, Cooliris and others
  • Many customization options, sizes, colors, text etc
  • Support playlist with customizable side, bottom and top list using CSS
  • Add caption and description to any item
  • Integrates with your CDN solution
  • Managment tool to allow your users/designers/web master to upload videos
  • Embed code button directly into article
  • Progressive Download (Pseudo streaming – httpd)
  • HD widescreen flv and H.264, ideal for videoblog and photoblog
  • Supported file types – avi, mov, wmv, mp4, m4a, f4a, f4b, f4v, f4p, m2ts, mts, DVD vob, mkv, rmvb, m1v, qt, div, divx, dv, 3gp, 3gpp, 3g2, mpg, mpeg, mpe, flv, wav, wma
  • Preview image in 4 sizes (for first frame of video).
  • Full Screen feature.
  • Domain lock feature to protect your video
  • Download source feature
  • On screen Logo for branding
  • Google analytics Tracking Enabled
  • Support other CMS systems and public web sites
  • Post to your blog from anywhere and even if your videos are at home on your PC
  • The plugin is FREE, we do offer a pro account with even more options.

Cincopa Content Gallery creates an automated, fully customizable image gallery, slideshows, video and music playlists anywhere within your WordPress site. Choose your videos, images and music and display skin, pages or posts with custom overlay text and a rotating thumbnail belts.

Now with new video players and slideshows!

Download now!

Get more information about Cincopa WordPress Plugin and see some examples.

For comments, questions and support use this email oren.wp.plugin@cincopa.com

Buddypress and wpmu

Ideal multimedia solution for buddypress and mu because each user gets his own private storage space with zero cost to site owner.

Author: orenshmu

http://wordpress.org/extend/plugins/cincopa-video-slideshow-photo-gallery-podcast-plugin/

« go backkeep looking »

About

博主 hgta

Search

Admin