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


PHP FileManager::getRealPath方法代码示例

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


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

示例1: getFilePointer

    /**
     * Get file pointer
     * This dedicates to greatest developer of all time, Maxim Shamaev. Because getFilename() is not enough for name combining.
     *
     * @return resource
     */
    protected function getFilePointer()
    {
        if (!isset($this->filePointer)) {
            $name = $this->getFilename();
            $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->generator->getOptions()->dir);
            if (is_writable($dir)) {
                if (!\Includes\Utils\FileManager::isExists($dir . LC_DS . '.htaccess')) {
                    // Try to create .htaccess file to protect directory
                    $out = <<<OUT
Options -Indexes

Deny from all

OUT;
                    \Includes\Utils\FileManager::write($dir . LC_DS . '.htaccess', $out);
                }
                $this->filePath = $dir . LC_DS . $name;
                $this->filePointer = @fopen($dir . LC_DS . $name, 'ab');
            } else {
                $this->generator->addError(static::t('Directory does not have permissions to write'), static::t('Directory X does not have permissions to write. Please set necessary permissions to directory X.', array('path' => $dir)));
            }
        }
        return $this->filePointer;
    }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:30,代码来源:Categories.php

示例2: importImageColumn

 /**
  * Import 'image' value
  *
  * @param \XLite\Model\Category $model  Category
  * @param string                $value  Value
  * @param array                 $column Column info
  *
  * @return void
  */
 protected function importImageColumn(\XLite\Model\Category $model, $value, array $column)
 {
     if ($value && $this->verifyValueAsFile($value)) {
         $image = $model->getImage();
         if (!$image) {
             $image = new \XLite\Model\Image\Category\Image();
             $image->setCategory($model);
             $model->setImage($image);
             \XLite\Core\Database::getEM()->persist($image);
         }
         if (1 < count(parse_url($value))) {
             $success = $image->loadFromURL($value, true);
         } else {
             $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->importer->getOptions()->dir);
             $success = $image->loadFromLocalFile($dir . LC_DS . $value);
         }
         if (!$success) {
             $this->addError('PRODUCT-IMG-LOAD-FAILED', array('column' => $column, 'value' => $path));
         } else {
             $image->setNeedProcess(1);
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:32,代码来源:Categories.php

示例3: deleteAllFiles

 /**
  * Delete all files
  *
  * @return void
  */
 public function deleteAllFiles()
 {
     $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->getOptions()->dir);
     if (!\Includes\Utils\FileManager::isExists($dir)) {
         \Includes\Utils\FileManager::mkdir($dir);
     }
     $list = glob($dir . LC_DS . '*');
     if ($list) {
         foreach ($list as $path) {
             if (is_file($path)) {
                 \Includes\Utils\FileManager::deleteFile($path);
             } else {
                 \Includes\Utils\FileManager::unlinkRecursive($path);
             }
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:22,代码来源:Importer.php

示例4: verifyValueAsFile

 /**
  * Verify value as file
  *
  * @param mixed @value Value
  *
  * @return boolean
  */
 protected function verifyValueAsFile($value)
 {
     // Do not verify files in verification mode and if 'ignoreFileChecking' option is true
     if (!$this->isVerification() || !$this->importer->getOptions()->ignoreFileChecking) {
         if (1 < count(parse_url($value))) {
             $request = new \XLite\Core\HTTP\Request($value);
             $response = $request->sendRequest();
             $result = $response && 200 == $response->code;
         } else {
             $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->importer->getOptions()->dir);
             $result = \Includes\Utils\FileManager::isReadable($dir . LC_DS . $value);
         }
     } else {
         $result = true;
     }
     return $result;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:24,代码来源:AProcessor.php

示例5: importVariantImageColumn

 /**
  * Import 'variantImage' value
  *
  * @param \XLite\Model\Product $model  Product
  * @param array                $value  Value
  * @param array                $column Column info
  *
  * @return void
  */
 protected function importVariantImageColumn(\XLite\Model\Product $model, $value, array $column)
 {
     foreach ($this->variants as $rowIndex => $variant) {
         if (isset($value[$rowIndex])) {
             $path = $value[$rowIndex];
             if ($this->verifyValueAsFile($path)) {
                 $image = $variant->getImage();
                 $isNew = false;
                 if (!$image) {
                     $isNew = true;
                     $image = new \XLite\Module\XC\ProductVariants\Model\Image\ProductVariant\Image();
                 }
                 if (1 < count(parse_url($path))) {
                     $success = $image->loadFromURL($path, true);
                 } else {
                     $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->importer->getOptions()->dir);
                     $success = $image->loadFromLocalFile($dir . LC_DS . $path);
                 }
                 if (!$success) {
                     $this->addError('PRODUCT-IMG-LOAD-FAILED', array('column' => $column, 'value' => $path));
                 } elseif ($isNew) {
                     $image->setProductVariant($variant);
                     $variant->setImage($image);
                     \XLite\Core\Database::getEM()->persist($image);
                 }
             }
         }
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:38,代码来源:Products.php

示例6: importImagesColumn

 /**
  * Import 'images' value
  *
  * @param \XLite\Model\Product $model  Product
  * @param array                $value  Value
  * @param array                $column Column info
  *
  * @return void
  */
 protected function importImagesColumn(\XLite\Model\Product $model, array $value, array $column)
 {
     if ($value) {
         foreach ($value as $index => $path) {
             if ($this->verifyValueAsFile($path)) {
                 $image = $model->getImages() ? $model->getImages()->get($index) : null;
                 $isNew = false;
                 if (!$image) {
                     $isNew = true;
                     $image = new \XLite\Model\Image\Product\Image();
                 }
                 if (1 < count(parse_url($path))) {
                     $success = $image->loadFromURL($path, true);
                 } else {
                     $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->importer->getOptions()->dir);
                     $success = $image->loadFromLocalFile($dir . LC_DS . $path);
                 }
                 if (!$success) {
                     $this->addError('PRODUCT-IMG-LOAD-FAILED', array('column' => $column, 'value' => $path));
                 } else {
                     $image->setNeedProcess(1);
                     if ($isNew) {
                         $image->setProduct($model);
                         $model->getImages()->add($image);
                         \XLite\Core\Database::getEM()->persist($image);
                     }
                 }
             }
         }
         while (count($model->getImages()) > count($value)) {
             $image = $model->getImages()->last();
             \XLite\Core\Database::getRepo('XLite\\Model\\Image\\Product\\Image')->delete($image, false);
             $model->getImages()->removeElement($image);
         }
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:45,代码来源:Products.php

示例7: getFileSource

 /**
  * Read file from package
  *
  * @param string $relativePath File relative path in package
  *
  * @return string
  */
 protected function getFileSource($relativePath)
 {
     $source = null;
     $path = \Includes\Utils\FileManager::getCanonicalDir($this->getRepositoryPath());
     if (!empty($path)) {
         $path = \Includes\Utils\FileManager::getRealPath($this->getFullPath($relativePath, $path));
     }
     if (!empty($path)) {
         $source = \Includes\Utils\FileManager::read($path);
     }
     return $source;
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:19,代码来源:AEntry.php

示例8: importImageColumn

 /**
  * Import 'image' value
  *
  * @param \XLite\Model\Category $model  Category
  * @param string                $value  Value
  * @param array                 $column Column info
  *
  * @return void
  */
 protected function importImageColumn(\XLite\Model\Category $model, $value, array $column)
 {
     if ($value && $this->verifyValueAsFile($value)) {
         $image = $model->getImage();
         if (!$image) {
             $image = new \XLite\Model\Image\Category\Image();
             $image->setCategory($model);
             $model->setImage($image);
             \XLite\Core\Database::getEM()->persist($image);
         }
         if (1 < count(parse_url($value))) {
             $image->loadFromURL($value, true);
         } else {
             $dir = \Includes\Utils\FileManager::getRealPath(LC_DIR_VAR . $this->importer->getOptions()->dir);
             $image->loadFromLocalFile($dir . LC_DS . $value);
         }
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:27,代码来源:Categories.php

示例9: getNormalizedPath

 /**
  * Check path to be inside the files catalog repository. {lc_catalog}/files
  * Return full path that inside the repository.
  * If path is out the one then returns the catalog repository path.
  *
  * @return string
  */
 public static function getNormalizedPath($path)
 {
     $filesCatalog = \XLite\View\BrowseServer::getFilesCatalog();
     $path = \Includes\Utils\FileManager::getRealPath($filesCatalog . LC_DS . $path);
     return $filesCatalog !== substr($path, 0, strlen($filesCatalog)) ? $filesCatalog : $path;
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:13,代码来源:BrowseServer.php


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