* @copyright 2004 by http://wombat.exit0.net * @package wombatSite * @subpackage formDatasource */ /** * form datasource which finds all static templates * * @version 0.1 * @package wombatSite * @subpackage formDatasource */ class wbFormDatasource_LoadExtension extends wbFormDatasource { /** * default values of used attributes * @access private * @var array $_atts */ var $_atts = array( ); /** * implement this method * * @access private * @param integer $id * @return boolean $result true on success * @see */ function getValues() { $extDir = wbFactory::getParam( 'baseDir' ) . '/extension'; $values = array( array( 'label' => _('... select custom extension' ), 'value' => '' ) ); // read dir if( !is_dir( $extDir ) ) { wbDebugger::addMsg( 'FormDS', 'Could not open directory: ' . $extDir, 'LoadExtension' ); return $values; } $dir = dir( $extDir ); while( ( $entry = $dir->read() ) !== false ) { // skip hidden files if( $entry[0] == '.' ) { continue; } if( is_dir( $extDir . '/' . $entry ) ) { continue; } // see whether it is a php file $val = explode( '.', $entry ); $ext = array_pop( $val ); // skip unknown extensions if( $ext != 'php' ) { continue; } $val = implode( '.', $val ); array_push( $values, array( 'value' => $val, 'label' => $val ) ); } $dir->close(); return $values; } } ?>