本文整理汇总了PHP中Horde_String::ucfirst方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_String::ucfirst方法的具体用法?PHP Horde_String::ucfirst怎么用?PHP Horde_String::ucfirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_String
的用法示例。
在下文中一共展示了Horde_String::ucfirst方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: factory
/**
* Attempts to return a concrete instance.
*
* @param string $renderer Either the tree renderer driver or a full
* class name to use.
* @param array $params Any additional parameters the constructor
* needs. Either 'name' or 'tree' must be
* specified. Common parameters are:
* - name: (string) The name of this tree instance.
* - tree: (Horde_Tree) An existing tree object.
* - session: (array) Callbacks used to store session data. Must define
* two keys: 'get' and 'set'. Function definitions:
* (string) = get([string - Instance], [string - ID]);
* set([string - Instance], [string - ID], [boolean - value]);
* DEFAULT: No session storage
*
* @return Horde_Tree The newly created concrete instance.
* @throws Horde_Tree_Exception
*/
public static function factory($renderer, $params = array())
{
if (!isset($params['tree']) && !isset($params['name'])) {
throw new BadFunctionCallException('Either "name" or "tree" parameters must be specified.');
}
if (isset($params['tree'])) {
$tree = $params['tree'];
unset($params['tree']);
} else {
$tree = new Horde_Tree($params['name'], isset($params['session']) ? $params['session'] : array());
unset($params['name']);
}
unset($params['session']);
$ob = null;
/* Base drivers (in Tree/ directory). */
$class = __CLASS__ . '_' . Horde_String::ucfirst($renderer);
if (class_exists($class)) {
$ob = new $class($tree, $params);
} else {
/* Explicit class name, */
$class = $renderer;
if (class_exists($class)) {
$ob = new $class($tree, $params);
}
}
if ($ob) {
if ($ob->isSupported()) {
return $ob;
}
$params['tree'] = $tree;
return self::factory($ob->fallback(), $params);
}
throw new Horde_Tree_Exception('Horde_Tree renderer not found: ' . $renderer);
}
示例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);
}
示例4: create
/**
* Return an Kolab_Driver instance.
*
* @return Kolab_Driver
*/
public function create(Horde_Injector $injector)
{
$driver = Horde_String::ucfirst($GLOBALS['conf']['storage']['driver']);
$signature = serialize(array($driver, $GLOBALS['conf']['storage']['params']['driverconfig']));
if (empty($this->_instances[$signature])) {
switch ($driver) {
case 'Sql':
try {
if ($GLOBALS['conf']['storage']['params']['driverconfig'] == 'horde') {
$db = $injector->getInstance('Horde_Db_Adapter');
} else {
$db = $injector->getInstance('Horde_Core_Factory_Db')->create('kolab', 'storage');
}
} catch (Horde_Exception $e) {
throw new Kolab_Exception($e);
}
$params = array('db' => $db);
break;
case 'Ldap':
try {
$params = array('ldap' => $injector->getIntance('Horde_Core_Factory_Ldap')->create('kolab', 'storage'));
} catch (Horde_Exception $e) {
throw new Kolab_Exception($e);
}
break;
}
$class = 'Kolab_Driver_' . $driver;
$this->_instances[$signature] = new $class($params);
}
return $this->_instances[$signature];
}
示例5: create
/**
* Return a Nag_Tasklists instance.
*
* @return Nag_Tasklists
*/
public function create()
{
if (!isset($GLOBALS['conf']['tasklists']['driver'])) {
$driver = 'Default';
} else {
$driver = Horde_String::ucfirst($GLOBALS['conf']['tasklists']['driver']);
}
if (empty($this->_instances[$driver])) {
$class = 'Nag_Tasklists_' . $driver;
if (class_exists($class)) {
$params = array();
if (!empty($GLOBALS['conf']['share']['auto_create'])) {
$params['auto_create'] = true;
}
switch ($driver) {
case 'Default':
$params['identity'] = $this->_injector->getInstance('Horde_Core_Factory_Identity')->create();
break;
}
$this->_instances[$driver] = new $class($GLOBALS['nag_shares'], $GLOBALS['registry']->getAuth(), $params);
} else {
throw new Nag_Exception(sprintf('Unable to load the definition of %s.', $class));
}
}
return $this->_instances[$driver];
}
示例6: up
/**
* Upgrade.
*/
public function up()
{
$sql = 'UPDATE ulaform_forms SET form_action = ? WHERE form_id = ?';
foreach ($this->select('SELECT form_id, form_action FROM ulaform_forms') as $form) {
$values = array(Horde_String::ucfirst($form['form_action']), $form['form_id']);
$this->execute($sql, $values);
}
}
示例7: factory
/**
* Attempts to return a concrete instance based on $driver.
*
* @deprecated
*
* @param mixed $driver The type of concrete subclass to return. This
* is based on the storage driver ($driver). The
* code is dynamically included.
* @param array $params A hash containing any additional configuration or
* connection parameters a subclass might need.
*
* @return VFS The newly created concrete VFS instance.
* @throws Horde_Vfs_Exception
*/
public static function factory($driver, $params = array())
{
$class = 'Horde_Vfs_' . basename(Horde_String::ucfirst($driver));
if (class_exists($class)) {
return new $class($params);
}
throw new Horde_Vfs_Exception('Class definition of ' . $class . ' not found.');
}
示例8: factory
/**
* Attempts to return a concrete Horde_SpellChecker instance based on
* $driver.
*
* @deprecated
*
* @param string $driver The type of concrete subclass to return.
* @param array $params A hash containing any additional configuration
* or connection parameters a subclass might need.
*
* @return Horde_SpellChecker The newly created instance.
* @throws Horde_Exception
*/
public static function factory($driver, $params = array())
{
$class = 'Horde_SpellChecker_' . Horde_String::ucfirst(basename($driver));
if (class_exists($class)) {
return new $class($params);
}
throw new Horde_Exception('Driver ' . $driver . ' not found');
}
示例9: getViewerConfig
/**
* Gets the configuration for a MIME type.
*
* @param string $type The MIME type.
* @param string $app The current Horde application.
*
* @return array The driver and a list of configuration parameters.
*/
public function getViewerConfig($type, $app)
{
$config = $this->_getDriver($type, $app);
$config['driver'] = Horde_String::ucfirst($config['driver']);
$driver = $config['app'] == 'horde' ? $config['driver'] : $config['app'] . '_Mime_Viewer_' . $config['driver'];
$params = array_merge($config, array('charset' => 'UTF-8', 'temp_file' => array('Horde', 'getTempFile'), 'text_filter' => array($this->_injector->getInstance('Horde_Core_Factory_TextFilter'), 'filter')));
switch ($config['driver']) {
case 'Deb':
case 'Rpm':
$params['monospace'] = 'fixed';
break;
case 'Html':
$params['browser'] = $GLOBALS['browser'];
$params['dns'] = $this->_injector->getInstance('Net_DNS2_Resolver');
$params['external_callback'] = array('Horde', 'externalUrl');
break;
case 'Ooo':
$params['temp_dir'] = Horde::getTempDir();
$params['zip'] = Horde_Compress::factory('Zip');
break;
case 'Rar':
$params['monospace'] = 'fixed';
$params['rar'] = Horde_Compress::factory('Rar');
break;
case 'Report':
case 'Security':
$params['viewer_callback'] = array($this, 'getViewerCallback');
break;
case 'Syntaxhighlighter':
if ($config['app'] == 'horde') {
$driver = 'Horde_Core_Mime_Viewer_Syntaxhighlighter';
}
$params['registry'] = $GLOBALS['registry'];
break;
case 'Tgz':
$params['gzip'] = Horde_Compress::factory('Gzip');
$params['monospace'] = 'fixed';
$params['tar'] = Horde_Compress::factory('Tar');
break;
case 'Tnef':
$params['tnef'] = Horde_Compress::factory('Tnef');
break;
case 'Vcard':
if ($config['app'] == 'horde') {
$driver = 'Horde_Core_Mime_Viewer_Vcard';
}
$params['browser'] = $GLOBALS['browser'];
$params['notification'] = $GLOBALS['notification'];
$params['prefs'] = $GLOBALS['prefs'];
$params['registry'] = $GLOBALS['registry'];
break;
case 'Zip':
$params['monospace'] = 'fixed';
$params['zip'] = Horde_Compress::factory('Zip');
break;
}
return array($this->_getDriverName($driver, 'Horde_Mime_Viewer'), $params);
}
示例10: scanForUnits
public function scanForUnits($token)
{
foreach ($this->unitScanner as $scannerItem => $scannerTag) {
if (preg_match($scannerItem, $token->word)) {
$class = 'Horde_Date_Repeater_' . Horde_String::ucfirst($scannerTag);
return new $class($scannerTag);
}
}
}
示例11: main
/**
* The main entry point for the application.
*
* @param array $parameters A list of named configuration parameters.
* <pre>
* 'parser' - (array) Parser configuration parameters.
* 'class' - (string) The class name of the parser to use.
* 'output' - (Horde_Cli) The output handler.
* </pre>
*/
public static function main(array $parameters = array())
{
$modular = self::_prepareModular($parameters);
if (empty($parameters['output'])) {
if (!class_exists('Horde_Cli')) {
throw new Horde_Kolab_Cli_Exception('The Horde_Cli package seems to be missing (Class Horde_Cli is missing)!');
}
$cli = Horde_Cli::init();
} else {
$cli = $parameters['output'];
}
$parser = $modular->createParser();
list($options, $arguments) = $parser->parseArgs();
if (count($arguments) == 0) {
$parser->printHelp();
} else {
try {
if (!empty($options['config'])) {
if (!file_exists($options['config'])) {
throw new Horde_Kolab_Cli_Exception(sprintf('The specified config file %s does not exist!', $options['config']));
}
global $conf;
include $options['config'];
foreach ($conf as $key => $value) {
$options->ensureValue($key, $value);
}
}
if (empty($options['host'])) {
$options['host'] = 'localhost';
}
if (empty($options['driver'])) {
$options['driver'] = 'horde';
}
$world = array();
foreach ($modular->getModules() as $module) {
$modular->getProvider()->getModule($module)->handleArguments($options, $arguments, $world);
}
if (!empty($options['timed']) && class_exists('Horde_Support_Timer')) {
$timer = new Horde_Support_Timer();
$timer->push();
} else {
$timer = false;
}
$modular->getProvider()->getModule(Horde_String::ucfirst($arguments[0]))->run($cli, $options, $arguments, $world);
if (!empty($options['timed'])) {
if ($timer) {
$cli->message(floor($timer->pop() * 1000) . ' ms');
} else {
$cli->message('The class Horde_Support_Timer seems to be missing!');
}
}
} catch (Horde_Cli_Modular_Exception $e) {
$parser->printHelp();
}
}
}
示例12: createTask
/**
* Create a task handler.
*
* @param string $type The task type.
* @param array $arguments The constructor arguments.
*
* @return Horde_Pear_Package_Task The task instance.
*/
public function createTask($type, $arguments)
{
$class = 'Horde_Pear_Package_Task_' . Horde_String::ucfirst($type);
if (class_exists($class)) {
$reflectionObj = new ReflectionClass($class);
return $reflectionObj->newInstanceArgs($arguments);
} else {
throw new InvalidArgumentException(sprintf('No task %s!', $type));
}
}
示例13: factory
/**
* Attempts to return a concrete Horde_Kolab_Resource_Getfreebusy instance
* based on $driver.
*
* @param mixed $driver The type of concrete
* Horde_Kolab_Resource_Getfreebusy subclass to
* return.
* @param array $params A hash containing any additional configuration or
* connection parameters a subclass might need.
*
* @return Horde_Kolab_Resource_Getfreebusy The newly created concrete
* Horde_Kolab_Resource_Getfreebusy
* instance, or false an error.
*/
public static function factory($driver, $params = array())
{
$driver = Horde_String::ucfirst(basename($driver));
$class = $driver == 'None' ? 'Horde_Kolab_Resource_Freebusy' : 'Horde_Kolab_Resource_Freebusy_' . $driver;
require_once __DIR__ . '/Freebusy/' . $driver . '.php';
if (!class_exists($class)) {
$class = 'Horde_Kolab_Resource_Freebusy';
}
return new $class($params);
}
示例14: __construct
/**
* Computes diffs between sequences of strings.
*
* @param string $engine Name of the diffing engine to use. 'auto'
* will automatically select the best.
* @param array $params Parameters to pass to the diffing engine.
* Normally an array of two arrays, each
* containing the lines from a file.
*/
public function __construct($engine, $params)
{
if ($engine == 'auto') {
$engine = extension_loaded('xdiff') ? 'Xdiff' : 'Native';
} else {
$engine = Horde_String::ucfirst(basename($engine));
}
$class = 'Horde_Text_Diff_Engine_' . $engine;
$diff_engine = new $class();
$this->_edits = call_user_func_array(array($diff_engine, 'diff'), $params);
}
示例15: _setup
/**
*
*/
protected function _setup()
{
parent::_setup();
$view = $this->getView();
$view->addTemplatePath(array($GLOBALS['fs_base'] . '/app/views/App', $GLOBALS['fs_base'] . '/app/views/App/apps/' . $this->_matchDict->app));
$view->appname = $this->_matchDict->app;
$view->hasAuthors = file_exists($GLOBALS['fs_base'] . '/app/views/App/apps/' . $this->_matchDict->app . '/appauthors.html.php');
$view->hasDocs = file_exists($GLOBALS['fs_base'] . '/app/views/App/apps/' . $this->_matchDict->app . '/docs');
$view->hasScreenshots = file_exists($GLOBALS['fs_base'] . '/app/views/App/apps/' . $this->_matchDict->app . '/appscreenshots.html.php');
$view->hasRoadmap = file_exists($GLOBALS['fs_base'] . '/app/views/App/apps/' . $this->_matchDict->app . '/approadmap.html.php');
// @TODO: Look this up in some kind of config/lookup array.
$view->appnameHuman = in_array($this->_matchDict->app, array('imp', 'mimp', 'dimp')) ? Horde_String::upper($this->_matchDict->app) : Horde_String::ucfirst($this->_matchDict->app);
}