当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend::isReadable方法代码示例

本文整理汇总了PHP中Zend::isReadable方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend::isReadable方法的具体用法?PHP Zend::isReadable怎么用?PHP Zend::isReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend的用法示例。


在下文中一共展示了Zend::isReadable方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testIsReadable

 public function testIsReadable()
 {
     $this->assertTrue(Zend::isReadable(__FILE__));
     $this->assertFalse(Zend::isReadable(__FILE__ . '.foobaar'));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:5,代码来源:ZendTest.php

示例2: _dispatch

 /**
  * If $performDispatch is FALSE, this method will check if a controller
  * file exists.  This still doesn't necessarily mean that it can be dispatched
  * in the stricted sense, as file may not contain the controller class or the
  * controller may reject the action.
  *
  * If $performDispatch is TRUE, then this method will actually
  * instantiate the controller and call its action.  Calling the action
  * is done by passing a Zend_Controller_Dispatcher_Token to the controller's constructor.
  *
  * @param Zend_Controller_Dispatcher_Token $action
  * @param boolean $performDispatch
  * @return boolean|Zend_Controller_Dispatcher_Token
  */
 protected function _dispatch(Zend_Controller_Dispatcher_Token $action, $performDispatch)
 {
     if ($this->_directory === null) {
         throw new Zend_Controller_Dispatcher_Exception('Controller directory never set.  Use setControllerDirectory() first.');
     }
     $className = $this->formatControllerName($action->getControllerName());
     /**
      * If $performDispatch is FALSE, only determine if the controller file
      * can be accessed.
      */
     if (!$performDispatch) {
         return Zend::isReadable($this->_directory . DIRECTORY_SEPARATOR . $className . '.php');
     }
     Zend::loadClass($className, $this->_directory);
     $controller = new $className();
     if (!$controller instanceof Zend_Controller_Action) {
         throw new Zend_Controller_Dispatcher_Exception("Controller \"{$className}\" is not an instance of Zend_Controller_Action.");
     }
     /**
      * Dispatch
      *
      * Call the action of the Zend_Controller_Action.  It will return either null or a
      * new Zend_Controller_Dispatcher_Token object.  If a Zend_Controller_Dispatcher_Token object is returned, this will be returned
      * back to ZFrontController, which will call $this again to forward to
      * another action.
      */
     $nextAction = $controller->run($this, $action);
     // Destroy the page controller instance
     $controller = null;
     // Return either null (finished) or a Zend_Controller_Dispatcher_Token object (forward to another action).
     return $nextAction;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:46,代码来源:Dispatcher.php

示例3: _getController

 /**
  * Get controller name
  *
  * Try request first; if not found, try pulling from request parameter; 
  * if still not found, fallback to default
  *
  * @param Zend_Controller_Request_Abstract $request
  * @param array $directories
  * @return string|false Returns class name on success
  */
 protected function _getController($request, $directories = null)
 {
     if (null === $directories) {
         $directories = $this->getControllerDirectory();
     }
     if (empty($directories)) {
         throw Zend::exception('Zend_Controller_Dispatcher_Exception', 'Controller directory never set.  Use setControllerDirectory() first');
     }
     $controllerName = $request->getControllerName();
     if (empty($controllerName)) {
         $controllerName = $this->getDefaultController();
         $request->setControllerName($controllerName);
     }
     $className = $this->formatControllerName($controllerName);
     /**
      * Determine if controller is dispatchable
      *
      * Checks to see if a module name is present in the request; if so, 
      * checks for class file existing in module directory. Otherwise, loops through 
      * directories in FIFO order to find it.
      */
     $dispatchable = false;
     $module = (string) $request->getParam('module', false);
     if ($module && isset($directories[$module])) {
         $dispatchable = Zend::isReadable($directories[$module] . DIRECTORY_SEPARATOR . $className . '.php');
         if ($dispatchable) {
             $this->_curDirectory = $directories[$module];
         }
     } else {
         foreach ($directories as $directory) {
             $dispatchable = Zend::isReadable($directory . DIRECTORY_SEPARATOR . $className . '.php');
             if ($dispatchable) {
                 $this->_curDirectory = $directory;
                 break;
             }
         }
     }
     return $dispatchable ? $className : false;
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:49,代码来源:Dispatcher.php

示例4: _dispatch

 /**
  * If $performDispatch is FALSE, this method will check if a controller
  * file exists.  This still doesn't necessarily mean that it can be dispatched
  * in the stricted sense, as file may not contain the controller class or the
  * controller may reject the action.
  *
  * If $performDispatch is TRUE, then this method will actually
  * instantiate the controller and call its action.  Calling the action
  * is done by passing a Zend_Controller_Dispatcher_Token to the controller's constructor.
  *
  * @param Zend_Controller_Request_Abstract $request
  * @param boolean $performDispatch
  * @return void
  */
 protected function _dispatch(Zend_Controller_Request_Abstract $request, $performDispatch = true)
 {
     /**
      * Controller directory check
      */
     if ($this->_directory === null) {
         throw new Zend_Controller_Dispatcher_Exception('Controller directory never set.  Use setControllerDirectory() first');
     }
     /**
      * Get controller name
      *
      * Try request first; if not found, try pulling from request parameter; 
      * if still not found, fallback to default
      */
     $controllerName = $request->getControllerName();
     if (empty($controllerName)) {
         $controllerName = $this->getDefaultController();
     }
     $className = $this->formatControllerName($controllerName);
     /**
      * Determine if controller is dispatchable
      */
     $dispatchable = Zend::isReadable($this->_directory . DIRECTORY_SEPARATOR . $className . '.php');
     /**
      * If $performDispatch is FALSE, only determine if the controller file
      * can be accessed.
      */
     if (!$performDispatch) {
         return $dispatchable;
     }
     /**
      * If not dispatchable, get the default controller; if this is already 
      * the default controller, throw an exception
      */
     if (!$dispatchable) {
         if ($controllerName == $this->getDefaultController()) {
             throw new Zend_Controller_Dispatcher_Exception('Default controller class not defined');
         }
         $className = $this->formatControllerName($this->getDefaultController());
     }
     /**
      * Load the controller class file
      */
     Zend::loadClass($className, $this->_directory);
     /**
      * Perform reflection on the class and verify it's a controller
      */
     $reflection = new ReflectionClass($className);
     if (!$reflection->isSubclassOf(new ReflectionClass('Zend_Controller_Action'))) {
         throw new Zend_Controller_Dispatcher_Exception("Controller \"{$className}\" is not an instance of Zend_Controller_Action");
     }
     /**
      * Get any instance arguments and instantiate a controller object
      */
     $argv = $this->getParams();
     /**
      * Prepend response object to arguments
      */
     array_unshift($argv, $this->getResponse());
     /**
      * Prepend request object to arguments
      */
     array_unshift($argv, $request);
     /**
      * Instantiate controller with arguments
      */
     $controller = $reflection->newInstanceArgs($argv);
     /**
      * Determine the action name
      *
      * First attempt to retrieve from request; then from request params 
      * using action key; default to default action
      */
     $action = $request->getActionName();
     if (empty($action)) {
         $action = $this->getDefaultAction();
     }
     $action = $this->formatActionName($action);
     $invokeArgs = array();
     /**
      * If method does not exist, default to __call()
      */
     if (!$reflection->hasMethod($action)) {
         $invokeArgs = array($action, array());
         $action = '__call';
     }
//.........这里部分代码省略.........
开发者ID:jorgenils,项目名称:zend-framework,代码行数:101,代码来源:Dispatcher.php

示例5: _loadClass

 /**
  * Loads a helper or filter class.
  *
  * @param string $type The class type ('helper' or 'filter').
  * @param string $name The base name.
  * @param string The full class name.
  */
 private function _loadClass($type, $name)
 {
     // check to see if name => class mapping exists for helper/filter
     $classLoaded = '_' . $type . 'Loaded';
     $classAccess = '_set' . ucfirst($type) . 'Class';
     if (isset($this->{$classLoaded}[$name])) {
         echo "Already loaded {$name} per {$classLoaded}\n", var_export($this->{$classLoaded}, 1), "\n";
         return $this->{$classLoaded}[$name];
     }
     // only look for "$Name.php"
     $file = ucfirst($name) . '.php';
     // do LIFO search for helper
     foreach ($this->_path[$type] as $info) {
         $dir = $info['dir'];
         $prefix = $info['prefix'];
         $class = $prefix . ucfirst($name);
         if (class_exists($class, false)) {
             $this->{$classAccess}($name, $class);
             return $class;
         } elseif (Zend::isReadable($dir . $file)) {
             include_once $dir . $file;
             if (class_exists($class, false)) {
                 $this->{$classAccess}($name, $class);
                 return $class;
             }
         }
     }
     require_once 'Zend/View/Exception.php';
     throw new Zend_View_Exception("{$type} '{$name}' not found in path");
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:37,代码来源:Abstract.php

示例6: getDefaultControllerClass

 /**
  * Retrieve default controller class
  *
  * Determines whether the default controller to use lies within the 
  * requested module, or if the global default should be used.
  *
  * By default, will only use the module default unless that controller does 
  * not exist; if this is the case, it falls back to the default controller 
  * in the default module.
  * 
  * @param Zend_Controller_Request_Abstract $request 
  * @return string
  */
 public function getDefaultControllerClass(Zend_Controller_Request_Abstract $request)
 {
     $controller = $this->getDefaultControllerName();
     $default = $this->formatControllerName($controller);
     $request->setControllerName($controller)->setActionName(null);
     $module = $request->getModuleName();
     $controllerDirs = $this->getControllerDirectory();
     $this->_curModule = 'default';
     $this->_curDirectory = $controllerDirs['default'];
     if ($this->isValidModule($module)) {
         $moduleDir = $controllerDirs[$module];
         $fileSpec = $moduleDir . DIRECTORY_SEPARATOR . $this->classToFilename($default);
         if (Zend::isReadable($fileSpec)) {
             $this->_curModule = $this->formatModuleName($module);
             $this->_curDirectory = $moduleDir;
         }
     }
     return $default;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:32,代码来源:Standard.php


注:本文中的Zend::isReadable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。