<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FV.Zone &#187; Plugin</title>
	<atom:link href="http://www.fvzone.com/blog/tag/plugin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fvzone.com/blog</link>
	<description>生命最快乐时,就是与你分享时!</description>
	<lastBuildDate>Fri, 28 May 2010 16:30:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Fvcode 帖代码的小插件</title>
		<link>http://www.fvzone.com/blog/fvcode.fv</link>
		<comments>http://www.fvzone.com/blog/fvcode.fv#comments</comments>
		<pubDate>Thu, 12 Jun 2008 08:10:32 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://fvzone.com/blog/?p=139</guid>
		<description><![CDATA[呵呵，这只是实验性的，也根本没有实际用途，功能也过于单一，不过我还是觉得够用了。
一直想找一个小巧的灵活的帖代码插件，但一直没有找到，于是今天花了一个小时研究了一下，写出... ]]></description>
			<content:encoded><![CDATA[<p>呵呵，这只是实验性的，也根本没有实际用途，功能也过于单一，不过我还是觉得够用了。<br />
一直想找一个小巧的灵活的帖代码插件，但一直没有找到，于是今天花了一个小时研究了一下，写出了这个小插件。</p>
<p>使用他很方便只要插入:</p>
<p><strong>&lt;code&gt;&lt;?php echo $test; &gt;&lt;/code&gt;</strong></p>
<p><strong>效果演示:</strong></p>
<pre class="syntax-highlight:php">/* 我就是演示了 */
&lt;?php phpinfo(); ?&gt;
&lt;html&gt;
&lt;!-- test --&gt;
&lt;/html&gt;</pre>
<p>就能显示代码了,这也符合我平时的习惯，还很好的向以后更换插件做好了兼容工作，如果像使用
<pre class="syntax-highlight:php"></pre>
<p>之类的特殊符号，那以后会很麻烦的。<br />
<span id="more-139"></span><br />
因为太小所以就不放下载了<br />
直接帖出代码，下面是PHP代码和CSS样式表</p>
<pre class="syntax-highlight:php">
&lt;?php
# -*- coding: utf-8 -*-
/*
Plugin Name: FVcode
Plugin URI: http://fvzone.com/blog/fvcodefvcode.fv
Description: 这是一个小东西
Author: FV.zone
Version: 0.0.0.2
Author URI: http://fvzone.com/blog/
*/
require_once(ABSPATH.&#039;wp-config.php&#039;);
require_once(ABSPATH.&#039;wp-settings.php&#039;);

function fvcode_style()
{
 $css_url = get_bloginfo(&quot;wpurl&quot;) . &#039;/&#039; . PLUGINDIR . &#039;/&#039; . dirname(plugin_basename (__FILE__)).&quot;/fvcode.css&quot;;
  echo &quot;\n&quot;.&#039;&lt;link rel=&quot;stylesheet&quot; href=&quot;&#039; . $css_url . &#039;&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;&#039;.&quot;\n&quot;;
}

  function fvcode_code($match)
  {
    foreach ($match as $value) {
      $value = htmlspecialchars($value);
      $content = nl2br($value);
    }

  $o = &#039;&lt;div class=&quot;fvcode&quot;&gt;&#039;;
  $o .= &#039;&lt;div class=&quot;code&quot;&gt;&#039;.$content.&#039;&lt;/div&gt;&#039;;
  $o .= &#039;&lt;/div&gt;&#039;;
  $o .= &#039;&lt;div class=&quot;clear&quot;&gt;&lt;/div&gt;&#039;;

  return $o;
}

function fvcode($content) {
		$content = preg_replace_callback(&quot;/\s*&lt;code&gt;\s*(.+?)\s*&lt;\/code&gt;\s*/sim&quot;, &#039;fvcode_code&#039;, $content);
		return $content;
}

function fvcode_format($content) {
    $content = str_replace(&quot;&amp;#8211;&quot;, &quot;--&quot;, $content);
	return $content;
}

add_action(&#039;wp_head&#039;, &#039;fvcode_style&#039;);

add_filter (&#039;the_content&#039;,&#039;fvcode_format&#039;);
add_filter (&#039;the_excerpt&#039;,&#039;fvcode_format&#039;);
add_filter (&#039;comment_text&#039;,&#039;fvcode_format&#039;);

add_filter(&#039;the_content&#039;, &#039;fvcode&#039;,9);
add_filter(&#039;the_excerpt&#039;, &#039;fvcode&#039;,9);
add_filter(&#039;comment_text&#039;, &#039;fvcode&#039;,9);

?&gt;</pre>
<p>你只要将这个代码复制保存命名随便，然后建立一个文件夹或是不建立也行，放到plugins目录里，在后台激活就可以了。</p>
<p>CSS样式:</p>
<pre class="syntax-highlight:css">/*
coding: utf-8
*/
.clear{clear:both;}
.fvcode {
	margin:6px 0;
	font:12px &quot;Lucida Grande&quot;,Verdana,Arial,Sans-Serif;
	text-align:left;
}
.code {
	padding:6px;
	float:left;
	line-height:18px;
	background:#ECF6FF;
	color:#666;
	border:1px solid #D6E9FC;
	display: inline;
}</pre>
<p>CSS要把保存的名字命为:fvcode.css才行，当然你也可以改掉PHP里面的定义，这个随便你。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/fvcode.fv/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Mint v2.11使用</title>
		<link>http://www.fvzone.com/blog/mint-211.fv</link>
		<comments>http://www.fvzone.com/blog/mint-211.fv#comments</comments>
		<pubDate>Tue, 18 Sep 2007 12:03:23 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[Web Vision]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Mint]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Skin]]></category>
		<category><![CDATA[统计]]></category>

		<guid isPermaLink="false">http://www.fvzone.com/blog/mint-211.fv</guid>
		<description><![CDATA[更新: 2007.10.8
现在已经有2.12版本了,如果有需要请下Email!
前段时间在V2EX上看到这个程序，都说很Web 2.0的一个统计程序，那就说说她的特点吧!
简单的说，它就是一个网站统计程序，但是跟一般... ]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong>更新: 2007.10.8<br />
现在已经有2.12版本了,如果有需要请下Email!</strong></p></blockquote>
<p>前段时间在V2EX上看到这个程序，都说很Web 2.0的一个统计程序，那就说说她的特点吧!</p>
<p>简单的说，它就是一个网站统计程序，但是跟一般的网站统计不同的是，它是建立在网站自己的空间上的，这样最大的优点就是减少了输出网页的时间。而且Mint的可定制性很强，可以根据个人喜好，自行添加统计插件与风格，你也可以自己设计风格，不过还是觉得官方用了很多心思去设计UI。<br />
<img src='http://www.fvzone.com/blog/wp-content/uploads/2007/09/mint.jpg' alt='' /><br />
<span id="more-105"></span></p>
<p>还有一点要提一下，就是他是一个商业软件，想拥有需要支付30$一个域名，当然也有盗版的&#8230;</p>
<p>目前我只是简单的应用了而已，我并没有加入任何插件，主要是因为我觉得我就一个Blog，而且写日志的时候都很少，默认的功能完全够用了，我也舍不得花30$去买，安装Mint完全是为了体验UI，嘻嘻&#8230;</p>
<p>目前我的Mint版本是2.11 插件就两个：<br />
<strong>Default Pepper</strong> ; 这个是Mint的核心了，通过它可以查看到特定时间之内的网站访问数，平也能够统计网站访问的来路和访问目标等等。它通过不同的版面展示了网站的pageview,referrer,还有搜索关键字等等。<br />
<strong>backuprestore</strong> ;顾名思义，因为Mint的访问数据都是存在mysql数据库中的，所以备份数据是很重要的。</p>
<p>核心自带两款风格，还外加了以下风格<br />
<strong>- Clearmint;<br />
- Clearmint Ice;<br />
- Massive Blue;<br />
- Pepper Mint; </strong></p>
<p>以后我可能会安装一些插件吧，时间也不是很多，毕竟搞一个Blog已经比较累了，还要工作，还要修改我的XMPP Robot，偶然也喜欢发布一下自己写的WP风格，所以时间真的有限。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/mint-211.fv/feed</wfw:commentRss>
		<slash:comments>56</slash:comments>
		</item>
		<item>
		<title>wordpress之我使用的插件</title>
		<link>http://www.fvzone.com/blog/wp%e4%b9%8b%e6%88%91%e4%bd%bf%e7%94%a8%e7%9a%84%e6%8f%92%e4%bb%b6.fv</link>
		<comments>http://www.fvzone.com/blog/wp%e4%b9%8b%e6%88%91%e4%bd%bf%e7%94%a8%e7%9a%84%e6%8f%92%e4%bb%b6.fv#comments</comments>
		<pubDate>Tue, 16 May 2006 00:57:27 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.osye.com/blog/?p=53</guid>
		<description><![CDATA[很久就想写一个关于我使用WP做BLOG平台的心得,可是也一直没有时间。
我建设Blog有半年了,刚开始在国内找程序,试用了很多Blog程序,都以失败告终,让我最深刻的是C-Blog我还做了官方BBS的版主,本... ]]></description>
			<content:encoded><![CDATA[<p>很久就想写一个关于我使用WP做BLOG平台的心得,可是也一直没有时间。</p>
<p>我建设Blog有半年了,刚开始在国内找程序,试用了很多Blog程序,都以失败告终,让我最深刻的是C-Blog我还做了官方BBS的版主,本来我是一直都支持的，可是&#8230;现在官方的资料突然没了，不知道站长是怎么搞的，这几天连站也关了。<span id="more-53"></span></p>
<p>后来经朋友介绍使用WP，刚开始走了很弯路,但是Blog就是要自己亲手做才有意思。</p>
<p style="color: #ffcc33; font-weight: bold; font-size: 14px">我使用的插件列表：</p>
<p><strong>Anti Spam Image </strong>   (为你的Blog评论加入一个防垃圾评论机制,就是在你评论的时候要你输入验证码)；</p>
<p><strong>Audio player</strong>    (一个漂亮的MP3播放器,后台控制,可改变皮肤颜色等)；</p>
<p><strong>Ajax Spoiler </strong>   (一个用prototype JS实现的效果类,Spoiler 主要功能是隐藏和显示文章,只要在写文章时加入即可,看上去很漂亮)；</p>
<p><strong>Theme Switcher</strong>    (我想这个大家一看就知道是什么了,没错,是一个模板前台切换工具)；</p>
<p><strong>OSYE tabpane</strong>    (一个很不错的菜单动态切换JS类,由hhalloyy发现,我插件化的,你可以在我Blog上找到下载地址)；</p>
<p><strong>Ultimate Tag Warrior</strong>       (不用多说,说的太多了&#8230;.)；</p>
<p><strong>WordPress Database Backup</strong>     (WP自带的数据备分插件,当然这个不能少的)；</p>
<p><strong>Jalenack&#8217;s Wordspew</strong>     (一个AJAX留言插件)；</p>
<p><strong>Contact Form </strong>   (为你的Blog加入一个联系中心,别人可以通过这个发邮件到你的邮箱!)；</p>
<p><strong>Adhesive</strong>     (如果你想把你的某一篇文章总是显示在最前面，那就用这个置顶插件吧)；</p>
<p><strong>Democracy</strong>  (一个投票程序,我用着还不错,你也可以试试)；</p>
<p><strong>Lightbox JS</strong>   (很不错的图像显示插件,给你一个很cool的显示风格)；</p>
<p><strong>中文 WordPress 工具箱</strong>    (有很多功能,比如最新发表、最新留言，等)；</p>
<p><strong>WP-PageNavi </strong>  （美化你的分页链接，比原来的漂亮多了；</p>
<p><strong>Quote Comment</strong>    (为你的评论加入一个小小的功能，那就是引用)；</p>
<p><strong>iG:Syntax Hiliter </strong>   (代码高亮，我见过最好的，起码比CoolCode好了很多&#8230;)；</p>
<p><strong>Twilight AutoSave</strong>    (如果你写文章的时候突然死机？浏览器崩溃，用这个插件可以动态保存你未写完的文章)；</p>
<p><strong>akismet</strong>    (WP官方防止垃圾留言插件)；</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/wp%e4%b9%8b%e6%88%91%e4%bd%bf%e7%94%a8%e7%9a%84%e6%8f%92%e4%bb%b6.fv/feed</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>WordPress Plugin Ajax-spoiler</title>
		<link>http://www.fvzone.com/blog/%e4%b8%80%e4%b8%aa%e4%b8%8d%e9%94%99%e7%9a%84wp%e6%8f%92%e4%bb%b6-aj-spoiler.fv</link>
		<comments>http://www.fvzone.com/blog/%e4%b8%80%e4%b8%aa%e4%b8%8d%e9%94%99%e7%9a%84wp%e6%8f%92%e4%bb%b6-aj-spoiler.fv#comments</comments>
		<pubDate>Sat, 25 Feb 2006 13:29:23 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.osye.com/blog/?p=23</guid>
		<description><![CDATA[是一个用Prototype的效果插件,主要功能是动态显示和隐藏指定内容,并有不少效果,看上去很不错,实用性也很高。
原作者网站是http://www.waikay.net
他写的只是一个简单的几行JS代码,后来由一个韩国BL... ]]></description>
			<content:encoded><![CDATA[<p>是一个用Prototype的效果插件,主要功能是动态显示和隐藏指定内容,并有不少效果,看上去很不错,实用性也很高。<br />
原作者网站是http://www.waikay.net<br />
他写的只是一个简单的几行JS代码,后来由一个韩国BLOG二次开发修改并加入了大有名气的Prototype AJAX类。<br />
他的网站是http://082net.com/<br />
Prototype 本身就是一个编写精美强大的AJAX类。</p>
<p><strong>演示效果</strong><br />
<span id="more-23"></span>我最早是在HAOOOO的BLOG上看到那效果，后来他告诉我名字，我就是在http://082net.com/下载到的。<br />
我将我改后的aj-spoiler提供给大家，我自己加入了moo.fx.pack.js文件，也是Prototype一家的，只是有个别区别。<br />
要知道详细的moo.fx.pack.js说明,请访问:http://moofx.mad4milk.net</p>
<p><strong>原作者下载地址：</strong><a href="http://082net.com/tag/aj-spoiler/">点击</a><br />
<strong>我修改的下载地址：</strong><a href="http://www.osye.com/soft/aj-spoiler.rar">点击</a><br />
备注：使用方法下载请看&#8221;主文件&#8221;aj-spoiler.php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/%e4%b8%80%e4%b8%aa%e4%b8%8d%e9%94%99%e7%9a%84wp%e6%8f%92%e4%bb%b6-aj-spoiler.fv/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Free titles 发布</title>
		<link>http://www.fvzone.com/blog/freetitles-%e5%8f%91%e5%b8%83.fv</link>
		<comments>http://www.fvzone.com/blog/freetitles-%e5%8f%91%e5%b8%83.fv#comments</comments>
		<pubDate>Thu, 02 Feb 2006 08:35:23 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.rcsky.org/blog/?p=10</guid>
		<description><![CDATA[Free titles是一种当鼠标停在标题或是链接上的时候给出一个提示的小插件,用于美比你的BLOG
JS原作者不是我
演示：请点击
1、下载freetitles
安装方法:2、将freetitles.rar解压缩传至：
/wp-content/plugins/*... ]]></description>
			<content:encoded><![CDATA[<p>Free titles是一种当鼠标停在标题或是链接上的时候给出一个提示的小插件,用于美比你的BLOG<br />
<strong>JS原作者不是我</strong></p>
<p>演示：<a href="http://www.rcsky.org/soft/freetitles.rar">请点击<br />
1、下载freetitles</a><span id="more-10"></span><br />
安装方法:2、将freetitles.rar解压缩传至：</p>
<pre class="syntax-highlight:php">/wp-content/plugins/************
/wp-content/plugins/freetitles/
/freetitles.php
/FreeFirefox.js
/freetitles.css
/freetitles.gif
/freetitles.js </pre>
<p>3、进入管理后台，在插件下找到Free titles 激活便可以使用，不需要任何修改~！祝大家新年快乐~!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/freetitles-%e5%8f%91%e5%b8%83.fv/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dissect WordPress Plugin</title>
		<link>http://www.fvzone.com/blog/dissect-wordpress-plugin.fv</link>
		<comments>http://www.fvzone.com/blog/dissect-wordpress-plugin.fv#comments</comments>
		<pubDate>Thu, 02 Feb 2006 04:39:18 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>

		<guid isPermaLink="false">http://www.rcsky.org/blog/?p=7</guid>
		<description><![CDATA[一直对软件的组件、插件架构非常感兴趣，我认为现在开发任何应用程序，一定要有一个架构良好的插件机制，这样可以吸引其他人来开发插件，极大的扩充系统的功能。Eclipse就是一个非常棒... ]]></description>
			<content:encoded><![CDATA[<p>一直对软件的组件、插件架构非常感兴趣，我认为现在开发任何应用程序，一定要有一个架构良好的插件机制，这样可以吸引其他人来开发插件，极大的扩充系统的功能。Eclipse就是一个非常棒的例子，几乎你想什么功能，都可以从社区中找到相应的<span id="more-7"></span><br />
第三方插件。Firefox也同样如此，它的插件机制非常灵活（尤其是相对IE而言），因此Firefox社区中可以找到各种各样的插件。</p>
<p>就像Nat在Open Source Summit中的一句话：</p>
<p>You have to give people work to do.<br />
Create an “architecture of participation” as Tim O’Reilly says.</p>
<p>自从开始使用WordPress，就想学习学习WordPress强大的插件机制。以前曾经研究过的COM、XPCOM、Firefox Extensions、Eclipse Plugin都是桌面应用级别的组件结构，而对Web应用中的插件确实知之甚少，于是，Dissect了一下WordPress（1.5.1.3）。虽然对PHP不是很熟悉，不过看看源码还是问题不大。</p>
<p>1）WordPress读取所有可用的插件</p>
<p>在文件“admin-functions.php”中，函数</p>
<pre class="syntax-highlight:php">&lt;?php function get_plugins() ?&gt; ?&gt;</pre>
<p>用来从文件系统得到所有的插件。原理很简单，就是读取’wp-content/plugins’目录下的所有PHP文件。这个函数允许一级的子文件夹，也就是说在’wp-content/plugins’下面的PHP文件，以及所以在此目录下的一级子文件夹内部的PHP文件被列作插件的候选，用下面的函数去进一步提取插件信息。这样的好处是方便用户利用文件夹来对插件进行管理和组织。</p>
<p>而函数</p>
<pre class="syntax-highlight:php">&lt;?php function get_plugin_data() ?&gt;</pre>
<p>用来得到插件的描述（Plugin Descriptor），主要包括插件的版本、名称、作者，等信息，而这些其实是以注释的方式存在的。用WordPress中自带的Hello插件来举例：</p>
<pre class="syntax-highlight:php"> &lt;?php
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/#
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire ...
Author: Matt Mullenweg
Version: 1.0
Author URI: http://photomatt.net/
 ?&gt;</pre>
<p>这样，在get_plugin_data函数中，就可以来得到插件的详细信息。</p>
<pre class="syntax-highlight:php">&lt;?php
function get_plugin_data($plugin_file) {
    $plugin_data = implode(&#039;&#039;, file($plugin_file));
    preg_match(&quot;|Plugin Name:(.*)|i&quot;, $plugin_data, $plugin_name);
    preg_match(&quot;|Plugin URI:(.*)|i&quot;, $plugin_data, $plugin_uri);
    preg_match(&quot;|Description:(.*)|i&quot;, $plugin_data, $description);
    preg_match(&quot;|Author:(.*)|i&quot;, $plugin_data, $author_name);
    preg_match(&quot;|Author URI:(.*)|i&quot;, $plugin_data, $author_uri);
 ?&gt;</pre>
<p>2）Active &amp; Deactive Plugin</p>
<p>Active（Deactive）插件的操作都在Plugins.php中，比如我要Deactive “Hello”这个插件，最后的URL其实是这个样子：</p>
<pre class="syntax-highlight:php">&lt;?php http://localhost/blog/wp-admin/plugins.php?action=deactivate&amp;amp;plugin=hello.php ?&gt;</pre>
<p>其中，“Action”表示动作，值为“active”或者“deactivate”，而“Plugin”表示动作的对象插件，此处为“hello.php”。得到动作指令后，首先从数据库中取出当前已经激活的插件。</p>
<pre class="syntax-highlight:php">&lt;?php $current = get_settings(&#039;active_plugins&#039;); ?&gt;
</pre>
<p>然后根据动作，重新生成已激活插件数组，存入数据库，并重新加载此页。加载的时候就需要考虑这些已经激活的插件是怎么工作的了。</p>
<p>BTW：附上数据库的Options表中0插件和只有1个插件的值：</p>
<p>没有插件：’a:1:{i:0;s:0:&#8221;";}’</p>
<p>只有Hello插件：’a:2:{i:0;s:0:&#8221;";i:1;s:9:&#8221;hello.php&#8221;;}’</p>
<p>3）插件（Active）如何加载到系统中</p>
<p>WordPress中的每页都会包含“wp-config.php”文件，而在“wp-config.php”的最后有这样一句：</p>
<pre class="syntax-highlight:php">&lt;?php require_once(ABSPATH.&#039;wp-settings.php&#039;); ?&gt;</pre>
<p>在“wp-settings.php”文件中，可以找到以下与插件相关的代码片断：</p>
<pre class="syntax-highlight:php"> &lt;?php
if ( get_settings(&#039;active_plugins&#039;) ) {
    $current_plugins = get_settings(&#039;active_plugins&#039;);
    if ( is_array($current_plugins) ) {
        foreach ($current_plugins as $plugin) {
            if (&#039;&#039; != $plugin &amp;&amp; file_exists(ABSPATH . &#039;wp-content/plugins/&#039; . $plugin))
                include_once(ABSPATH . &#039;wp-content/plugins/&#039; . $plugin);
        }
    }
}
 ?&gt;</pre>
<p>可见，这段代码会取出系统中所有Active的插件，并Include进来。所以在每页加载的时候，都会首先Include这些插件代码。那么，这些插件自己在加载的时候都做了什么呢？</p>
<p>4）插件的加载</p>
<p>插件的加载其实最重要的一个部分就是插件的事件注册机制，WordPress插件中的事件注册其实和Eclipse中的扩展点（Extension-Point）机制非常相像，而这种类似“插销”、“插销座”的软件插拔方式也成为了最近软件组件架构方面应用最多的实践。</p>
<p>事件注册过程中比较重要的几个函数分别是：do_action、add_action、add_filter。</p>
<p>WordPress中默认定义了很多扩展点（也可以叫做“钩子”），或者说注册了很多系统事件（WP中的正规叫法应该是“Action Tag”），比如“admin_head”表示Admin页面的Head输出事件，“publish_post”表示发布一篇帖子的事件等等。而插件要做的就是扩展这些扩展点，或者说挂接这些钩子，从而实现系统的扩展功能。add_action就是通常插件扩展某个扩展点用到的函数，而do_action是扩展点本身开始执行的函数。</p>
<p>刚才说过WordPress中的每一页执行前都会Include所有Active的插件代码，而这些代码通常都会用“add_action”来将自己的函数注册到系统的扩展点中。这样，在扩展点执行的时候，就会找到系统中所有已经挂接到这个扩展点上的插件的函数来执行之，从而扩充系统的功能。</p>
<p>WordPress中的很多功能也都是通过这种插件结构来实现的，默认注册了很多系统事件，都在’default-filter.php’中。比如：</p>
<pre class="syntax-highlight:php">&lt;?php add_action(&#039;publish_post&#039;, &#039;generic_ping&#039;); ?&gt;
</pre>
<p>这个是用来在发布每篇帖子的时候发送XML-RPC Ping的。再比如：</p>
<pre class="syntax-highlight:php">&lt;?php add_filter(&#039;the_content&#039;, &#039;convert_smilies&#039;); ?&gt;</pre>
<p>用来将正文（content）中的笑脸符号转换为图像。</p>
<p>还是举“Hello”插件来说。Hello插件会随机的在Admin Page的右上角显示一段话，它的工作原理是这样的：</p>
<p>在每一个Admin page的前面都有</p>
<pre class="syntax-highlight:php">&lt;?php require_once(&#039;admin-header.php&#039;); ?&gt;</pre>
<p>而在“admin-head.php”中将会执行扩展点“admin_head”的所有扩展：</p>
<pre class="syntax-highlight:php"> &lt;?php
do_action(&#039;admin_head&#039;, &#039;&#039;);
 ?&gt;</pre>
<p>这样，就会执行所有挂接到admin_head的函数</p>
<p>Admin Page的Footer部分同样如此，</p>
<pre class="syntax-highlight:php"> &lt;?php
do_action(&#039;admin_footer&#039;, &#039;&#039;);
 ?&gt;
</pre>
<p>这样，就会执行所有挂接到admin_footer的函数</p>
<p>再来看看Hello插件的初始化过程中：</p>
<pre class="syntax-highlight:php">
&lt;?php  

// This just echoes the chosen line, we&#039;ll position it later
function hello_dolly() {
    global $chosen;
    echo &quot;&lt;p id=&#039;dolly&#039;&gt;$chosen&lt;/p&gt;&quot;;
} 

// Now we set that function up to execute when the admin_footer action is called
add_action(&#039;admin_footer&#039;, &#039;hello_dolly&#039;); 

// We need some CSS to position the paragraph
function dolly_css() {
    echo &quot;
    &lt;style type=&#039;text/css&#039;&gt;
    #dolly {
        position: absolute;
        top: 5px;
margin: 0; padding: 0;
        right: 3em;
        font-size: 20px;
        color: #f66;
    }
    &lt;/style&gt;
    &quot;;
} 

add_action(&#039;admin_head&#039;, &#039;dolly_css&#039;); 

?&gt;
</pre>
<p>可见，将dolly的CSS部分插到Header部分，而在footer部分插入显示代码，这样，在AdminPage的右上角就会随机显示一段话。</p>
<p>再来看看曾经说过的Google Sitemap插件，插件中有一项功能是在发布、修改或者删除文章的时候重新Build Sitemap文件，这个功能就是通过注册系统的三个事件（“publish_post”，“edit_post”，“delete_post”）来完成的。</p>
<pre class="syntax-highlight:php">&lt;?php
//Register to various events... @WordPress Dev Team: I wish me a &#039;public_content_changed&#039; action <img src='http://www.fvzone.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
if(defined(&quot;SM_ACTIVE&quot;) &amp;&amp; SM_ACTIVE===true) {
    //If a new post gets published
    add_action(&#039;publish_post&#039;, &#039;sm_buildSitemap&#039;); 

    //Existing post gets edited (published or not)
    add_action(&#039;edit_post&#039;, &#039;sm_buildSitemap&#039;); 

    //Existing posts gets deleted (published or not)
    add_action(&#039;delete_post&#039;, &#039;sm_buildSitemap&#039;);
}
#endregion
 ?&gt;
</pre>
<p>BTW：其中的注释也很有意思，我也觉得确实需要有“public_content_changed”这样一个事件，就不必分别订阅三个单独的事件了。</p>
<p>对了，就在我们刚才说的wp-settings.php中的插件启动后，有</p>
<pre class="syntax-highlight:php">&lt;?php do_action(&#039;plugins_loaded&#039;); ?&gt;</pre>
<p>这样一个系统事件，可以注册这个事件来做一些希望在所有插件Load完毕而做的事儿。</p>
<p>5）如果插件中涉及UI</p>
<p>其实是一样的。以WordPress FeedBurner Plugin中添加菜单为例：</p>
<p>如果想添加一个菜单，就需要注册“admin_menu”这个Action Tag（系统事件）：</p>
<pre class="syntax-highlight:php">
&lt;?php add_action(&#039;admin_menu&#039;, &#039;ol_add_feedburner_options_page&#039;);  ?&gt;</pre>
<p>即可，插件中的这个函数为：</p>
<pre class="syntax-highlight:php"> &lt;?php function ol_add_feedburner_options_page() {
  if (function_exists(&#039;add_options_page&#039;)) {
      add_options_page(&#039;FeedBurner&#039;, &#039;FeedBurner&#039;, 8, basename(__FILE__), &#039;ol_feedburner_options_subpanel&#039;);
  }&lt;br&gt;}
 ?&gt;
</pre>
<p>“add_options_page”这个函数就会在系统的“Options”菜单中添加“FeedBurner”这样一个子菜单。</p>
<p>而这个函数其实就是增加 Menu 或者 SubMenu，</p>
<pre class="syntax-highlight:php">&lt;?php
function add_submenu_page($parent, $page_title, $menu_title, $access_level, $file, $function = &#039;&#039;) {
    global $submenu;
    global $menu; 

    $parent = plugin_basename($parent);
    $file = plugin_basename($file); 

    // If the parent doesn&#039;t already have a submenu, add a link to the parent
    // as the first item in the submenu.  If the submenu file is the same as the
    // parent file someone is trying to link back to the parent manually.  In
    // this case, don&#039;t automatically add a link back to avoid duplication.
    if (! isset($submenu[$parent]) &amp;&amp; $file != $parent) {
        foreach ($menu as $parent_menu) {
            if ($parent_menu[2] == $parent) {
                $submenu[$parent][] = $parent_menu;
            }
        }
    } 

    $submenu[$parent][] = array($menu_title, $access_level, $file, $page_title); 

    $hookname = get_plugin_page_hookname($file, $parent);
    if ( !empty($function) &amp;&amp; !empty($hookname) )
        add_action($hookname, $function); 

    return $hookname;
} 

function add_options_page($page_title, $menu_title, $access_level, $file, $function = &#039;&#039;) {
    return add_submenu_page(&#039;options-general.php&#039;, $page_title, $menu_title, $access_level, $file, $function);
}
 ?&gt;
</pre>
<p>6）其它</p>
<p>还有一些简单的插件就是只提供一些API函数。比如Most_Commented Plugin，它提供一个API “mdv_most_commented”：通过数据库查询得到评论最多的文章，并加以显示。因为这个插件已经被Include过，所以可以用这个API来进行显示。</p>
<p>历史：</p>
<p>2005.07.14 &#8211; 创建</p>
<p>2005.07.16 &#8211; 新增get_plugins的子文件夹解析部分</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/dissect-wordpress-plugin.fv/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TabPane Plugin 发布</title>
		<link>http://www.fvzone.com/blog/tabpane-plugin-%e5%8f%91%e5%b8%83.fv</link>
		<comments>http://www.fvzone.com/blog/tabpane-plugin-%e5%8f%91%e5%b8%83.fv#comments</comments>
		<pubDate>Wed, 01 Feb 2006 07:38:58 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[技术开发]]></category>

		<guid isPermaLink="false">http://www.rcsky.org/blog/?p=5</guid>
		<description><![CDATA[   本次发布的tabpane plugin 只是为了让大家更好的使用 tabpane，本程序不是我写的，我只是把它插件化了。
我们一直在想怎么让你一看就能明白，就能轻松的用上它，那怕只是一点点的改进我们... ]]></description>
			<content:encoded><![CDATA[<p>   本次发布的tabpane plugin 只是为了让大家更好的使用 tabpane，本程序不是我写的，我只是把它插件化了。<br />
我们一直在想怎么让你一看就能明白，就能轻松的用上它，那怕只是一点点的改进我们都愿意做，关于这个tabpane插件的用法也很简单<span id="more-5"></span></p>
<p>原作者网站:http://webfx.eae.net/<br />
OSYE 插件化:http://blog.rcsky.org,wwww.osye.com<br />
<a href="http://www.rcsky.org/soft/tabpane.rar">本地下载</a><br />
<a href="http://blog.rcsky.org">本站演示</a><br />
你只要将它传到wp-content/plugins/里去，和文件夹，在后台激活，就这样tabpane的JS文件和CSS文件就被加载到了模板的核心，你只要在模板文件的任何地方调用下面的代码就可以使tabpane工作。<br />
当时的tabpane是要放到空间的一个地方去，要使用绝对路径才能工作，要修改很多地方才能做到，对于换模板很不好，这样我们把它插件化了，将它放到插件目录，这样就把tabpane完全的插件化了。<br />
也模决化了，不知道你感觉到没？如果你在使用本插件时什么问题好的建议请联系我，祝大家新年快乐~！<br />
因为时间原因，我没有详细说明用法，下面的代码是我BLOG的工具栏的调用的代码，你可以作一些参考：</p>
<pre class="syntax-highlight:php">
&lt;p style=&quot;float: right&quot;&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class=&quot;tab-pane&quot; id=&quot;tab-pane-1&quot;&gt; &lt;script type=&quot;text/javascript&quot;&gt;var tabPane1 = new WebFXTabPane( document.getElementById( &quot;tab-pane-1&quot; ) );&lt;/script&gt;&lt;/p&gt;
&lt;p class=&quot;tab-page&quot; id=&quot;tab-page-1&quot;&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 class=&quot;tab&quot;&gt;General&lt;abbr title=&quot;XHTML Friends Network&quot;&gt;&lt;/abbr&gt;&lt;/h2&gt;
&lt;script type=&quot;text/javascript&quot;&gt;tabPane1.addTabPage( document.getElementById( &quot;tab-page-1&quot; ) );&lt;/script&gt;

&lt;center&gt; &lt;/center&gt;
&lt;p class=&quot;tab-page&quot; id=&quot;tab-page-2&quot;&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 class=&quot;tab&quot;&gt;Music&lt;/h2&gt;
&lt;script type=&quot;text/javascript&quot;&gt;tabPane1.addTabPage( document.getElementById( &quot;tab-page-2&quot; ) );&lt;/script&gt;                            &lt;iframe src=&quot;http://blog.raidybor.com/wp-admin/%3C?php%20bloginfo%28%27stylesheet_directory%27%29;%20?%3E/player/player.php&quot; border=&quot;0&quot; frameborder=&quot;0&quot; height=&quot;220&quot; scrolling=&quot;no&quot; width=&quot;200&quot;&gt;&lt;/iframe&gt;
&lt;p class=&quot;tab-page&quot; id=&quot;tab-page-3&quot;&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 class=&quot;tab&quot;&gt;Message&lt;/h2&gt;
&lt;script type=&quot;text/javascript&quot;&gt;tabPane1.addTabPage( document.getElementById( &quot;tab-page-3&quot; ) );&lt;/script&gt;
&lt;p class=&quot;tab-page&quot; id=&quot;tab-page-4&quot;&gt;&amp;nbsp;&lt;/p&gt;

&lt;h2 class=&quot;tab&quot;&gt;Votes&lt;/h2&gt;
&lt;script type=&quot;text/javascript&quot;&gt;tabPane1.addTabPage( document.getElementById( &quot;tab-page-4&quot; ) );&lt;/script&gt;
</pre>
<p>原作者网站:http://webfx.eae.net/<br />
OSYE 插件化:http://blog.rcsky.org,wwww.osye.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/tabpane-plugin-%e5%8f%91%e5%b8%83.fv/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rcsky titles 发布</title>
		<link>http://www.fvzone.com/blog/rcsky-titles-%e5%8f%91%e5%b8%83.fv</link>
		<comments>http://www.fvzone.com/blog/rcsky-titles-%e5%8f%91%e5%b8%83.fv#comments</comments>
		<pubDate>Wed, 01 Feb 2006 06:17:00 +0000</pubDate>
		<dc:creator>Fvart</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[技术开发]]></category>

		<guid isPermaLink="false">http://www.rcsky.org/blog/?p=3</guid>
		<description><![CDATA[RcSky titles是一种当鼠标停在标题或是链接上的时候给出一个提示的小插件,用于美比你的BLOG,一直喜欢这个东西,今天终于找到了他,为了大家使用方便我做成了插件,欢迎大家使用.
原作者不是我.... ]]></description>
			<content:encoded><![CDATA[<p>RcSky titles是一种当鼠标停在标题或是链接上的时候给出一个提示的小插件,用于美比你的BLOG,一直喜欢这个东西,今天终于找到了他,为了大家使用方便我做成了插件,欢迎大家使用.<br />
<strong>原作者不是我.我只是因为改动较大,所以改名</strong><span id="more-3"></span><br />
原作者网站:http://www.remus.dti.ne.jp/~a-satomi/<br />
bunsyorou/ArekorePopup.html<br />
<strong>注意:如果你用的是K2模板因为冲突在Mozilla Firefox下没有效果,暂时还不知道因原因,我们会尽快修正</strong></p>
<p>演示：<a href="http://www.rcsky.org" title="演示效果">请点击</a><br />
<a href="http://www.rcsky.org/soft/RcSky%20titles.rar">1、下载RcSky titles</a><br />
安装方法:2、将RcSky titles.rar解压缩传至：</p>
<pre class="syntax-highlight:php">/wp-content/plugins/************
/wp-content/plugins/RcSky titles/
/RcSky titles.php
/README.txt
/RcSky titles/ArekorePopup.css
/RcSky titles/ArekorePopup.js
/RcSky titles/Firefox.js
/RcSky titles/body.png
/RcSky titles/bottom.png
/RcSky titles/bottom-left.png
/RcSky titles/bottom-right.png
/RcSky titles/left.png
/RcSky titles/right.png
/RcSky titles/top.png
/RcSky titles/top-left.png
/RcSky titles/top-right.png</pre>
<p>3、进入管理后台，在插件下找到RcSky titles 激活便可以使用，不需要任何修改~！祝大家新年快乐~!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fvzone.com/blog/rcsky-titles-%e5%8f%91%e5%b8%83.fv/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
