<?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>花儿开了 &#187; bbpress</title>
	<atom:link href="http://blog.istef.info/tag/bbpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.istef.info</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 06 Jun 2010 05:52:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<atom:link rel='hub' href='http://blog.istef.info/?pushpress=hub'/>
		<item>
		<title>【发布】bbPress 头像插件</title>
		<link>http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/</link>
		<comments>http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/#comments</comments>
		<pubDate>Fri, 16 Feb 2007 16:52:47 +0000</pubDate>
		<dc:creator>iStef</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[avatar]]></category>
		<category><![CDATA[bbpress]]></category>

		<guid isPermaLink="false">http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/</guid>
		<description><![CDATA[最近做 bbPress 相关的开发，做了不少的插件来实现我需要的功能，我会陆续将一些好玩的插件分享出来，今天分享的就是 bbPress 头像插件。 bbPress 非常精简，本身并没有头像功能。不过这么好玩的功能一般论坛都需要吧。翻遍了 bbPress 官方论坛，找到几个头像插件，要么利用外部引用图片，要么利用 Gravatar。可我需要的是类似 Discuz 那样的头像上传，只好花点时间自己做一个了，而且实现了一些我需要的功能： 验证上传图片类型，只支持 gif,jpeg,png 格式； 验证上传图片的尺寸； 根据预先设定，生成不同尺寸的正方形头像图片，方便不同地方调用； 您可以通过这里下载 bbPress Avatar Plugin。然后进行如下设置： 改名为 *.php 上传到 my-plugins 目录下； 在 bbPress 目录下建立目录 avatar，并更改权限为可写； 修改模版，在适当的地方添加调用； 对于第三步，其实只是在需要显示头像的地方进行调用，例如需要在文章列表中显示最后回复用户 20*20 的头像，只要在合适位置添加下面的代码： &#60;?php topic_avatar_list(20);?&#62; 在模版 post.php 中，显示每个发帖、回复用户的大头像： &#60;?php post_avatar();?&#62; 在 profile.php 中，用户资料页面用户名左侧显示一个 20*20 的小头像： &#60;?php post_avatar(20,$user-&#62;ID); ?&#62; 是不是很方便？其实可以定义的参数还有很多，您可以打开 avatar.php 参考一下，可以调整的地方均有注释。 btw: 明天就是除夕了，在这里恭祝大家新年快乐，吉祥如意！]]></description>
			<content:encoded><![CDATA[<p><!--SPONSOR=[PAGEFLAKES]-->
<p style="text-indent:0;text-align:center"><img src='http://blog.istef.info/wp-content/uploads/2007/02/2007-2-16.jpg' alt='bbPress Avatar Plugin' /></p>
<p>最近做 bbPress 相关的开发，做了不少的插件来实现我需要的功能，我会陆续将一些好玩的插件分享出来，今天分享的就是 bbPress 头像插件。</p>
<p>bbPress 非常精简，本身并没有头像功能。不过这么好玩的功能一般论坛都需要吧。翻遍了 bbPress 官方论坛，找到几个头像插件，要么利用外部引用图片，要么利用 Gravatar。可我需要的是类似 Discuz 那样的头像上传，只好花点时间自己做一个了，而且实现了一些我需要的功能：</p>
<ul>
<li>验证上传图片类型，只支持 gif,jpeg,png 格式；</li>
<li>验证上传图片的尺寸；</li>
<li>根据预先设定，生成不同尺寸的正方形头像图片，方便不同地方调用；</li>
</ul>
<p>您可以通过这里下载 <a href="http://blog.istef.info/wp-content/plugins/DownloadCounter/download.php?id=4">bbPress Avatar Plugin</a>。然后进行如下设置：</p>
<ol>
<li>改名为 *.php 上传到 my-plugins 目录下；</li>
<li>在 bbPress 目录下建立目录 avatar，并更改权限为可写；</li>
<li>修改模版，在适当的地方添加调用；</li>
</ol>
<p>对于第三步，其实只是在需要显示头像的地方进行调用，例如需要在文章列表中显示最后回复用户 20*20 的头像，只要在合适位置添加下面的代码：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span><span style="color: Gray;"> </span><span style="color: Blue;">topic_avatar_list</span><span style="color: Olive;">(</span><span style="color: Maroon;">20</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>在模版 post.php 中，显示每个发帖、回复用户的大头像：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span><span style="color: Gray;"> </span><span style="color: Blue;">post_avatar</span><span style="color: Olive;">()</span><span style="color: Gray;">;</span><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>在 profile.php 中，用户资料页面用户名左侧显示一个 20*20 的小头像：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span><span style="color: Gray;"> </span><span style="color: Blue;">post_avatar</span><span style="color: Olive;">(</span><span style="color: Maroon;">20</span><span style="color: Gray;">,</span><span style="color: #00008b;">$user</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">ID</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>是不是很方便？其实可以定义的参数还有很多，您可以打开 avatar.php 参考一下，可以调整的地方均有注释。</p>
<p>btw: 明天就是除夕了，在这里恭祝大家新年快乐，吉祥如意！
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.istef.info%2F2007%2F02%2F17%2Fbbpress-avatar-plugin%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.istef.info%2F2007%2F02%2F17%2Fbbpress-avatar-plugin%2F&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.istef.info/2007/02/17/bbpress-avatar-plugin/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>bbPress 发布 0.8 版，中文 Tag 问题修正</title>
		<link>http://blog.istef.info/2007/02/15/bbpress-08-and-tag-fix/</link>
		<comments>http://blog.istef.info/2007/02/15/bbpress-08-and-tag-fix/#comments</comments>
		<pubDate>Thu, 15 Feb 2007 15:43:06 +0000</pubDate>
		<dc:creator>iStef</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[bbpress]]></category>
		<category><![CDATA[tag]]></category>

		<guid isPermaLink="false">http://blog.istef.info/2007/02/15/bbpress-08-and-tag-fix/</guid>
		<description><![CDATA[轻量级论坛 bbPress 近日推出了 0.8 版，可以像 WP 一样支持在后台调整主题，支持多字节 Tag，并且修正了一堆小 Bug，具体可以看 bbPress 官方 Blog 上的文章。 前不久我写过一篇文章，提到如何修复 bbPress 0.75 版不支持中文 Tag 的问题。这次 bbPress 官方修复了这个问题，思路和我的方法是一致的，但实现方法却恰好相反。因此如果您是应用了我的方法修正这个问题，那么在升级后，多字节 Tag 将无法使用。其实这个问题很容易解决，下面给出解决方法。 在 my-plugins 目录中建立一个 upgrade-tag-0.8.php 文件，写入如下代码： &#60;?php &#160; $old_tags = $bbdb-&#62;get_results(&#34;SELECT * FROM $bbdb-&#62;tags&#34;); &#160; foreach&#160;($old_tags as $old_tag) { &#160; &#160; if&#160;(preg_match(&#34;/%[0-9A-F]{2}/&#34;,$old_tag-&#62;tag)) continue; &#160; &#160; $newtag = urlencode($old_tag-&#62;tag); &#160; &#160; $bbdb-&#62;query(&#34;UPDATE $bbdb-&#62;tags SET [...]]]></description>
			<content:encoded><![CDATA[<p><!--SPONSOR=[PAGEFLAKES]--><img src='http://blog.istef.info/wp-content/uploads/2007/02/2007-2-15.jpg' alt='bbPress'  style="float:left" />轻量级论坛 bbPress 近日<a href="http://bbpress.org/blog/2007/02/bbpress-08-desmond-released/">推出了 0.8 版</a>，可以像 WP 一样支持在后台调整主题，支持多字节 Tag，并且修正了一堆小 Bug，具体可以看 bbPress 官方 Blog 上的文章。</p>
<p>前不久我写过一篇<a href="http://blog.istef.info/2007/02/03/bugfix-of-bbpress-chinese-tag/">文章</a>，提到如何修复 bbPress 0.75 版不支持中文 Tag 的问题。这次 bbPress 官方修复了这个问题，思路和我的方法是一致的，但实现方法却恰好相反。因此如果您是应用了我的方法修正这个问题，那么在升级后，多字节 Tag 将无法使用。其实这个问题很容易解决，下面给出解决方法。</p>
<p>在 my-plugins 目录中建立一个 upgrade-tag-0.8.php 文件，写入如下代码：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline"><span style="color: Blue;">&lt;?php</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: #00008b;">$old_tags</span><span style="color: Gray;"> = </span><span style="color: #00008b;">$bbdb</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">get_results</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">SELECT * FROM </span><span style="color: #00008b;">$bbdb</span><span style="color: Red;">-&gt;tags</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Green;">foreach</span><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: #00008b;">$old_tags</span><span style="color: Gray;"> </span><span style="color: Green;">as</span><span style="color: Gray;"> </span><span style="color: #00008b;">$old_tag</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Blue;">preg_match</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">/%[0-9A-F]{2}/</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">,</span><span style="color: #00008b;">$old_tag</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">tag</span><span style="color: Olive;">))</span><span style="color: Gray;"> </span><span style="color: Green;">continue</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: #00008b;">$newtag</span><span style="color: Gray;"> = </span><span style="color: Blue;">urlencode</span><span style="color: Olive;">(</span><span style="color: #00008b;">$old_tag</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">tag</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; &nbsp; </span><span style="color: #00008b;">$bbdb</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">query</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">UPDATE </span><span style="color: #00008b;">$bbdb</span><span style="color: Red;">-&gt;tags SET tag='</span><span style="color: #00008b;">$newtag</span><span style="color: Red;">' WHERE tag_id = </span><span style="color: #00008b;">$old_tag</span><span style="color: Red;">-&gt;tag_id</span><span style="color: #8b0000;">&quot;</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Blue;">?&gt;</span></li></ol></div>
<p>在浏览器中访问一次您的论坛，然后立刻<strong>删除这个文件</strong>，中文 Tag 在 0.8 版就又可以使用了。
<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fblog.istef.info%2F2007%2F02%2F15%2Fbbpress-08-and-tag-fix%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fblog.istef.info%2F2007%2F02%2F15%2Fbbpress-08-and-tag-fix%2F&amp;style=compact&amp;service=bit.ly&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.istef.info/2007/02/15/bbpress-08-and-tag-fix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using memcached
Page Caching using memcached
Database Caching 1/13 queries in 0.007 seconds using memcached
Object Caching 431/453 objects using memcached

Served from: blog.istef.info @ 2012-02-13 15:49:31 -->
