本文整理汇总了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;
}
示例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;
}
}
示例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‑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‑X', '<a href="mailto:qtranslateteam@gmail.com">qtranslateteam@gmail.com</a>', $nm, '<a href="https://wordpress.org/support/plugin/qtranslate-x">', '</a>', 'qTranslate‑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'])) {
//.........这里部分代码省略.........
示例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;
}
示例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'){
}
}
}