本文整理汇总了PHP中PMF_Init::isASupportedLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Init::isASupportedLanguage方法的具体用法?PHP PMF_Init::isASupportedLanguage怎么用?PHP PMF_Init::isASupportedLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Init
的用法示例。
在下文中一共展示了PMF_Init::isASupportedLanguage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PMF_Init
// get language (default: english)
$pmf = new PMF_Init();
$LANGCODE = $pmf->setLanguage(isset($PMF_CONF['detection']) ? true : false, $PMF_CONF['language']);
if (isset($LANGCODE) && PMF_Init::isASupportedLanguage($LANGCODE)) {
require_once "lang/language_" . $LANGCODE . ".php";
} else {
$LANGCODE = "en";
require_once "lang/language_en.php";
}
if (isset($_GET['cat']) && is_numeric($_GET['cat']) == true) {
$currentCategory = $_REQUEST['cat'];
}
if (isset($_GET["id"]) && is_numeric($_GET["id"]) == true) {
$id = $_GET["id"];
}
if (isset($_GET["lang"]) && PMF_Init::isASupportedLanguage($_GET["lang"])) {
$lang = $_GET["lang"];
}
$result = $db->query("SELECT id, lang, solution_id, thema, content, datum, author FROM " . SQLPREFIX . "faqdata WHERE id = " . $id . " AND lang = '" . $lang . "' AND active = 'yes'");
if ($db->num_rows($result) > 0) {
while ($row = $db->fetch_object($result)) {
$lang = $row->lang;
$solution_id = $row->solution_id;
$thema = $row->thema;
$content = $row->content;
$date = $row->datum;
$author = $row->author;
}
} else {
print "Error!";
}
示例2: str_replace
}
}
// HACK: do not use pmf_lang cookie if we're saving the PMF Configuration
if (isset($_REQUEST['aktion']) && $_REQUEST['aktion'] == 'saveconfig') {
// Read the language file that is going to be saved in the PMF configuration
$PMF_CONF['language'] = $_REQUEST['edit']['language'];
// Force a POST "lang" key: PMF_Init class will rewrite the pmf_lang cookie
// according to the new value
$_POST['language'] = str_replace(array("language_", ".php"), "", $PMF_CONF['language']);
}
// get language (default: english)
$pmf = new PMF_Init();
$LANGCODE = $pmf->setLanguage(isset($PMF_CONF['detection']) ? true : false, $PMF_CONF['language']);
// Preload English strings
require_once '../lang/language_en.php';
if (isset($LANGCODE) && PMF_Init::isASupportedLanguage($LANGCODE)) {
// Overwrite English strings with the ones we have in the current language
require_once '../lang/language_' . $LANGCODE . '.php';
} else {
$LANGCODE = 'en';
}
// use mbstring extension if available
$valid_mb_strings = array('ja', 'en');
if (function_exists('mb_language') && in_array($PMF_LANG['metaLanguage'], $valid_mb_strings)) {
mb_language($PMF_LANG['metaLanguage']);
mb_internal_encoding($PMF_LANG['metaCharset']);
}
unset($auth);
// If the cookie is set, take the data from it
if (isset($_COOKIE['cuser']) && !preg_match('/^[a-z0-9]$/i', $_COOKIE['cuser'])) {
$user = $_COOKIE['cuser'];
示例3: generateNewestData
/**
* This function generates an array with a specified number of most recent published records
*
* @param string, int
* @return array
* @access public
* @author Robin Wood <robin@digininja.org>
* @since 2005-03-06
*/
function generateNewestData($language = '', $count = PMF_NUMBER_RECORDS_LATEST)
{
global $db, $sids, $PMF_LANG, $PMF_CONF;
$query = 'SELECT DISTINCT ' . SQLPREFIX . 'faqdata.id AS id, ' . SQLPREFIX . 'faqdata.lang AS lang, ' . SQLPREFIX . 'faqcategoryrelations.category_id AS category_id, ' . SQLPREFIX . 'faqdata.thema AS thema, ' . SQLPREFIX . 'faqdata.datum AS datum, ' . SQLPREFIX . 'faqvisits.visits AS visits FROM ' . SQLPREFIX . 'faqvisits, ' . SQLPREFIX . 'faqdata LEFT JOIN ' . SQLPREFIX . 'faqcategoryrelations ON ' . SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id AND ' . SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang WHERE ';
if (isset($language) && PMF_Init::isASupportedLanguage($language)) {
$query .= SQLPREFIX . 'faqdata.lang = \'' . $language . '\' AND ';
}
$query .= SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqvisits.id AND ' . SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqvisits.lang AND ' . SQLPREFIX . 'faqdata.active = \'yes\' ORDER BY ' . SQLPREFIX . 'faqdata.datum DESC';
$result = $db->query($query);
$newestArray = array();
$data = array();
$i = 0;
$oldId = 0;
while (($row = $db->fetch_object($result)) && $i < $count) {
if ($oldId != $row->id) {
$data['datum'] = $row->datum;
$data['thema'] = $row->thema;
$data['visits'] = $row->visits;
if (isset($PMF_CONF["mod_rewrite"]) && $PMF_CONF["mod_rewrite"] == "TRUE") {
$data['url'] = $row->category_id . "_" . $row->id . "_" . $row->lang . ".html";
} else {
$data['url'] = $_SERVER["PHP_SELF"] . "?" . $sids . "action=artikel&cat=" . $row->category_id . "&id=" . $row->id . "&artlang=" . $row->lang;
}
$newestArray[] = $data;
$i++;
}
$oldId = $row->id;
}
return $newestArray;
}
示例4: setLanguage
/**
* setLanguage()
*
* Sets the current language for phpMyFAQ user session
*
* @param bool $config_detection
* @param string $config_language
* @return string $language
* @access public
* @author Thorsten Rinne <rinne@mayflower.de>
* @author Matteo scaramuccia <matteo@scaramuccia.com>
*/
function setLanguage($config_detection, $config_language)
{
$_lang = array();
PMF_Init::getUserAgentLanguage();
// Get language from: _POST, _GET, _COOKIE, phpMyFAQ configuration and
// the automatic language detection
if (isset($_POST['language']) && PMF_Init::isASupportedLanguage($_POST['language'])) {
$_lang['post'] = $_POST['language'];
}
// Get the user language
if (isset($_GET['lang']) && PMF_Init::isASupportedLanguage($_GET['lang'])) {
$_lang['get'] = $_GET['lang'];
}
// Get the faq record language
if (isset($_GET['artlang']) && PMF_Init::isASupportedLanguage($_GET['artlang'])) {
$_lang['get'] = $_GET['artlang'];
}
// Get the language from the cookie
if (isset($_COOKIE['pmf_lang']) && PMF_Init::isASupportedLanguage($_COOKIE['pmf_lang'])) {
$_lang['cookie'] = $_COOKIE['pmf_lang'];
}
// Get the language from the config
if (isset($config_language)) {
$confLangCode = str_replace(array("language_", ".php"), "", $config_language);
if (PMF_Init::isASupportedLanguage($confLangCode)) {
$_lang['config'] = $confLangCode;
}
}
// Detect the browser's language
if (true === $config_detection && PMF_Init::isASupportedLanguage($this->acceptedLanguage)) {
$_lang['detection'] = $this->acceptedLanguage;
}
// Select the language
if (isset($_lang['post'])) {
$this->language = $_lang['post'];
unset($_lang);
setcookie('pmf_lang', $this->language, time() + 3600);
} elseif (isset($_lang['get'])) {
$this->language = $_lang['get'];
} elseif (isset($_lang['cookie'])) {
$this->language = $_lang['cookie'];
unset($_lang);
} elseif (isset($_lang['config'])) {
$this->language = $_lang['config'];
unset($_lang);
setcookie('pmf_lang', $this->language, time() + 3600);
} elseif (isset($_lang['detection'])) {
$this->language = $_lang['detection'];
unset($_lang);
setcookie('pmf_lang', $this->language, time() + 3600);
} else {
$this->language = 'en';
// just a fallback
}
return $this->language;
}
示例5: elseif
} elseif (isset($_GET['sid']) || isset($_COOKIE['pmf_sid'])) {
if (!isset($_COOKIE['pmf_sid'])) {
$sids = 'sid=' . (int) $_GET['sid'] . '&lang=' . $LANGCODE . '&';
} else {
$sids = '';
}
}
} else {
if (!setcookie('pmf_lang', $LANGCODE, time() + 3600)) {
$sids = 'lang=' . $LANGCODE . '&';
} else {
$sids = '';
}
}
// found a article language?
if (isset($_POST["artlang"]) && PMF_Init::isASupportedLanguage($_POST["artlang"])) {
$lang = $_POST["artlang"];
} else {
$lang = $LANGCODE;
}
// found a record ID?
if (isset($_REQUEST['id']) && is_numeric($_REQUEST['id']) === true) {
$id = $_REQUEST['id'];
$title = ' - ' . stripslashes(getThema($id, $lang));
$keywords = ' ' . stripslashes(getKeywords($id, $lang));
} else {
$id = '';
//$title = ' - powered by phpMyFAQ '.$PMF_CONF['version'];
$keywords = '';
}
// found a solution ID?