/** * Run the Manager * * @return string * * @access public */ public function run() { //check if plugins/advanced-access-manager/extension is writable if (!is_writable(AAM_BASE_DIR . 'extension')) { aam_Core_Console::add(__('Folder advanced-access-manager/extension is not writable', 'aam')); } return $this->loadTemplate(dirname(__FILE__) . '/tmpl/extension.phtml'); }
* Autoloader for project Advanced Access Manager * * Try to load a class if prefix is mvb_ * * @param string $class_name */ function aam_autoload($class_name) { $chunks = explode('_', strtolower($class_name)); $prefix = array_shift($chunks); if ($prefix === 'aam') { $base_path = AAM_BASE_DIR . '/application'; $path = $base_path . '/' . implode('/', $chunks) . '.php'; if (file_exists($path)) { require $path; } } } spl_autoload_register('aam_autoload'); //make sure that we have always content dir if (!file_exists(AAM_TEMP_DIR)) { if (@mkdir(AAM_TEMP_DIR)) { //silence the directory file_put_contents(AAM_TEMP_DIR . '/index.php', ''); } else { aam_Core_Console::add(__('Failed to create wp-content/aam folder', 'aam')); } } elseif (!is_writable(AAM_TEMP_DIR)) { aam_Core_Console::add(__('Folder wp-content/aam is not writable', 'aam')); } load_plugin_textdomain('aam', false, basename(AAM_BASE_DIR) . '/lang');
/** * * @param type $filename */ protected function parseConfig($filename) { //include third party library if (!class_exists('Zend_Config')) { require_once AAM_LIBRARY_DIR . 'Zend/Exception.php'; require_once AAM_LIBRARY_DIR . 'Zend/Config/Exception.php'; require_once AAM_LIBRARY_DIR . 'Zend/Config.php'; require_once AAM_LIBRARY_DIR . 'Zend/Config/Ini.php'; } //parse ini file try { $this->setTree(new Zend_Config_Ini($filename)); } catch (Zend_Config_Exception $e) { aam_Core_Console::add('ConfigPress parsing error'); } }
/** * Bootstrap the Extension * * In case of any errors, the output can be found in console * * @param string $extension * * @return void * * @access protected */ protected function bootstrapExtension($extension) { $bootstrap = $this->_basedir . "/{$extension}/index.php"; if (file_exists($bootstrap) && !isset($this->_cache[$extension])) { //bootstrap the extension $this->_cache[$extension] = (require_once $bootstrap); //check if activation hook still present and trigger warning if yes if (file_exists($this->_basedir . "/{$extension}/activation.php")) { aam_Core_Console::add("Activation hook for {$extension} is not deleted"); } } }