本文整理汇总了PHP中PMF_Utils::languageAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP PMF_Utils::languageAvailable方法的具体用法?PHP PMF_Utils::languageAvailable怎么用?PHP PMF_Utils::languageAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMF_Utils
的用法示例。
在下文中一共展示了PMF_Utils::languageAvailable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
$_title = $faq->getRecordTitle($_id, false);
$_link = substr($_url, 9);
// Move the link to XHTML
if (strpos($_url, '&') === false) {
$_link = str_replace('&', '&', $_link);
}
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . $_link);
$oLink->itemTitle = $oLink->tooltip = $_title;
$newFaqPath = $oLink->toString();
$fixedContent = str_replace($_url, $newFaqPath, $fixedContent);
}
}
}
$content = $fixedContent;
// Check for the languages for a faq
$arrLanguage = PMF_Utils::languageAvailable($record_id);
$switchLanguage = '';
$check4Lang = '';
$num = count($arrLanguage);
if ($num > 1) {
foreach ($arrLanguage as $language) {
$check4Lang .= "<option value=\"" . $language . "\"";
$check4Lang .= $lang == $language ? ' selected="selected"' : '';
$check4Lang .= ">" . $languageCodes[strtoupper($language)] . "</option>\n";
}
$switchLanguage .= "<p>\n";
$switchLanguage .= "<fieldset>\n";
$switchLanguage .= "<legend>" . $PMF_LANG["msgLangaugeSubmit"] . "</legend>\n";
$switchLanguage .= "<form action=\"" . $changeLanguagePath . "\" method=\"post\" style=\"display: inline;\">\n";
$switchLanguage .= "<select name=\"language\" size=\"1\">\n";
$switchLanguage .= $check4Lang;
示例2: array
$showcat = PMF_Filter::filterInput(INPUT_POST, 'showcat', FILTER_SANITIZE_STRING);
// translate an existing category
if (!is_null($showcat) && $showcat == 'yes') {
$categoryData = array('id' => PMF_Filter::filterInput(INPUT_POST, 'id', FILTER_VALIDATE_INT), 'lang' => PMF_Filter::filterInput(INPUT_POST, 'lang', FILTER_SANITIZE_STRING), 'parent_id' => PMF_Filter::filterInput(INPUT_POST, 'parent_id', FILTER_VALIDATE_INT), 'name' => PMF_Filter::filterInput(INPUT_POST, 'name', FILTER_SANITIZE_STRING), 'description' => PMF_Filter::filterInput(INPUT_POST, 'description', FILTER_SANITIZE_STRING), 'user_id' => PMF_Filter::filterInput(INPUT_POST, 'user_id', FILTER_VALIDATE_INT));
// translate.category only returns non-existent languages to translate too
if ($categoryNode->create($categoryData)) {
printf('<p>%s</p>', $PMF_LANG['ad_categ_translated']);
} else {
printf('<p>%s</p>', $db->error());
}
}
print "\n\n<table>\n";
print "<tr>\n";
print " <th>" . $currentLanguage . "</th>\n";
// get languages in use for all categories
$allLanguages = PMF_Utils::languageAvailable(0, $table = 'faqcategories');
asort($allLanguages);
foreach ($allLanguages as $language) {
if ($languageCodes[strtoupper($language)] != $currentLanguage) {
print " <th>" . $languageCodes[strtoupper($language)] . "</th>\n";
}
}
$categoryDataProvider = new PMF_Category_Tree_DataProvider_SingleQuery();
$categoryTreeHelper = new PMF_Category_Tree_Helper(new PMF_Category_Tree($categoryDataProvider));
$categoryHelper = new PMF_Category_Helper();
foreach ($categoryTreeHelper as $categoryId => $categoryName) {
$indent = str_repeat(' ', $categoryTreeHelper->indent);
$categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage();
if ($categoryLang == $LANGCODE) {
print "</tr>\n";
print "<tr>\n";
示例3: substr
$_title = $faq->getRecordTitle($_id, false);
$_link = substr($_url, 9);
// Move the link to XHTML
if (strpos($_url, '&') === false) {
$_link = str_replace('&', '&', $_link);
}
$oLink = new PMF_Link(PMF_Link::getSystemRelativeUri() . $_link);
$oLink->itemTitle = $oLink->tooltip = $_title;
$newFaqPath = $oLink->toString();
$fixedContent = str_replace($_url, $newFaqPath, $fixedContent);
}
}
}
$content = $fixedContent;
// Check for the languages for a faq
$arrLanguage = PMF_Utils::languageAvailable($faq->faqRecord['id']);
$switchLanguage = '';
$check4Lang = '';
$num = count($arrLanguage);
if ($num > 1) {
foreach ($arrLanguage as $language) {
$check4Lang .= "<option value=\"" . $language . "\"";
$check4Lang .= $lang == $language ? ' selected="selected"' : '';
$check4Lang .= ">" . $languageCodes[strtoupper($language)] . "</option>\n";
}
$switchLanguage .= "<p>\n";
$switchLanguage .= "<fieldset>\n";
$switchLanguage .= "<legend>" . $PMF_LANG["msgLangaugeSubmit"] . "</legend>\n";
$switchLanguage .= "<form action=\"" . $changeLanguagePath . "\" method=\"post\" style=\"display: inline;\">\n";
$switchLanguage .= "<select name=\"artlang\" size=\"1\">\n";
$switchLanguage .= $check4Lang;
示例4: renderLanguages
/**
* Create all languagess which can be used for translation as <option>
*
* @param integer $categoryId Category id
* @param string $selectedLanguage Selected language
* @return string
*/
public function renderLanguages($categoryId, $selectedLanguage)
{
$existingLanguages = PMF_Utils::languageAvailable($categoryId, 'faqcategories');
$options = '';
foreach (PMF_Language::getAvailableLanguages() as $lang => $langname) {
if (!in_array(strtolower($lang), $existingLanguages)) {
$options .= sprintf("\t<option value=\"%s\"%s>%s</option>\n", strtolower($lang), $lang == $selectedLanguage ? ' selected="selected"' : '', $langname);
}
}
return $options;
}
示例5: getCategoryLanguagesToTranslate
/**
* Create all languagess which can be used for translation as <option>
*
* @param integer $category_id Category id
* @param string $selected_lang Selected language
* @return string
*/
public function getCategoryLanguagesToTranslate($category_id, $selected_lang)
{
$output = "";
$existcatlang = PMF_Utils::languageAvailable($category_id, 'faqcategories');
foreach (PMF_Language::getAvailableLanguages() as $lang => $langname) {
if (!in_array(strtolower($lang), $existcatlang)) {
$output .= "\t<option value=\"" . strtolower($lang) . "\"";
if ($lang == $selected_lang) {
$output .= " selected=\"selected\"";
}
$output .= ">" . $langname . "</option>\n";
}
}
return $output;
}