ZEND_AUTH Check if user logged-in

This example show you how we can check if a use logged in

 $auth = Zend_Auth::getInstance();
 if (!$auth->hasIdentity()) {
     if ('login' != $this->getRequest()->getActionName()) {
         $this->_helper->getHelper('Redirector')->setGotoRoute(array(), 'MYROUTE');
     }
 }

Date: 15/01/2012

Par: admin

0 comment

More info

PHP5 inflector - underscored

Convert any "CamelCased" or "ordinary Word" into an "underscored_word"

Example:

 $word = 'MyClassPHP';
 echo  strtolower(preg_replace('/[^A-Z^a-z^0-9]+/','_', preg_replace('/([a-z\d])([A-Z])/','\1_\2', preg_replace('/([A-Z]+)([A-Z][a-z])/','\1_\2',$word))));

Results:

 my_class_php

Date: 04/01/2012

Par: admin

0 comment

More info

PHP5 inflector - camelize

Converts a word like "send_email" to "SendEmail". It will remove non aphanumeric character from the word, so "who's online" will be converted to "WhoSOnline"

Example:

 $word = 'send_email';
 echo str_replace(' ','',ucwords(preg_replace('/[^A-Z^a-z^0-9]+/',' ',$word)));

Result:

 SendEmail

Date: 04/01/2012

Par: admin

0 comment

More info