本文整理汇总了PHP中qtranxf_flag_location_default函数的典型用法代码示例。如果您正苦于以下问题:PHP qtranxf_flag_location_default函数的具体用法?PHP qtranxf_flag_location_default怎么用?PHP qtranxf_flag_location_default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtranxf_flag_location_default函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qtranxf_conf
//.........这里部分代码省略.........
echo $post_type;
?>
" value="1"<?php
checked(!$post_type_off);
?>
/> <?php
echo $post_type;
?>
</span>
<?php
}
?>
</p><p><small><?php
_e('If a post type unchecked, no fields in a post of that type are treated as translatable on editing pages. However, the manual raw multilingual entries with language tags may still get translated in a usual way at front-end.', 'qtranslate');
?>
</small></p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Flag Image Path', 'qtranslate');
?>
</th>
<td>
<?php
echo trailingslashit(WP_CONTENT_URL);
?>
<input type="text" name="flag_location" id="flag_location" value="<?php
echo $q_config['flag_location'];
?>
" style="width:100%"/>
<br/>
<small><?php
printf(__('Path to the flag images under wp-content, with trailing slash. (Default: %s, clear the value above to reset it to the default)', 'qtranslate'), qtranxf_flag_location_default());
?>
</small>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Ignore Links', 'qtranslate');
?>
</th>
<td>
<input type="text" name="ignore_file_types" id="ignore_file_types" value="<?php
echo implode(',', array_diff($q_config['ignore_file_types'], explode(',', QTX_IGNORE_FILE_TYPES)));
?>
" style="width:100%"/>
<br/>
<small><?php
printf(__('Don\'t convert links to files of the given file types. (Always included: %s)', 'qtranslate'), implode(', ', explode(',', QTX_IGNORE_FILE_TYPES)));
?>
</small>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Head inline CSS', 'qtranslate');
?>
</th>
<td>
<label for="header_css_on"><input type="checkbox" name="header_css_on" id="header_css_on" value="1"<?php
checked($q_config['header_css_on']);
?>
/> <?php
_e('CSS code added by plugin in the head of front-end pages:', 'qtranslate');
示例2: qtranxf_load_option_flag_location
function qtranxf_load_option_flag_location($nm)
{
global $q_config;
$default_value = qtranxf_flag_location_default();
$option_value = get_option('qtranslate_' . $nm);
if ($option_value === FALSE) {
$q_config[$nm] = $default_value;
} else {
// url fix for upgrading users
$flag_location = trailingslashit(preg_replace('#^wp-content/#', '', $option_value));
if (file_exists(trailingslashit(WP_CONTENT_DIR) . $flag_location) && $default_value != $flag_location) {
$q_config[$nm] = $flag_location;
} else {
$q_config[$nm] = $default_value;
delete_option('qtranslate_' . $nm);
}
}
}
示例3: qtranxf_updateSettingFlagLocation
function qtranxf_updateSettingFlagLocation($nm)
{
global $q_config;
if (!isset($_POST['submit'])) {
return false;
}
if (!isset($_POST[$nm])) {
return false;
}
$flag_location = untrailingslashit(sanitize_text_field($_POST[$nm]));
if (empty($flag_location)) {
$flag_location = qtranxf_flag_location_default();
}
$flag_location = trailingslashit($flag_location);
if (!file_exists(trailingslashit(WP_CONTENT_DIR) . $flag_location)) {
return null;
}
if ($flag_location != $q_config[$nm]) {
$q_config[$nm] = $flag_location;
if ($flag_location == qtranxf_flag_location_default()) {
delete_option('qtranslate_' . $nm);
} else {
update_option('qtranslate_' . $nm, $flag_location);
}
}
return true;
}
示例4: prepare_items
public function prepare_items()
{
global $q_config;
$flags = qtranxf_language_configured('flag');
$languages_stored = get_option('qtranslate_language_names', array());
$languages_predef = qtranxf_default_language_name();
$flag_location_url = qtranxf_flag_location();
$flag_location_dir = trailingslashit(WP_CONTENT_DIR) . $q_config['flag_location'];
$flag_location_url_def = content_url(qtranxf_flag_location_default());
//trailingslashit(content_url()).'/plugins/'.basename(dirname(QTRANSLATE_FILE)).'/flags/';
$clean_uri = $this->_clean_uri;
$data = array();
foreach ($this->_language_names as $lang => $language) {
if ($lang == 'code') {
continue;
}
$flag = $flags[$lang];
if (file_exists($flag_location_dir . $flag)) {
$flag_url = $flag_location_url . $flag;
} else {
$flag_url = $flag_location_url_def . $flag;
}
$data[] = array('code' => $lang, 'flag' => '<img src="' . $flag_url . '" alt="' . sprintf(__('%s Flag', 'qtranslate'), $language) . '">', 'name' => $language, 'action' => in_array($lang, $q_config['enabled_languages']) ? $q_config['default_language'] == $lang ? __('Default', 'qtranslate') : '<a class="edit" href="' . $clean_uri . '&disable=' . $lang . '#languages">' . __('Disable', 'qtranslate') . '</a>' : '<a class="edit" href="' . $clean_uri . '&enable=' . $lang . '#languages">' . __('Enable', 'qtranslate') . '</a>', 'edit' => '<a class="edit" href="' . $clean_uri . '&edit=' . $lang . '">' . __('Edit', 'qtranslate') . '</a>', 'stored' => !isset($languages_stored[$lang]) ? __('Pre-Defined', 'qtranslate') : '<a class="delete" href="' . $clean_uri . '&delete=' . $lang . '#languages">' . (isset($languages_predef[$lang]) ? __('Reset', 'qtranslate') : __('Delete', 'qtranslate')) . '</a>');
}
$this->items = $data;
}
示例5: prepare_items
public function prepare_items()
{
global $q_config;
if (isset($_GET['orderby'])) {
$this->_orderby = $_GET['orderby'];
} else {
$this->_orderby = $_GET['orderby'] = 'name';
}
$langs_preset = qtranxf_langs_preset();
$langs_stored = qtranxf_langs_stored($langs_preset);
$langs_config = qtranxf_langs_config($langs_preset, $langs_stored);
$this->_order = isset($_GET['order']) && 'desc' == $_GET['order'] ? -1 : +1;
$flag_location_url = qtranxf_flag_location();
$flag_location_dir = trailingslashit(WP_CONTENT_DIR) . $q_config['flag_location'];
$flag_location_url_def = content_url(qtranxf_flag_location_default());
$clean_uri = $this->_clean_uri;
$data = array();
foreach ($langs_config as $lang => $props) {
$locale = $props['locale'];
$flag = $props['flag'];
//$flags[$lang];
if (file_exists($flag_location_dir . $flag)) {
$flag_url = $flag_location_url . $flag;
} else {
$flag_url = $flag_location_url_def . $flag;
}
$lang_name = $props['language_name'];
//native name
$admin_name = qtranxf_getLanguageName($lang, $locale, $lang_name);
//name translated to admin language
$action = qtranxf_isEnabled($lang) ? $q_config['default_language'] == $lang ? __('Default', 'qtranslate') : __('Disable', 'qtranslate') : __('Enable', 'qtranslate');
$stored = empty($props['stored']) ? __('Pre-Defined', 'qtranslate') : (isset($langs_preset[$lang]) ? __('Reset', 'qtranslate') : __('Delete', 'qtranslate'));
switch ($this->_orderby) {
default:
case 'locale':
$orderby = $locale;
break;
case 'code':
$orderby = $lang;
break;
case 'flag':
$orderby = $lang_name;
break;
case 'name':
$orderby = $admin_name;
break;
case 'action':
$orderby = $action;
break;
case 'stored':
$orderby = $stored;
break;
}
$edit_url = $clean_uri . '&edit=' . $lang;
$atitle = __('Edit', 'qtranslate') . ' ' . $lang_name . ' (' . $locale . ')';
$data[] = array('locale' => $locale, 'code' => $lang, 'flag' => '<a href="' . $edit_url . '" title="' . $atitle . '"><img src="' . $flag_url . '" alt="' . sprintf(__('%s Flag', 'qtranslate'), $lang_name) . '"></a>', 'name' => '<a href="' . $edit_url . '" title="' . $atitle . '">' . $admin_name . '</a>', 'action' => qtranxf_isEnabled($lang) ? $q_config['default_language'] == $lang ? $action : '<a class="edit" href="' . $clean_uri . '&disable=' . $lang . '#languages">' . $action . '</a>' : '<a class="edit" href="' . $clean_uri . '&enable=' . $lang . '#languages">' . $action . '</a>', 'stored' => empty($props['stored']) ? $stored : '<a class="delete" href="' . $clean_uri . '&delete=' . $lang . '#languages">' . $stored . '</a>', 'admin_name' => $admin_name, 'orderby' => $orderby);
}
uasort($data, array($this, 'compare_items'));
$this->items = $data;
}
示例6: qtranxf_conf
//.........这里部分代码省略.........
]" id="post_type_<?php
echo $post_type;
?>
" value="1"<?php
checked(!$post_type_off);
?>
/> <?php
echo $post_type;
?>
</span>
<?php
}
?>
</p><p class="qtranxs_notes"><?php
_e('If a post type unchecked, no fields in a post of that type are treated as translatable on editing pages. However, the manual raw multilingual entries with language tags may still get translated in a usual way at front-end.', 'qtranslate');
?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Flag Image Path', 'qtranslate');
?>
</th>
<td>
<?php
echo trailingslashit(WP_CONTENT_URL);
?>
<input type="text" name="flag_location" id="flag_location" value="<?php
echo $q_config['flag_location'];
?>
" style="width:100%"/>
<p class="qtranxs_notes"><?php
printf(__('Path to the flag images under wp-content, with trailing slash. (Default: %s, clear the value above to reset it to the default)', 'qtranslate'), qtranxf_flag_location_default());
?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Ignore Links', 'qtranslate');
?>
</th>
<td>
<input type="text" name="ignore_file_types" id="ignore_file_types" value="<?php
echo implode(',', array_diff($q_config['ignore_file_types'], explode(',', QTX_IGNORE_FILE_TYPES)));
?>
" style="width:100%"/>
<p class="qtranxs_notes"><?php
printf(__('Don\'t convert links to files of the given file types. (Always included: %s)', 'qtranslate'), implode(', ', explode(',', QTX_IGNORE_FILE_TYPES)));
?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row"><?php
_e('Head inline CSS', 'qtranslate');
?>
</th>
<td>
<label for="header_css_on"><input type="checkbox" name="header_css_on" id="header_css_on" value="1"<?php
checked($q_config['header_css_on']);
?>
/> <?php
_e('CSS code added by plugin in the head of front-end pages:', 'qtranslate');
?>
示例7: qtranxf_default_enabled_languages
/**
* since 3.2.9.2
*/
function qtranxf_default_enabled_languages()
{
//$languages = get_available_languages();
//qtranxf_dbg_log('qtranxf_default_enabled_languages: count(languages): ',count($languages));
//qtranxf_dbg_log('qtranxf_default_enabled_languages: get_available_languages: ',$languages);
$locale = get_locale();
if (!$locale) {
$locale = 'en_US';
}
$lang = null;
$locales = qtranxf_default_locale();
foreach ($locales as $ln => $lo) {
if ($lo != $locale) {
continue;
}
$lang = $ln;
break;
}
if (!$lang) {
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
$translations = wp_get_available_translations();
//qtranxf_dbg_log('qtranxf_default_enabled_languages: count(available_translations): ',count($translations));
//qtranxf_dbg_log('qtranxf_default_enabled_languages: wp_get_available_translations: ',$translations);
if (empty($translations[$locale])) {
$lang = substr($locale, 0, 2);
$name = 'Unknown';
} else {
$translation = $translations[$locale];
$lang = current($translation['iso']);
if (!$lang) {
$lang = substr($locale, 0, 2);
}
$name = empty($translation['native_name']) ? 'Unknown' : $translation['native_name'];
}
$flag_location = WP_CONTENT_DIR . '/' . qtranxf_flag_location_default();
do {
$p = strpos($locale, '_');
if ($p > 0) {
$fn = strtolower(substr($locale, $p, 2));
$flag = $fn . '.png';
if (file_exists($flag_location . $flag)) {
break;
}
$flag = $fn . '.gpg';
if (file_exists($flag_location . $flag)) {
break;
}
}
$fn = strtolower(substr($locale, 0, 2));
$flag = $fn . '.png';
if (file_exists($flag_location . $flag)) {
break;
}
$flag = $fn . '.gpg';
if (file_exists($flag_location . $flag)) {
break;
}
$flag = 'aa.png';
} while (false);
$props = array('language_name' => $name, 'flag' => $flag, 'locale' => $locale, 'date_format' => __('F j, Y'), 'time_format' => __('g:i a'), 'not_available' => 'Sorry, this entry is only available in %LANG:, : and %.');
qtranxf_set_default_options($qtranslate_options);
qtranxf_save_languages(array($lang => $props), $qtranslate_options);
//qtranxf_dbg_log('qtranxf_default_enabled_languages: $props: ',$props);
}
$enabled_languages = array($lang);
if ($lang != 'en') {
$enabled_languages[] = 'en';
}
//qtranxf_dbg_log('qtranxf_default_enabled_languages: $lang="'.$lang.'"; $locale="'.$locale.'"; $enabled_languages: ',$enabled_languages);
return $enabled_languages;
}