/** * * @param string $class * @param unknown_type $dirs * @throws IfwPsn_Vendor_Zend_Exception */ public static function loadClass($class, $dirs = null) { if (IfwPsn_Wp_Autoloader::autoload($class)) { return; } parent::loadClass($class, $dirs); }
/** * Inits default logic */ public function init() { // check if module properties are set $this->_checkProperties(); // register lib if ($this->_pathinfo->hasRootLib()) { // add the module lib dir to the autoloader $classPrefix = $this->_pm->getAbbr() . '_Module_' . $this->_pathinfo->getDirname(); IfwPsn_Wp_Autoloader::registerModule($classPrefix, $this->_pathinfo->getRootLib()); } // register templates dir if ($this->_pm->getAccess()->isPlugin()) { $this->initTpl(); } // init module translation $this->_initTranslation(); // load default script and style files if ($this->_pm->getAccess()->isPlugin() && !$this->_pm->getAccess()->isAjax()) { $this->_enqueueScripts(); } if ($this->_pm->getAccess()->isAjax() && !$this->_pm->getAccess()->isHeartbeat()) { $this->_initAjax(); } $this->_initialized = true; }
/** * Return the command class * * @param string $command * @param array $args * @param IfwPsn_Wp_Plugin_Manager $pm * @throws IfwPsn_Wp_Plugin_Cli_Factory_Exception * @return IfwPsn_Wp_Cli_Command_Abstract */ public static function getCommand($command, $args, IfwPsn_Wp_Plugin_Manager $pm) { $commandPath = IfwPsn_Wp_Autoloader::getClassPath($command); if ($commandPath == false) { throw new IfwPsn_Wp_Plugin_Cli_Factory_Exception('Unkown command: ' . $command); } elseif (get_parent_class($command) != 'IfwPsn_Wp_Plugin_Cli_Command_Abstract') { throw new IfwPsn_Wp_Plugin_Cli_Factory_Exception('Command class must extend IfwPsn_Wp_Plugin_Cli_Command_Abstract'); } else { return new $command($command, $args, $pm); } }
/** * Loads autoloader before other resources for convenience */ protected function _initAutoloader() { if (!class_exists('IfwPsn_Wp_Autoloader')) { require_once $this->_pluginPathinfo->getRootLib() . 'IfwPsn/Wp/Autoloader.php'; } if (!IfwPsn_Wp_Autoloader::init($this->_pluginPathinfo->getRootLib())) { ifw_debug('Autoloader error: Could not init ' . $this->_pluginPathinfo->getRootLib()); } if (!IfwPsn_Wp_Autoloader::init($this->_pluginPathinfo->getRootAdminMenu())) { ifw_debug('Autoloader error: Could not init ' . $this->_pluginPathinfo->getRootAdminMenu()); } }
/** * @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); }