Source for file directory_functions.php

Documentation is available at directory_functions.php

  1. <?php
  2. /**
  3.  * CodeIgniter
  4.  *
  5.  * An open source application development framework for PHP 4.3.2 or newer
  6.  *
  7.  * @package        CodeIgniter
  8.  * @subpackage     Helpers
  9.  * @author        ExpressionEngine Dev Team
  10.  * @copyright    Copyright (c) 2006, EllisLab, Inc.
  11.  * @license        http://codeigniter.com/user_guide/license.html
  12.  * @link        http://codeigniter.com
  13.  * @since        Version 1.0
  14.  * @filesource
  15.  */
  16.  
  17. // ------------------------------------------------------------------------
  18.  
  19. /**
  20.  * CodeIgniter Directory Helpers
  21.  *
  22.  * @package        ClassLib
  23.  * @subpackage     CodeIgniterHelpers
  24.  * @author        ExpressionEngine Dev Team
  25.  * @link        http://codeigniter.com/user_guide/helpers/directory_helper.html
  26.  */
  27.  
  28. // ------------------------------------------------------------------------
  29.  
  30. if (function_exists('directory_map')) {
  31.     /**
  32.      * Create a Directory Map
  33.      *
  34.      * Reads the specified directory and builds an array
  35.      * representation of it.  Sub-folders contained with the
  36.      * directory will be mapped as well.
  37.      *
  38.      * @access    public
  39.      * @param    string    path to source
  40.      * @param    bool    whether to limit the result to the top level only
  41.      * @return    array 
  42.      */
  43.     function directory_map($source_dir$top_level_only FALSE{    
  44.         if ($fp @opendir($source_dir))
  45.         {
  46.             $filedata array();
  47.             while (FALSE !== ($file readdir($fp)))
  48.             {
  49.                 if (@is_dir($source_dir.$file&& substr($file01!= '.' AND $top_level_only == FALSE)
  50.                 {
  51.                     $temp_array array();
  52.                 
  53.                     $temp_array directory_map($source_dir.$file."/");
  54.                 
  55.                     $filedata[$file$temp_array;
  56.                 }
  57.                 elseif (substr($file01!= ".")
  58.                 {
  59.                     $filedata[$file;
  60.                 }
  61.             }
  62.             return $filedata;
  63.         }
  64.     }
  65. }
  66.  
  67. ?>

Documentation generated on Tue, 22 Nov 2011 13:28:55 -0200 by phpDocumentor 1.4.3