protected function _init() { if (IfwPsn_Wp_Proxy_Screen::isLoadedCurrentScreen()) { $this->_pm->getLogger()->error('Screen option must be initialized before page load.'); } $this->_type = $this->getType(); IfwPsn_Wp_Proxy_Filter::addSetScreenOption(array($this, 'setScreenOptionCallback'), 10, 3); IfwPsn_Wp_Proxy_Action::addCurrentScreen(array($this, 'registerOption')); }
/** * @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; }