<?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>Luca's forge &#187; zend</title>
	<atom:link href="http://lucasforge.2bopen.org/category/zend/feed/" rel="self" type="application/rss+xml" />
	<link>http://lucasforge.2bopen.org</link>
	<description>Experiments from the land of open source</description>
	<lastBuildDate>Tue, 20 Jul 2010 15:24:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using Pear::Auth as Zend_Auth adapter</title>
		<link>http://lucasforge.2bopen.org/2009/07/using-pear-auth-as-zend-auth-adapter/</link>
		<comments>http://lucasforge.2bopen.org/2009/07/using-pear-auth-as-zend-auth-adapter/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 13:57:04 +0000</pubDate>
		<dc:creator>Luca Corbo</dc:creator>
				<category><![CDATA[pear]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[authentication]]></category>

		<guid isPermaLink="false">http://lucasforge.2bopen.org/?p=63</guid>
		<description><![CDATA[If you use both Pear and Zend framework you may want to extend the <a href="http://framework.zend.com/manual/en/zend.auth.html">Zend_Auth</a> adapters to use all the containers shipped with the <a href="http://pear.php.net/package/Auth">Pear::Auth</a> package.

Let's go to create the class implements the Zend_Auth_Adapter_Interface starting from the Zend_Auth_Adapter_Ldap class.]]></description>
			<content:encoded><![CDATA[<p>If you use both Pear and Zend framework you may want to extend the <a href="http://framework.zend.com/manual/en/zend.auth.html">Zend_Auth</a> adapters to use all the containers shipped with the <a href="http://pear.php.net/package/Auth">Pear::Auth</a> package.</p>
<p>Let&#8217;s go to create the class implements the Zend_Auth_Adapter_Interface starting from the Zend_Auth_Adapter_Ldap class.</p>
]]></content:encoded>
			<wfw:commentRss>http://lucasforge.2bopen.org/2009/07/using-pear-auth-as-zend-auth-adapter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ReCaptcha with Zend Form</title>
		<link>http://lucasforge.2bopen.org/2009/04/recaptcha-with-zend-form/</link>
		<comments>http://lucasforge.2bopen.org/2009/04/recaptcha-with-zend-form/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 13:43:03 +0000</pubDate>
		<dc:creator>Luca Corbo</dc:creator>
				<category><![CDATA[php]]></category>
		<category><![CDATA[zend]]></category>
		<category><![CDATA[Form]]></category>
		<category><![CDATA[ReCaptcha]]></category>

		<guid isPermaLink="false">http://lucasforge.2bopen.org/?p=38</guid>
		<description><![CDATA[Requirements Zend Framework (1.7.8 at writing time) Valid ReCaptcha keys (public &#38; private) Simple ReCaptcha Zend Form Class source: application/forms/ReCaptcha.php &#60;?php class Form_ReCaptcha extends Zend_Form { public function init() { $this-&#62;setMethod(&#039;post&#039;); //Add your elements here... $recaptcha = new Zend_Service_ReCaptcha($publickey, $privatekey); $captcha = new Zend_Form_Element_Captcha(&#039;challenge&#039;, array(&#039;captcha&#039; =&#62; &#039;ReCaptcha&#039;, &#039;captchaOptions&#039; =&#62; array(&#039;captcha&#039; =&#62; &#039;ReCaptcha&#039;, &#039;service&#039; =&#62; $recaptcha))); [...]]]></description>
			<content:encoded><![CDATA[<h3>Requirements</h3>
<ul>
<li><a href="http://framework.zend.com/download/" target="_blank">Zend Framework</a> (1.7.8 at writing time)</li>
<li>Valid <a href="http://recaptcha.net/" target="_blank">ReCaptcha</a> keys (public &amp; private)</li>
</ul>
<h3>Simple ReCaptcha</h3>
<h4>Zend Form Class</h4>
<p>source: <em>application/forms/ReCaptcha.php</em></p>
<pre class="brush: php">
&lt;?php
class Form_ReCaptcha extends Zend_Form
{
    public function init()
    {
        $this-&gt;setMethod(&#039;post&#039;);
        //Add your elements here...

        $recaptcha = new Zend_Service_ReCaptcha($publickey, $privatekey);

        $captcha = new Zend_Form_Element_Captcha(&#039;challenge&#039;,
              array(&#039;captcha&#039;        =&gt; &#039;ReCaptcha&#039;,
                    &#039;captchaOptions&#039; =&gt; array(&#039;captcha&#039; =&gt; &#039;ReCaptcha&#039;, &#039;service&#039; =&gt; $recaptcha)));

        $this-&gt;addElement($captcha);

        // Add the submit button
        $this-&gt;addElement(&#039;submit&#039;, &#039;submit&#039;, array(&#039;label&#039; =&gt; &#039;Submit&#039;));
    }
}
?&gt;
</pre>
<h4>Zend Controller Class</h4>
<p>source: <em>application/controller/ReCaptchaController.php</em></p>
<pre class="brush: php">
&lt;?php
class ReCaptchaController extends Zend_Controller_Action
{
    public function indexAction()
    {
        require_once APPLICATION_PATH . &#039;/forms/Contact.php&#039;;

        $form = new Form_ReCaptcha();

        if ($this-&gt;_request-&gt;isPost()) {
            $formData = $this-&gt;_request-&gt;getPost();
            if ($form-&gt;isValid($formData)) {
                $recaptcha = new Zend_Service_ReCaptcha($publickey, $privatekey);

                $result = $recaptcha-&gt;verify($this-&gt;_getParam(&#039;recaptcha_challenge_field&#039;),
                                             $this-&gt;_getParam(&#039;recaptcha_response_field&#039;));
                if (!$result-&gt;isValid()) {
                    //ReCaptcha validation error
                    //Your action here...
               }
            }
        }
        $this-&gt;view-&gt;form = $form;
    }
}
?&gt;
</pre>
<h3>Customized ReCaptcha</h3>
<p>You may also want to internationalizing or change colors to ReCaptcha, to do it you need to specify some options for the  Zend_Service_ReCaptcha object.<br />
See the <a href="http://wiki.recaptcha.net/index.php/Main_Page" target="_blank">ReCaptcha wiki</a> for a complete list of available options. </p>
<h4>Zend Form Class</h4>
<p>source: <em>application/forms/ReCaptcha.php</em></p>
<pre class="brush: php">
&lt;?php
class Form_ReCaptcha extends Zend_Form
{
    public function init()
    {
        $this-&gt;setMethod(&#039;post&#039;);
        //Add your elements here...
        $recaptcha = new Zend_Service_ReCaptcha($publickey, $privatekey);

        //Translate in your language
        $recaptcha_it_translation =
            array(&#039;visual_challenge&#039; =&gt; &quot;Verifica video&quot;,
                  &#039;audio_challenge&#039; =&gt; &quot;Verifica audio&quot;,
                  &#039;refresh_btn&#039; =&gt; &quot;Effettua una nuova verifica&quot;,
                  &#039;instructions_visual&#039; =&gt; &quot;Scrivi le due parole&quot;,
                  &#039;instructions_audio&#039; =&gt; &quot;Scrivi quello che ascolti&quot;,
                  &#039;help_btn&#039; =&gt; &quot;Aiuto&quot;,
                  &#039;play_again&#039; =&gt; &quot;Riascolto di nuovo l&#039;audio&quot;,
                  &#039;cant_hear_this&#039; =&gt; &quot;Scarica l&#039;audio come MP3&quot;,
                  &#039;incorrect_try_again&#039; =&gt; &quot;Incorretto. Prova ancora.&quot;);

        $recaptcha-&gt;setOption(&#039;custom_translations&#039;, $recaptcha_it_translation);
        //Change theme
        $recaptcha-&gt;setOption(&#039;theme&#039;, &#039;clean&#039;);

        $captcha = new Zend_Form_Element_Captcha(&#039;challenge&#039;,
              array(&#039;captcha&#039;        =&gt; &#039;ReCaptcha&#039;,
                    &#039;captchaOptions&#039; =&gt; array(&#039;captcha&#039; =&gt; &#039;ReCaptcha&#039;,
                                             &#039;service&#039; =&gt; $recaptcha)));

        $this-&gt;addElement($captcha);

        // Add the submit button
        $this-&gt;addElement(&#039;submit&#039;, &#039;submit&#039;, array(&#039;label&#039; =&gt; &#039;Submit&#039;));
    }
}
?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://lucasforge.2bopen.org/2009/04/recaptcha-with-zend-form/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
