当前位置: 首页>>代码示例>>PHP>>正文


PHP Localization::getInstance方法代码示例

本文整理汇总了PHP中Localization::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Localization::getInstance方法的具体用法?PHP Localization::getInstance怎么用?PHP Localization::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Localization的用法示例。


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

示例1: __construct

 public function __construct($page, $comment_id, $type = 0)
 {
     $this->_localization = Localization::getInstance();
     $this->type = $type;
     $this->page = $page;
     $this->comment_id = $comment_id;
     $this->form_values['comment_text'] = isset($_POST['comment_text']) ? htmlspecialchars($_POST['comment_text']) : '';
     $this->form_values['name'] = isset($_POST['name']) ? htmlspecialchars($_POST['name']) : '';
     $this->form_values['email_hp'] = isset($_POST['email_hp']) ? htmlspecialchars($_POST['email_hp']) : '';
     $this->_form_session = 'comment_form_session_' . $this->comment_id . '_' . $this->type;
     if ($this->type == 1) {
         if (isset($_GET['get_5'])) {
             $this->current_page = intval($_GET['get_5']);
         } else {
             $this->current_page = 1;
         }
     } else {
         if (isset($_GET['get_1'])) {
             $this->current_page = intval($_GET['get_1']);
         } else {
             $this->current_page = 1;
         }
     }
     if ($this->current_page == 0) {
         $this->current_page = 1;
     }
     if (isset($_SESSION[$this->_form_session])) {
         $this->form_session = $_SESSION[$this->_form_session];
         $form_session_data['name'] = session_name();
         $form_session_data['id'] = session_id();
         $this->form_session_data = $form_session_data;
     }
 }
开发者ID:adartk,项目名称:phpsqlitecms,代码行数:33,代码来源:Comment.class.php

示例2: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization(Page $c = null)
 {
     $loc = \Localization::getInstance();
     if (!(\User::isLoggedIn() && Config::get('concrete.multilingual.keep_users_locale'))) {
         if (!$c) {
             $c = Page::getCurrentPage();
         }
         // don't translate dashboard pages
         $dh = \Core::make('helper/concrete/dashboard');
         if ($dh->inDashboard($c)) {
             return;
         }
         $locale = null;
         $ms = Section::getBySectionOfSite($c);
         if ($ms) {
             $locale = $ms->getLocale();
         }
         if (!$locale) {
             if (Config::get('concrete.multilingual.use_previous_locale') && Session::has('previous_locale')) {
                 $locale = Session::get('previous_locale');
             }
             if (!$locale) {
                 $ms = static::getPreferredSection();
                 if ($ms) {
                     $locale = $ms->getLocale();
                 }
             }
         }
         if ($locale) {
             $loc->setLocale($locale);
         }
     }
     Session::set('previous_locale', $loc->getLocale());
 }
开发者ID:WillemAnchor,项目名称:concrete5,代码行数:34,代码来源:Detector.php

示例3: changeLocale

 static function changeLocale($locale)
 {
     // change core language to translate e.g. core blocks/themes
     if (strlen($locale)) {
         Localization::changeLocale($locale);
         // site translations
         $loc = Localization::getInstance();
         $loc->addSiteInterfaceLanguage($locale);
         // add package translations
         $pl = PackageList::get();
         $installed = $pl->getPackages();
         foreach ($installed as $pkg) {
             if ($pkg instanceof Package) {
                 $pkg->setupPackageLocalization($locale);
             }
         }
     }
 }
开发者ID:rratcliffe,项目名称:fsen,代码行数:18,代码来源:fsen_localization.php

示例4: __construct

 public function __construct($id, $news_per_page)
 {
     $this->id = $id;
     $this->news_per_page = $news_per_page;
     $this->current_time = time();
     $this->_localization = Localization::getInstance();
     $category_identifier_length = strlen(CATEGORY_IDENTIFIER);
     if (isset($_GET['get_1']) && substr($_GET['get_1'], 0, $category_identifier_length) == CATEGORY_IDENTIFIER) {
         $this->category = str_replace(AMPERSAND_REPLACEMENT, '&', substr($_GET['get_1'], $category_identifier_length));
         $this->category_urlencoded = str_replace('%26', AMPERSAND_REPLACEMENT, urlencode($this->category));
     }
     if (isset($_GET['get_2'])) {
         $this->current_page = intval($_GET['get_2']);
     } else {
         $this->current_page = 1;
     }
     if ($this->current_page == 0) {
         $this->current_page = 1;
     }
 }
开发者ID:hplc,项目名称:phpsqlitecms,代码行数:20,代码来源:News.class.php

示例5: __construct

 public function __construct($gallery, $commentable = 0)
 {
     $this->_localization = Localization::getInstance();
     $dbr = Database::$content->prepare('SELECT id, photo_thumbnail, photo_normal, title, subtitle, description, photos_per_row FROM ' . Database::$db_settings['photo_table'] . ' WHERE gallery=:gallery ORDER BY sequence ASC');
     $dbr->bindParam(':gallery', $gallery, PDO::PARAM_STR);
     $dbr->execute();
     $i = 0;
     while ($photo_data = $dbr->fetch()) {
         if ($commentable == 1) {
             $count_result = Database::$entries->prepare('SELECT COUNT(*) AS comments FROM ' . Database::$db_settings['comment_table'] . ' WHERE comment_id=:id AND type=1');
             $count_result->bindValue(':id', $photo_data['id'], PDO::PARAM_INT);
             $count_result->execute();
             $count_data = $count_result->fetch();
             $this->photos[$i]['comments'] = $count_data['comments'];
             $this->_localization->bindId('number_of_comments', $photo_data['id']);
             switch ($count_data['comments']) {
                 case 0:
                     $this->_localization->selectBoundVariant('number_of_comments', $photo_data['id'], 0);
                     break;
                 case 1:
                     $this->_localization->selectBoundVariant('number_of_comments', $photo_data['id'], 1);
                     break;
                 default:
                     $this->_localization->selectBoundVariant('number_of_comments', $photo_data['id'], 2);
                     $this->_localization->replacePlaceholderBound('comments', $count_data['comments'], 'number_of_comments', $photo_data['id']);
             }
         }
         $this->photos[$i]['id'] = $photo_data['id'];
         $this->photos[$i]['photo_thumbnail'] = $photo_data['photo_thumbnail'];
         $this->photos[$i]['photo_normal'] = $photo_data['photo_normal'];
         $this->photos[$i]['title'] = htmlspecialchars($photo_data['title']);
         $this->photos[$i]['subtitle'] = htmlspecialchars($photo_data['subtitle']);
         $this->photos[$i]['description'] = htmlspecialchars($photo_data['description']);
         $thumbnail_info = getimagesize(MEDIA_DIR . $photo_data['photo_thumbnail']);
         $this->photos[$i]['width'] = $thumbnail_info[0];
         $this->photos[$i]['height'] = $thumbnail_info[1];
         $this->photos_per_row = $photo_data['photos_per_row'];
         $i++;
     }
     $this->number_of_photos = $i;
 }
开发者ID:hplc,项目名称:phpsqlitecms,代码行数:41,代码来源:Gallery.class.php

示例6: User

/**
 * ----------------------------------------------------------------------------
 * Load preprocess items
 * ----------------------------------------------------------------------------
 */
require DIR_BASE_CORE . '/bootstrap/preprocess.php';
/**
 * ----------------------------------------------------------------------------
 * Set the active language for the site, based either on the site locale, or the
 * current user record. This can be changed later as well, during runtime.
 * Start localization library.
 * ----------------------------------------------------------------------------
 */
$u = new User();
$lan = $u->getUserLanguageToDisplay();
$loc = Localization::getInstance();
$loc->setLocale($lan);
/**
 * Handle automatic updating
 */
$cms->handleAutomaticUpdates();
/**
 * ----------------------------------------------------------------------------
 * Now that we have languages out of the way, we can run our package on_start
 * methods
 * ----------------------------------------------------------------------------
 */
$cms->setupPackages();
/**
 * ----------------------------------------------------------------------------
 * Load all permission keys into our local cache.
开发者ID:kreativmind,项目名称:concrete5-5.7.0,代码行数:31,代码来源:start.php

示例7: isEmail

 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitationsborder: 10px dotted #29C3FF; under the License.
 */
?>

<?php 
$msgs = Localization::getInstance();
?>

<form action="wb.php?do=register" method="post" name="registerForm" onsubmit="return isEmail('registerForm', 'textNewUserEmail', 'emailNewUser');">
	
	<div class="registerForm">
			
		<div class="line">
			<div class="left">
				<?php 
echo $msgs->getText('registerForm.name');
?>
			</div>			
			<input 
				id="textNewUserName" 
				type="text" 
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:31,代码来源:registerForm.php

示例8: date

	/** 
	 * Subsitute for the native date() function that adds localized date support
	 * This uses Zend's Date Object {@link http://framework.zend.com/manual/en/zend.date.constants.html#zend.date.constants.phpformats}
	 * @param string $mask
	 * @param int $timestamp
	 * @return string
	 */
	public function date($mask,$timestamp=false) {
		$loc = Localization::getInstance();
		if ($timestamp === false) {
			$timestamp = time();
		}
		
		if ($loc->getLocale() == 'en_US') {
			return date($mask, $timestamp);			
		}		

		$locale = new Zend_Locale(Localization::activeLocale());
		Zend_Date::setOptions(array('format_type' => 'php'));
		$cache = Cache::getLibrary();
		if (is_object($cache)) {
			Zend_Date::setOptions(array('cache'=>$cache));
		} 
		$date = new Zend_Date($timestamp, false, $locale);

		return $date->toString($mask);
	}
开发者ID:nveid,项目名称:concrete5,代码行数:27,代码来源:date.php

示例9: getTranslate

 /** Returns the current Zend_Translate instance (null if and only if locale is en_US)
  * @var Zend_Translate|null
  */
 public static function getTranslate()
 {
     $loc = Localization::getInstance();
     return $loc->getActiveTranslateObject();
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:8,代码来源:localization.php

示例10: execute

 public function execute($action)
 {
     $msgs = Localization::getInstance();
     $forwards = $action->getForwards();
     //$_POST["course"] = "1";
     //$_POST['manager'] = "coordenador@eduquito.com";
     //$_POST["name"] = "Coordenador do Curso";
     //$_POST["email"] ="coordenador@eduquito.com";
     $roomCourse = $_POST["course"];
     $roomManager = $_POST['manager'];
     $userName = utf8_decode($_POST["name"]);
     $userEmail = $_POST["email"];
     $userPasswordEduquito = "mude";
     if (!empty($roomCourse) && !empty($roomManager) && !empty($userName) && !empty($userEmail)) {
         // CHECKING USER IN EDUQUITO
         $bdHost = "143.54.193.37";
         $bdUser = "wb";
         $bdPassword = "wb";
         $bdDataBase = "EduquitoCurso" . $roomCourse;
         // Connect to database
         $mysqli = mysqli_init();
         mysqli_options($mysqli, MYSQLI_OPT_CONNECT_TIMEOUT, 3);
         mysqli_real_connect($mysqli, $bdHost, $bdUser, $bdPassword, $bdDataBase);
         $eduquitoConnected = true;
         // Checks whether any errors occurred
         if (mysqli_connect_errno()) {
             $eduquitoConnected = false;
         }
         if ($eduquitoConnected) {
             $nameLoginEduquito = $userName;
             $emailLoginEduquito = $userEmail;
             // Prepares a SQL query
             if ($sql = $mysqli->prepare("SELECT `cod_usuario` FROM `Usuario` WHERE `email` = ? AND `nome` = ?")) {
                 $sql->bind_param('ss', $emailLoginEduquito, $nameLoginEduquito);
                 // Run the query
                 $sql->execute();
                 $i = 0;
                 $sql->bind_result($id);
                 while ($sql->fetch()) {
                     $i++;
                 }
                 if ($i >= 1) {
                     $permissionEduquito = true;
                 } else {
                     $permissionEduquito = false;
                 }
                 // Close query
                 $sql->close();
             }
             // Closes the connection to the database
             $mysqli->close();
         }
         if (!$eduquitoConnected || $permissionEduquito) {
             // CHECKING USER IN WHITEBOARD
             $user = $this->dao->login($userEmail, $userPasswordEduquito);
             if (count($user) <= 0) {
                 // Not in database, create new user
                 if (!empty($userEmail) && !empty($userName)) {
                     // Instantiates a new user;
                     $user = new User();
                     $user->setName($userName);
                     $user->setEmail($userEmail);
                     $user->setPassword($userPasswordEduquito);
                     $user->setRoomcreator(0);
                     $resultUser = $this->dao->saveNewUser($user);
                     $user = $this->dao->login($userEmail, $userPasswordEduquito);
                 }
             }
             if ($user->getName() != $userName) {
                 // Upadate user;
                 $resultUser = $this->dao->updateUserName($user->getUserId(), $userName);
             }
             // User contained in the database, loggin
             $_SESSION['id'] = $user->getUserId();
             $_SESSION['name'] = $user->getName();
             $_SESSION['roomCreator'] = $user->getRoomcreator();
             $_SESSION['email'] = $user->getEmail();
             $_SESSION['user'] = $user;
             // Verifies and creates, if necessary, the room of course
             $roomEduquito = $this->dao->getRoomByCourse($roomCourse);
             if (count($roomEduquito) <= 0) {
                 $roomName = "Sala do curso " . $roomCourse;
                 $_POST["name"] = $roomName;
                 $_POST["course"] = $roomCourse;
                 $_POST['idsSelecteds'] = $user->getUserId();
                 if ($user->getEmail() == $roomManager) {
                     $_SESSION['id'] = $user->getUserId();
                 } else {
                     $manager = $this->dao->login($roomManager, $userPasswordEduquito);
                     if (count($manager) <= 0) {
                         // Not in database, create new user coordinator
                         $manager = new User();
                         $manager->setName("Coordenador do curso");
                         $manager->setEmail($roomManager);
                         $manager->setPassword($userPasswordEduquito);
                         $manager->setRoomcreator(0);
                         $resultManager = $this->dao->saveNewUser($manager);
                         $manager = $this->dao->login($manager->getEmail(), $userPasswordEduquito);
                     }
                     $_SESSION['id'] = $manager->getUserId();
//.........这里部分代码省略.........
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:101,代码来源:EduquitoActions.php

示例11: __construct

 public function __construct()
 {
     $this->_localization = Localization::getInstance();
 }
开发者ID:hplc,项目名称:phpsqlitecms,代码行数:4,代码来源:Pingback.class.php

示例12: __construct

 public function __construct()
 {
     $mySqlDAOFactory = DAOFactory::getDAOFactory(DAOFactory::$MYSQL);
     $this->dao = $mySqlDAOFactory->getDataBaseOperations();
     $this->message = Localization::getInstance();
 }
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:6,代码来源:AbstractSecurity.php

示例13: setupSiteInterfaceLocalization

 public static function setupSiteInterfaceLocalization()
 {
     // don't translate dashboard pages
     $c = Page::getCurrentPage();
     if ($c instanceof Page && Loader::helper('section', 'multilingual')->section('dashboard')) {
         return;
     }
     $ms = MultilingualSection::getCurrentSection();
     if (is_object($ms)) {
         $locale = $ms->getLocale();
     } else {
         $locale = DefaultLanguageHelper::getSessionDefaultLocale();
     }
     // change core language to translate e.g. core blocks/themes
     if (strlen($locale)) {
         Localization::changeLocale($locale);
     }
     // site translations
     if (is_dir(DIR_LANGUAGES_SITE_INTERFACE)) {
         if (file_exists(DIR_LANGUAGES_SITE_INTERFACE . '/' . $locale . '.mo')) {
             $loc = Localization::getInstance();
             $loc->addSiteInterfaceLanguage($locale);
         }
     }
     // add package translations
     if (strlen($locale)) {
         $ms = MultilingualSection::getByLocale($locale);
         if ($ms instanceof MultilingualSection) {
             $pl = PackageList::get();
             $installed = $pl->getPackages();
             foreach ($installed as $pkg) {
                 if ($pkg instanceof Package) {
                     $pkg->setupPackageLocalization($ms->getLocale());
                 }
             }
         }
     }
 }
开发者ID:Zyqsempai,项目名称:amanet,代码行数:38,代码来源:default_language.php

示例14: execute

 public function execute($action)
 {
     $msgs = Localization::getInstance();
     $forwards = $action->getForwards();
     // Recebe os valores enviados
     $roomCourse = $_POST["group"];
     $roomManager = $_POST['manager'];
     $userName = utf8_decode($_POST["name"]);
     $userEmail = $_POST["email"];
     $userPasswordPlataform = "mude";
     if (!empty($roomCourse) && !empty($roomManager) && !empty($userName) && !empty($userEmail)) {
         /**
          * Routine that checks which the browser used
          * If an error occurs during the login, the system should return to the previous page
          * If the browser used is Firefox, the system must go back two pages
          * If is Chrome should back 1 page
          * TODO Test with Internet Explorer
          */
         $useragent = $_SERVER['HTTP_USER_AGENT'];
         if (preg_match('|Firefox/([0-9\\.]+)|', $useragent, $matched)) {
             $browser_version = $matched[1];
             $browser = 'Firefox';
             $numReturnPages = 2;
         } else {
             $numReturnPages = 1;
         }
         /**
          * Via rest, it checks if this tool (in this case the Whiteboard)
          * have permission to use information from the Core
          */
         $host = $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"];
         $pass = md5(date("d/m/Y") . $host);
         $server = "http://code.inf.poa.ifrs.edu.br/core/index.php/rest";
         $action = str_replace("%40", "@", $userEmail);
         $rest = new RESTClient();
         $rest->initialize(array('server' => $server, 'http_user' => $host, 'http_pass' => $pass));
         $granted = $rest->get($action);
         if ($granted == 1) {
             // Caso o usuário esteja cadastrado na Plataform
             // CHECKING USER IN WHITEBOARD
             $user = $this->dao->login($userEmail, $userPasswordPlataform);
             if (count($user) <= 0) {
                 // Not in database, create new user
                 if (!empty($userEmail) && !empty($userName)) {
                     // Instantiates a new user;
                     $user = new User();
                     $user->setName($userName);
                     $user->setEmail($userEmail);
                     $user->setPassword($userPasswordPlataform);
                     $user->setRoomcreator(0);
                     $resultUser = $this->dao->saveNewUser($user);
                     $user = $this->dao->login($userEmail, $userPasswordPlataform);
                 }
             }
             if ($user->getName() != $userName) {
                 // Upadate user;
                 $resultUser = $this->dao->updateUserName($user->getUserId(), $userName);
             }
             // User contained in the database, loggin
             $_SESSION['id'] = $user->getUserId();
             $_SESSION['name'] = $user->getName();
             $_SESSION['roomCreator'] = $user->getRoomcreator();
             $_SESSION['email'] = $user->getEmail();
             $_SESSION['user'] = $user;
             // Verifies and creates, if necessary, the room of course
             $roomPlataform = $this->dao->getRoomByCourse($roomCourse);
             if (count($roomPlataform) <= 0) {
                 $roomName = "Turma: " . $roomCourse;
                 if ($user->getEmail() == $roomManager) {
                     $managerId = $user->getUserId();
                 } else {
                     $manager = $this->dao->login($roomManager, $userPasswordPlataform);
                     if (count($manager) <= 0) {
                         // Not in database, create new user coordinator
                         $manager = new User();
                         $manager->setName("Professor " . $roomCourse);
                         $manager->setEmail($roomManager);
                         $manager->setPassword($userPasswordPlataform);
                         $manager->setRoomcreator(1);
                         $resultManager = $this->dao->saveNewUser($manager);
                         $manager = $this->dao->login($manager->getEmail(), $userPasswordPlataform);
                     }
                     $managerId = $manager->getUserId();
                 }
                 // Instantiates a new room;
                 $roomPlataform = new Room();
                 $roomPlataform->setName($roomName);
                 $roomPlataform->setUserId($managerId);
                 $roomPlataform->setActive(0);
                 $roomPlataform->setActiveProduction(0);
                 $roomPlataform->setCourse($roomCourse);
                 $resultRoom = $this->dao->saveNewRoom($roomPlataform);
                 $roomPlataform = $this->dao->getRoomByCourse($roomCourse);
                 // Set manager permission of room
                 $permission = new Permission();
                 $permission->setUserId($managerId);
                 $permission->setRoomId($roomPlataform->getRoomId());
                 $resultPermission = $this->dao->savePermission($permission);
             }
             // Checks permissions
//.........这里部分代码省略.........
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:101,代码来源:PlataformActions.php

示例15: execute

 public function execute($action)
 {
     $forwards = $action->getForwards();
     $msgs = Localization::getInstance();
     $message = $_POST['inviteFriendMessage'];
     $message = $message . "<br />" . $msgs->getText('inviteFriendForm.defaultMessage');
     $subject = $msgs->getText('inviteFriendForm.emailTitle');
     if (!empty($_POST['emailsSelecteds'])) {
         $listUsers = explode("-", $_POST['emailsSelecteds']);
         $code = md5($_POST[roomId]);
         $message = $message . "<br />" . $code;
         // Envio de email utilizando o PHPMailer
         unset($listUsers[0]);
         $mail = new PHPMailer();
         $mail->IsSMTP();
         $mail->IsHTML(true);
         //$mail->SMTPDebug= 2;
         $mail->Port = 25;
         $mail->Host = "nead.poa.ifrs.edu.br";
         //$mail->SMTPAuth = true;  // True caso use autentificação
         //$mail->Username = ''; // Usuário
         //$mail->Password = ''; // Senha
         //$mail->SMTPSecure = "ssl";
         $mail->Subject = $subject;
         $mail->From = "whiteboard@whiteboard.com";
         $mail->FromName = "WhiteBoard";
         foreach ($listUsers as $allowedUserEmail) {
             $mail->AddAddress($allowedUserEmail);
         }
         $mail->Body = $message;
         $mail->AltBody = $mail->Body;
         $enviado = $mail->Send();
         $mail->ClearAllRecipients();
         $mail->ClearAttachments();
         if ($enviado) {
             //echo "E-mail enviado com sucesso!";
         } else {
             echo "Não foi possível enviar o e-mail.<br /><br />";
             echo "<b>Informações do erro:</b> <br />" . $mail->ErrorInfo;
         }
     }
     $_SESSION['idRoomAux'] = $_POST[roomId];
     $this->pageController->run($forwards['success']);
 }
开发者ID:rodrigoprestesmachado,项目名称:whiteboard,代码行数:44,代码来源:CommonsActions.php


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