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


PHP qtranxf_endsWith函數代碼示例

本文整理匯總了PHP中qtranxf_endsWith函數的典型用法代碼示例。如果您正苦於以下問題:PHP qtranxf_endsWith函數的具體用法?PHP qtranxf_endsWith怎麽用?PHP qtranxf_endsWith使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了qtranxf_endsWith函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: qtranxf_find_plugin_config_files

function qtranxf_find_plugin_config_files(&$fn_bnm, &$fn_qtx, $bnm)
{
    $plugins = wp_get_active_and_valid_plugins();
    $fn_bnm = null;
    if (!qtranxf_find_plugin_by_foder($bnm . '-qtranslate-x', $plugins)) {
        $fn_bnm = qtranxf_find_plugin_file($bnm . '/i18n-config.json');
        while (!$fn_bnm) {
            $fn_bnm = qtranxf_plugin_dirname() . '/i18n-config/plugins/' . $bnm . '/i18n-config.json';
            $fn_bnm = qtranxf_find_plugin_file($fn_bnm);
            if ($fn_bnm) {
                break;
            }
            $fn_bnm = qtranxf_plugin_dirname() . '/i18n-config/themes/' . $bnm . '/i18n-config.json';
            $fn_bnm = qtranxf_find_plugin_file($fn_bnm);
            break;
        }
    }
    $fn_qtx = null;
    while (qtranxf_endsWith($bnm, '-qtranslate-x')) {
        $bnm_qtx = substr($bnm, 0, -13);
        $plugins = wp_get_active_and_valid_plugins();
        $fn_qtx = qtranxf_plugin_dirname() . '/i18n-config/plugins/' . $bnm_qtx . '/i18n-config.json';
        $fn_qtx = qtranxf_find_plugin_file($fn_qtx);
        if ($fn_qtx) {
            break;
        }
        $fn_qtx = qtranxf_plugin_dirname() . '/i18n-config/themes/' . $bnm_qtx . '/i18n-config.json';
        $fn_qtx = qtranxf_find_plugin_file($fn_qtx);
        break;
    }
    return $fn_bnm || $fn_qtx;
}
開發者ID:danmilon,項目名稱:donation-box,代碼行數:32,代碼來源:qtx_activation_hook.php

示例2: qtranxf_external_host_ex

function qtranxf_external_host_ex($host, $homeinfo)
{
    global $q_config;
    //$homehost = qtranxf_get_home_info()['host'];
    switch ($q_config['url_mode']) {
        case QTX_URL_QUERY:
        case QTX_URL_PATH:
            return $homeinfo['host'] != $host;
        case QTX_URL_DOMAIN:
            return !qtranxf_endsWith($host, $homeinfo['host']);
        case QTX_URL_DOMAINS:
            foreach ($q_config['domains'] as $lang => $h) {
                if ($h == $host) {
                    return false;
                }
            }
            if ($homeinfo['host'] == $host) {
                return false;
            }
        default:
            return true;
    }
}
開發者ID:antigenius,項目名稱:qtranslate-x,代碼行數:23,代碼來源:qtranslate_utils.php

示例3: qtranxf_conf

function qtranxf_conf()
{
    global $q_config, $wpdb;
    //qtranxf_dbg_log('qtranxf_conf: POST: ',$_POST);
    // do redirection for dashboard
    if (isset($_GET['godashboard'])) {
        echo '<h2>' . __('Switching Language', 'qtranslate') . '</h2>' . sprintf(__('Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.', 'qtranslate'), $q_config['language_name'][qtranxf_getLanguage()], admin_url()) . '<script type="text/javascript">document.location="' . admin_url() . '";</script>';
        exit;
    }
    // init some needed variables
    $error = '';
    $original_lang = '';
    $language_code = '';
    $language_name = '';
    $language_locale = '';
    $language_date_format = '';
    $language_time_format = '';
    $language_na_message = '';
    $language_flag = '';
    $language_default = '';
    $altered_table = false;
    $message = apply_filters('qtranslate_configuration_pre', array());
    // check for action
    if (isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
        $message[] = __('qTranslate has been reset.', 'qtranslate');
    } elseif (isset($_POST['default_language'])) {
        qtranxf_updateSettings();
        //execute actions
        if (isset($_POST['update_mo_now']) && $_POST['update_mo_now'] == '1') {
            $result = qtranxf_updateGettextDatabases(true);
            if ($result === true) {
                $message[] = __('Gettext databases updated.', 'qtranslate');
            } elseif (is_wp_error($result)) {
                $message[] = __('Gettext databases <strong>not</strong> updated:', 'qtranslate') . ' ' . $result->get_error_message();
            }
        }
        foreach ($_POST as $key => $value) {
            if (!is_string($value)) {
                continue;
            }
            if (!qtranxf_endsWith($key, '-migration')) {
                continue;
            }
            $plugin = substr($key, 0, -strlen('-migration'));
            if ($value == 'import') {
                $nm = '<span style="color:blue"><strong>' . qtranxf_get_plugin_name($plugin) . '</strong></span>';
                $message[] = sprintf(__('Applicable options and taxonomy names from plugin %s have been imported. Note that the multilingual content of posts, pages and other objects has not been altered during this operation. There is no additional operation needed to import content, since its format is compatible with %s.', 'qtranslate'), $nm, 'qTranslate&#8209;X') . ' ' . sprintf(__('It might be a good idea to review %smigration instructions%s, if you have not yet done so.', 'qtranslate'), '<a href="https://qtranslatexteam.wordpress.com/2015/02/24/migration-from-other-multilingual-plugins/" target="_blank">', '</a>');
                $message[] = sprintf(__('%sImportant%s: Before you start making edits to post and pages, please, make sure that both, your front site and admin back-end, work under this configuration. It may help to review "%s" and see if any of conflicting plugins mentioned there are used here. While the current content, coming from %s, is compatible with this plugin, the newly modified posts and pages will be saved with a new square-bracket-only encoding, which has a number of advantages comparing to former %s encoding. However, the new encoding is not straightforwardly compatible with %s and you will need an additional step available under "%s" option if you ever decide to go back to %s. Even with this additional conversion step, the 3rd-party plugins custom-stored data will not be auto-converted, but manual editing will still work. That is why it is advisable to create a test-copy of your site before making any further changes. In case you encounter a problem, please give us a chance to improve %s, send the login information to the test-copy of your site to %s along with a detailed step-by-step description of what is not working, and continue using your main site with %s meanwhile. It would also help, if you share a success story as well, either on %sthe forum%s, or via the same e-mail as mentioned above. Thank you very much for trying %s.', 'qtranslate'), '<span style="color:red">', '</span>', '<a href="https://wordpress.org/plugins/qtranslate-x/other_notes/" target="_blank">' . 'Known Issues' . '</a>', $nm, 'qTranslate', $nm, '<span style="color:magenta">' . __('Convert Database', 'qtranslate') . '</span>', $nm, 'qTranslate&#8209;X', '<a href="mailto:qtranslateteam@gmail.com">qtranslateteam@gmail.com</a>', $nm, '<a href="https://wordpress.org/support/plugin/qtranslate-x">', '</a>', 'qTranslate&#8209;X') . '<br/><small>' . __('This is a one-time message, which you will not see again, unless the same import is repeated.', 'qtranslate') . '</small>';
                if ($plugin == 'mqtranslate') {
                    $message[] = sprintf(__('Option "%s" has also been turned on, as the most common case for importing configuration from %s. You may turn it off manually if your setup does not require it. Refer to %sFAQ%s for more information.', 'qtranslate'), '<span style="color:magenta">' . __('Compatibility Functions', 'qtranslate') . '</span>', $nm, '<a href="https://wordpress.org/plugins/qtranslate-x/faq/" target="_blank">', '</a>');
                }
            } elseif ($value == 'export') {
                $nm = '<span style="color:blue"><strong>' . qtranxf_get_plugin_name($plugin) . '</strong></span>';
                $message[] = sprintf(__('Applicable options have been exported to plugin %s. If you have done some post or page updates after migrating from %s, then "%s" operation is also required to convert the content to "dual language tag" style in order for plugin %s to function.', 'qtranslate'), $nm, $nm, '<span style="color:magenta">' . __('Convert Database', 'qtranslate') . '</span>', $nm);
            }
        }
        if (isset($_POST['convert_database'])) {
            $msg = qtranxf_convert_database($_POST['convert_database']);
            if ($msg) {
                $message[] = $msg;
            }
        }
    }
    if (isset($_POST['original_lang'])) {
        // validate form input
        $lang = sanitize_text_field($_POST['language_code']);
        if ($_POST['language_na_message'] == '') {
            $error = __('The Language must have a Not-Available Message!', 'qtranslate');
        }
        if (strlen($_POST['language_locale']) < 2) {
            $error = __('The Language must have a Locale!', 'qtranslate');
        }
        if ($_POST['language_name'] == '') {
            $error = __('The Language must have a name!', 'qtranslate');
        }
        if (strlen($lang) != 2) {
            $error = __('Language Code has to be 2 characters long!', 'qtranslate');
        }
        //$lang = strtolower($lang);
        //$language_names = qtranxf_language_configured('language_name');
        $langs = array();
        qtranxf_load_languages($langs);
        $language_names = $langs['language_name'];
        if ($_POST['original_lang'] == '' && $error == '') {
            // new language
            if (isset($language_names[$lang])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            }
        }
        if ($_POST['original_lang'] != '' && $error == '') {
            // language update
            if ($lang != $_POST['original_lang'] && isset($language_names[$lang])) {
                $error = __('There is already a language with the same Language Code!', 'qtranslate');
            } else {
                if ($lang != $_POST['original_lang']) {
                    // remove old language
                    qtranxf_unsetLanguage($langs, $_POST['original_lang']);
                    qtranxf_unsetLanguage($q_config, $_POST['original_lang']);
                }
                if (in_array($_POST['original_lang'], $q_config['enabled_languages'])) {
//.........這裏部分代碼省略.........
開發者ID:ycms,項目名稱:framework,代碼行數:101,代碼來源:qtx_configuration.php

示例4: qtranxf_fetch_file_selection

function qtranxf_fetch_file_selection($dir, $suffix = '.css')
{
    //qtranxf_dbg_log('qtranxf_fetch_file_selection: dir:',$dir);
    $files = array();
    $dir_handle = @opendir($dir);
    if (!$dir_handle) {
        return false;
    }
    while (false !== ($file = readdir($dir_handle))) {
        if (!qtranxf_endsWith($file, $suffix)) {
            continue;
        }
        $nm = basename($file, $suffix);
        if (!$nm) {
            continue;
        }
        $nm = str_replace('_', ' ', $nm);
        if (qtranxf_endsWith($nm, '.min')) {
            $nm = substr($nm, -4);
            $files[$nm] = $file;
        } elseif (!isset($files[$nm])) {
            $files[$nm] = $file;
        }
    }
    ksort($files);
    //qtranxf_dbg_log('qtranxf_fetch_file_selection: files:',$files);
    return $files;
}
開發者ID:ycms,項目名稱:framework,代碼行數:28,代碼來源:qtx_admin_utils.php

示例5: qtranxf_migrate_plugins

function qtranxf_migrate_plugins()
{
    if (!current_user_can('manage_options')) {
        return;
    }
    //qtranxf_migrate_plugin('mqtranslate');
    //qtranxf_migrate_plugin('qtranslate-xp');
    ////qtranxf_migrate_plugin('ztranslate');//ok same db
    ////do_action('qtranslate_migrate_plugins');
    foreach ($_POST as $key => $value) {
        if (!is_string($value)) {
            continue;
        }
        if ($value == 'none') {
            continue;
        }
        if (!qtranxf_endsWith($key, '-migration')) {
            continue;
        }
        $plugin = substr($key, 0, -strlen('-migration'));
        $f = 'qtranxf_migrate_' . $value . '_' . str_replace('-', '_', $plugin);
        if (!function_exists($f)) {
            continue;
        }
        $f();
        if ($value == 'import') {
            qtranxf_reloadConfig();
            //}elseif($value == 'export'){
        }
    }
}
開發者ID:fernao,項目名稱:qtranslate-x,代碼行數:31,代碼來源:qtx_import_export.php


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