<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Bakawan Web Design</title>
	
	<link>http://www.bakawan.com/log</link>
	<description>i'm sorry we forgot easily</description>
	<lastBuildDate>Tue, 16 Mar 2010 13:01:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/bakawan/wkTg" /><feedburner:info uri="bakawan/wktg" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-nd/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId>bakawan/wkTg</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Howto Show Parent Category only in WP Dashboard Panel</title>
		<link>http://feedproxy.google.com/~r/bakawan/wkTg/~3/kVOTlGneN0Q/</link>
		<comments>http://www.bakawan.com/log/howto-show-parent-category-only-in-wp-dashboard-panel/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 12:51:35 +0000</pubDate>
		<dc:creator>uwiuw</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.bakawan.com/log/?p=2826</guid>
		<description><![CDATA[I have able to find a way to mass delete category. But unfortunately i haven&#8217;t able to do it directly. I have to make delete process into two separated way. First i delete the category then forcefully move all it post into default category where the cron job i have set before will delete them [...]]]></description>
			<content:encoded><![CDATA[<p>I have able to find a way to <a href="http://www.bakawan.com/log/confused-by-wordpress-category/">mass delete category</a>. But unfortunately i haven&#8217;t able to do it directly. I have to make delete process into two separated way. First i delete the category then forcefully move all it post into default category where the cron job i have set before will delete them eventually.</p>
<p>By the way, I manage to make the client satisfied with other category-related custom.  I make category panel in dashboard only show parent directory as he request it. So, this will make the panel only show category that he want it. I don&#8217;t know why he need something like this. But <em>see no evil hear no evil, your wish is my command</em>. i do it anyway.</p>
<p>bytheway, anybody who need this, shall put above code in <strong>functions.php</strong></p>
<pre>
add_action('get_terms', 'bk_show_cat_parent_only'); 

function bk_show_cat_parent_only($cat) {
	if (is_admin()) {
		$hasil = array();		

		$default_cat = get_option('default_category');

		foreach ($cat as $cat_object) {
		    if (($cat_object->parent) == 0 &#038;&#038; ($cat_object->term_id) != $default_cat )
			 $hasil = array_merge ($hasil, array ($cat_object));
			 // FIXME : Count the object --> add filter to
			 // 'edit_categories_per_page'
			 // as much as count
 		}

		return $hasil;
	} else {
		return $cat;
	}
}
</pre>
<img src="http://feeds.feedburner.com/~r/bakawan/wkTg/~4/kVOTlGneN0Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.bakawan.com/log/howto-show-parent-category-only-in-wp-dashboard-panel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.bakawan.com/log/howto-show-parent-category-only-in-wp-dashboard-panel/</feedburner:origLink></item>
		<item>
		<title>After Reading : WP Coder have no Class</title>
		<link>http://feedproxy.google.com/~r/bakawan/wkTg/~3/Zbn6AHNd4Ic/</link>
		<comments>http://www.bakawan.com/log/after-reading-wp-coder-have-no-class/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 18:14:46 +0000</pubDate>
		<dc:creator>uwiuw</dc:creator>
				<category><![CDATA[Diary]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.bakawan.com/log/?p=2813</guid>
		<description><![CDATA[I just read Wordpress Coders have no class and in contrary with the provocative title, this article give deep astonishing how wordpress community and way of code is so different with the rest of PHP community. What i meant is&#8230;ah just read this if you read mine.
This article describe how wp coder has culture not [...]]]></description>
			<content:encoded><![CDATA[<p>I just read <a href="http://www.arickmann.co.uk/wordpress-coders-have-no-class/">Wordpress Coders have no class</a> and in contrary with the provocative title, this article give deep astonishing how wordpress community and way of code is so different with the rest of PHP community. What i meant is&#8230;ah just read this if you read mine.</p>
<p>This article describe how wp coder has culture not to use OOP (Object Oriented Programming), a way of code that can be describe as the better way of coding. This has been use in java, C++, and PHP 5. But because of, wp still support any installation on server with PHP 4&#8230;. (the rest of this topic i still struggle to comprehend) </p>
<p>Frankly, before reading this article, i got this low esteem as somebody who learn PHP the wrong way. My friend and ex-coworker, call me, <em>Banci</em> aka <em>Karbit</em> coder &#8211; somebody who learn Wordpress first then try to learn advance PHP. So, most of the time, i follow my coding habit : I don&#8217;t encapsulate my functions in class. i don&#8217;t do fancy dancing. I just solve problem. period.</p>
<p>I do custom to solve problem fast and don&#8217;t really consider any redesign, recustom, or refactor. Most of the time, what i do, is bent wordpress and not utilized it or fork it with light-weight PHP framework like Codeigniter or similar CMS.</p>
<p>This <em>lack of future proof on understanding that shit can pour anytime soon</em> mentality covers by my good habit to put detail description on comment section. Every tiny process will be explain. I also always explain about the argument, the return value, and the debug output if available. And, i seperate my custom in several file to localized its feature. </p>
<p>I believe i follow the right way to make my code easy to understand. But still, i don&#8217;t do class. i&#8217;m a karbit. i understand wp more then PHP. (<del datetime="2010-03-01T06:53:14+00:00">Damm you pepa!</del>). If somebody ask me to read a file, i prefer wp class (such as filereader and streamreader),  rather then php built-in function. I&#8217;m a karbit.</p>
<p>Honestly, i like to read otto (<a href="http://ottodestruct.com/">ottodsctruct.com</a>) blog. He&#8217;s one of my wp hero. I learn a lot from reading his plugin. So i got this stupid expression when he said that most of the time OOP in wp plugin is waste of time : </p>
<p><em>The big problem with OOP techniques is that people who have just learned them tend to want to use them everywhere, even where it makes no sense. A WordPress plugin is, generally, a place where it makes absolutely no sense to do so. </em></p>
<p>I know it&#8217;s true. But sometimes it hard to explain this to others. <del datetime="2010-03-01T06:44:37+00:00">Just with pepa, we have a very different style of coding and preference. We do our part the way we like. My part mostly procedural and rarely has class. While Pepa has the opposite. But fuck shit, it work!</del> </p>
<img src="http://feeds.feedburner.com/~r/bakawan/wkTg/~4/Zbn6AHNd4Ic" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.bakawan.com/log/after-reading-wp-coder-have-no-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.bakawan.com/log/after-reading-wp-coder-have-no-class/</feedburner:origLink></item>
		<item>
		<title>Narrow Search on Wordpress Default Output</title>
		<link>http://feedproxy.google.com/~r/bakawan/wkTg/~3/wun3nAUwZ4c/</link>
		<comments>http://www.bakawan.com/log/narrow-search/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 12:54:17 +0000</pubDate>
		<dc:creator>uwiuw</dc:creator>
				<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.bakawan.com/log/?p=2806</guid>
		<description><![CDATA[Right now, i got in the situation where i have to change how the wordpress search behave. I need to support strict search on content. So when i try to find something like Hello world, wordpress doesn&#8217;t output a post with Hello or World. I just want the sanitize output, a far more strict output [...]]]></description>
			<content:encoded><![CDATA[<p>Right now, i got in the situation where i have to change how the wordpress search behave. I need to support strict search on content. So when i try to find something like <strong>Hello world</strong>, wordpress doesn&#8217;t output a post with Hello or World. I just want the sanitize output, a far more strict output in the loop. Nothing more.</p>
<p> So, i create some quick and dirty way to achieve this.</p>
<pre>
add_filter('posts_where', 'bk_query_change_where');  //when wp create sql query use WHERE

/****************************************
<em>	WHAT		: Change the where sql to work as strict search</em>
*****************************************/
function bk_query_change_where($query) {
	global $table_prefix;

	if ($search_query = esc_attr(bk_is_search()))
		if ($total = (int) cek_search_query()) {
			if ($total > 0) {
				$after_query = explode("AND", $query );

				if ($total == 1) {
					$total += 2;
				} elseif ($total > 1){
					$total += 2;
				}

 				for ($i=0; $i < $total; $i++) {
					unset($after_query[$i]);
				}

				//FIXME : You can just search the content or
				// the title or both with strict search ....
				// making the new query euy ....

				$after_query = array_merge(array(
					"AND (" . $table_prefix . "posts.post_content LIKE '%" .
					$search_query . "%')")	,
					$after_query  );

				$after_query = implode(" AND ",  $after_query);
 				return $after_query;
			}
		}

	return $query;
}

/****************************************
<em>	WHAT		: just check whether is it a search via GET
	WHY			: need to do custom search
	FIXME		:
	TODO		: add_action('init', 'bk_is_search');
	RETURN		: The Search Query
	ARGs		: none, just took the global $_POST and $_GET.
	MORE		: In this moment, in init, wp_query has not been initiate.
				 It's still empty
	CATATAN 	: Return value is need sanitation</em>
*****************************************/
function bk_is_search() {
	if (isset($_GET) &#038;&#038; $_GET["s"] != "")  {
		$string = $_GET["s"];
		return $string;
	}
	return false;
}

/****************************************
	WHAT		: Check whether the search use ""
	WHY			: To make the search work differently with wp default.
		This will make 'Strict Search'
		the meaning of strict search is when we need to search a frase
		(has 2 or more words such as 'aulia ashari' <--- look for the the whitespaces).
		It will just search it without make seperate query
	FIXME		:
	TODO		: use it just before the parse_query created (an sql command to send
				to wordpress)
	RETURN		: TRUE if it has whitespace and use ""
	ARGs		: $search_query , $strict_search //search has been change into
	MORE 		: Cek $_GET for any search
		: $search_query (if has "  then it will be slashed).
		For example = "auilia ashari" then it become \"auilia ashari\"
*****************************************/
function cek_search_query($search_query = "") {
	if (empty($search_query))
		if (FALSE == ($search_query = bk_is_search()) ) {
			return FALSE;
		}

	$search_query = trim($search_query);
	if (str_replace(" ", " ", $search_query, $count )) { //bila memiliki white space
  			return $count; //total whitespaces
	}

	return FALSE;
}
</pre>
<p>I think i will create a proper class to wrap all of this. And maybe a plugin. Maybe after the work is done.    </p>
<img src="http://feeds.feedburner.com/~r/bakawan/wkTg/~4/wun3nAUwZ4c" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.bakawan.com/log/narrow-search/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.bakawan.com/log/narrow-search/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.240 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-03-16 20:05:28 -->
