<?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>Redink Design &#187; Open Source</title>
	<atom:link href="http://redinkdesign.net/category/open-source/feed/" rel="self" type="application/rss+xml" />
	<link>http://redinkdesign.net</link>
	<description>Good code is its own best documentation</description>
	<lastBuildDate>Tue, 10 Aug 2010 15:34:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remove (Hide) a SugarCRM Subpanel</title>
		<link>http://redinkdesign.net/open-source/remove-hide-a-sugarcrm-subpanel/</link>
		<comments>http://redinkdesign.net/open-source/remove-hide-a-sugarcrm-subpanel/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 11:11:43 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[You can hide a SubPanel in an upgrade safe way but unsetting the subpanel via PHP. 

Example:

You can hid the Leads SubPanel into Accounts module by customizing the custom/modules/Accounts/Ext/Layoutdefs/layoutdefs.ext.php, which is a upgrade safe customization. Add the following to the end of the file, before the closing PHP tag.

<code>
unset($layout_defs['Accounts']['subpanel_setup']['leads']);
</code]]></description>
			<content:encoded><![CDATA[<p>You can hide a SubPanel in an upgrade safe way but unsetting the subpanel via PHP.</p>
<p>Example:</p>
<p>You can hid the Leads SubPanel into Accounts module by customizing the custom/modules/Accounts/Ext/Layoutdefs/layoutdefs.ext.php, which is a upgrade safe customization. Add the following to the end of the file, before the closing PHP tag.</p>
<pre class="brush: php;">
unset($layout_defs['Accounts']['subpanel_setup']['leads']);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/open-source/remove-hide-a-sugarcrm-subpanel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove SugarCRM Custom Relationship</title>
		<link>http://redinkdesign.net/open-source/remove-sugarcrm-custom-relationship/</link>
		<comments>http://redinkdesign.net/open-source/remove-sugarcrm-custom-relationship/#comments</comments>
		<pubDate>Wed, 17 Feb 2010 11:01:21 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[After searching for a while, I finally found out how to manually delete or remove a sugar crm relationship that was created in studio.  I tested this on Sugar 5.2 Professional and it seems to work just fine. Use at your own risk.

When you create a new relationship through Admin -&#62; Studio -&#62;  -&#62; Relationships, Sugar create several files at custom folders:

Left Side Hand Relationship (module from which you created the relationship):
custom/Extension/modules//Ext/Vardefs/.php
]]></description>
			<content:encoded><![CDATA[<p>After searching for a while, I finally found out how to manually delete or remove a sugar crm relationship that was created in studio.  I tested this on Sugar 5.2 Professional and it seems to work just fine. Use at your own risk.</p>
<p>When you create a new relationship through Admin -&gt; Studio -&gt;  -&gt; Relationships, Sugar create several files at custom folders:<br />
<strong><br />
Left Side Hand Relationship (module from which you created the relationship):</strong><br />
custom/Extension/modules/{moduleName}/Ext/Vardefs/{relationshipName}.php<br />
custom/Extension/modules/{moduleName}/Ext/Layoutdefs/{relationshipName}.php<br />
custom/Extension/modules/{moduleName}/Ext/Language/{relationshipName}.php</p>
<p><strong>Right Side Hand Relationship:</strong><br />
custom/Extension/modules/{moduleName}/Ext/Vardefs/{relationshipName}.php<br />
custom/Extension/modules/{moduleName}/Ext/Language/{relationshipName}.php</p>
<p><strong>Relationship itself:</strong><br />
custom/metadata/{relationshipName}Meta.php</p>
<p><strong>Table Dictionary:</strong><br />
custom/Extension/application/Ext/TableDictionary/{relationshipName}.php</p>
<p><strong>Edit</strong> custom/application/Ext/TableDictionary/tabledictionary.ext.php file and delete include(&#8216;custom/metadata/{relationshipName}.php&#8217;);</p>
<p>To remove the relationship, you need to delete these files. After removing all these files you should need to go to <strong>Admin -&gt; Repair -&gt; Quick Repair and Rebuild</strong></p>
<p>Original post:</p>
<p>http://www.sugarcrm.com/forums/showthread.php?t=37781</p>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/open-source/remove-sugarcrm-custom-relationship/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vBulletin Social Group Icons in Postbit</title>
		<link>http://redinkdesign.net/open-source/vbulletin/vbulletin-social-group-icons-in-postbit/</link>
		<comments>http://redinkdesign.net/open-source/vbulletin/vbulletin-social-group-icons-in-postbit/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 12:54:13 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SugarCRM]]></category>
		<category><![CDATA[vBulletin]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Here's a quick plugin I wrote for vBulletin to display social group icons on the postbit. The social group icon for each public social group the user belongs to will be displayed. Please see attachment.

To install, just import the plugin via the admin panel.

This plugin was only tested on vBulletin 3.8 on http://www.b15u.com. Please use at your own risk]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a quick plugin I wrote for vBulletin to display social group icons on the postbit. The social group icon for each public social group the user belongs to will be displayed. Please see attachment.</p>
<p>To install, just import the plugin via the admin panel.</p>
<p>This plugin was only tested on vBulletin 3.8 on http://www.b15u.com. Please use at your own risk.</p>
<p><a href="http://redinkdesign.net/files/2009/12/redinkdesign-socialgroupicons-plugin.xml">Click here to download the Social Group Icons Plugin</a></p>
<p><a href="http://redinkdesign.net/files/2009/12/icons.jpg"><img class="alignnone size-full wp-image-82" title="icons" src="http://redinkdesign.net/files/2009/12/icons.jpg" alt="" width="108" height="352" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/open-source/vbulletin/vbulletin-social-group-icons-in-postbit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>QuantCast Screen Scraper</title>
		<link>http://redinkdesign.net/programming/php/quantcast-screen-scraper/</link>
		<comments>http://redinkdesign.net/programming/php/quantcast-screen-scraper/#comments</comments>
		<pubDate>Wed, 13 May 2009 15:31:40 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This is a quick and dirty screen scraper for quantcast.com. It currently only grabs the site rank and description.

Usage:
<code>
		$q = new QuantCast('cnet.com');
		echo '<strong>Rank:</strong> ' . $q-&#62;getRank() . '<br />';
		echo '<strong>Desc:</strong> ' . $q-&#62;getDescription() . '<br />';
</code>

Class Source Code:
<code>
	class QuantCast {

		public $siteName;
		private $siteContents;

		public function __construct($siteName){
			$this-&#62;siteName = strtolower(str_replace('http://', '', $siteName));
]]></description>
			<content:encoded><![CDATA[<p>This is a quick and dirty screen scraper for quantcast.com. It currently only grabs the site rank and description.</p>
<p><strong>Updated: 8/10/2010<br />
Rank, Description and US Stats are now working again. Global Stats are no longer available.</strong></p>
<p><strong>Usage:</strong></p>
<pre class="brush: php;">
$q = new QuantCast('cnet.com');
		echo '&lt;strong&gt;Rank:&lt;/strong&gt; ' . $q-&gt;getRank() . '&lt;br /&gt;';
		echo '&lt;strong&gt;Desc:&lt;/strong&gt; ' . $q-&gt;getDescription() . '&lt;br /&gt;';
</pre>
<p><strong><br />
Class Source Code:</strong></p>
<pre class="brush: php;">
class QuantCast {

 public $siteName;
 public $rank = 0;
 public $description = '';
 public $usTraffic = '';

 private $siteContents;

 public function __construct($siteName){

 $this-&gt;siteName = strtolower(str_replace('http://', '', $siteName));
 $url = &quot;http://www.quantcast.com/{$this-&gt;siteName}&quot;;

 $ch = curl_init($url);
 curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
 curl_setopt($ch, CURLOPT_USERAGENT, &quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8 ( .NET CLR 3.5.30729)&quot;);
 $this-&gt;siteContents = curl_exec($ch);
 curl_close($ch);

 $newlines = array(&quot;\t&quot;,&quot;\n&quot;,&quot;\r&quot;,&quot;\x20\x20&quot;,&quot;&#92;&#48;&quot;,&quot;\x0B&quot;);
 $this-&gt;siteContents = str_replace($newlines, &quot;&quot;, html_entity_decode($this-&gt;siteContents));
 }

 public function getRank(){
 $this-&gt;_getRank();
 return $this-&gt;rank;
 }

 public function getDescription(){
 $this-&gt;_getDescription();
 return $this-&gt;description;
 }

 public function getUsStats(){
 $this-&gt;_getUsStats();
 return $this-&gt;usTraffic;
 }

 private function _getRank(){
 $start = strpos($this-&gt;siteContents, '&lt;li&gt;');
 $end = strpos($this-&gt;siteContents, '&lt;/li&gt;', $start);
 $data = substr($this-&gt;siteContents, $start, $end-$start);
 preg_match_all('/\&lt;strong\&gt;([0-9,]*)\&lt;\/strong\&gt;/', $data, $ar_matches);
 $this-&gt;rank = $ar_matches[1][0];
 }

 private function _getDescription(){
 $start = strpos($this-&gt;siteContents, '&lt;div&gt;');
 $end = strpos($this-&gt;siteContents, '&lt;/div&gt;', $start);
 $data = substr($this-&gt;siteContents, $start, $end-$start);
 $this-&gt;description = strip_tags($data);
 }

 private function _getUsStats(){
 $site = explode('.', $this-&gt;siteName);
 $td = '&lt;td id=&quot;reach-wd:' . $site[1] . '.' . $site[0] . '&quot;&gt;';
 $start = strpos($this-&gt;siteContents, $td);
 $end = strpos($this-&gt;siteContents, '&lt;/td&gt;', $start);
 $data = substr($this-&gt;siteContents, $start, $end-$start);
 $data = strip_tags($data);
 $data = str_replace('Est.MonthlyUS People', '', $data);
 $this-&gt;usTraffic = $data;
 }
 }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/programming/php/quantcast-screen-scraper/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP MySQLi Table to Object Class</title>
		<link>http://redinkdesign.net/programming/php/php-mysqli-table-to-object-class/</link>
		<comments>http://redinkdesign.net/programming/php/php-mysqli-table-to-object-class/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 13:00:17 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This class requires PHP 5.2+ and the MySQLi extension. It will not work with the regular MySQL extension.  An object representing a table is created on the fly that will allow you to do inserts, updates etc. 

Please see comments in the code for usage. 

<code>
init('user_table');
	 * 	$user-&#62;get("user_id = 4343");
]]></description>
			<content:encoded><![CDATA[<p>This class requires PHP 5.2+ and the MySQLi extension. It will not work with the regular MySQL extension.  An object representing a table is created on the fly that will allow you to do inserts, updates etc. </p>
<p>Please see comments in the code for usage. </p>
<pre class="brush: php;">
&lt;?php
/**
	All code is Copyright 2009 by Ashwin Surajbali (http://www.redinkdesign.net).

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation.

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

	You can view a copy of the GNU General Public Licsense at

http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

**/

	/**
	 * Create's an object representing a table in a database
	 * This class requires a database handle to be passed in
	 *
	 * @version 1.0
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$user = $db-&gt;init('user_table');
	 * 	$user-&gt;get(&quot;user_id = 4343&quot;);
	 * 	$user-&gt;name = 'BumbleBee';
	 * 	$user-&gt;save();
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$user = $db-&gt;init('user_table');
	 * 	$user-&gt;name = 'BumbleBee';
	 * 	$user-&gt;age = 24;
	 * 	$user-&gt;save();
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$user = $db-&gt;init('user_table');
	 * 	$user-&gt;get(&quot;user_id = 1233&quot;);
	 * 	$user-&gt;name = '
	 * 	$user-&gt;sex = 'F';
	 * 	$user-&gt;update(&quot;sex != 'F' &amp;&amp; user_id = 1233&quot;);
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$user = $db-&gt;init('user_table');
	 * 	$ar_users = $user-&gt;get_data(&quot;first_name = 'john'&quot;);
	 * 	foreach ($ar_users as $user){
	 * 		echo $user-&gt;id;
	 * 	}
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$user = $db-&gt;init('user_table');
	 * 	$ar_all_users = $user-&gt;get_data();
	 * 	foreach ($ar_all_users as $user){
	 * 		echo $user-&gt;age . '&lt;br /&gt;';
	 *	}
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$first_name = $db-&gt;get_query_value(&quot;select first_name from user_table where id = 12333&quot;);
	 *
	 * @example
	 * 	$db = new redDB('host', 'username', 'password', 'database_name');
	 * 	$ar_data = $db-&gt;get_query_data(&quot;select * from user_table where age &gt; 21&quot;);
	 * 	foreach ($ar_data as $data){
	 * 		echo $data-&gt;first_name . '&lt;br /&gt;';
	 * 	}
	 *
	 */

	class redDB {

		private $__db_host;
		private $__db_username;
		private $__db_password;
		private $__db_name;
		private $__db_port;
		private $__db_handle;

		private $__sql;
		private $__table_name;
		private $__primary_key = '';
		private $__result;
		private $__ar_field_types = array(
			0 =&gt; &quot;DECIMAL&quot;,
			1 =&gt; &quot;TINYINT&quot;,
			2 =&gt; &quot;SMALLINT&quot;,
			3 =&gt; &quot;INTEGER&quot;,
			4 =&gt; &quot;FLOAT&quot;,
			5 =&gt; &quot;DOUBLE&quot;,
			7 =&gt; &quot;TIMESTAMP&quot;,
			8 =&gt; &quot;BIGINT&quot;,
			9 =&gt; &quot;MEDIUMINT&quot;,
			10 =&gt; &quot;DATE&quot;,
			11 =&gt; &quot;TIME&quot;,
			12 =&gt; &quot;DATETIME&quot;,
			13 =&gt; &quot;YEAR&quot;,
			14 =&gt; &quot;DATE&quot;,
			16 =&gt; &quot;BIT&quot;,
			246 =&gt; &quot;DECIMAL&quot;,
			247 =&gt; &quot;ENUM&quot;,
			248 =&gt; &quot;SET&quot;,
			249 =&gt; &quot;TINYBLOB&quot;,
			250 =&gt; &quot;MEDIUMBLOB&quot;,
			251 =&gt; &quot;LONGBLOB&quot;,
			252 =&gt; &quot;BLOB&quot;,
			253 =&gt; &quot;VARCHAR&quot;,
			254 =&gt; &quot;CHAR&quot;,
			255 =&gt; &quot;GEOMETRY&quot;
		);

		function __construct($host, $username, $password, $db_name, $port = '3306'){

			$this-&gt;__db_host = $host;
			$this-&gt;__db_username = $username;
			$this-&gt;__db_password = $password;
			$this-&gt;__db_name = $db_name;
			$this-&gt;__db_port = $port;
			$this-&gt;connect();
		}

		/**
		 * Initialize our table object
		 *
		 * @example $this-&gt;init('users_table');
		 *
		 * @param string $table
		 * @return object
		 */
		public function init($table = ''){
			if(empty($table)){
				$this-&gt;throw_error(__METHOD__, __LINE__, 'No table name specified.');
			}

			$this-&gt;__table_name = $table;

			$ar_fields = $this-&gt;get_table_fields();

			if (!is_array($ar_fields)) {
				$this-&gt;throw_error(__METHOD__, __LINE__, &quot;ERROR: Table '{$this-&gt;__table_name}' has no fields.&quot;);
			}

			foreach ($ar_fields as $field){

				switch ($field-&gt;type){
					case &quot;INTEGER&quot;:
					case &quot;TINYINT&quot;:
					case &quot;SMALLINT&quot;:
					case &quot;MEDIUMINT&quot;:
						$this-&gt;{$field-&gt;name} = 0;
						break;
					case &quot;DOUBLE&quot;:
					case &quot;FLOAT&quot;:
					case &quot;DECIMAL&quot;:
						$this-&gt;{$field-&gt;name} = 0.00;
						break;
					case &quot;DATE&quot;:
						$this-&gt;{$field-&gt;name} = '0000-00-00';
						break;
					case &quot;TIME&quot;:
						$this-&gt;{$field-&gt;name} = '00:00:00';
						break;
					case &quot;DATETIME&quot;:
						$this-&gt;{$field-&gt;name} = '0000-00-00 00:00:00';
						break;
					case &quot;YEAR&quot;:
						$this-&gt;{$field-&gt;name} = '0000';
						break;
					default:
						$this-&gt;{$field-&gt;name} = '';
						break;
				}

				if (!empty($field-&gt;def)) {
					$this-&gt;{$field-&gt;name} = $field-&gt;def;
				}

			}

			return $this;
		}

		/**
		 * Alias for @link init
		 *
		 * @param string $table
		 * @return object
		 */
		public function init_table($table){
			return $this-&gt;init($table);
		}

		/**
		 * Returns a single record as a table object depending on
		 * constraint passed in
		 *
		 * @example $this-&gt;get_single_record(&quot;id = 22&quot;);
		 *
		 * @param string $constraint
		 * @return object
		 */
		public function get_single_record($constraint = ''){
			if (empty($this-&gt;__table_name)){
				$this-&gt;throw_error(__METHOD__, __LINE__,  &quot;You must initialize a table before retrieving a record.&quot;);
			}

			if (empty($constraint)){
				$this-&gt;throw_error(__METHOD__, __LINE__,  &quot;No constraint entered.&quot;);
			}

			$this-&gt;__sql = &quot;select * from {$this-&gt;__table_name} where {$constraint} limit 1&quot;;
			return $this-&gt;get_single_result();

		}

		/**
		 * Alias for @link get_single_record
		 *
		 * @param string $constraint
		 * @return object
		 */
		public function get($constraint){
			return $this-&gt;get_single_record($constraint);
		}

		/**
		 * Inserts a new record or updates if it already exists
		 * Use this for quick updates/inserts
		 *
		 * For custom updates, use @link update
		 *
		 * @return boolean
		 */
		public function save(){

			$duplicate_sql = '';
			$this-&gt;__sql = &quot;insert into {$this-&gt;__table_name} values (&quot;;
			foreach ($this as $key =&gt; $val){
				if (substr($key, 0, 2) == '__'){
					continue;
				}
				$this-&gt;__sql .= &quot;'{$this-&gt;escape($val)}'&quot; . ',';
				$duplicate_sql .= &quot;{$key} = '{$this-&gt;escape($val)}'&quot; . ',';
			}
			$this-&gt;__sql = trim($this-&gt;__sql, ',');
			$this-&gt;__sql .= &quot;)&quot;;
			$this-&gt;__sql .= ' on duplicate key update ';
			$this-&gt;__sql .= trim($duplicate_sql, ',');

			return $this-&gt;execute_query($this-&gt;__sql);
		}

		/**
		 * Updates an existing record depending on custom constraints
		 * Use this for complex updates instead of @link save
		 *
		 * @param string $where_constraint
		 * @return boolean
		 */
		public function update($where_constraint = ''){
			if (empty($where_constraint)){
				$this-&gt;throw_error(__METHOD__, __LINE__, 'Missing WHERE constraint. eg. ID = 222');
			}

			$this-&gt;__sql = &quot;update {$this-&gt;__table_name} set &quot;;
			foreach ($this as $key =&gt; $val){
				if (substr($key, 0, 2) == '__'){
					continue;
				}
				$this-&gt;__sql .= &quot;{$key} = '{$this-&gt;escape($val)}'&quot; . ',';
			}
			$this-&gt;__sql = trim($this-&gt;__sql, ',');
			$this-&gt;__sql .= ' ' . $where_constraint;

			return $this-&gt;execute_query($this-&gt;__sql);
		}

		/**
		 * Executes a query
		 *
		 * @param string $query
		 * @return boolean
		 */
		public function execute_query($query){
			$this-&gt;__sql = $query;
			if(!$this-&gt;__db_handle-&gt;query($this-&gt;__sql)){
				$this-&gt;throw_error(__METHOD__, __LINE__);
			}
		}

		/**
		 * Send out a query and return the first field of the first result row
		 * eg. select count(*) as count from blah; only the value of count will be returned
		 *
		 * @param string $query
		 * @return string return value of query
		 */
		public function get_query_value($query){
			if (empty($query)) $this-&gt;throw_error(__METHOD__, __LINE__, 'Query missing.');

			$this-&gt;__sql = $query;
			$this-&gt;__result = $this-&gt;__db_handle-&gt;query($this-&gt;__sql);
			if (!$this-&gt;__result){
				$this-&gt;throw_error(__METHOD__, __LINE__);
			}

			$ar_result = $this-&gt;__result-&gt;fetch_array();
			if (!empty($ar_result[0])){
				return $ar_result[0];
			}else{
				return false;
			}
		}

		/**
		 * Get data from the initialized table depending on constraint, limit and order
		 * Returns results in an array of objects
		 *
		 * @param string $constraint - optional
		 * @param string $limit - optional
		 * @param string $order_by - optional
		 * @return array of objects
		 */
		public function get_data($constraint = '', $limit = '', $order_by = ''){
			if (empty($this-&gt;__table_name)) $this-&gt;throw_error(__METHOD__, __LINE__, 'Table missing.');

			$this-&gt;__sql = &quot;select * from {$this-&gt;__table_name}&quot; . (!empty($constraint)? &quot; where {$constraint}&quot; : '') . (!empty($order_by)? &quot; order by {$this-&gt;escape($order_by)}&quot; : '') . (!empty($limit)? &quot; limit {$this-&gt;escape($limit)}&quot; : '');
			$this-&gt;__result = $this-&gt;__db_handle-&gt;query($this-&gt;__sql);
			if (!$this-&gt;__result){
				$this-&gt;throw_error(__METHOD__, __LINE__);
			}

			$ar_results = array();
			while($obj = $this-&gt;__result-&gt;fetch_object()){
				$ar_results[] = $obj;
			}

			if (is_array($ar_results)){
				return $ar_results;
			}else{
				return false;
			}
		}

		/**
		 * Runs a query and returns results in an array of objects
		 *
		 * @param string $query
		 * @return array
		 */
		public function get_query_data($query){
			if (empty($query)) $this-&gt;throw_error(__METHOD__, __LINE__, &quot;Query missing.&quot;);

			$this-&gt;__sql = $query;
			$this-&gt;__result = $this-&gt;__db_handle-&gt;query($this-&gt;__sql);
			if(!$this-&gt;__result){
				$this-&gt;throw_error(__METHOD__, __LINE__);
			}

			$ar_results = array();
			while ($obj = $this-&gt;__result-&gt;fetch_object()){
				$ar_results[] = $obj;
			}

			if (is_array($ar_results)){
				return $ar_results;
			}else{
				return false;
			}
		}

		/**
		 * Escapes special characters in a string for use in a SQL statement
		 *
		 * @param string $string
		 * @return string
		 */
		public function escape($string){
			return $this-&gt;__db_handle-&gt;real_escape_string($string);
		}

		/**
		 * Alias of function escape
		 *
		 * @param mixed $mixed_var
		 * @return string
		 */
		public function escape_str($mixed_var){
			return $this-&gt;escape($mixed_var);
		}

		/**
		 * Hanldes integers properly for db insertion
		 * Helps prevent injections by converting the mixed var to an int and then attempt to escape it (sanity check)
		 *
		 * @param mixed $mixed_var
		 * @return mixed
		 */
		public function escape_int($mixed_var){
			return $this-&gt;__db_handle-&gt;real_escape_string(intval($mixed_var));
		}

		/**
		 * Gets the sql statement that was executed
		 *
		 * @return string
		 */
		public function get_sql(){
			return $this-&gt;__sql;
		}

		/**
		 * Returns the auto generated id used in the last query
		 *
		 * @return int
		 */
		public function get_inserted_id(){
			return mysqli_insert_id($this-&gt;__db_handle);
		}

		/**
		 * Gets the number of rows in a result
		 *
		 * @return int
		 */
		public function get_num_rows(){
			return $this-&gt;__result-&gt;num_rows();
		}

		/**
		 * Gets the number of affected rows in a previous MySQL operation
		 * Returns an integer greater than zero which indicated the number of rows affected or retrieved.
		 * Zero indicates that no records where updated for an UPDATE statement,
		 * no rows matched the WHERE clause in the query or that no query has yet been executed.
		 * -1 indicates that the query returned an error.
		 *
		 * @return int
		 */
		public function get_affected_rows(){
			return $this-&gt;__db_handle-&gt;affected_rows;
		}

		/**
		 * Returns a string providing information about the last query executed.
		 * ex. Records:100 Duplicates:0 Warnings:0 etc.
		 *
		 * @return string
		 */
		public function get_query_info(){
			return $this-&gt;__db_handle-&gt;info;
		}

		private function connect(){
			$this-&gt;__db_handle = new mysqli($this-&gt;__db_host, $this-&gt;__db_username, $this-&gt;__db_password, $this-&gt;__db_name);
			if (mysqli_connect_errno()){
				$this-&gt;throw_error(__METHOD__, __LINE__, mysqli_connect_error);
			}
		}

		private function get_single_result(){
			$this-&gt;__result = $this-&gt;__db_handle-&gt;query($this-&gt;__sql);
			if (!$this-&gt;__result){
				$this-&gt;throw_error(__METHOD__, __LINE__);
			}

			$ob_record = $this-&gt;__result-&gt;fetch_object();
			if (is_object($ob_record)){
				foreach($ob_record as $key =&gt; $value){
					$this-&gt;{$key} = $value;
				}
				return $this;
			}else{
				return false;
			}
		}

		private function get_table_fields(){
			$this-&gt;__sql = &quot;select * from {$this-&gt;escape($this-&gt;__table_name)} limit 1&quot;;

			$this-&gt;__result = $this-&gt;__db_handle-&gt;query($this-&gt;__sql);
			if (!$this-&gt;__result){
				$this-&gt;throw_error(__METHOD__, __LINE__,'Could not fetch table fields.');
			}

			$ar_field_info = $this-&gt;__result-&gt;fetch_fields();
			if (is_array($ar_field_info)){
				foreach ($ar_field_info as $val){
					$ar_fields[$val-&gt;name]-&gt;name = $val-&gt;name;
					$ar_fields[$val-&gt;name]-&gt;orgname = $val-&gt;orgname;
					$ar_fields[$val-&gt;name]-&gt;table = $val-&gt;table;
					$ar_fields[$val-&gt;name]-&gt;orgtable = $val-&gt;orgtable;
					$ar_fields[$val-&gt;name]-&gt;def = $val-&gt;def;
					$ar_fields[$val-&gt;name]-&gt;max_length = $val-&gt;max_length;
					$ar_fields[$val-&gt;name]-&gt;length = $val-&gt;length;
					$ar_fields[$val-&gt;name]-&gt;charsetnr = $val-&gt;charsetnr;
					$ar_fields[$val-&gt;name]-&gt;flags = $val-&gt;flags;
					$ar_fields[$val-&gt;name]-&gt;type = $this-&gt;__ar_field_types[$val-&gt;type];
					$ar_fields[$val-&gt;name]-&gt;decimals = $val-&gt;decimals;
				}
				return $ar_fields;
			}else{
				$this-&gt;throw_error(__METHOD__, __LINE__, &quot;No columns found for table {$this-&gt;__table_name}.&quot;);
			}
		}

		private function throw_error($function_name, $line_number, $error_msg = ''){
			die('&lt;font style=&quot;color: red; font-weight: bold;&quot;&gt;-- Error --&lt;/font&gt;&lt;br /&gt;' . $function_name . ' at line ' . $line_number . '&lt;br /&gt;MySQLi Error: ' . $this-&gt;__db_handle-&gt;error . (!empty($error_msg)? &quot;&lt;br /&gt;Message: $error_msg&quot; : &quot;&quot;));
		}

	}
?&gt;
</pre>
<p>All code is Copyright 2009 by Ashwin Surajbali (http://www.redinkdesign.net).</p>
<p>This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.</p>
<p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of ERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.</p>
<p>You can view a copy of the GNU General Public Licsense at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.</p>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/programming/php/php-mysqli-table-to-object-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sugar CRM &#8211; Entry Point Registry</title>
		<link>http://redinkdesign.net/open-source/sugar-crm-entry-point-registry/</link>
		<comments>http://redinkdesign.net/open-source/sugar-crm-entry-point-registry/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 11:57:40 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[To register new custom entry points for Sugar CRM, do the following you have to create the file custom/include/MVC/Controller/entry_point_registry.php

Contents should be the following: 

<code>

$entry_point_registry['entry_point_name'] = array('file' =&#62; 'path/to/custom/code.php', 'auth' =&#62; true);

</code>

]]></description>
			<content:encoded><![CDATA[<p>To register new custom entry points for Sugar CRM, do the following you have to create the file custom/include/MVC/Controller/entry_point_registry.php</p>
<p>Contents should be the following: </p>
<pre class="brush: php;">
$entry_point_registry['entry_point_name'] = array('file' =&gt; 'path/to/custom/code.php', 'auth' =&gt; true);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/open-source/sugar-crm-entry-point-registry/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Mime Type&#8217;s Array</title>
		<link>http://redinkdesign.net/programming/php/php-mime-types-array/</link>
		<comments>http://redinkdesign.net/programming/php/php-mime-types-array/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 14:50:13 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Just a simple php mime type array

<code>
$mimes = array(
      'hqx'   =&#62;  'application/mac-binhex40',
      'cpt'   =&#62;  'application/mac-compactpro',
      'doc'   =&#62;  'application/msword',
      'bin'   =&#62;  'application/macbinary',
      'dms'   =&#62;  'application/octet-stream',
      'lha'   =&#62;  'application/octet-stream',
      'lzh'   =&#62;  'application/octet-stream',
      'exe'   =&#62;  'application/octet-stream',
      'class' =&#62;  'application/octet-stream',
      'psd'   =&#62;  'application/octet-stream',
      'so'    =&#62;  'application/octet-stream',
]]></description>
			<content:encoded><![CDATA[<p>Just a simple php mime type array</p>
<pre class="brush: php;">
$mimes = array(
      'hqx'   =&gt;  'application/mac-binhex40',
      'cpt'   =&gt;  'application/mac-compactpro',
      'doc'   =&gt;  'application/msword',
      'bin'   =&gt;  'application/macbinary',
      'dms'   =&gt;  'application/octet-stream',
      'lha'   =&gt;  'application/octet-stream',
      'lzh'   =&gt;  'application/octet-stream',
      'exe'   =&gt;  'application/octet-stream',
      'class' =&gt;  'application/octet-stream',
      'psd'   =&gt;  'application/octet-stream',
      'so'    =&gt;  'application/octet-stream',
      'sea'   =&gt;  'application/octet-stream',
      'dll'   =&gt;  'application/octet-stream',
      'oda'   =&gt;  'application/oda',
      'pdf'   =&gt;  'application/pdf',
      'ai'    =&gt;  'application/postscript',
      'eps'   =&gt;  'application/postscript',
      'ps'    =&gt;  'application/postscript',
      'smi'   =&gt;  'application/smil',
      'smil'  =&gt;  'application/smil',
      'mif'   =&gt;  'application/vnd.mif',
      'xls'   =&gt;  'application/vnd.ms-excel',
      'ppt'   =&gt;  'application/vnd.ms-powerpoint',
      'wbxml' =&gt;  'application/vnd.wap.wbxml',
      'wmlc'  =&gt;  'application/vnd.wap.wmlc',
      'dcr'   =&gt;  'application/x-director',
      'dir'   =&gt;  'application/x-director',
      'dxr'   =&gt;  'application/x-director',
      'dvi'   =&gt;  'application/x-dvi',
      'gtar'  =&gt;  'application/x-gtar',
      'php'   =&gt;  'application/x-httpd-php',
      'php4'  =&gt;  'application/x-httpd-php',
      'php3'  =&gt;  'application/x-httpd-php',
      'phtml' =&gt;  'application/x-httpd-php',
      'phps'  =&gt;  'application/x-httpd-php-source',
      'js'    =&gt;  'application/x-javascript',
      'swf'   =&gt;  'application/x-shockwave-flash',
      'sit'   =&gt;  'application/x-stuffit',
      'tar'   =&gt;  'application/x-tar',
      'tgz'   =&gt;  'application/x-tar',
      'xhtml' =&gt;  'application/xhtml+xml',
      'xht'   =&gt;  'application/xhtml+xml',
      'zip'   =&gt;  'application/zip',
      'mid'   =&gt;  'audio/midi',
      'midi'  =&gt;  'audio/midi',
      'mpga'  =&gt;  'audio/mpeg',
      'mp2'   =&gt;  'audio/mpeg',
      'mp3'   =&gt;  'audio/mpeg',
      'aif'   =&gt;  'audio/x-aiff',
      'aiff'  =&gt;  'audio/x-aiff',
      'aifc'  =&gt;  'audio/x-aiff',
      'ram'   =&gt;  'audio/x-pn-realaudio',
      'rm'    =&gt;  'audio/x-pn-realaudio',
      'rpm'   =&gt;  'audio/x-pn-realaudio-plugin',
      'ra'    =&gt;  'audio/x-realaudio',
      'rv'    =&gt;  'video/vnd.rn-realvideo',
      'wav'   =&gt;  'audio/x-wav',
      'bmp'   =&gt;  'image/bmp',
      'gif'   =&gt;  'image/gif',
      'jpeg'  =&gt;  'image/jpeg',
      'jpg'   =&gt;  'image/jpeg',
      'jpe'   =&gt;  'image/jpeg',
      'png'   =&gt;  'image/png',
      'tiff'  =&gt;  'image/tiff',
      'tif'   =&gt;  'image/tiff',
      'css'   =&gt;  'text/css',
      'html'  =&gt;  'text/html',
      'htm'   =&gt;  'text/html',
      'shtml' =&gt;  'text/html',
      'txt'   =&gt;  'text/plain',
      'text'  =&gt;  'text/plain',
      'log'   =&gt;  'text/plain',
      'rtx'   =&gt;  'text/richtext',
      'rtf'   =&gt;  'text/rtf',
      'xml'   =&gt;  'text/xml',
      'xsl'   =&gt;  'text/xml',
      'mpeg'  =&gt;  'video/mpeg',
      'mpg'   =&gt;  'video/mpeg',
      'mpe'   =&gt;  'video/mpeg',
      'qt'    =&gt;  'video/quicktime',
      'mov'   =&gt;  'video/quicktime',
      'avi'   =&gt;  'video/x-msvideo',
      'movie' =&gt;  'video/x-sgi-movie',
      'doc'   =&gt;  'application/msword',
      'word'  =&gt;  'application/msword',
      'xl'    =&gt;  'application/excel',
      'eml'   =&gt;  'message/rfc822'
    );
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/programming/php/php-mime-types-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configuring Triggers and Actions in Drupal 6</title>
		<link>http://redinkdesign.net/open-source/configuring-triggers-and-actions-in-drupal-6/</link>
		<comments>http://redinkdesign.net/open-source/configuring-triggers-and-actions-in-drupal-6/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 11:52:12 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Here's a nice and simple article explaining how to add Triggers and Actions in Drupal 6. This tutorial will send an email notification to the site administrator when a comment is added to an article. I use it on this site to send an email to the articles author when a comment is added.

http://www.scribbledesigns.co.uk/2008/04/03/howto-configuring-triggers-and-actions-in-drupal-]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a nice and simple article explaining how to add Triggers and Actions in Drupal 6. This tutorial will send an email notification to the site administrator when a comment is added to an article. I use it on this site to send an email to the articles author when a comment is added.</p>
<p>http://www.scribbledesigns.co.uk/2008/04/03/howto-configuring-triggers-and-actions-in-drupal-6/</p>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/open-source/configuring-triggers-and-actions-in-drupal-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple SugarCRM E-mail Wrapper</title>
		<link>http://redinkdesign.net/open-source/simple-sugarcrm-e-mail-wrapper/</link>
		<comments>http://redinkdesign.net/open-source/simple-sugarcrm-e-mail-wrapper/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 10:53:18 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[SugarCRM]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This is a little helper function I wrote to send an email using Sugar CRM's built in mail class. 

<code>
/**
	 * A wrapper for sugar's mail class
	 * Sends emails to everyon in $tos array.
	 * $tos['user name'] = 'username@domain.com';
	 *
	 * @example : 	$tos['Some User'] = 'SomeUser@somewhere.com';
	 * 				$tos['Some User 2'] = 'SomeUser2@somewhere.com';
	 * 				sendSugarPHPMail($tos, 'hi', 'hello fellas');
	 *
	 * @param associative array
	 * @param string $subject
	 * @param string $body
	 * @return boolean
	 */
]]></description>
			<content:encoded><![CDATA[<p>This is a little helper function I wrote to send an email using Sugar CRM&#8217;s built in mail class. </p>
<pre class="brush: php;">
/**
	 * A wrapper for sugar's mail class
	 * Sends emails to everyon in $tos array.
	 * $tos['user name'] = 'username@domain.com';
	 *
	 * @example : 	$tos['Some User'] = 'SomeUser@somewhere.com';
	 * 				$tos['Some User 2'] = 'SomeUser2@somewhere.com';
	 * 				sendSugarPHPMail($tos, 'hi', 'hello fellas');
	 *
	 * @param associative array
	 * @param string $subject
	 * @param string $body
	 * @return boolean
	 */
	function sendSugarPHPMail($tos, $subject, $body){

		require_once('include/SugarPHPMailer.php');
		require_once('modules/Administration/Administration.php');

		$mail = new SugarPHPMailer();
		$admin = new Administration();
		$admin-&gt;retrieveSettings();

		if ($admin-&gt;settings['mail_sendtype'] == &quot;SMTP&quot;) {
			$mail-&gt;Host = $admin-&gt;settings['mail_smtpserver'];
			$mail-&gt;Port = $admin-&gt;settings['mail_smtpport'];

			if ($admin-&gt;settings['mail_smtpauth_req']) {
				$mail-&gt;SMTPAuth = TRUE;
				$mail-&gt;Username = $admin-&gt;settings['mail_smtpuser'];
				$mail-&gt;Password = $admin-&gt;settings['mail_smtppass'];
			}

			$mail-&gt;Mailer   = &quot;smtp&quot;;
			$mail-&gt;SMTPKeepAlive = true;

		}else{
			$mail-&gt;mailer = 'sendmail';
		}

		$mail-&gt;From     = $admin-&gt;settings['notify_fromaddress'];
		$mail-&gt;FromName = $admin-&gt;settings['notify_fromname'];
		$mail-&gt;ContentType = &quot;text/html&quot;; //&quot;text/plain&quot;

		$mail-&gt;Subject = $subject;
		$mail-&gt;Body = $body;

		foreach ($tos as $name =&gt; $address){
			$mail-&gt;AddAddress(&quot;{$address}&quot;, &quot;{$name}&quot;);
		}

		if (!$mail-&gt;send()) {
			$GLOBALS['log']-&gt;info(&quot;sendSugarPHPMail - Mailer error: &quot; . $mail-&gt;ErrorInfo);
			return false;
 		}else{
 			return true;
 		}
	}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/open-source/simple-sugarcrm-e-mail-wrapper/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP Country Array</title>
		<link>http://redinkdesign.net/programming/php/php-country-array/</link>
		<comments>http://redinkdesign.net/programming/php/php-country-array/#comments</comments>
		<pubDate>Wed, 16 Jul 2008 11:39:25 +0000</pubDate>
		<dc:creator>Ashwin Surajbali</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[This array can be used to build out a Country drop down list.

<code>
'AFGHANISTAN',
		'AL'=&#62;'ALBANIA',
		'DZ'=&#62;'ALGERIA',
		'AS'=&#62;'AMERICAN SAMOA',
		'AD'=&#62;'ANDORRA',
		'AO'=&#62;'ANGOLA',
		'AI'=&#62;'ANGUILLA',
		'AQ'=&#62;'ANTARCTICA',
		'AG'=&#62;'ANTIGUA AND BARBUDA',
		'AR'=&#62;'ARGENTINA',
		'AM'=&#62;'ARMENIA',
		'AW'=&#62;'ARUBA',
		'AU'=&#62;'AUSTRALIA',
		'AT'=&#62;'AUSTRIA',
		'AZ'=&#62;'AZERBAIJAN',
		'BS'=&#62;'BAHAMAS',
		'BH'=&#62;'BAHRAIN',
		'BD'=&#62;'BANGLADESH',
		'BB'=&#62;'BARBADOS',
		'BY'=&#62;'BELARUS',
		'BE'=&#62;'BELGIUM',
		'BZ'=&#62;'BELIZE',
]]></description>
			<content:encoded><![CDATA[<p>This array can be used to build out a Country drop down list.</p>
<pre class="brush: php;">
&lt;?php
	$ar_countries = array(
		'AF'=&gt;'AFGHANISTAN',
		'AL'=&gt;'ALBANIA',
		'DZ'=&gt;'ALGERIA',
		'AS'=&gt;'AMERICAN SAMOA',
		'AD'=&gt;'ANDORRA',
		'AO'=&gt;'ANGOLA',
		'AI'=&gt;'ANGUILLA',
		'AQ'=&gt;'ANTARCTICA',
		'AG'=&gt;'ANTIGUA AND BARBUDA',
		'AR'=&gt;'ARGENTINA',
		'AM'=&gt;'ARMENIA',
		'AW'=&gt;'ARUBA',
		'AU'=&gt;'AUSTRALIA',
		'AT'=&gt;'AUSTRIA',
		'AZ'=&gt;'AZERBAIJAN',
		'BS'=&gt;'BAHAMAS',
		'BH'=&gt;'BAHRAIN',
		'BD'=&gt;'BANGLADESH',
		'BB'=&gt;'BARBADOS',
		'BY'=&gt;'BELARUS',
		'BE'=&gt;'BELGIUM',
		'BZ'=&gt;'BELIZE',
		'BJ'=&gt;'BENIN',
		'BM'=&gt;'BERMUDA',
		'BT'=&gt;'BHUTAN',
		'BO'=&gt;'BOLIVIA',
		'BA'=&gt;'BOSNIA AND HERZEGOVINA',
		'BW'=&gt;'BOTSWANA',
		'BV'=&gt;'BOUVET ISLAND',
		'BR'=&gt;'BRAZIL',
		'IO'=&gt;'BRITISH INDIAN OCEAN TERRITORY',
		'BN'=&gt;'BRUNEI DARUSSALAM',
		'BG'=&gt;'BULGARIA',
		'BF'=&gt;'BURKINA FASO',
		'BI'=&gt;'BURUNDI',
		'KH'=&gt;'CAMBODIA',
		'CM'=&gt;'CAMEROON',
		'CA'=&gt;'CANADA',
		'CV'=&gt;'CAPE VERDE',
		'KY'=&gt;'CAYMAN ISLANDS',
		'CF'=&gt;'CENTRAL AFRICAN REPUBLIC',
		'TD'=&gt;'CHAD',
		'CL'=&gt;'CHILE',
		'CN'=&gt;'CHINA',
		'CX'=&gt;'CHRISTMAS ISLAND',
		'CC'=&gt;'COCOS (KEELING) ISLANDS',
		'CO'=&gt;'COLOMBIA',
		'KM'=&gt;'COMOROS',
		'CG'=&gt;'CONGO',
		'CD'=&gt;'CONGO, THE DEMOCRATIC REPUBLIC OF THE',
		'CK'=&gt;'COOK ISLANDS',
		'CR'=&gt;'COSTA RICA',
		'CI'=&gt;'COTE D IVOIRE',
		'HR'=&gt;'CROATIA',
		'CU'=&gt;'CUBA',
		'CY'=&gt;'CYPRUS',
		'CZ'=&gt;'CZECH REPUBLIC',
		'DK'=&gt;'DENMARK',
		'DJ'=&gt;'DJIBOUTI',
		'DM'=&gt;'DOMINICA',
		'DO'=&gt;'DOMINICAN REPUBLIC',
		'TP'=&gt;'EAST TIMOR',
		'EC'=&gt;'ECUADOR',
		'EG'=&gt;'EGYPT',
		'SV'=&gt;'EL SALVADOR',
		'GQ'=&gt;'EQUATORIAL GUINEA',
		'ER'=&gt;'ERITREA',
		'EE'=&gt;'ESTONIA',
		'ET'=&gt;'ETHIOPIA',
		'FK'=&gt;'FALKLAND ISLANDS (MALVINAS)',
		'FO'=&gt;'FAROE ISLANDS',
		'FJ'=&gt;'FIJI',
		'FI'=&gt;'FINLAND',
		'FR'=&gt;'FRANCE',
		'GF'=&gt;'FRENCH GUIANA',
		'PF'=&gt;'FRENCH POLYNESIA',
		'TF'=&gt;'FRENCH SOUTHERN TERRITORIES',
		'GA'=&gt;'GABON',
		'GM'=&gt;'GAMBIA',
		'GE'=&gt;'GEORGIA',
		'DE'=&gt;'GERMANY',
		'GH'=&gt;'GHANA',
		'GI'=&gt;'GIBRALTAR',
		'GR'=&gt;'GREECE',
		'GL'=&gt;'GREENLAND',
		'GD'=&gt;'GRENADA',
		'GP'=&gt;'GUADELOUPE',
		'GU'=&gt;'GUAM',
		'GT'=&gt;'GUATEMALA',
		'GN'=&gt;'GUINEA',
		'GW'=&gt;'GUINEA-BISSAU',
		'GY'=&gt;'GUYANA',
		'HT'=&gt;'HAITI',
		'HM'=&gt;'HEARD ISLAND AND MCDONALD ISLANDS',
		'VA'=&gt;'HOLY SEE (VATICAN CITY STATE)',
		'HN'=&gt;'HONDURAS',
		'HK'=&gt;'HONG KONG',
		'HU'=&gt;'HUNGARY',
		'IS'=&gt;'ICELAND',
		'IN'=&gt;'INDIA',
		'ID'=&gt;'INDONESIA',
		'IR'=&gt;'IRAN, ISLAMIC REPUBLIC OF',
		'IQ'=&gt;'IRAQ',
		'IE'=&gt;'IRELAND',
		'IL'=&gt;'ISRAEL',
		'IT'=&gt;'ITALY',
		'JM'=&gt;'JAMAICA',
		'JP'=&gt;'JAPAN',
		'JO'=&gt;'JORDAN',
		'KZ'=&gt;'KAZAKSTAN',
		'KE'=&gt;'KENYA',
		'KI'=&gt;'KIRIBATI',
		'KP'=&gt;'KOREA DEMOCRATIC PEOPLES REPUBLIC OF',
		'KR'=&gt;'KOREA REPUBLIC OF',
		'KW'=&gt;'KUWAIT',
		'KG'=&gt;'KYRGYZSTAN',
		'LA'=&gt;'LAO PEOPLES DEMOCRATIC REPUBLIC',
		'LV'=&gt;'LATVIA',
		'LB'=&gt;'LEBANON',
		'LS'=&gt;'LESOTHO',
		'LR'=&gt;'LIBERIA',
		'LY'=&gt;'LIBYAN ARAB JAMAHIRIYA',
		'LI'=&gt;'LIECHTENSTEIN',
		'LT'=&gt;'LITHUANIA',
		'LU'=&gt;'LUXEMBOURG',
		'MO'=&gt;'MACAU',
		'MK'=&gt;'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF',
		'MG'=&gt;'MADAGASCAR',
		'MW'=&gt;'MALAWI',
		'MY'=&gt;'MALAYSIA',
		'MV'=&gt;'MALDIVES',
		'ML'=&gt;'MALI',
		'MT'=&gt;'MALTA',
		'MH'=&gt;'MARSHALL ISLANDS',
		'MQ'=&gt;'MARTINIQUE',
		'MR'=&gt;'MAURITANIA',
		'MU'=&gt;'MAURITIUS',
		'YT'=&gt;'MAYOTTE',
		'MX'=&gt;'MEXICO',
		'FM'=&gt;'MICRONESIA, FEDERATED STATES OF',
		'MD'=&gt;'MOLDOVA, REPUBLIC OF',
		'MC'=&gt;'MONACO',
		'MN'=&gt;'MONGOLIA',
		'MS'=&gt;'MONTSERRAT',
		'MA'=&gt;'MOROCCO',
		'MZ'=&gt;'MOZAMBIQUE',
		'MM'=&gt;'MYANMAR',
		'NA'=&gt;'NAMIBIA',
		'NR'=&gt;'NAURU',
		'NP'=&gt;'NEPAL',
		'NL'=&gt;'NETHERLANDS',
		'AN'=&gt;'NETHERLANDS ANTILLES',
		'NC'=&gt;'NEW CALEDONIA',
		'NZ'=&gt;'NEW ZEALAND',
		'NI'=&gt;'NICARAGUA',
		'NE'=&gt;'NIGER',
		'NG'=&gt;'NIGERIA',
		'NU'=&gt;'NIUE',
		'NF'=&gt;'NORFOLK ISLAND',
		'MP'=&gt;'NORTHERN MARIANA ISLANDS',
		'NO'=&gt;'NORWAY',
		'OM'=&gt;'OMAN',
		'PK'=&gt;'PAKISTAN',
		'PW'=&gt;'PALAU',
		'PS'=&gt;'PALESTINIAN TERRITORY, OCCUPIED',
		'PA'=&gt;'PANAMA',
		'PG'=&gt;'PAPUA NEW GUINEA',
		'PY'=&gt;'PARAGUAY',
		'PE'=&gt;'PERU',
		'PH'=&gt;'PHILIPPINES',
		'PN'=&gt;'PITCAIRN',
		'PL'=&gt;'POLAND',
		'PT'=&gt;'PORTUGAL',
		'PR'=&gt;'PUERTO RICO',
		'QA'=&gt;'QATAR',
		'RE'=&gt;'REUNION',
		'RO'=&gt;'ROMANIA',
		'RU'=&gt;'RUSSIAN FEDERATION',
		'RW'=&gt;'RWANDA',
		'SH'=&gt;'SAINT HELENA',
		'KN'=&gt;'SAINT KITTS AND NEVIS',
		'LC'=&gt;'SAINT LUCIA',
		'PM'=&gt;'SAINT PIERRE AND MIQUELON',
		'VC'=&gt;'SAINT VINCENT AND THE GRENADINES',
		'WS'=&gt;'SAMOA',
		'SM'=&gt;'SAN MARINO',
		'ST'=&gt;'SAO TOME AND PRINCIPE',
		'SA'=&gt;'SAUDI ARABIA',
		'SN'=&gt;'SENEGAL',
		'SC'=&gt;'SEYCHELLES',
		'SL'=&gt;'SIERRA LEONE',
		'SG'=&gt;'SINGAPORE',
		'SK'=&gt;'SLOVAKIA',
		'SI'=&gt;'SLOVENIA',
		'SB'=&gt;'SOLOMON ISLANDS',
		'SO'=&gt;'SOMALIA',
		'ZA'=&gt;'SOUTH AFRICA',
		'GS'=&gt;'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS',
		'ES'=&gt;'SPAIN',
		'LK'=&gt;'SRI LANKA',
		'SD'=&gt;'SUDAN',
		'SR'=&gt;'SURINAME',
		'SJ'=&gt;'SVALBARD AND JAN MAYEN',
		'SZ'=&gt;'SWAZILAND',
		'SE'=&gt;'SWEDEN',
		'CH'=&gt;'SWITZERLAND',
		'SY'=&gt;'SYRIAN ARAB REPUBLIC',
		'TW'=&gt;'TAIWAN, PROVINCE OF CHINA',
		'TJ'=&gt;'TAJIKISTAN',
		'TZ'=&gt;'TANZANIA, UNITED REPUBLIC OF',
		'TH'=&gt;'THAILAND',
		'TG'=&gt;'TOGO',
		'TK'=&gt;'TOKELAU',
		'TO'=&gt;'TONGA',
		'TT'=&gt;'TRINIDAD AND TOBAGO',
		'TN'=&gt;'TUNISIA',
		'TR'=&gt;'TURKEY',
		'TM'=&gt;'TURKMENISTAN',
		'TC'=&gt;'TURKS AND CAICOS ISLANDS',
		'TV'=&gt;'TUVALU',
		'UG'=&gt;'UGANDA',
		'UA'=&gt;'UKRAINE',
		'AE'=&gt;'UNITED ARAB EMIRATES',
		'GB'=&gt;'UNITED KINGDOM',
		'US'=&gt;'UNITED STATES',
		'UM'=&gt;'UNITED STATES MINOR OUTLYING ISLANDS',
		'UY'=&gt;'URUGUAY',
		'UZ'=&gt;'UZBEKISTAN',
		'VU'=&gt;'VANUATU',
		'VE'=&gt;'VENEZUELA',
		'VN'=&gt;'VIET NAM',
		'VG'=&gt;'VIRGIN ISLANDS, BRITISH',
		'VI'=&gt;'VIRGIN ISLANDS, U.S.',
		'WF'=&gt;'WALLIS AND FUTUNA',
		'EH'=&gt;'WESTERN SAHARA',
		'YE'=&gt;'YEMEN',
		'YU'=&gt;'YUGOSLAVIA',
		'ZM'=&gt;'ZAMBIA',
		'ZW'=&gt;'ZIMBABWE'
	);
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://redinkdesign.net/programming/php/php-country-array/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
