<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss version="2.0"><channel><title>Corey Worrell Blog</title><description>Random postings about web and graphic design; PHP, Javascript, CSS, HTML, etc...</description><link>http://coreyworrell.com/blog</link><generator>Corey Worrell - http://coreyworrell.com</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/corey_worrell_blog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="corey_worrell_blog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">corey_worrell_blog</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Fri, 26 Nov 10 13:01:36 -0800</pubDate><title>PHP Calendar</title><description>&lt;p&gt;&lt;a rel="lightbox" href="http://coreyworrell.com/assets/uploads/files/php-calendar.jpg"&gt;&lt;img class="full" title="Click to Enlarge" alt="PHP Calendar" src="http://coreyworrell.com/assets/uploads/images/php-calendar-small.jpg" height="200" width="539" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="demo" href="/calendar/"&gt;Go to PHP Calendar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;PHP Calendar is a handy little set of classes that makes creating a calendar a very simple task. You have FULL control over how it is displayed, and can add events incredibly easy.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://kohanaframework.org"&gt;Kohana Framework&lt;/a&gt; had first created these classes for use within their framework. But development stopped, and the code was not yet fully useable. So I modified and added to their base code to create this standalone version.&lt;/p&gt;
&lt;p&gt;Feel free to use it and abuse it. If you use it on anything and would like to share what you've done with it, please leave a comment or use my contact form to get in touch.&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/php-calendar</link><guid>http://coreyworrell.com/blog/article/php-calendar</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Thu, 04 Mar 10 12:14:46 -0800</pubDate><title>Kohana 3 Filter Class</title><description>&lt;p&gt;Here's a class that has come in super handy for me lately. I created it for use with Kohana v3. Basically, say you have an adminstrator backend to your website and you so you have a page for blog posts and one for blog categories. Simple enough. But you wanna give your users options to filter their results so they don't have to search through hundreds or thousands of blog posts every time they wanna find a certain post. Easy enough.&lt;/p&gt;
&lt;p&gt;But then you have the problem where the user filters the results, finds the post they want, goes to edit it, then it sends them back to the list of all posts. But whoops, they forgot they wanted to change something else in that same post. Now they have to re-filter all over again and find it. VERY ANNOYING!&lt;/p&gt;
&lt;p&gt;So with this class you can provide it with an array of keys to keep track of over multiple page loads. It keeps every controller and actions filters seperate so that you can easily use them throughout your controllers and views. So if you want to filter by 'Author' and 'Category' then the class will look for the keys 'author' and 'category' in either &lt;code&gt;$_POST&lt;/code&gt; or &lt;code&gt;$_GET&lt;/code&gt; and add them to the filters. Now when the user returns to that page, all filters will still be applied. It's a big time saver!&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://github.com/coreyworrell/Filter"&gt;Source and Usage on Github&lt;/a&gt;&lt;br /&gt;&lt;/h3&gt;</description><link>http://coreyworrell.com/blog/article/kohana-3-filter-class</link><guid>http://coreyworrell.com/blog/article/kohana-3-filter-class</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Thu, 03 Dec 09 13:11:10 -0800</pubDate><title>Javascript Stopwatch</title><description>&lt;p&gt;&lt;a href="/stopwatch/"&gt;&lt;img class="left" alt="Stopwatch" src="http://coreyworrell.com/assets/uploads/images/stopwatch.png" height="200" width="200" /&gt;&lt;/a&gt;The other day I needed a stopwatch to time a talk I was giving, but I had a problem. My stopwatch was ALL the way outside in the garage! Now I obviously wasn't going to get up and get it, so I figured there's gotta be something online. Sure enough, there are quite a few online stopwatches.&lt;/p&gt;
&lt;p&gt;After using one, I started to think "Man, I should try to make this, it'll be a good exercise". So I did.&lt;/p&gt;
&lt;p&gt;And I failed... Sort of... I've only worked with time in javascript a couple times, so after trying to figure it out for awhile, I modified some code I'd found a couple different javascript stopwatches using. Then I added some cool extra functionality and styled it all up with CSS (with CSS3 features!).&lt;/p&gt;
&lt;p&gt;Hopefully you'll find this useful. And if not, at least it looks cool!&lt;/p&gt;
&lt;p&gt;&lt;a class="demo" href="/stopwatch/"&gt;Javascript Stopwatch&lt;/a&gt;&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/javascript-stopwatch</link><guid>http://coreyworrell.com/blog/article/javascript-stopwatch</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Sat, 12 Sep 09 10:32:53 -0700</pubDate><title>Convert to HTML Entities Between Code Tags</title><description>&lt;p&gt;If you're ever posting a piece of code on your blog or whatever, you've probably realized that it's a pain to have to convert any special character to its HTML entity. Why not take the pain away and let PHP handle that for you?&lt;/p&gt;
&lt;p&gt;I'm using something similar for the comments on this blog. After I read &lt;a href="http://matthewjamestaylor.com/"&gt;Matthew James Taylor's&lt;/a&gt; &lt;a href="http://matthewjamestaylor.com/blog/convert-special-characters-to-html-entities-between-code-tags"&gt;post about this&lt;/a&gt;, I tried to come up with something using a little less code.&lt;/p&gt;
&lt;p&gt;There really isn't a foolproof method to pull this off, and I have been told that traversing the code using the DOM would be better, but this function (as ugly as it is) actually works quite well if you have a proper HTML structure with valid code.&lt;br /&gt;It checks for any &amp;lt;code&amp;gt; and &amp;lt;pre&amp;gt; tags and converts any special characters inside them to there respective HTML entity. It even accounts for nested &amp;lt;code&amp;gt; and &amp;lt;pre&amp;gt; tags, as well as any attributes you give them.&lt;/p&gt;
&lt;a name="more_10"&gt;&lt;/a&gt;
&lt;h3&gt;The Function&lt;/h3&gt;
&lt;pre name="code" class="php"&gt;function fixcodeblocks($string) &lt;br /&gt;{&lt;br /&gt;	return preg_replace_callback('#&amp;lt;(code|pre)([^&amp;gt;]*)&amp;gt;(((?!&amp;lt;/?\1).)*|(?R))*&amp;lt;/\1&amp;gt;#si', 'specialchars', $string);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function specialchars($matches)&lt;br /&gt;{&lt;br /&gt;	return '&amp;lt;'.$matches[1].$matches[2].'&amp;gt;'.htmlspecialchars(substr(str_replace('&amp;lt;'.$matches[1].$matches[2].'&amp;gt;', '', $matches[0]), 0, -(strlen($matches[1]) + 3))).'&amp;lt;/'.$matches[1].'&amp;gt;';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;echo fixcodeblocks($html);&lt;/pre&gt;
&lt;p&gt;That would turn something like this:&lt;/p&gt;
&lt;pre name="code" class="html"&gt;&amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Some stuff here, but no actually code yet.&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Here is our first code that needs to be escaped: &amp;lt;code&amp;gt;&amp;lt;div id="test"&amp;gt;Something inside a DIV&amp;lt;/div&amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;pre id="test"&amp;gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;	&amp;lt;head&amp;gt;&lt;br /&gt;		&amp;lt;meta name="author" content="First Last" /&amp;gt;&lt;br /&gt;	&amp;lt;/head&amp;gt;&lt;br /&gt;	&amp;lt;body&amp;gt;&lt;br /&gt;		&amp;lt;p&amp;gt;Hey&amp;lt;/p&amp;gt;&lt;br /&gt;	&amp;lt;/body&amp;gt;&lt;br /&gt;	&amp;lt;div id="nested"&amp;gt;&lt;br /&gt;		&amp;lt;div id="nest-inside"&amp;gt;&lt;br /&gt;			&amp;lt;p&amp;gt;Inside nest&amp;lt;/p&amp;gt;&lt;br /&gt;		&amp;lt;/div&amp;gt;&lt;br /&gt;	&amp;lt;/div&amp;gt;&lt;br /&gt;	&amp;lt;code&amp;gt;Another code block inside some code.&amp;lt;/code&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;&amp;lt;h2&amp;gt;More Content&amp;lt;/h2&amp;gt;&lt;/pre&gt;
&lt;p&gt;into this:&lt;/p&gt;
&lt;pre name="code" class="html"&gt;&amp;lt;h1&amp;gt;Heading&amp;lt;/h1&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Some stuff here, but no actually code yet.&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;p&amp;gt;Here is our first code that needs to be escaped: &amp;lt;code&amp;gt;&amp;amp;lt;div id=&amp;amp;quot;test&amp;amp;quot;&amp;amp;gt;Something inside a DIV&amp;amp;lt;/div&amp;amp;gt;&amp;lt;/code&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;&amp;lt;pre id="test"&amp;gt;&lt;br /&gt;&amp;amp;lt;html&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;head&amp;amp;gt;&lt;br /&gt;		&amp;amp;lt;meta name=&amp;amp;quot;author&amp;amp;quot; content=&amp;amp;quot;First Last&amp;amp;quot; /&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;/head&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;body&amp;amp;gt;&lt;br /&gt;		&amp;amp;lt;p&amp;amp;gt;Hey&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;/body&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;div id=&amp;amp;quot;nested&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;		&amp;amp;lt;div id=&amp;amp;quot;nest-inside&amp;amp;quot;&amp;amp;gt;&lt;br /&gt;			&amp;amp;lt;p&amp;amp;gt;Inside nest&amp;amp;lt;/p&amp;amp;gt;&lt;br /&gt;		&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;/div&amp;amp;gt;&lt;br /&gt;	&amp;amp;lt;code&amp;amp;gt;Another code block inside some code.&amp;amp;lt;/code&amp;amp;gt;&lt;br /&gt;&amp;amp;lt;/html&amp;amp;gt;&lt;br /&gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;&amp;lt;h2&amp;gt;More Content&amp;lt;/h2&amp;gt;&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Feel free to offer any suggestions or improvements you might have, as well as any other ways of accomplishing this.&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/convert-to-html-entities-between-code-tags</link><guid>http://coreyworrell.com/blog/article/convert-to-html-entities-between-code-tags</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Tue, 25 Aug 09 13:26:01 -0700</pubDate><title>HTML Sandbox</title><description>&lt;p&gt;&lt;a href="http://sandbox.coreyworrell.com"&gt;&lt;img alt="HTML Sandbox" src="http://coreyworrell.com/assets/uploads/images/html-sandbox.jpg" class="full" height="200" width="539" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I've always got ideas running through my head of how to code something, or how something might look. But sometimes I don't feel like going through the trouble of making a new file and filling it with a proper HTML structure just to test a piece of code out real quick. That's why I created this HTML Sandbox page to test out my code.&lt;/p&gt;
&lt;h3&gt;Features&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Choose your own &lt;code&gt;DOCTYPE&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Enable syntax highlighting code editor&lt;/li&gt;
&lt;li&gt;Paste in code snippets to save time&lt;/li&gt;
&lt;li&gt;Hide form to see just your content&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;&lt;a href="http://sandbox.coreyworrell.com"&gt;Check it Out!&lt;/a&gt;&lt;/h3&gt;</description><link>http://coreyworrell.com/blog/article/html-sandbox</link><guid>http://coreyworrell.com/blog/article/html-sandbox</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Mon, 27 Jul 09 16:43:22 -0700</pubDate><title>Flickr API Wrapper</title><description>&lt;p&gt;There are already a couple PHP Flickr API classes out there, but they all seemed a bit over-complicated. &lt;a href="http://www.flickr.com"&gt;Flickr&lt;/a&gt; has already done all the work for us, so why make it harder than it is. They've even got all the documentation, so if you ever need to know anything about it, just head over &lt;a href="http://www.flickr.com/services/api/"&gt;there&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a class="download zip" href="http://coreyworrell.com/assets/uploads/files/flickr.zip"&gt;Download Class&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This class makes making a request to Flickr's API very simple. And it returns the results as a PHP object. It will even cache your requests so you aren't hitting Flickr as often, thus increasing the speed and performance of this script.&lt;/p&gt;
&lt;pre name="code" class="php"&gt;&amp;lt;?php&lt;br /&gt;&lt;br /&gt;$api_key = 'your_flickr_api_key_here';&lt;br /&gt;&lt;br /&gt;$flickr = new Flickr($api_key);&lt;br /&gt;&lt;br /&gt;$params = array&lt;br /&gt;(&lt;br /&gt;    'user_id'  =&amp;gt; 'your_flickr_user_nsid_here',&lt;br /&gt;    'extras'   =&amp;gt; 'url_m,url_sq',&lt;br /&gt;    'per_page' =&amp;gt; 10,&lt;br /&gt;);&lt;br /&gt;&lt;br /&gt;$result = $flickr-&amp;gt;call('people.getPublicPhotos', $params);&lt;br /&gt;&lt;br /&gt;foreach ($result-&amp;gt;photos-&amp;gt;photo as $photo)&lt;br /&gt;{&lt;br /&gt;    $p = $flickr-&amp;gt;call('photos.getInfo', array('photo_id' =&amp;gt; $photo-&amp;gt;id));&lt;br /&gt;&lt;br /&gt;    echo '&amp;lt;h2&amp;gt;'.$photo-&amp;gt;title.'&amp;lt;/h2&amp;gt;';&lt;br /&gt;    echo '&amp;lt;a href="'.$photo-&amp;gt;url_m.'"&amp;gt;&amp;lt;img src="'.$photo-&amp;gt;url_sq.'" alt="" /&amp;gt;&amp;lt;/a&amp;gt;';&lt;br /&gt;    echo nl2br($p-&amp;gt;photo-&amp;gt;description-&amp;gt;_content);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Example using chaining&lt;br /&gt;&lt;br /&gt;$result = Flickr::factory($api_key)-&amp;gt;call('people.getPublicPhotos', $params);&lt;/pre&gt;
&lt;p&gt;For a live demo, just check out my sidebar over on the right.&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/flickr-api-wrapper</link><guid>http://coreyworrell.com/blog/article/flickr-api-wrapper</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Wed, 22 Jul 09 17:51:13 -0700</pubDate><title>CSS Compressor</title><description>&lt;p&gt;&lt;img class="right" alt="CSS Compressor" src="http://coreyworrell.com/assets/uploads/images/css-compressor.jpg" height="200" width="200" /&gt;So I've been noticing quite a few articles lately about speeding up your website, and compressing static files and all that. It got me thinking, and I started to mess around with some ideas I had.&lt;/p&gt;
&lt;p&gt;Now I know there are a lot of CSS compressors on the web today, but most of them involve copying and pasting your code into a textarea, and it giving you a compressed version that you have to upload to your server and reference in your HTML document. But what if you have 4 or 5 different style sheets that you are going to be editing quite a bit, and don't want to bother having to merge your code and compress it all the time.&lt;/p&gt;
&lt;a name="more_7"&gt;&lt;/a&gt;
&lt;p&gt;That's why I created this little PHP script that you throw on your server, tell it which CSS files you want compressed, and then it does all the work for you, serving up a nice, lightweight CSS file. And the best part is that you can still open up your CSS files like normal and edit them anytime.&lt;/p&gt;
&lt;p&gt;So now, just reference that one PHP file in your HTML document:&lt;/p&gt;
&lt;pre name="code" class="html"&gt;&amp;lt;link rel="stylesheet" type="text/css" href="css.php" /&amp;gt;&lt;/pre&gt;
&lt;p&gt;The best part is that the script creates a compressed file and caches it until the next time you update any of your CSS files.&lt;/p&gt;
&lt;h3&gt;UPDATE:&lt;/h3&gt;
&lt;p&gt;I created an alternate version where you define the css files in the URI instead of as an array. I think this is more widely used and allows you to easily modify which files you want to use. The only difference is the way you reference the link tag:&lt;/p&gt;
&lt;pre name="code" class="html"&gt;&amp;lt;link rel="stylesheet" type="text/css" src="css.php?reset,grid,styles" /&amp;gt;&lt;/pre&gt;
&lt;p&gt;This file is named 'css.alt.php' in the ZIP download below.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://coreyworrell.com/assets/uploads/files/css-compressor.zip" class="download zip"&gt;Download&lt;/a&gt;&lt;br /&gt;&lt;/h3&gt;
&lt;h3&gt;Example:&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;reset.css&lt;/strong&gt;&lt;/p&gt;
&lt;pre name="code" class="css"&gt;html, body, div, span, a,&lt;br /&gt;form, table, tr, td, ul, li {&lt;br /&gt;    margin : 0px;&lt;br /&gt;    padding : 0px;&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;grid.css&lt;/strong&gt;&lt;/p&gt;
&lt;pre name="code" class="css"&gt;.container_12 {width:960px; float:left;}&lt;br /&gt;.container_12 .grid_1 {width:60px;}&lt;br /&gt;.container_12 .grid_2 {width:120px;}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;styles.css&lt;/strong&gt;&lt;/p&gt;
&lt;pre name="code" class="css"&gt;body {&lt;br /&gt;    font : 12px/16px Helvetica, Arial, sans-serif;&lt;br /&gt;    text-align : center;&lt;br /&gt;    background : #000 url('../img/body_bg.jpg') top center no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Will generate the following:&lt;/p&gt;
&lt;pre name="code" class="css"&gt;html,body,div,span,a,form,table,tr,td,ul,li{margin:0;padding:0}.container_12{width:960px;float:left}.container_12 .grid_1{width:60px}.container_12 .grid_2{width:120px}body{font:12px/16px Helvetica,Arial,sans-serif;text-align:center;background:#000 url('../img/body_bg.jpg') top center no-repeat}&lt;/pre&gt;
&lt;h3&gt;Preview:&lt;/h3&gt;
&lt;pre name="code" class="php"&gt;&amp;lt;?php&lt;br /&gt;/**&lt;br /&gt; * Easily compress all your CSS files into one streamlined file.&lt;br /&gt; * This file strips your CSS of all unnecessary line breaks, spaces, and characters.&lt;br /&gt; *&lt;br /&gt; * @author   Corey Worrell&lt;br /&gt; * @url      http://coreyworrell.com&lt;br /&gt; * @version  1.0&lt;br /&gt; *&lt;br /&gt; * Usage:&lt;br /&gt; * &amp;lt;link rel="stylesheet" type="text/css" href="css.php?reset,grid,styles" /&amp;gt;&lt;br /&gt; *&lt;br /&gt; * Example folder structure:&lt;br /&gt; * httpdocs&lt;br /&gt; *   - css&lt;br /&gt; *      - css.php&lt;br /&gt; *      - grid.css&lt;br /&gt; *      - reset.css&lt;br /&gt; *      - styles.css&lt;br /&gt; *   - js&lt;br /&gt; *   - img&lt;br /&gt; *   - index.html&lt;br /&gt; */&lt;br /&gt;&lt;br /&gt;// Name of generated "cache" file (w/out '.css' extension)&lt;br /&gt;$compressed = 'compressed';&lt;br /&gt;// End configuration&lt;br /&gt;&lt;br /&gt;function bad_request()&lt;br /&gt;{&lt;br /&gt;	header('HTTP/1.1 400 Bad Request');&lt;br /&gt;	echo 'HTTP/1.1 400 Bad Request';&lt;br /&gt;	exit;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;$url = parse_url($_SERVER['REQUEST_URI']);&lt;br /&gt;$files = explode(',', $url['query']);&lt;br /&gt;&lt;br /&gt;$compress = FALSE;&lt;br /&gt;&lt;br /&gt;if (file_exists($compressed.'.css'))&lt;br /&gt;{&lt;br /&gt;	foreach ($files as $file)&lt;br /&gt;	{&lt;br /&gt;		if ( ! file_exists($file.'.css'))&lt;br /&gt;		{&lt;br /&gt;			bad_request();&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		if ($time = filemtime($file.'.css') AND $time &amp;gt; filemtime($compressed.'.css'))&lt;br /&gt;		{&lt;br /&gt;			$compress = TRUE;&lt;br /&gt;		}&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (file_exists($compressed.'.css') AND ! $compress)&lt;br /&gt;{&lt;br /&gt;	$css = file_get_contents($compressed.'.css');&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;	$file = '';&lt;br /&gt;	$css  = '';&lt;br /&gt;	&lt;br /&gt;	foreach ($files as $file)&lt;br /&gt;	{&lt;br /&gt;		if ( ! file_exists($file.'.css'))&lt;br /&gt;		{&lt;br /&gt;			bad_request();&lt;br /&gt;		}&lt;br /&gt;		&lt;br /&gt;		$css .= file_get_contents($file.'.css');&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	$replace = array&lt;br /&gt;	(&lt;br /&gt;		'/\s+/' 									=&amp;gt; ' ',&lt;br /&gt;		'/[\s+]?(;|:|{|}|,)[\s+]?/' 				=&amp;gt; '$1',&lt;br /&gt;		'/[\t\r\n]/' 								=&amp;gt; '',&lt;br /&gt;		'/\/\*(.*?)\*\//' 							=&amp;gt; '',&lt;br /&gt;		'/;}/' 										=&amp;gt; '}',&lt;br /&gt;		'/}(\s+)?/' 								=&amp;gt; '}',&lt;br /&gt;		'/#([\da-f])\1([\da-f])\2([\da-f])\3/i' 	=&amp;gt; '#$1$2$3',&lt;br /&gt;		'/([^\d])0(px|em|pt|ex|%|pc|cm|in|mm)/i'	=&amp;gt; '${1}0',&lt;br /&gt;	);&lt;br /&gt;&lt;br /&gt;	$css = trim(preg_replace(array_keys($replace), array_values($replace), $css));&lt;br /&gt;	&lt;br /&gt;	$handle = fopen($compressed.'.css', 'w');&lt;br /&gt;			  fwrite($handle, $css);&lt;br /&gt;			  fclose($handle);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;header('Content-type: text/css');&lt;br /&gt;&lt;br /&gt;echo $css;&lt;/pre&gt;
&lt;p&gt;Hopefully you can find this useful, and be sure to let me know of any bugs or improvements you can find.&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/css-compressor</link><guid>http://coreyworrell.com/blog/article/css-compressor</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Tue, 23 Jun 09 15:27:31 -0700</pubDate><title>PHP Menu Builder</title><description>&lt;p&gt;&lt;img class="left" alt="PHP Menu Builder" src="http://coreyworrell.com/assets/uploads/images/menu_builder.gif" width="200" height="200" /&gt;PHP Menu Builder is a new class I just finished that allows you to easily build out a navigational menu. It outputs as an unordered list, and allows for as many levels as you want.&lt;/p&gt;
&lt;p&gt;You can add any HTML attributes to the main list, and sub-levels and active items are given classes according to their place in the list.&lt;/p&gt;
&lt;p&gt;&lt;a class="demo" href="/demo/php_menu_builder"&gt;View Demo &amp;amp; Documentation&lt;/a&gt;&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/php-menu-builder</link><guid>http://coreyworrell.com/blog/article/php-menu-builder</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Fri, 22 May 09 16:57:33 -0700</pubDate><title>Free High-Res T-Shirt Templates</title><description>&lt;p&gt;&lt;img class="full" alt="High-Res T-Shirt Templates" src="http://coreyworrell.com/assets/uploads/images/shirt_templates.jpg" width="539" height="363" /&gt;&lt;/p&gt;
&lt;p&gt;Here are some t-shirt templates that I created and have been using for display mock-ups and products on websites. They are all 300 dpi and about 2000 pixels square.&lt;/p&gt;
&lt;a name="more_5"&gt;&lt;/a&gt;
&lt;p&gt;The best part about them is that there is a color layer that is on top of the t-shirt that can easily be set to any color. The default blend mode works great with most colors, but you can tweak it if you need something different.&lt;br /&gt;And you can also throw in a background because each shirt has a transparent background.&lt;/p&gt;
&lt;p&gt;The download includes all three PSD files.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://coreyworrell.com/assets/uploads/files/shirt_templates.zip" class="download zip"&gt;Download (58 MB)&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Here are some previews of each shirt with the color layer activated.&lt;/p&gt;
&lt;h3&gt;Men's T-Shirt&lt;/h3&gt;
&lt;p&gt;&lt;img alt="Men's Shirt" src="http://coreyworrell.com/assets/uploads/images/t-shirt_template.png" width="539" height="480" /&gt;&lt;/p&gt;
&lt;h3&gt;Women's Shirt&lt;/h3&gt;
&lt;p&gt;&lt;img alt="Women's Shirt" src="http://coreyworrell.com/assets/uploads/images/womens_shirt_template.png" width="539" height="635" /&gt;&lt;/p&gt;
&lt;h3&gt;Long Sleeve Shirt&lt;/h3&gt;
&lt;p&gt;&lt;img alt="Long Sleeve" src="http://coreyworrell.com/assets/uploads/images/long_sleeve_template.png" /&gt;&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/free-high-res-t-shirt-templates</link><guid>http://coreyworrell.com/blog/article/free-high-res-t-shirt-templates</guid></item><item><author>corey@coreyworrell.com (Corey Worrell)</author><pubDate>Wed, 20 May 09 09:53:17 -0700</pubDate><title>2 Free Fonts</title><description>&lt;p&gt;I made these fonts probably about a year ago, and they were the first time I ever experimented with creating a font. They've been available since then on &lt;a href="http://dafont.com"&gt;dafont.com&lt;/a&gt; (as well as many others), but I just want to share them on my blog now.&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://www.dafont.com/lazy.font"&gt;Lazy&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://www.dafont.com/lazy.font"&gt;&lt;img class="full" alt="Lazy Font" src="http://www.dafont.com/img/illustration/l/a/lazy.png" width="539" height="192" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://www.dafont.com/sketchathon.font"&gt;Sketchathon&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a href="http://www.dafont.com/sketchathon.font"&gt;&lt;img class="full" alt="Sketchathon Font" src="http://www.dafont.com/img/illustration/s/k/sketchathon.jpg" width="539" height="249" /&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://coreyworrell.com/blog/article/2-free-fonts</link><guid>http://coreyworrell.com/blog/article/2-free-fonts</guid></item></channel></rss>
