Esempio n. 1
0
 public function onLoad()
 {
     $application = $this->_pm->getBootstrap()->getApplication();
     if ($application->getAdapter() instanceof IfwPsn_Wp_Plugin_Application_Adapter_ZendFw) {
         IfwPsn_Wp_Proxy_Action::addAdminInit(array($application->getAdapter(), 'init'));
         IfwPsn_Wp_Proxy_Action::add('load-' . $this->getPageHook(), array($application, 'render'));
     }
 }
Esempio n. 2
0
 public function init()
 {
     require_once $this->_pm->getPathinfo()->getRootLib() . '/IfwPsn/Wp/Proxy/Action.php';
     IfwPsn_Wp_Proxy_Action::addAdminInit(array($this, 'register'));
     add_filter('pre_update_option_' . $this->_pageId, array($this, 'sanitizeFields'), 10, 2);
 }
Esempio n. 3
0
 /**
  * @param IfwPsn_Vendor_Zend_Controller_Request_Abstract $request
  * @param IfwPsn_Vendor_Zend_Controller_Response_Abstract $response
  * @throws IfwPsn_Vendor_Zend_Controller_Dispatcher_Exception
  */
 public function initController(IfwPsn_Vendor_Zend_Controller_Request_Abstract $request, IfwPsn_Vendor_Zend_Controller_Response_Abstract $response)
 {
     $this->setResponse($response);
     /**
      * Get controller class
      */
     if (!$this->isDispatchable($request)) {
         $controller = $request->getControllerName();
         if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) {
             //require_once 'IfwZend/Controller/Dispatcher/Exception.php';
             throw new IfwPsn_Vendor_Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')');
         }
         $className = $this->getDefaultControllerClass($request);
     } else {
         $className = $this->getControllerClass($request);
         if (!$className) {
             $className = $this->getDefaultControllerClass($request);
         }
     }
     /**
      * Load the controller class file
      */
     $className = $this->loadClass($className);
     /**
      * Instantiate controller with request, response, and invocation
      * arguments; throw exception if it's not an action controller
      */
     $controller = new $className($request, $this->getResponse(), $this->getParams());
     if (!$controller instanceof IfwPsn_Vendor_Zend_Controller_Action_Interface && !$controller instanceof IfwPsn_Vendor_Zend_Controller_Action) {
         //require_once 'IfwZend/Controller/Dispatcher/Exception.php';
         throw new IfwPsn_Vendor_Zend_Controller_Dispatcher_Exception('Controller "' . $className . '" is not an instance of IfwPsn_Vendor_Zend_Controller_Action_Interface');
     }
     if (method_exists($controller, 'onBootstrap')) {
         $controller->onBootstrap();
     }
     // add WP actions hooks
     IfwPsn_Wp_Proxy_Action::addAdminMenu(array($controller, 'onAdminMenu'));
     IfwPsn_Wp_Proxy_Action::addAdminInit(array($controller, 'onAdminInit'));
     IfwPsn_Wp_Proxy_Action::addCurrentScreen(array($controller, 'onCurrentScreen'));
     $this->_controller = $controller;
 }