getDirectories

Availability: >= 3.0

Type: Object Method

Description: Returns an array of wproDirectory objects containing data for all the file browser directories that have been configured.

Syntax:

array $directories $editor->getDirectories( [string $type] );

Paramaters: 

$directories
The function returns a numerically indexed array of all wproDirectory objects that were added to the editor with the addDirectory function. The array also includes directory objects for directories configured through the other properties (documentDir, documentURL, imageDir, imageURL, mediaDir, mediaURL). This is a one-stop function for retrieving data on all directories configured for the editor.

$type
This single optional parameter is the type of directories to return. Possible values are:

  • 'image'
    Returns only image directories.
  • 'document'
    Returns only document directories.
  • 'media'
    Returns only media directories.

Or omit this parameter to return all directories.

Example, get data for all image directories:

$dirs $editor->getDirectories('image');

You could then loop through the array of directories and do something with each object.