Exemplo n.º 1
0
 public static function listFolderTree($path, $filter, $maxLevel = 3, $level = 0, $parent = 0)
 {
     $dirs = array();
     if ($level == 0) {
         $GLOBALS['_JFolder_folder_tree_index'] = 0;
     }
     if ($level < $maxLevel) {
         $folders = JFolder::folders($path, $filter, false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', '_spmedia_thumbs'));
         $pathObject = new JFilesystemWrapperPath();
         // First path, index foldernames
         foreach ($folders as $name) {
             $id = ++$GLOBALS['_JFolder_folder_tree_index'];
             $fullName = $pathObject->clean($path . '/' . $name);
             $dirs[] = array('id' => $id, 'parent' => $parent, 'name' => $name, 'fullname' => $fullName, 'relname' => str_replace(JPATH_ROOT, '', $fullName));
             $dirs2 = self::listFolderTree($fullName, $filter, $maxLevel, $level + 1, $id);
             $dirs = array_merge($dirs, $dirs2);
         }
     }
     return $dirs;
 }
Exemplo n.º 2
0
<?php

/**
 * @package     Joomla.Platform
 * @subpackage  FileSystem
 *
 * @copyright   Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE
 */
defined('JPATH_PLATFORM') or die;
if (!defined('JPATH_ROOT')) {
    // Define a string constant for the root directory of the file system in native format
    $pathHelper = new JFilesystemWrapperPath();
    define('JPATH_ROOT', $pathHelper->clean(JPATH_SITE));
}
/**
 * A Path handling class
 *
 * @since  11.1
 */
class JPath
{
    /**
     * Checks if a path's permissions can be changed.
     *
     * @param   string  $path  Path to check.
     *
     * @return  boolean  True if path can have mode changed.
     *
     * @since   11.1
     */
Exemplo n.º 3
0
 /**
  * Wrapper for the standard file_exists function
  *
  * @param   string  $file  File path
  *
  * @return  boolean  True if path is a file
  *
  * @since   11.1
  */
 public static function exists($file)
 {
     $pathObject = new JFilesystemWrapperPath();
     return is_file($pathObject->clean($file));
 }