本文整理汇总了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);
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
}
示例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);
}