<?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; web</title>
	<atom:link href="http://wp.foliz.net/archives/category/web/feed" rel="self" type="application/rss+xml" />
	<link>http://wp.foliz.net</link>
	<description>webプログラム　php,Smarty,Zend Framework,ajax,pearネタなど～</description>
	<lastBuildDate>Sat, 21 Jan 2012 06:32:52 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>プロジェクト管理「Collabtive」を使ってみる</title>
		<link>http://wp.foliz.net/archives/295</link>
		<comments>http://wp.foliz.net/archives/295#comments</comments>
		<pubDate>Tue, 13 Apr 2010 13:35:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Collabtive]]></category>
		<category><![CDATA[オープンソース]]></category>
		<category><![CDATA[プロジェクト管理]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=295</guid>
		<description><![CDATA[そろそろー プロジェクト管理とバージョン管理を取り入れなきゃと想いながら いまいち掴めないのずっと放置してましたが、 とりあえず一つインストールしてみた。 まずはプロジェクト管理をいろいろ探し回った結果、 シンプルで 使 [...]]]></description>
			<content:encoded><![CDATA[<p>そろそろー<br />
プロジェクト管理とバージョン管理を取り入れなきゃと想いながら<br />
いまいち掴めないのずっと放置してましたが、<br />
とりあえず一つインストールしてみた。<br />
<span id="more-295"></span><br />
まずはプロジェクト管理をいろいろ探し回った結果、<br />
シンプルで 使いやすそうなオープンソースで「<a href="http://collabtive.o-dyn.de/">Collabtive</a>」をインストールしてみた。<br />
Smarty+php+mysqlってことでとりあえずは触りやすいだろう。</p>
<p>インストールまでは何の問題もなく日本語がきちんと表示されていたけど<br />
入力データーが化けてしまうので、ちょっと反則だけどちょっと改造しちゃいました。</p>
<p>/include/class.datenbank.php 42行目</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #000088;">$conn</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_host</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_user</span><span style="color: #339933;">,</span><span style="color: #000088;">$db_pass</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$db_check</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_check</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SET NAMES utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//追加</span>
            <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">else</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span></pre></div></div>

<p>とっても気に入らない対処法だが、ま、動けばよいだろう。</p>
<p><strong>Collabtive</strong><br />
<a href="http://collabtive.o-dyn.de/">http://collabtive.o-dyn.de/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/295/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>preg_replace_callback 名前付キャプチャ</title>
		<link>http://wp.foliz.net/archives/273</link>
		<comments>http://wp.foliz.net/archives/273#comments</comments>
		<pubDate>Thu, 25 Feb 2010 13:52:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[preg_replace_callback]]></category>
		<category><![CDATA[正規表現]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=273</guid>
		<description><![CDATA[正規表現に名前付キャプチャ（名前付き捕獲式集合と言うらしい）のネタを先日書いたけど、書き方やバージョンがpreg_replace_callbackも同様だと思ったら、またしてもそーではないらしい。 php5.2.2からの [...]]]></description>
			<content:encoded><![CDATA[<p>正規表現に名前付キャプチャ（<strong>名前付き捕獲式集合</strong>と言うらしい）のネタを先日書いたけど、書き方やバージョンがpreg_replace_callbackも同様だと思ったら、またしてもそーではないらしい。<br />
<span id="more-273"></span></p>
<p>php5.2.2からの書き方以前に、preg_replace_callbackで名前付き捕獲式集合が使えるようになるのは5.2.7以降だそうです。。。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'foobar: 2008'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// PHP 5.2.7 以降で動作します</span>
<span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(P?&lt;name&gt;\w+): (P?&lt;digit&gt;\d+)/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'callback'</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> callback<span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">Array</span>
<span style="color: #009900;">&#40;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> foobar<span style="color: #339933;">:</span> <span style="color: #cc66cc;">2008</span>
    <span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> foobar
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> foobar
    <span style="color: #009900;">&#91;</span>digit<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2008</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2008</span>
<span style="color: #009900;">&#41;</span></pre></div></div>

<p>Pはなくてもいいのかな？</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/273/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>preg_replace_callbackに配列は無理っぽ</title>
		<link>http://wp.foliz.net/archives/265</link>
		<comments>http://wp.foliz.net/archives/265#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:08:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[preg_replace_callback]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=265</guid>
		<description><![CDATA[preg_replaceと同じ理屈でpreg_replace_callbackを配列指定できると信じ込んで凄くハマったのでメモメモ。 複数の正規表現を一気にかける場合、配列で指定しちゃうと楽チン。 $preg = arr [...]]]></description>
			<content:encoded><![CDATA[<p>preg_replaceと同じ理屈でpreg_replace_callbackを配列指定できると信じ込んで凄くハマったのでメモメモ。<br />
<span id="more-265"></span></p>
<p>複数の正規表現を一気にかける場合、配列で指定しちゃうと楽チン。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$preg</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'/正規表現/si'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'$1:$2'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'/正規表現/si'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'$1=$2'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$preg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$preg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>上と同じ理屈でpreg_replace_callbackも配列が可能と信じ込んでいた。<br />
<strong>ダメダメな例</strong></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$preg</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
  <span style="color: #0000ff;">'/正規表現/si'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'callback1'</span><span style="color: #339933;">,</span>
  <span style="color: #0000ff;">'/正規表現/si'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'callback2'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$preg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$preg</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> callback1<span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">':'</span><span style="color: #339933;">.</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">function</span> callback2<span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">.</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>どうやらこれはダメっぽい。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/265/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php正規表現 名前付キャプチャ</title>
		<link>http://wp.foliz.net/archives/260</link>
		<comments>http://wp.foliz.net/archives/260#comments</comments>
		<pubDate>Tue, 23 Feb 2010 07:52:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[正規表現]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=260</guid>
		<description><![CDATA[とっても不得意な正規表現。 ちと覚えておくと便利な技をメモっておくぞ。 マッチパターンを参照するときは通常 $matches[0],$matches[1],$matches[2]&#8230;などと順番に書いているので  [...]]]></description>
			<content:encoded><![CDATA[<p>とっても不得意な正規表現。<br />
ちと覚えておくと便利な技をメモっておくぞ。<br />
<span id="more-260"></span></p>
<p>マッチパターンを参照するときは通常<br />
$matches[0],$matches[1],$matches[2]&#8230;などと順番に書いているので<br />
どっかでパターンの変更があった場合は、0から順番に数えなおさなければならんのでメンテナンス性も悪ければ、とても読みにくい。<br />
時間がたてばたつほど、自分で書いたソースなのに追うのが大変になってしまう。</p>
<p>そこでマッチしたパターンに名前を付けれるのを最近知った。</p>
<p>php5.2.2以前と以降で使い方が違うので注意。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$str</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'foobar: 2008'</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// PHP 5.2.2 以降で動作します</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(?&lt;name&gt;\w+): (?&lt;digit&gt;\d+)/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// PHP 5.2.2 より前のバージョンではこれを使います</span>
<span style="color: #990000;">preg_match</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/(?P&lt;name&gt;\w+): (?P&lt;digit&gt;\d+)/'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$str</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>上の例の出力は以下となります。</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">Array</span>
<span style="color: #009900;">&#40;</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> foobar<span style="color: #339933;">:</span> <span style="color: #cc66cc;">2008</span>
    <span style="color: #009900;">&#91;</span>name<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> foobar
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> foobar
    <span style="color: #009900;">&#91;</span>digit<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2008</span>
    <span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2008</span>
<span style="color: #009900;">&#41;</span></pre></div></div>

<p>参考：<br />
php :: 正規表現 :: 名前つきキャプチャというのを習った<br />
<a href="http://blog.3ot.net/design/php/20091018012202.html">http://blog.3ot.net/design/php/20091018012202.html</a></p>
<p>2010/02/24 リンク修正</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/260/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>携帯用Apacheモジュール「mod_ktai」</title>
		<link>http://wp.foliz.net/archives/248</link>
		<comments>http://wp.foliz.net/archives/248#comments</comments>
		<pubDate>Mon, 22 Feb 2010 08:20:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=248</guid>
		<description><![CDATA[Apacheにインストールしておいて 携帯サイトの各キャリア用にいろいろと自動変換してくれるらしい。 mod_ktai http://labs.yumemi.co.jp/ ただし、インストールにはいろいろ制限があるようで [...]]]></description>
			<content:encoded><![CDATA[<p>Apacheにインストールしておいて<br />
携帯サイトの各キャリア用にいろいろと自動変換してくれるらしい。<br />
<strong>mod_ktai</strong><br />
<a href="http://labs.yumemi.co.jp/">http://labs.yumemi.co.jp/</a><br />
<span id="more-248"></span></p>
<p>ただし、インストールにはいろいろ制限があるようで<br />
Apache、Boost、ImageMagickがパッケージでインストールされていないと<br />
ダメだとか。</p>
<p>主な機能は<br />
mod_ktai_info(端末情報取得モジュール)<br />
mod_ktai_emoji(絵文字変換モジュール)<br />
mod_ktai_image(画像変換モジュール)<br />
との事。</p>
<p>ところで・・・<br />
国内の携帯サイトはホントにキライだ。<br />
何でこの時代に1ページ200kとかshift-jisのみとかおかしくね？<br />
なんで携帯の会社にそれぞれ合わせて作らなきゃならんのだ？<br />
草の根通信みたいだよな。<br />
ホント日本の携帯会社さんよーいいかげんにしろよー</p>
<p>PCで携帯サイトを確認するためには公式サイトから<br />
アノ中途半端なビュアーを落として・・・アホか。<br />
media=&#8221;mobile&#8221;<br />
で全て解決させなさい。</p>
<p>以上・・愚痴でした（笑）</p>
<p>参考：<br />
<a href="http://www.plusmb.jp/2008/11/17/1291.html">携帯用Apacheモジュール「mod_ktai」をインストール</a></p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/248/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>class内でpreg_replace_callbackを使う</title>
		<link>http://wp.foliz.net/archives/171</link>
		<comments>http://wp.foliz.net/archives/171#comments</comments>
		<pubDate>Sat, 14 Nov 2009 20:02:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[preg_replace_callback]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/?p=171</guid>
		<description><![CDATA[Class内でpreg_replace_callbackを使うのにとっても手こずったのでメモ。 phpマニュアル（http://php.net/manual/ja/function.preg-replace-callba [...]]]></description>
			<content:encoded><![CDATA[<p>Class内でpreg_replace_callbackを使うのにとっても手こずったのでメモ。<br />
phpマニュアル（http://php.net/manual/ja/function.preg-replace-callback.php）によれば以下のようです。<br />
<span id="more-171"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">class</span> myClass<span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> parsetext<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// parses text and sets literals A - C to lower case</span>
        <span style="color: #666666; font-style: italic;">// this works</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|([a-c])|i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'myClass::preg_tolower'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> parsefail<span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// parses text and sets literals A - C to lower case</span>
        <span style="color: #666666; font-style: italic;">// this fails</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">preg_replace_callback</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'|([a-c])|i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'self::preg_tolower'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000000; font-weight: bold;">function</span> preg_tolower<span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$matches</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$parser</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> myClass<span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$parser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parsetext</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ABCDEFGH'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// echoes abcDEFGH</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$parser</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parsefail</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ABCDEFGH'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;">// throws the error</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>&#8220;self::preg_tolower&#8221;の他に</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;preg_tolower&quot;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p> と書いてもいいようです。</p>
<p>しかし、この手によく出てくる参照渡し。<br />
いまだに使ったこともなく、理解してないｗ</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/171/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phplinkdirectory メール機能を日本語化</title>
		<link>http://wp.foliz.net/archives/83</link>
		<comments>http://wp.foliz.net/archives/83#comments</comments>
		<pubDate>Thu, 04 Sep 2008 07:02:17 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[phpld]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/83</guid>
		<description><![CDATA[phplinkdirectory Free Version2.1　のメール機能を日本語対応にする。 フリーバージョンの最新版は2.2.0だけどテンプレートが2.1で止まっている？2.2対応と記されたのがないので安全を見て [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.phplinkdirectory.com/">phplinkdirectory</a> Free Version2.1　のメール機能を日本語対応にする。</p>
<p>フリーバージョンの最新版は2.2.0だけどテンプレートが2.1で止まっている？2.2対応と記されたのがないので安全を見て2.1を設置してます。</p>
<p>メール機能の日本語対応は答えがわかれば凄く簡単です。</p>
<p>まず、本プログラムのメール送信機能に<a href="http://phpmailer.codeworxtech.com/">phpMailer</a>ライブラリが使われています。</p>
<p>まずこれを最新版にあげちゃいます。<br />
for php5/6版の varion2.2.1が最新版でした。<br />
これをdownload解凍して　<br />
class.phpmailer.php<br />
class.pop3.php<br />
class.smtp.php<br />
/languageフォルダ　を入れ替えます。</p>
<p>入れ替えフォルダは<br />
phplinkdirectoryのlibs/phpmailer/ です。<br />
同じファイルが入っているので迷わないと思います。</p>
<p>そして<br />
class.phpmailer.phpの<br />
public $CharSet           = &#8216;UTF-8&#8242;;<br />
に変更。</p>
<p>これで完了です！！</p>
<p>最初iso-2022-jp、7bitで試したのですがダメでした。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/83/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php Link Directoryを設置してみた</title>
		<link>http://wp.foliz.net/archives/74</link>
		<comments>http://wp.foliz.net/archives/74#comments</comments>
		<pubDate>Thu, 22 May 2008 08:46:08 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/74</guid>
		<description><![CDATA[オープンソースの相互リンクシステムphp Link Directoryphp Link Directoryを設置してみた。 今回設置したのはフリーのversion2.1.2 サーバーの環境がEUC-JPなので設定する箇所 [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://wp.foliz.net/archives/74/outputjpg-2/' rel='attachment wp-att-75' title='output.jpg'><img src='http://wp.foliz.net/wp-content/uploads/2008/05/output.thumbnail.jpg' alt='output.jpg' /></a><br />
オープンソースの相互リンクシステムphp Link Directory<a href="http://www.phplinkdirectory.com/">php Link Directory</a>を設置してみた。<br />
<span id="more-74"></span><br />
今回設置したのはフリーのversion2.1.2</p>
<p>サーバーの環境がEUC-JPなので設定する箇所が複数あるのでメモ。</p>
<p>mySqlのテーブル参照順序をutf8_general_ciにしておく。</p>
<p>.htaccsessに<br />
<code>AddDefaultCharset UTF-8<br />
php_value mbstring.internal_encoding UTF-8<br />
php_value mbstring.http_output pass<br />
php_value mbstring.http_input pass<br />
php_flag mbstring.encoding_translation Off<br />
</code><br />
を追加</p>
<p>/init.phpに以下を追加</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>69
70
71
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFetchMode</span><span style="color: #009900;">&#40;</span>ADODB_FETCH_ASSOC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Execute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES 'utf8'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// &lt; --add</span>
read_config<span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>/admin/init.phpに以下を追加
</pre>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>59
60
61
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">SetFetchMode</span><span style="color: #009900;">&#40;</span>ADODB_FETCH_ASSOC<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$db</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">Execute</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SET NAMES 'utf8'&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// &lt; --add</span>
read_config<span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>以上</pre>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/74/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mySQL 誕生日から年齢を求める</title>
		<link>http://wp.foliz.net/archives/73</link>
		<comments>http://wp.foliz.net/archives/73#comments</comments>
		<pubDate>Thu, 01 May 2008 14:30:09 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/73</guid>
		<description><![CDATA[以前書いたと思ったけど見つからなかったのと新技があったので内容はダブルかもだけどメモ。 方法1 SELECT (YEAR(CURDATE())-YEAR(birth)) - (RIGHT(CURDATE(),5) < R [...]]]></description>
			<content:encoded><![CDATA[<p>以前書いたと思ったけど見つからなかったのと新技があったので内容はダブルかもだけどメモ。<br />
<span id="more-73"></span><br />
<strong>方法1</strong><br />
<code>SELECT (YEAR(CURDATE())-YEAR(birth)) - (RIGHT(CURDATE(),5) < RIGHT(birth,5)) AS age</code></p>
<p><strong>方法2</strong><br />
</code><code>SELECT (<br />
CASE WHEN DATE_FORMAT( NOW() ,'%m%e') >= DATE_FORMAT(birth,'%m%e')<br />
THEN YEAR( NOW() ) - YEAR( birth )<br />
ELSE YEAR( NOW() ) - YEAR( birth ) - 1<br />
END) AS age</code></p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/73/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scuttle：オープンソースのソーシャルブックマークを設置してみた</title>
		<link>http://wp.foliz.net/archives/72</link>
		<comments>http://wp.foliz.net/archives/72#comments</comments>
		<pubDate>Wed, 09 Apr 2008 13:14:16 +0000</pubDate>
		<dc:creator>Fou</dc:creator>
				<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://wp.foliz.net/archives/72</guid>
		<description><![CDATA[オープンソースのソーシャルブックマークScuttleを設置してみた。 まずScuttleの設置手順から Scuttleをダウンロード /config.inc.php.sample を/config.inc.phpに変更し [...]]]></description>
			<content:encoded><![CDATA[<p>オープンソースのソーシャルブックマークScuttleを設置してみた。<br />
<span id="more-72"></span><br />
まずScuttleの設置手順から</p>
<ol>
<li><a href="http://sourceforge.net/projects/scuttle/" target="_brank">Scuttle</a>をダウンロード</li>
<li>/config.inc.php.sample を/config.inc.phpに変更し、中身を自分用に書き換えます。</li>
<li>mySqlデーターベースを作成。付属のtables.sqlを実行</li>
</ol>
<p>ここまでが通常の設置<br />
続いて、dbがEUC保存しかできなかったので改造。</p>
<p>.hpacssessファイルに追加<br />
<code><br />
php_value mbstring.internal_encoding UTF-8<br />
php_value mbstring.http_output pass<br />
php_value mbstring.http_input pass<br />
php_flag mbstring.encoding_translation Off<br />
</code></p>
<p>includes/db/mysql4.phpに以下を追加。<br />
function sql_connect{}内の</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>45
46
47
48
49
50
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">@</span><span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbname</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
　<span style="color: #009900;">&#123;</span>
    <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SET NAMES utf8'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db_connect_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #666666; font-style: italic;">//add</span>
　　<span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db_connect_id</span><span style="color: #339933;">;</span>
　<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>そしてtemplates/を自分用にカスタマイズ。<br />
おまけに<a href="http://d.hatena.ne.jp/emergent/20070501/1178005668" target="_brank">Scuttleの見栄えを変更する &#8211; にたまごほうれん草</a>を参考にサムネイルの表示とファビコンの表示、はてブ件数の表示を付けた。</p>
<p>設置後いきなりスパム行為があったのでユーザー登録には日本語入力チェックを付けた。</p>
<p>更新時間のバグ（-18時間）があるけど、直すの面倒だからこのままでよしとするか・・。</p>
<p>今のところユーザー登録制限はないので勝手に登録して勝手に使ってもらってもよしですが、設置した場所はまた気が向いたら報告します。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.foliz.net/archives/72/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

