<?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>devness &#187; Wordpress</title>
	<atom:link href="http://devness.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://devness.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Wed, 01 Jul 2009 21:41:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Forcing Letter Case with CSS and jQuery</title>
		<link>http://devness.com/2009/06/forcing-letter-case-with-css-and-jquery/</link>
		<comments>http://devness.com/2009/06/forcing-letter-case-with-css-and-jquery/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 21:49:33 +0000</pubDate>
		<dc:creator>dmoena</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[force letter case]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[lower case]]></category>
		<category><![CDATA[upper case]]></category>

		<guid isPermaLink="false">http://devness.com/?p=45</guid>
		<description><![CDATA[
.upper {text-transform:uppercase;} .lower {text-transform:lowercase;} 
Try this two forms. Both force letter case, but only one of them will send to the server exactly what you see (in terms of lower and upper case).










See? Now, let me explain what just happen and how to avoid the first situation.

Explanation
In each form we just force letter casing by [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript" src="http://devness.com/wp-content/uploads/2009/06/casingdemo.js"></script></p>
<style>.upper {text-transform:uppercase;} .lower {text-transform:lowercase;} </style>
<p>Try this two forms. Both force letter case, but only one of them will send to the server exactly what you see (in terms of lower and upper case).</p>
<form id="nocaseform">
<input type="text" class="upper" name="upper"/>
<input type="text" class="lower" name="lower"/>
<input type="submit" value="Non-cased Form"/>
</form>
<form id="caseform">
<input type="text" class="upper" name="upper"/>
<input type="text" class="lower" name="lower"/>
<input type="submit" value="Cased Form"/>
</form>
<p>See? Now, let me explain what just happen and how to avoid the first situation.</p>
<p><span id="more-45"></span></p>
<h2>Explanation</h2>
<p>In each form we just force letter casing by using CSS. In this case, inputs with the &#8220;upper&#8221; class will be upper cased and those with the &#8220;lower&#8221; class will be lower cased.</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="re1">.upper</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; text-transform<span class="re2">:uppercase</span>;<br />
<span class="br0">&#125;</span></p>
<p><span class="re1">.lower</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; text-transform<span class="re2">:lowercase</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>The problem is that we get only the impression of lower and/or upper case, but we will actually send data cased as the user has entered. This means that even when you see &#8220;ABCD&#8221; you could actually receive &#8220;aBCd&#8221; at the server. I know, is not a big deal since you can (and should) force casing at server side, but sometimes you just want to be sure that your data is sent with the propper format.</p>
<h2>A solution</h2>
<p>So, how to solve this? jQuery (jQuery makes this easier, but you can use plain JavaScript too). You just need to add this code (plus the previous CSS one) to intercept any form submit, force propper and effective data casing and then continue with the sumbit process.</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;">&lt;script type=<span class="st0">&quot;text/javascript&quot;</span>&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&quot;form&quot;</span><span class="br0">&#41;</span>.<span class="me1">submit</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;.upper&quot;</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">val</span><span class="br0">&#40;</span>String<span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">val</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">toUpperCase</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; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">&quot;.lower&quot;</span><span class="br0">&#41;</span>.<span class="me1">each</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">val</span><span class="br0">&#40;</span>String<span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>.<span class="me1">val</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>.<span class="me1">toLowerCase</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; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;<br />
&lt;/script&gt;</div>
</div>
<p>Simple, but useful in case you are working with casing.</p>
]]></content:encoded>
			<wfw:commentRss>http://devness.com/2009/06/forcing-letter-case-with-css-and-jquery/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Livegets: update any WordPress Widget in real time</title>
		<link>http://devness.com/2009/06/livegets-update-any-wordpress-widget-in-real-time/</link>
		<comments>http://devness.com/2009/06/livegets-update-any-wordpress-widget-in-real-time/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 21:43:54 +0000</pubDate>
		<dc:creator>dmoena</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Livegets]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[real time widgets]]></category>

		<guid isPermaLink="false">http://devness.com/?p=34</guid>
		<description><![CDATA[
hello world! -not too original, but I had to do it- Let me tell you about Livegets. What is it? Well, Livegets is a Worpress plugin for enabling real time updates for any Wordpress widget. Any widget? Any.
Why? Because real time widget update would be useful for visitors to know what is happening at any [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft" title="wordpress-logo" src="http://devness.com/wp-content/uploads/2009/06/wordpress-logo.gif" alt="wordpress-logo" width="200" height="200" /></p>
<p>hello world! -not too original, but I had to do it- Let me tell you about Livegets. What is it? Well, Livegets is a Worpress plugin for enabling real time updates for any Wordpress widget. Any widget? Any.</p>
<p>Why? Because real time widget update would be useful for visitors to know what is happening at any time in your blog.</p>
<p>Picture this: a visitor is reading an specific post at your site and you add a new one. Without Livegets, your visitor will probably leave the site if the current post is the lastest at the time he/she arrives. Now, with Livegets he/she will know there is a new post and will probably visit it.</p>
<p>Another example? Think about a &#8220;Top 10 Something&#8221; widget. Would be great to offer real time updates, don&#8217;t you think?</p>
<p><span id="more-34"></span></p>
<h2 style="clear:both;padding-top:2px;">Installation</h2>
<p>Livegets installation is divided into two steps: plugin installation as any other plugin and an small modification of a Wordpress core file&#8230; I know it sounds painfull, but is really simple.</p>
<p>Lets start with the &#8220;core&#8221; part. For this, we need to modify just one file ir order to fully integrate Livegets to your Wordpress installation. The file we need to edit is located into wp-includes and it&#8217;s named &#8220;widgets.php&#8221;.</p>
<p>Its modification is pretty simple: just locate dynamic_sidebar function (around line 433 for Wordpress 2.7.1 and 808 for 2.8) inside of &#8220;widgets.php&#8221; and find this code (line 477 and 855 respectively)</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="kw1">if</span> <span class="br0">&#40;</span> <a href="http://www.php.net/is_callable"><span class="kw3">is_callable</span></a><span class="br0">&#40;</span><span class="re0">$callback</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/call_user_func_array"><span class="kw3">call_user_func_array</span></a><span class="br0">&#40;</span><span class="re0">$callback</span>, <span class="re0">$params</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; <span class="re0">$did_one</span> = <span class="kw2">true</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p>once you have it, change the previous code for this one</p>
<div class="codesnip-container" >
<div class="codesnip" style="font-family: monospace;"><span class="re0">$widgets</span> = <a href="http://www.php.net/explode"><span class="kw3">explode</span></a><span class="br0">&#40;</span><span class="st0">&quot;,&quot;</span>,get_option<span class="br0">&#40;</span><span class="st0">&quot;livegets&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>;<br />
<span class="kw1">if</span> <span class="br0">&#40;</span> <a href="http://www.php.net/is_callable"><span class="kw3">is_callable</span></a><span class="br0">&#40;</span><span class="re0">$callback</span><span class="br0">&#41;</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/in_array"><span class="kw3">in_array</span></a><span class="br0">&#40;</span><span class="re0">$id</span>,<span class="re0">$widgets</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span> <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;script type=<span class="st0">&quot;text/javascript&quot;</span>&gt; widgets.push<span class="br0">&#40;</span><span class="st0">&quot;&lt;?php echo $id; ?&gt;&quot;</span><span class="br0">&#41;</span>; <span class="kw2">&lt;/script&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;script type=<span class="st0">&quot;text/javascript&quot;</span>&gt; widgets_name<span class="br0">&#91;</span><span class="st0">&quot;&lt;?php echo $id; ?&gt;&quot;</span><span class="br0">&#93;</span> = <span class="st0">&quot;&lt;?php echo get_option($id.&quot;</span>_updated_text<span class="st0">&quot;); ?&gt;&quot;</span>; <span class="kw2">&lt;/script&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;span id=<span class="st0">&quot;&lt;?php echo $id; ?&gt;&quot;</span>&gt;&lt;?php<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/call_user_func_array"><span class="kw3">call_user_func_array</span></a><span class="br0">&#40;</span><span class="re0">$callback</span>, <span class="re0">$params</span><span class="br0">&#41;</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span><a href="http://www.php.net/in_array"><span class="kw3">in_array</span></a><span class="br0">&#40;</span><span class="re0">$id</span>,<span class="re0">$widgets</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span> <span class="kw2">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/span&gt;&lt;?php<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$did_one</span> = <span class="kw2">true</span>;<br />
<span class="br0">&#125;</span></div>
</div>
<p><img class="alignleft" style="margin-bottom:16px" title="livegets_config" src="http://devness.com/wp-content/uploads/2009/06/livegets_config.png" alt="Livegets Config" width="145" height="229" /></p>
<p>Plugin installation is like the usual thing: decompress livegets into the Wordpress&#8217; plugin directory. Just be sure the final plugin route is like &#8220;&#8230;/plugins/livegets/livegets.php&#8221;.</p>
<p>Once activated, you will see Livegets Configuration options as part of Wordpress&#8217; Settings, just like in the example image.</p>
<p>We are done! Now you just need to select the widgets that will be real time widegts or  Livegets and fill its updated text if you want it. After that, Livegets plugin and jQuery will do the rest.</p>
<p>Oh, one more thing! Choose only those widgets which worth to make Livegets, that means, those that reports some kind of &#8220;last activity&#8221; &#8211; last comments, last posts&#8230; &#8211; otherwise, you will be stressing out your server and bandwith for no reason.</p>
<h2 style="clear:both;padding-top:12px;">Demo</h2>
<p>You can simulate an update for the &#8220;Recent Posts&#8221; widget by clicking right <a href="#" id="livegets_demo">here</a>. What you see -or will see- is only a <a href="http://www.stanlemon.net/projects/jgrowl.html">jGrowl notification</a>, but when it happens for real, you can see the widget actually updated and you are enable to visit the new event(s) if you want to.<br />
<script type="text/javascript"> 
$(document).ready(function(){
    $('#livegets_demo').click(function(){
        $.jGrowl('<a href="#recent-posts-3">New post added</a>');
        return false;
    });
});
</script></p>
<h2 style="clear:both;padding-top:12px;">Restrictions</h2>
<p>At this time, I found problems with themes where widget&#8217;s content is manipulated after being sent. For instance, when you use JavaScript to create rounded corners. So, check this before you use it.</p>
<h2>Download</h2>
<p>You can download this plugin <a href="http://devness.com/wp-content/uploads/2009/06/livegets.rar">right here</a>.</p>
<h2>Finally</h2>
<p>If you find any kind of error, please let me know. The better way is probably by leaving a comment&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://devness.com/2009/06/livegets-update-any-wordpress-widget-in-real-time/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
