Availability: >= 3.0

Type: Object Method

Description: Adds directories to the file managers.


$editor->addDirectoryobject $directory );

This function allows you to add multiple directories to the file managers. Each directory is configured with its own permissions and filters. The directories appear down the sidebar on the file managers allowing users to choose which directory to browse. This can be used instead of, or in addition to the other properties for setting directories.

The single parameter should be a correctly configured wproDirectory object. 

Example, setting two image directories:

// create and configure the first image directory:
$dir1 = new wproDirectory();
// set type of folder:
$dir1->type 'image';
// full file path of the folder:
$dir1->dir dirname(__FILE__).'/images1/';
// URL of the folder:
$dir1->URL dirname($_SERVER['SCRIPT_NAME']).'/images1/';
// Set access permissions:
$dir1->editImages true;
$dir1->renameFiles true;
$dir1->renameFolders true;
$dir1->deleteFiles true;
$dir1->deleteFolders true;
$dir1->copyFiles true;
$dir1->copyFolders true;
$dir1->moveFiles true;
$dir1->moveFolders true;
$dir1->upload true;
$dir1->overwrite true;
$dir1->createFolders true;
// You can give the directory a custom label using the name attribute:
$dir1->name 'My Images';
// If you do not do this the name of the folder will be used instead.
// Note: you can give the directory a custom icon using the icon attribute. Set it to the URL of the icon image.
// add the directory to the editor

// create and configure the second image directory:
$dir2 = new wproDirectory();
// set type of folder:
$dir2->type 'image';
// full file path of the folder:
$dir2->dir dirname(__FILE__).'/images2/';
// URL of the folder:
$dir2->URL dirname($_SERVER['SCRIPT_NAME']).'/images2/';
// Set access permissions:
$dir2->editImage true;
$dir2->renameFiles true;
$dir2->renameFolders true;
$dir2->deleteFiles true;
$dir2->deleteFolders true;
$dir2->copyFiles true;
$dir2->copyFolders true;
$dir2->moveFiles true;
$dir2->moveFolders true;
$dir2->upload true;
$dir2->overwrite true;
$dir2->createFolders true;
// You can give the directory a custom label using the name attribute:
$dir2->name 'Shared Images';
// add the directory to the editor