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


PHP PMF_Language::languageOptions方法代码示例

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


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

示例1: renderInputForm

/**
 * @param mixed $key
 * @param string $type
 *
 * @return void
 */
function renderInputForm($key, $type)
{
    global $PMF_LANG, $faqConfig;
    switch ($type) {
        case 'area':
            printf('<textarea name="edit[%s]" rows="4" class="form-control">%s</textarea>', $key, str_replace('<', '&lt;', str_replace('>', '&gt;', $faqConfig->get($key))));
            printf("</div>\n");
            break;
        case 'input':
            if ('' == $faqConfig->get($key) && 'socialnetworks.twitterAccessTokenKey' == $key && isset($_SESSION['access_token'])) {
                $value = $_SESSION['access_token']['oauth_token'];
            } elseif ('' == $faqConfig->get($key) && 'socialnetworks.twitterAccessTokenSecret' == $key && isset($_SESSION['access_token'])) {
                $value = $_SESSION['access_token']['oauth_token_secret'];
            } else {
                $value = str_replace('"', '&quot;', $faqConfig->get($key));
            }
            printf('<input class="form-control" type="%s" name="edit[%s]" value="%s" step="1" min="0">', is_numeric($value) ? 'number' : 'text', $key, $value);
            echo "</div>\n";
            break;
        case 'select':
            printf('<select name="edit[%s]" size="1" class="form-control">', $key);
            switch ($key) {
                case 'main.language':
                    $languages = PMF_Language::getAvailableLanguages();
                    if (count($languages) > 0) {
                        echo PMF_Language::languageOptions(str_replace(array('language_', '.php'), '', $faqConfig->get('main.language')), false, true);
                    } else {
                        echo '<option value="language_en.php">English</option>';
                    }
                    break;
                case 'records.orderby':
                    echo PMF_Configuration::sortingOptions($faqConfig->get($key));
                    break;
                case 'records.sortby':
                    printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['ad_conf_desc']);
                    printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['ad_conf_asc']);
                    break;
                case 'security.permLevel':
                    echo PMF_Perm::permOptions($faqConfig->get($key));
                    break;
                case 'main.templateSet':
                    $faqSystem = new PMF_System();
                    $templates = $faqSystem->getAvailableTemplates();
                    foreach ($templates as $template => $selected) {
                        printf("<option%s>%s</option>", $selected === true ? ' selected' : '', $template);
                    }
                    break;
                case "records.attachmentsStorageType":
                    foreach ($PMF_LANG['att_storage_type'] as $i => $item) {
                        $selected = $faqConfig->get($key) == $i ? ' selected' : '';
                        printf('<option value="%d"%s>%s</option>', $i, $selected, $item);
                    }
                    break;
                case "records.orderingPopularFaqs":
                    printf('<option value="visits"%s>%s</option>', 'visits' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['records.orderingPopularFaqs.visits']);
                    printf('<option value="voting"%s>%s</option>', 'voting' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['records.orderingPopularFaqs.voting']);
                    break;
                case "search.relevance":
                    printf('<option value="thema,content,keywords"%s>%s</option>', 'thema,content,keywords' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.thema-content-keywords']);
                    printf('<option value="thema,keywords,content"%s>%s</option>', 'thema,keywords,content' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.thema-keywords-content']);
                    printf('<option value="content,thema,keywords"%s>%s</option>', 'content,thema,keywords' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.content-thema-keywords']);
                    printf('<option value="content,keywords,thema"%s>%s</option>', 'content,keywords,thema' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.content-keywords-thema']);
                    printf('<option value="keywords,content,thema"%s>%s</option>', 'keywords,content,thema' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.keywords-content-thema']);
                    printf('<option value="keywords,thema,content"%s>%s</option>', 'keywords,thema,content' == $faqConfig->get($key) ? ' selected' : '', $PMF_LANG['search.relevance.keywords-thema-content']);
                    break;
            }
            echo "</select>\n</div>\n";
            break;
        case 'checkbox':
            printf('<div class="checkbox"><input type="checkbox" name="edit[%s]" value="true"', $key);
            if ($faqConfig->get($key)) {
                echo ' checked';
            }
            if ('security.ldapSupport' === $key && !extension_loaded('ldap')) {
                echo ' disabled';
            }
            if ('security.useSslOnly' === $key && empty($_SERVER['HTTPS'])) {
                echo ' disabled';
            }
            if ('security.ssoSupport' === $key && empty($_SERVER['REMOTE_USER'])) {
                echo ' disabled';
            }
            echo ">\n</div></div>\n";
            break;
        case 'print':
            printf('<input type="text" readonly name="edit[%s]" class="form-control" value="%s"></div>', $key, str_replace('"', '&quot;', $faqConfig->get($key)), $faqConfig->get($key));
            break;
    }
}
开发者ID:ae120,项目名称:phpMyFAQ,代码行数:95,代码来源:ajax.config_list.php

示例2: printInputFieldByType

function printInputFieldByType($key, $type)
{
    global $PMF_LANG;
    $faqconfig = PMF_Configuration::getInstance();
    switch ($type) {
        case 'area':
            printf('<textarea name="edit[%s]" cols="60" rows="6" style="width: 500px;">%s</textarea>', $key, str_replace('<', '&lt;', str_replace('>', '&gt;', $faqconfig->get($key))));
            printf("<br />\n");
            break;
        case 'input':
            printf('<input type="text" name="edit[%s]" size="75" value="%s" style="width: 500px;" />', $key, str_replace('"', '&quot;', $faqconfig->get($key)));
            printf("<br />\n");
            break;
        case 'select':
            printf('<select name="edit[%s]" size="1" style="width: 500px;">', $key);
            switch ($key) {
                case 'main.language':
                    $languages = PMF_Language::getAvailableLanguages();
                    if (count($languages) > 0) {
                        print PMF_Language::languageOptions(str_replace(array("language_", ".php"), "", $faqconfig->get('main.language')), false, true);
                    } else {
                        print '<option value="language_en.php">English</option>';
                    }
                    break;
                case 'records.orderby':
                    print sortingOptions($faqconfig->get($key));
                    break;
                case 'records.sortby':
                    printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_desc']);
                    printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_asc']);
                    break;
                case 'main.permLevel':
                    print PMF_Perm::permOptions($faqconfig->get($key));
                    break;
                case "main.templateSet":
                    /**
                     * TODO: do get availiable template sets in the PMF_Template
                     */
                    foreach (new DirectoryIterator('../template') as $item) {
                        if (!$item->isDot() && $item->isDir()) {
                            $selected = PMF_Template::getTplSetName() == $item ? ' selected="selected"' : '';
                            printf("<option%s>%s</option>", $selected, $item);
                        }
                    }
                    break;
                case "main.attachmentsStorageType":
                    foreach ($PMF_LANG['att_storage_type'] as $i => $item) {
                        $selected = $faqconfig->get($key) == $i ? ' selected="selected"' : '';
                        printf('<option value="%d"%s>%s</option>', $i, $selected, $item);
                    }
                    break;
            }
            print "</select>\n<br />\n";
            break;
        case 'checkbox':
            printf('<input type="checkbox" name="edit[%s]" value="true"', $key);
            if ($faqconfig->get($key)) {
                print ' checked="checked"';
            }
            print " /><br />\n";
            break;
        case 'print':
            printf('<input type="hidden" name="edit[%s]" size="80" value="%s" />%s<br />', $key, str_replace('"', '&quot;', $faqconfig->get($key)), $faqconfig->get($key));
            break;
    }
}
开发者ID:noon,项目名称:phpMyFAQ,代码行数:66,代码来源:ajax.config_list.php

示例3: printInputFieldByType

/**
 * @param  $key
 * @param  $type
 * @return void
 */
function printInputFieldByType($key, $type)
{
    global $PMF_LANG;
    $faqconfig = PMF_Configuration::getInstance();
    switch ($type) {
        case 'area':
            printf('<textarea name="edit[%s]" cols="60" rows="6" style="width: 300px;">%s</textarea>', $key, str_replace('<', '&lt;', str_replace('>', '&gt;', $faqconfig->get($key))));
            printf("</p>\n");
            break;
        case 'input':
            if ('' == $faqconfig->get($key) && 'socialnetworks.twitterAccessTokenKey' == $key) {
                $value = $_SESSION['access_token']['oauth_token'];
            } elseif ('' == $faqconfig->get($key) && 'socialnetworks.twitterAccessTokenSecret' == $key) {
                $value = $_SESSION['access_token']['oauth_token_secret'];
            } else {
                $value = str_replace('"', '&quot;', $faqconfig->get($key));
            }
            printf('<input type="text" name="edit[%s]" size="75" value="%s" style="width: 300px;" />', $key, $value);
            printf("</p>\n");
            break;
        case 'select':
            printf('<select name="edit[%s]" size="1" style="width: 300px;">', $key);
            switch ($key) {
                case 'main.language':
                    $languages = PMF_Language::getAvailableLanguages();
                    if (count($languages) > 0) {
                        print PMF_Language::languageOptions(str_replace(array('language_', '.php'), '', $faqconfig->get('main.language')), false, true);
                    } else {
                        print '<option value="language_en.php">English</option>';
                    }
                    break;
                case 'records.orderby':
                    print sortingOptions($faqconfig->get($key));
                    break;
                case 'records.sortby':
                    printf('<option value="DESC"%s>%s</option>', 'DESC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_desc']);
                    printf('<option value="ASC"%s>%s</option>', 'ASC' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['ad_conf_asc']);
                    break;
                case 'security.permLevel':
                    print PMF_Perm::permOptions($faqconfig->get($key));
                    break;
                case "main.templateSet":
                    /**
                     * TODO: do get available template sets in the PMF_Template
                     */
                    foreach (new DirectoryIterator('../template') as $item) {
                        if (!$item->isDot() && $item->isDir()) {
                            $selected = PMF_Template::getTplSetName() == $item ? ' selected="selected"' : '';
                            printf("<option%s>%s</option>", $selected, $item);
                        }
                    }
                    break;
                case "records.attachmentsStorageType":
                    foreach ($PMF_LANG['att_storage_type'] as $i => $item) {
                        $selected = $faqconfig->get($key) == $i ? ' selected="selected"' : '';
                        printf('<option value="%d"%s>%s</option>', $i, $selected, $item);
                    }
                    break;
                case "records.orderingPopularFaqs":
                    printf('<option value="visits"%s>%s</option>', 'visits' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['records.orderingPopularFaqs.visits']);
                    printf('<option value="voting"%s>%s</option>', 'voting' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['records.orderingPopularFaqs.voting']);
                    break;
                case "search.relevance":
                    printf('<option value="thema,content,keywords"%s>%s</option>', 'thema,content,keywords' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.thema-content-keywords']);
                    printf('<option value="thema,keywords,content"%s>%s</option>', 'thema,keywords,content' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.thema-keywords-content']);
                    printf('<option value="content,thema,keywords"%s>%s</option>', 'content,thema,keywords' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.content-thema-keywords']);
                    printf('<option value="content,keywords,thema"%s>%s</option>', 'content,keywords,thema' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.content-keywords-thema']);
                    printf('<option value="keywords,content,thema"%s>%s</option>', 'keywords,content,thema' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.keywords-content-thema']);
                    printf('<option value="keywords,thema,content"%s>%s</option>', 'keywords,thema,content' == $faqconfig->get($key) ? ' selected="selected"' : '', $PMF_LANG['search.relevance.keywords-thema-content']);
                    break;
            }
            print "</select>\n</p>\n";
            break;
        case 'checkbox':
            printf('<input type="checkbox" name="edit[%s]" value="true"', $key);
            if ($faqconfig->get($key)) {
                print ' checked="checked"';
            }
            print " /></p>\n";
            break;
        case 'print':
            printf('<input type="hidden" name="edit[%s]" size="80" value="%s" />%s</p>', $key, str_replace('"', '&quot;', $faqconfig->get($key)), $faqconfig->get($key));
            break;
    }
}
开发者ID:atlcurling,项目名称:tkt,代码行数:90,代码来源:ajax.config_list.php


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