本文整理汇总了PHP中PMF_Language::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Language::setLanguage方法的具体用法?PHP PMF_Language::setLanguage怎么用?PHP PMF_Language::setLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Language
的用法示例。
在下文中一共展示了PMF_Language::setLanguage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
session_name(PMF_COOKIE_NAME_AUTH . trim($faqconfig->get('main.phpMyFAQToken')));
session_start();
// Send headers
$http = PMF_Helper_Http::getInstance();
$http->setContentType('application/json');
$http->addHeader();
// Set user permissions
$current_user = -1;
$current_groups = array(-1);
$action = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
$language = PMF_Filter::filterInput(INPUT_GET, 'lang', FILTER_SANITIZE_STRING, 'en');
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'categoryId', FILTER_VALIDATE_INT);
$recordId = PMF_Filter::filterInput(INPUT_GET, 'recordId', FILTER_VALIDATE_INT);
// Get language (default: english)
$Language = new PMF_Language();
$language = $Language->setLanguage($faqconfig->get('main.languageDetection'), $faqconfig->get('main.language'));
// Set language
if (PMF_Language::isASupportedLanguage($language)) {
require 'lang/language_' . $language . '.php';
} else {
require 'lang/language_en.php';
}
$plr = new PMF_Language_Plurals($PMF_LANG);
PMF_String::init($language);
// Set empty result
$result = array();
// Handle actions
switch ($action) {
case 'getVersion':
$result = array('version' => $faqconfig->get('main.currentVersion'));
break;
示例2: unset
// Define the named constant used as a check by any included PHP file
//
define('IS_VALID_PHPMYFAQ', null);
//
// Bootstrapping
//
require PMF_ROOT_DIR . '/inc/Bootstrap.php';
/**
* Initialize attachment factory
*/
PMF_Attachment_Factory::init($faqConfig->get('records.attachmentsStorageType'), $faqConfig->get('records.defaultAttachmentEncKey'), $faqConfig->get('records.enableAttachmentEncryption'));
$currentSave = PMF_Filter::filterInput(INPUT_POST, 'save', FILTER_SANITIZE_STRING);
$currentAction = PMF_Filter::filterInput(INPUT_GET, 'action', FILTER_SANITIZE_STRING);
$currentToken = PMF_Filter::filterInput(INPUT_POST, 'csrf', FILTER_SANITIZE_STRING);
$Language = new PMF_Language($faqConfig);
$LANGCODE = $Language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language'));
require_once PMF_ROOT_DIR . '/lang/language_en.php';
if (isset($LANGCODE) && PMF_Language::isASupportedLanguage($LANGCODE)) {
require_once PMF_ROOT_DIR . '/lang/language_' . $LANGCODE . '.php';
} else {
$LANGCODE = 'en';
}
$auth = false;
$user = PMF_User_CurrentUser::getFromSession($faqConfig);
if ($user) {
$auth = true;
} else {
$error = $PMF_LANG['ad_auth_sess'];
$user = null;
unset($user);
}
示例3: trim
* @copyright 2007-2014 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2007-03-27
*/
use Symfony\Component\HttpFoundation\Response;
define('IS_VALID_PHPMYFAQ', null);
//
// Prepend and start the PHP session
//
require 'inc/Bootstrap.php';
$searchString = PMF_Filter::filterInput(INPUT_POST, 'search', FILTER_SANITIZE_STRIPPED);
$ajaxLanguage = PMF_Filter::filterInput(INPUT_POST, 'ajaxlanguage', FILTER_SANITIZE_STRING, 'en');
$categoryId = PMF_Filter::filterInput(INPUT_GET, 'searchcategory', FILTER_VALIDATE_INT, '%');
$language = new PMF_Language($faqConfig);
$languageCode = $language->setLanguage($faqConfig->get('main.languageDetection'), $faqConfig->get('main.language'));
$faqConfig->setLanguage($language);
require_once 'lang/language_en.php';
if (PMF_Language::isASupportedLanguage($ajaxLanguage)) {
$languageCode = trim($ajaxLanguage);
require_once 'lang/language_' . $languageCode . '.php';
} else {
$languageCode = 'en';
require_once 'lang/language_en.php';
}
//Load plurals support for selected language
$plr = new PMF_Language_Plurals($PMF_LANG);
//
// Initalizing static string wrapper
//
PMF_String::init($languageCode);