當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PMF_Utils::languageAvailable方法代碼示例

本文整理匯總了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;
開發者ID:nosch,項目名稱:phpMyFAQ,代碼行數:31,代碼來源:artikel.php

示例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('&nbsp;', $categoryTreeHelper->indent);
     $categoryLang = $categoryTreeHelper->getInnerIterator()->current()->getLanguage();
     if ($categoryLang == $LANGCODE) {
         print "</tr>\n";
         print "<tr>\n";
開發者ID:nosch,項目名稱:phpMyFAQ,代碼行數:31,代碼來源:category.showstructure.php

示例3: substr

            $_title = $faq->getRecordTitle($_id, false);
            $_link = substr($_url, 9);
            // Move the link to XHTML
            if (strpos($_url, '&amp;') === false) {
                $_link = str_replace('&', '&amp;', $_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;
開發者ID:rybal06,項目名稱:phpMyFAQ,代碼行數:31,代碼來源:artikel.php

示例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;
 }
開發者ID:jr-ewing,項目名稱:phpMyFAQ,代碼行數:18,代碼來源:Helper.php

示例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;
 }
開發者ID:atlcurling,項目名稱:tkt,代碼行數:22,代碼來源:Category.php


注:本文中的PMF_Utils::languageAvailable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。