list_files_tool

The Responsive Minimal list files tool function.

Description

list_files_tool( $path, $extension ); 

Parameters (2)

0. $path
The path.
1. $extension
The extension.

Usage

  1. if ( !function_exists( 'list_files_tool' ) ) { 
  2. require_once '/functions/framework-tool-panel.php'; 
  3.  
  4. // The path. 
  5. $path = null; 
  6.  
  7. // The extension. 
  8. $extension = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = list_files_tool($path, $extension); 
  12.  

Defined (1)

The function is defined in the following location(s).

/functions/framework-tool-panel.php  
  1. function list_files_tool($path, $extension) { 
  2. $folders = array(); 
  3. if (is_dir($path)) { 
  4. $punt = opendir($path); 
  5. while ($folder = readdir($punt)) { 
  6. if ($folder[0] == '.') { continue; } 
  7. if (is_file($path.$folder) and preg_match('/\.'.$extension.'$/', $folder, $gatto)) { 
  8. $folders[] = $folder; 
  9. closedir($punt); 
  10. natsort($folders); 
  11. return $folders;