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


PHP FileManager::isFileReadable方法代码示例

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


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

示例1: getIconURL

 /**
  * Return URL for module icon
  *
  * @return string
  */
 public static function getIconURL()
 {
     list($author, $name) = explode('\\', \Includes\Utils\ModulesManager::getModuleNameByClassName(get_called_class()));
     $path = \Includes\Utils\ModulesManager::getModuleIconFile($author, $name);
     $url = '';
     if (\Includes\Utils\FileManager::isFileReadable($path)) {
         $url = \XLite\Core\Converter::buildURL('module', null, compact('author', 'name'), 'image.php');
     }
     return $url;
 }
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:AModule.php

示例2: getClassesTree

 /**
  * Return classes tree
  * 
  * @param boolean $create Flag OPTIONAL
  *  
  * @return \Includes\Decorator\DataStructure\Graph\Classes
  */
 public static function getClassesTree($create = true)
 {
     if (!isset(static::$classesTree) && $create) {
         if (\Includes\Utils\FileManager::isFileReadable(static::getClassesHashPath())) {
             $data = unserialize(\Includes\Utils\FileManager::read(static::getClassesHashPath()));
             static::$classesTree = array_pop($data);
         } else {
             static::$classesTree = \Includes\Decorator\Utils\Operator::createClassesTree();
         }
     }
     return static::$classesTree;
 }
开发者ID:kingsj,项目名称:core,代码行数:19,代码来源:ADecorator.php

示例3: getDBSchema

 /**
  * Get schema
  *
  * @return array
  */
 public static function getDBSchema()
 {
     if (!isset(static::$schema)) {
         $path = static::getDBSchemaFilePath();
         if (\Includes\Utils\FileManager::isFileReadable($path)) {
             $content = \Includes\Utils\FileManager::read($path);
             if ($content) {
                 static::$schema = explode(';', $content);
             }
         }
     }
     return static::$schema;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:18,代码来源:DBSchemaManager.php

示例4: getFixtures

 /**
  * Get fixtures paths list
  *
  * @return array
  */
 public static function getFixtures()
 {
     if (!isset(static::$fixtures)) {
         static::$fixtures = array();
         $path = static::getFixturesFilePath();
         if (\Includes\Utils\FileManager::isFileReadable($path)) {
             foreach (parse_ini_file($path, false) as $file) {
                 if (static::checkFile($file)) {
                     static::$fixtures[] = $file;
                 }
             }
         }
     }
     return static::$fixtures;
 }
开发者ID:kingsj,项目名称:core,代码行数:20,代码来源:FixturesManager.php

示例5: upgrade

 /**
  * Perform upgrade
  *
  * @param boolean    $isTestMode       Flag OPTIONAL
  * @param array|null $filesToOverwrite List of custom files to overwrite OPTIONAL
  *
  * @return void
  */
 public function upgrade($isTestMode = true, $filesToOverwrite = null)
 {
     parent::upgrade($isTestMode, $filesToOverwrite);
     if (!$isTestMode) {
         list($author, $name) = explode('\\', $this->getActualName());
         if (!$this->isValid()) {
             \Includes\SafeMode::markModuleAsUnsafe($author, $name);
         }
         // Load fixtures
         if (!$this->isInstalled()) {
             $yaml = \Includes\Utils\ModulesManager::getModuleYAMLFile($author, $name);
             if (\Includes\Utils\FileManager::isFileReadable($yaml)) {
                 \XLite\Core\Database::getInstance()->loadFixturesFromYaml($yaml);
             }
         }
         $this->updateDBRecords();
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:26,代码来源:AModule.php

示例6: getPlugins

 /**
  * Return list of registered plugins
  *
  * @param string $hook Hook name OPTIONAL
  *
  * @return array
  */
 protected static function getPlugins($hook = null)
 {
     if (!isset(static::$plugins)) {
         // Check config file
         if (\Includes\Utils\FileManager::isFileReadable(static::getConfigFile())) {
             // Iterate over all sections
             foreach (parse_ini_file(static::getConfigFile(), true) as $section => $plugins) {
                 // Set plugins order
                 asort($plugins, SORT_NUMERIC);
                 // Save plugins list
                 static::$plugins[$section] = array_fill_keys(array_keys($plugins), null);
             }
         } else {
             \Includes\ErrorHandler::fireError('Unable to read config file for the Decorator plugins');
         }
     }
     return \Includes\Utils\ArrayManager::getIndex(static::$plugins, $hook);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:25,代码来源:PluginManager.php

示例7: bindRegionsToUK

function bindRegionsToUK()
{
    $statesFile = __DIR__ . LC_DS . 'regionForUkStates.yaml';
    if (!\Includes\Utils\FileManager::isFileReadable($statesFile)) {
        return false;
    }
    $data = \Symfony\Component\Yaml\Yaml::parse($statesFile);
    foreach ($data['states'] as $state) {
        $foundByCode = \XLite\Core\Database::getRepo('XLite\\Model\\State')->findOneBy(array('code' => $state['code']));
        // If we found state with code we should bind region
        if ($foundByCode) {
            $region = \XLite\Core\Database::getRepo('XLite\\Model\\Region')->findOneBy(array('code' => $state['region']['code']));
            if ($region) {
                $foundByCode->setRegion($region);
            }
        }
    }
    \XLite\Core\Database::getEM()->flush();
    return true;
}
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:20,代码来源:post_rebuild.php

示例8: __construct

 /**
  * Overloaded constructor
  *
  * @param string $path Path to the module package
  *
  * @return void
  */
 public function __construct($path)
 {
     if (!\Includes\Utils\FileManager::isFileReadable($path)) {
         \Includes\ErrorHandler::fireError('Unable to read module package: "' . $path . '"');
     }
     $this->setRepositoryPath($path);
     $module = new \PharData($this->getRepositoryPath());
     $this->metadata = $module->getMetaData();
     if (empty($this->metadata)) {
         \Includes\ErrorHandler::fireError('Unable to read module metadata: "' . $path . '"');
     }
     parent::__construct();
 }
开发者ID:kingsj,项目名称:core,代码行数:20,代码来源:Uploaded.php

示例9: uploadSQLFromFile

 /**
  * Execute a set of SQL queries from file
  *
  * :FIXME: must be completely revised
  *
  * @param string  $fileName Name of SQL-file
  * @param boolean $verbose  Display uploading progress flag OPTIONAL
  *
  * @return boolean
  */
 public static function uploadSQLFromFile($fileName, $verbose = false)
 {
     $result = false;
     if (false == \Includes\Utils\FileManager::isFileReadable($fileName)) {
         throw new \InvalidArgumentException(sprintf('SQL file \'%s\' not found or is not readable', $fileName));
     } else {
         $fp = fopen($fileName, 'rb');
         $sql = '';
         $result = true;
         while ($result && !feof($fp)) {
             $c = '';
             // Read SQL statement from file
             do {
                 $c .= fgets($fp, 1024);
                 $endPos = strlen($c) - 1;
             } while (substr($c, $endPos) != PHP_EOL && !feof($fp));
             $c = rtrim($c);
             // Skip comments
             if (substr($c, 0, 1) == '#' || substr($c, 0, 2) == '--') {
                 continue;
             }
             // Parse SQL statement
             $sql .= $c;
             if (substr($sql, -1) == ';') {
                 $sql = substr($sql, 0, strlen($sql) - 1);
                 // Execute SQL query
                 try {
                     static::getHandler()->beginTransaction();
                     $result = false !== static::exec($sql);
                     if ($result) {
                         static::getHandler()->commit();
                     } else {
                         static::getHandler()->rollBack();
                     }
                     if ($verbose) {
                         echo '.';
                         flush();
                     }
                 } catch (\PDOException $e) {
                     static::getHandler()->rollBack();
                     $result = false;
                     echo '<br />' . $e->getMessage();
                 }
                 $sql = '';
             }
         }
         fclose($fp);
     }
     return $result;
 }
开发者ID:kingsj,项目名称:core,代码行数:60,代码来源:Database.php

示例10: uninstallModule

 /**
  * Uninstall module
  *
  * @param \XLite\Model\Module $module    Module object
  * @param array               &$messages Messages list
  *
  * @return boolean
  */
 public function uninstallModule(\XLite\Model\Module $module, &$messages)
 {
     $result = false;
     // Get module pack
     $pack = new \XLite\Core\Pack\Module($module);
     $dirs = $pack->getDirs();
     $nonWritableDirs = array();
     // Check module directories permissions
     foreach ($dirs as $dir) {
         if (\Includes\Utils\FileManager::isExists($dir) && !\Includes\Utils\FileManager::isDirWriteable($dir)) {
             $nonWritableDirs[] = \Includes\Utils\FileManager::getRelativePath($dir, LC_DIR_ROOT);
         }
     }
     $params = array('name' => sprintf('%s v%s (%s)', $module->getModuleName(), $module->getVersion(), $module->getAuthorName()));
     if (empty($nonWritableDirs)) {
         $yamlData = array();
         $yamlFiles = \Includes\Utils\ModulesManager::getModuleYAMLFiles($module->getAuthor(), $module->getName());
         foreach ($yamlFiles as $yamlFile) {
             $yamlData[] = \Includes\Utils\FileManager::read($yamlFile);
         }
         if (!$module->checkModuleMainClass()) {
             $classFile = LC_DIR_CLASSES . \Includes\Utils\Converter::getClassFile($module->getMainClass());
             if (\Includes\Utils\FileManager::isFileReadable($classFile)) {
                 require_once $classFile;
             }
         }
         // Call uninstall event method
         $r = $module->callModuleMethod('callUninstallEvent', 111);
         if (111 == $r) {
             \XLite\Logger::getInstance()->log($module->getActualName() . ': Method callUninstallEvent() was not called');
         }
         // Remove from FS
         foreach ($dirs as $dir) {
             \Includes\Utils\FileManager::unlinkRecursive($dir);
         }
         \Includes\Utils\ModulesManager::disableModule($module->getActualName());
         \Includes\Utils\ModulesManager::removeModuleFromDisabledStructure($module->getActualName());
         // Remove module from DB
         try {
             // Refresh module entity as it was changed by disableModule() method above
             $module = $this->find($module->getModuleID());
             $this->delete($module);
         } catch (\Exception $e) {
             $messages[] = $e->getMessage();
         }
         if ($module->getModuleID()) {
             $messages[] = \XLite\Core\Translation::getInstance()->translate('A DB error occured while uninstalling the module X', $params);
         } else {
             if (!empty($yamlData)) {
                 foreach ($yamlData as $yaml) {
                     \XLite\Core\Database::getInstance()->unloadFixturesFromYaml($yaml);
                 }
             }
             $messages[] = \XLite\Core\Translation::getInstance()->translate('The module X has been uninstalled successfully', $params);
             $result = true;
         }
     } else {
         $messages[] = \XLite\Core\Translation::getInstance()->translate('Unable to delete module X files: some dirs have no writable permissions: Y', $params + array('dirs' => implode(', ', $nonWritableDirs)));
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:69,代码来源:Module.php

示例11: makeCSS

 /**
  * Make a css file compiled from the LESS files collection
  *
  * @param array $lessFiles LESS files structures array
  *
  * @return array
  */
 public function makeCSS($lessFiles)
 {
     $file = $this->makeLESSResourcePath($lessFiles);
     $path = $this->getCSSResource($lessFiles);
     $url = $this->getCSSResourceURL($path);
     $data = array('file' => $path, 'media' => 'screen', 'url' => $url);
     if ($this->needToCompileLessResource($lessFiles)) {
         try {
             $originalPath = $this->getCSSResource($lessFiles, true);
             if ($path != $originalPath && $this->getLESSResourceHash($lessFiles, true) && $this->getLESSResourceHash($lessFiles, true) == $this->calcLESSResourceHash($lessFiles) && \Includes\Utils\FileManager::isFileReadable($originalPath)) {
                 $content = \Includes\Utils\FileManager::read($originalPath);
             } else {
                 // Need recreate parser for every parseFile
                 $this->parser = new \Less_Parser($this->getLessParserOptions());
                 $this->parser->parseFile($file, '');
                 $this->parser->ModifyVars($this->getModifiedLESSVars($data));
                 $content = $this->prepareLESSContent($this->parser->getCss(), $path, $data);
                 $this->setLESSResourceHash($lessFiles);
             }
             \Includes\Utils\FileManager::mkdirRecursive(dirname($path));
             \Includes\Utils\FileManager::write($path, $content);
         } catch (\Exception $e) {
             \XLite\Logger::getInstance()->registerException($e);
             $data = null;
         }
     }
     return $data;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:35,代码来源:LessParser.php

示例12: getScript

 /**
  * Return current endpoint script
  *
  * @param boolean $check Check if file exists and readable (default: false)
  *s
  * @return string
  */
 public function getScript($check = false)
 {
     return static::isAdminZone() ? !$check || \Includes\Utils\FileManager::isFileReadable(static::getAdminScript()) ? static::getAdminScript() : self::ADMIN_SELF : (!$check || \Includes\Utils\FileManager::isFileReadable(static::getCustomerScript()) ? static::getCustomerScript() : self::CART_SELF);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:11,代码来源:XLite.php

示例13: checkIfClassExists

 /**
  * Check if class is already declared.
  * NOTE: this function does not use autoloader
  *
  * @param string $name Class name
  *
  * @return boolean
  */
 public static function checkIfClassExists($name)
 {
     $result = class_exists($name, false);
     if (!$result) {
         $result = \Includes\Utils\FileManager::isFileReadable(\Includes\Autoloader::getLCAutoloadDir() . \Includes\Utils\Converter::getClassFile($name));
     }
     return $result;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:16,代码来源:Operator.php

示例14: checkFile

 /**
  * Check if file exists and is readable
  *
  * @param string $file file to check
  *
  * @return bool
  */
 protected static function checkFile($file)
 {
     return \Includes\Utils\FileManager::isFileReadable($file);
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:11,代码来源:ConfigParser.php

示例15: getUnsafeModulesList

 /**
  * Get unsafe modules list
  *
  * @param boolean $asPlainList Flag OPTIONAL
  *
  * @return array
  */
 public static function getUnsafeModulesList($asPlainList = true)
 {
     $list = array();
     $path = static::getUnsafeModulesFilePath();
     if (\Includes\Utils\FileManager::isFileReadable($path)) {
         foreach (parse_ini_file($path, true) as $author => $names) {
             foreach (array_filter($names) as $name => $flag) {
                 if ($asPlainList) {
                     $list[] = $author . '\\' . $name;
                 } else {
                     if (!isset($list[$author])) {
                         $list[$author] = array();
                     }
                     $list[$author][$name] = 1;
                 }
             }
         }
     }
     return $list;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:27,代码来源:SafeMode.php


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