mosReadDirectory equivalent for Joomla 1.5 ?
Posted: Fri Mar 21, 2008 8:32 am
does anyone know the mosReadDirectory equivalent for Joomla 1.5 ?
Joomla! Community, help and support.
https://sandbox-forum.joomla.org/
Code: Select all
/**
* Utility function to read the files in a folder
*
* @param string $path The path of the folder to read
* @param string $filter A filter for file names
* @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth
* @param boolean $fullpath True to return the full path to the file
* @param array $exclude Array with names of files which should not be shown in the result
* @return array Files in the given folder
* @since 1.5
*/
function files($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
Code: Select all
/**
* Utility function to read the folders in a folder
*
* @param string $path The path of the folder to read
* @param string $filter A filter for folder names
* @param mixed $recurse True to recursively search into sub-folders, or an integer to specify the maximum depth
* @param boolean $fullpath True to return the full path to the folders
* @param array $exclude Array with names of folders which should not be shown in the result
* @return array Folders in the given folder
* @since 1.5
*/
function folders($path, $filter = '.', $recurse = false, $fullpath = false, $exclude = array('.svn', 'CVS'))
Code: Select all
if( defined('_JEXEC') ){
//joomla 1.5
jimport( 'joomla.filesystem.folder' );
$languages = JFolder::files(dirname(__FILE__).'/../language');
}else{
//joomla 1.0.x
$languages = mosReadDirectory(dirname(__FILE__).'/../language');
}
foreach($languages as $language){
if($language!='index.html'){
$language = str_replace('.php','',$language);
$selected = '';
if($language==$config['language']){
$selected = ' selected="selected"';
}
echo '<option value="'.$language.'"'.$selected.'>'.$language.'</option>';
}
}