<?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>Joey Rivera &#187; WordPress</title>
	<atom:link href="http://www.joeyrivera.com/category/categories/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joeyrivera.com</link>
	<description>Blogging about PHP, Actionscript, MySQL, and other interests.</description>
	<lastBuildDate>Wed, 04 Aug 2010 14:52:07 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Finally gave my blog a much needed face lift!</title>
		<link>http://www.joeyrivera.com/2010/finally-gave-my-blog-a-much-needed-face-lift/</link>
		<comments>http://www.joeyrivera.com/2010/finally-gave-my-blog-a-much-needed-face-lift/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 18:38:47 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/?p=513</guid>
		<description><![CDATA[So what do you guys think? Does it look better now? It is not finished, I still need to tweak some graphics and colors but overall I&#8217;m very pleased. I started out with a new theme: Arclite by digitalnature. It has many customization options so I haven&#8217;t had to do too much tweaking of the .css files [...]]]></description>
			<content:encoded><![CDATA[<p>So what do you guys think? Does it look better now? It is not finished, I still need to tweak some graphics and colors but overall I&#8217;m very pleased. I started out with a new theme: Arclite by <a href="http://digitalnature.ro/">digitalnature</a>. It has many customization options so I haven&#8217;t had to do too much tweaking of the .css files but there has been some. Since I blog so much about code, I finally stopped being lazy and got a code highlighter. I&#8217;m using: <a href="http://www.deanlee.cn/wordpress/code_highlighter_plugin_for_wordpress/">Dean&#8217;s Code Highlighter by</a> Dean Lee. It&#8217;s very easy to use and supports a range of different code syntax such as PHP and Actionscript. One of the reasons I decided to update my look was because I have been running an older version of WordPress and it was about time to upgrade. I&#8217;m now running 2.9.1 and it looks great. I really like the new admin back office and it is so easy to use and setup.</p>
<p>I also created my first widgets! The &#8216;Interesting Links&#8217; and &#8216;Interesting Images&#8217; on the sidebar are no longer hacks done on the themes sidebar.php file. I learned how to create a plugin in WordPress and make it into a widget. Here is what one of the widgets looks like:</p>
<div class="dean_ch" style="white-space: wrap;">
<span class="coMULTI">/*<br />
Plugin Name: JR-Images<br />
Plugin URI: http://www.joeyrivera.com<br />
Description: Show my images<br />
Version: 0.1<br />
Author: Joey Rivera<br />
Author URI: http://www.joeyrivera.com</p>
<p>&nbsp; Copyright 2010 &nbsp;Joey Rivera &nbsp;(email : joey1.rivera@gmail.com)</p>
<p>&nbsp; &nbsp; This program is free software; you can redistribute it and/or modify<br />
&nbsp; &nbsp; it under the terms of the GNU General Public License, version 2, as <br />
&nbsp; &nbsp; published by the Free Software Foundation.</p>
<p>&nbsp; &nbsp; This program is distributed in the hope that it will be useful,<br />
&nbsp; &nbsp; but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
&nbsp; &nbsp; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. &nbsp;See the<br />
&nbsp; &nbsp; GNU General Public License for more details.</p>
<p>&nbsp; &nbsp; You should have received a copy of the GNU General Public License<br />
&nbsp; &nbsp; along with this program; if not, write to the Free Software<br />
&nbsp; &nbsp; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA &nbsp;02110-1301 &nbsp;USA<br />
*/</span><br />
&nbsp;<br />
<span class="kw2">function</span> show_images<span class="br0">&#40;</span><span class="br0">&#41;</span> <br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/global"><span class="kw3">global</span></a> <span class="re0">$wpdb</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$query</span> = <span class="st0">&#8216;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SELECT image_file, image_origin, image_thumbnail<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FROM wp_images<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ORDER BY image_id DESC<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LIMIT 6&#8242;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$results</span> = <span class="re0">$wpdb</span>-&gt;<span class="me1">get_results</span><span class="br0">&#40;</span><span class="re0">$query</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>!<span class="re0">$results</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;&lt;li class=&quot;block widget widget_images&quot;&gt;&lt;div class=&quot;box&quot;&gt; &lt;div class=&quot;wrapleft&quot;&gt;&lt;div class=&quot;wrapright&quot;&gt;&lt;div class=&quot;tr&quot;&gt;&lt;div class=&quot;bl&quot;&gt;&lt;div class=&quot;tl&quot;&gt;&lt;div class=&quot;br the-content&quot;&gt;&lt;div class=&quot;titlewrap&quot;&gt;&lt;h4&gt;&lt;span&gt;Interesting Images&lt;/span&gt;&lt;/h4&gt;&lt;/div&gt;&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;&lt;ul class=&quot;blank&quot;&gt;&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">foreach</span><span class="br0">&#40;</span><span class="re0">$results</span> <span class="kw1">as</span> <span class="re0">$row</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;&lt;li&gt;&lt;a href=&quot;/uploader/sample/&#8217;</span> . <span class="re0">$row</span>-&gt;<span class="me1">image_file</span> . <span class="st0">&#8216;&quot; title=&quot;&#8217;</span> . <span class="re0">$row</span>-&gt;<span class="me1">image_origin</span> . <span class="st0">&#8216;&quot; rel=&quot;lightbox&quot;&gt;&lt;img src=&quot;/uploader/sample/&#8217;</span> . <span class="re0">$row</span>-/&gt;image_thumbnail . <span class="st0">&#8216;&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&#8217;</span>, <span class="st0">&quot;<span class="es0">\n</span>&quot;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;&lt;/ul&gt;&#8217;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span class="kw3">echo</span></a> <span class="st0">&#8216;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt;&lt;/li&gt;&#8217;</span>;<br />
<span class="br0">&#125;</span><br />
&nbsp;<br />
<span class="kw2">function</span> register_images<span class="br0">&#40;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; register_sidebar_widget<span class="br0">&#40;</span><span class="st0">&quot;JR-Images&quot;</span>, <span class="st0">&quot;show_images&quot;</span><span class="br0">&#41;</span>; &nbsp; &nbsp; <br />
<span class="br0">&#125;</span><br />
&nbsp;<br />
add_action<span class="br0">&#40;</span><span class="st0">&quot;plugins_loaded&quot;</span>, <span class="st0">&quot;register_images&quot;</span><span class="br0">&#41;</span>;</div>
<p>I had to go back to all my old posts and make updates. If you find any issues anywhere, please let me know so I can fix it asap. I&#8217;ve found instances in code where there should be two &amp;&amp; and instead the code blocks shows &amp;amp;&amp;amp;. I&#8217;m currently trying to figure out why my preview button doesn&#8217;t work, hopefully I&#8217;ll figure that out soon so I can move on to changing some colors around and finally updating my &#8216;About Me&#8217; page. I hope to have some content in that page by the end of this weekend. Other than that, I hope you all enjoy the new look and am looking forward to hearing some feedback!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2010/finally-gave-my-blog-a-much-needed-face-lift/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Uploader Phase 2 complete!</title>
		<link>http://www.joeyrivera.com/2008/uploader-phase-2-complete/</link>
		<comments>http://www.joeyrivera.com/2008/uploader-phase-2-complete/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 03:45:52 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uploader]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/?p=165</guid>
		<description><![CDATA[So today after work I decided it was about time to start working on phase two of my Uploader tool. Phase two consists of allowing me to drag and drop an image URL into the app so the app can then download the image to a folder in my server, create a thumbnail of this [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 157px"><img title="Uploader screen shot" src="/blog_files/96/uploader_ss.gif" alt="Here is a screen shot of the Uploader 0.1.0" width="147" height="172" /><p class="wp-caption-text">Uploader 0.2.0</p></div>
<p>So today after work I decided it was about time to start working on phase two of my Uploader tool. Phase two consists of allowing me to drag and drop an image URL into the app so the app can then download the image to a folder in my server, create a thumbnail of this image, and update the WordPress database with information about the new image. The new image would then show up the next time a person visits my blog. If you notice, there is now a &#8220;Pics of Interest&#8221; section on the sidebar to the right of the page (similar to what people are doing with the flickr plugin). Every time I drag an image URL into the Uploader, the new image thumbnail will show in that area and if you click on the thumbnail you&#8217;ll see the full size image.</p>
<p>It was actually much easier than I originally thought to make this work. Technically, the Uploader already has the drag/drop functionality and already takes in a URL. The only extra <a title="Main.as" href="http://www.joeyrivera.com/blog_files/165/Main.as" target="_blank">AS3 code</a> was a check to see if the URL was an image and if so call the PHP page with a code (I&#8217;m passing &#8211;@IMAGE@&#8211; to know it&#8217;s an image &#8211; it was just the first thing that came to my head) so then PHP knows this URL should be treated as an image not just a URL. If you remember, phase 1 for the Uploader allows a person to drag/drop a URL into the app so it creates a new link under the &#8220;Links of Interest&#8221;.<span id="more-165"></span></p>
<p>Most of the changes were on the PHP end. The file that handles the request from the AIR app now does a check to see if this URL is an image. If so, it has to download the original image to the local server, make a thumbnail copy of it, and finally update the wp_images table (this is a new table I created for this - <a title="MySQL create script" href="http://www.joeyrivera.com/blog_files/165/wp_images.sql" target="_blank">MySQL script</a>) in WordPress. I&#8217;m using two PEAR packages to do this: HTTP_Request and Image_Transform. The same can be done just as easily without them but I like using PEAR on my projects. Here&#8217;s the code that does this (<a title="index.php file as text" href="http://www.joeyrivera.com/blog_files/165/file.txt" target="_blank">file.txt</a>):</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw1">if</span><span class="br0">&#40;</span><span class="re0">$name</span> == <span class="st0">&#8216;&#8211;@IMAGE@&#8211;&#8217;</span><span class="br0">&#41;</span><br />
<span class="br0">&#123;</span><br />
&nbsp; &nbsp; <span class="co1">// later use unique names?</span><br />
    <span class="re0">$name</span> = <a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$url</span>, strripos<span class="br0">&#40;</span><span class="re0">$url</span>,<span class="st0">&#8216;/&#8217;</span><span class="br0">&#41;</span> + <span class="nu0">1</span><span class="br0">&#41;</span>;<br />
        <br />
&nbsp; &nbsp; <span class="kw1">require</span> <span class="st0">&#8216;HTTP/Request.php&#8217;</span>;<br />
    <span class="re0">$req</span> = <span class="kw2">new</span> HTTP_Request<span class="br0">&#40;</span><span class="re0">$url</span><span class="br0">&#41;</span>;<br />
    <span class="re0">$req</span>-&gt;<span class="me1">sendRequest</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;<br />
    <br />
&nbsp; &nbsp; <span class="re0">$fp</span> = <a href="http://www.php.net/fopen"><span class="kw3">fopen</span></a><span class="br0">&#40;</span><span class="st0">&#8216;images/&#8217;</span>.<span class="re0">$name</span>, <span class="st0">&#8216;w&#8217;</span><span class="br0">&#41;</span>;<br />
    <a href="http://www.php.net/fwrite"><span class="kw3">fwrite</span></a><span class="br0">&#40;</span><span class="re0">$fp</span>, <span class="re0">$req</span>-&gt;<span class="me1">getResponseBody</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
&nbsp;   <a href="http://www.php.net/fclose"><span class="kw3">fclose</span></a><span class="br0">&#40;</span><span class="re0">$fp</span><span class="br0">&#41;</span>;<br />
    <br />
&nbsp; &nbsp; <span class="co1">// create thumbnail</span><br />
    <span class="kw1">require</span> <span class="st0">&#8216;Image/Transform.php&#8217;</span>;</p>
<p>&nbsp;   <span class="co1">//create transform driver object</span><br />
&nbsp;   <span class="re0">$it</span> = Image_Transform::<span class="me2">factory</span><span class="br0">&#40;</span><span class="st0">&#8216;GD&#8217;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp;   <span class="co1">//load the original file</span><br />
&nbsp;   <span class="re0">$it</span>-&gt;<span class="me1">load</span><span class="br0">&#40;</span><span class="st0">&#8216;images/&#8217;</span>.<span class="re0">$name</span><span class="br0">&#41;</span>;</p>
<p>&nbsp;   <span class="co1">//scale it to 100px</span><br />
&nbsp;   <span class="re0">$it</span>-&gt;<span class="me1">scaleMaxLength</span><span class="br0">&#40;</span><span class="nu0">100</span><span class="br0">&#41;</span>;</p>
<p>&nbsp;   <span class="co1">//save it into a different file</span><br />
&nbsp;   <span class="re0">$tn</span> = <a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$name</span>,<span class="nu0">0</span>,strripos<span class="br0">&#40;</span><span class="re0">$name</span>,<span class="st0">&#8216;.&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="st0">&#8216;-tn.&#8217;</span>.<a href="http://www.php.net/substr"><span class="kw3">substr</span></a><span class="br0">&#40;</span><span class="re0">$name</span>,strripos<span class="br0">&#40;</span><span class="re0">$name</span>,<span class="st0">&#8216;.&#8217;</span><span class="br0">&#41;</span><span class="nu0">+1</span><span class="br0">&#41;</span>;<br />
&nbsp;   <span class="re0">$it</span>-&gt;<span class="me1">save</span><span class="br0">&#40;</span><span class="st0">&#8216;images/&#8217;</span>.<span class="re0">$tn</span><span class="br0">&#41;</span>;</p>
<p>&nbsp;   <span class="re0">$query</span> = <span class="st0">&#8216;<br />
&nbsp;           Insert Into wp_images<br />
&nbsp;           Values (null, &#8216;</span>.<span class="re0">$db</span>-&gt;<span class="me1">quote</span><span class="br0">&#40;</span><span class="re0">$name</span>, <span class="st0">&#8216;text&#8217;</span><span class="br0">&#41;</span>.<span class="st0">&#8216;, &#8216;</span>.<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$db</span>-&gt;<span class="me1">quote</span><span class="br0">&#40;</span><span class="re0">$tn</span>, <span class="st0">&#8216;text&#8217;</span><span class="br0">&#41;</span>.<span class="st0">&#8216;, &#8216;</span>.<span class="re0">$db</span>-&gt;<span class="me1">quote</span><span class="br0">&#40;</span><span class="re0">$url</span>, <span class="st0">&#8216;text&#8217;</span><span class="br0">&#41;</span>.<span class="st0">&#8216;);<br />
}</span></div>
<p>Then I had to add some code to the sidebar.php for my template in WordPress to show the new section &#8220;Pics of Interest&#8221;. As you read this keep in mind this is just a quick beta and I&#8217;ll be doing refactoring later. This is by no means a finished product but it works fine and it&#8217;s a good start for anyone who wants to try it out. This is the new code I added to my <a title="sidebar.php" href="http://www.joeyrivera.com/blog_files/165/sidebar.txt" target="_blank">sidebar.php</a>:</p>
<div class="dean_ch" style="white-space: wrap;">&lt;div <span class="kw2">class</span>=<span class="st0">&quot;block poi&quot;</span>&gt;<br />
&nbsp;       &lt;h3&gt;Pics of Interest&lt;/h3&gt;<br />
&nbsp;       <span class="kw2">&lt;?php</span><br />
&nbsp;               <span class="kw1">require</span> <span class="st0">&#8216;./uploader/lib/DB.php&#8217;</span>;<br />
&nbsp;               DB::<span class="me2">conn</span><span class="br0">&#40;</span><span class="st0">&#8216;live&#8217;</span><span class="br0">&#41;</span>;<br />
&nbsp;               <span class="re0">$db</span> = DB::<span class="me2">getInstance</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp;               <span class="re0">$query</span> = <span class="st0">&#8216;<br />
&nbsp;                       Select image_file, image_thumbnail, image_origin<br />
&nbsp;                       From wp_images<br />
&nbsp;                       Order By image_id desc<br />
&nbsp;                       Limit 6;<br />
&nbsp;                       &#8217;</span>;</p>
<p>&nbsp;               <span class="re0">$rs</span> = <span class="re0">$db</span>-&gt;<span class="me1">query</span><span class="br0">&#40;</span><span class="re0">$query</span><span class="br0">&#41;</span>;<br />
&nbsp;               <span class="kw1">while</span><span class="br0">&#40;</span><span class="re0">$row</span> = <span class="re0">$rs</span>-&gt;<span class="me1">fetchRow</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/print"><span class="kw3">print</span></a> <span class="st0">&#8216;&lt;a href=&quot;/uploader/images/&#8217;</span>.<span class="re0">$row</span><span class="br0">&#91;</span><span class="st0">&#8216;image_file&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&#8216;&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title=&quot;From: &#8216;</span>.<span class="re0">$row</span><span class="br0">&#91;</span><span class="st0">&#8216;image_origin&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&#8216;&quot;&gt;&lt;img<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src=&quot;/uploader/images/&#8217;</span>.<span class="re0">$row</span><span class="br0">&#91;</span><span class="st0">&#8216;image_thumbnail&#8217;</span><span class="br0">&#93;</span>.<span class="st0">&#8216;&quot; /&gt;&lt;/a&gt;&#8217;</span>;<br />
&nbsp;       <span class="kw2">?&gt;</span><br />
&lt;/div&gt;</div>
<p>The last thing I had to do was to add the style for my images in the styles.css file and I was done. Make sure your images folder has the proper privileges so you can upload an image into it. The next phase will be allowing me to drag files from my local file system into the AIR app so it&#8217;ll upload it to my server. Right now the Uploader only does something when a URL is dropped on it: adds a link if it&#8217;s not a image, adds the image if it&#8217;s an image.</p>
<p>Question, comments, conerns are always welcome!</p>
<p>Edit:</p>
<p><a title="Info about Uploader Phase 1" href="http://www.joeyrivera.com/2008/uploader-phase-1/" target="_self">Uploader Phase 1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2008/uploader-phase-2-complete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joey&#8217;s WordPress Setup</title>
		<link>http://www.joeyrivera.com/2008/joeys-wordpress-setup/</link>
		<comments>http://www.joeyrivera.com/2008/joeys-wordpress-setup/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 16:28:46 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/blog/?p=58</guid>
		<description><![CDATA[I&#8217;m going to list the changes I&#8217;ve made to WordPress to look and function the way it is today. This will probably change over time, but I feel as if it&#8217;s working pretty well right now. This information is for anyone trying to create something similar and for me to use as reference later if [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m going to list the changes I&#8217;ve made to WordPress to look and function the way it is today. This will probably change over time, but I feel as if it&#8217;s working pretty well right now. This information is for anyone trying to create something similar and for me to use as reference later if I need to recreate this again.</p>
<p>The theme I&#8217;m using is <a title="Devart Theme Link" href="http://wordpress.org/extend/themes/devart" target="_blank">Devart</a> by <a title="Deniart - Author of Devart" href="http://wordpress.org/extend/themes/profile/deniart" target="_blank">deniart</a>. The few mods I&#8217;ve made to this theme are:</p>
<ul>
<li>Edited the /wp-content/themes/devart/images/author.gif (to show my pic instead of the default apple)</li>
<li>Modified the /wp-content/themes/devart/style.css to change the way &lt;code&gt;, &lt;ul&gt;, &lt;li&gt; look</li>
<li>Modified the style.css to add my twitter logo and link on the top right hand side of the page</li>
<li>Modified the header.php page to add my twitter logo and link to the top right hand side of the page</li>
<li>Had to add &lt;?php wp_footer(); ?&gt; to footer.php to launch stats code</li>
<li>Added img#wpstats{display:none} to style.css to hide the <img src='http://www.joeyrivera.com/blog_new/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  from stats plugin</li>
</ul>
<p>I&#8217;ve also done the following to my setup:</p>
<ul>
<li>Followed these instructions to make my blog be at the root: <a href="http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory" target="_blank">http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory</a></li>
<li>Installed the following stats plugin: <a href="http://wordpress.org/extend/plugins/stats/" target="_blank">http://wordpress.org/extend/plugins/stats/</a></li>
<li>Change &#8216;blog roll&#8217; to &#8216;Links of Interest&#8217; (displays all links under links category)</li>
<li>Installed <a href="http://lesterchan.net/wordpress/readme/wp-postviews.html" target="_blank">http://lesterchan.net/wordpress/readme/wp-postviews.html</a> to show how many views each page/post has received. Made the modifications required for this to show and work. Also modified the view_options in db to format the text a bit differently.</li>
<li>Installed the <a title="Google Analytics Plugin for WordPress" href="http://wordpress.org/extend/plugins/google-analytics-for-wordpress/" target="_blank">Google Analytics plugin</a> and created an account with them.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2008/joeys-wordpress-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uploader Phase 1</title>
		<link>http://www.joeyrivera.com/2008/uploader-phase-1/</link>
		<comments>http://www.joeyrivera.com/2008/uploader-phase-1/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 15:49:47 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uploader]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress tools]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/?p=96</guid>
		<description><![CDATA[If you missed the previous post explaining what Uploader is go check it out.
So after having some fun with code I think I&#8217;m close to being done with phase 1.  I currently have a working beta (0.1.0) that I&#8217;m going to share with you all and explain what I&#8217;ve done in case anyone else wants [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 157px"><img title="Uploader screen shot" src="/blog_files/96/uploader_ss.gif" alt="Here is a screen shot of the Uploader 0.1.0" width="147" height="172" /><p class="wp-caption-text">Uploader 0.1.0</p></div>
<p>If you missed the previous post explaining what Uploader is go <a title="About the uploader" href="http://www.joeyrivera.com/2008/uploader-automating-wordpress-links-and-file-uploads/" target="_self">check it out</a>.</p>
<p>So after having some fun with code I think I&#8217;m close to being done with phase 1.  I currently have a working beta (0.1.0) that I&#8217;m going to share with you all and explain what I&#8217;ve done in case anyone else wants to do something similar.  For the most part this was pretty straight forward.  There were a few hiccups here and there that I&#8217;ll try to address in this post. The link to the code will be at the end.</p>
<p> <span id="more-96"></span></p>
<p>First I looked online for some info on Drag/Drop in AIR and I found these two posts that I used for reference:</p>
<ul>
<li><a href="http://www.senocular.com/air/tutorials/dragdropimageviewer/" target="_blank">http://www.senocular.com/air/tutorials/dragdropimageviewer/</a></li>
<li><a href="http://www.mikechambers.com/blog/2007/11/07/air-example-native-drag-and-drop/" target="_blank">http://www.mikechambers.com/blog/2007/11/07/air-example-native-drag-and-drop/</a></li>
</ul>
<p>I should have read the comments in those post since they answer the question of using &#8216;NativeDragManager&#8217; instead of &#8216;DragManager&#8217;.  I had that issue and had to figure out why it wasn&#8217;t working.</p>
<p>This is an AIR app made in Flash.  So far I only have one &#8216;Main&#8217; class taking care of most of the action.  I&#8217;ll clean the code up later and comment it but here&#8217;s the <a title="Main.as file" href="http://www.joeyrivera.com/blog_files/96/com/joeyrivera/uploader/Main.as" target="_blank">class</a> so far. Using the &#8216;NativeDragEvent&#8217;, Uploader waits for something to be dragged over it.  When it does, &#8216;dragEnter&#8217; is called. Usually you can do some validation here to see if this is a file type you want to accept but I just do that later.  Before a file/URL can be dropped you need to call &#8216;NativeDragManager.acceptDragDrop(<em>object</em>)&#8217;. By doing this, you let AIR know that the object is ready to accept the drop.</p>
<p>Once an item is dropped, &#8216;dragDrop&#8217; is called to see if this is a file or a URL.  If URL, &#8216;urlDropped&#8217; is called which creates a listener for the loader var and sends the request to the URL that was dropped on the app.  When the request is complete, &#8216;urlLoaded&#8217; is called.  The reason we are loading the dropped URL is so we can grab the title of that page in between the &lt;title&gt; tag of the html.  This is going to be used as the display name when we insert the new link in WordPress. &#8216;grabTitle&#8217; does a quick substr and when all is done we do one last request.  I had to make sure to remove the listener on &#8216;loader&#8217; for &#8216;urlLoaded&#8217; since later when I make a new listener and request, both the new and old listeners were triggering (so make sure to remove a listener from a loader if you are going to reuse that var with a different event call back).</p>
<p>&#8216;SERVER&#8217; is the constant that needs to by modified to point to the correct PHP page that will insert the link to the WordPress DB.  &#8217;urlLoaded&#8217; finishes by sending two variables to the SERVER page, &#8216;name&#8217; and &#8216;url&#8217;. After the request is loaded, the &#8217;serverUpdated&#8217; function will display if the process was successful or not based on what is returned by the PHP page.</p>
<p>That&#8217;s pretty much it for the AS3 code.  The PHP file is much more light weight.  At first I had PHP request the HTML for the URL and strip out the title but after thinking about it, it makes more sense to put that burden on the client and not the server so I moved the code to Flash.</p>
<p>The <a title="PHP Code file" href="http://www.joeyrivera.com/blog_files/96/file.html" target="_blank">PHP code</a> starts out by checking for the two needed variables &#8216;url&#8217; and &#8216;name&#8217;.  There&#8217;s a tiny bit of validation going on, definitely more to come as well as implementing some security features since at the moment anyone can submit variables to this page if they know the URL.  (<em>Before posting this, I decided to add a quick security check for now which will see if the remote IP address matches a couple different valid IP address &#8211; such as my home or work PC &#8211; and if it does, it will continue executing</em> ) Then we make a DB connection to the WordPress DB. I have a standard DB class I use, just use regular <a title="php.net mysql_connect info" href="http://us2.php.net/mysql_connect" target="_blank">mysql_connect</a> instead (ask if you need help with this). Next is the query to insert the data into the &#8216;wp_links&#8217; table.  I kept the name default during my WordPress install, so the table name might be different for others. And at last, the query is executed and true is returned. The assumption is if we make it down that far everything worked correctly.  Like I said, I need to add more validation and security but that will be later&#8230; maybe phase 2 or 3.</p>
<p>The only issue I&#8217;m having now that I can&#8217;t seem to figure out is where the WordPress DB tracks what category a link is attached to?  When I log into the WordPress admin area and go to manage links, all the links I&#8217;m inserting using this method don&#8217;t show anything under &#8216;Categories&#8217;. I&#8217;m assuming this information isn&#8217;t in the &#8216;wp_links&#8217; table?  If anyone has an answer to this, please let me know.</p>
<p>Here is a <a title="FLA, Main.as, PHP file, and AIR xml file" href="http://www.joeyrivera.com/blog_files/96/Uploader_0.1.0.zip">zip</a> of all the files (FLA, PHP file, Main class, and AIR xml).  Make sure to edit the ActionScript &#8216;SERVER&#8217; const and DB info in the PHP file.</p>
<p>* Quick side note, I need to give credit to my fiance Ashley who created a quick graphic for me to use last night. Visit her <a title="Ashley Fleishel" href="http://www.ashleyfleishel.com" target="_blank">site</a> to see some of her work.</p>
<p>EDIT:</p>
<p>I forgot to mention I made some edits to the Uploader-app.xml file. These settings were to remove the system chrome and make the app window transparent. More information about these settings can be found at <a title="Information about AIR" href="http://help.adobe.com/en_US/AIR/1.5/devappsflash/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff1.html" target="_blank">help.adobe.com</a>.</p>
<p><a title="Uploader Phase 2 done!" href="http://www.joeyrivera.com/2008/uploader-phase-2-complete/" target="_self">Uploader Phase 2 complete</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2008/uploader-phase-1/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Uploader: Automating WordPress Links and File Uploads</title>
		<link>http://www.joeyrivera.com/2008/uploader-automating-wordpress-links-and-file-uploads/</link>
		<comments>http://www.joeyrivera.com/2008/uploader-automating-wordpress-links-and-file-uploads/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 01:12:41 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[AIR]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uploader]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wordpress links]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/?p=93</guid>
		<description><![CDATA[So now that I&#8217;m starting to get my WordPress and new hosting server settled in I&#8217;m trying to think of what I can create to help me automate some tasks. One of the things I know I&#8217;ll be doing quite often is adding new links to the &#8216;Links of Interest&#8217; on the front page.  I&#8217;ll [...]]]></description>
			<content:encoded><![CDATA[<p>So now that I&#8217;m starting to get my WordPress and new hosting server settled in I&#8217;m trying to think of what I can create to help me automate some tasks. One of the things I know I&#8217;ll be doing quite often is adding new links to the &#8216;Links of Interest&#8217; on the front page.  I&#8217;ll also be uploading files/images to use on posts or to share with others but I&#8217;m too lazy to be ftping files constantly. So&#8230; time for a new tool!</p>
<p>The Uploader (yeah I know, I&#8217;m very creative) is going to do all the above for me. This will be a app I can keep running on my desktop somewhere and when I need to upload a file or link I can just drag it over and drop it in. The tool will then figure out what kind of item was dropped in and what to do with it.</p>
<p>Phase 1 will handle the links. The way the tool should work for links is the following.  I visit a page that I find interesting and want to add to the &#8216;Links of Interest&#8217;.  Instead of logging into WordPress to create it, I highlight the link from the address bar of the browser, drag it over to the app, and drop it. Now the app needs to figure out the &lt;title&gt; of that page to use as the name since we need a name and url to create a link. Once it has that, the tool will send the information to a PHP page which will do an insert to the links table in the WordPress DB.  </p>
<p>Phase 2 will deal with images and files. I may break phase 2 into two since I may do some stuff differently with images versus other files.  I&#8217;m thinking I may want to upload images, create a thumbnail, and insert to a DB to display in the front page the same way some people do with their flickr images. Other files I would just upload and store somewhere else.  I&#8217;ll give this more thought when I get to it.</p>
<p>I&#8217;m going to be writing the tool in Flash CS3/AIR with PHP in the backend using the current WordPress MySQL DB.  Stay tuned for updates!</p>
<p>EDIT:</p>
<p><a title="Uploader Phase 1 done" href="http://www.joeyrivera.com/2008/uploader-phase-1/" target="_self">Uploader Phase 1 completed</a> <br />
<a title="Uploader Phase 2 done" href="http://www.joeyrivera.com/2008/uploader-phase-2-complete/" target="_self"> Uploader Phase 2 completed</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2008/uploader-automating-wordpress-links-and-file-uploads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rtl.css?</title>
		<link>http://www.joeyrivera.com/2008/rtlcss/</link>
		<comments>http://www.joeyrivera.com/2008/rtlcss/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 19:09:43 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/blog/?p=39</guid>
		<description><![CDATA[So I&#8217;m still learning to use WordPress and decided to style the default theme a bit.  I went to the theme folder and opened up the first CSS file I found which was &#8216;rtl.css&#8217;.  I added a background color to the &#60;code&#62; tag, saved the file, and refreshed my page&#8230; nothing. Tried it [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;m still learning to use WordPress and decided to style the default theme a bit.  I went to the theme folder and opened up the first CSS file I found which was &#8216;rtl.css&#8217;.  I added a background color to the &lt;code&gt; tag, saved the file, and refreshed my page&#8230; nothing. Tried it again and nothing. I went back to the theme folder and noticed a &#8217;style.css&#8217; file. Opened that up, made changes to the &lt;code&gt; tag, saved and reloaded and it worked! So what&#8217;s this &#8216;rtl.css&#8217; file? A quick Google search gave me the following answer:</p>
<blockquote><p>&#8220;rtl.css is called when you are using a language localization that reads from right to left (e.g., Arabic or Hebrew).&#8221; &#8211; <a title="what is rtl.css" href="http://wordpress.org/support/topic/136250">source</a></p></blockquote>
<p>Well now I know and so do you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2008/rtlcss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up my WordPress</title>
		<link>http://www.joeyrivera.com/2008/setting-up-my-wordpress/</link>
		<comments>http://www.joeyrivera.com/2008/setting-up-my-wordpress/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 19:02:13 +0000</pubDate>
		<dc:creator>Joey</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.joeyrivera.com/blog/?p=23</guid>
		<description><![CDATA[So I&#8217;m using WordPress for the first time and I&#8217;m quickly learning that it&#8217;s neat and fun to play around with.  The documentation seems good and the code easy to work with.  I&#8217;m going to be tracking all the changes I make to the default installation of version 2.6.3 for reference.  I may need this [...]]]></description>
			<content:encoded><![CDATA[<p>So I&#8217;m using <a title="WordPress site" href="http://www.wordpress.org">WordPress</a> for the first time and I&#8217;m quickly learning that it&#8217;s neat and fun to play around with.  The documentation seems good and the code easy to work with.  I&#8217;m going to be tracking all the changes I make to the default installation of version 2.6.3 for reference.  I may need this information later or someone else might find helpful.</p>
<p>So far I am using the default theme.  I&#8217;m sure I&#8217;ll eventually change it but for now I&#8217;m just trying to understand how things are structured and how to tweak elements on screen.  The <a title="List of functions for WordPress" href="http://codex.wordpress.org/Function_Reference">WordPress Function Reference</a> page was a great place to start.  My first goal was to figure out how to get my sidebar to display a list of projects and topics.  In the admin, I created a root level category called &#8216;Topics&#8217; and another one called &#8216;Projects&#8217;.  Then I created a few other categories that were under either topics or projects such as &#8216;Flash&#8217;, &#8216;Cars&#8217;, &#8216;PHP&#8217;.</p>
<p><span id="more-23"></span></p>
<p>I was trying to make my side bar look something like this:</p>
<div>Topics</div>
<ul>
<li>Flash</li>
<li>PHP</li>
<li>General</li>
</ul>
<div>Projects</div>
<ul>
<li>QAlias</li>
<li>Car</li>
</ul>
<p>Unfortunately, once I reloaded my page I didn&#8217;t get these results.  Instead, I had a root level element titled &#8216;Categories&#8217; and the links under it were my sub topics.  After talking to <a title="moses' website" href="http://www.mospired.com/">Moses</a>, he explained the concept of widgets and I guess currently the default theme is using a categories widget that isn&#8217;t doing what I need it to do.  So, I went back to the admin, clicked on &#8216;Design&#8217;, finally on &#8216;Widgets&#8217;.  On the right side of the page, it showed I was using a &#8216;Categories&#8217; widget so I removed it since I didn&#8217;t see any options to modify it from here to do what I wanted.  I think this would be the right time to mention I like coding so I (depending on time constraints and the project) rather figure things out myself than to ask and/or find a guide online.   it makes things more fun &#8211; ok, back to the topic.</p>
<p>After removing the &#8216;Category&#8217; widget I had to modify the &#8217;sidebar.php&#8217; file located at &#8216;wordpress root/wp-content/themes/default/&#8217; to add my &#8216;Topics&#8217; and &#8216;Projects&#8217; lists.  I opened the file and looked over it to see what it&#8217;s doing.  It&#8217;s pretty much just one big &lt;ul&gt; with a bunch of checks to see what needs to be displayed.  I went to the bottom of the file to add my two new &lt;li&gt;&#8217;s in there.  Using the functions reference list, I found a function called &#8216;<a title="list categories function" href="http://codex.wordpress.org/Template_Tags/wp_list_categories">wp_list_categories</a>&#8216;.  By using the &#8216;child_of&#8217; parameter, I was able to get a list of all the sub topics for a particular topic.  My code looked something like this:</p>
<p><code>&lt;!-- topic --&gt;<br />
&lt;li&gt;<br />
&lt;h2&gt;Topics&lt;/h2&gt;<br />
&lt;ul&gt;&lt;?php wp_list_categories('orderby=name&amp;show_count=1&amp;use_desc_for_title=0&amp;child_of=1&amp;title_li='); ?&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;!-- project --&gt;<br />
&lt;li&gt;<br />
&lt;h2&gt;Projects&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;?php wp_list_categories('orderby=name&amp;show_count=1&amp;use_desc_for_title=0&amp;child_of=2&amp;title_li='); ?&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;</code> <br />
To get the id value for the &#8216;child_of&#8217; parameter, I just went to the admin and clicked on &#8216;Manage&#8217; and &#8216;Categories&#8217;.  Then you can move the mouse over the categories and in the status bar of your browser see if the cat_id for each category.  After a bit of researched, I found out that if you pass &#8216;title_li=&#8217; with no value, the function won&#8217;t return a &#8216;Category&#8217; title attached to the list of sub topics.  Before this, the list returned by the &#8216;wp_list_categories&#8217; function was &#8216;Categories-&gt;Flash/PHP/Other&#8217;.  With &#8216;title_li=&#8217; the return value is just the sub topics &#8216;Flash/PHP/Other&#8217;.</p>
<p>After hitting reload on my browser, my sidebar was displaying correctly but something was bothering me.  I was hard coding the title of the categories and I didn&#8217;t like that.  As you can see the code above, the &lt;h2&gt;&#8217;s have the names of the categories hard coded.  This to me is a big no no so I did some browsing around the list of functions in WordPress and found &#8216;get_cat_name(id)&#8217;.  Now I&#8217;m using this function and passing the correct id&#8217;s and I&#8217;m feeling better about the end result.  Final code is:</p>
<p><code>&lt;!-- topic --&gt;<br />
&lt;li&gt;<br />
&lt;h2&gt;&lt;?php print get_cat_name(1); ?&gt;&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;?php wp_list_categories('orderby=name&amp;show_count=1&amp;use_desc_for_title=0&amp;child_of=1&amp;title_li='); ?&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;<br />
&lt;!-- project --&gt;<br />
&lt;li&gt;<br />
&lt;h2&gt;&lt;?php print get_cat_name(2); ?&gt;&lt;/h2&gt;<br />
&lt;ul&gt;<br />
&lt;?php wp_list_categories('orderby=name&amp;show_count=1&amp;use_desc_for_title=0&amp;child_of=2&amp;title_li='); ?&gt;<br />
&lt;/ul&gt;<br />
&lt;/li&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.joeyrivera.com/2008/setting-up-my-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
