當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Horde_Core_Translation::t方法代碼示例

本文整理匯總了PHP中Horde_Core_Translation::t方法的典型用法代碼示例。如果您正苦於以下問題:PHP Horde_Core_Translation::t方法的具體用法?PHP Horde_Core_Translation::t怎麽用?PHP Horde_Core_Translation::t使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Horde_Core_Translation的用法示例。


在下文中一共展示了Horde_Core_Translation::t方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: create

 /**
  * @throws Horde_Exception
  */
 public function create(Horde_Injector $injector)
 {
     global $conf, $injector;
     if (empty($conf['weather']['provider'])) {
         throw new Horde_Exception(Horde_Core_Translation::t("Weather support not configured."));
     }
     // Parameters for all driver types
     $params = array('cache' => $injector->getInstance('Horde_Cache'), 'cache_lifetime' => $conf['weather']['params']['lifetime'], 'http_client' => $injector->createInstance('Horde_Core_Factory_HttpClient')->create());
     $driver = $conf['weather']['provider'];
     switch ($driver) {
         case 'WeatherUnderground':
         case 'Wwo':
             $params['apikey'] = $conf['weather']['params']['key'];
             break;
         case 'Google':
             $l = explode('_', $GLOBALS['language']);
             $params['language'] = $l[0];
             break;
     }
     $class = $this->_getDriverName($driver, 'Horde_Service_Weather');
     try {
         return new $class($params);
     } catch (InvalidArgumentException $e) {
         throw new Horde_Exception($e);
     }
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:29,代碼來源:Weather.php

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

示例3: __construct

 /**
  * Constructor
  *
  * @var params Horde_Variables  TODO
  */
 public function __construct(&$vars)
 {
     parent::__construct($vars, Horde_Core_Translation::t("Sign up for an account"));
     $this->setButtons(Horde_Core_Translation::t("Sign up"));
     $this->addHidden('', 'url', 'text', false);
     /* Use hooks get any extra fields required in signing up. */
     try {
         $extra = $GLOBALS['injector']->getInstance('Horde_Core_Hooks')->callHook('signup_getextra', 'horde');
     } catch (Horde_Exception_HookNotSet $e) {
     }
     if (!empty($extra)) {
         if (!isset($extra['user_name'])) {
             $this->addVariable(Horde_Core_Translation::t("Choose a username"), 'user_name', 'text', true);
         }
         if (!isset($extra['password'])) {
             $this->addVariable(Horde_Core_Translation::t("Choose a password"), 'password', 'passwordconfirm', true, false, Horde_Core_Translation::t("Type your password twice to confirm"));
         }
         foreach ($extra as $field_name => $field) {
             $readonly = isset($field['readonly']) ? $field['readonly'] : null;
             $desc = isset($field['desc']) ? $field['desc'] : null;
             $required = isset($field['required']) ? $field['required'] : false;
             $field_params = isset($field['params']) ? $field['params'] : array();
             $this->addVariable($field['label'], 'extra[' . $field_name . ']', $field['type'], $required, $readonly, $desc, $field_params);
         }
     } else {
         $this->addVariable(Horde_Core_Translation::t("Choose a username"), 'user_name', 'text', true);
         $this->addVariable(Horde_Core_Translation::t("Choose a password"), 'password', 'passwordconfirm', true, false, Horde_Core_Translation::t("Type your password twice to confirm"));
     }
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:34,代碼來源:Form.php

示例4: _handle

 /**
  * Variables required in form input:
  *   - imple_submit: vcard action. Contains import and source properties
  *   - mime_id
  *   - muid
  *
  * @return boolean  True on success.
  */
 protected function _handle(Horde_Variables $vars)
 {
     global $registry, $injector, $notification;
     $iCal = new Horde_Icalendar();
     try {
         $contents = $injector->getInstance('IMP_Factory_Contents')->create(new IMP_Indices_Mailbox($vars));
         if (!($mime_part = $contents->getMimePart($vars->mime_id))) {
             throw new IMP_Exception(_("Cannot retrieve vCard data from message."));
         } elseif (!$iCal->parsevCalendar($mime_part->getContents(), 'VCALENDAR', $mime_part->getCharset())) {
             throw new IMP_Exception(_("Error reading the contact data."));
         }
         $components = $iCal->getComponents();
     } catch (Exception $e) {
         $notification->push($e, 'horde.error');
     }
     $import = !empty($vars->imple_submit->import) ? $vars->imple_submit->import : false;
     $source = !empty($vars->imple_submit->source) ? $vars->imple_submit->source : false;
     if ($import && $source && $registry->hasMethod('contacts/import')) {
         $count = 0;
         foreach ($components as $c) {
             if ($c->getType() == 'vcard') {
                 try {
                     $registry->call('contacts/import', array($c, null, $source));
                     ++$count;
                 } catch (Horde_Exception $e) {
                     $notification->push(Horde_Core_Translation::t("There was an error importing the contact data:") . ' ' . $e->getMessage(), 'horde.error');
                 }
             }
         }
         $notification->push(sprintf(Horde_Core_Translation::ngettext("%d contact was successfully added to your address book.", "%d contacts were successfully added to your address book.", $count), $count), 'horde.success');
     }
 }
開發者ID:raz0rsdge,項目名稱:horde,代碼行數:40,代碼來源:VcardImport.php

示例5: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $ob = new Horde_Script_File_JsDir('dialog.js', 'horde');
     $ob->jsvars = array('HordeDialog.cancel_text' => Horde_Core_Translation::t("Cancel"), 'HordeDialog.ok_text' => Horde_Core_Translation::t("OK"));
     $this->_files[] = $ob;
     $this->_files[] = new Horde_Script_File_JsDir('redbox.js', 'horde');
     $this->_files[] = new Horde_Script_File_JsDir('scriptaculous/effects.js', 'horde');
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:11,代碼來源:Dialog.php

示例6: _renderVarInput_tableset

    protected function _renderVarInput_tableset($form, &$var, &$vars)
    {
        $header = $var->type->getHeader();
        $name = $var->getVarName();
        $values = $var->getValues();
        $form_name = $form->getName();
        $var_name = $var->getVarName() . '[]';
        $checkedValues = $var->getValue($vars);
        $actions = $this->_getActionScripts($form, $var);
        $function_name = 'select' . $form_name . $var->getVarName();
        $enable = Horde_Core_Translation::t("Select all");
        $disable = Horde_Core_Translation::t("Select none");
        $invert = Horde_Core_Translation::t("Invert selection");
        $page = $GLOBALS['injector']->getInstance('Horde_PageOutput');
        $page->addScriptFile('tables.js', 'horde');
        $page->addInlineScript(sprintf('
function %s()
{
    for (var i = 0; i < document.%s.elements.length; i++) {
        f = document.%s$2.elements[i];
        if (f.name != \'%s$3\') {
            continue;
        }
        if (arguments.length) {
            f.checked = arguments[0];
        } else {
            f.checked = !f.checked;
        }
    }
}', $function_name, $form_name, $var_name));
        $html = <<<EOT
<a href="#" onclick="{$function_name}(true); return false;">{$enable}</a>,
<a href="#" onclick="{$function_name}(false); return false;">{$disable}</a>,
<a href="#" onclick="{$function_name}(); return false;">{$invert}</a>
<table style="width: 100%" class="sortable striped" id="tableset_' . {$name} . '"><thead><tr>
<th>&nbsp;</th>
EOT;
        foreach ($header as $col_title) {
            $html .= sprintf('<th class="leftAlign">%s</th>', $col_title);
        }
        $html .= '</tr></thead>';
        if (!is_array($checkedValues)) {
            $checkedValues = array();
        }
        $i = 0;
        foreach ($values as $value => $displays) {
            $checked = in_array($value, $checkedValues) ? ' checked="checked"' : '';
            $html .= '<tr>' . sprintf('<td style="text-align: center"><input id="%s[]" type="checkbox" name="%s[]" value="%s"%s%s /></td>', $name, $name, $value, $checked, $actions);
            foreach ($displays as $col) {
                $html .= sprintf('<td>&nbsp;%s</td>', $col);
            }
            $html .= '</tr>' . "\n";
            $i++;
        }
        $html .= '</table>' . '<a href="#" onclick="' . $function_name . '(true); return false;">' . $enable . '</a>, ' . '<a href="#" onclick="' . $function_name . '(false); return false;">' . $disable . '</a>, ' . '<a href="#" onclick="' . $function_name . '(); return false;">' . $invert . '</a>';
        return $html;
    }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:57,代碼來源:TablesetHtml.php

示例7: getQueuedSignup

 /**
  * Get a user's queued signup information.
  *
  * @param string $username  The username to retrieve the queued info for.
  *
  * @return Horde_Core_Auth_Signup_SqlObject $signup  The object for the
  *                                                   requested signup.
  * @throws Horde_Exception
  * @throws Horde_Db_Exception
  */
 public function getQueuedSignup($username)
 {
     $query = 'SELECT * FROM ' . $this->_params['table'] . ' WHERE user_name = ?';
     $values = array($username);
     $result = $GLOBALS['injector']->getInstance('Horde_Core_Factory_Db')->create('horde', 'signup')->selectOne($query, $values);
     if (empty($result)) {
         throw new Horde_Exception(sprintf(Horde_Core_Translation::t("User \"%s\" does not exist."), $username));
     }
     $object = new Horde_Core_Auth_Signup_SqlObject($result['user_name']);
     $object->setData($result);
     return $object;
 }
開發者ID:horde,項目名稱:horde,代碼行數:22,代碼來源:Sql.php

示例8: parseEmailAddress

 /**
  * Parses a valid email address out of a complete address string.
  *
  * Variables used:
  *   - email: (string) An email address.
  *
  * @return object  Object with the following properties:
  *   - email: (string) The parsed email address.
  *
  * @throws Horde_Exception
  * @throws Horde_Mail_Exception
  */
 public function parseEmailAddress()
 {
     $ob = new Horde_Mail_Rfc822_Address($this->vars->email);
     if (is_null($ob->mailbox)) {
         throw new Horde_Exception(Horde_Core_Translation::t("No valid email address found"));
     }
     if (is_null($ob->host) && !is_null($this->defaultDomain)) {
         $ob->host = $this->defaultDomain;
     }
     $ret = new stdClass();
     $ret->email = $ob->bare_address;
     return $ret;
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:25,代碼來源:Email.php

示例9: create

 public function create(Horde_Injector $injector)
 {
     global $conf;
     if (empty($conf['twitter']['key']) || empty($conf['twitter']['secret'])) {
         throw new Horde_Service_Twitter_Exception(Horde_Core_Translation::t("No OAuth Key or Secret found for the Twitter API"));
     }
     /* Keys - these are obtained when registering for the service */
     $consumer_key = $conf['twitter']['key'];
     $consumer_secret = $conf['twitter']['secret'];
     /* Parameters required for the Horde_Oauth_Consumer */
     $params = array('key' => $consumer_key, 'secret' => $consumer_secret, 'requestTokenUrl' => Horde_Service_Twitter::REQUEST_TOKEN_URL, 'authorizeTokenUrl' => Horde_Service_Twitter::USER_AUTHORIZE_URL, 'accessTokenUrl' => Horde_Service_Twitter::ACCESS_TOKEN_URL, 'signatureMethod' => new Horde_Oauth_SignatureMethod_HmacSha1(), 'callbackUrl' => $GLOBALS['registry']->getServiceLink('twitter'));
     /* Create the Consumer */
     $auth = new Horde_Service_Twitter_Auth_Oauth(new Horde_Oauth_Consumer($params));
     $request = new Horde_Service_Twitter_Request_Oauth($injector->getInstance('Horde_Controller_Request'));
     $twitter = new Horde_Service_Twitter($auth, $request);
     //$twitter->setCache($injector->getInstance('Horde_Cache'));
     $twitter->setLogger($injector->getInstance('Horde_Log_Logger'));
     $twitter->setHttpClient($injector->getInstance('Horde_Core_Factory_HttpClient')->create());
     return $twitter;
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:20,代碼來源:Twitter.php

示例10: smartmobileHeader

 /**
  * Output the title bar.
  *
  * @param array $params  A list of parameters:
  *   - backlink: (mixed) Show backlink. If an array, first is URL to link
  *               to, second is label. If true, shows a basic Back link.
  *   - logout: (boolean) If true, show logout link.
  *   - portal: (boolean) If true, show portal link.
  *   - taptoggle: (boolean) Enable tap-toggle?
  *   - title: (string) If given, used as the title.
  *
  * @return string  Generated HTML code.
  */
 public function smartmobileHeader(array $params = array())
 {
     global $registry;
     $out = '<div data-position="fixed" data-role="header" data-tap-toggle="' . (empty($params['taptoggle']) ? 'false' : 'true') . '">';
     if (!empty($params['backlink'])) {
         if (is_array($params['backlink'])) {
             $out .= '<a class="smartmobile-back ui-btn-left" href="' . $params['backlink'][0] . '" data-icon="arrow-l" data-direction="reverse">' . $params['backlink'][1] . '</a>';
         } else {
             $out .= '<a class="smartmobile-back ui-btn-left" href="#" ' . 'data-icon="arrow-l" data-rel="back">' . Horde_Core_Translation::t("Back") . '</a>';
         }
     }
     if (!empty($params['portal']) && ($portal = $registry->getServiceLink('portal', 'horde')->setRaw(false))) {
         $out .= '<a class="smartmobile-portal ui-btn-left" ' . 'data-ajax="false" href="' . $portal . '">' . Horde_Core_Translation::t("Applications") . '</a>';
     }
     if (isset($params['title']) && strlen($params['title'])) {
         $out .= '<h1 class="smartmobile-title">' . $params['title'] . '</h1>';
     }
     if (!empty($params['logout']) && $registry->showService('logout') && ($logout = $registry->getServiceLink('logout')->setRaw(false))) {
         $out .= '<a class="smartmobile-logout ui-btn-right" href="' . $logout . '" data-ajax="false" data-theme="e" data-icon="delete">' . Horde_Core_Translation::t("Log out") . '</a>';
     }
     return $out . '</div>';
 }
開發者ID:horde,項目名稱:horde,代碼行數:35,代碼來源:Helper.php

示例11: _attach

 /**
  */
 protected function _attach($init)
 {
     global $page_output;
     if ($init) {
         $page_output->addScriptFile('scriptaculous/effects.js', 'horde');
         $page_output->addScriptFile('inplaceeditor.js', 'horde');
         $value_url = $this->getImpleUrl()->add(array('id' => $this->_params['dataid'], 'input' => 'value'))->setRaw(true);
         $load_url = $value_url->copy()->add(array('action' => 'load'))->setRaw(true);
         $config = new stdClass();
         $config->config = array('cancelClassName' => '', 'cancelText' => Horde_Core_Translation::t("Cancel"), 'emptyText' => Horde_Core_Translation::t("Click to add caption..."), 'okText' => Horde_Core_Translation::t("Ok"));
         $config->ids = new stdClass();
         $config->ids->{$this->getDomId()} = array('load_url' => (string) $load_url, 'rows' => $this->_params['rows'], 'value_url' => (string) $value_url);
         if (!empty($this->_params['width'])) {
             $config->ids->{$this->getDomId()}['width'] = $this->_params['width'];
         }
         $page_output->addInlineJsVars(array('HordeImple.InPlaceEditor' . $this->getDomId() => $config));
         $page_output->addInlineScript(array('$H(HordeImple.InPlaceEditor' . $this->getDomId() . '.ids).each(function(pair) {
                  new InPlaceEditor(pair.key, pair.value.value_url, Object.extend(HordeImple.InPlaceEditor' . $this->getDomId() . '.config, {
                      htmlResponse: false,
                      callback: function(form, value) {
                          return "value=" + encodeURIComponent(value);
                      },
                      onComplete: function(ipe, opts) {
                         if (opts) {
                             $("' . $this->getDomId() . '").update(opts.responseJSON)
                         }
                          ipe.checkEmpty()
                      },
                      loadTextURL: pair.value.load_url,
                      rows: pair.value.rows,
                      autoWidth: true
                  }));
              })'), true);
     }
     return false;
 }
開發者ID:raz0rsdge,項目名稱:horde,代碼行數:38,代碼來源:InPlaceEditor.php

示例12: fatal

    /**
     * Aborts with a fatal error, displaying debug information to the user.
     *
     * @param mixed $error  Either a string or an object with a getMessage()
     *                      method (e.g. PEAR_Error, Exception).
     */
    public static function fatal($error)
    {
        global $registry;
        if (is_object($error)) {
            switch (get_class($error)) {
                case 'Horde_Exception_AuthenticationFailure':
                    $auth_app = !$registry->clearAuthApp($error->application);
                    if ($auth_app && $registry->isAuthenticated(array('app' => $error->application, 'notransparent' => true))) {
                        break;
                    }
                    try {
                        Horde::log($error, 'NOTICE');
                    } catch (Exception $e) {
                    }
                    if (Horde_Cli::runningFromCLI()) {
                        $cli = new Horde_Cli();
                        $cli->fatal($error);
                    }
                    $params = array();
                    if ($registry->getAuth()) {
                        $params['app'] = $error->application;
                    }
                    switch ($error->getCode()) {
                        case Horde_Auth::REASON_MESSAGE:
                            $params['msg'] = $error->getMessage();
                            $params['reason'] = $error->getCode();
                            break;
                    }
                    $logout_url = $registry->getLogoutUrl($params);
                    /* Clear authentication here. Otherwise, there might be
                     * issues on the login page since we would otherwise need
                     * to do session token checking (which might not be
                     * available, so logout won't happen, etc...) */
                    if ($auth_app && array_key_exists('app', $params)) {
                        $registry->clearAuth();
                    }
                    $logout_url->redirect();
            }
        }
        try {
            Horde::log($error, 'EMERG');
        } catch (Exception $e) {
        }
        try {
            $cli = Horde_Cli::runningFromCLI();
        } catch (Exception $e) {
            die($e);
        }
        if ($cli) {
            $cli = new Horde_Cli();
            $cli->fatal($error);
        }
        if (!headers_sent()) {
            header('Content-type: text/html; charset=UTF-8');
        }
        echo <<<HTML
<html>
<head><title>Horde :: Fatal Error</title></head>
<body style="background:#fff; color:#000">
HTML;
        ob_start();
        try {
            $admin = isset($registry) && $registry->isAdmin();
            echo '<h1>' . Horde_Core_Translation::t("A fatal error has occurred") . '</h1>';
            if (is_object($error) && method_exists($error, 'getMessage')) {
                echo '<h3>' . htmlspecialchars($error->getMessage()) . '</h3>';
            } elseif (is_string($error)) {
                echo '<h3>' . htmlspecialchars($error) . '</h3>';
            }
            if ($admin) {
                $trace = $error instanceof Exception ? $error : debug_backtrace();
                echo '<div id="backtrace"><pre>' . strval(new Horde_Support_Backtrace($trace)) . '</pre></div>';
                if (is_object($error)) {
                    echo '<h3>' . Horde_Core_Translation::t("Details") . '</h3>';
                    echo '<h4>' . Horde_Core_Translation::t("The full error message is logged in Horde's log file, and is shown below only to administrators. Non-administrative users will not see error details.") . '</h4>';
                    ob_flush();
                    flush();
                    echo '<div id="details"><pre>' . htmlspecialchars(print_r($error, true)) . '</pre></div>';
                }
            } else {
                echo '<h3>' . Horde_Core_Translation::t("Details have been logged for the administrator.") . '</h3>';
            }
        } catch (Exception $e) {
            die($e);
        }
        ob_end_flush();
        echo '</body></html>';
        exit(1);
    }
開發者ID:horde,項目名稱:horde,代碼行數:95,代碼來源:ErrorHandler.php

示例13: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $ob = new Horde_Script_File_JsDir('popup.js', 'horde');
     $ob->jsvars = array('HordePopup.popup_block_text' => Horde_Core_Translation::t("A popup window could not be opened. Your browser may be blocking popups."));
     $this->_files[] = $ob;
 }
開發者ID:raz0rsdge,項目名稱:horde,代碼行數:9,代碼來源:Popup.php

示例14: writePHPConfig

 /**
  * Generates and writes the content of the application's configuration
  * file.
  *
  * @param Horde_Variables $formvars  The processed configuration form
  *                                   data.
  * @param string $php                The content of the generated
  *                                   configuration file.
  *
  * @return boolean  True if the configuration file could be written
  *                  immediately to the file system.
  */
 public function writePHPConfig($formvars, &$php = null)
 {
     $php = $this->generatePHPConfig($formvars);
     $path = $GLOBALS['registry']->get('fileroot', $this->_app) . '/config';
     $configFile = $this->configFile();
     if (file_exists($configFile)) {
         if (@copy($configFile, $path . '/conf.bak.php')) {
             $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Successfully saved the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.success');
         } else {
             $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Could not save the backup configuration file %s."), Horde_Util::realPath($path . '/conf.bak.php')), 'horde.warning');
         }
     }
     if ($fp = @fopen($configFile, 'w')) {
         /* Can write, so output to file. */
         fwrite($fp, $php);
         fclose($fp);
         $GLOBALS['registry']->rebuild();
         $GLOBALS['notification']->push(sprintf(Horde_Core_Translation::t("Successfully wrote %s"), Horde_Util::realPath($configFile)), 'horde.success');
         return true;
     }
     /* Cannot write. Save to session. */
     $GLOBALS['session']->set('horde', 'config/' . $this->_app, $php);
     return false;
 }
開發者ID:jubinpatel,項目名稱:horde,代碼行數:36,代碼來源:Config.php

示例15: header

 /**
  * Output the page header.
  *
  * @param array $opts  Options:
  *   - body_class: (string)
  *   - body_id: (string)
  *   - html_id: (string)
  *   - smartmobileinit: (string) (@deprecated; use $this->smartmobileInit
  *                      instead)
  *   - stylesheet_opts: (array)
  *   - title: (string)
  *   - view: (integer)
  */
 public function header(array $opts = array())
 {
     global $injector, $language, $registry, $session;
     $view = new Horde_View(array('templatePath' => $registry->get('templates', 'horde') . '/common'));
     $view->outputJs = !$this->deferScripts;
     $view->stylesheetOpts = array();
     $this->_view = empty($opts['view']) ? $registry->hasView($registry->getView()) ? $registry->getView() : Horde_Registry::VIEW_BASIC : $opts['view'];
     if ($session->regenerate_due) {
         $session->regenerate();
     }
     switch ($this->_view) {
         case $registry::VIEW_BASIC:
             $this->_addBasicScripts();
             break;
         case $registry::VIEW_DYNAMIC:
             $this->ajax = true;
             $this->growler = true;
             $this->_addBasicScripts();
             $this->addScriptPackage('Horde_Core_Script_Package_Popup');
             break;
         case $registry::VIEW_MINIMAL:
             $view->stylesheetOpts['subonly'] = true;
             $view->minimalView = true;
             $this->sidebar = $this->topbar = false;
             break;
         case $registry::VIEW_SMARTMOBILE:
             $smobile_files = array($this->debug ? 'jquery.mobile/jquery.js' : 'jquery.mobile/jquery.min.js', 'growler-jquery.js', 'horde-jquery.js', 'smartmobile.js', 'horde-jquery-init.js', $this->debug ? 'jquery.mobile/jquery.mobile.js' : 'jquery.mobile/jquery.mobile.min.js');
             foreach ($smobile_files as $val) {
                 $ob = $this->addScriptFile(new Horde_Script_File_JsFramework($val, 'horde'));
                 $ob->cache = 'package_smartmobile';
             }
             $this->smartmobileInit = array_merge(array('$.mobile.page.prototype.options.backBtnText = "' . Horde_Core_Translation::t("Back") . '";', '$.mobile.dialog.prototype.options.closeBtnText = "' . Horde_Core_Translation::t("Close") . '";', '$.mobile.loader.prototype.options.text = "' . Horde_Core_Translation::t("loading") . '";'), isset($opts['smartmobileinit']) ? $opts['smartmobileinit'] : array(), $this->smartmobileInit);
             $this->addInlineJsVars(array('HordeMobile.conf' => array('ajax_url' => $registry->getServiceLink('ajax', $registry->getApp())->url, 'logout_url' => strval($registry->getServiceLink('logout')), 'sid' => SID, 'token' => $session->getToken())));
             $this->addMetaTag('viewport', 'width=device-width, initial-scale=1', false);
             $view->stylesheetOpts['subonly'] = true;
             $this->addStylesheet($registry->get('jsfs', 'horde') . '/jquery.mobile/jquery.mobile.min.css', $registry->get('jsuri', 'horde') . '/jquery.mobile/jquery.mobile.min.css');
             $view->smartmobileView = true;
             // Force JS to load at top of page, so we don't see flicker when
             // mobile styles are applied.
             $view->outputJs = true;
             $this->sidebar = $this->topbar = false;
             break;
     }
     $view->stylesheetOpts['sub'] = Horde_Themes::viewDir($this->_view);
     if ($this->ajax || $this->growler) {
         $this->addScriptFile(new Horde_Script_File_JsFramework('hordecore.js', 'horde'));
         /* Configuration used in core javascript files. */
         $js_conf = array_filter(array('URI_AJAX' => $registry->getServiceLink('ajax', $registry->getApp())->url, 'URI_DLOAD' => strval($registry->getServiceLink('download', $registry->getApp())), 'URI_LOGOUT' => strval($registry->getServiceLink('logout')), 'URI_SNOOZE' => strval(Horde::url($registry->get('webroot', 'horde') . '/services/snooze.php', true, -1)), 'SID' => SID, 'TOKEN' => $session->getToken(), 'growler_log' => $this->topbar, 'popup_height' => 610, 'popup_width' => 820));
         /* Gettext strings used in core javascript files. */
         $js_text = array('ajax_error' => Horde_Core_Translation::t("Error when communicating with the server."), 'ajax_recover' => Horde_Core_Translation::t("The connection to the server has been restored."), 'ajax_timeout' => Horde_Core_Translation::t("There has been no contact with the server for several minutes. The server may be temporarily unavailable or network problems may be interrupting your session. You will not see any updates until the connection is restored."), 'snooze' => sprintf(Horde_Core_Translation::t("You can snooze it for %s or %s dismiss %s it entirely"), '#{time}', '#{dismiss_start}', '#{dismiss_end}'), 'snooze_select' => array('0' => Horde_Core_Translation::t("Select..."), '5' => Horde_Core_Translation::t("5 minutes"), '15' => Horde_Core_Translation::t("15 minutes"), '60' => Horde_Core_Translation::t("1 hour"), '360' => Horde_Core_Translation::t("6 hours"), '1440' => Horde_Core_Translation::t("1 day")), 'dismissed' => Horde_Core_Translation::t("The alarm was dismissed."));
         if ($this->topbar) {
             $js_text['growlerclear'] = Horde_Core_Translation::t("Clear All");
             $js_text['growlerinfo'] = Horde_Core_Translation::t("This is the notification log.");
             $js_text['growlernoalerts'] = Horde_Core_Translation::t("No Alerts");
         }
         $this->addInlineJsVars(array('HordeCore.conf' => $js_conf, 'HordeCore.text' => $js_text), array('top' => true));
     }
     if ($this->growler) {
         $this->addScriptFile('growler.js', 'horde');
         $this->addScriptFile('scriptaculous/effects.js', 'horde');
         $this->addScriptFile('scriptaculous/sound.js', 'horde');
     }
     if (isset($opts['stylesheet_opts'])) {
         $view->stylesheetOpts = array_merge($view->stylesheetOpts, $opts['stylesheet_opts']);
     }
     $html = '';
     if (isset($language)) {
         $html .= ' lang="' . htmlspecialchars(strtr($language, '_', '-')) . '"';
     }
     if (isset($opts['html_id'])) {
         $html .= ' id="' . htmlspecialchars($opts['html_id']) . '"';
     }
     $view->htmlAttr = $html;
     $body = '';
     if (isset($opts['body_class'])) {
         $body .= ' class="' . htmlspecialchars($opts['body_class']) . '"';
     }
     if (isset($opts['body_id'])) {
         $body .= ' id="' . htmlspecialchars($opts['body_id']) . '"';
     }
     $view->bodyAttr = $body;
     $page_title = $registry->get('name');
     if (isset($opts['title'])) {
         $page_title .= ' :: ' . $opts['title'];
     }
     $view->pageTitle = htmlspecialchars($page_title);
     $view->pageOutput = $this;
//.........這裏部分代碼省略.........
開發者ID:jubinpatel,項目名稱:horde,代碼行數:101,代碼來源:PageOutput.php


注:本文中的Horde_Core_Translation::t方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。