Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1
CHAPTER 16 ■ ADVANCED ZEND FRAMEWORK^257

After you have built your array of data, you can call the isSpam() method:

if(! $akismet->isSpam($data)) { //data is clean }

If the filter misses data, you can also call submitSpam($data) so that the filter can learn how
to block similar requests in the future. If the filter catches something that it shouldn’t and returns a
false positive, you can call submitHam($data) to help the filter learn not to block that informa-
tion in the future. These two methods do not return a value.

Just the Facts


This chapter introduced several of the more advanced facilities the Zend Framework has to
offer. Here is a summary:


  • Zend_Config allows you to manage configuration files.


•With Zend_View, you can set site-wide view variables.


  • Zend_Registry allows you to share objects among components.


•With the ErrorController, you can create an error handler that dumps out extensive
amounts of debugging information. You can integrate this error information with a
custom Zend_Log log file.

•By using Zend_Cache, you can increase the performance of your applications by applying
effective caching. You must be careful how you implement caching, as it can be dangerous.


  • You can create an authentication system using Zend_Auth and integrate it with a login
    controller.


•With Zend_Json you can create a JSON-emitting action.


  • Zend_Controller_Router_Rewrite allows you to apply custom routes to make your URLs
    shorter and more specific.

  • You can create a Zend_Session_Namespace and expire data after a specific number of
    “hops.” To prevent session hijacking, you can use regenerateId().

  • You can send e-mail with Zend_Mail.


comment_content The actual comment data No
comment_type The type of data provided, one of 'comment',
'trackback', 'pingback', '', or any other string.

No

permalink The URL of the form page, not the main page No
referrer $_SERVER['HTTP_REFERER'] No
* Any other information you feel like providing No

Table 16-3. Akismet Keys
Key Data Required

McArthur_819-9C16.fm Page 257 Friday, February 29, 2008 5:07 PM

Free download pdf