Turba::availableSources PHP Method

availableSources() public static method

Returns the source entries from config/backends.php that have been configured as available sources in the main Turba configuration.
public static availableSources ( ) : array
return array List of available sources.
    public static function availableSources()
    {
        global $registry;
        $s = $registry->loadConfigFile('backends.php', 'cfgSources', 'turba')->config['cfgSources'];
        $sources = array();
        foreach ($s as $key => $source) {
            if (empty($source['disabled'])) {
                $sources[$key] = $source;
            }
        }
        return $sources;
    }

Usage Example

Example #1
0
 /**
  * @return Horde_Share  The new share object.
  * @throws Turba_Exception
  */
 public function execute()
 {
     // Need a clean cfgSources array
     $cfgSources = Turba::availableSources();
     $driver = $GLOBALS['injector']->getInstance('Turba_Factory_Driver')->create($cfgSources[$GLOBALS['conf']['shares']['source']]);
     $params = array('params' => array('source' => $GLOBALS['conf']['shares']['source']), 'name' => $this->_vars->get('name'), 'desc' => $this->_vars->get('description'));
     return $driver->createShare(strval(new Horde_Support_Randomid()), $params);
 }
All Usage Examples Of Turba::availableSources