Author: Michael J Rubinsky (mrubinsk@horde.org)
Inheritance: extends Horde_Translation_Autodetect
Ejemplo n.º 1
0
 /**
  * Const'r
  *
  * @param array $params  Configuration parameters:
  *   - logger: (Horde_Log_Logger) The logger.
  *             DEFAULT: none (No logging).
  *
  *   - state: (Horde_ActiveSync_State_Base) The state driver.
  *            DEFAULT: none (REQUIRED).
  *   - connector: (Horde_Core_ActiveSync_Connector) The connector object
  *                for communicating with the registry.
  *                DEFAULT: none (REQUIRED)
  *   - auth: (Horde_Auth) The auth object.
  *           DEFAULT: none (REQUIRED).
  *   - imap: (Horde_ActiveSync_Imap_Adapter) The IMAP adapter if email
  *           support is desired.
  *           DEFAULT: none (No email support will be provided).
  *   - cache: (Horde_Cache)  A cache object to store certain types of
  *                           data, such as mailbox search results.
  *                           @since 2.12.0
  */
 public function __construct(array $params = array())
 {
     parent::__construct($params);
     $this->_pid = getmypid();
     if (empty($this->_params['connector']) || !$this->_params['connector'] instanceof Horde_Core_ActiveSync_Connector) {
         throw new InvalidArgumentException('Missing required connector object.');
     }
     if (empty($this->_params['auth']) || !$this->_params['auth'] instanceof Horde_Auth_Base) {
         throw new InvalidArgumentException('Missing required Auth object');
     }
     $this->_connector = $params['connector'];
     $this->_auth = $params['auth'];
     unset($this->_params['connector']);
     unset($this->_params['auth']);
     if (!empty($this->_params['imap'])) {
         $this->_imap = $this->_params['imap'];
         unset($this->_params['imap']);
     }
     if (!empty($this->_params['cache'])) {
         $this->_cache = $this->_params['cache'];
     }
     // Build the displaymap
     $this->_displayMap = array(self::APPOINTMENTS_FOLDER_UID => Horde_ActiveSync_Translation::t('Calendar'), self::CONTACTS_FOLDER_UID => Horde_ActiveSync_Translation::t('Contacts'), self::TASKS_FOLDER_UID => Horde_ActiveSync_Translation::t('Tasks'), self::NOTES_FOLDER_UID => Horde_ActiveSync_Translation::t('Notes'));
 }
Ejemplo n.º 2
0
 /**
  * Return the descriptive part label, making sure it is not empty.
  *
  * @param Horde_Mime_Part $part  The MIME Part object.
  * @param boolean $use_descrip   Use description? If false, uses name.
  *
  * @return string  The part label (non-empty).
  */
 public function getPartName(Horde_Mime_Part $part, $use_descrip = false)
 {
     $name = $use_descrip ? $part->getDescription(true) : $part->getName(true);
     if ($name) {
         return $name;
     }
     switch ($ptype = $part->getPrimaryType()) {
         case 'multipart':
             if ($part->getSubType() == 'related' && ($view_id = $part->getMetaData('viewable_part')) && ($viewable = $this->getMimePart($view_id, array('nocontents' => true)))) {
                 return $this->getPartName($viewable, $use_descrip);
             }
             /* Fall-through. */
         /* Fall-through. */
         case 'application':
         case 'model':
             $ptype = $part->getSubType();
             break;
     }
     switch ($ptype) {
         case 'audio':
             return Horde_ActiveSync_Translation::t('Audio part');
         case 'image':
             return Horde_ActiveSync_Translation::t('Image part');
         case 'message':
         case Horde_Mime_Part::UNKNOWN:
             return Horde_ActiveSync_Translation::t('Message part');
         case 'multipart':
             return Horde_ActiveSync_Translation::t('Multipart part');
         case 'text':
             return Horde_ActiveSync_Translation::t('Text part');
         case 'video':
             return Horde_ActiveSync_Translation::t('Video part');
         default:
             // Attempt to translate this type, if possible. Odds are that
             // it won't appear in the dictionary though.
             return sprintf(Horde_ActiveSync_Translation::t('%s part'), _(Horde_String::ucfirst($ptype)));
     }
 }
Ejemplo n.º 3
0
 /**
  * Returns the plural translation of a message.
  *
  * @param string $singular  The singular version to translate.
  * @param string $plural    The plural version to translate.
  * @param integer $number   The number that determines singular vs. plural.
  *
  * @return string  The string translation, or the original string if no
  *                 translation exists.
  */
 public static function ngettext($singular, $plural, $number)
 {
     self::$_domain = 'Horde_ActiveSync';
     self::$_directory = '@data_dir@' == '@' . 'data_dir' . '@' ? dirname(__FILE__) . '/../../../locale' : '@data_dir@/Horde_ActiveSync/locale';
     return parent::ngettext($singular, $plural, $number);
 }