<?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; pr</title>
	<atom:link href="http://www.evlos.org/tag/pr/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.evlos.org</link>
	<description>A straw shows which way the wind blows ..</description>
	<lastBuildDate>Sun, 05 Sep 2010 20:37:35 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>一个PR图片调用API与查询的程序</title>
		<link>http://www.evlos.org/2010/03/23/google-pr-img-api-v1/</link>
		<comments>http://www.evlos.org/2010/03/23/google-pr-img-api-v1/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 21:33:52 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1945</guid>
		<description><![CDATA[> 嘿嘿，这个是 超人 特别版喔，送给超人童鞋。并附带用户查询界面，为其中的 Index.php 文件。 > 最近觉得 Google 很厚道，日历 阅读器 GMail GoogleCode Appengine 等一系列服务都很不错。 > 很爽，嘻嘻 O(∩_∩)O。最近打算搞一个 VPS 之类的有更大流量的东东来玩，嘎嘎，春哥保佑。 > 迟一些再发布 AlexImgAPI V1.0.0 吧，其实是还没有完成啦 ╮(╯▽╰)╭，还是代码丢失的老原因。 一. GooglePRImgAPI V1.0.0： > 下面两幅图分别是 Index.php 和 Pr.php 的浏览图，请注意 Index.php 是依赖于 Pr.php 的喔。 > 下载 - http://code.google.com/p/evlosbox/downloads/detail?name=share_primgapi_UI.zip 二. 附言： > 嘿嘿，因为超人童鞋急需，所以先发布这篇，下篇将发布《WP用于围观某评论者发言的插件》。 > 刚刚到手了 Zxc.im nnd.im，嘎嘎嘎，第一个网址是键盘上顺序按键，第二个是NND，O(∩_∩)O。]]></description>
			<content:encoded><![CDATA[<p>> 嘿嘿，这个是 <a target='_blank' rel='nofollow' href='http://www.superm.org/'>超人</a> 特别版喔，送给超人童鞋。并附带用户查询界面，为其中的 Index.php 文件。<br />
> 最近觉得 Google 很厚道，日历 阅读器 GMail GoogleCode Appengine 等一系列服务都很不错。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000254.png' /></p>
<p>> 很爽，嘻嘻 O(∩_∩)O。最近打算搞一个 VPS 之类的有更大流量的东东来玩，嘎嘎，春哥保佑。<br />
> 迟一些再发布 AlexImgAPI V1.0.0 吧，其实是还没有完成啦 ╮(╯▽╰)╭，还是代码丢失的老原因。</p>
<p><span id="more-1945"></span><strong>一. GooglePRImgAPI V1.0.0：</strong></p>
<p>> 下面两幅图分别是 Index.php 和 Pr.php 的浏览图，请注意 Index.php 是依赖于 Pr.php 的喔。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000255.png' /></p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000256.png' /></p>
<p>> 下载 - <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=share_primgapi_UI.zip&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=share_primgapi_UI.zip</a></p>
<p><strong>二. 附言：</strong></p>
<p>> 嘿嘿，因为超人童鞋急需，所以先发布这篇，下篇将发布《WP用于围观某评论者发言的插件》。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000260.png' /></p>
<p>> 刚刚到手了 Zxc.im nnd.im，嘎嘎嘎，第一个网址是键盘上顺序按键，第二个是NND，O(∩_∩)O。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2010/03/23/google-pr-img-api-v1/feed/</wfw:commentRss>
		<slash:comments>180</slash:comments>
		</item>
		<item>
		<title>共享小邪的PR文本调用API代码</title>
		<link>http://www.evlos.org/2010/02/10/share-my-google-pr-text-api/</link>
		<comments>http://www.evlos.org/2010/02/10/share-my-google-pr-text-api/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 12:48:02 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1926</guid>
		<description><![CDATA[> 嘎嘎，O(∩ o ∩)O，小邪给大家的新年礼物就只能送送代码咯，╮(╯▽╰)╭，今天送的是 PR Api。 > 这个 API 可以通过 JS 调用方法调用谷歌的 PR 数值，可自定义调用的文字，例如 “3个屁啊”。 > 那么明天小邪打算送出 Alex 可自定义文本的 API，可以 JS 方法调用并输出 “Alex排名:100”。 > ╮(╯o╰)╭，出国时间又延迟了，真是被中介折腾地半死，不过也不错的，小邪可以过完年再走。 一. PR自定义文本调用API： 1. 关于此程序： > 程序名称 - GooglePRTextAPI [更新时间为 - 2010.01.10] [版本号 - v1.01] [性质 - 稳定版] > 程序文件 - [pr.php - 代码与说明] [style.css - CSS 代码] [Cache 缓存文件夹（自动建立）] > [...]]]></description>
			<content:encoded><![CDATA[<p>> 嘎嘎，O(∩ o ∩)O，小邪给大家的新年礼物就只能送送代码咯，╮(╯▽╰)╭，今天送的是 PR Api。<br />
> 这个 API 可以通过 JS 调用方法调用谷歌的 PR 数值，可自定义调用的文字，例如 “3个屁啊”。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000096.jpg' /></p>
<p>> 那么明天小邪打算送出 Alex 可自定义文本的 API，可以 JS 方法调用并输出 “Alex排名:100”。<br />
> ╮(╯o╰)╭，出国时间又延迟了，真是被中介折腾地半死，不过也不错的，小邪可以过完年再走。</p>
<p><span id="more-1926"></span><strong>一. PR自定义文本调用API：</strong></p>
<p><strong>1. 关于此程序：</strong></p>
<p>> 程序名称 - GooglePRTextAPI [更新时间为 - 2010.01.10] [版本号 - v1.01] [性质 - 稳定版]<br />
> 程序文件 - [pr.php - 代码与说明] [style.css - CSS 代码] [Cache 缓存文件夹（自动建立）]</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000096_1.jpg' /></p>
<p>> 杯具鸟，╮(╯▽╰)╭，小邪很想把代码发到 Google Code，但是灰常茶几，居然这几天在维护中。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">Project hosting will be READ<span style="color: #339933;">-</span>ONLY Wednesday at 8am PST due to brief network maintenance<span style="color: #339933;">.</span></pre></td></tr></table></div>

<p>> 下载传送门 [Pr.php] - <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=google_pr_text_api.txt&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=google_pr_text_api.txt</a><br />
> 下载传送门 [style.css] - <a target='_blank' rel='nofollow' href='http://code.google.com/p/evlosbox/downloads/detail?name=google_pr_text_api_css.txt&#038;can=2&#038;q='>http://code.google.com/p/evlosbox/downloads/detail?name=google_pr_text_api_css.txt</a></p>
<p><strong>2. 程序运行时可能造成的影响：</strong></p>
<p>> 程序运行需要使用 Curl 和 File_get_contents 函数，如果你的服务器限制严格，就无法运行了。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000098.jpg' /></p>
<p>> 同时程序会在 Pr.php 同级目录新建一个 Cache 文件夹，里面保存类似 Www_evlos_org.txt。<br />
> 这样子的文件，文件里面的内容是类似于 “2” 这样子的数字，这数字则是对应网站的 PR 数值。</p>
<p>> 上面的文件是缓存文件，缓存时间是 3 天，超过 3 天则会重新到 Google 服务器获取一次 PR。<br />
> 若需要修改缓存时间，请修改 Pr.php 文件的第二行，$cachetime 变量中的数值，单位秒。</p>
<p><strong>二. 菠萝阁奇趣发现：</strong></p>
<p>> 嘻嘻，这个是 <a target='_blank' rel='nofollow' href='http://close.cc/'>JerryChen</a> 写得一个<a target='_blank' rel='nofollow' href='http://u.close.cc/'>短网址程序</a>，也很不错的喔，灰常简洁，也很注重效率呢。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000097.jpg' /></p>
<p>> 今天看到 <a target='_blank' rel='nofollow' href='http://fai.im/'>蓝冰</a> 童鞋在摆弄 <a target='_blank' rel='nofollow' href='http://typecho.org/'>Typecho</a>，小邪感觉灰常心动，╮(╯▽╰)╭，到时候也去弄一个玩玩咯。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000099.jpg' /></p>
<p><strong>三. 附言：</strong></p>
<p>> 是不是又有盆友看不到图片鸟？额，小邪自己测试过了，Poco.cn 全世界都可以访问的说。<br />
> 不会那么杯具吧？！有的盆友请和小邪说，那小邪就立马换微软 Skydrive 网盘服务了喔。<br />
> 至于 Skydrive 网盘的图片可见性，目前可以参见 <a target='_blank' rel='nofollow' href='http://wange.im'>万戈兄</a> 博客中的图片，O(∩_∩)O 呵呵。</p>
<p>> 如果 Skydrive 表现不好的话，就写篇文章，强力赞颂一下 <a target='_blank' rel='nofollow' href='http://zou.lu'>兽兽</a> 的免费精神，嘎嘎。<br />
> 兽兽童鞋提供了一个很不错的公用图床呢，<a target='_blank' rel='nofollow' href='http://zoulu.org/'>http://zoulu.org/</a> 目前表现很不错的说，嘻嘻。</p>
<p><img src='http://www.evlos.org/ev-box/myimg/uploads/old/Cap0000100.jpg' /></p>
<p>> 还有喔，小邪打算把 <a target='_blank' rel='nofollow' href='http://www.soulsolo.org'>Soulsolo.org</a> 建成一个原创摄影图片的站点，专门放小邪拍的照片。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2010/02/10/share-my-google-pr-text-api/feed/</wfw:commentRss>
		<slash:comments>52</slash:comments>
		</item>
		<item>
		<title>裸奔帝国版PR和Alex排名程序</title>
		<link>http://www.evlos.org/2010/01/02/alex-and-pr-js-api/</link>
		<comments>http://www.evlos.org/2010/01/02/alex-and-pr-js-api/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 08:10:50 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[alex]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1882</guid>
		<description><![CDATA[> 呵呵，这个程序是为 619 的裸奔帝国打造的，灰常强力并且绝对够YD，大家都可以用喔。 > 由于昨天是1月1日，小邪难得可以在晚上玩电脑玩得迟一些，一不小心给 619 逮住了。 > 然后就顺手给他定制了裸奔专用 PR 输出程序，效果为：3个屁啊。不是一般的牛叉。 > 话说，昨天小邪写程序的时候，619 星网 Lostab 三位童鞋建立了 “万老水茶谈会” 详情看文章。 1. 可自由定制的PR文字输出API： > 嘻嘻，效果请看下面这幅图片。话说，那个显示了 “235341个屁啊” 的特殊效果。 > 其实是下面那个文字输出 Alex 排名的效果，原本应该显示 “Alex世界排名：235341” 的。 > 但是小邪不小心手抖了一下，搞混了代码，导致出现下图的奇观，哇卡卡卡卡。 > 然后小邪手又抖了一下，就灰常不小心的截了一张图，最后再抖了一下就不小心贴出来了：）。 > 以下是调用代码，复制到自己喜欢的位置即可，O(∩_∩)O 哈哈。 1 2 &#60;script src=&#34;http://tool.evlos.org/primg/text.php ?url=www.liuyijun.com&#38;ooxx=[ooxx]个屁啊&#34;/&#62;&#60;/script&#62; > 1. 参数 url，这里就是将要调用的网站的 url，上面使用的是 www.verycd.com。 > 2. 是最让小邪自豪的 ooxx 参数，自豪在哪里呢，就是半夜三更写程序的时候可以提神。 > [...]]]></description>
			<content:encoded><![CDATA[<p>> 呵呵，这个程序是为 <a target="_blank" rel="nofollow" href="http://www.liuyijun.com/">619</a> 的裸奔帝国打造的，灰常强力并且绝对够YD，大家都可以用喔。<br />
> 由于昨天是1月1日，小邪难得可以在晚上玩电脑玩得迟一些，一不小心给 619 逮住了。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture1014.jpg" /></p>
<p>> 然后就顺手给他定制了裸奔专用 PR 输出程序，效果为：3个屁啊。不是一般的牛叉。<br />
> 话说，昨天小邪写程序的时候，619 星网 Lostab 三位童鞋建立了 “万老水茶谈会” 详情看文章。</p>
<p><span id="more-1882"></span><strong>1. 可自由定制的PR文字输出API：</strong></p>
<p>> 嘻嘻，效果请看下面这幅图片。话说，那个显示了 “235341个屁啊” 的特殊效果。<br />
> 其实是下面那个文字输出 Alex 排名的效果，原本应该显示 “Alex世界排名：235341” 的。 </p>
<p>> 但是小邪不小心手抖了一下，搞混了代码，导致出现下图的奇观，哇卡卡卡卡。<br />
> 然后小邪手又抖了一下，就灰常不小心的截了一张图，最后再抖了一下就不小心贴出来了：）。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture1010.jpg" /></p>
<p>> 以下是调用代码，复制到自己喜欢的位置即可，O(∩_∩)O 哈哈。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://tool.evlos.org/primg/text.php
?url=www.liuyijun.com&amp;ooxx=[ooxx]个屁啊&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>> 1. 参数 url，这里就是将要调用的网站的 url，上面使用的是 www.verycd.com。<br />
> 2. 是最让小邪自豪的 ooxx 参数，自豪在哪里呢，就是半夜三更写程序的时候可以提神。<br />
> 3. 参数 ooxx，[ooxx] 这个东西会被替换为PR数值，上面用的是“[ooxx]个屁啊”。</p>
<p>> 比如想显示 “619有3个屁啊”，就用下面的代码 -</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://tool.evlos.org/primg/text.php
?url=www.verycd.com&amp;ooxx=619有[ooxx]个屁啊&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>> 4. 参数 code，不用这个参数的时候自动输出 UTF-8 编码的文本，用了 code=gbk 则输出 gbk。</p>
<p><strong>2. 可自由定制的Alex排名输出API：</strong></p>
<p>> 嘻嘻，用法和上面的一摸一样，所以小邪就不讲第二遍了喔 (*^__^*) 。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture1015.jpg" /></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span>
src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://tool.evlos.org/aleximg/world_text.php
?url=www.verycd.com&amp;ooxx=Alex 世界排名：[ooxx]&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span>
src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;http://tool.evlos.org/aleximg/nation_text.php
?url=www.verycd.com&amp;ooxx=Alex 国内排名：[ooxx]&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><strong>3. 万老水茶谈会：</strong></p>
<p>> 此则灰常牛叉的新闻由裸奔帝国官方电视台台长兼主持人：小邪，为您报道。</p>
<p>> 昨晚万戈兄的博客遭遇了空前强大的恐怖袭击，导致高楼大厦遍地拔起。<br />
> 3位坚强的勇士兼恐怖分子为了争取水王宝座，整整盖了4个小时的楼，可堪称英雄。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture1018.jpg" /></p>
<p>> 第二天由 万戈兄 与 619 童鞋为本次恐怖袭击（简称万老水茶谈会）作总结。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture1017.jpg" /></p>
<p>> 灰常强力的星际传送门（目的地 - 万老水茶谈会总部）：<a target="_blank" href="http://wange.im/guestbook">http://wange.im/guestbook</a></p>
<p><strong>4. JavaScript 输出代码：</strong></p>
<p>> 这样就可以使用 JavaScript 输出 HTML 代码了喔，调用很方便呢。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #009900;">&#123;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;h1&gt;This is a header&lt;/h1&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;p&gt;This is a paragraph&lt;/p&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;p&gt;This is another paragraph&lt;/p&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p><strong>5. PHP 输出 JS 文件：</strong></p>
<p>> 嘻嘻 (*^__^*) ，讲解请看代码中的注释喔，小邪就不另外写了。<br />
> 否则小邪的文章又要长到害大家怕怕的了，嘿嘿嘿。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ooxx'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$ooxx</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ooxx'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$ooxx_out</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'[ooxx]'</span><span style="color: #339933;">,</span><span style="color: #000088;">$cn_num</span><span style="color: #339933;">,</span><span style="color: #000088;">$ooxx</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #096;">//把[ooxx]替换成排名数值</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$ooxx_out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'PR：'</span><span style="color: #339933;">.</span><span style="color: #000088;">$cn_num</span><span style="color: #339933;">;</span>
	<span style="color: #096;">//无ooxx参数则输出 PR：XXX</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000088;">$href</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;a target='_blank' &quot;</span>
	<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;href='http://tool.evlos.org/onlinechk/?&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$href1</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;'&gt;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #096;">//小邪觉得这里是一个亮点，因为 Document.write 里面一定要用双引号</span>
<span style="color: #096;">//所以得把字符串分成三个部分，才好，PHP里面引号一不小心矛盾了就会杯具的。</span>
<span style="color: #000088;">$out</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'document.write(&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$href</span><span style="color: #339933;">.</span><span style="color: #000088;">$website</span><span style="color: #339933;">.</span><span style="color: #000088;">$href1</span><span style="color: #339933;">.</span><span style="color: #000088;">$ooxx_out</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;&quot;);'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'gbk'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #990000;">iconv</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UTF-8&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;GB2312&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$out</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #096;">//编码转换函数</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$out</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$out</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p><strong>6. 小邪的工具箱：</strong></p>
<p>> 嘿嘿，以上工具都已经收录到了小邪的工具箱中，向大家推荐一下。<br />
> 传送门：<a target="_blank" rel="nofollow" href="http://www.evlos.org/tools">http://www.evlos.org/tools</a> - UrlShort( <a target="_blank" rel="nofollow" href="http://u.evlos.org/58">http://u.evlos.org/58</a> )</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture1016.jpg" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2010/01/02/alex-and-pr-js-api/feed/</wfw:commentRss>
		<slash:comments>169</slash:comments>
		</item>
		<item>
		<title>制作好一个输出PR图片的API</title>
		<link>http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/</link>
		<comments>http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 06:35:07 +0000</pubDate>
		<dc:creator>小邪</dc:creator>
				<category><![CDATA[小程序 [Lit Work]]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://www.evlos.org/?p=1490</guid>
		<description><![CDATA[> ╮(╯▽╰)╭ 昨天白夜三更写的，糊涂地忘记了已经有蛮多网站提供这个功能了，结果就杯具了。 > 不过也没什么，这篇文章刚刚好总结一下 Curl 函数和 File_get_contents 函数的用法。 > 好多服务器为了防采集都禁止 File_get_contents，所以介绍一下俩函数互相替代的方法。 > 话说，昨天给 619 的模板导航栏上加上了分类目录的显示，但我觉得那个模板的函数有点奇怪。 P.s. 呵呵，使用方法如图，作为图片显示即可，有兴趣的童鞋可以调用过去玩玩 O(∩_∩)O。 1. File_get_contents 函数： > 使用如下的代码可以将变量 $GontenPRURL 里的路径指向的文件读入字符串 $filecontent 中。 > 只要在 Url 中传递参数即可到 Google 获取到 PR 的数值，然后转换为相对的图片文件名称。 1 $filecontent = file_get_contents&#40;$prurl&#41;; > 我简单的使用下面的函数代码过滤了一下 Url 地址。 > 因为没法过滤引号，所以后面再使用 Preg_match 的正则式过滤文件头。 1 2 $evlos_re = array&#40;&#34;\&#34;&#34;,&#34;'&#34;,&#34;!&#34;,&#34;@&#34;,&#34;#&#34;,&#34;$&#34;,&#34;%&#34;,&#34;^&#34;,&#34;&#38;&#34;,&#34;*&#34;,&#34;(&#34;,&#34;)&#34;,&#34;+&#34;,&#34;=&#34;&#41;; $website = [...]]]></description>
			<content:encoded><![CDATA[<p>> ╮(╯▽╰)╭ 昨天白夜三更写的，糊涂地忘记了已经有蛮多网站提供这个功能了，结果就杯具了。<br />
> 不过也没什么，这篇文章刚刚好总结一下 Curl 函数和 File_get_contents 函数的用法。</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0704.jpg" /></p>
<p>> 好多服务器为了防采集都禁止 File_get_contents，所以介绍一下俩函数互相替代的方法。<br />
> 话说，昨天给 619 的模板导航栏上加上了分类目录的显示，但我觉得那个模板的函数有点奇怪。</p>
<p>P.s. 呵呵，使用方法如图，作为图片显示即可，有兴趣的童鞋可以调用过去玩玩 O(∩_∩)O。</p>
<p><span id="more-1490"></span>1. <strong>File_get_contents 函数</strong>：</p>
<p><img src="http://www.evlos.org/ev-box/myimg/uploads/old/Capture0703.jpg" /></p>
<p>> 使用如下的代码可以将变量 $GontenPRURL 里的路径指向的文件读入字符串 $filecontent 中。<br />
> 只要在 Url 中传递参数即可到 Google 获取到 PR 的数值，然后转换为相对的图片文件名称。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$filecontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$prurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 我简单的使用下面的函数代码过滤了一下 Url 地址。<br />
> 因为没法过滤引号，所以后面再使用 Preg_match 的正则式过滤文件头。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$evlos_re</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;!&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;@&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;$&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;%&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;^&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&amp;&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;*&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;(&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;)&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;+&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;=&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$website</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$evlos_re</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$website</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 最后再输出一个文件头，再把作为字符串的图片接着输出即可。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: image/jpeg; charset=UTF-8&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>2. <strong>Curl 函数</strong>：</p>
<p>> <strong>注意！！</strong>CURLOPT_URL 参数是不支持相对路径的，网上没看到有人提到，害我差点没折腾挂掉。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ch1</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$timeout1</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$prurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #000088;">$timeout1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$filecontent</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> 这里就得用那么长的代码来代替上面 File_get_contents 函数的那一行代码了。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$fixurl</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://'</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$fixurl</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$fixurl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$pic</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$fixurl</span><span style="color: #339933;">.</span><span style="color: #000088;">$pic</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>> $pic 是我的 PR 图片文件，这里通过上面代码把相对路径转换为 Url 路径。<br />
> 最后也差不多，输出一个文件头，再把作为字符串的图片接着输出即可。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$ch2</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$timeout2</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">15</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #339933;">,</span> CURLOPT_URL<span style="color: #339933;">,</span> <span style="color: #000088;">$pic</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #339933;">,</span> CURLOPT_RETURNTRANSFER<span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_setopt</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #339933;">,</span> CURLOPT_CONNECTTIMEOUT<span style="color: #339933;">,</span> <span style="color: #000088;">$timeout2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">curl_exec</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">curl_close</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ch2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>3. <strong>同行输出日志分类与博客页面列表</strong>：</p>
<p>> 话说原先 Sandbox 只输出博客页面列表的时候 Header.php 只调用了一个函数：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> sandbox_globalnav<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>> 然后在主题函数 Functions.php 里面加了一大段这个代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> sandbox_globalnav<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$menu</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> 
wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=&amp;sort_column=menu_order&amp;echo=0'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$menu</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$menu</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$menu</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div id=&quot;menu&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$menu</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'globalnav_menu'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$menu</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>> 我觉得其实没啥必要的样子，因为下面使用 WP 自带的函数输出一个 Li 列表也是可以达到相同效果的。<br />
> 博客页面是 Wp_list_pages，文章分类是 Wp_list_categories。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;div id=&quot;menu&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=0&amp;orderby=name&amp;show_count=0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=0&amp;sort_column=menu_order'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></td></tr></table></div>

<p>> 然后在 CSS 文件里面把 Li 变成行内元素即可，话说 Li 真是一个神奇的东西。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#access</span> li <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span><span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></td></tr></table></div>

<p>4. <strong>调用说明页面传送门</strong>：</p>
<p>> <a target="_blank" href="http://tool.evlos.org/primg/">http://tool.evlos.org/primg/</a></p>
<p>5. <strong>欢迎来 Follow 我的 Twitter <a target="_blank" rel="nofollow" href="http://twitter.com/angelsolo">@AngelSolo</a></strong> 。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.evlos.org/2009/12/09/made-a-api-can-output-pr-image/feed/</wfw:commentRss>
		<slash:comments>70</slash:comments>
		</item>
	</channel>
</rss>
