本文整理汇总了PHP中Zend_Loader::loadFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Loader::loadFile方法的具体用法?PHP Zend_Loader::loadFile怎么用?PHP Zend_Loader::loadFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Loader
的用法示例。
在下文中一共展示了Zend_Loader::loadFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
if (!in_array(Zend_Controller_Front::getInstance()->getRouter()->getCurrentRouteName(), array('admin', 'admin_language'))) {
return;
}
$resource = new User_Model_Acl_Resource();
$resource->getAdminPrivileges();
if ($resource->admin_privileges) {
//$actionStack = Zend_Controller_Action_HelperBroker::getStaticHelper('ActionStack');
$actionStack = new Zend_Controller_Plugin_ActionStack();
foreach ($resource->admin_privileges as $module => $actions) {
$class = ucfirst($module) . '_AdminController';
if (!class_exists($class)) {
Zend_Loader::loadFile(APPLICATION_PATH . '/modules/' . $module . '/controllers/AdminController.php');
}
$reflection = new Zend_Reflection_Class($class);
$method = null;
try {
if ($method = $reflection->getMethod('menuAction')) {
$actionStack->pushStack(new Zend_Controller_Request_Simple('menu', 'admin', $module, array('admin_actions' => array_flip($actions))));
}
} catch (Exception $e) {
}
}
}
}
示例2: factory
/**
* Loads a Form from the Form Path
*
* @param string $sModel
* @return mixed
*/
public static function factory($sForm)
{
$sFormFile = $sForm . '.php';
$sFormClass = 'Form_' . $sForm;
Zend_Loader::loadFile($sFormFile, self::$_formPath);
return new $sFormClass();
}
示例3: __construct
/**
* Singleton pattern implementation makes "new" unavailable
*
* @return void
*/
protected function __construct()
{
Zend_Loader::loadFile("Predis.php", EXTERNAL_LIBRARY_PATH . "/predis/lib");
$registry = Zend_Registry::getInstance();
$config = $registry->get("config");
$redisConfig = $config['cache']['backend']['redis'];
$redis = new Predis\Client($redisConfig['servers']['global']);
return $redis;
}
示例4: _initBook
protected function _initBook()
{
$view = Zend_Registry::get('Zend_View');
$view->headScript()->appendFile($view->layout()->staticBaseUrl . 'application/modules/Book/externals/scripts/core.js');
$view->headTranslate('click to rate');
$view->headTranslate('you already rated');
$view->headTranslate('please log in to rate');
$view->headTranslate(array('%s rating', '%s ratings'));
$view->headTranslate('Thanks for rating');
Zend_Loader::loadFile('Bootstrap.php', $this->getModulePath() . '/libs/HTMLPurifier/', true);
}
示例5: subPostsAction
public function subPostsAction()
{
$request = $this->getRequest();
$uri_arr = explode('=', $request->getRequestUri());
$_GET['JSQUERYID'] = array_pop($uri_arr);
Zend_Loader::loadFile('JsDataLoader.php', 'Rp');
$id = $request->getParam('id');
$treePosts = new Rp_Db_View_TreePosts();
$result['pid'] = $id;
$result['posts'] = $treePosts->findChildPosts($id, true)->toArray();
$GLOBALS['_RESULT'] = $result;
exit;
}
示例6: __construct
function __construct()
{
$front = Zend_Controller_Front::getInstance();
$event_handlers = array();
$filters = array();
$dir = new DirectoryIterator(APPLICATION_DIRECTORY . "/plugins");
$plugins = array();
foreach ($dir as $file) {
$className = $file->getFilename();
if ($file->isDir() && $className[0] != '.' && $className[0] != '_') {
if (file_exists("plugins/{$className}/{$className}.php") && file_exists("plugins/{$className}/config.xml")) {
Zend_Loader::loadFile("plugins/{$className}/{$className}.php");
$class = new ReflectionClass($className);
if ($class->getParentClass() && ($class->getParentClass()->getName() == "Joobsbox_Plugin_Base" || $class->getParentClass()->getName() == "Joobsbox_Plugin_AdminBase")) {
foreach ($class->getMethods() as $method) {
$methodName = $method->getName();
if (strpos($methodName, "event_") !== FALSE) {
$eventName = substr($methodName, strpos($methodName, "_") + 1);
$event_handlers[$eventName][] = $className;
} elseif (strpos($methodName, "filter_") !== FALSE) {
$filterName = substr($methodName, strpos($methodName, "_") + 1);
$filters[$filterName][] = $className;
}
}
$plugins[$className] = new $className();
if ($class->getParentClass()->getName() == "Joobsbox_Plugin_AdminBase") {
$plugins[$className]->isAdmin = true;
}
$plugins[$className]->conf = new Zend_Config_Xml("plugins/{$className}/config.xml");
$plugins[$className]->path = "plugins/{$className}";
if (method_exists($plugins[$className], 'setPluginName')) {
$plugins[$className]->setPluginName($className);
}
if (method_exists($plugins[$className], 'initPlugin')) {
$plugins[$className]->initPlugin();
}
if (method_exists($plugins[$className], 'init')) {
$plugins[$className]->init();
}
if (method_exists($plugins[$className], 'startup')) {
$plugins[$className]->startup();
}
}
}
}
}
Zend_Registry::set("event_handler_plugins", $event_handlers);
Zend_Registry::set("filter_plugins", $filters);
Zend_Registry::set("plugins", $plugins);
}
示例7: dispatchLoopStartup
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
if (!isset($this->_modules[$module])) {
throw new Exception("Module does not exist!");
}
$bootstrapPath = $this->_modules[$module];
//$bootstrapFile = dirname($bootstrapPath) . '/Bootstrap.php';
$class = ucfirst($module) . '_Bootstrap';
if (Zend_Loader::loadFile('Bootstrap.php', dirname($bootstrapPath)) && class_exists($class)) {
$bootstrap = new $class(new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/modules/' . $module . '/configs/module.ini'));
$bootstrap->bootstrap();
}
}
示例8: initModules
/**
* PreDispatch actions
*
* Initialize module bootstraps
*
* @param Zend_Controller_Request_Abstract $request
* @return void
*/
public function initModules()
{
$modules = $this->front->getControllerDirectory();
foreach ($modules as $module => $dir) {
if ('default' == $module) {
continue;
}
$bootstrapFile = dirname($dir) . '/Bootstrap.php';
$class = ucfirst($module) . '_Bootstrap';
if (Zend_Loader::loadFile('Bootstrap.php', dirname($dir)) && class_exists($class)) {
$bootstrap = new $class();
$bootstrap->setAppBootstrap($this);
$bootstrap->bootstrap();
}
}
return $this;
}
示例9: codeHighlight
public function codeHighlight($source, $lang)
{
Zend_Loader::loadFile("geshi.php", array(config::getFilename("geshi/"), "/usr/share/php-geshi"), true);
if ($lang == "cpp") {
$lang = "C++";
}
if ($lang == "gcj") {
$lang = "Java";
}
if (!class_exists("GeSHi")) {
return "<!-- GeSHi disabled --> <pre>" . htmlspecialchars($source) . "</pre>";
}
$geshi = new GeSHi($source, $lang);
$geshi->set_header_type(GESHI_HEADER_PRE_TABLE);
$geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
$geshi->set_overall_class("geshi");
$code = $geshi->parse_code();
return $code;
}
示例10: getModel
/**
* Load a model class and return an object instance
*
* @param string $model
* @param string $module Use explicitly named module
* @return object
*/
public function getModel($model, $module = null)
{
$model = preg_replace_callback('/(\\b|_)([a-z])/i', create_function('$m', 'return $m[1].strtoupper($m[2]);'), $model);
$module = $module === null ? $this->_getModuleName() : $module;
$className = 'Model_' . $model;
if ('default' != $module) {
$className = ucfirst($module) . '_' . $className;
}
if (class_exists($className, false)) {
return new $className();
}
$modulePath = $this->_getModulePath($module);
$modelFileName = str_replace('_', '/', $model);
$modelFileName = $modulePath . '/models/' . $modelFileName . '.php';
if (!Zend_Loader::isReadable($modelFileName)) {
throw new Exception(sprintf('Invalid model (%s) specified; model class file (%s) not found', $model, $modelFileName));
}
Zend_Loader::loadFile($modelFileName);
return new $className();
}
示例11: __construct
public function __construct()
{
$this->lockFile = BASE_DIR . '/data/cache/__run_lock';
$this->jobData = array();
try {
if (!Zend_Loader::isReadable(self::$DATA_FILE, BASE_DIR . '/data/cache')) {
throw new Zend_Exception("Scheduled task cache not found");
}
Zend_Loader::loadFile(self::$DATA_FILE, BASE_DIR . '/data/cache', null, true);
global $__SCHEDULE_CACHE;
if (isset($__SCHEDULE_CACHE)) {
$this->jobData = $__SCHEDULE_CACHE;
} else {
$this->jobData = array();
}
} catch (Zend_Exception $e) {
// So create the cache dammit!
}
$this->lastRun = ifset($this->jobData, 'last_run', 0);
}
示例12: load
public function load()
{
$files = $this->_getFiles();
$manifestRegistry = Zend_Tool_Rpc_Manifest_Registry::getInstance();
$providerRegistry = Zend_Tool_Rpc_Provider_Registry::getInstance();
$classesLoadedBefore = get_declared_classes();
foreach ($files as $file) {
Zend_Loader::loadFile($file);
}
$classesLoadedAfter = get_declared_classes();
$loadedClasses = array_diff($classesLoadedAfter, $classesLoadedBefore);
foreach ($loadedClasses as $loadedClass) {
$reflectionClass = new ReflectionClass($loadedClass);
if ($reflectionClass->implementsInterface('Zend_Tool_Rpc_Manifest_Interface') && !$reflectionClass->isAbstract()) {
$manifestRegistry->addManifest($reflectionClass->newInstance());
}
if ($reflectionClass->implementsInterface('Zend_Tool_Rpc_Provider_Interface') && !$reflectionClass->isAbstract()) {
$providerRegistry->addProvider($reflectionClass->newInstance());
}
}
}
示例13: _initModules
/**
* Загружаем Bootstrap модулей
*/
protected function _initModules()
{
$this->bootstrap('Frontcontroller');
$this->bootstrap('Session');
$filesModules = glob(MODULES_PATH . DS . '*' . DS . 'Bootstrap.php');
$filesHeap = glob(HEAP_PATH . DS . '*' . DS . 'Bootstrap.php');
$bootstraps = array_merge($filesModules, $filesHeap);
$modules = array();
foreach ($bootstraps as $path) {
Zend_Loader::loadFile($path, null, 1);
$temp = explode(DS, $path);
$prefix = $temp[sizeof($temp) - 3] == 'Modules' ? 'Modules_' : '';
$bootstrapClass = $prefix . $temp[sizeof($temp) - 2] . '_Bootstrap';
if (class_exists($bootstrapClass, false)) {
$moduleBootstrap = new $bootstrapClass();
$moduleBootstrap->bootstrap();
$modules[$prefix . $temp[sizeof($temp) - 2]] = dirname($path);
}
}
Zend_Registry::set('modules', $modules);
}
示例14: dispatchLoopStartup
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
// $module = $request->getModuleName();
//
// if (!isset($this->_modules[$module])) {
// throw new Exception("Module does not exist!");
// }
//
// $bootstrapPath = $this->_modules[$module];
//
// $bootstrapFile = dirname($bootstrapPath) . '/Bootstrap.php';
// $class = ucfirst($module) . '_Bootstrap';
// $application = new Zend_Application(
// APPLICATION_ENV,
// APPLICATION_PATH . '/modules/' . $module . '/configs/module.ini'
// );
//
// if (Zend_Loader::loadFile('Bootstrap.php', dirname($bootstrapPath)) & class_exists($class)) {
// $bootstrap = new $class($application);
// $bootstrap->bootstrap();
// }
$front = Zend_Controller_Front::getInstance();
// Get current module name
$module = $request->getModuleName();
// Array module
$modules = $front->getParam('cmsModules');
$modulePath = $front->getParam("pathToModules");
if (isset($modules[$module])) {
$currentModulePath = $modulePath . '/' . $modules[$module];
$bootstrapFile = $currentModulePath . '/Bootstrap.php';
$class = ucfirst($modules[$module]) . '_Bootstrap';
$application = new Zend_Application(APPLICATION_ENV, $currentModulePath . '/configs/module.ini');
if (Zend_Loader::loadFile('Bootstrap.php', $currentModulePath) && class_exists($class)) {
$bootstrap = new $class($application);
$bootstrap->bootstrap();
}
}
}
示例15: includeType
/**
* Ensure that a given type is actually included
*
* @param string $class
*/
public function includeType($class)
{
if (empty($class)) {
throw new Exception("Cannot include null type");
}
$class = str_replace('.', '_', $class);
$dir = 'model';
$file = $class . '.php';
$source = $dir . DIRECTORY_SEPARATOR . $file;
$found = false;
if (!Zend_Loader::isReadable($source)) {
$extensions = array_merge(array('november'), za()->getExtensions());
foreach ($extensions as $extDir) {
$source = $extDir . DIRECTORY_SEPARATOR . 'model' . DIRECTORY_SEPARATOR . $file;
if (Zend_Loader::isReadable($source)) {
$found = true;
break;
}
}
} else {
$found = true;
}
if (!$found && endswith($class, 'Version')) {
// try including the non-version instance instead
return $this->includeType(substr($class, 0, strrpos($class, 'Version')));
}
try {
if (!class_exists($class, false)) {
Zend_Loader::loadFile(basename($source), APP_DIR . DIRECTORY_SEPARATOR . dirname($source), true);
}
} catch (Zend_Exception $ze) {
// ignore it, we'll just assume it was loaded elsewhere
}
if (!class_exists($class)) {
throw new Exception("Class {$class} not found in the model directory");
}
}