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


PHP Zend_Loader::isReadable方法代码示例

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


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

示例1: setAdapter

 /**
  * Sets new encryption options
  *
  * @param  string|array $options (Optional) Encryption options
  * @return Zend_Filter_Encrypt
  */
 public function setAdapter($options = null)
 {
     if (is_string($options)) {
         $adapter = $options;
     } else {
         if (isset($options['adapter'])) {
             $adapter = $options['adapter'];
             unset($options['adapter']);
         } else {
             $adapter = 'Mcrypt';
         }
     }
     if (!is_array($options)) {
         $options = array();
     }
     if (Zend_Loader::isReadable('Zend/Filter/Encrypt/' . ucfirst($adapter) . '.php')) {
         $adapter = 'Zend_Filter_Encrypt_' . ucfirst($adapter);
     }
     if (!class_exists($adapter)) {
         Zend_Loader::loadClass($adapter);
     }
     $this->_adapter = new $adapter($options);
     if (!$this->_adapter instanceof Zend_Filter_Encrypt_Interface) {
         require_once 'Zend/Filter/Exception.php';
         throw new Zend_Filter_Exception("Encoding adapter '" . $adapter . "' does not implement Zend_Filter_Encrypt_Interface");
     }
     return $this;
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:34,代码来源:Encrypt.php

示例2: loadClass

 /**
  * Load a controller class
  *
  * Attempts to load the controller class file from
  * {@link getControllerDirectory()}.  If the controller belongs to a
  * module, looks for the module prefix to the controller class.
  *
  * @param string $className
  * @return string Class name loaded
  * @throws Zend_Controller_Dispatcher_Exception if class not loaded
  */
 public function loadClass($className)
 {
     $finalClass = $className;
     if ($this->_defaultModule != $this->_curModule || $this->getParam('prefixDefaultModule')) {
         $finalClass = $this->formatClassName($this->_curModule, $className);
     }
     if (class_exists($finalClass, false)) {
         return $finalClass;
     }
     $fileName = $this->classToFilename($className);
     $loadFile = APPLICATION_PATH . '/../customization/modules/' . $this->_curModule . '/controllers/' . $fileName;
     if (Zend_Loader::isReadable($loadFile)) {
         include_once $loadFile;
     } else {
         $dispatchDir = $this->getDispatchDirectory();
         $loadFile = $dispatchDir . DIRECTORY_SEPARATOR . $fileName;
         if (Zend_Loader::isReadable($loadFile)) {
             include_once $loadFile;
         } else {
             require_once 'Zend/Controller/Dispatcher/Exception.php';
             throw new Zend_Controller_Dispatcher_Exception('Cannot load controller class "' . $className . '" from file "' . $loadFile . "'");
         }
     }
     if (!class_exists($finalClass, false)) {
         require_once 'Zend/Controller/Dispatcher/Exception.php';
         throw new Zend_Controller_Dispatcher_Exception('Invalid controller class ("' . $finalClass . '")');
     }
     return $finalClass;
 }
开发者ID:bokultis,项目名称:kardiomedika,代码行数:40,代码来源:Dispatcher.php

示例3: isValid

 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if the mimetype of the file does not matche the given ones. Also parts
  * of mimetypes can be checked. If you give for example "image" all image
  * mime types will not be accepted like "image/gif", "image/jpeg" and so on.
  *
  * @param  string $value Real file to check for mimetype
  * @param  array  $file  File data from Zend_File_Transfer
  * @return boolean
  */
 public function isValid($value, $file = null)
 {
     if ($file === null) {
         $file = array('type' => null, 'name' => $value);
     }
     // Is file readable ?
     //require_once 'Zend/Loader.php';
     if (!Zend_Loader::isReadable($value)) {
         return $this->_throw($file, self::NOT_READABLE);
     }
     $this->_type = $this->_detectMimeType($value);
     if (empty($this->_type) && $this->_headerCheck) {
         $this->_type = $file['type'];
     }
     if (empty($this->_type)) {
         return $this->_throw($file, self::NOT_DETECTED);
     }
     $mimetype = $this->getMimeType(true);
     if (in_array($this->_type, $mimetype)) {
         return $this->_throw($file, self::FALSE_TYPE);
     }
     $types = explode('/', $this->_type);
     $types = array_merge($types, explode('-', $this->_type));
     foreach ($mimetype as $mime) {
         if (in_array($mime, $types)) {
             return $this->_throw($file, self::FALSE_TYPE);
         }
     }
     return true;
 }
开发者ID:ddxmaaa,项目名称:wecenter-loudong,代码行数:41,代码来源:ExcludeMimeType.php

示例4: isValid

 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if the mimetype of the file does not matche the given ones. Also parts
  * of mimetypes can be checked. If you give for example "image" all image
  * mime types will not be accepted like "image/gif", "image/jpeg" and so on.
  *
  * @param  string $value Real file to check for mimetype
  * @param  array  $file  File data from Zend_File_Transfer
  * @return boolean
  */
 public function isValid($value, $file = null)
 {
     // Is file readable ?
     require_once 'Zend/Loader.php';
     if (!Zend_Loader::isReadable($value)) {
         return $this->_throw($file, self::NOT_READABLE);
     }
     if ($file !== null) {
         if (class_exists('finfo', false) && defined('MAGIC')) {
             $mime = new finfo(FILEINFO_MIME);
             $this->_type = $mime->file($value);
             unset($mime);
         } elseif (function_exists('mime_content_type') && ini_get('mime_magic.magicfile')) {
             $this->_type = mime_content_type($value);
         } else {
             $this->_type = $file['type'];
         }
     }
     if (empty($this->_type)) {
         return $this->_throw($file, self::NOT_DETECTED);
     }
     $mimetype = $this->getMimeType(true);
     if (in_array($this->_type, $mimetype)) {
         return $this->_throw($file, self::FALSE_TYPE);
     }
     $types = explode('/', $this->_type);
     $types = array_merge($types, explode('-', $this->_type));
     foreach ($mimetype as $mime) {
         if (in_array($mime, $types)) {
             return $this->_throw($file, self::FALSE_TYPE);
         }
     }
     return true;
 }
开发者ID:quangbt2005,项目名称:vhost-kis,代码行数:45,代码来源:ExcludeMimeType.php

示例5: isValid

 /**
  * Defined by Zend_Validate_Interface
  *
  * Returns true if and only if the fileextension of $value is not included in the
  * set extension list
  *
  * @param  string  $value Real file to check for extension
  * @param  array   $file  File data from Zend_File_Transfer
  * @return boolean
  */
 public function isValid($value, $file = null)
 {
     // Is file readable ?
     // require_once 'Zend/Loader.php';
     if (!Zend_Loader::isReadable($value)) {
         return $this->_throw($file, self::NOT_FOUND);
     }
     if ($file !== null) {
         $info['extension'] = substr($file['name'], strrpos($file['name'], '.') + 1);
     } else {
         $info = pathinfo($value);
     }
     $extensions = $this->getExtension();
     if ($this->_case and !in_array($info['extension'], $extensions)) {
         return true;
     } else {
         if (!$this->_case) {
             $found = false;
             foreach ($extensions as $extension) {
                 if (strtolower($extension) == strtolower($info['extension'])) {
                     $found = true;
                 }
             }
             if (!$found) {
                 return true;
             }
         }
     }
     return $this->_throw($file, self::FALSE_EXTENSION);
 }
开发者ID:FluentDevelopment,项目名称:piwik,代码行数:40,代码来源:ExcludeExtension.php

示例6: autoload

 public function autoload($class)
 {
     if (substr($class, 0, 10) === 'ViewHelper') {
         $class = substr($class, 11);
         $path = APPLICATION_PATH . '/modules/' . MODULE_NAME . '/views/helpers/' . $class . '.php';
         if (Zend_Loader::isReadable($path)) {
             @(include $path);
             return true;
         }
     }
     if (substr($class, -10) === 'Controller') {
         $path = APPLICATION_PATH . '/modules/' . MODULE_NAME . '/controllers/' . $class . '.php';
         if (Zend_Loader::isReadable($path)) {
             @(include $path);
             return true;
         }
     }
     if (substr($class, -4) === 'Form') {
         $path = APPLICATION_PATH . '/modules/' . MODULE_NAME . '/forms/' . $class . '.php';
         if (Zend_Loader::isReadable($path)) {
             @(include $path);
             return true;
         }
     }
     $paths = array(APPLICATION_PATH . '/modules/' . MODULE_NAME . '/models', APPLICATION_PATH . '/../library/Bbx/Vendor');
     foreach ($paths as $p) {
         $classPath = $p . '/' . $class . '.php';
         if (Zend_Loader::isReadable($classPath)) {
             @(include $classPath);
             return true;
         }
     }
     return false;
 }
开发者ID:rdallasgray,项目名称:bbx,代码行数:34,代码来源:Autoloader.php

示例7: preDispatch

 /**
  * Pre-dispatch routine
  *
  * This will replace the default pre-dispatch routine and call
  * the action-level pre-dispatch function, if it exists. This
  * gives us more flexibility in controlling the process flow.
  *
  * @return void
  */
 public function preDispatch()
 {
     // Get controller and action names
     $controller = $this->getRequest()->getControllerName();
     $action = $this->getRequest()->getActionName();
     // Automatically add CSS and JS
     $cssFiles = array('default.css', $controller . '.css', $controller . '/' . $action . '.css');
     $cssPrintFiles = array('default.print.css', $controller . '.print.css', $controller . '/' . $action . '.print.css');
     $headLink = $this->view->headLink();
     foreach ($cssFiles as $file) {
         if (!Zend_Loader::isReadable(ZFE_Environment::getFilePath('/css/' . $file))) {
             continue;
         }
         $headLink->appendStylesheet('/css/' . $file, 'screen, print');
     }
     foreach ($cssPrintFiles as $file) {
         if (!Zend_Loader::isReadable(ZFE_Environment::getFilePath('/css/' . $file))) {
             continue;
         }
         $headLink->appendStylesheet('/css/' . $file, 'print');
     }
     $jsFiles = array('default.js', $controller . '.js', $controller . '/' . $action . '.js');
     $headScript = $this->view->headScript();
     foreach ($jsFiles as $file) {
         if (!Zend_Loader::isReadable(ZFE_Environment::getFilePath('/js/' . $file))) {
             continue;
         }
         $headScript->appendFile('/js/' . $file);
     }
     // Call the action's pre-function
     $func = 'pre' . ucfirst(strtolower($action)) . 'Action';
     if (method_exists($this, $func)) {
         $this->{$func}();
     }
 }
开发者ID:wthielen,项目名称:zf1e,代码行数:44,代码来源:Base.php

示例8: registerTranslation

 public function registerTranslation($langCode)
 {
     // we are certainly in LogStats mode, Zend is not loaded
     if (!class_exists('Zend_Loader')) {
         return;
     }
     $infos = $this->getInformation();
     if (!isset($infos['translationAvailable'])) {
         $infos['translationAvailable'] = false;
     }
     $translationAvailable = $infos['translationAvailable'];
     if (!$translationAvailable) {
         return;
     }
     $name = $infos['name'];
     $path = "plugins/" . $name . "/lang/%s.php";
     $defaultLangPath = sprintf($path, $langCode);
     $defaultEnglishLangPath = sprintf($path, 'en');
     $translations = array();
     if (Zend_Loader::isReadable($defaultLangPath)) {
         require $defaultLangPath;
     } elseif (Zend_Loader::isReadable($defaultEnglishLangPath)) {
         require $defaultEnglishLangPath;
     } else {
         throw new Exception("Language file not found for the plugin '{$name}'.");
     }
     Piwik_Translate::getInstance()->addTranslationArray($translations);
 }
开发者ID:Doluci,项目名称:tomatocart,代码行数:28,代码来源:Plugin.php

示例9: getActions

 public static function getActions($filter = false, $module, $controller)
 {
     $controller = ucfirst($controller) . 'Controller.php';
     $loadFile = _BASE_PATH . 'application/modules/' . $module . '/controllers/' . $controller;
     if (Zend_Loader::isReadable($loadFile)) {
         /** @noinspection PhpIncludeInspection */
         include_once $loadFile;
     }
     if ($module == 'default') {
         $controller = substr($controller, 0, -4);
     } else {
         $controller = ucfirst($module) . '_' . substr($controller, 0, -4);
     }
     $res = array();
     try {
         $reflection = new ReflectionClass($controller);
         $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
         foreach ($methods as $method) {
             $method = $method->name;
             if (false !== strpos($method, 'Action')) {
                 $name = str_replace('Action', '', $method);
                 $res[$name] = $name;
             }
         }
     } catch (ReflectionException $e) {
         //TODO $x = 1;
     }
     return $res;
 }
开发者ID:dafik,项目名称:dfi,代码行数:29,代码来源:Resource.php

示例10: direct

 public function direct($options = array())
 {
     // Set default options as to where the CSS and JS directories are
     if (is_null($this->_options)) {
         $this->_options = $this->_defaultOptions;
     }
     // Merge passed options with default options
     $this->_options = array_merge($this->_defaultOptions, $options);
     // Store basename here
     $basename = 'bootstrap';
     $css = $basename . '.css';
     $js = $basename . '.js';
     // Check if minified versions exist for production environment
     if ($this->_options['minified']) {
         $cssPath = $_SERVER['DOCUMENT_ROOT'] . $this->_options['css'];
         if (Zend_Loader::isReadable($cssPath . '/' . $basename . '.min.css')) {
             $css = $basename . '.min.css';
         }
         $jsPath = $_SERVER['DOCUMENT_ROOT'] . $this->_options['js'];
         if (Zend_Loader::isReadable($jsPath . '/' . $basename . '.min.js')) {
             $js = $basename . '.min.js';
         }
     }
     // Add files to view
     $controller = $this->getActionController();
     $controller->view->headLink()->appendStylesheet($this->_options['css'] . '/' . $css);
     $controller->view->headScript()->appendFile($this->_options['js'] . '/' . $js);
 }
开发者ID:wthielen,项目名称:zf1e,代码行数:28,代码来源:Bootstrap.php

示例11: isControllerDispatchable

 /**
  * Returns TRUE if module and controller pair can be dispatched to
  *
  * @param Zend_Controller_Request_Abstract $action
  * @return boolean
  */
 public function isControllerDispatchable($moduleName, $controllerName)
 {
     $dirs = $this->getFrontController()->getControllerDirectory();
     if (!$this->isValidModule($moduleName)) {
         return false;
     }
     $path = $dirs[$moduleName] . DIRECTORY_SEPARATOR . $this->classToFilename($this->formatControllerName($controllerName));
     return Zend_Loader::isReadable($path);
 }
开发者ID:jon9872,项目名称:zend-framework,代码行数:15,代码来源:Standard.php

示例12: getPhpImageSize

 public function getPhpImageSize()
 {
     if (is_null($this->_phpImageSize)) {
         if (!Zend_Loader::isReadable($this->getFileName())) {
             throw new Exception("Cannot read image information from {$this->getFileName()}");
         }
         $this->_phpImageSize = getimagesize($this->getFileName());
     }
     return $this->_phpImageSize;
 }
开发者ID:html,项目名称:PI,代码行数:10,代码来源:Gd.php

示例13: _initAutoLoader

 protected function _initAutoLoader()
 {
     set_include_path(implode(PATH_SEPARATOR, array(APPLICATION_PATH . "/models", get_include_path())));
     spl_autoload_register(function ($className) {
         //Write a very simple custom autoloader for models...
         if (Zend_Loader::isReadable("{$className}.php")) {
             require_once "{$className}.php";
         }
     });
 }
开发者ID:radalin,项目名称:pgday2012-task,代码行数:10,代码来源:Bootstrap.php

示例14: autoload

 public static function autoload($className)
 {
     if (Zend_Loader::isReadable("{$className}.php")) {
         require_once "{$className}.php";
     } else {
         if (Zend_Loader::isReadable("tables/{$className}.php")) {
             require_once "tables/{$className}.php";
         }
     }
 }
开发者ID:radalin,项目名称:zf-examples,代码行数:10,代码来源:Autoloader.php

示例15: isDispatchable

 /**
  * Расширяем диспетчер для функционала описанного в методе loadClass
  * 
  * @param Zend_Controller_Request_Abstract $action
  * @return boolean
  */
 public function isDispatchable(Zend_Controller_Request_Abstract $request)
 {
     $isDispatchable = parent::isDispatchable($request);
     if (!$isDispatchable) {
         $className = $this->getControllerClass($request);
         $systemControllerDir = $this->_modulesControllerDirectory();
         $isDispatchable = Zend_Loader::isReadable($systemControllerDir . DS . $this->classToFilename($className));
     }
     return $isDispatchable;
 }
开发者ID:kytvi2p,项目名称:ZettaFramework,代码行数:16,代码来源:Standard.php


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