Advertisement
Guest User

Untitled

a guest
May 26th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.14 KB | None | 0 0
  1. <?php
  2. abstract class Meldels_Controller_Action extends Zend_Controller_Action
  3. {
  4.     public function preDispatch()
  5.     {
  6.         $action = $this->getFrontController()->getDispatcher()->formatActionName(
  7.             $this->getRequest()->getActionName()
  8.         );
  9.         $classeRefletida = new Zend_Reflection_Class($this);
  10.         $metodoRefletido = $classeRefletida->getMethod($action);
  11.         try {
  12.             $docblockRefletido = $metodoRefletido->getDocblock();
  13.         } catch (Zend_Reflection_Exception $e) {}
  14.  
  15.         if (isset($docblockRefletido)) {
  16.             if ($docblockRefletido->hasTag('AutenticacaoObrigatoria')) {
  17.                 if (!Zend_Auth::getInstance()->hasIdentity()) {
  18.                     $this->_helper->redirector->gotoSimple('login', 'autenticacao');
  19.                 }
  20.  
  21.                 $gruposPermitidos = array_map(function ($v) {return trim($v);},
  22.                     explode(
  23.                         ',',
  24.                         $docblockRefletido->getTag('AutenticacaoObrigatoria')
  25.                             ->getDescription()
  26.                         )
  27.                 );
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement