当前位置: 首页>>代码示例>>PHP>>正文


PHP Horde::getDriverConfig方法代码示例

本文整理汇总了PHP中Horde::getDriverConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde::getDriverConfig方法的具体用法?PHP Horde::getDriverConfig怎么用?PHP Horde::getDriverConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde的用法示例。


在下文中一共展示了Horde::getDriverConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: create

 /**
  * Return the Agora_Driver:: instance.
  *
  * @param string $scope  Instance scope
  * @param int $forum_id  Forum to link to
  *
  * @return Agora_Driver  The singleton instance.
  * @throws Agora_Exception
  */
 public function create($scope = 'agora', $forum_id = 0)
 {
     if (!isset($this->_instances[$scope])) {
         $driver = $GLOBALS['conf']['threads']['split'] ? 'SplitSql' : 'Sql';
         $params = Horde::getDriverConfig('sql');
         $class = 'Agora_Driver_' . $driver;
         if (!class_exists($class)) {
             throw new Agora_Exception(sprintf('Unable to load the definition of %s.', $class));
         }
         $params = array('db' => $this->_injector->getInstance('Horde_Db_Adapter'), 'charset' => $params['charset']);
         $driver = new $class($scope, $params);
         $this->_instances[$scope] = $driver;
     }
     if ($forum_id) {
         /* Check if there was a valid forum object to get. */
         try {
             $forum = $this->_instances[$scope]->getForum($forum_id);
         } catch (Horde_Exception $e) {
             throw new Agora_Exception($e->getMessage());
         }
         /* Set current forum id and forum data */
         $this->_instances[$scope]->_forum = $forum;
         $this->_instances[$scope]->_forum_id = (int) $forum_id;
     }
     return $this->_instances[$scope];
 }
开发者ID:horde,项目名称:horde,代码行数:35,代码来源:Driver.php

示例2: create

 public function create(Horde_Injector $injector)
 {
     $driver = Horde_String::ucfirst($GLOBALS['conf']['group']['driver']);
     $params = Horde::getDriverConfig('group', $driver);
     if (!empty($GLOBALS['conf']['group']['cache'])) {
         $params['cache'] = $injector->getInstance('Horde_Cache');
     }
     switch ($driver) {
         case 'Contactlists':
             $class = 'Horde_Group_Contactlists';
             $params['api'] = $GLOBALS['registry']->contacts;
             break;
         case 'Kolab':
             $class = 'Horde_Group_Kolab';
             $params['ldap'] = $injector->getInstance('Horde_Core_Factory_Ldap')->create('horde', 'group');
             break;
         case 'Ldap':
             $class = 'Horde_Core_Group_Ldap';
             $params['ldap'] = $injector->getInstance('Horde_Core_Factory_Ldap')->create('horde', 'group');
             break;
         case 'Sql':
             $class = 'Horde_Group_Sql';
             $params['db'] = $injector->getInstance('Horde_Core_Factory_Db')->create('horde', 'group');
             break;
         default:
             $class = $this->_getDriverName($driver, 'Horde_Group');
             break;
     }
     return new $class($params);
 }
开发者ID:horde,项目名称:horde,代码行数:30,代码来源:Group.php

示例3: create

 /**
  * Returns the spellchecker instance.
  *
  * @param array $args    Configuration arguments to override the
  *                       defaults.
  * @param string $input  Input text.  If set, allows language detection
  *                       if not automatically set.
  *
  * @return Horde_SpellChecker  The spellchecker instance.
  * @throws Horde_Exception
  */
 public function create(array $args = array(), $input = null)
 {
     global $conf, $language, $registry;
     if (empty($conf['spell']['driver'])) {
         throw new Horde_Exception('No spellcheck driver configured.');
     }
     $args = array_merge(array('localDict' => array()), Horde::getDriverConfig('spell', null), $args);
     if (empty($args['locale'])) {
         if (!is_null($input)) {
             try {
                 $args['locale'] = $this->_injector->getInstance('Horde_Core_Factory_LanguageDetect')->getLanguageCode($input);
             } catch (Horde_Exception $e) {
             }
         }
         if (empty($args['locale']) && isset($language)) {
             $args['locale'] = $language;
         }
     }
     /* Add local dictionary words. */
     try {
         $args['localDict'] = array_merge($args['localDict'], $registry->loadConfigFile('spelling.php', 'ignore_list', 'horde')->config['ignore_list']);
     } catch (Horde_Exception $e) {
     }
     $classname = 'Horde_SpellChecker_' . Horde_String::ucfirst(basename($conf['spell']['driver']));
     if (!class_exists($classname)) {
         throw new Horde_Exception('Spellcheck driver does not exist.');
     }
     return new $classname($args);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:40,代码来源:SpellChecker.php

示例4: create

 /**
  * A Factory for the Sesha_Driver. Currently only Rdo is implemented
  * @param string name  An arbitrary name string to identify the driver instance
  * @param array params  a hash of driver parameters. For the Rdo driver, these are the parameters for creating a Horde_Db_Adapter
  * @return Horde_Rdo_Driver  A concrete instance of Horde_Rdo_Driver with all necessary dependencies injected
  */
 public function create($name = '', $params = array())
 {
     if (!isset($this->_instances[$name])) {
         if (!empty($params['driver'])) {
             $driver = $params['driver'];
             unset($params['driver']);
         } else {
             $driver = $GLOBALS['conf']['storage']['driver'];
             $params = Horde::getDriverConfig('storage', $driver);
         }
         $class = 'Sesha_Driver_' . ucfirst(basename($driver));
         if (!class_exists($class)) {
             throw new Sesha_Exception(sprintf('Unable to load the definition of %s.', $class));
         }
         switch ($class) {
             case 'Sesha_Driver_Rdo':
                 if (empty($params['db'])) {
                     $params['db'] = $this->_injector->getInstance('Horde_Core_Factory_Db')->create('sesha', $params);
                 }
                 break;
         }
         $this->_instances[$name] = new $class($params);
     }
     return $this->_instances[$name];
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:Driver.php

示例5: create

 /**
  * Return the Mnemo_Driver:: instance.
  *
  * @param mixed $name  The notepad to open
  *
  * @return Mnemo_Driver
  * @throws Mnemo_Exception
  */
 public function create($name = '')
 {
     if (!isset($this->_instances[$name])) {
         $driver = $GLOBALS['conf']['storage']['driver'];
         $params = Horde::getDriverConfig('storage', $driver);
         $class = 'Mnemo_Driver_' . ucfirst(basename($driver));
         if (!class_exists($class)) {
             throw new Mnemo_Exception(sprintf('Unable to load the definition of %s.', $class));
         }
         switch ($class) {
             case 'Mnemo_Driver_Sql':
                 if ($params['driverconfig'] != 'horde') {
                     $customParams = $params;
                     unset($customParams['driverconfig'], $customParams['table']);
                     $params['db'] = $this->_injector->getInstance('Horde_Core_Factory_Db')->create('mnemo', $customParams);
                 } else {
                     $params['db'] = $this->_injector->getInstance('Horde_Db_Adapter');
                 }
                 break;
             case 'Mnemo_Driver_Kolab':
                 $params = array('storage' => $this->_injector->getInstance('Horde_Kolab_Storage'));
         }
         $driver = new $class($name, $params);
         $this->_instances[$name] = $driver;
     }
     return $this->_instances[$name];
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:35,代码来源:Driver.php

示例6: create

 /**
  * Return the Ingo_Storage instance.
  *
  * @param string $driver  Driver name.
  * @param array $params   Configuration parameters.
  *
  * @return Ingo_Storage  The singleton instance.
  *
  * @throws Ingo_Exception
  */
 public function create($driver = null, $params = null)
 {
     if (is_null($driver)) {
         $driver = $GLOBALS['conf']['storage']['driver'];
     }
     $driver = ucfirst(basename($driver));
     if (!isset($this->_instances[$driver])) {
         if (is_null($params)) {
             $params = Horde::getDriverConfig('storage', $driver);
         }
         switch ($driver) {
             case 'Sql':
                 $params['db'] = $GLOBALS['injector']->getInstance('Horde_Db_Adapter');
                 $params['table_forwards'] = 'ingo_forwards';
                 $params['table_lists'] = 'ingo_lists';
                 $params['table_rules'] = 'ingo_rules';
                 $params['table_spam'] = 'ingo_spam';
                 $params['table_vacations'] = 'ingo_vacations';
                 break;
         }
         $class = 'Ingo_Storage_' . $driver;
         if (class_exists($class)) {
             $this->_instances[$driver] = new $class($params);
         } else {
             throw new Ingo_Exception(sprintf(_("Unable to load the storage driver \"%s\"."), $class));
         }
     }
     return $this->_instances[$driver];
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:39,代码来源:Storage.php

示例7: create

 public function create(Horde_Injector $injector)
 {
     global $conf, $session;
     $driver = empty($conf['token']) ? 'null' : $conf['token']['driver'];
     $params = empty($conf['token']) ? array() : Horde::getDriverConfig('token', $conf['token']['driver']);
     $params['logger'] = $injector->getInstance('Horde_Log_Logger');
     if (!$session->exists('horde', 'token_secret_key')) {
         $session->set('horde', 'token_secret_key', strval(new Horde_Support_Randomid()));
     }
     $params['secret'] = $session->get('horde', 'token_secret_key');
     switch (Horde_String::lower($driver)) {
         case 'none':
             $driver = 'null';
             break;
         case 'nosql':
             $nosql = $injector->getInstance('Horde_Core_Factory_Nosql')->create('horde', 'token');
             if ($nosql instanceof Horde_Mongo_Client) {
                 $params['mongo_db'] = $nosql;
                 $driver = 'Horde_Token_Mongo';
             }
             break;
         case 'sql':
             $params['db'] = $injector->getInstance('Horde_Core_Factory_Db')->create('horde', 'token');
             break;
     }
     if (isset($conf['urls']['token_lifetime'])) {
         $params['token_lifetime'] = $conf['urls']['token_lifetime'] * 60;
     }
     $class = $this->_getDriverName($driver, 'Horde_Token');
     return new $class($params);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:31,代码来源:Token.php

示例8: create

 /**
  * Return a Horde_Alarm instance.
  *
  * @return Horde_Alarm
  * @throws Horde_Exception
  */
 public function create()
 {
     global $conf;
     if (isset($this->_alarm)) {
         return $this->_alarm;
     }
     $driver = empty($conf['alarms']['driver']) ? 'null' : $conf['alarms']['driver'];
     $params = Horde::getDriverConfig('alarms', $driver);
     switch (Horde_String::lower($driver)) {
         case 'sql':
             $params['db'] = $this->_injector->getInstance('Horde_Core_Factory_Db')->create('horde', 'alarms');
             break;
     }
     $params['logger'] = $this->_injector->getInstance('Horde_Log_Logger');
     $params['loader'] = array($this, 'load');
     $this->_ttl = isset($params['ttl']) ? $params['ttl'] : 300;
     $class = $this->_getDriverName($driver, 'Horde_Alarm');
     $this->_alarm = new $class($params);
     $this->_alarm->initialize();
     $this->_alarm->gc();
     /* Add those handlers that need configuration and can't be auto-loaded
      * through Horde_Alarms::handlers(). */
     $this->_alarm->addHandler('notify', new Horde_Core_Alarm_Handler_Notify());
     $this->_alarm->addHandler('desktop', new Horde_Core_Alarm_Handler_Desktop(array('icon' => new Horde_Core_Alarm_Handler_Desktop_Icon('alerts/alarm.png'), 'js_notify' => array($this->_injector->getInstance('Horde_PageOutput'), 'addInlineScript'))));
     $this->_alarm->addHandler('mail', new Horde_Alarm_Handler_Mail(array('identity' => $this->_injector->getInstance('Horde_Core_Factory_Identity'), 'mail' => $this->_injector->getInstance('Horde_Mail'))));
     return $this->_alarm;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:33,代码来源:Alarm.php

示例9: __construct

 /**
  */
 public function __construct($params = array())
 {
     if (!isset($params['db'])) {
         throw new Passwd_Exception('Missing required Horde_Db_Adapter object');
     }
     $this->_db = $params['db'];
     unset($params['db']);
     /* Use defaults from Horde. */
     parent::__construct(array_merge(Horde::getDriverConfig('', 'sql'), array('clear_passwd' => 'pw_clear_passwd', 'domain' => 'pw_domain', 'encryption' => 'crypt', 'name' => 'pw_name', 'passwd' => 'pw_passwd', 'show_encryption' => false, 'table' => 'horde_users', 'use_clear_passwd' => false), $params));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:12,代码来源:Vpopmail.php

示例10: create

 public function create(Horde_Injector $injector)
 {
     $driver = $GLOBALS['conf']['davstorage']['driver'];
     $params = Horde::getDriverConfig('davstorage', $driver);
     switch ($driver) {
         case 'Sql':
             $class = 'Horde_Dav_Storage_Sql';
             $params['db'] = $injector->getInstance('Horde_Core_Factory_Db')->create('horde', 'davstorage');
             break;
         default:
             throw new Horde_Exception('A storage backend for DAV has not been configured.');
             break;
     }
     return new $class($params);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:15,代码来源:DavStorage.php

示例11: create

 /**
  * Attempts to return a concrete instance based on $driver.
  *
  * @return Horde_Perms  The newly created concrete instance.
  * @throws Horde_Exception
  */
 public function create(Horde_Injector $injector)
 {
     global $conf;
     $driver = empty($conf['perms']['driver']) ? 'null' : $conf['perms']['driver'];
     $params = isset($conf['perms']) ? Horde::getDriverConfig('perms', $driver) : array();
     switch (Horde_String::lower($driver)) {
         case 'sql':
             $params['db'] = $injector->getInstance('Horde_Core_Factory_Db')->create('horde', 'perms');
             break;
     }
     $params['cache'] = new Horde_Cache(new Horde_Cache_Storage_Stack(array('stack' => array(new Horde_Cache_Storage_Memory(), $injector->getInstance('Horde_Cache')))));
     $params['logger'] = $injector->getInstance('Horde_Log_Logger');
     $class = $this->_getDriverName($driver, 'Horde_Perms');
     return new $class($params);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:21,代码来源:Perms.php

示例12: create

 /**
  * Return the Ulaform_Driver:: instance.
  *
  * @param mixed $name  Instance name
  *
  * @return Ulaform_Driver
  * @throws Ulaform_Exception
  */
 public function create($name = '')
 {
     if (!isset($this->_instances[$name])) {
         $driver = 'Sql';
         $params = Horde::getDriverConfig('sql', $driver);
         $class = 'Ulaform_Driver_' . $driver;
         if (!class_exists($class)) {
             throw new Ulaform_Exception(sprintf('Unable to load the definition of %s.', $class));
         }
         $params = array('db' => $this->_injector->getInstance('Horde_Db_Adapter'), 'charset' => $params['charset']);
         $driver = new $class($params);
         $this->_instances[$name] = $driver;
     }
     return $this->_instances[$name];
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:23,代码来源:Driver.php

示例13: factory

 /**
  * Gets a concrete Klutz_Driver instance.
  *
  * @param string $driver  The type of concrete Klutz_Driver subclass to
  *                        return.  The code for the driver is dynamically
  *                        included.
  *
  * @param array $params   A hash containing any additional configuration or
  *                        connection parameters a subclass might need
  *
  * @return object Klutz_Driver  The newly created concrete instance, or
  *                              false on error.
  */
 function factory($driver = null, $params = null)
 {
     if (is_null($driver)) {
         $driver = $GLOBALS['conf']['storage']['driver'];
     }
     $driver = ucfirst(basename($driver));
     if (is_null($params)) {
         $params = Horde::getDriverConfig('storage', $driver);
     }
     $class = 'Klutz_Driver_' . $driver;
     if (class_exists($class)) {
         return new $class($params);
     }
     return new Klutz_Driver($params);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:28,代码来源:Driver.php

示例14: create

 /**
  * Return the driver instance.
  *
  * @param string $tasklist   The name of the tasklist to load.
  *
  * @return Nag_Driver
  * @throws Nag_Exception
  */
 public function create($tasklist)
 {
     $driver = null;
     $params = array();
     if (!empty($tasklist)) {
         $signature = $tasklist;
         try {
             $share = $GLOBALS['nag_shares']->getShare($tasklist);
             if ($share->get('issmart')) {
                 $driver = 'Smartlist';
             }
         } catch (Horde_Exception $e) {
             throw new Nag_Exception($e);
         }
     }
     if (!$driver) {
         $driver = $GLOBALS['conf']['storage']['driver'];
         $params = Horde::getDriverConfig('storage', $driver);
         $signature = serialize(array($tasklist, $driver, $params));
     }
     if (isset($this->_instances[$signature])) {
         return $this->_instances[$signature];
     }
     $driver = ucfirst(basename($driver));
     $class = 'Nag_Driver_' . $driver;
     switch ($driver) {
         case 'Sql':
             $params['db'] = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Db')->create('nag', 'storage');
             break;
         case 'Kolab':
             $params['kolab'] = $GLOBALS['injector']->getInstance('Horde_Kolab_Storage');
             break;
         case 'Smartlist':
             $params['driver'] = $this->create('');
     }
     if (class_exists($class)) {
         try {
             $nag = new $class($tasklist, $params);
         } catch (Nag_Exception $e) {
             $nag = new Nag_Driver($params, sprintf(_("The Tasks backend is not currently available: %s"), $e->getMessage()));
         }
     } else {
         $nag = new Nag_Driver($params, sprintf(_("Unable to load the definition of %s."), $class));
     }
     $this->_instances[$signature] = $nag;
     return $nag;
 }
开发者ID:DSNS-LAB,项目名称:Dmail,代码行数:55,代码来源:Driver.php

示例15: create

 /**
  * Attempts to return a concrete instance based on $driver.
  *
  * @return Horde_SessionHandler_Driver  The newly created concrete
  *                                      instance.
  * @throws Horde_SessionHandler_Exception
  */
 public function create(Horde_Injector $injector)
 {
     global $conf;
     if (empty($conf['sessionhandler']['type'])) {
         $driver = 'Builtin';
     } else {
         $driver = $conf['sessionhandler']['type'];
         if (!strcasecmp($driver, 'None')) {
             $driver = 'Builtin';
         }
     }
     $params = Horde::getDriverConfig('sessionhandler', $driver);
     $driver = basename(Horde_String::lower($driver));
     $noset = false;
     switch ($driver) {
         case 'builtin':
             $noset = true;
             break;
         case 'hashtable':
             // DEPRECATED
         // DEPRECATED
         case 'memcache':
             $params['hashtable'] = $injector->getInstance('Horde_HashTable');
             $driver = 'hashtable';
             break;
         case 'nosql':
             $nosql = $injector->getInstance('Horde_Core_Factory_Nosql')->create('horde', 'sessionhandler');
             if ($nosql instanceof Horde_Mongo_Client) {
                 $params['mongo_db'] = $nosql;
                 $driver = 'Horde_SessionHandler_Storage_Mongo';
             }
             break;
         case 'sql':
             $factory = $injector->getInstance('Horde_Core_Factory_Db');
             $config = $factory->getConfig('sessionhandler');
             unset($config['umask'], $config['driverconfig']);
             $params['db'] = $factory->createDb($config);
             break;
     }
     $class = $this->_getDriverName($driver, 'Horde_SessionHandler_Storage');
     $storage = $this->storage = new $class($params);
     if ((!empty($conf['sessionhandler']['hashtable']) || !empty($conf['sessionhandler']['memcache'])) && !in_array($driver, array('builtin', 'hashtable'))) {
         $storage = new Horde_SessionHandler_Storage_Stack(array('stack' => array(new Horde_SessionHandler_Storage_Hashtable(array('hashtable' => $injector->getInstance('Horde_HashTable'))), $this->storage)));
     }
     return new Horde_SessionHandler($storage, array('logger' => $injector->getInstance('Horde_Log_Logger'), 'no_md5' => true, 'noset' => $noset, 'parse' => array($this, 'readSessionData')));
 }
开发者ID:horde,项目名称:horde,代码行数:53,代码来源:SessionHandler.php


注:本文中的Horde::getDriverConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。