<?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>Garbage Collector 2.0</title>
	<atom:link href="http://wott.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://wott.info</link>
	<description>Another brick in the web</description>
	<lastBuildDate>Sat, 21 Apr 2012 01:34:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Comments enabled</title>
		<link>http://wott.info/common/comments-enabled/</link>
		<comments>http://wott.info/common/comments-enabled/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 16:08:41 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Common]]></category>

		<guid isPermaLink="false">http://wott.info/?p=1037</guid>
		<description><![CDATA[Hi people ! I am sorry for problems in commenting due mistake which I made in configuration, but now it should works. You can comment from list of post and new comment will be placed to the top posts on the page. If you click to the top-right corner of existed comment you have to [...]]]></description>
			<content:encoded><![CDATA[<p>Hi people !</p>
<p>I am sorry for problems in commenting due mistake which I made in configuration, but now it should works.</p>
<ul>
<li>You can comment from list of post and new comment will be placed to the top posts on the page. </li>
<li>If you click to the top-right corner of existed comment you have to see reply form with the replied comment body. </li>
<li>During comment editing you can use tools and preview by icons above comment body</li>
<li>After submit you can remove the comment during 1 hour. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/common/comments-enabled/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New version 1.5.3 of Picasa Express plugin for WordPress</title>
		<link>http://wott.info/picasa-express/new-version-1-5-3-of-picasa-express-plugin-for-wordpress/</link>
		<comments>http://wott.info/picasa-express/new-version-1-5-3-of-picasa-express-plugin-for-wordpress/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 21:47:29 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Picasa Express]]></category>
		<category><![CDATA[Picasa]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://wott.info/?p=1030</guid>
		<description><![CDATA[New WordPress version 3.3 bring some important changes for my plugin so I release version 1.5.3 early. Everyone who use WP 3.3 RC2 or later, please test the plugin and report if you find anything wrong. Additionally some small fixes was included like Network activation and new site ( if you like to see plugin [...]]]></description>
			<content:encoded><![CDATA[<div class="alignright">
<div id="fb-root"></div>
<p><script src="http://connect.facebook.net/en_US/all.js#appId=116442491780273&#038;xfbml=1"></script><fb:like href="http://wott.info" layout="box_count" width="50" show_faces="false" font="verdana"></fb:like>
</div>
<div class="alignright">
<p><g:plusone href="http://wott.info" size="tall"></g:plusone></p>
</div>
<p><img src="http://lh5.ggpht.com/-jrpL1HRjHs8/TuEwFSYyDAI/AAAAAAAAAqY/RMkDiF-iLjI/s150/wrench2.png" alt="wrench2.png" class="alignleft" style="margin:10px;" width="150" /><br />
New WordPress version 3.3 bring some important changes for my plugin so I release version 1.5.3 early. Everyone who use WP 3.3 RC2 or later, please test the plugin and report if you find anything wrong.</p>
<p>Additionally some small fixes was included like Network activation and new site ( if you like to see plugin active in new created sites, please make network reactivate after update to 1.5.3 ), fix for update setting and roles, caption shortcode fix and etc.</p>
<p>Album gallery has now more option for tune the results. All parameters included in the readme.txt file in new version changelog section.</p>
<p><strong>Update</strong>: Picasa change the URL rules and now</p>
<ul>
<li>original image moved to prefix /s0 </li>
<li>without prefix you can find 512 pixels limited image</li>
</ul>
<p>You can use the workaround and set ‘Large image size’ to /s0 ( limit by any direction and 0 in the pixels input ) or set you preferred size. Next version will have /s0 as link for big image.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/picasa-express/new-version-1-5-3-of-picasa-express-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Attachments for custom posts</title>
		<link>http://wott.info/wordpress/attachments-for-custom-posts/</link>
		<comments>http://wott.info/wordpress/attachments-for-custom-posts/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 21:07:55 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom posts]]></category>

		<guid isPermaLink="false">http://wott.info/?p=1015</guid>
		<description><![CDATA[Attachments can be linked to any post or page, so custom posts have not any difference and any code below work for classic posts as well. How to add file to the post ? How to get the file ? And how to change file attributes like title for attachments ? Here you will find [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://lh6.ggpht.com/-kmoOi_c6R1E/TojVXpg_3KI/AAAAAAAAApk/UMdiafVJtU0/Attachment.png" alt="Attachment.png" title="Attachment.png" class="alignright" style="margin:10px;" width="256" height="256" /></p>
<p>Attachments can be linked to any post or page, so custom posts have not any difference and any code below work for classic posts as well.</p>
<p>How to add file to the post ? How to get the file ? And how to change file attributes like title for attachments ? Here you will find the answers.</p>
<p><span id="more-1015"></span></p>
<p>First, you can upload file only by form with <em>enctype=&#8221;multipart/form-data&#8221;</em> so you need to add this property to the form. Post edit form has special hook <em>post_edit_form_tag</em> and enctype can be simply add by code like</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p10157">
        <div class="code php" id="p1015code7">
add_action<span class="br0">&#40;</span><span class="st_h">'post_edit_form_tag'</span><span class="sy0">,</span><span class="st_h">'publications_form_enctype'</span><span class="br0">&#41;</span>;<br />
<span class="kw2">function</span> publications_form_enctype<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">echo</span> <span class="st_h">' enctype=&quot;multipart/form-data&quot; '</span>;<br />
<span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>then you can add somewhere html like</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p10158">
        <div class="code html" id="p1015code8">
<span class="sc3">&lt;<span class="kw2">input</span> <span class="kw3">type</span><span class="sy0">=</span><span class="st0">&quot;file&quot;</span> <span class="kw3">name</span><span class="sy0">=</span><span class="st0">&quot;userfile&quot;</span> <span class="kw3">size</span><span class="sy0">=</span><span class="st0">&quot;80&quot;</span> <span class="kw3">id</span><span class="sy0">=</span><span class="st0">&quot;userfile&quot;</span> <span class="sy0">/</span>&gt;</span>
        </div>
    </div>
</div>

<p>of course you can use ajax or flash for file uploading, but anyway you will receive the <em>$_FILES</em> in the php code and need to handle the uploaded temporary file in the hooks</p>
<p>Main function for handle files in the WordPress is <em>media_handle_upload()</em>. you need to provide the name of the file input and post id. In the <em>save_post</em> hook you can place the code like</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p10159">
        <div class="code php" id="p1015code9">
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">empty</span><span class="br0">&#40;</span><span class="re0">$_FILES</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Upload File button was clicked</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$id</span> <span class="sy0">=</span> media_handle_upload<span class="br0">&#40;</span><span class="st_h">'userfile'</span><span class="sy0">,</span> <span class="re0">$post_id</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//unset($_FILES);</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> is_wp_error<span class="br0">&#40;</span><span class="re0">$id</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$errors</span><span class="br0">&#91;</span><span class="st_h">'upload_error'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$id</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$id</span> <span class="sy0">=</span> <span class="kw2">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>ID provided by media_handle_upload is attachment id, which is used by function for attachment management like <em>wp_delete_attachment()</em> or <em>wp_get_attachment_image()</em>. You can save this ID or use <em>get_posts()</em> with post_type=attachment to request linked attachments to the post.</p>
<p>Normally WP can handle files only with meta_type and extension of media files &#8211; images or movie. You can disable this check by </p>
          
<div class="codebox">
    <div class="the_code" style="" id="p101510">
        <div class="code php" id="p1015code10">
<span class="kw3">define</span><span class="br0">&#40;</span><span class="st_h">'ALLOW_UNFILTERED_UPLOADS'</span><span class="sy0">,</span><span class="kw2">true</span><span class="br0">&#41;</span>;
        </div>
    </div>
</div>

<p>Another problem will be happens if you download file on server side. For this case you have to use <em>media_handle_sideload()</em> function. The handle functions has also some filters for disable few checks if you have special file treatment.</p>
<p>Additionally files in WP has few standard meta data like caption. Usual images has internal meta data or file name used as caption. But you can overwrite caption from your form field by code in the <em>save_post</em> hook:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p101511">
        <div class="code php" id="p1015code11">
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> <span class="sy0">!</span><span class="kw3">empty</span><span class="br0">&#40;</span><span class="re0">$_FILES</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; add_filter<span class="br0">&#40;</span><span class="st_h">'wp_read_image_metadata'</span><span class="sy0">,</span><span class="st_h">'my_save_file_description'</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">// Upload File button was clicked</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$id</span> <span class="sy0">=</span> media_handle_upload<span class="br0">&#40;</span><span class="st_h">'userfile'</span><span class="sy0">,</span> <span class="re0">$post_id</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">unset</span><span class="br0">&#40;</span><span class="re0">$_FILES</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> is_wp_error<span class="br0">&#40;</span><span class="re0">$id</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$errors</span><span class="br0">&#91;</span><span class="st_h">'upload_error'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="re0">$id</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$id</span> <span class="sy0">=</span> <span class="kw2">false</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>and function for the filter above</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p101512">
        <div class="code php" id="p1015code12">
<span class="kw2">function</span> my_save_file_description<span class="br0">&#40;</span><span class="re0">$meta</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'filedesc'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$meta</span><span class="br0">&#91;</span><span class="st_h">'caption'</span><span class="br0">&#93;</span> <span class="sy0">=</span> <span class="kw3">utf8_encode</span><span class="br0">&#40;</span> <span class="kw3">trim</span><span class="br0">&#40;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'filedesc'</span><span class="br0">&#93;</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$meta</span>;<br />
<span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>To show attachment in the template use <em>the_attachment_link()</em> which provide permalink for the file. </p>
<p>Of course WP has a lot of abilities for use files like featured image or make gallery. Take a look into <a href="http://codex.wordpress.org/Function_Reference" title="Codex Function reference" target="_blank">Codex</a> for the features and keep you sites usable.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/wordpress/attachments-for-custom-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introduction to custom posts</title>
		<link>http://wott.info/wordpress/introduction-to-custom-posts/</link>
		<comments>http://wott.info/wordpress/introduction-to-custom-posts/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 20:15:09 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[custom posts]]></category>

		<guid isPermaLink="false">http://wott.info/?p=994</guid>
		<description><![CDATA[WordPress 3 give new instrument which make WP more powerful and wide abilities for make blogs and sites better. Custom posts allow to separate some objectives from posts and pages to make good treatment for files, events, news etc. What really custom posts is ? Custom posts is new record in the posts table ( [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://lh3.ggpht.com/-azYxYEZ5ZvM/Tl9YD75cQJI/AAAAAAAAApE/FDQOwb44QE0/sculptor.jpg" alt="sculptor.jpg" title="sculptor.jpg" class="alignleft" style="margin:10px;" width="152" height="200" /> WordPress 3 give new instrument which make WP more powerful and wide abilities for make blogs and sites better. Custom posts allow to separate some objectives from posts and pages to make good treatment for files, events, news etc.</p>
<p>What really custom posts is ? <span id="more-994"></span> Custom posts is new record in the posts table ( additionally to posts, pages and attachments ), add new item to the admin menu ( to top or below some menu point ), add new taxonomies like category for hierarchy or like tags for flat, add new rewrite point for permalink to see custom posts in UI. Some core features like widgets or system function still works only with system types of posts, but can be easily hooked or changed. </p>
<p>I will show how to use custom posts for files, testimonials, calendar events, form for add for users and many other features</p>
<h2>Register the custom posts</h2>
<p>First you have to register custom posts by <a href="http://codex.wordpress.org/Function_Reference/register_post_type" title="register_post_type description in the Codex">register_post_type()</a></p>
          
<div class="codebox">
    <div class="the_code" style="" id="p99418">
        <div class="code php" id="p994code18">
add_action<span class="br0">&#40;</span><span class="st_h">'init'</span><span class="sy0">,</span> <span class="st_h">'testimonials_init'</span><span class="br0">&#41;</span>;<br />
<span class="kw2">function</span> testimonials_init<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="re0">$args</span> <span class="sy0">=</span> <span class="kw3">array</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'labels'</span> <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'name'</span> <span class="sy0">=&gt;</span> __<span class="br0">&#40;</span><span class="st_h">'Testimonials'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'singular_name'</span> <span class="sy0">=&gt;</span> __<span class="br0">&#40;</span><span class="st_h">'Testimonials'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'add_new_item'</span> <span class="sy0">=&gt;</span> __<span class="br0">&#40;</span><span class="st_h">'Add new testimonal'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'edit_item'</span> <span class="sy0">=&gt;</span> __<span class="br0">&#40;</span><span class="st_h">'Edit testimonal'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'public'</span> <span class="sy0">=&gt;</span> <span class="kw2">true</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'supports'</span> <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span><span class="st_h">'title'</span><span class="sy0">,</span> <span class="st_h">'editor'</span><span class="sy0">,</span> <span class="st_h">'thumbnail'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'rewrite'</span> <span class="sy0">=&gt;</span> <span class="kw2">true</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'has_archive'</span> <span class="sy0">=&gt;</span> <span class="kw2">true</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'permalink_epmask'</span> <span class="sy0">=&gt;</span> EP_PERMALINK<br />
&nbsp; &nbsp; <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; register_post_type<span class="br0">&#40;</span> <span class="st_h">'testimonials'</span><span class="sy0">,</span> <span class="re0">$args</span> <span class="br0">&#41;</span>;<br />
<br />
&nbsp; &nbsp; register_taxonomy<span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'testimonials'</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'testimonials'</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">array</span> <span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'hierarchical'</span> <span class="sy0">=&gt;</span> <span class="kw2">false</span><span class="sy0">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'labels'</span> <span class="sy0">=&gt;</span> <span class="kw3">array</span><span class="br0">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'name'</span> <span class="sy0">=&gt;</span> __<span class="br0">&#40;</span><span class="st_h">'Testimonials category'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st_h">'singular_name'</span> <span class="sy0">=&gt;</span> __<span class="br0">&#40;</span><span class="st_h">'Testimonials category'</span><span class="br0">&#41;</span><span class="sy0">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#41;</span><br />
&nbsp; &nbsp; <span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>get_option<span class="br0">&#40;</span><span class="st_h">'testimonials'</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; flush_rewrite_rules<span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; update_option<span class="br0">&#40;</span><span class="st_h">'testimonials'</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>You can place this registration in theme <em>functions.php</em> or in plugin activation hook and/or in settings update. Just keep related things together.</p>
<p><a href="http://lh4.ggpht.com/-YZbKWVwAVzY/Tl9MKBwYmtI/AAAAAAAAAos/UeVFW1eE6kM/admin%252520menu.png" title="Admin submenu for testimonials" class="highslide" onclick="return hs.expand(this)"><img src="http://lh4.ggpht.com/-YZbKWVwAVzY/Tl9MKBwYmtI/AAAAAAAAAos/UeVFW1eE6kM/s150/admin%252520menu.png" alt="admin menu.png" title="Admin submenu for testimonials" class="alignleft" style="margin:10px;" width="150" /></a> By this code we will receive admin submenu for testimonials with default list and ability to change content and title ( managed by <em>supports</em> field in registration ),  use separated tags named &#8216;Testimonials category&#8217; and request template for single custom post or list by url prefix <em>http://example.org/testimonials/</em> ( list enabled by <em>has_archive</em>, prefix is type name by default, but you can change it by <em>&#8216;rewrite&#8217; => array( &#8216;slug&#8217; => &#8216;some&#8217; )</em> in registration )</p>
<p>New testimonials will not displayed in the normal posts query, but templates can be reused or separated by slug suffix ( eg list will use <em>archive-testimonials.php</em> )</p>
<p>You can query custom posts in template or widget by <a href="http://codex.wordpress.org/Function_Reference/get_posts" title="get_post description in Codex">get_posts()</a></p>
          
<div class="codebox">
    <div class="the_code" style="" id="p99419">
        <div class="code php" id="p994code19">
<span class="re0">$loop</span> <span class="sy0">=</span> get_posts<span class="br0">&#40;</span> <span class="kw3">array</span><span class="br0">&#40;</span> <span class="st_h">'post_type'</span> <span class="sy0">=&gt;</span> <span class="st_h">'testimonials'</span><span class="sy0">,</span> <span class="st_h">'posts_per_page'</span> <span class="sy0">=&gt;</span> <span class="nu0">1</span> <span class="sy0">,</span> <span class="st_h">'orderby'</span> <span class="sy0">=&gt;</span> <span class="st_h">'rand'</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">foreach</span><span class="br0">&#40;</span> <span class="re0">$loop</span> <span class="kw1">as</span> <span class="re0">$post</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; setup_postdata<span class="br0">&#40;</span><span class="re0">$post</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; get_template_part<span class="br0">&#40;</span> <span class="st_h">'content'</span><span class="sy0">,</span> <span class="st_h">'testimonial'</span> <span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>There get 1 random testimonial to show on home page.</p>
<p>Above we use only standard title and content of the post, but usually we need more properties to describe object </p>
<h2> Meta values for posts </h2>
<p>WordPress has meta values for post. You can set any values by <em>update_post_meta()</em> and read by <em>get_post_meta()</em>, but before you have to add input values in the user or admin form.</p>
<p>User form if under template control and you have to add code into template. Admin form for post of course has hook to insert, but more useful <em>add_meta_box()</em> function where you can &#8216;meta box&#8217; into standard post form:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p99420">
        <div class="code php" id="p994code20">
add_action<span class="br0">&#40;</span><span class="st_h">'admin_menu'</span><span class="sy0">,</span> <span class="st_h">'shopping_add_custom_box'</span><span class="br0">&#41;</span>;<br />
<span class="kw2">function</span> shopping_add_custom_box<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; add_meta_box<span class="br0">&#40;</span><span class="st_h">'shopping_fields'</span><span class="sy0">,</span> __<span class="br0">&#40;</span><span class="st_h">'Additionals for post'</span><span class="br0">&#41;</span><span class="sy0">,</span> <span class="st_h">'shopping_fields'</span><span class="sy0">,</span> <span class="st_h">'testimonials'</span><span class="sy0">,</span> <span class="st_h">'normal'</span><span class="sy0">,</span> <span class="st_h">'high'</span><span class="br0">&#41;</span>;<br />
<span class="br0">&#125;</span><br />
<span class="kw2">function</span> shopping_fields<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw3">global</span> <span class="re0">$pe2_instance</span><span class="sy0">,</span> <span class="re0">$post</span>;<br />
&nbsp; &nbsp; <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;</span>input type<span class="sy0">=</span><span class="st0">&quot;hidden&quot;</span> name<span class="sy0">=</span><span class="st0">&quot;shopping_noncename&quot;</span> id<span class="sy0">=</span><span class="st0">&quot;shopping_noncename&quot;</span> value<span class="sy0">=</span><span class="st0">&quot;&lt;?php echo wp_create_nonce( __FILE__ ); ?/&gt;&quot;</span> <span class="sy0">/&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;</span>div <span class="kw2">class</span><span class="sy0">=</span><span class="st0">&quot;alignleft&quot;</span><span class="sy0">&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;</span>label<span class="sy0">&gt;</span>URL<span class="sy0">&lt;</span>br <span class="sy0">/&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;</span>input type<span class="sy0">=</span><span class="st0">&quot;text&quot;</span> id<span class="sy0">=</span><span class="st0">&quot;shopping_image_url&quot;</span> name<span class="sy0">=</span><span class="st0">&quot;shopping_image_url&quot;</span> value<span class="sy0">=</span><span class="st0">&quot;&lt;?php $image = get_post_meta($post-/&gt;ID, 'shopping_image_url',true); echo $image; ?&gt;&quot;</span> size<span class="sy0">=</span><span class="st0">&quot;45&quot;</span> <span class="sy0">/&gt;&lt;</span>br <span class="sy0">/&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;/</span>label<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;/</span>div<span class="sy0">&gt;</span><br />
&nbsp; &nbsp; <span class="sy0">&lt;</span> ?php<br />
<span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>And in the save hook you can get <em>$_POST[name]</em> and write into meta:
</pre>
          
<div class="codebox">
    <div class="the_code" style="" id="p99421">
        <div class="code php" id="p994code21">
add_action<span class="br0">&#40;</span><span class="st_h">'save_post'</span><span class="sy0">,</span> <span class="st_h">'shopping_fields_save_postdata'</span><span class="br0">&#41;</span>;<br />
<span class="kw2">function</span> shopping_fields_save_postdata<span class="br0">&#40;</span> <span class="re0">$post_id</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> <span class="sy0">!</span>wp_verify_nonce<span class="br0">&#40;</span> <span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'shopping_noncename'</span><span class="br0">&#93;</span><span class="sy0">,</span> <span class="kw2">__FILE__</span> <span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$post_id</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> <span class="kw3">defined</span><span class="br0">&#40;</span><span class="st_h">'DOING_AUTOSAVE'</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> DOING_AUTOSAVE <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$post_id</span>;<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span> <span class="sy0">!</span>current_user_can<span class="br0">&#40;</span> <span class="st_h">'edit_post'</span><span class="sy0">,</span> <span class="re0">$post_id</span> <span class="br0">&#41;</span> <span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> <span class="re0">$post_id</span>;<br />
<br />
&nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="kw3">isset</span><span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'shopping_image_url'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; update_post_meta<span class="br0">&#40;</span><span class="re0">$post_id</span><span class="sy0">,</span> <span class="st_h">'shopping_image_url'</span><span class="sy0">,</span> esc_attr<span class="br0">&#40;</span><span class="re0">$_POST</span><span class="br0">&#91;</span><span class="st_h">'shopping_image_url'</span><span class="br0">&#93;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="br0">&#125;</span><br />
<span class="br0">&#125;</span>
        </div>
    </div>
</div>

<p>Take care about nonce field, avoid autosave and check the field name in the <em>$_POST</em>, because save from posts quick edit form and other can miss the field.</p>
<p>Template for the custom post can use meta values and show them or use for behavior modification. Additionally you can use meta values for sort or filter custom posts in the <em>get_posts()</em>:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p99422">
        <div class="code php" id="p994code22">
<span class="re0">$loop</span> <span class="sy0">=</span> get_posts<span class="br0">&#40;</span> <span class="kw3">array</span><span class="br0">&#40;</span> <span class="st_h">'post_type'</span> <span class="sy0">=&gt;</span> <span class="st_h">'testimonials'</span><span class="sy0">,</span> <span class="st_h">'nopaging'</span> <span class="sy0">=&gt;</span> <span class="kw2">true</span><span class="sy0">,</span> <span class="st_h">'meta_key'</span> <span class="sy0">=&gt;</span> <span class="st_h">'shopping_image_url'</span><span class="sy0">,</span> <span class="st_h">'orderby'</span> <span class="sy0">=&gt;</span> <span class="st_h">'meta_value'</span><span class="sy0">,</span> <span class="st_h">'order'</span> <span class="sy0">=&gt;</span> <span class="st_h">'ASC'</span> <span class="br0">&#41;</span><span class="br0">&#41;</span>;
        </div>
    </div>
</div>

<p>WordPress has big ability to tuning the custom posts - add sortable fields in the posts list, show fields in the admin edit form, use compound meta query in custom posts selection and more and more ... I'll show some useful cases in the next posts.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/wordpress/introduction-to-custom-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New plugin for optimize styles and scripts</title>
		<link>http://wott.info/wordpress/new-plugin-for-optimize-styles-and-scripts/</link>
		<comments>http://wott.info/wordpress/new-plugin-for-optimize-styles-and-scripts/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 23:30:26 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[Plugins]]></category>

		<guid isPermaLink="false">http://wott.info/?p=944</guid>
		<description><![CDATA[Hurrah ! Definitely, I find the way how to make required optimization for my site in simple and beautiful way. Some time ago I wrote about good optimization, but changes in core kill the idea. I was thinking about plugin to make required things: collect styles/scripts and concatenate them into solid files minify styles translate [...]]]></description>
			<content:encoded><![CDATA[<p>Hurrah !<br />
<img src="http://lh6.ggpht.com/-Mx6aCTcIZao/Tjc5lwLrK6I/AAAAAAAAAmk/fJh3fDWC7Sk/s150-c/speed-racing-bike-concept.jpg" alt="speed-racing-bike-concept.jpg" title="speed-racing-bike-concept.jpg" class="alignright" style="margin:10px;" width="150" height="150" /></p>
<p>Definitely, I find the way how to make required optimization for my site in simple and beautiful way.</p>
<p>Some time ago I wrote about <a href="http://wott.info/wordpress/wordpress-page-load-optimization/">good optimization</a>, but changes in core kill the idea. I was thinking about plugin to make required things:</p>
<ul>
<li>collect styles/scripts and concatenate them into solid files</li>
<li>minify styles</li>
<li>translate images to data:uri if possible</li>
</ul>
<p>Yes, this is not a big deal, but I want to have all of this with more ability<span id="more-944"></span></p>
<h2>Use dynamic path as version info instead of parameters</h2>
<p>This page links styles by uri</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p94424">
        <div class="code html" id="p944code24">
http://wott.info/styles/17ea6fc138d8207dc87dcb419cd5ebec/style.css
        </div>
    </div>
</div>

<p>Are you see &#8217;17ea6fc138d8207dc87dcb419cd5ebec&#8217; in the path ? This is the key. All information about style files and conditions ( to convert images to data:uri or not ) keeps in plugin options by this key. The result styles composed from several files, minified and provided to the user with length and content type.</p>
<p>Of course this task need some time. But I fully control cache parameters in response and can ask browser to keep file forever, because any changes will drive to change the key.</p>
<p>But this is not enough to make me happy. Any other user can load my server with build styles and script again. To prevent this wasted workload I ask wp-super-cache to keep results.</p>
<h2> WP-Super-Cache integration </h2>
<p>This plugin do very important thing for cheap site optimization. Super-Cache used apache rewrites to use file cache instead of run php engine. This feature improve performance more then 10 times. </p>
<p>But before Super-Cache works only for page body. Now it&#8217;s used for styles and scripts. By this step I mostly remove server CPU loading. And only the network speed and size can be an issue.</p>
<p>At the end I make the plugin for all requirements and now it&#8217;s working on my site ! So today I am happy <img src='http://wott.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Here is <a href="http://tools.pingdom.com/fpt/?url=http://wott.info/&#038;id=5293913">pingdom view for my site</a> now.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/wordpress/new-plugin-for-optimize-styles-and-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New version 1.5.2 of Picasa Express plugin for WordPress</title>
		<link>http://wott.info/picasa-express/new-version-1-5-2-of-picasa-express-plugin-for-wordpress/</link>
		<comments>http://wott.info/picasa-express/new-version-1-5-2-of-picasa-express-plugin-for-wordpress/#comments</comments>
		<pubDate>Tue, 05 Jul 2011 17:06:22 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Picasa Express]]></category>
		<category><![CDATA[Picasa]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://wott.info/?p=921</guid>
		<description><![CDATA[I see WordPress 3.2 and thank you for my users I was noticed very quickly about some problem with my plugin in new version. Here is the fixes to work perfectly with WP 3.2. I have to say &#8216;Thank you!&#8217; to all my donators. You are supporting my work and I find that my plugin [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://lh3.ggpht.com/-_SMomNChDMU/ThNC7Qwal2I/AAAAAAAAAls/ypDiBWZT1eQ/wrench.jpeg" alt="wrench here" title="wrench here" class="alignleft" style="margin:10px;" width="117" height="117" /> I see WordPress 3.2 and thank you for my users I was noticed very quickly about some problem with my plugin in new version. Here is the fixes to work perfectly with WP 3.2.</p>
<p>I have to say &#8216;Thank you!&#8217; to all my donators. You are supporting my work and I find that my plugin has some value for people.<br />
For others &#8211; let me know that my plugin is good work and donate me.</p>
<p>And of course, please like my new site in facebook and google plus one</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/picasa-express/new-version-1-5-2-of-picasa-express-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>Site restored after 5 months</title>
		<link>http://wott.info/common/site-restored-after-5-months/</link>
		<comments>http://wott.info/common/site-restored-after-5-months/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 23:48:10 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Common]]></category>

		<guid isPermaLink="false">http://wott.info/?p=913</guid>
		<description><![CDATA[I have trouble with domain wott.net.ru and get another &#8211; wott.info. I make redirection but in year or so old domain will be disappeared &#8211; please fix your bookmarks. The plugin will have new version with some fixes and new links to this site in few days. You can find here new theme &#8211; lalrva, [...]]]></description>
			<content:encoded><![CDATA[<p>I have trouble with domain wott.net.ru and get another &#8211; wott.info. I make redirection but in year or so old domain will be disappeared &#8211; please fix your bookmarks. </p>
<p>The plugin will have new version with some fixes and new links to this site in few days.</p>
<p>You can find here new theme &#8211; lalrva, you can find here new functionality starting from feedback ajax form to feature requests and bug reports soon</p>
<p>All data will be restored here when required functionality will be ready for. I desire to not use some plugins and making necessary functionality by my self. Because some plugins has a lot of errors, another plugins don&#8217;t follow for WordPress rules. In some cases I see very good idea and want to know make this functionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/common/site-restored-after-5-months/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New version 1.5 of Picasa Express plugin for WordPress</title>
		<link>http://wott.info/picasa-express/new-version-1-5-of-picasa-express-plugin-for-wordpress/</link>
		<comments>http://wott.info/picasa-express/new-version-1-5-of-picasa-express-plugin-for-wordpress/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 13:47:36 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Picasa Express]]></category>
		<category><![CDATA[Picasa]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[wpmu]]></category>

		<guid isPermaLink="false">http://wott.info/?p=831</guid>
		<description><![CDATA[New version again! Some new features are added: Save last state If album was opened &#8211; you will see the album images instead if album&#8217;s list.If you change username &#8211; you will find the user&#8217;s albums next time. And so on. I am planning to add &#8220;Recently uploaded&#8221; sections in next release to simplify the [...]]]></description>
			<content:encoded><![CDATA[<p>New version again!<img class="alignleft" style="margin: 10px;" title="Fly was set on my boots // Sun is jumped to sky // No one leave from the cycle // Don't worry about !" src="http://lh4.ggpht.com/_P3-vavBhxe8/TPTuUEFfRrI/AAAAAAAAAiw/El3hIO48kqM/w150/ushu.png" alt="ushu.gif" width="150" /></p>
<p>Some new features are added:</p>
<p><strong>Save last state</strong><br />
If album was opened &#8211; you will see the album images instead if album&#8217;s list.If you change username &#8211; you will find the user&#8217;s albums next time. And so on.</p>
<p><span id="more-831"></span><br />
I am planning to add &#8220;Recently uploaded&#8221; sections in next release to simplify the work with images.</p>
<p>By request added <strong>limitation of big images</strong> feature. Picasa allow to limit by width, height or max dimension &#8211; you can find all this options in the settings.</p>
<p><strong>Revoke private album access</strong> from settings. You can expect the problem with &#8220;domain not registered&#8221; but FAQ contain the workaround for this problem.</p>
<p><strong>Other fixes</strong></p>
<ul>
<li>Thanks to <a href="http://www.streetdaddy.com/">streetdaddy</a> the problem with token receiving was solved. </li>
<li>Add the username test in the settings</li>
<li>Increase the timer for connect to 30 seconds. Looks some hosting has problem with DNS</li>
<li>In case of issue you can find the true error message in setting or dialog</li>
<li>fix parentheses in title &#8211; for <a href="http://worldtravelhd.com/">Dylan</a></li>
</ul>
<p>I am planing to add in next release the followed</p>
<ul>
<li>Selection enhancement &#8211; click modificators and other keys </li>
<li>Recent uploaded images</li>
</ul>
<p>And may be more if I find time</p>
<ul>
<li>Image search</li>
<li>Some widgets</li>
<li>Upload to Picasa from dialog</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/picasa-express/new-version-1-5-of-picasa-express-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Nginx for dummies</title>
		<link>http://wott.info/wordpress/nginx-for-dummies/</link>
		<comments>http://wott.info/wordpress/nginx-for-dummies/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 11:15:51 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[reverse proxy]]></category>
		<category><![CDATA[rhel]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://wott.info/?p=776</guid>
		<description><![CDATA[I was installing nginx as reverse proxy again. And find that some crib note will be nice. Install In theory you have to request the package which resolve all dependencies. But I found that EPEL has nginx version 0.6.39 and I go to make nginx from sources. First download the latest version from http://sysoev.ru/ wget [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://lh5.ggpht.com/_P3-vavBhxe8/TOpRvnT0aiI/AAAAAAAAAiY/W8M92hWXHr0/w150/776px-Nginx-battleship.svg.png" alt="776px-Nginx-battleship.svg.png" title="776px-Nginx-battleship.svg.png" class="alignright" style="margin:10px;" width="150" /><br />
I was installing nginx as reverse proxy again. And find that some crib note will be nice.</p>
<h3>Install</h3>
<p>In theory you have to request the package which resolve all dependencies. But I found that EPEL has nginx version 0.6.39 and I go to make nginx from sources.<br />
<span id="more-776"></span><br />
First download the latest version from http://sysoev.ru/</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77646">
        <div class="code bash" id="p776code46">
<span class="kw2">wget</span> http:<span class="sy0">//</span>sysoev.ru<span class="sy0">/</span>nginx<span class="sy0">/</span>nginx-0.8.53.tar.gz<br />
<span class="kw2">tar</span> zxf nginx-0.8.53.tar.gz<br />
<span class="kw3">cd</span> nginx-0.8.53
        </div>
    </div>
</div>

<p>Then run <em>./configure</em> and look for misses.<br />
I need pcre and md5. So I was downloaded them ( md5 in openssl )</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77647">
        <div class="code bash" id="p776code47">
<span class="kw2">sudo</span> yum <span class="kw2">install</span> pcre-devel.x86_64<br />
<span class="kw2">sudo</span> yum <span class="kw2">install</span> openssl-devel.x86_64
        </div>
    </div>
</div>

<p>then configuring again with all paths, compiling and install</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77648">
        <div class="code bash" id="p776code48">
<span class="kw2">make</span> clean<br />
.<span class="sy0">/</span>configure \<br />
&nbsp; --<span class="re2">prefix</span>=<span class="sy0">/</span>usr \<br />
&nbsp; --conf-<span class="re2">path</span>=<span class="sy0">/</span>etc<span class="sy0">/</span>nginx<span class="sy0">/</span>nginx.conf \<br />
&nbsp; --http-log-<span class="re2">path</span>=<span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>nginx<span class="sy0">/</span>access.log \<br />
&nbsp; --error-log-<span class="re2">path</span>=<span class="sy0">/</span>var<span class="sy0">/</span>log<span class="sy0">/</span>nginx<span class="sy0">/</span>error.log \<br />
&nbsp; --pid-<span class="re2">path</span>=<span class="sy0">/</span>var<span class="sy0">/</span>run<span class="sy0">/</span>nginx<span class="sy0">/</span>nginx.pid &nbsp;\<br />
&nbsp; --lock-<span class="re2">path</span>=<span class="sy0">/</span>var<span class="sy0">/</span>lock<span class="sy0">/</span>nginx.lock \<br />
&nbsp; --http-client-body-temp-<span class="re2">path</span>=<span class="sy0">/</span>var<span class="sy0">/</span>tmp<span class="sy0">/</span>nginx<span class="sy0">/</span>client<span class="sy0">/</span> \<br />
&nbsp; --http-proxy-temp-<span class="re2">path</span>=<span class="sy0">/</span>var<span class="sy0">/</span>tmp<span class="sy0">/</span>nginx<span class="sy0">/</span>proxy<span class="sy0">/</span> \<br />
&nbsp; --<span class="re2">user</span>=nginx \<br />
&nbsp; --<span class="re2">group</span>=nginx \<br />
&nbsp; <span class="re5">--with-sha1-asm</span> \<br />
&nbsp; --with-<span class="re2">sha1</span>=<span class="sy0">/</span>usr<span class="sy0">/</span>include \<br />
&nbsp; --without-http_fastcgi_module \<br />
&nbsp; --without-http_geo_module \<br />
&nbsp; --without-http_autoindex_module \<br />
&nbsp; --without-http_memcached_module \<br />
&nbsp; --without-http_ssi_module \<br />
&nbsp; --without-http_upstream_ip_hash_module \<br />
&nbsp; --with-http_sub_module \<br />
&nbsp; --with-http_ssl_module \<br />
&nbsp; --with-http_gzip_static_module \<br />
&nbsp; --with-http_stub_status_module<br />
<span class="kw2">make</span> <br />
<span class="kw2">sudo</span> <span class="kw2">make</span> <span class="kw2">install</span>
        </div>
    </div>
</div>

<p>I have RHEL so paths specific for RHEL. Other variants you can find in <a href="http://wiki.nginx.org/NginxInstallOptions">wiki</a>. I remove non-required fastcgi, geo, memcached и ssi. I don&#8217;t plan to balance loading and making indexes, so upstream_ip_hash and autoindex removed, ssl added just in case, stub_status for nice graphs on serverdensity.com, and gzip_static checking gzip placed near &#8211; so we can make precache. Sub allow to add or remove something quickly. The rest is standard. </p>
<p>Some compile warnings for depricated function we are ignoring <img src='http://wott.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Because install is not adding user &#8211; make it manually</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77649">
        <div class="code bash" id="p776code49">
<span class="kw2">sudo</span> useradd <span class="re5">-M</span> <span class="re5">-r</span> <span class="re5">-d</span> <span class="sy0">/</span>var<span class="sy0">/</span>www <span class="re5">-s</span> <span class="sy0">/</span>sbin<span class="sy0">/</span>nologin <span class="re5">-c</span> <span class="st0">'Nginx unprivileged user'</span> nginx
        </div>
    </div>
</div>

<p>group will auto add</p>
<h3>Configuring proxy-pass for Apache</h3>
<p>( in case of WordPress ) </p>
<p>In default configuration we have to change</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77650">
        <div class="code apache" id="p776code50">
worker_processes &nbsp;<span class="nu0">3</span>;
        </div>
    </div>
</div>

<p>by available cores</p>
<p>define log format:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77651">
        <div class="code apache" id="p776code51">
&nbsp; &nbsp; log_format &nbsp;main &nbsp;<span class="st0">'$remote_addr - $remote_user [$time_local] &quot;$request&quot; '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">'$status $body_bytes_sent &quot;$http_referer&quot; '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">'&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot; &quot;$gzip_ratio&quot;'</span>;
        </div>
    </div>
</div>

<p>In the end &#8211; the gzip ratio for analysis</p>
<p>adding gzip and define cache place with 100MB size</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77652">
        <div class="code apache" id="p776code52">
&nbsp; &nbsp; proxy_cache_path &nbsp;/var/tmp/nginx/proxy/one &nbsp;levels=<span class="nu0">1</span>:<span class="nu0">2</span> &nbsp; keys_zone=one:100m;<br />
<br />
&nbsp; &nbsp; gzip &nbsp;<span class="kw2">on</span>;<br />
&nbsp; &nbsp; gzip_http_version <span class="nu0">1.1</span>;<br />
&nbsp; &nbsp; gzip_comp_level <span class="nu0">5</span>;<br />
&nbsp; &nbsp; gzip_types &nbsp;text/plain text/css<br />
&nbsp; &nbsp; &nbsp; &nbsp; application/x-javascript text/xml<br />
&nbsp; &nbsp; &nbsp; &nbsp; application/xml application/xml+rss<br />
&nbsp; &nbsp; &nbsp; &nbsp; text/javascript;
        </div>
    </div>
</div>

<p>Define default server &#8211; rewrite any unknown to main server</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77653">
        <div class="code apache" id="p776code53">
&nbsp; &nbsp; server {<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">listen</span> <span class="nu0">80</span> default_server;<br />
&nbsp; &nbsp; &nbsp; &nbsp; server_name _;<br />
&nbsp; &nbsp; &nbsp; &nbsp; rewrite &nbsp;^&nbsp; http://www.<span class="kw1">example</span>.com$request_uri?;<br />
&nbsp; &nbsp; }
        </div>
    </div>
</div>

<p>Main server</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77654">
        <div class="code apache" id="p776code54">
&nbsp; &nbsp; server {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">listen</span> <span class="nu0">80</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;server_name <span class="kw1">example</span>.com www.<span class="kw1">example</span>.com;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;root /www/main;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;access_log &nbsp;/var/log/nginx/main.access.log &nbsp;main;
        </div>
    </div>
</div>

<p>Errors returned from static file for hide any private info.</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77655">
        <div class="code apache" id="p776code55">
&nbsp; &nbsp; &nbsp; &nbsp; error_page &nbsp;<span class="nu0">404</span> <span class="nu0">500</span> <span class="nu0">501</span> <span class="nu0">502</span> <span class="nu0">504</span> /error.html;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">location</span> = /error.html {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; internal;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }
        </div>
    </div>
</div>

<p>Adding status url</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77656">
        <div class="code apache" id="p776code56">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">location</span> = /nginx_status {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;stub_status <span class="kw2">on</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;access_log <span class="kw2">off</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">allow</span> 127.0.0.1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">deny</span> <span class="kw1">all</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
        </div>
    </div>
</div>

<p>Maintenance page with 503 status code to avoid indexing the page</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77657">
        <div class="code apache" id="p776code57">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;error_page <span class="nu0">503</span> /maintenance.html;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">location</span> /maintenance.html {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="co1">#pass</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
        </div>
    </div>
</div>

<p>and define the main location with proxying to backend</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77658">
        <div class="code apache" id="p776code58">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">location</span> / {<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (-f $document_root/maintenance.html) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return <span class="nu0">503</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_intercept_errors &nbsp; &nbsp; <span class="kw2">on</span>;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_cache &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;one;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_cache_key &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_cache_valid &nbsp; &nbsp; &nbsp;<span class="nu0">200</span> <span class="nu0">301</span> <span class="nu0">302</span> <span class="nu0">304</span> 1h;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header Host $host; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header X-Real-IP $remote_addr; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_pass http://127.0.0.1:<span class="nu0">8080</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
        </div>
    </div>
</div>

<p>Take attention for <em>proxy_intercept_errors</em> &#8211; all errors from backend rewrote but keep status unchanged.</p>
<p>Key for cache is very important. $host and $request_uri is required. $request_method protect GET from HEAD requests. $http_if_modified_since and $http_if_none_match protect normal answers with 200 status from empty 304 &#8216;unchanged&#8217; response.</p>
<p>Static files nginx should find them-self. WP add version as parameter for browser cache update, so adding the version to regexp.</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77659">
        <div class="code apache" id="p776code59">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">location</span> ~* ^.+\.(jpg|jpeg|gif|css|png|js|ico|xml|swf)(\?.*)?$ &nbsp;{<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;expires max;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
        </div>
    </div>
</div>

<p>To prevent apache config downloading </p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77660">
        <div class="code apache" id="p776code60">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">location</span> ~ /\.ht {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">deny</span> &nbsp;<span class="kw1">all</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}
        </div>
    </div>
</div>

<p>Here <a href='http://wott.info/wp-content/uploads/nginx.conf_.sample'>you can download full sample of nginx.conf</a>. You can also will find the development server with backend errors.</p>
<p>Here <a href='http://wott.info/wp-content/uploads/nginx'>you can find standard script for manage nginx</a>. I was take the script from some site ages ago probably from library.linode.com &#8230;</p>
<p>In Apache config you have to change port to 8080 &#8211; just in example <img src='http://wott.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77661">
        <div class="code bash" id="p776code61">
<span class="kw2">sudo</span> <span class="kw2">sed</span> <span class="re5">-i</span> s<span class="sy0">/</span><span class="nu0">80</span><span class="sy0">/</span><span class="nu0">8080</span><span class="sy0">/</span> <span class="sy0">/</span>etc<span class="sy0">/</span>httpd<span class="sy0">/</span>conf<span class="sy0">/</span>httpd.conf
        </div>
    </div>
</div>

<h3>Run and check</h3>
<p>So we can add nginx to system startup and start</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77662">
        <div class="code bash" id="p776code62">
<span class="kw2">sudo</span> <span class="kw2">chmod</span> +x <span class="sy0">/</span>etc<span class="sy0">/</span>rc.d<span class="sy0">/</span>init.d<span class="sy0">/</span>nginx<br />
<span class="kw2">sudo</span> <span class="sy0">/</span>sbin<span class="sy0">/</span>chkconfig <span class="re5">--add</span> nginx<br />
<span class="kw2">sudo</span> <span class="sy0">/</span>sbin<span class="sy0">/</span>chkconfig <span class="re5">--level</span> <span class="nu0">35</span> nginx on<br />
<span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>httpd stop<br />
<span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>nginx start<br />
<span class="kw2">sudo</span> <span class="sy0">/</span>etc<span class="sy0">/</span>init.d<span class="sy0">/</span>httpd start
        </div>
    </div>
</div>

<p>Usually on working server I start nginx first on 8080 to check the interworking &#8211; every time some plugins do something wrong.</p>
<p>Check list:</p>
<ul>
<li>normal page. You can put phpinfo for avoid any WP features</li>
<li>errors like 404 and 500 ( trigger_error )</li>
<li>/maintenance.html</li>
<li>page with no-cache eg /wp-login.php, authorizing and comments </li>
<li>ajax &#8211; can be cached or not</li>
<li>plugins</li>
<li>static files &#8211; check extentions</li>
</ul>
<p>WordPress is good CMS in term of caching management. Every private page has no-cache in the headers &#8211; in login, admin or comments pages. Additionally every logged user receive no-cache every time &#8211; take attention for this when you are checking the proxy cache and use private tabs in your browser to avoid authorizing cookies.</p>
<p>Additionally you have to note about ajax requests. If private &#8211; it should contain no-cache ( WP has function <em>nocache_headers()</em> ). Otherwise you have to take attention on caching key &#8211; because body is not included into key you have to put something in the request url like <em>ajax.php?cache_key=val1,val2,val3</em>. Better to add some hash function, but just values is acceptable. Note that different requests will have different request url and vise versa.</p>
<p>But not all is perfect. For example comments cached and will not updated immediately after new comment come in. But in general this configuration is ok and system became faster. </p>
<h3>Additional</h3>
<p>take a look into cached pages</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77663">
        <div class="code bash" id="p776code63">
<span class="kw2">sudo</span> <span class="kw2">grep</span> <span class="re5">-har</span> <span class="st0">'KEY:'</span> <span class="sy0">/</span>var<span class="sy0">/</span>tmp<span class="sy0">/</span>nginx<span class="sy0">/</span>proxy<span class="sy0">/</span>one
        </div>
    </div>
</div>

<p>Check if cookies cached</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77664">
        <div class="code bash" id="p776code64">
<span class="kw2">sudo</span> <span class="kw2">grep</span> <span class="re5">-hari</span> <span class="st0">'cookie'</span> <span class="sy0">/</span>var<span class="sy0">/</span>tmp<span class="sy0">/</span>nginx<span class="sy0">/</span>proxy<span class="sy0">/</span>one
        </div>
    </div>
</div>

<p>PS. Please, do not forget to remove any cached plugins like WP Super Cache. And you have to use system cron to run WP cron jobs:<br />
in <em>wp-config.php</em> place the const</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77665">
        <div class="code php" id="p776code65">
<ol class="php php" style="font-family:monospace;" start="83"><li class="li1"><div class="de1"><span class="kw3">define</span><span class="br0">&#40;</span><span class="st_h">'DISABLE_WP_CRON'</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span>;</div></li>
</ol>
        </div>
    </div>
</div>

<p>In crontab write something like ( for every site if WPMU )</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p77666">
        <div class="code bash" id="p776code66">
<span class="sy0">*/</span><span class="nu0">5</span> <span class="sy0">*</span> <span class="sy0">*</span> <span class="sy0">*</span> <span class="sy0">*</span> <span class="kw2">nice</span> <span class="re5">-20</span> <span class="kw2">wget</span> <span class="re5">-O</span> <span class="sy0">/</span>tmp<span class="sy0">/</span>wp-cron.log <span class="re5">-o</span> <span class="sy0">/</span>dev<span class="sy0">/</span>null http:<span class="sy0">//</span>example.com:<span class="nu0">8080</span><span class="sy0">/</span>wp-cron.php?doing_wp_cron
        </div>
    </div>
</div>

<p>Here we run every 5 minutes WP dispatch, writing logs into /tmp/wp-cron.log and ignoring the rest. <em>Nice</em> for decrease the priority.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/wordpress/nginx-for-dummies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP simple deobfuscation</title>
		<link>http://wott.info/coding/php-simple-deobfuscation/</link>
		<comments>http://wott.info/coding/php-simple-deobfuscation/#comments</comments>
		<pubDate>Sun, 14 Nov 2010 17:54:09 +0000</pubDate>
		<dc:creator>Wott</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[crypted]]></category>
		<category><![CDATA[obfuscation]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://wott.info/?p=751</guid>
		<description><![CDATA[I don&#8217;t like obfuscation. Because it is unprofessional &#8211; source can be simply opened, but server loaded and any troubleshooting and changes will be a problem Because all obfuscated scripts which I ever meet is hodgie code. I don&#8217;t like stink people Because most code under obfuscation has some validation on external sites, which is [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t like obfuscation.</p>
<p>Because it is unprofessional &#8211; source can be simply opened, but server loaded and any troubleshooting and changes will be a problem</p>
<p>Because all obfuscated scripts which I ever meet is hodgie code. I don&#8217;t like stink people <img src='http://wott.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Because most code under obfuscation has some validation on external sites, which is increase the response time.<br />
<span id="more-751"></span><br />
So there is simple deobfuscator:</p>
          
<div class="codebox">
    <div class="the_code" style="" id="p75168">
        <div class="code php" id="p751code68">
<ol class="php php" style="font-family:monospace;"><li class="li1"><div class="de1"><span class="kw2">&lt;?php</span></div></li>
<li class="li1"><div class="de1"><span class="re0">$s</span> <span class="sy0">=</span> <span class="st0">&quot;eval(...);&quot;</span>;</div></li>
<li class="li1"><div class="de1"><span class="kw1">while</span><span class="br0">&#40;</span><span class="kw3">strpos</span><span class="br0">&#40;</span><span class="re0">$s</span><span class="sy0">,</span> <span class="st_h">'eval'</span><span class="br0">&#41;</span><span class="sy0">===</span><span class="nu19">0</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; <span class="re0">$s</span> <span class="sy0">=</span> <span class="kw3">substr_replace</span><span class="br0">&#40;</span><span class="re0">$s</span><span class="sy0">,</span> <span class="st_h">'print'</span><span class="sy0">,</span> <span class="nu19">0</span><span class="sy0">,</span> <span class="nu0">4</span><span class="br0">&#41;</span>;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; <span class="kw3">ob_start</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; <span class="kw3">eval</span><span class="br0">&#40;</span><span class="re0">$s</span><span class="br0">&#41;</span>;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; <span class="re0">$s</span> <span class="sy0">=</span> <span class="kw3">ob_get_contents</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div></li>
<li class="li1"><div class="de1">&nbsp; &nbsp; <span class="kw3">ob_end_clean</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div></li>
<li class="li1"><div class="de1"><span class="br0">&#125;</span></div></li>
<li class="li1"><div class="de1"><span class="kw3">print</span><span class="br0">&#40;</span><span class="re0">$s</span><span class="br0">&#41;</span>;</div></li>
<li class="li1"><div class="de1"><span class="kw2">?&gt;</span></div></li>
</ol>
        </div>
    </div>
</div>

<p>If you find in the code eval function  with some encrypting inside &#8211; just copy eval and all content into $s variable in the script above and run. The script print the original code.</p>
<p>If you need more help with deobfuscation &#8211; you are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://wott.info/coding/php-simple-deobfuscation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.646 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-05-24 06:28:23 -->
