/** * Loads the menu */ public function _load() { IfwPsn_Wp_Proxy_Action::doPlugin($this->_pm, 'before_load_options_page', $this); $this->_pageHook = add_options_page($this->getPageTitle(), $this->getMenuTitle(), $this->getCapability(), $this->getSlug(), array($this, 'handle')); IfwPsn_Wp_Proxy_Action::doPlugin($this->_pm, 'after_load_options_page', $this); if ($this->_pm->getAccess()->getPage() == $this->getSlug()) { $this->onLoad(); } }
/** * Loads js/css on admin_enqueue_scripts */ protected function _enqueueScripts() { if ($this->_pm->getAccess()->isModule(strtolower($this->getName()))) { $this->_loadAdminCss(); $this->_loadAdminJs(); } }
/** * Loads the menu */ public function _load() { if ($this->isIsMultisite()) { IfwPsn_Wp_Proxy_Action::doPlugin($this->_pm, 'before_load_multisite_menu_page', $this); } else { IfwPsn_Wp_Proxy_Action::doPlugin($this->_pm, 'before_load_menu_page', $this); } $this->_pageHook = add_menu_page($this->getPageTitle(), $this->getMenuTitle(), $this->getCapability(), $this->getSlug(), array($this, 'handle'), $this->getIconUrl(), $this->getPosition()); /** * @var IfwPsn_Wp_Plugin_Menu_Page_Sub $subPage */ foreach ($this->getSubPagesSorted() as $subPage) { $this->_triggerAction('before_load_submenu_page'); if ($subPage->isHidden()) { global $_registered_pages; $hookname = get_plugin_page_hookname(plugin_basename($subPage->getSlug()), $subPage->getSlug()); add_action($hookname, array($subPage, 'handle')); $subPage->setPageHook($hookname); $_registered_pages[$hookname] = true; } else { $subPageHook = add_submenu_page($this->getSlug(), $subPage->getPageTitle(), $subPage->getMenuTitle(), $subPage->getCapability(), $subPage->getSlug(), array($subPage, 'handle')); $subPage->setPageHook($subPageHook); } $this->_triggerAction('after_load_submenu_page'); if ($this->_pm->getAccess()->getPage() == $subPage->getSlug()) { $subPage->onLoad(); } } $this->_triggerAction('after_load_menu_page'); if ($this->_pm->getAccess()->getPage() == $this->getSlug()) { $this->onLoad(); } }
/** * Init custom router and plugins */ protected function _initPlugin() { if ($this->_pm->getAccess()->isPlugin()) { $this->bootstrap('FrontController'); $front = $this->getResource('FrontController'); // $front = IfwPsn_Zend_Controller_Front::getInstance(); // set custom router require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Zend/Controller/Router/WpRewrite.php'; $front->setRouter(new IfwPsn_Zend_Controller_Router_WpRewrite()); // launch the custom router to support request vars for controller / action $router = $front->getRouter(); require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Zend/Controller/Router/Route/RequestVars.php'; $router->addRoute('requestVars', new IfwPsn_Zend_Controller_Router_Route_RequestVars($this->_pm)); // launch the wp request dispatcher require_once $this->_pm->getPathinfo()->getRootLib() . 'IfwPsn/Zend/Controller/Plugin/WpRequestDispatcher.php'; $front->registerPlugin(new IfwPsn_Zend_Controller_Plugin_WpRequestDispatcher($this->_pm)); } }
private function _applicationBootstrap() { if ($this->_pm->getAccess()->isPlugin() && $this->_pm->getPathinfo()->hasRootApplication() && !$this->_pm->getAccess()->isAjax()) { // it's an access to the plugin settings and no AJAX request // start the admin application ifw_raise_memory_limit(); require_once $this->_pm->getPathinfo()->getRootLib() . '/IfwPsn/Wp/Plugin/Application.php'; $this->_application = IfwPsn_Wp_Plugin_Application::factory($this->_pm); $this->_application->load(); } }
/** * Fires at the end of the update message container in each row of the plugins list table. * * @param array $plugin_data An array of plugin data. * @param $meta_data */ public function getUpdateInlineMessage($plugin_data, $meta_data) { // slug $pluginSlug = $this->_pm->getSlugFilenamePath(); if ($this->_pm->isPremium()) { if (!apply_filters('ifw_woocommerce_is_slug_activated-' . $pluginSlug, false)) { if ($this->_pm->getAccess()->isNetworkAdmin()) { $licensePage = network_admin_url($this->_pm->getConfig()->plugin->licensePageNetwork); } else { $licensePage = admin_url($this->_pm->getConfig()->plugin->licensePage); } printf('<div style="padding: 5px 10px; border: 1px dashed red; margin-top: 10px;"><span class="dashicons dashicons-info"></span> %s</div>', sprintf(__('<b>License issue:</b> You have to <a href="%s">active your license</a> to be able to receive updates.', 'ifw'), $licensePage)); } } }
/** * @return bool */ public function isAccess() { return $this->_pm->getAccess()->isPlugin() || $this->_pm->getAccess()->isOptionsSubmit(); }