• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Horde_String类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: 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)));
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:14,代码来源:Gravatar.php


示例2: create

 /**
  * Factory for a log object. Attempts to create a device specific file if
  * custom logging is requested.
  *
  * @param array $properties  The property array.
  *
  * @return Horde_Log_Logger  The logger object, correctly configured.
  */
 public function create($properties = array())
 {
     global $conf;
     $logger = false;
     if ($conf['activesync']['logging']['type'] == 'onefile') {
         if (!empty($properties['DeviceId'])) {
             $device_id = $properties['DeviceId'];
             $format = "%timestamp% {$device_id} %levelName%: %message%" . PHP_EOL;
             $formatter = new Horde_Log_Formatter_Simple(array('format' => $format));
             $stream = fopen($conf['activesync']['logging']['path'], 'a');
             if ($stream) {
                 $logger = new Horde_Log_Logger(new Horde_Log_Handler_Stream($stream, false, $formatter));
             }
         }
     } elseif ($conf['activesync']['logging']['type'] == 'perdevice') {
         if (!empty($properties['DeviceId'])) {
             $stream = fopen($conf['activesync']['logging']['path'] . '/' . Horde_String::upper($properties['DeviceId']) . '.txt', 'a');
             if ($stream) {
                 $logger = new Horde_Log_Logger(new Horde_Log_Handler_Stream($stream));
             }
         }
     }
     if (!$logger) {
         $logger = new Horde_Log_Logger(new Horde_Log_Handler_Null());
     }
     return $logger;
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:35,代码来源:Factory.php


示例3: auth

 /**
  * Attempt to do LMTP authentication.
  *
  * @param string The userid to authenticate as.
  * @param string The password to authenticate with.
  * @param string The requested authentication method.  If none is
  *               specified, the best supported method will be used.
  *
  * @return mixed Returns a PEAR_Error with an error message on any
  *               kind of failure, or true on success.
  * @access public
  */
 function auth($uid, $pwd, $method = '')
 {
     if (!isset($this->_esmtp['STARTTLS'])) {
         return PEAR::raiseError('LMTP server does not support authentication');
     }
     if (PEAR::isError($result = $this->_put('STARTTLS'))) {
         return $result;
     }
     if (PEAR::isError($result = $this->_parseResponse(220))) {
         return $result;
     }
     if (PEAR::isError($result = $this->_socket->enableCrypto(true, STREAM_CRYPTO_METHOD_TLS_CLIENT))) {
         return $result;
     } elseif ($result !== true) {
         return PEAR::raiseError('STARTTLS failed');
     }
     /* Send LHLO again to recieve the AUTH string from the LMTP server. */
     $this->_negotiate();
     if (empty($this->_esmtp['AUTH'])) {
         return PEAR::raiseError('LMTP server does not support authentication');
     }
     /*
      * If no method has been specified, get the name of the best supported
      * method advertised by the LMTP server.
      */
     if (empty($method) || $method === true) {
         if (PEAR::isError($method = $this->_getBestAuthMethod())) {
             /* Return the PEAR_Error object from _getBestAuthMethod(). */
             return $method;
         }
     } else {
         $method = Horde_String::upper($method);
     }
     switch ($method) {
         case 'DIGEST-MD5':
             $result = $this->_authDigest_MD5($uid, $pwd);
             break;
         case 'CRAM-MD5':
             $result = $this->_authCRAM_MD5($uid, $pwd);
             break;
         case 'LOGIN':
             $result = $this->_authLogin($uid, $pwd);
             break;
         case 'PLAIN':
             $result = $this->_authPlain($uid, $pwd);
             break;
         default:
             $result = new PEAR_Error("{$method} is not a supported authentication method");
             break;
     }
     /* If an error was encountered, return the PEAR_Error object. */
     if (PEAR::isError($result)) {
         return $result;
     }
     /* RFC-2554 requires us to re-negotiate ESMTP after an AUTH. */
     if (PEAR::isError($error = $this->_negotiate())) {
         return $error;
     }
     return true;
 }
开发者ID:horde,项目名称:horde,代码行数:72,代码来源:LMTPTLS.php


示例4: verifyIdentity

 /**
  * Sends a message to an email address supposed to be added to the
  * identity.
  *
  * A message is send to this address containing a time-sensitive link to
  * confirm that the address really belongs to that user.
  *
  * @param integer $id       The identity's ID.
  * @param string $old_addr  The old From: address.
  *
  * @throws Horde_Mime_Exception
  */
 public function verifyIdentity($id, $old_addr)
 {
     global $injector, $notification, $registry;
     $hash = strval(new Horde_Support_Randomid());
     $pref = $this->_confirmEmail();
     $pref[$hash] = $this->get($id);
     $pref[$hash][self::EXPIRE] = time() + self::EXPIRE_SECS;
     $this->_confirmEmail($pref);
     $new_addr = $this->getValue($this->_prefnames['from_addr'], $id);
     $confirm = Horde::url($registry->getServiceLink('emailconfirm')->add('h', $hash)->setRaw(true), true);
     $message = sprintf(Horde_Core_Translation::t("You have requested to add the email address \"%s\" to the list of your personal email addresses.\n\nGo to the following link to confirm that this is really your address:\n%s\n\nIf you don't know what this message means, you can delete it."), $new_addr, $confirm);
     $msg_headers = new Horde_Mime_Headers();
     $msg_headers->addHeaderOb(Horde_Mime_Headers_MessageId::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_UserAgent::create());
     $msg_headers->addHeaderOb(Horde_Mime_Headers_Date::create());
     $msg_headers->addHeader('To', $new_addr);
     $msg_headers->addHeader('From', $old_addr);
     $msg_headers->addHeader('Subject', Horde_Core_Translation::t("Confirm new email address"));
     $body = new Horde_Mime_Part();
     $body->setType('text/plain');
     $body->setContents(Horde_String::wrap($message, 76));
     $body->setCharset('UTF-8');
     $body->send($new_addr, $msg_headers, $injector->getInstance('Horde_Mail'));
     $notification->push(sprintf(Horde_Core_Translation::t("A message has been sent to \"%s\" to verify that this is really your address. The new email address is activated as soon as you confirm this message."), $new_addr), 'horde.message');
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:37,代码来源:Identity.php


示例5: 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;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:38,代码来源:Vfs.php


示例6: 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];
         }
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:40,代码来源:Ldap.php


示例7: 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);
 }
开发者ID:horde,项目名称:horde,代码行数:27,代码来源:Form.php


示例8: 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);
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:53,代码来源:Renderer.php


示例9: __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;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:34,代码来源:Ldap.php


示例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;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:33,代码来源:Alarm.php


示例11: 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];
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:36,代码来源:Driver.php


示例12: 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


示例13: 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;
 }
开发者ID:horde,项目名称:horde,代码行数:9,代码来源:DtdManager.php


示例14: 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;
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:47,代码来源:RenameSentmailMonthly.php


示例15: __construct

 /**
  * Constructor.
  *
  * @param array $config  Configuration key-value pairs.
  */
 public function __construct($config = array())
 {
     global $prefs, $registry;
     parent::__construct($config);
     $blank = new Horde_Url();
     $this->addNewButton(_("_New Event"), $blank, array('id' => 'kronolithNewEvent'));
     $this->newExtra = $blank->link(array_merge(array('id' => 'kronolithQuickEvent'), Horde::getAccessKeyAndTitle(_("Quick _insert"), false, true)));
     $sidebar = $GLOBALS['injector']->createInstance('Horde_View');
     /* Minical. */
     $today = new Horde_Date($_SERVER['REQUEST_TIME']);
     $sidebar->today = $today->format('F Y');
     $sidebar->weekdays = array();
     for ($i = $prefs->getValue('week_start_monday'), $c = $i + 7; $i < $c; $i++) {
         $weekday = Horde_Nls::getLangInfo(constant('DAY_' . ($i % 7 + 1)));
         $sidebar->weekdays[$weekday] = Horde_String::substr($weekday, 0, 2);
     }
     /* Calendars. */
     $sidebar->newShares = $registry->getAuth() && !$prefs->isLocked('default_share');
     $sidebar->admin = $registry->isAdmin();
     $sidebar->resourceAdmin = $registry->isAdmin() || $GLOBALS['injector']->getInstance('Horde_Core_Perms')->hasAppPermission('resource_management');
     $sidebar->resources = $GLOBALS['conf']['resources']['enabled'];
     $sidebar->addRemote = !$prefs->isLocked('remote_cals');
     $remotes = unserialize($prefs->getValue('remote_cals'));
     $sidebar->showRemote = !($prefs->isLocked('remote_cals') && empty($remotes));
     $this->content = $sidebar->render('dynamic/sidebar');
 }
开发者ID:horde,项目名称:horde,代码行数:31,代码来源:Sidebar.php


示例16: _renderInline

 /**
  * Return the rendered inline version of the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  */
 protected function _renderInline()
 {
     $text = Horde_String::convertCharset($this->_mimepart->getContents(), $this->_mimepart->getCharset(), 'UTF-8');
     /* Check for 'flowed' text data. */
     $data = $this->_mimepart->getContentTypeParameter('format') == 'flowed' ? $this->_formatFlowed($text, $this->_mimepart->getContentTypeParameter('delsp')) : $text;
     return $this->_renderReturn($data, 'text/html; charset=UTF-8');
 }
开发者ID:horde,项目名称:horde,代码行数:12,代码来源:Plain.php


示例17: 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


示例18: _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;
     }
 }
开发者ID:x59,项目名称:horde-mime,代码行数:37,代码来源:Addresses.php


示例19: configSpecialValues

 /**
  */
 public function configSpecialValues($what)
 {
     switch ($what) {
         case 'apps':
             $apps = Horde_Array::valuesToKeys($GLOBALS['registry']->listApps(array('active')));
             asort($apps);
             return $apps;
         case 'languages':
             $convert_numeric = function ($num) {
                 return Horde_String::convertCharset(pack('H*', $num[1]), 'ucs-2', 'UTF-8');
             };
             $convert_symbolic = function ($symbol) {
                 return Horde_String::convertCharset(html_entity_decode($symbol[1], ENT_COMPAT, 'iso-8859-1'), 'iso-8859-1', 'UTF-8');
             };
             return array_map(function ($val) {
                 return preg_replace_callback(array('/&#x([0-9a-f]{4});/i', '/(&[^;]+;)/'), array($convert_numeric, $convert_symbolic), $val);
             }, $GLOBALS['registry']->nlsconfig->languages);
         case 'blocks':
             return $GLOBALS['injector']->getInstance('Horde_Core_Factory_BlockCollection')->create()->getBlocksList();
         case 'mapsources':
             return array('Google' => 'Google', 'Bing' => 'Bing', 'Cloudmade' => 'CloudMade', 'Mytopo' => 'MyTopo', 'Osm' => 'OpenStreetMap', 'Ocm' => 'OpenCycleMap', 'Mapquest' => 'OpenMapquest');
         case 'geocoders':
             return array('None' => null, 'Google' => 'Google');
     }
 }
开发者ID:horde,项目名称:horde,代码行数:27,代码来源:Application.php


示例20: _renderInfo

 /**
  * Return the rendered information about the Horde_Mime_Part object.
  *
  * @return array  See parent::render().
  * @throws Horde_Exception
  */
 protected function _renderInfo()
 {
     $charset = $this->getConfigParam('charset');
     $contents = $this->_mimepart->getContents();
     if (!$this->getConfigParam('zip')) {
         $this->setConfigParam('zip', Horde_Compress::factory('Zip'));
     }
     $zipInfo = $this->getConfigParam('zip')->decompress($contents, array('action' => Horde_Compress_Zip::ZIP_LIST));
     $fileCount = count($zipInfo);
     $name = $this->_mimepart->getName(true);
     if (empty($name)) {
         $name = Horde_Mime_Viewer_Translation::t("unnamed");
     }
     $monospace = $this->getConfigParam('monospace');
     $text = '<table><tr><td align="left"><span ' . ($monospace ? 'class="' . $monospace . '">' : 'style="font-family:monospace">') . $this->_textFilter(Horde_Mime_Viewer_Translation::t("Archive Name") . ': ' . $name . "\n" . Horde_Mime_Viewer_Translation::t("Archive File Size") . ': ' . strlen($contents) . " bytes\n" . sprintf(Horde_Mime_Viewer_Translation::ngettext("File Count: %d file", "File Count: %d files", $fileCount), $fileCount) . "\n\n" . str_repeat(' ', 15) . Horde_String::pad(Horde_Mime_Viewer_Translation::t("Attributes"), 10, ' ', STR_PAD_LEFT) . Horde_String::pad(Horde_Mime_Viewer_Translation::t("Size"), 10, ' ', STR_PAD_LEFT) . Horde_String::pad(Horde_Mime_Viewer_Translation::t("Modified Date"), 19, ' ', STR_PAD_LEFT) . Horde_String::pad(Horde_Mime_Viewer_Translation::t("Method"), 10, ' ', STR_PAD_LEFT) . Horde_String::pad(Horde_Mime_Viewer_Translation::t("Ratio"), 10, ' ', STR_PAD_LEFT) . "\n", 'Space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true)) . str_repeat('-', 74) . "\n";
     foreach ($zipInfo as $key => $val) {
         $ratio = empty($val['size']) ? 0 : 100 * ($val['csize'] / $val['size']);
         $val['name'] = Horde_String::pad(Horde_String::truncate($val['name'], 15), 15, ' ', STR_PAD_RIGHT);
         $val['attr'] = Horde_String::pad($val['attr'], 10, ' ', STR_PAD_LEFT);
         $val['size'] = Horde_String::pad($val['size'], 10, ' ', STR_PAD_LEFT);
         $val['date'] = Horde_String::pad(strftime("%d-%b-%Y %H:%M", $val['date']), 19, ' ', STR_PAD_LEFT);
         $val['method'] = Horde_String::pad($val['method'], 10, ' ', STR_PAD_LEFT);
         $val['ratio'] = Horde_String::pad(sprintf("%1.1f%%", $ratio), 10, ' ', STR_PAD_LEFT);
         reset($val);
         while (list($k, $v) = each($val)) {
             $val[$k] = $this->_textFilter($v, 'Space2html', array('charset' => $charset, 'encode' => true, 'encode_all' => true));
         }
         if (!is_null($this->_callback)) {
             $val = call_user_func($this->_callback, $key, $val);
         }
         $text .= $val['name'] . $val['attr'] . $val['size'] . $val['date'] . $val['method'] . $val['ratio'] . "\n";
     }
     return $this->_renderReturn(nl2br($text . str_repeat('-', 74) . "\n</span></td></tr></table>"), 'text/html; charset=' . $charset);
 }
开发者ID:horde,项目名称:horde,代码行数:40,代码来源:Zip.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Horde_Themes类代码示例发布时间:2022-05-23
下一篇:
PHP Horde_Serialize类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap