本文整理汇总了PHP中Zend_View::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::translate方法的具体用法?PHP Zend_View::translate怎么用?PHP Zend_View::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::translate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildMenu
/**
* Build Menu
*
* @return array
*/
public function buildMenu()
{
$lang = $this->_language;
$config = Zend_Registry::get('config');
$forumConfig = $config->get('forum');
$url = $forumConfig->get('url');
$mainMenu = array(array('lang' => $lang, 'title' => $this->_view->translate('Forum'), 'url' => $url, 'controller' => 'forum', 'action' => 'index'), array('lang' => $lang, 'title' => $this->_view->translate('My Profile'), 'controller' => 'profile', 'action' => 'index'), array('lang' => $lang, 'title' => $this->_view->translate('Manage News'), 'controller' => 'administration', 'action' => 'news'), array('lang' => $lang, 'title' => $this->_view->translate('Manage Users'), 'controller' => 'administration', 'action' => 'users'));
return $this->_getAuthorizedMenus($mainMenu);
}
示例2: decode
public static function decode($string)
{
if (extension_loaded(self::EXTENSION) == true) {
self::loadConfig();
$string = str_replace(array('-', '_'), array('+', '/'), $string);
$base = base64_decode($string);
$keySize = mcrypt_get_key_size(self::$cipher, self::$mode);
$key = substr(self::$secretKey, 0, $keySize);
$vectorSize = mcrypt_get_iv_size(self::$cipher, self::$mode);
$vector = substr($base, 0, $vectorSize);
$value = substr($base, $vectorSize);
$decrypted = mcrypt_decrypt(self::$cipher, $key, $value, self::$mode, $vector);
$decrypted = rtrim($decrypted, "");
return $decrypted;
} else {
$view = new Zend_View();
$message = $view->translate(self::TR_EXCEPTION);
throw new Exception($message);
}
}
示例3: loadConfFromDb
public static function loadConfFromDb()
{
$view = new Zend_View();
$db = Snep_Db::getInstance();
// TODO - buscar informações da tabela extensions
foreach (array("sip", "iax2") as $tech) {
$config = Zend_Registry::get('config');
$asteriskDirectory = $config->system->path->asterisk->conf;
$extenFileConf = "{$asteriskDirectory}/snep/snep-{$tech}.conf";
$trunkFileConf = "{$asteriskDirectory}/snep/snep-{$tech}-trunks.conf";
if (!is_writable($extenFileConf)) {
throw new PBX_Exception_IO($view->translate("Failed to open file %s with write permission.", $extenFileConf));
}
if (!is_writable($trunkFileConf)) {
throw new PBX_Exception_IO($view->translate("Failed to open file %s with write permission.", $trunkFileConf));
}
/* clean snep-sip.conf file */
file_put_contents($extenFileConf, '');
/* Register header on output string of the file */
$todayDate = date("d/m/Y H:m:s");
$header = ";------------------------------------------------------------------------------------\n";
$header .= "; Arquivo: snep-{$tech}.conf - Cadastro de ramais \n";
$header .= "; \n";
$header .= "; Atualizado em: {$todayDate} \n";
$header .= "; Copyright(c) 2008 Opens Tecnologia \n";
$header .= ";------------------------------------------------------------------------------------\n";
$header .= "; Os registros a Seguir sao gerados pelo Software SNEP. \n";
$header .= "; Este Arquivo NAO DEVE ser editado Manualmente sob riscos de \n";
$header .= "; causar mau funcionamento do Asterisk \n";
$header .= ";------------------------------------------------------------------------------------\n";
/* query that gets information of the peers on the DB */
$sql = "SELECT * FROM peers WHERE name != 'admin' AND canal like '" . strtoupper($tech) . "%'";
$peer_data = $db->query($sql)->fetchAll();
$peers = "\n";
$trunk_config = "\n";
if (count($peer_data) > 0) {
foreach ($peer_data as $peer) {
$sipallow = explode(";", $peer['allow']);
$allow = '';
foreach ($sipallow as $siper) {
if ($siper != '') {
$allow .= $siper . ",";
}
}
$allow = substr($allow, 0, strlen($allow) - 1);
if ($peer['peer_type'] == 'T') {
$select = $db->select()->from('trunks')->where("name = {$peer['name']}")->limit(1);
$trunk = $db->query($select)->fetchObject();
if ($trunk->type == "SNEPSIP") {
/* Assemble trunk entries */
$peers .= '[' . $peer['username'] . "]\n";
$peers .= 'type=' . $peer['type'] . "\n";
$peers .= 'context=' . $peer['context'] . "\n";
$peers .= 'canreinvite=' . $peer['canreinvite'] . "\n";
$peers .= 'dtmfmode=' . ($peer['dtmfmode'] ? $peer['dtmfmode'] : "rfc2833") . "\n";
$peers .= 'host=' . $peer['host'] . "\n";
$peers .= 'qualify=' . ($peer['qualify'] == "no" ? "no" : "yes") . "\n";
$peers .= 'nat=' . $peer['nat'] . "\n";
$peers .= 'disallow=' . $peer['disallow'] . "\n";
$peers .= 'allow=' . $allow . "\n";
$peers .= "\n";
} else {
if ($trunk->type == "SNEPIAX2") {
/* Assemble Extension entries */
$peers .= '[' . $peer['username'] . "]\n";
$peers .= 'type=' . $peer['type'] . "\n";
$peers .= 'username=' . $peer['username'] . "\n";
$peers .= 'secret=' . $peer['username'] . "\n";
$peers .= 'context=' . $peer['context'] . "\n";
$peers .= 'canreinvite=' . $peer['canreinvite'] . "\n";
$peers .= 'dtmfmode=' . ($peer['dtmfmode'] ? $peer['dtmfmode'] : "rfc2833") . "\n";
$peers .= 'host=' . $peer['host'] . "\n";
$peers .= 'qualify=' . ($peer['qualify'] == "no" ? "no" : "yes") . "\n";
$peers .= 'nat=' . $peer['nat'] . "\n";
$peers .= 'disallow=' . $peer['disallow'] . "\n";
$peers .= 'allow=' . $allow . "\n";
$peers .= "\n";
} else {
if ($trunk->dialmethod != "NOAUTH") {
/* Assemble trunk entries */
$peers .= '[' . $peer['username'] . "]\n";
$peers .= 'type=' . $peer['type'] . "\n";
$peers .= 'context=' . $peer['context'] . "\n";
$peers .= $peer['fromdomain'] != "" ? 'fromdomain=' . $peer['fromdomain'] . "\n" : "";
$peers .= $peer['fromuser'] != "" ? 'fromuser=' . $peer['fromuser'] . "\n" : "";
$peers .= 'canreinvite=' . $peer['canreinvite'] . "\n";
$peers .= 'dtmfmode=' . ($peer['dtmfmode'] ? $peer['dtmfmode'] : "rfc2833") . "\n";
$peers .= 'host=' . $peer['host'] . "\n";
$peers .= 'qualify=' . $peer['qualify'] . "\n";
$peers .= 'nat=' . $peer['nat'] . "\n";
$peers .= 'disallow=' . $peer['disallow'] . "\n";
$peers .= 'allow=' . $allow . "\n";
if ($peer['port'] != "") {
$peers .= 'port=' . $peer['port'] . "\n";
}
if ($peer['call-limit'] != "" && $trunk->type == "SIP") {
$peers .= 'call-limit=' . $peer['call-limit'] . "\n";
}
if ($trunk->insecure != "") {
$peers .= 'insecure=' . $trunk->insecure . "\n";
//.........这里部分代码省略.........
示例4: translate
/**
* Uses the view translator to translate the provided message id.
*
* @param string $messageId
* @return string
*/
protected function translate($messageId)
{
return $this->view->translate($messageId);
}
示例5: setLanguage
public function setLanguage($language = null)
{
// provide translations
$validLanguages = array('english' => 'en', 'german' => 'de', 'french' => 'fr', 'russian' => 'ru');
Zend_Registry::set('validLanguages', $validLanguages);
if (!empty($language) && '' != $language) {
$language = strtolower($language);
} elseif (isset($_GET['language']) && !empty($_GET['language'])) {
$language = strtolower($_GET['language']);
} else {
$locale = new Zend_Locale();
$lang = $locale->getLanguage();
$languages = array_flip($validLanguages);
$language = $languages[$lang];
}
if (!in_array($language, array_keys($validLanguages))) {
$language = 'english';
}
$locale = new Zend_Locale($validLanguages[$language]);
Zend_Registry::set('language', $language);
$adapter = new Zend_Translate('csv', './application/admin/data/languages/back/' . $language . '.back.csv', $validLanguages[$language], array('disableNotices' => true));
Zend_Registry::set('Zend_Translate', $adapter);
$view = new Zend_View();
$view->translate()->setLocale($locale);
return $language;
}
示例6: createDefaultProfile
public function createDefaultProfile(Zend_View $view)
{
$profiles = new Users_Model_Profiles();
$profile = $profiles->createRow();
$profile->user_id = $this->id;
$profile->name = $view->translate('Default profile');
$profile->save();
return $profile->id;
}