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


PHP Files::fixPath方法代码示例

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


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

示例1: getFiles

 /**
  * Get all the files and directories of a relative path.
  * @param string $path relative path to be base path.
  * @return array of file and path information.
  * <code>array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...)</code>
  * fileinfo array: <code>array('url'=>'full url', 
  *                       'relative'=>'relative to base', 
  *                        'fullpath'=>'full file path', 
  *                        'image'=>imageInfo array() false if not image,
  *                        'stat' => filestat)</code>
  */
 function getFiles($path)
 {
     $files = array();
     $dirs = array();
     if ($this->isValidBase() == false) {
         return array($files, $dirs);
     }
     $path = Files::fixPath($path);
     $base = Files::fixPath($this->getImagesDir());
     $fullpath = Files::makePath($base, $path);
     $d = @dir($fullpath);
     while (false !== ($entry = $d->read())) {
         //not a dot file or directory
         if (substr($entry, 0, 1) != '.') {
             if (is_dir($fullpath . $entry) && $this->isThumbDir($entry) == false) {
                 $relative = Files::fixPath($path . $entry);
                 $full = Files::fixPath($fullpath . $entry);
                 $count = $this->countFiles($full);
                 $dirs[$relative] = array('fullpath' => $full, 'entry' => $entry, 'count' => $count);
             } else {
                 if (is_file($fullpath . $entry) && $this->isThumb($entry) == false && $this->isTmpFile($entry) == false) {
                     $img = $this->getImageInfo($fullpath . $entry);
                     if (!(!is_array($img) && $this->config['validate_images'])) {
                         $file['url'] = Files::makePath($this->config['base_url'], $path) . $entry;
                         $file['relative'] = $path . $entry;
                         $file['fullpath'] = $fullpath . $entry;
                         $file['image'] = $img;
                         $file['stat'] = stat($fullpath . $entry);
                         $files[$entry] = $file;
                     }
                 }
             }
         }
     }
     $d->close();
     ksort($dirs);
     ksort($files);
     return array($dirs, $files);
 }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:50,代码来源:ImageManager.php

示例2: getFiles

 /**
  * Get all the files and directories of a relative path.
  *
  * @param string $path relative path to be base path.
  *
  * @return array of file and path information.
  * <code>
  *   array(0 => array('relative'=>'fullpath',...),
  *		   1 => array('filename'=>fileinfo array(),...)
  * </code>
  * fileinfo array:
  * <code>
  *   array('url'=>'full url',
  *         'relative'=>'relative to base',
  *         'fullpath'=>'full file path',
  *         'image'=>imageInfo array() false if not image,
  *         'stat' => filestat)
  * </code>
  */
 function getFiles($path, $articleId)
 {
     $files = array();
     $dirs = array();
     if ($this->isValidBase() == false) {
         return array($files, $dirs);
     }
     $path = Files::fixPath($path);
     $base = Files::fixPath($this->getBaseDir());
     $fullpath = Files::makePath($base, $path);
     $articleImages = ArticleImage::GetImagesByArticleNumber($articleId);
     foreach ($articleImages as $articleImage) {
         $image = $articleImage->getImage();
         $img = $this->getImageInfo($image->getImageStorageLocation());
         if (is_array($img) || !$this->config['validate_images']) {
             $file['template_id'] = $articleImage->getTemplateId();
             $file['url'] = $image->getImageUrl();
             $file['image'] = $img;
             $file['image_object'] = $image;
             $file['alt'] = htmlspecialchars($image->getDescription(), ENT_QUOTES);
             $files[$articleImage->getTemplateId()] = $file;
         }
     }
     ksort($dirs);
     ksort($files);
     return array($dirs, $files);
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:46,代码来源:ImageManager.php

示例3: cleanUp

 /**
  * Delete any tmp image files.
  * @param string $path the full path 
  * where the clean should take place.
  */
 function cleanUp($path, $file)
 {
     $path = Files::fixPath($path);
     if (!is_dir($path)) {
         return false;
     }
     $d = @dir($path);
     $tmp = $this->manager->getTmpPrefix();
     $tmpLen = strlen($tmp);
     $prefix = $tmp . $this->_uid;
     $len = strlen($prefix);
     while (false !== ($entry = $d->read())) {
         //echo $entry."<br>";
         if (is_file($path . $entry) && $this->manager->isTmpFile($entry)) {
             if (substr($entry, 0, $len) == $prefix && $entry != $file) {
                 Files::delFile($path . $entry);
             } else {
                 if (substr($entry, 0, $tmpLen) == $tmp && $entry != $file) {
                     if (filemtime($path . $entry) + $this->lapse_time < time()) {
                         Files::delFile($path . $entry);
                     }
                 }
             }
         }
     }
     $d->close();
 }
开发者ID:BackupTheBerlios,项目名称:rheinaufcms-svn,代码行数:32,代码来源:ImageEditor.php

示例4: makeFile

 /**
  * Similar to makePath, but the second parameter
  * is not only a path, it may contain say a file ending.
  * @param string $pathA the leading path
  * @param string $pathB the ending path with file
  * @return string combined file path.
  */
 function makeFile($pathA, $pathB)
 {
     $pathA = Files::fixPath($pathA);
     if (substr($pathB, 0, 1) == '/') {
         $pathB = substr($pathB, 1);
     }
     return $pathA . $pathB;
 }
开发者ID:vnotebaert,项目名称:qcmphp,代码行数:15,代码来源:Files.php

示例5: _checkIMLibrary

 function _checkIMLibrary($method)
 {
     //ImageMagick goes throught 1 single executable
     if (is_file(Files::fixPath(IMAGE_TRANSFORM_LIB_PATH) . 'convert')) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:9,代码来源:ImageManager.php

示例6: getFiles

 /**
  * Get all the files and directories of a relative path.
  * @param string $path relative path to be base path.
  * @return array of file and path information.
  * <code>array(0=>array('relative'=>'fullpath',...), 1=>array('filename'=>fileinfo array(),...)</code>
  * fileinfo array: <code>array('url'=>'full url', 
  *                       'relative'=>'relative to base', 
  *                        'fullpath'=>'full file path', 
  *                        'image'=>imageInfo array() false if not image,
  *                        'stat' => filestat)</code>
  */
 function getFiles($path)
 {
     $files = array();
     $dirs = array();
     $valid_extensions = $this->mode == 'image' ? $this->config['allowed_image_extensions'] : $this->config['allowed_link_extensions'];
     if ($this->isValidBase() == false) {
         return array($files, $dirs);
     }
     $path = Files::fixPath($path);
     $base = Files::fixPath($this->getImagesDir());
     $fullpath = Files::makePath($base, $path);
     $d = @dir($fullpath);
     while (false !== ($entry = $d->read())) {
         //not a dot file or directory
         if (substr($entry, 0, 1) != '.') {
             if (is_dir($fullpath . $entry) && $this->isThumbDir($entry) == false) {
                 $relative = Files::fixPath($path . $entry);
                 $full = Files::fixPath($fullpath . $entry);
                 $count = $this->countFiles($full);
                 $dirs[$relative] = array('fullpath' => $full, 'entry' => $entry, 'count' => $count, 'stat' => stat($fullpath . $entry));
             } else {
                 if (is_file($fullpath . $entry) && $this->isThumb($entry) == false && $this->isTmpFile($entry) == false) {
                     $afruext = strtolower(substr(strrchr($entry, "."), 1));
                     if (in_array($afruext, $valid_extensions)) {
                         $file['url'] = Files::makePath($this->config['base_url'], $path) . $entry;
                         $file['relative'] = $path . $entry;
                         $file['fullpath'] = $fullpath . $entry;
                         $img = $this->getImageInfo($fullpath . $entry);
                         if (!is_array($img)) {
                             $img[0] = $img[1] = 0;
                         }
                         $file['image'] = $img;
                         $file['stat'] = stat($fullpath . $entry);
                         $file['ext'] = $afruext;
                         $files[$entry] = $file;
                     }
                 }
             }
         }
     }
     $d->close();
     ksort($dirs);
     ksort($files);
     return array($dirs, $files);
 }
开发者ID:vnotebaert,项目名称:qcmphp,代码行数:56,代码来源:ExtendedFileManager.php


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