<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Tue, 21 May 2013 07:13:17 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Leonid Mamchenkov's Blog: Disable and enable CakePHP plugins on the fly]]></title>
      <guid>http://www.phpdeveloper.org/news/16243</guid>
      <link>http://www.phpdeveloper.org/news/16243</link>
      <description><![CDATA[<p>
<i>Leonid Mamchenkov</i> has a quick post to his blog showing how to <a href="http://mamchenkov.net/wordpress/2011/04/23/disable-and-enable-cakephp-plugins-on-the-fly/">enable and disable (well, restrict from enabling) CakePHP plugins</a> on the fly - no need to modify config files if you only need it for a certain request.
</p>
<blockquote>
I am currently working on a rather large project which is based on CakePHP framework.  In order to simplify the task, I've broken down the whole application into a number of CakePHP plugins.  Now, however, I want to enable/disable plugins on the fly.  After a brief search around I couldn't find how to do that.  Asking a question at #cakephp IRC channel did it.  RabidFire instantly replied with <a href="http://groups.google.com/group/cake-php/browse_thread/thread/9370aac4a0d80488?fwc=1&pli=1">the link that gave me an idea</a>. 30 seconds later I had a working solution.
</blockquote>
<p>
Since the plugins extend the main AppController, all it took was a beforeFilter() method call that looks at a request parameter for the plugin name, checks against an "allowed" array and throws an exception of it's not found or can't load it.
</p>]]></description>
      <pubDate>Mon, 25 Apr 2011 11:45:17 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Lee Blue's Blog: How To Implement A Ruby on Rails style before_filter With The PHP Zend Framework]]></title>
      <guid>http://www.phpdeveloper.org/news/9564</guid>
      <link>http://www.phpdeveloper.org/news/9564</link>
      <description><![CDATA[<p>
<i>Lee Blue</i> has <a href="http://www.refreshinglyblue.com/2008/01/30/how-to-implement-a-ruby-on-rails-style-before_filter-with-the-php-zend-framework/">posted something</a> looking to bridge yet another gap between Ruby on Rails and PHP - a method for adding before_filter functionality to PHP.
</p>
<blockquote>
I often use this when implementing a simple login screen for a password protected section of my application. In a <a href="http://framework.zend.com/">Zend Framework</a> application you can implement a <a href="http://framework.zend.com/manual/en/zend.controller.plugins.html">preDispatch()</a> function in a Zend_Controller_Action which will run before an action is dispatched. This lets you setup your filter to check to see if the visitor is logged in or not. If the visitor is not logged in, you can redirect them to the login screen of your application.
</blockquote>
<p>
He <a href="http://www.refreshinglyblue.com/2008/01/30/how-to-implement-a-ruby-on-rails-style-before_filter-with-the-php-zend-framework/">includes example code</a> to show its usefulness - checking to see two things: is a user is logged in and to see if they're allowed to use a certain resource.
</p>]]></description>
      <pubDate>Mon, 04 Feb 2008 14:36:00 -0600</pubDate>
    </item>
  </channel>
</rss>
