<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>khoshinoのライフログ &#187; プラグイン</title>
	<atom:link href="http://khoshino.com/tag/%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3/feed/" rel="self" type="application/rss+xml" />
	<link>http://khoshino.com</link>
	<description>WEB制作やアプリ制作が好きなkhoshinoのライフログ</description>
	<lastBuildDate>Wed, 04 Jan 2012 20:58:18 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://khoshino.com/tag/%e3%83%97%e3%83%a9%e3%82%b0%e3%82%a4%e3%83%b3/feed/" />
		<item>
		<title>WP Social Bookmarking Lightプラグインをインストールして有効化する。</title>
		<link>http://khoshino.com/2011/10/17/291/</link>
		<comments>http://khoshino.com/2011/10/17/291/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 00:55:26 +0000</pubDate>
		<dc:creator>khoshino</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://khoshino.com/?p=291</guid>
		<description><![CDATA[WordPressのプラグインで、「WP Social Bookmarking Light」プラグインをインストールして有効化しました。 このプラグインを有効化すると、ソーシャルボタンを、簡単にWordPressに設置す &#8230; <a href="http://khoshino.com/2011/10/17/291/">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>WordPressのプラグインで、「WP Social Bookmarking Light」プラグインをインストールして有効化しました。</p>
<p>このプラグインを有効化すると、ソーシャルボタンを、簡単にWordPressに設置することができます。<br />
最近は、TwitterやFacebookを始め、ソーシャルからの流入や連携も意識する時代になってきた、ということですね。</p>
<p>連携できるソーシャルは、以下のように多くに渡ります。<br />
<a href="http://wordpress.org/extend/plugins/wp-social-bookmarking-light/">WordPress › WP Social Bookmarking Light « WordPress Plugins</a><br />
Hatena<br />
Facebook<br />
Facebook Like Button<br />
Facebook Send Button<br />
Twitter<br />
Livedoor Clip<br />
BuzzURL<br />
@nifty clip<br />
Tumblr<br />
FC2 Bookmark<br />
newsing<br />
Choix<br />
Yahoo!JAPAN Bookmark<br />
Yahoo!Buzz<br />
Google Bookmark<br />
Google Buzz<br />
Google +1<br />
Delicious<br />
Digg<br />
FriendFeed<br />
reddit<br />
LinkedIn<br />
Evernote<br />
Instapaper<br />
StumbleUpon<br />
mixi Check<br />
mixi Like<br />
GREE Social Feedback<br />
atode (toread)<br />
Grow!</p>
]]></content:encoded>
			<wfw:commentRss>http://khoshino.com/2011/10/17/291/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://khoshino.com/2011/10/17/291/" />
	</item>
		<item>
		<title>大曲さんが作られた「WordPressで挿入する画像のsrcを相対リンクにする【発展版】」をプラグイン化</title>
		<link>http://khoshino.com/2011/10/17/255/</link>
		<comments>http://khoshino.com/2011/10/17/255/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 00:47:17 +0000</pubDate>
		<dc:creator>khoshino</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://khoshino.com/?p=255</guid>
		<description><![CDATA[そのようなわけで、ライフログを取るにあたって、色々と初めの仕組み作りをしているわけですが、 ブログをWordPressで書こうとする場合、画像を添付する時は、画像の挿入リンクは、絶対リンクになる仕様です。 例えば、 とな &#8230; <a href="http://khoshino.com/2011/10/17/255/">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>そのようなわけで、ライフログを取るにあたって、色々と初めの仕組み作りをしているわけですが、<br />
ブログをWordPressで書こうとする場合、画像を添付する時は、画像の挿入リンクは、絶対リンクになる仕様です。<br />
例えば、</p>
<pre class="brush: xml; title: ; notranslate">
&lt;img src=&quot;http://khoshino.com/wp-content/uploads/2011/10/abc.jpg&quot; /&gt;
</pre>
<p>となります。</p>
<p>この場合、例えば、ローカル環境や構築環境で作ったサイトを、本番用のドメインで公開する場合、画像を既に多くアップロードしている場合には、この画像のドメイン部分のURLを置換する必要があります。<br />
また、既に運営しているサイトを、何かの事情でドメインを移行する場合にも、同様に、この画像のドメイン部分のURLを置換する必要が生じるでしょう。</p>
<p>以上のような理由から、WordPressで挿入する画像のsrcを相対リンクにする需要があるわけで、大曲さんが、ソースコードを書いてくださっています。</p>
<p>このソースコードを用いると、<br />
<strong><a href="http://www.warna.info/archives/20/">WordPressで挿入する画像のsrcを相対リンクにする</a></strong>では、</p>
<pre class="brush: xml; title: ; notranslate">
&lt;img src=&quot;/wp-content/uploads/2011/10/abc.jpg&quot; /&gt;
</pre>
<p>となります。</p>
<p>また、<br />
<strong><a href="http://www.warna.info/archives/1789/">WordPressで挿入する画像のsrcを相対リンクにする【発展版】</a></strong>では、</p>
<pre class="brush: xml; title: ; notranslate">
&lt;img src=&quot;[domain]/wp-content/uploads/2011/10/abc.jpg&quot; /&gt;
</pre>
<p>となり、結果的には、</p>
<pre class="brush: xml; title: ; notranslate">
&lt;img src=&quot;http://khoshino.com/wp-content/uploads/2011/10/abc.jpg&quot; /&gt;
</pre>
<p>という感じで、絶対パスになるけど、柔軟に対応できるという仕様になっています。</p>
<p>大曲さんの提案は、テーマのfunctions.phpの中に、ソースコードを書く、という方法です。<br />
もちろん、この方法でも問題無いのですが、すると、テーマを変えるたびに、コードをまたfunctions.phpに書かなくてはいけません。<br />
一方で、プラグイン化すれば、そのサイトにおいては、テーマを変えても、ずっと相対リンクで画像を表示することができます。</p>
<p>また、大曲さんの【発展版】の方の場合、ショートコードを使っているので、このソースコードを有効化しなくなった際には、画像が表示されなくなってしまうと思います。そのような理由から、プラグイン化で、このブログでは使ってみようかと思いました。</p>
<p><strong><a href="http://www.warna.info/archives/1789/">WordPressで挿入する画像のsrcを相対リンクにする【発展版】 | Simple Colors</a></strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/*
Plugin Name: gazou src
Plugin URI: http://wp3.jp/
Description: WordPressで挿入する画像のsrcを相対リンクにします。
Author: Kunitoshi Hoshino
Version: 0.1
Author URI: http://wp3.jp/
*/

/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

/*
このプラグインは、大曲さんの「WordPressで挿入する画像のsrcを相対リンクにする【発展版】」をプラグイン化しただけのものです。
プラグイン化した理由は、テーマのfunctions.phpに記載した場合、テーマを変えるたびに、コードをまたfunctions.phpに書かなくてはいけません。
プラグイン化すれば、そのサイトにおいては、テーマを変えても、ずっと相対リンクで画像を表示できるからです。
素敵なソースコードを書いてくださった大曲さんに感謝します！
WordPressで挿入する画像のsrcを相対リンクにする【発展版】 | Simple Colors
URL: http://www.warna.info/archives/1789/
*/

function delete_host_from_attachment_url( $url ) {
    $regex = '/^http(s)?:\/\/[^\/\s]+(.*)$/';
    if ( preg_match( $regex, $url, $m ) ) {
        $url = '[domain]' . $m[2];
    }
    return $url;
}
add_filter( 'wp_get_attachment_url', 'delete_host_from_attachment_url' );

function domain_shortcode() {
    if ( preg_match( '|^https?://[^/]+|', get_option( 'home' ), $m ) ) {
        $domain = $m[0];
    } else {
        $domain = '';
    }
    return $domain;
}
add_shortcode( 'domain', 'domain_shortcode' );
</pre>
<p>なお、ショートコードを使わず、純粋な相対リンクで十分だよ、という人は、コチラです。</p>
<p><strong><a href="http://www.warna.info/archives/20/">WordPressで挿入する画像のsrcを相対リンクにする | Simple Colors</a></strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
/*
Plugin Name: gazou src
Plugin URI: http://wp3.jp/
Description: WordPressで挿入する画像のsrcを相対リンクにします。
Author: Kunitoshi Hoshino
Version: 0.1
Author URI: http://wp3.jp/
*/

/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

/*
このプラグインは、大曲さんの「WordPressで挿入する画像のsrcを相対リンクにする」をプラグイン化しただけのものです。
プラグイン化した理由は、テーマのfunctions.phpに記載した場合、テーマを変えるたびに、コードをまたfunctions.phpに書かなくてはいけません。
プラグイン化すれば、そのサイトにおいては、テーマを変えても、ずっと相対リンクで画像を表示できるからです。
素敵なソースコードを書いてくださった大曲さんに感謝します！
WordPressで挿入する画像のsrcを相対リンクにする | Simple Colors
URL: http://www.warna.info/archives/20/
*/

function delete_host_from_attachment_url( $url ) {
    $regex = '/^http(s)?:\/\/[^\/\s]+(.*)$/';
    if ( preg_match( $regex, $url, $m ) ) {
        $url = $m[2];
    }
    return $url;
}
add_filter( 'wp_get_attachment_url', 'delete_host_from_attachment_url' );

add_filter( 'attachment_link', 'delete_host_from_attachment_url' );
</pre>
<p>以上のいずれかのソースコードを、gazou-src.phpなど、適当なファイルを作って、［wp-content］の階層下の［plugins］の中に、アップロードしましょう。</p>
<p>ただ、１点、WordPressが公式に出しているiPhoneアプリから画像を投稿をすると、結局、画像は、絶対パスになるので、iPhoneアプリやメール投稿から、画像も投稿する人は、結局、MySQL（データベース）からの一括置換が必要になる気がしますねぇ。</p>
]]></content:encoded>
			<wfw:commentRss>http://khoshino.com/2011/10/17/255/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://khoshino.com/2011/10/17/255/" />
	</item>
		<item>
		<title>SyntaxHighlighter Evolvedプラグインをインストールして有効化する。</title>
		<link>http://khoshino.com/2011/10/16/248/</link>
		<comments>http://khoshino.com/2011/10/16/248/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 04:29:50 +0000</pubDate>
		<dc:creator>khoshino</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://khoshino.com/?p=248</guid>
		<description><![CDATA[WordPressのプラグインで、「SyntaxHighlighter Evolved」プラグインをインストールして有効化しました。 これは、PHPなどのソースコードを、WordPressの投稿画面に書いて、ソースコード &#8230; <a href="http://khoshino.com/2011/10/16/248/">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>WordPressのプラグインで、「SyntaxHighlighter Evolved」プラグインをインストールして有効化しました。</p>
<p>これは、PHPなどのソースコードを、WordPressの投稿画面に書いて、ソースコード解説などをしたい際に、<br />
［php］［/php］（［］はココでは全角ですが、半角に直してください。）<br />
というショートコードで書こうと、</p>
<pre class="brush: php; title: ; notranslate">
echo 'テスト';
</pre>
<p>などと表示されるプラグインです。</p>
<p>プログラム関係の解説をしているブログをWordPressで書いている場合には、便利なプラグインかもしれないですね。</p>
<p>管理画面から、色やレイアウトなども変えられます。</p>
<p>もともと<strong>「SyntaxHighlighter」</strong>というものがあって、それをWordPressのプラグイン化している、ということです。</p>
<p><a href="http://www.google.co.jp/search?rlz=1C1CHMZ_jaJP326JP326&#038;aq=f&#038;gcx=w&#038;sourceid=chrome&#038;ie=UTF-8&#038;q=SyntaxHighlighter">SyntaxHighlighter &#8211; Google 検索</a></p>
]]></content:encoded>
			<wfw:commentRss>http://khoshino.com/2011/10/16/248/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://khoshino.com/2011/10/16/248/" />
	</item>
		<item>
		<title>Akismetプラグインを有効化する。</title>
		<link>http://khoshino.com/2011/10/16/243/</link>
		<comments>http://khoshino.com/2011/10/16/243/#comments</comments>
		<pubDate>Sun, 16 Oct 2011 03:55:09 +0000</pubDate>
		<dc:creator>khoshino</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Akismet]]></category>
		<category><![CDATA[プラグイン]]></category>

		<guid isPermaLink="false">http://khoshino.com/?p=243</guid>
		<description><![CDATA[WordPressのプラグインとして、デフォルト（初期の段階）で入っている「Akismet」プラグインを有効化しました。 これはスパムコメントなどを防止するプラグインです。 Akismet API キーが必要ですが、 A &#8230; <a href="http://khoshino.com/2011/10/16/243/">続きを読む <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>WordPressのプラグインとして、デフォルト（初期の段階）で入っている「Akismet」プラグインを有効化しました。<br />
これはスパムコメントなどを防止するプラグインです。<br />
<strong>Akismet API キー</strong>が必要ですが、<br />
<a href="http://akismet.com/wordpress/">Akismet anti-spam plugin for WordPress</a><br />
から取得できます。<br />
最近は有料版もあるみたいですね。個人サイトなら、無料版で良いと思いますよ。</p>
]]></content:encoded>
			<wfw:commentRss>http://khoshino.com/2011/10/16/243/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://khoshino.com/2011/10/16/243/" />
	</item>
	</channel>
</rss>
