本文整理汇总了PHP中Horde_String::lower方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_String::lower方法的具体用法?PHP Horde_String::lower怎么用?PHP Horde_String::lower使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_String
的用法示例。
在下文中一共展示了Horde_String::lower方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param string $text The text of the HTML document.
* @param string $charset The charset of the HTML document.
*
* @throws Exception
*/
public function __construct($text, $charset = null)
{
if (!extension_loaded('dom')) {
throw new Exception('DOM extension is not available.');
}
// Bug #9616: Make sure we have valid HTML input.
if (!strlen($text)) {
$text = '<html></html>';
}
$old_error = libxml_use_internal_errors(true);
$doc = new DOMDocument();
if (is_null($charset)) {
/* If no charset given, charset is whatever libxml tells us the
* encoding should be defaulting to 'iso-8859-1'. */
$doc->loadHTML($text);
$this->_origCharset = $doc->encoding ? $doc->encoding : 'iso-8859-1';
} else {
/* Convert/try with UTF-8 first. */
$this->_origCharset = Horde_String::lower($charset);
$this->_xmlencoding = '<?xml encoding="UTF-8"?>';
$doc->loadHTML($this->_xmlencoding . Horde_String::convertCharset($text, $charset, 'UTF-8'));
if ($doc->encoding && Horde_String::lower($doc->encoding) != 'utf-8') {
/* Convert charset to what the HTML document says it SHOULD
* be. */
$doc->loadHTML(Horde_String::convertCharset($text, $charset, $doc->encoding));
$this->_xmlencoding = '';
}
}
if ($old_error) {
libxml_use_internal_errors(false);
}
$this->dom = $doc;
}
示例2: __construct
/**
* Constructor.
*
* @throws Horde_Group_Exception
*/
public function __construct($params)
{
$params = array_merge(array('binddn' => '', 'bindpw' => '', 'gid' => 'cn', 'memberuid' => 'memberUid', 'objectclass' => array('posixGroup'), 'newgroup_objectclass' => array('posixGroup')), $params);
/* Check mandatory parameters. */
foreach (array('ldap', 'basedn') as $param) {
if (!isset($params[$param])) {
throw new Horde_Group_Exception('The \'' . $param . '\' parameter is missing.');
}
}
/* Set Horde_Ldap object. */
$this->_ldap = $params['ldap'];
unset($params['ldap']);
/* Lowercase attribute names. */
$params['gid'] = Horde_String::lower($params['gid']);
$params['memberuid'] = Horde_String::lower($params['memberuid']);
if (!is_array($params['newgroup_objectclass'])) {
$params['newgroup_objectclass'] = array($params['newgroup_objectclass']);
}
foreach ($params['newgroup_objectclass'] as &$objectClass) {
$objectClass = Horde_String::lower($objectClass);
}
/* Generate LDAP search filter. */
try {
$this->_filter = Horde_Ldap_Filter::build($params['search']);
} catch (Horde_Ldap_Exception $e) {
throw new Horde_Group_Exception($e);
}
$this->_params = $params;
}
示例3: registerDTD
/**
*/
public function registerDTD($publicIdentifier, $uri, $dtd)
{
$dtd->setDPI($publicIdentifier);
$publicIdentifier = Horde_String::lower($publicIdentifier);
$this->_strDTD[$publicIdentifier] = $dtd;
$this->_strDTDURI[Horde_String::lower($uri)] = $dtd;
}
示例4: getId
/**
* Return the Gravatar ID for the specified mail address.
*
* @param string $mail The mail address.
*
* @return string The Gravatar ID.
*/
public function getId($mail)
{
if (!is_string($mail)) {
throw new InvalidArgumentException('The mail address must be a string!');
}
return md5(Horde_String::lower(trim($mail)));
}
示例5: 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);
}
示例6: _setValue
/**
*/
protected function _setValue($value)
{
parent::_setValue(trim($value));
$val = $this->value;
$encoding = Horde_String::lower($val);
switch ($encoding) {
case '7bit':
case '8bit':
case 'base64':
case 'binary':
case 'quoted-printable':
// Valid encodings
break;
default:
/* RFC 2045 [6.3] - Valid non-standardized encodings must begin
* with 'x-'. */
if (substr($encoding, 0, 2) !== 'x-') {
$encoding = self::UNKNOWN_ENCODING;
}
break;
}
if ($encoding !== $val) {
parent::_setValue($encoding);
}
}
示例7: _getDriver
/**
* Gets the driver/params for a given base Horde_Text_Filter driver.
*
* @param string $driver Either a driver name, or the full class name to
* use.
* @param array $params A hash containing any additional configuration
* parameters a subclass might need.
*
* @return array Driver as the first value, params list as the second.
*/
protected function _getDriver($driver, $params)
{
$lc_driver = Horde_String::lower($driver);
switch ($lc_driver) {
case 'bbcode':
$driver = 'Horde_Core_Text_Filter_Bbcode';
break;
case 'emails':
$driver = 'Horde_Core_Text_Filter_Emails';
break;
case 'emoticons':
$driver = 'Horde_Core_Text_Filter_Emoticons';
break;
case 'highlightquotes':
$driver = 'Horde_Core_Text_Filter_Highlightquotes';
break;
case 'linkurls':
if (!isset($params['callback'])) {
$params['callback'] = 'Horde::externalUrl';
}
break;
case 'text2html':
$param_copy = $params;
foreach (array('emails', 'linkurls', 'space2html') as $val) {
if (!isset($params[$val])) {
$tmp = $this->_getDriver($val, $param_copy);
$params[$val] = array($tmp[0] => $tmp[1]);
}
}
break;
}
return array($driver, $params);
}
示例8: _setValue
/**
*
* @throws Horde_Mime_Exception
*/
protected function _setValue($value)
{
/* @todo Implement with traits */
$rfc822 = new Horde_Mail_Rfc822();
try {
$addr_list = $rfc822->parseAddressList($value);
} catch (Horde_Mail_Exception $e) {
throw new Horde_Mime_Exception($e);
}
foreach ($addr_list as $ob) {
if ($ob instanceof Horde_Mail_Rfc822_Group) {
$ob->groupname = $this->_sanityCheck($ob->groupname);
} else {
$ob->personal = $this->_sanityCheck($ob->personal);
}
}
switch (Horde_String::lower($this->name)) {
case 'bcc':
case 'cc':
case 'from':
case 'to':
/* Catch malformed undisclosed-recipients entries. */
if (count($addr_list) == 1 && preg_match("/^\\s*undisclosed-recipients:?\\s*\$/i", $addr_list[0]->bare_address)) {
$addr_list = new Horde_Mail_Rfc822_List('undisclosed-recipients:;');
}
break;
}
if ($this->append_addr && $this->_values) {
$this->_values->add($addr_list);
} else {
$this->_values = $addr_list;
}
}
示例9: create
/**
* @return Horde_Core_History
* @throws Horde_Exception
*/
public function create(Horde_Injector $injector)
{
global $conf;
// For BC, default to 'Sql' driver.
$driver = empty($conf['history']['driver']) ? 'Sql' : $conf['history']['driver'];
$history = null;
$user = $injector->getInstance('Horde_Registry')->getAuth();
switch (Horde_String::lower($driver)) {
case 'nosql':
$nosql = $injector->getInstance('Horde_Core_Factory_Nosql')->create('horde', 'history');
if ($nosql instanceof Horde_History_Mongo) {
$history = new Horde_History_Mongo($user, array('mongo_db' => $nosql));
}
break;
case 'sql':
try {
$history = new Horde_History_Sql($user, $injector->getInstance('Horde_Core_Factory_Db')->create('horde', 'history'));
} catch (Exception $e) {
}
break;
}
if (is_null($history)) {
$history = new Horde_History_Null($user);
} elseif ($cache = $injector->getInstance('Horde_Cache')) {
$history->setCache($cache);
$history = new Horde_Core_History($history);
}
return $history;
}
示例10: 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;
}
示例11: retrieve
/**
* Retrieves user preferences from the backend.
*
* @throws Sam_Exception
*/
public function retrieve()
{
$attrib = Horde_String::lower($this->_params['attribute']);
try {
$search = $this->_ldap->search($this->_params['basedn'], Horde_Ldap_Filter::create($this->_params['uid'], 'equals', $this->_user), array('attributes' => array($attrib)));
$entry = $search->shiftEntry();
if (!$entry) {
throw new Sam_Exception(sprintf('LDAP user "%s" not found.', $this->_user));
}
foreach ($entry->getValue($attrib, 'all') as $attribute) {
list($a, $v) = explode(' ', $attribute);
$ra = $this->_mapOptionToAttribute($a);
if (is_numeric($v)) {
if (strstr($v, '.')) {
$newoptions[$ra][] = (double) $v;
} else {
$newoptions[$ra][] = (int) $v;
}
} else {
$newoptions[$ra][] = $v;
}
}
} catch (Horde_Ldap_Exception $e) {
throw new Sam_Exception($e);
}
/* Go through new options and pull single values out of their
* arrays. */
foreach ($newoptions as $k => $v) {
if (count($v) > 1) {
$this->_options[$k] = $v;
} else {
$this->_options[$k] = $v[0];
}
}
}
示例12: execute
/**
* Renames the old sent-mail mailboxes.
*
* Mailbox name: sent-mail-month-year
* month = English: 3 letter abbreviation
* Other Languages: Month value (01-12)
* year = 4 digit year
*
* The mailbox name needs to be in this specific format (as opposed to a
* user-defined one) to ensure that 'delete_sentmail_monthly' processing
* can accurately find all the old sent-mail mailboxes.
*
* @return boolean Whether all sent-mail mailboxes were renamed.
*/
public function execute()
{
global $notification;
$date_format = substr($GLOBALS['language'], 0, 2) == 'en' ? 'M-Y' : 'm-Y';
$datetime = new DateTime();
$now = $datetime->format($date_format);
foreach ($this->_getSentmail() as $sent) {
/* Display a message to the user and rename the mailbox.
* Only do this if sent-mail mailbox currently exists. */
if ($sent->exists) {
$notification->push(sprintf(_("\"%s\" mailbox being renamed at the start of the month."), $sent->display), 'horde.message');
$query = new Horde_Imap_Client_Fetch_Query();
$query->imapDate();
$query->uid();
$imp_imap = $sent->imp_imap;
$res = $imp_imap->fetch($sent, $query);
$msgs = array();
foreach ($res as $val) {
$date_string = $val->getImapDate()->format($date_format);
if (!isset($msgs[$date_string])) {
$msgs[$date_string] = $imp_imap->getIdsOb();
}
$msgs[$date_string]->add($val->getUid());
}
unset($msgs[$now]);
foreach ($msgs as $key => $val) {
$new_mbox = IMP_Mailbox::get(strval($sent) . '-' . Horde_String::lower($key));
$imp_imap->copy($sent, $new_mbox, array('create' => true, 'ids' => $val, 'move' => true));
}
}
}
return true;
}
示例13: getConfig
/**
* Returns the VFS driver parameters for the specified backend.
*
* @param string $name The VFS system name being used.
*
* @return array A hash with the VFS parameters; the VFS driver in 'type'
* and the connection parameters in 'params'.
* @throws Horde_Exception
*/
public function getConfig($name = 'horde')
{
global $conf;
if ($name !== 'horde' && !isset($conf[$name]['type'])) {
throw new Horde_Exception(Horde_Core_Translation::t("You must configure a VFS backend."));
}
$vfs = $name == 'horde' || $conf[$name]['type'] == 'horde' ? $conf['vfs'] : $conf[$name];
switch (Horde_String::lower($vfs['type'])) {
case 'none':
$vfs['params'] = array();
$vfs['type'] = 'null';
break;
case 'nosql':
$nosql = $this->_injector->getInstance('Horde_Core_Factory_Nosql')->create('horde', 'vfs');
if ($nosql instanceof Horde_Mongo_Client) {
$vfs['params']['mongo_db'] = $nosql;
$vfs['type'] = 'mongo';
}
break;
case 'sql':
case 'sqlfile':
case 'musql':
$config = Horde::getDriverConfig('vfs', 'sql');
unset($config['umask'], $config['vfsroot']);
$vfs['params']['db'] = $this->_injector->getInstance('Horde_Core_Factory_Db')->create('horde', $config);
break;
}
return $vfs;
}
示例14: toRadioButtonTag
public function toRadioButtonTag($tagValue, $options = array())
{
$options = array_merge($this->_defaultRadioOptions, $options);
$options['type'] = 'radio';
$options['value'] = $tagValue;
if (isset($options['checked'])) {
$cv = $options['checked'];
unset($options['checked']);
$checked = $cv == true || $cv == 'checked';
} else {
$checked = $this->isRadioButtonChecked($this->value($this->object()), $tagValue);
}
$options['checked'] = (bool) $checked;
$prettyTagValue = strval($tagValue);
$prettyTagValue = preg_replace('/\\s/', '_', $prettyTagValue);
$prettyTagValue = preg_replace('/\\W/', '', $prettyTagValue);
$prettyTagValue = Horde_String::lower($prettyTagValue);
if (!isset($options['id'])) {
if (isset($this->autoIndex)) {
$options['id'] = "{$this->objectName}_{$this->autoIndex}_{$this->objectProperty}_{$prettyTagValue}";
} else {
$options['id'] = "{$this->objectName}_{$this->objectProperty}_{$prettyTagValue}";
}
}
$options = $this->addDefaultNameAndId($options);
return $this->tag('input', $options);
}
示例15: _setSimplifiedType
/**
*/
protected function _setSimplifiedType()
{
if (Horde_String::lower($this->_sqlType) == 'number' && $this->_precision == 1) {
$this->_type = 'boolean';
return;
}
parent::_setSimplifiedType();
}