public function initializeCli() { $paths = new Paths(); $folder = basename($paths->getPluginRoot()); $pluginFile = $paths->getPluginRoot() . '/' . $folder . '.php'; if (file_exists($pluginFile)) { require_once $pluginFile; } }
public function getConfigData($file = null) { if (!$this->configData) { if (null === $file) { $paths = new Paths(); $file = $paths->getPluginRoot() . '/dewdrop-config.php'; } if (file_exists($file) || is_readable($file)) { $this->configData = (require $file); } } return $this->configData; }
/** * Optionally point this class at a non-standard configuration file path. * * @param string $file */ public function __construct($file = null) { $paths = new Paths(); if (!$paths->isWp()) { if (null === $file) { $file = $paths->getPluginRoot() . '/dewdrop-config.php'; } if (file_exists($file) || is_readable($file)) { $this->data = (require $file); } } else { $className = '\\Dewdrop\\Bootstrap\\Wp'; if (defined('DEWDROP_BOOTSTRAP_CLASS')) { $className = DEWDROP_BOOTSTRAP_CLASS; } $this->data = array('bootstrap' => $className, 'db' => array('username' => DB_USER, 'password' => DB_PASSWORD, 'host' => DB_HOST, 'name' => DB_NAME, 'type' => 'mysql')); } }
/** * Assuming that we can detect ZF1 is in use after bootstrapping our CLI environment, * we'll then start up the Application itself, bootstrap it, and do minimal front * controller configuration. This allows us to get the configuration loaded, the * application resources in place, etc. without actually starting the dispatch cycle. */ public function initializeCli() { $paths = new Paths(); $root = $paths->getPluginRoot(); // Define path to the parent of application/ and library/ defined('PROJECT_ROOT') || define('PROJECT_ROOT', $root); defined('APPLICATION_PATH') || define('APPLICATION_PATH', PROJECT_ROOT . '/application'); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV')); if (class_exists('DeltaZend_Application')) { $applicationClass = 'DeltaZend_Application'; } else { $applicationClass = 'Zend_Application'; } /* @var $application \Zend_Application */ $application = new $applicationClass(APPLICATION_ENV, PROJECT_ROOT . '/application/configs/application.ini'); $application->bootstrap(); /* @var $frontController Zend_Controller_Front */ $bootstrap = $application->getBootstrap(); $frontController = $bootstrap->getResource('FrontController'); $frontController->setParam('bootstrap', $bootstrap); }