<?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>Florent Clairambault &#187; Wordpress</title>
	<atom:link href="http://florent.clairambault.fr/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://florent.clairambault.fr</link>
	<description></description>
	<lastBuildDate>Sat, 04 Feb 2012 19:56:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-alpha-19719</generator>
		<item>
		<title>WP-Codebox fix so that it doesn&#8217;t prevent posts export</title>
		<link>http://florent.clairambault.fr/wp-codebox-fix-so-that-it-doesnt-prevent-posts-export?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wp-codebox-fix-so-that-it-doesnt-prevent-posts-export</link>
		<comments>http://florent.clairambault.fr/wp-codebox-fix-so-that-it-doesnt-prevent-posts-export#comments</comments>
		<pubDate>Sat, 15 May 2010 07:00:08 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[WP Codebox]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2695</guid>
		<description><![CDATA[If you have a PHP configured with some open_basedir restriction (which is recommended), the WP-Codebox plugin will prevent you from exporting the posts of your blog. Go to your blog, go in the &#8220;wp-content/plugins/wp-codebox&#8221; dir and edit the &#8220;wp-codebox.php&#8221; file : On line 27, you should have : 1 2 include_once &#34;../../../wp-config.php&#34;; include_once &#34;../../../wp-settings.php&#34;; Well, [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a PHP configured with some <a href="http://www.php.net/manual/en/ini.core.php#ini.open-basedir">open_basedir restriction</a> (which is recommended), the WP-Codebox plugin will prevent you from exporting the posts of your blog.</p>
<p>Go to your blog, go in the &#8220;wp-content/plugins/wp-codebox&#8221; dir and edit the &#8220;wp-codebox.php&#8221; file :<br />
On line 27, you should have :</p>

<div class="wp_codebox"><table><tr id="p26953"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2695code3"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">&quot;../../../wp-config.php&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">&quot;../../../wp-settings.php&quot;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Well, it fails because the plugin doesn&#8217;t use the good practices, so it&#8217;s pretty easy to fix :</p>

<div class="wp_codebox"><table><tr id="p26954"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2695code4"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span> ABSPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'/wp-config.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span> ABSPATH<span style="color: #339933;">.</span><span style="color: #0000ff;">'/wp-settings.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>I&#8217;d like to thank the developer of this plugin for doing such a great job. It brings the power of <a href="http://qbnz.com/highlighter/">geshi</a> (not the latest version by the way) into <a href="http://wordpress.org/">wordpress</a>.</p>
<div style="display: none">
BTW, why change :<br />
* include_once to require_once : Why should we accept that a file couldn&#8217;t be included on go on ?<br />
* double quote to simple quote : php reads it faster because it doesn&#8217;t parse vars (&#8220;$&#8221; starting words).<br />
* no parenthesis to parenthesis : Well, it&#8217;s a method isn&#8217;t it ?
</div>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/wp-codebox-fix-so-that-it-doesnt-prevent-posts-export/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dirty WordPress APC caching</title>
		<link>http://florent.clairambault.fr/dirty-wordpress-apc-caching?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dirty-wordpress-apc-caching</link>
		<comments>http://florent.clairambault.fr/dirty-wordpress-apc-caching#comments</comments>
		<pubDate>Sat, 13 Feb 2010 08:00:36 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[APC]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2347</guid>
		<description><![CDATA[One or two weeks ago, I made a simple AB benchmarking test on a PHP site I built, it was ok. Then I did the same test on this blog and well&#8230; It was freaking slow&#8230; On 100 pages with 10 concurrent access, it took 3.5 to 10s to render. Well, I thought I should [...]]]></description>
			<content:encoded><![CDATA[<p>One or two weeks ago, I made a simple <a href="http://httpd.apache.org/docs/2.0/programs/ab.html">AB</a> benchmarking test on a PHP site I built, it was ok. Then I did the same test on this blog and well&#8230; It was freaking slow&#8230; On 100 pages with 10 concurrent access, it took 3.5 to 10s to render. Well, I thought I should remove all these plugins I installed to make me and my blog famous (they didn&#8217;t perform well). It reduced the generation time by something like 100 ms.</p>
<p>So I had the brilliant idea to put everything in an APC cache, <a href="http://www.idontplaydarts.com/2009/08/caching-wordpress-as-static-html-using-apc/">someone</a> had the same idea.</p>
<p>So I approximatively did the same thing :</p>
<p>In the beginning of the index.php file :</p>

<div class="wp_codebox"><table><tr id="p234710"><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
</pre></td><td class="code" id="p2347code10"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_METHOD'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'GET'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// This key will identify the page used</span>
        <span style="color: #000088;">$cacheKey</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'WP_'</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><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// We try to get this page</span>
        <span style="color: #000088;">$cacheData</span> <span style="color: #339933;">=</span> apc_fetch<span style="color: #009900;">&#40;</span><span style="color: #000088;">$cacheKey</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// If we got something</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cacheData</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// We give each header</span>
                <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cacheData</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$h</span> <span style="color: #009900;">&#41;</span>
                        <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$h</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #666666; font-style: italic;">// And the content</span>
                <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cacheData</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>
&nbsp;
        <span style="color: #666666; font-style: italic;">// If we're still here, we have no cache, so we'll start caching right now</span>
        <a href="http://www.php.net/ob_start"><span style="color: #990000;">ob_start</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>In the end of the index.php file :</p>

<div class="wp_codebox"><table><tr id="p234711"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2347code11"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// We have a cache key, it means we have something to cache</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cacheKey</span> <span style="color: #009900;">&#41;</span>
        apc_store<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$cacheKey</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/headers_list"><span style="color: #990000;">headers_list</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/ob_get_contents"><span style="color: #990000;">ob_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">900</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And once it&#8217;s cached it performs well, to make it short it can serve in mean time of 1 ms and gives a general bandwidth of 200 MB/s. As you can guess, these tests are made locally and this is normal.</p>

<div class="wp_codebox"><table><tr id="p234712"><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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code" id="p2347code12"><pre class="txt" style="font-family:monospace;">[root@s15342968 ~]# ab -n 100  &quot;http://florent.clairambault.fr/&quot;
This is ApacheBench, Version 2.0.40-dev &lt;$Revision: 1.146 $&gt; apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
&nbsp;
Benchmarking florent.clairambault.fr (be patient).....done
&nbsp;
&nbsp;
Server Software:        Apache/2.2.8
Server Hostname:        florent.clairambault.fr
Server Port:            80
&nbsp;
Document Path:          /
Document Length:        161165 bytes
&nbsp;
Concurrency Level:      1
Time taken for tests:   0.119899 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      16156100 bytes
HTML transferred:       16116500 bytes
Requests per second:    834.04 [#/sec] (mean)
Time per request:       1.199 [ms] (mean)
Time per request:       1.199 [ms] (mean, across all concurrent requests)
Transfer rate:          131585.75 [Kbytes/sec] received
&nbsp;
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    1   0.0      1       1
Waiting:        0    0   0.1      0       1
Total:          1    1   0.0      1       1
&nbsp;
Percentage of the requests served within a certain time (ms)
  50%      1
  66%      1
  75%      1
  80%      1
  90%      1
  95%      1
  98%      1
  99%      1
 100%      1 (longest request)</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p234713"><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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
</pre></td><td class="code" id="p2347code13"><pre class="txt" style="font-family:monospace;">[root@s15342968 ~]# ab -n 100 -c 10  &quot;http://florent.clairambault.fr/&quot;
This is ApacheBench, Version 2.0.40-dev &lt;$Revision: 1.146 $&gt; apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
&nbsp;
Benchmarking florent.clairambault.fr (be patient).....done
&nbsp;
&nbsp;
Server Software:        Apache/2.2.8
Server Hostname:        florent.clairambault.fr
Server Port:            80
&nbsp;
Document Path:          /
Document Length:        161165 bytes
&nbsp;
Concurrency Level:      10
Time taken for tests:   0.47897 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      16156100 bytes
HTML transferred:       16116500 bytes
Requests per second:    2087.81 [#/sec] (mean)
Time per request:       4.790 [ms] (mean)
Time per request:       0.479 [ms] (mean, across all concurrent requests)
Transfer rate:          329394.31 [Kbytes/sec] received
&nbsp;
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     1    4   1.3      4      10
Waiting:        0    1   1.0      1       4
Total:          1    4   1.3      4      10
&nbsp;
Percentage of the requests served within a certain time (ms)
  50%      4
  66%      4
  75%      5
  80%      5
  90%      6
  95%      6
  98%      8
  99%     10
 100%     10 (longest request)</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p234714"><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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
</pre></td><td class="code" id="p2347code14"><pre class="php" style="font-family:monospace;"><span style="color: #009900;">&#91;</span>root<span style="color: #339933;">@</span>s15342968 ~<span style="color: #009900;">&#93;</span><span style="color: #666666; font-style: italic;"># ab -n 10000 -c 10  &quot;http://florent.clairambault.fr/&quot;
</span>This is ApacheBench<span style="color: #339933;">,</span> Version 2<span style="color: #339933;">.</span>0<span style="color: #339933;">.</span>40<span style="color: #339933;">-</span>dev <span style="color: #339933;">&lt;</span><span style="color: #000088;">$Revision</span><span style="color: #339933;">:</span> <span style="color:#800080;">1.146</span> $<span style="color: #339933;">&gt;</span> apache<span style="color: #339933;">-</span><span style="color:#800080;">2.0</span>
Copyright <span style="color: #cc66cc;">1996</span> Adam Twiss<span style="color: #339933;">,</span> Zeus Technology Ltd<span style="color: #339933;">,</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.zeustech.net/</span>
Copyright <span style="color: #cc66cc;">2006</span> The Apache Software Foundation<span style="color: #339933;">,</span> http<span style="color: #339933;">:</span><span style="color: #666666; font-style: italic;">//www.apache.org/</span>
&nbsp;
Benchmarking florent<span style="color: #339933;">.</span>clairambault<span style="color: #339933;">.</span>fr <span style="color: #009900;">&#40;</span>be patient<span style="color: #009900;">&#41;</span>
Completed <span style="color: #cc66cc;">1000</span> requests
Completed <span style="color: #cc66cc;">2000</span> requests
Completed <span style="color: #cc66cc;">3000</span> requests
Completed <span style="color: #cc66cc;">4000</span> requests
Completed <span style="color: #cc66cc;">5000</span> requests
Completed <span style="color: #cc66cc;">6000</span> requests
Completed <span style="color: #cc66cc;">7000</span> requests
Completed <span style="color: #cc66cc;">8000</span> requests
Completed <span style="color: #cc66cc;">9000</span> requests
Finished <span style="color: #cc66cc;">10000</span> requests
&nbsp;
&nbsp;
Server Software<span style="color: #339933;">:</span>        Apache<span style="color: #339933;">/</span>2<span style="color: #339933;">.</span>2<span style="color: #339933;">.</span>8
Server Hostname<span style="color: #339933;">:</span>        florent<span style="color: #339933;">.</span>clairambault<span style="color: #339933;">.</span>fr
Server Port<span style="color: #339933;">:</span>            <span style="color: #cc66cc;">80</span>
&nbsp;
Document Path<span style="color: #339933;">:</span>          <span style="color: #339933;">/</span>
Document Length<span style="color: #339933;">:</span>        <span style="color: #cc66cc;">161165</span> bytes
&nbsp;
Concurrency Level<span style="color: #339933;">:</span>      <span style="color: #cc66cc;">10</span>
<a href="http://www.php.net/time"><span style="color: #990000;">Time</span></a> taken <span style="color: #b1b100;">for</span> tests<span style="color: #339933;">:</span>   <span style="color:#800080;">7.898135</span> seconds
Complete requests<span style="color: #339933;">:</span>      <span style="color: #cc66cc;">10000</span>
Failed requests<span style="color: #339933;">:</span>        <span style="color: #cc66cc;">0</span>
Write errors<span style="color: #339933;">:</span>           <span style="color: #cc66cc;">0</span>
Total transferred<span style="color: #339933;">:</span>      <span style="color: #cc66cc;">1616094683</span> bytes
HTML transferred<span style="color: #339933;">:</span>       <span style="color: #cc66cc;">1612133495</span> bytes
Requests per second<span style="color: #339933;">:</span>    <span style="color:#800080;">1266.12</span> <span style="color: #009900;">&#91;</span><span style="color: #666666; font-style: italic;">#/sec] (mean)
</span><a href="http://www.php.net/time"><span style="color: #990000;">Time</span></a> per request<span style="color: #339933;">:</span>       <span style="color:#800080;">7.898</span> <span style="color: #009900;">&#91;</span>ms<span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#40;</span>mean<span style="color: #009900;">&#41;</span>
<a href="http://www.php.net/time"><span style="color: #990000;">Time</span></a> per request<span style="color: #339933;">:</span>       <span style="color:#800080;">0.790</span> <span style="color: #009900;">&#91;</span>ms<span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#40;</span>mean<span style="color: #339933;">,</span> across all concurrent requests<span style="color: #009900;">&#41;</span>
Transfer rate<span style="color: #339933;">:</span>          <span style="color:#800080;">199821.47</span> <span style="color: #009900;">&#91;</span>Kbytes<span style="color: #339933;">/</span>sec<span style="color: #009900;">&#93;</span> received
&nbsp;
Connection Times <span style="color: #009900;">&#40;</span>ms<span style="color: #009900;">&#41;</span>
              <a href="http://www.php.net/min"><span style="color: #990000;">min</span></a>  mean<span style="color: #009900;">&#91;</span><span style="color: #339933;">+/-</span>sd<span style="color: #009900;">&#93;</span> median   <a href="http://www.php.net/max"><span style="color: #990000;">max</span></a>
Connect<span style="color: #339933;">:</span>        <span style="color: #cc66cc;">0</span>    <span style="color: #cc66cc;">0</span>   <span style="color:#800080;">0.9</span>      <span style="color: #cc66cc;">0</span>       <span style="color: #cc66cc;">7</span>
Processing<span style="color: #339933;">:</span>     <span style="color: #cc66cc;">2</span>    <span style="color: #cc66cc;">6</span>   <span style="color:#800080;">1.6</span>      <span style="color: #cc66cc;">7</span>      <span style="color: #cc66cc;">13</span>
Waiting<span style="color: #339933;">:</span>        <span style="color: #cc66cc;">0</span>    <span style="color: #cc66cc;">1</span>   <span style="color:#800080;">1.4</span>      <span style="color: #cc66cc;">1</span>       <span style="color: #cc66cc;">8</span>
Total<span style="color: #339933;">:</span>          <span style="color: #cc66cc;">2</span>    <span style="color: #cc66cc;">7</span>   <span style="color:#800080;">1.5</span>      <span style="color: #cc66cc;">7</span>      <span style="color: #cc66cc;">16</span>
&nbsp;
Percentage of the requests served within a certain <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a> <span style="color: #009900;">&#40;</span>ms<span style="color: #009900;">&#41;</span>
  <span style="color: #cc66cc;">50</span><span style="color: #339933;">%</span>      <span style="color: #cc66cc;">7</span>
  <span style="color: #cc66cc;">66</span><span style="color: #339933;">%</span>      <span style="color: #cc66cc;">8</span>
  <span style="color: #cc66cc;">75</span><span style="color: #339933;">%</span>      <span style="color: #cc66cc;">8</span>
  <span style="color: #cc66cc;">80</span><span style="color: #339933;">%</span>      <span style="color: #cc66cc;">8</span>
  <span style="color: #cc66cc;">90</span><span style="color: #339933;">%</span>      <span style="color: #cc66cc;">9</span>
  <span style="color: #cc66cc;">95</span><span style="color: #339933;">%</span>     <span style="color: #cc66cc;">10</span>
  <span style="color: #cc66cc;">98</span><span style="color: #339933;">%</span>     <span style="color: #cc66cc;">11</span>
  <span style="color: #cc66cc;">99</span><span style="color: #339933;">%</span>     <span style="color: #cc66cc;">11</span>
 <span style="color: #cc66cc;">100</span><span style="color: #339933;">%</span>     <span style="color: #cc66cc;">16</span> <span style="color: #009900;">&#40;</span>longest request<span style="color: #009900;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/dirty-wordpress-apc-caching/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WordPress supports MultiSites</title>
		<link>http://florent.clairambault.fr/wordpress-supports-multisites?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wordpress-supports-multisites</link>
		<comments>http://florent.clairambault.fr/wordpress-supports-multisites#comments</comments>
		<pubDate>Sun, 10 Jan 2010 01:27:44 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[MultiSites]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2296</guid>
		<description><![CDATA[WordPress now supports MultiSites with its 3.0 version. It&#8217;s the current SVN development version. This means you can have one wordpress install for multiple sites. You can see how it works by looking into &#8220;ms-settings.php&#8221;. This is quite a good news for anyone willing to manage a community of bloggers. Here is a part of [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress now supports MultiSites with its 3.0 version. It&#8217;s the current SVN development version. This means you can have one wordpress install for multiple sites. You can see how it works by looking into &#8220;ms-settings.php&#8221;.</p>
<p>This is quite a good news for anyone willing to manage a community of bloggers.</p>
<p>Here is a part of the <strong>wp-includes/wp-settings.php</strong> file :</p>

<div class="wp_codebox"><table><tr id="p229616"><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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
</pre></td><td class="code" id="p2296code16"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wpmu_current_site<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">,</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sites</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'DOMAIN_CURRENT_SITE'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'PATH_CURRENT_SITE'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$current_site</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'SITE_ID_CURRENT_SITE'</span> <span style="color: #009900;">&#41;</span> ? <a href="http://www.php.net/constant"><span style="color: #990000;">constant</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'SITE_ID_CURRENT_SITE'</span><span style="color: #009900;">&#41;</span> <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: #000088;">$current_site</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">domain</span> <span style="color: #339933;">=</span> DOMAIN_CURRENT_SITE<span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">path</span>   <span style="color: #339933;">=</span> <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> PATH_CURRENT_SITE<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'BLOGID_CURRENT_SITE'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                        <span style="color: #000088;">$current_site</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">blog_id</span> <span style="color: #339933;">=</span> BLOGID_CURRENT_SITE<span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> wp_cache_get<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;current_site&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;site-options&quot;</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;">$current_site</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">suppress_errors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #000088;">$sites</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// usually only one site</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sites</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sites</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">path</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">blog_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;SELECT blog_id FROM <span style="color: #006699; font-weight: bold;">{$wpdb-&gt;blogs}</span> WHERE domain='<span style="color: #006699; font-weight: bold;">{$current_site-&gt;domain}</span>' AND path='<span style="color: #006699; font-weight: bold;">{$current_site-&gt;path}</span>'&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> get_current_site_name<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$current_site</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                wp_cache_set<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;current_site&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;site-options&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span> <span style="color: #0000ff;">'REQUEST_URI'</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span> <span style="color: #0000ff;">'REQUEST_URI'</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: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> is_subdomain_install<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span> WHERE domain = <span style="color: #009933; font-weight: bold;">%s</span> AND path = <span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</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;">$current_site</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span> WHERE domain = <span style="color: #009933; font-weight: bold;">%s</span> AND path='/'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span><span style="color: #009900;">&#41;</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;">$current_site</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>
                        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
&nbsp;
                <span style="color: #000088;">$sitedomain</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span> WHERE domain = <span style="color: #009933; font-weight: bold;">%s</span> AND path = <span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sitedomain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</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;">$current_site</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span> WHERE domain = <span style="color: #009933; font-weight: bold;">%s</span> AND path='/'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$sitedomain</span><span style="color: #009900;">&#41;</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;">$current_site</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;WP_INSTALLING&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">false</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> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sites</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sites</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                                <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;That blog does not exist. Please try &lt;a href='http://<span style="color: #006699; font-weight: bold;">{$current_site-&gt;domain}</span><span style="color: #006699; font-weight: bold;">{$current_site-&gt;path}</span>'&gt;http://<span style="color: #006699; font-weight: bold;">{$current_site-&gt;domain}</span><span style="color: #006699; font-weight: bold;">{$current_site-&gt;path}</span>&lt;/a&gt;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                                <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;No WPMU site defined on this host. If you are the owner of this site, please check &lt;a href='http://codex.wordpress.org/Debugging_WPMU'&gt;Debugging WPMU&lt;/a&gt; for f
urther assistance.&quot;</span> <span style="color: #009900;">&#41;</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: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</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: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span> WHERE domain = <span style="color: #009933; font-weight: bold;">%s</span> AND path = <span style="color: #009933; font-weight: bold;">%s</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</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;">$current_site</span> <span style="color: #339933;">!=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span>
                        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_row</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT * FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;site</span> WHERE domain = <span style="color: #009933; font-weight: bold;">%s</span> AND path='/'&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$domain</span><span style="color: #009900;">&#41;</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;">$current_site</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;WP_INSTALLING&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">false</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> <a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$sites</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                <span style="color: #000088;">$current_site</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sites</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
                                <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;That blog does not exist. Please try &lt;a href='http://<span style="color: #006699; font-weight: bold;">{$current_site-&gt;domain}</span><span style="color: #006699; font-weight: bold;">{$current_site-&gt;path}</span>'&gt;http://<span style="color: #006699; font-weight: bold;">{$current_site-&gt;domain}</span><span style="color: #006699; font-weight: bold;">{$current_site-&gt;path}</span>&lt;/a&gt;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
                                <a href="http://www.php.net/die"><span style="color: #990000;">die</span></a><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;No WPMU site defined on this host. If you are the owner of this site, please check &lt;a href='http://codex.wordpress.org/Debugging_WPMU'&gt;Debugging WPMU&lt;/a&gt; for f
urther assistance.&quot;</span> <span style="color: #009900;">&#41;</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: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$current_site</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/wordpress-supports-multisites/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP Codebox Quick fix for WordPress 2.9</title>
		<link>http://florent.clairambault.fr/wp-codebox-quick-fix-for-wordpress-2-9?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=wp-codebox-quick-fix-for-wordpress-2-9</link>
		<comments>http://florent.clairambault.fr/wp-codebox-quick-fix-for-wordpress-2-9#comments</comments>
		<pubDate>Mon, 07 Dec 2009 19:00:02 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[WP Codebox]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2120</guid>
		<description><![CDATA[This bug has been fixed ! I like to have the latest version of WordPress, this is why I use the SVN version. And recently the CSS of the &#8220;WP Codebox&#8221; plugin stopped working. Here the explanation and the solution : It seems that starting with the 2.9 version, you can register the styles in [...]]]></description>
			<content:encoded><![CDATA[<p><strong style="color: red">This bug has been fixed !</strong></p>
<p>I like to have the latest version of WordPress, this is why I use <a href="http://codex.wordpress.org/Installing/Updating_WordPress_with_Subversion">the SVN version</a>. And recently the CSS of the &#8220;WP Codebox&#8221; plugin stopped working. Here the explanation and the solution :</p>
<p>It seems that starting with the 2.9 version, you can register the styles in the &#8220;wp_print_scripts&#8221; action method. So in the wp-codebox.php file, you have to put this :</p>

<div class="wp_codebox"><table><tr id="p212018"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
</pre></td><td class="code" id="p2120code18"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_print_scripts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Codebox_ScriptsAction'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> Codebox_ScriptsAction <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$cb_path</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpurl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wp-content/plugins/wp-codebox&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//URL to the plugin directory</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        wp_enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'codebox'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cb_path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/js/codebox.js'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'0.1'</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;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_print_styles'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Codebox_StylesAction'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> Codebox_StylesAction<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$cb_path</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wpurl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wp-content/plugins/wp-codebox&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//URL to the plugin directory</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                wp_enqueue_style<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'codebox'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cb_path</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/css/codebox.css'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'0.1'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'screen'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>And it will work&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/wp-codebox-quick-fix-for-wordpress-2-9/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 disk: basic
Page Caching using disk: enhanced
Database Caching 1/21 queries in 0.010 seconds using disk: basic
Object Caching 794/822 objects using disk: basic

Served from: florent.clairambault.fr @ 2012-02-07 11:07:51 -->
