<?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>lautr.com &#187; development</title>
	<atom:link href="http://www.lautr.com/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lautr.com</link>
	<description>Hannes Blog for Development and Stuff besides</description>
	<lastBuildDate>Thu, 19 Jan 2012 17:58:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>jquery slug plugin for input fields</title>
		<link>http://www.lautr.com/jquery-slug-plugin-for-input-fields/</link>
		<comments>http://www.lautr.com/jquery-slug-plugin-for-input-fields/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 09:33:32 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[java script]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sideblog]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[input]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[slug]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=336</guid>
		<description><![CDATA[A small jQuery Plugin i wrote to slug input fields, enjoy; (function( $ ){ function stringToSlug(str){ str = str.replace(/^\s+&#124;\s+$/g, &#039;&#039;); // trim str = str.toLowerCase(); // remove accents, swap ñ for n, etc var from = &#34;àáäâèéëêìíïîòóöôùúüûñç·_,:;&#34;; var to = &#8230; <a href="http://www.lautr.com/jquery-slug-plugin-for-input-fields/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>A small jQuery Plugin i wrote to slug input fields, enjoy;</p>
<pre class="brush: javascript">
(function( $ ){
    function stringToSlug(str){
      str = str.replace(/^\s+|\s+$/g, &#039;&#039;); // trim
      str = str.toLowerCase();

      // remove accents, swap ñ for n, etc
      var from = &quot;àáäâèéëêìíïîòóöôùúüûñç·_,:;&quot;;
      var to   = &quot;aaaaeeeeiiiioooouuuunc-----&quot;;
      for (var i=0, l=from.length ; i&lt;l ; i++) {
        str = str.replace(new RegExp(from.charAt(i), &#039;g&#039;), to.charAt(i));
      }

      str = str.replace(/[^a-z0-9 -/]/g, &#039;&#039;) // remove invalid chars
        .replace(/\s+/g, &#039;-&#039;) // collapse whitespace and replace by -
        .replace(/-+/g, &#039;-&#039;); // collapse dashes

      return str;
    }

    $.fn.slug = function(){
        var inputField = this;
        $(this).closest(&#039;form&#039;).submit(function(){
            $(inputField).val(stringToSlug($(inputField).val()));
            return true;
        });
        $(this).blur(function(){
            $(this).val(stringToSlug($(this).val()));
        });
    }
})( jQuery );

$(document).ready(function() {
    $(&#039;input.slug&#039;).slug();
});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/jquery-slug-plugin-for-input-fields/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Convert Object of class stdClass to XML Object</title>
		<link>http://www.lautr.com/convert-object-of-class-stdclass-to-xml-object/</link>
		<comments>http://www.lautr.com/convert-object-of-class-stdclass-to-xml-object/#comments</comments>
		<pubDate>Wed, 13 Oct 2010 09:29:47 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[sideblog]]></category>
		<category><![CDATA[Convert]]></category>
		<category><![CDATA[StdClass]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xmlWriter]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=319</guid>
		<description><![CDATA[I had to do that recently and since i didn't found anything PHP native to do it i had to code it myself, just 2 SMall Functions to Convert an stdClass Object in to an XML (Writer) Object, or an XML String at the End. <a href="http://www.lautr.com/convert-object-of-class-stdclass-to-xml-object/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had to do that recently and since i didn&#8217;t found anything PHP native to do it i had to code it myself, just 2 SMall Functions to Convert an stdClass Object in to an XML (Writer) Object, or an XML String at the End.</p>
<p>/**<br />
* Adds Nodes to an Existing XML Writer Object<br />
*<br />
* @param XMLWriter $xml<br />
* @param string $nodeName<br />
* @param string | array | stdObject $nodeValue<br />
*/<br />
function _addNodeToXML(&amp;$xml,$nodeName,$nodeValue){<br />
if(is_array($nodeValue)){<br />
$xml-&gt;startElement($nodeName);<br />
foreach($nodeValue as $nodeValueKey =&gt; $nodeValueValue){<br />
_addNodeToXML($xml, $nodeValueKey, $nodeValueValue);<br />
}<br />
$xml-&gt;endElement();<br />
}elseif(is_a($nodeValue,&#8217;stdClass&#8217;)){<br />
$xml-&gt;startElement(&#8220;item&#8221;);<br />
foreach($nodeValue as $nodeValueKey =&gt; $nodeValueValue){<br />
_addNodeToXML($xml, $nodeValueKey, $nodeValueValue);<br />
}<br />
$xml-&gt;endElement();<br />
}else{<br />
$xml-&gt;writeElement($nodeName,$nodeValue);<br />
}<br />
}</p>
<p>/**</p>
<p>* Converts an Object of stdClass to an XML (XMLWriter) &#8220;Object&#8221;<br />
*<br />
* @param stdClass|array $stdClass<br />
* @return s<br />
*/<br />
function _stdClassToXML($stdClass){<br />
$xml = new XMLWriter();<br />
$xml-&gt;openMemory();</p>
<p>$this-&gt;_addNodeToXML($xml,&#8217;root&#8217;,$stdClass);<br />
return $xml-&gt;outputMemory();<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/convert-object-of-class-stdclass-to-xml-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>simple image view helper for zend framework</title>
		<link>http://www.lautr.com/simple-image-view-helper-for-zend-framework/</link>
		<comments>http://www.lautr.com/simple-image-view-helper-for-zend-framework/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 07:46:28 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[gd2]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[view]]></category>
		<category><![CDATA[zf]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=288</guid>
		<description><![CDATA[This Helper I use to store and resize Images (external or not) &#8211; it uses GD so make sure to have it, of course this is just an example, so you must change the structure of paths/URLs to your needs. &#8230; <a href="http://www.lautr.com/simple-image-view-helper-for-zend-framework/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This Helper I use to store and resize Images (external or not) &#8211; it uses GD so make sure to have it, of course this is just an example, so you must change the structure of paths/URLs to your needs.</p>
<p><span id="more-288"></span></p>
<pre class="brush: php">

class Zend_View_Helper_Images
{
private $_name;
private $_source;
static private $_webpath;
static private $_fspath;

public function __construct() {
if(null == $this-&gt;_fspath){
$this-&gt;_fspath = str_replace(&#039;application&#039;,&#039;&#039;,APPLICATION_PATH).&quot;public/images/tumbs/&quot;;
$this-&gt;_webpath = &quot;/images/thumbs/&quot;;
}
}

public function scale($x = false,$y = false)
{

if(!file_exists($this-&gt;_fspath.&#039;x&#039;.$x.&#039;y&#039;.$y.$this-&gt;_name)){
$infos = getimagesize($this-&gt;_source);

switch($infos[&#039;mime&#039;]) {
case &quot;image/pjpeg&quot;:
case &quot;image/jpeg&quot;:
case &quot;image/jpg&quot;:
$image=imagecreatefromjpeg($this-&gt;_source);
break;
case &quot;image/gif&quot;:
$image=imagecreatefromgif($this-&gt;_source);
break;
case &quot;image/png&quot;:
case &quot;image/x-png&quot;:
$image=imagecreatefrompng($this-&gt;_source);
break;
}
$newImage = imagecreatetruecolor($x,$y);
imagecopyresampled($newImage,$image,0,0,0,0,$x,$y,$infos[0],$infos[1]);

imagejpeg($newImage,$this-&gt;_fspath.&#039;x&#039;.$x.&#039;y&#039;.$y.$this-&gt;_name);
imagedestroy($newImage);
}

return $this-&gt;_webpath.&#039;x&#039;.$x.&#039;y&#039;.$y.$this-&gt;_name;

}

public function images($imageurl)
{
$this-&gt;_source = $imageurl;
preg_match(&#039;#[^/]+\.[\w]+$#&#039;,$imageurl,$match);
$this-&gt;_name = $match[0];
return $this;
}
}
</pre>
<p>in that cas the Implementation looks like:</p>
<pre class="brush: php">

&lt;img src=&quot;&lt;?= $this-&gt;images($this-&gt;some_image_url)-&gt;scale(150,200) ?&gt;&quot; alt=&quot;&quot;/&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/simple-image-view-helper-for-zend-framework/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>zootool wordpress plugin</title>
		<link>http://www.lautr.com/zootool-wordpress-plugin/</link>
		<comments>http://www.lautr.com/zootool-wordpress-plugin/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 16:14:10 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[badge]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[widget]]></category>
		<category><![CDATA[zootool]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=219</guid>
		<description><![CDATA[I Took the Time to program a neat ZooTool Wordpress Plugin. For everyone out there who likes wordpress, zootool, badges and doesn't like to use to much extern Javascript on his Page this might be Something for you.  <a href="http://www.lautr.com/zootool-wordpress-plugin/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I Took the Time to program a neat ZooTool WordPress Plugin. For everyone out there who likes wordpress, zootool, badges and doesn&#8217;t like to use to much extern Javascript on his Page this might be Something for you. You can find more Details on <a href="http://www.lautr.com/wordpress-zootool">my dedicated Page</a> .</p>
<p>Or if you&#8217;ve no Idea what I&#8217;m talking about check out <a href="http://zootool.com/user/justhannes/" target="_blank">zootool</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/zootool-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Convert all applicable characters to Numeric entities for use in XML</title>
		<link>http://www.lautr.com/convert-all-applicable-characters-to-numeric-entities-for-use-in-xml/</link>
		<comments>http://www.lautr.com/convert-all-applicable-characters-to-numeric-entities-for-use-in-xml/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 16:09:14 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[sideblog]]></category>
		<category><![CDATA[htmlentities]]></category>
		<category><![CDATA[Numeric entities]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=215</guid>
		<description><![CDATA[If you wanna make sure your text gets parsed  correctly you mostly use htmlentities. However this method has 2 downsides: 1. It does not convert in to numeric entities so you'll have problems when parsing as XML 2. It does NOT cover all characters that are like to show up. <a href="http://www.lautr.com/convert-all-applicable-characters-to-numeric-entities-for-use-in-xml/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you wanna make sure your text gets parsed  correctly you mostly use <a href="http://de2.php.net/manual/en/function.htmlentities.php" target="_blank">htmlentities</a>. However this method has 2 downsides:</p>
<p>1. It does not convert in to numeric entities so you&#8217;ll have problems when parsing as XML</p>
<p>2. It does NOT cover all characters that are like to show up.</p>
<p>So, to address this Issues, first for Point 1:</p>
<pre class="brush: php">
function _convertAlphaEntitysToNumericEntitys($entity){
return &#039;&amp;amp;amp;#&#039;.ord(html_entity_decode($entity[0])).&#039;;&#039;;
}
$content = preg_replace_callback(&#039;/&amp;amp;amp;([\w\d]+);/i&#039;,&#039;_convertAlphaEntitysToNumericEntitys&#039;,$content);
</pre>
<p>Here all &#8220;normal&#8221; entities are taken (which you already have, using  <a href="http://de2.php.net/manual/en/function.htmlentities.php" target="_blank">htmlentities</a>) and replaced by their numeric counterparts so they can be parsed as XML, now that leaves us with our second Problem, the Fact that only a small range of characters is covered in the first Place:</p>
<pre class="brush: php">
function _convertAsciOver127toNumericEntitys($entity){
if(($asciCode = ord($entity[0])) &gt; 127){
return &#039;&amp;amp;amp;#&#039;.$asciCode.&#039;;&#039;;
}else{
return $entity[0];
}
}
$content = preg_replace_callback(&#039;/[^\w\d ]/i&#039;,&#039;_convertAsciOver127toNumericEntitys&#039;), $content);
</pre>
<p>And there you go, the resulting Text should have no entitie Problems in XML.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/convert-all-applicable-characters-to-numeric-entities-for-use-in-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Utilizing HTML5 Geolocation API and Yahoo! PlaceFinder Example</title>
		<link>http://www.lautr.com/utilizing-html5-geolocation-api-and-yahoo-placefinder-example/</link>
		<comments>http://www.lautr.com/utilizing-html5-geolocation-api-and-yahoo-placefinder-example/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 12:06:55 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[geolocation]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[placefinder]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=209</guid>
		<description><![CDATA[Yeah yeah i know, HTML5 is the new web 2.0 or whatever and everyone has to blag about it, but to be honest, most of the improvments are pretty good, I'm not just talking about the semantics and the end of XHTML (Hooray) but i wont cover that here. Here is what I'm gonna do, show you what you can do with the geolocation API and Yahoos Placefinder API. <a href="http://www.lautr.com/utilizing-html5-geolocation-api-and-yahoo-placefinder-example/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Yeah yeah i know, HTML5 is the new web 2.0 or whatever and everyone has to blag about it, but to be honest, most of the improvments are pretty good, I&#8217;m not just talking about the semantics and the end of XHTML (Hooray) but i wont cover that here. Here is what I&#8217;m gonna do, show you what you can do with the <a href="http://dev.w3.org/geo/api/spec-source.html">geolocation API </a>and <a href="http://developer.yahoo.com/geo/placefinder/" target="_blank">Yahoos Placefinder API</a>.</p>
<p>Geolocation API is by now implementet in most of the browsers besides IE, of course, so its as usual a nice-to-have thing for desktop devices, of course for mobile, its a completly different matter. But if you wanna know more about it, read it up, there are <a href="http://www.google.com/search?hl=de&amp;client=opera&amp;hs=V6z&amp;rls=en&amp;q=geolocation+api&amp;aq=f&amp;aqi=g9g-s1&amp;aql=&amp;oq=&amp;gs_rfai=">plenty of rescources avaible on the net</a>.</p>
<p>Yahoos Place finder is, in there own words &#8220;Yahoo! PlaceFinder is a geocoding Web service that helps developers make their applications location-aware by converting street addresses or place names into geographic coordinates (and vice versa).&#8221; And yeah, besides the marketing spin, that is what it does, you provide latitude and latitude and Placefinder tells you where the hell you are.</p>
<p>I made<a href="http://www.lautr.com/sandbox/utilizing-html5-geolocation-api-and-yahoo-placefinder-example.php" target="_blank"> a short example you can check it out here</a>.</p>
<p>The Code is as slim as they come:<br />
PHP:</p>
<pre class="brush: php">
$search = &#039;http://where.yahooapis.com/geocode?q=&#039;.$_POST[&#039;lat&#039;].&#039;,+&#039;.$_POST[&#039;lon&#039;].&#039;&amp;amp;amp;amp;gflags=R&amp;amp;amp;amp;appid=[yourappidhere]&#039;;
$xml = simplexml_load_file($search,&#039;SimpleXMLElement&#039;, LIBXML_NOCDATA);
echo $xml-&gt;asXML();
</pre>
<p>HTML/JS</p>
<pre class="brush: html">
&lt;h1&gt;Utilizing HTML5 Geolocation API and Yahoo! PlaceFinder Example&lt;/h1&gt;
&lt;div&gt;You are currently in &lt;strong&gt; &lt;/strong&gt; - &lt;strong&gt; &lt;/strong&gt;, well to be more precisely in &lt;strong&gt; &lt;/strong&gt; and your ZIP is &lt;strong&gt; &lt;/strong&gt;&#039;ish&lt;/div&gt;
&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot;&gt;// &lt;![CDATA[
$(document).ready(function() {
navigator.geolocation.getCurrentPosition(
function(position){
$.ajax({
type: &#039;POST&#039;,
url: &#039;/sandbox/utilizing-html5-geolocation-api-and-yahoo-placefinder-example.php&#039;,
dataTyoe: &#039;xml&#039;,
data: ({
lat: position.coords.latitude,
lon: position.coords.longitude
}),
success: function(xml){
$(&#039;#city&#039;).html($(xml).find(&#039;city&#039;).text());
$(&#039;#country&#039;).html($(xml).find(&#039;country&#039;).text());
$(&#039;#neighborhood&#039;).html($(xml).find(&#039;neighborhood&#039;).text());
$(&#039;#plz&#039;).html($(xml).find(&#039;uzip&#039;).text());
}
});
}
);
});
// ]]&gt;&lt;/script&gt;
</pre>
<p>So you see, with literally no Work whatsoever you can get quite some Information, whatever you with them, is of course up to you, but remember if the user provides the Information or not is up to him!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/utilizing-html5-geolocation-api-and-yahoo-placefinder-example/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>XML-RPC &#8220;read timeout&#8221; after 10 Seconds with Zend_XmlRpc_Client</title>
		<link>http://www.lautr.com/xml-rpc-read-timeout-after-10-seconds-with-zend_xmlrpc_client/</link>
		<comments>http://www.lautr.com/xml-rpc-read-timeout-after-10-seconds-with-zend_xmlrpc_client/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 13:44:19 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[timeout]]></category>
		<category><![CDATA[xml rpc]]></category>
		<category><![CDATA[Zend_XmlRpc_Client]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=194</guid>
		<description><![CDATA[Recently i had a small Problem with the Service of a Partner we use for a new Project, it worked all together just fine, but just was a little bit slow at times, so i often got a Red Timeout after 10 Seconds. <a href="http://www.lautr.com/xml-rpc-read-timeout-after-10-seconds-with-zend_xmlrpc_client/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Recently i had a small Problem with the Service of a Partner we use for a new Project, it worked all together just fine, but just was a little bit slow at times, so i often got a Red Timeout after 10 Seconds.<br />
All you&#8217;ve to do here is, of course, increase the timeout by configuring the Zend_Http_Client that is used here, unfortunately you ether have to set it in every method you use like:</p>
<pre class="brush: php">
$this-&gt;_httpClient-&gt;setConfig(array(&#039;timeout&#039; =&gt; &#039;60&#039;));
</pre>
<p>(if you like me has an own class that extends from Zend_XmlRpc_Client to do your bidding). O</p>
<p>r must supply a full new, configured HTTP Client like:</p>
<pre class="brush: php">
$httpClient = new Zend_Http_Client;
$httpClient-&gt;setConfig(array(&#039;timeout&#039; =&gt; &#039;60&#039;));
$xmlrpcClient = new Zend_XmlRpc_Client(&#039;http://www.foobar.com/service&#039;,$httpClient);
</pre>
<p>(or something along those lines)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/xml-rpc-read-timeout-after-10-seconds-with-zend_xmlrpc_client/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>zend framework xmlrpc two element structure</title>
		<link>http://www.lautr.com/zend-framework-xmlrpc-two-element-structure/</link>
		<comments>http://www.lautr.com/zend-framework-xmlrpc-two-element-structure/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 16:07:52 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[headache]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=144</guid>
		<description><![CDATA[Well, i just had a lot of Fun with xmlrpc two element structure, first the request failed completely - i figured out i had to disable the skip system lookup because the other server couldn't handle it. <a href="http://www.lautr.com/zend-framework-xmlrpc-two-element-structure/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, i just had a lot of Fun with xmlrpc two element structure, first the request failed completely &#8211; i figured out i had to disable the skip system lookup because the other server couldn&#8217;t handle it.</p>
<pre class="brush: php">
$client = new Zend_XmlRpc_Client(&#039;http://www.example.com/xmlrpc.php&#039;);
$client-&gt;setSkipSystemLookup(true);
</pre>
<p>Now i had the Problem that zend reduced my request from two levels to one level and so the server couln&#8217;t interpret it anymore, for example:</p>
<pre class="brush: xml">
&lt;struct&gt;
&lt;params&gt;
&lt;param&gt;&lt;value&gt;
&lt;struct&gt;
&lt;member&gt;
&lt;name&gt;lowerBound&lt;/name&gt;
&lt;value&gt;&lt;int&gt;18&lt;/int&gt;&lt;/value&gt;
&lt;/member&gt;
&lt;member&gt;
&lt;name&gt;upperBound&lt;/name&gt;
&lt;value&gt;&lt;int&gt;139&lt;/int&gt;&lt;/value&gt;
&lt;/member&gt;
&lt;/struct&gt;
&lt;/value&gt;&lt;/param&gt;
&lt;/params&gt;
</pre>
<p>became</p>
<pre class="brush: xml">
&lt;params&gt;
&lt;param&gt;
&lt;value&gt;&lt;int&gt;18&lt;/int&gt;&lt;/value&gt;
&lt;/param&gt;
&lt;param&gt;
&lt;value&gt;&lt;int&gt;139&lt;/int&gt;&lt;/value&gt;
&lt;/param&gt;
&lt;/params&gt;
</pre>
<p>the Solution is simple, but took my a while, instead of giving him an array like</p>
<pre class="brush: php">
$response = $client-&gt;call(&#039;ra.order&#039;,array(&#039;lowerBound&#039; =&gt; 18,&#039;upperBound&#039; =&gt; 139));
</pre>
<p>the array must be wrapped in another array</p>
<pre class="brush: php">
$response = $client-&gt;call(&#039;ra.order&#039;,array(array(&#039;lowerBound&#039; =&gt; 18,&#039;upperBound&#039; =&gt; 139)));
</pre>
<p>i wish i knew why&#8230; well maybe i don&#8217;t&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/zend-framework-xmlrpc-two-element-structure/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Framework Tidy (HTML) View Helper</title>
		<link>http://www.lautr.com/zend-framework-tidy-html-view-helper/</link>
		<comments>http://www.lautr.com/zend-framework-tidy-html-view-helper/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 10:26:19 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[zend framework]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[tidy]]></category>
		<category><![CDATA[valid]]></category>
		<category><![CDATA[view]]></category>
		<category><![CDATA[view helper]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=141</guid>
		<description><![CDATA[In a recent Project i have to deal with some external content which has a good quality when it comes to the content itself, but unfortunately the html markup is rather poor, so i decided to include tidy to clean it up, and out of convenience make it in a view helper. <a href="http://www.lautr.com/zend-framework-tidy-html-view-helper/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>In a recent Project i have to deal with some external content which has a good quality when it comes to the content itself, but unfortunately the html markup is rather poor, so i decided to include tidy to clean it up, and out of convenience make it in a view helper:</p>
<p>/var/www/zend-framework/project-name/application/views/helpers/Tidy.php :</p>
<pre class="brush: php">
class Zend_View_Helper_Tidy extends Zend_View_Helper_Abstract
{
    private $_config = array();

    public function __construct(){
        $this-&gt;_config[&quot;show-body-only&quot;]=true;
        $this-&gt;_config[&quot;wrap&quot;]=0;
        $this-&gt;_config[&quot;wrap-attributes&quot;]=0;
        $this-&gt;_config[&quot;preserve-entities&quot;]=1;
        $this-&gt;_config[&quot;output-xhtml&quot;]=1;
        $this-&gt;_config[&quot;new-inline-tags&quot;]=&#039;go&#039;;
        $this-&gt;_config[&#039;fix-bad-comments&#039;]=&#039;no&#039;;
        $this-&gt;_config[&#039;hide-comments&#039;]=&#039;no&#039;;
        $this-&gt;_config[&#039;drop-empty-paras&#039;]=&#039;yes&#039;;
    }
    public function tidy($html,$charset = &#039;utf8&#039;){
        return tidy_repair_string($html,$this-&gt;_config,$charset);
    }
}
</pre>
<p>/var/www/zend-framework/project-name/application/views/scripts/output.phtml :</p>
<pre class="brush: php">
&lt;?= $this-&gt;tidy($html); ?&gt;
</pre>
<p>its an rather simple script and could probably have some version checking (tidy use variates from version to version when it comes to setting the char type so make sure which version you have installed).</p>
<p><a href="http://tidy.sourceforge.net/docs/quickref.html">A reference to all tidy options can be found here.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/zend-framework-tidy-html-view-helper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Menu and Option Points in WordPress Backend, different possibilities</title>
		<link>http://www.lautr.com/adding-menu-and-option-pages-in-wordpress-different-possibilities/</link>
		<comments>http://www.lautr.com/adding-menu-and-option-pages-in-wordpress-different-possibilities/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 12:00:31 +0000</pubDate>
		<dc:creator>Hannes</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[menu]]></category>
		<category><![CDATA[options]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wp]]></category>

		<guid isPermaLink="false">http://www.lautr.com/?p=81</guid>
		<description><![CDATA[There are different Ways to add Navigation Points to the WordPress Backend, most of them are explained here. Basically you have: add_options_page This will basically create another navigation Point under setting as most Plug-ins do. Its best suited for scenarios &#8230; <a href="http://www.lautr.com/adding-menu-and-option-pages-in-wordpress-different-possibilities/">Weiterlesen <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>There are different Ways to add Navigation Points to the WordPress Backend, <a href="http://codex.wordpress.org/Adding_Administration_Menus" target="_blank">most of them are explained here</a>. Basically you have:</p>
<h3>add_options_page</h3>
<p><a href="http://static.lautr.com/wp-content/uploads/2010/02/add_options_page.png"><img class="size-full wp-image-89 alignleft" title="add_options_page" src="http://static.lautr.com/wp-content/uploads/2010/02/add_options_page.png" alt="" width="150" height="270" /></a>This will basically create another navigation Point under setting as most Plug-ins do. Its best suited for scenarios where your Plug-in provides Options/Settings for your blog.</p>
<p>The Parameters are the following</p>
<ol>
<li>the Title you want to display in the Menu</li>
<li>the Title you want to display on the Page itself</li>
<li>the Userlevel required to see the Link</li>
<li>as the name says, a unique string,  basename(__FILE__) works just fine also</li>
<li>a callback function for the page it should lead to, you can use a simple function name (as string) or use an object and its method, as i did</li>
</ol>
<p>the syntax could look like:</p>
<pre class="brush: php">
add_options_page(&#039;Menu Title&#039;, &#039;Page Title&#039;, 9,&#039;an-uniq-string-as-key&#039;, array(&#039;wp_my_awesome_class&#039;,&#039;optionPage&#039;));
</pre>
<h3>add_submenu_page</h3>
<p><a href="http://static.lautr.com/wp-content/uploads/2010/02/add_submenu_page.png"><img class="alignleft size-full wp-image-90" title="add_submenu_page" src="http://static.lautr.com/wp-content/uploads/2010/02/add_submenu_page.png" alt="" width="150" height="270" /></a>As the Name suggests this function is used to add Sub Menus to any Main Option, besides and including what add_options_page does, why are there two different functions then? Lets say legacy Reason &#8211; yeah sounds fine.</p>
<p>As you may see, its basically the same, besides you need to give the unique-key of the parent you want to attend to, for the basics that would be:</p>
<p>For Write: add_submenu_page(&#8216;post-new.php&#8217;,&#8230;)<br />
For Manage: add_submenu_page(&#8216;edit.php&#8217;,&#8230;)<br />
For Design: add_submenu_page(&#8216;themes.php&#8217;,&#8230;)<br />
For Comments: add_submenu_page(&#8216;edit-comments.php&#8217;,&#8230;)<br />
For Settings: add_submenu_page(&#8216;options-general.php&#8217;,&#8230;)<br />
For Plugins: add_submenu_page(&#8216;plugins.php&#8217;,&#8230;)<br />
For Users: add_submenu_page(&#8216;users.php&#8217;,&#8230;)</p>
<p>Or, anything you set up as a Main-Menu-Point / Parent yourself.</p>
<p>And it, for an example, looks like:</p>
<pre class="brush: php">
add_submenu_page(&#039;an-uniq-string-as-key-of-the-parent&#039;,&#039;Page Title&#039;,&#039;Menu Title&#039;,9,&#039;an-uniq-string-as-key&#039;, array(&#039;wp_my_awesome_class&#039;,&#039;adminPage&#039;));
</pre>
<h3>add_menu_page</h3>
<p><a href="http://static.lautr.com/wp-content/uploads/2010/02/add_menu_page.png"><img class="alignleft size-full wp-image-87" title="add_menu_page" src="http://static.lautr.com/wp-content/uploads/2010/02/add_menu_page.png" alt="" width="150" height="270" /></a>And thats where the fun starts, with this nice function you can add a Main-Navigation-point to your menu.</p>
<p>The most stuff should be clear by now, the only difference is that you add a path to an icon you use. Well, isnt that just too nice to be true? Yes, yes it is, because you will notice that your Nice new so important Main Navigation Point will always appear on the very bottom of the Navigation.</p>
<p>So lets, see, in the End you can add Navigation Points to every Main Navigation Points (in the Bottom) and an Main Navigation Point itself, in the bottom.</p>
<p>the syntax could look like:</p>
<pre class="brush: php">
add_menu_page(&#039;Page Title&#039;, &#039;Main Title&#039;,4,&#039;an-uniq-string-as-key&#039;, array(&#039;wp_my_awesome_class&#039;,&#039;adminPage&#039;)),&#039;http://www.example.com/favicon.ico&#039;);
</pre>
<p><strong>Now, if you want to Add an Main Navigation Point on another Position it is possibile, but only in a not documented manner!</strong></p>
<h3>add_menu_page extended</h3>
<p>The Code is the same as for the regular use of add_menu_page, but in release 2.9 they added a new Parameter that can be used to choose the Position of the Entry:</p>
<pre class="brush: php">
add_menu_page(&#039;Page Title&#039;, &#039;Main Title&#039;,4,&#039;an-uniq-string-as-key&#039;, array(&#039;wp_my_awesome_class&#039;,&#039;adminPage&#039;)),&#039;http://www.example.com/favicon.ico&#039;,1);
</pre>
<p><a href="http://static.lautr.com/wp-content/uploads/2010/02/add_menu_page_2.png"><img class="alignleft size-full wp-image-88" title="add_menu_page_2" src="http://static.lautr.com/wp-content/uploads/2010/02/add_menu_page_2.png" alt="" width="150" height="270" /></a>This would then Appear on top, even before Dashboard. However, unfortunately  you can not just use every Position.</p>
<p>Since most of them are already taken by Existing Menu Points and Separators <strong>if you do so anyway you&#8217;ll overwrite them</strong>.</p>
<p>Some free Positions you can use are: 1,3,6,7,8,9,11,12,13,14,16,17,18,19.</p>
<p>If you want to be more free you must do the following, first we must activate the &#8220;custom_menu_order&#8221; Hook.</p>
<p>Just add this Code in a Plugin, of the functions.php of your template:</p>
<pre class="brush: php">
add_filter(&#039;custom_menu_order&#039;,&#039;custom_menu_order_function&#039;);
function custom_menu_order_function(){
return true;
}
</pre>
<p>Now we can use the menu_order Filter to add our an-uniq-string-as-key at any position we want</p>
<pre class="brush: php">
add_filter(&#039;menu_order&#039;,&#039;menu_order_my_function&#039;);
function menu_order_my_function($menu_order){
$new_menu_order = array();

foreach($menu_order as $position =&gt; $menu_element){
if($position == 4){
$new_menu_order[] = &#039;an-uniq-string-as-key&#039;;
}elseif($menu_element != &#039;an-uniq-string-as-key&#039;){
$new_menu_order[] = $menu_element;
}
}
return $new_menu_order;
}
</pre>
<p>4 is of course the example Position, you can use any you want. To move separators just use the strings &#8220;separator1&#8243;, &#8220;separator2&#8243; and &#8220;separator-last&#8221; unfortunately it seams you can only move the existing Separators, not add new ones.</p>
<p>But like i said, this is not documented, so use it carefully if you choose so. And most important, think if your Plug-in &#8220;add-alt-seo-title-to-dohikkie&#8221; really need the number one Position.</p>
<h4>Access Limitations</h4>
<p>You See in all this functions always an numeric value for the Access Rights, wich value Reflects witch user type you can see at <a href="http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table">the Capability vs. Role Table</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.lautr.com/adding-menu-and-option-pages-in-wordpress-different-possibilities/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc (User agent is rejected)
Database Caching 5/44 queries in 0.074 seconds using apc
Object Caching 649/766 objects using apc
Content Delivery Network via static.lautr.com

Served from: www.lautr.com @ 2012-02-06 02:28:27 -->
