public function init() { IfwPsn_Wp_Proxy_Action::addAdminMenu(array($this, '_load')); if ($this->_pm->getAccess()->getPage() == $this->getSlug()) { IfwPsn_Wp_Proxy_Action::addInit(array($this, 'onInit')); } }
public function load() { if ($this->isIsMultisite()) { IfwPsn_Wp_Proxy_Action::addNetworkAdminMenu(array($this, '_load')); } else { IfwPsn_Wp_Proxy_Action::addAdminMenu(array($this, '_load')); } }
/** * @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; }