/** * Initializes the controller * Will be called on bootstrap before admin-menu/admin-init/load-[page] * Use onAdminMenu/onAdminInit etc otherwise */ public function init() { // set config $this->_config = $this->getInvokeArg('bootstrap')->getOptions(); $this->_pm = $this->_config['pluginmanager']; $this->view->pm = $this->_pm; $this->_pm->getLogger()->logPrefixed('Init default controller.'); $this->_adminNotices = new IfwPsn_Wp_Admin_Notices($this->_pm->getAbbrLower()); // $this->_adminNotices->setAutoShow(true); $this->view->adminNotices = $this->_adminNotices; $this->_redirector = $this->_helper->getHelper('Redirector'); $this->_request = $this->getRequest(); $this->_helper->layout()->setLayout('layout'); $this->_pageHook = 'page-' . $this->_pm->getPathinfo()->getDirname() . '-' . $this->getRequest()->getControllerName() . '-' . $this->getRequest()->getActionName(); $this->view->pageHook = $this->_pageHook; $this->initNavigation(); $this->view->isSupportedWpVersion = IfwPsn_Wp_Proxy_Blog::isMinimumVersion($this->_pm->getConfig()->plugin->wpMinVersion); $this->view->notSupportedWpVersionMessage = sprintf(__('This plugin requires WordPress version %s for full functionality. Your version is %s. <a href="%s">Please upgrade</a>.', 'ifw'), $this->_pm->getConfig()->plugin->wpMinVersion, IfwPsn_Wp_Proxy_Blog::getVersion(), 'http://wordpress.org/download/'); // Do action on controller init IfwPsn_Wp_Proxy_Action::doAction(get_class($this) . '_init', $this); }
/** * @param IfwPsn_Wp_Plugin_Manager $pm * @return string */ public static function getServerEnvironment(IfwPsn_Wp_Plugin_Manager $pm) { $tpl = IfwPsn_Wp_Tpl::getFilesytemInstance($pm); $count_users = count_users(); $mysql_server_info = @mysql_get_server_info(); $mysql_client_info = @mysql_get_client_info(); $phpAutoloadFunctions = array(); foreach (IfwPsn_Wp_Autoloader::getAllRegisteredAutoloadFunctions() as $function) { try { if (is_string($function)) { array_push($phpAutoloadFunctions, $function); } elseif (is_array($function) && count($function) == 2) { $autoloadObject = $function[0]; if (is_object($autoloadObject)) { $autoloadObject = get_class($autoloadObject); } $autoloadMethod = $function[1]; if (!is_scalar($autoloadMethod)) { $autoloadMethod = var_export($autoloadMethod, true); } array_push($phpAutoloadFunctions, $autoloadObject . '::' . $autoloadMethod); } elseif (is_object($function)) { array_push($phpAutoloadFunctions, get_class($function)); } } catch (Exception $e) { // no action } } $context = array('plugin_name' => $pm->getEnv()->getName(), 'plugin_version' => $pm->getEnv()->getVersion(), 'plugin_build_number' => $pm->getEnv()->getBuildNumber(), 'plugin_modules' => $pm->getBootstrap()->getModuleManager()->getModules(), 'plugin_modules_initialized' => $pm->getBootstrap()->getModuleManager()->getInitializedModules(), 'plugin_modules_custom_dir' => $pm->getBootstrap()->getModuleManager()->getCustomModulesLocation(), 'OS' => PHP_OS, 'uname' => php_uname(), 'wp_version' => IfwPsn_Wp_Proxy_Blog::getVersion(), 'wp_charset' => IfwPsn_Wp_Proxy_Blog::getCharset(), 'wp_count_users' => $count_users['total_users'], 'wp_debug' => WP_DEBUG == true ? 'true' : 'false', 'wp_debug_log' => WP_DEBUG_LOG == true ? 'true' : 'false', 'wp_debug_display' => WP_DEBUG_DISPLAY == true ? 'true' : 'false', 'plugins' => IfwPsn_Wp_Proxy_Blog::getPlugins(), 'theme_name' => IfwPsn_Wp_Proxy_Blog::getThemeName(), 'theme_version' => IfwPsn_Wp_Proxy_Blog::getThemeVersion(), 'theme_author' => IfwPsn_Wp_Proxy_Blog::getThemeAuthor(), 'theme_uri' => IfwPsn_Wp_Proxy_Blog::getThemeURI(), 'php_version' => phpversion(), 'php_memory_limit' => ini_get('memory_limit'), 'php_extensions' => IfwPsn_Wp_Server_Php::getExtensions(), 'php_include_path' => get_include_path(), 'php_open_basedir' => ini_get('open_basedir'), 'php_autoload_functions' => $phpAutoloadFunctions, 'mysql_version' => !empty($mysql_server_info) ? $mysql_server_info : '', 'mysql_client' => !empty($mysql_client_info) ? $mysql_client_info : '', 'server_software' => $_SERVER['SERVER_SOFTWARE']); if (function_exists('apache_get_version')) { $context['apache_version'] = apache_get_version(); } if (function_exists('apache_get_modules')) { $context['apache_modules'] = apache_get_modules(); } return $tpl->render('server_env.html.twig', $context); }
/** * @return bool */ protected function _isValidBlogVersion() { return IfwPsn_Wp_Proxy_Blog::getVersion() >= '3.3'; }