本文整理汇总了PHP中qtrans_getLanguage函数的典型用法代码示例。如果您正苦于以下问题:PHP qtrans_getLanguage函数的具体用法?PHP qtrans_getLanguage怎么用?PHP qtrans_getLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtrans_getLanguage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: et_load_dailyjournal_scripts
function et_load_dailyjournal_scripts()
{
if (!is_admin()) {
$template_dir = get_template_directory_uri();
if (get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('easing', $template_dir . '/js/jquery.easing.1.3.js', array('jquery'), '1.0', true);
wp_enqueue_script('jquery_address', $template_dir . '/js/jquery.address-1.5.min.js', array('jquery'), '1.0', true);
wp_enqueue_script('mousewheel', $template_dir . '/js/jquery.mousewheel.js', array('jquery'), '1.0', true);
wp_enqueue_script('jscrollpane', $template_dir . '/js/jquery.jscrollpane.min.js', array('jquery'), '1.0', true);
wp_enqueue_script('gleam_plugin_fixes', $template_dir . '/js/gleam_plugin_fixes.js', array('jquery'), '1.0', true);
wp_enqueue_script('custom_script', $template_dir . '/js/custom.js', array('jquery'), '1.0', true);
$data = array('site_url' => home_url('/'), 'theme_url' => $template_dir);
if (function_exists('qtrans_getLanguage')) {
$data['qtranslate_lang'] = '?lang=' . qtrans_getLanguage();
}
if (function_exists('icl_object_id')) {
$data['wpml_lang'] = '?lang=' . ICL_LANGUAGE_CODE;
}
wp_localize_script('custom_script', 'et_site_data', $data);
wp_localize_script('custom_script', 'et_shortcodes_strings', array('previous' => __('Previous', 'Gleam'), 'next' => __('Next', 'Gleam')));
if (defined('ET_LB_PLUGIN_URI')) {
wp_localize_script('custom_script', 'et_gleam_lb', array('plugin_url' => ET_LB_PLUGIN_URI));
}
wp_localize_script('gleam_plugin_fixes', 'et_plugin_data', array('folder' => plugins_url()));
}
}
示例2: get_context_data
/**
* Get data from context
*
* @since 1.0
* @return array
*/
public function get_context_data()
{
$data = array($this->id);
if (function_exists('qtrans_getLanguage')) {
$data[] = qtrans_getLanguage();
}
return $data;
}
示例3: dsq_qtrans_get_lang
function dsq_qtrans_get_lang()
{
if (function_exists('qtranxf_getLanguage')) {
return qtranxf_getLanguage($text);
} else {
return qtrans_getLanguage($text);
}
}
示例4: getCurrentLangCode
/**
* Мы храним иногда язык в базе как отдельное поле. В таком случае у нас есть цифровой код языка
* @return int
*/
public function getCurrentLangCode($lang = NULL)
{
$lang = empty($lang) ? qtrans_getLanguage() : $lang;
$langCodes = array('ru' => 1, 'ro' => 2);
if (array_key_exists($lang, $langCodes)) {
return $langCodes[$lang];
}
return 0;
}
示例5: tfuse_add_js
/**
* This function include files of javascript.
*/
function tfuse_add_js()
{
wp_enqueue_script('jquery');
wp_register_script('modernizr', tfuse_get_file_uri('/js/lib/modernizr.min.js'), array('jquery'), '', true);
wp_enqueue_script('modernizr');
wp_register_script('respond', tfuse_get_file_uri('/js/lib/respond.min.js'), array('jquery'), '', true);
wp_enqueue_script('respond');
wp_register_script('jquery-ui.min', tfuse_get_file_uri('/js/lib/jquery-ui.min.js'), array('jquery'), '', true);
wp_enqueue_script('jquery-ui.min');
//
wp_register_script('bootstrap', tfuse_get_file_uri('/js/lib/bootstrap.min.js'), array('jquery'), '', true);
wp_enqueue_script('bootstrap');
wp_register_script('jquery.slicknav.min', tfuse_get_file_uri('/js/jquery.slicknav.min.js'), array('jquery'), '', true);
wp_enqueue_script('jquery.slicknav.min');
wp_register_script('jquery.customInput', tfuse_get_file_uri('/js/jquery.customInput.js'), array('jquery'), '', false);
wp_enqueue_script('jquery.customInput');
wp_register_script('jquery.carouFredSel-6.2.1-packed', tfuse_get_file_uri('/js/jquery.carouFredSel-6.2.1-packed.js'), array('jquery'), '', false);
wp_enqueue_script('jquery.carouFredSel-6.2.1-packed');
wp_register_script('general', tfuse_get_file_uri('/js/general.js'), array('jquery'), '', true);
wp_enqueue_script('general');
wp_register_script('html5shiv', tfuse_get_file_uri('/js/lib/html5shiv.js'), array('jquery'), '', true);
wp_enqueue_script('html5shiv');
wp_register_script('maps.google.com', '//maps.google.com/maps/api/js?sensor=false', array('jquery'), '1.0', true);
wp_enqueue_script('maps.google.com');
wp_register_script('jquery.gmap.min', tfuse_get_file_uri('/js/jquery.gmap.min.js'), array('jquery'), '', true);
wp_enqueue_script('jquery.gmap.min');
wp_register_script('html5gallery', tfuse_get_file_uri('/js/html5gallery.js'), array('jquery'), '', true);
wp_enqueue_script('html5gallery');
wp_register_script('jquery.touchSwipe.min', tfuse_get_file_uri('/js/jquery.touchSwipe.min.js'), array('jquery'), '', true);
wp_enqueue_script('jquery.touchSwipe.min');
wp_register_script('video', tfuse_get_file_uri('/js/video.js'), array('jquery'), '', true);
wp_enqueue_script('video');
//
wp_register_script('prettyPhoto', TFUSE_ADMIN_JS . '/jquery.prettyPhoto.js', array('jquery'), '3.1.4', true);
wp_enqueue_script('prettyPhoto');
wp_register_script('youtube-api.min', tfuse_get_file_uri('/js/youtube-api.min.js'), array('jquery'), '', true);
wp_enqueue_script('youtube-api.min');
wp_register_script('shCore', tfuse_get_file_uri('/js/shCore.js'), array('jquery'), '', true);
wp_enqueue_script('shCore');
wp_register_script('calendar', tfuse_get_file_uri('/js/calendar/calendar.js'), array('jquery'), '', true);
wp_enqueue_script('calendar');
wp_register_script('underscore-min', tfuse_get_file_uri('/js/calendar/underscore-min.js'), array('jquery'), '', true);
wp_enqueue_script('underscore-min');
wp_register_script('shBrushPlain', tfuse_get_file_uri('/js/shBrushPlain.js'), array('jquery'), '', true);
wp_enqueue_script('shBrushPlain');
wp_register_script('sintaxHighlighter', tfuse_get_file_uri('/js/sintaxHighlighter.js'), array('jquery'), '', true);
wp_enqueue_script('sintaxHighlighter');
if (function_exists('qtrans_getLanguage')) {
wp_localize_script('calendar', 'tf_qtrans_lang', array('lang' => qtrans_getLanguage()));
}
if (!is_admin()) {
do_action('tf_scripts_added');
}
}
示例6: detectLanguage
public static function detectLanguage()
{
$DW =& $GLOBALS['DW'];
if (self::detect(FALSE)) {
$qtlang = get_option('qtranslate_default_language');
$curlang = qtrans_getLanguage();
$DW->message('QT language: ' . $curlang);
if ($qtlang != $curlang) {
$DW->qt = TRUE;
$DW->message('QT enabled');
}
return $curlang;
}
}
示例7: of_meta
function of_meta($id, $key, $echo = true)
{
if (function_exists('qtrans_getAvailableLanguages')) {
$selectedLanguage = qtrans_getLanguage();
if ($echo) {
echo get_post_meta($id, $key . "_" . $selectedLanguage, true);
} else {
return get_post_meta($id, $key . "_" . $selectedLanguage, true);
}
} else {
if ($echo) {
echo get_post_meta($id, $key, true);
} else {
return get_post_meta($id, $key, true);
}
}
}
示例8: blogfilter
/**
* We use the blogfilter function to define all the page urls and category mappings
*
* @Params the name of the page
* @Params 'display'
* @return string - the url or category name
*
**/
function blogfilter($arg, $arg2)
{
global $current_user, $authordata, $group;
$userInfo = wp_get_current_user();
$loggedin = is_user_logged_in();
$lang = qtrans_getLanguage();
switch ($arg2) {
/* === Main Page Links === */
case 'main_url':
return get_bloginfo('wpurl');
case 'company_url':
return get_bloginfo('wpurl') . "/" . $lang . "/company";
case 'company_history_url':
return get_bloginfo('wpurl') . "/" . $lang . "/company-history";
case 'company_events_url':
return get_bloginfo('wpurl') . "/" . $lang . "/company-events";
case 'company_careers_url':
return get_bloginfo('wpurl') . "/" . $lang . "/company-careers";
case 'activity_url':
return get_bloginfo('wpurl') . "/" . $lang . "/activity";
case 'activity_geography_url':
return get_bloginfo('wpurl') . "/" . $lang . "/activity-geography";
case 'activity_license_url':
return get_bloginfo('wpurl') . "/" . $lang . "/activity-license";
case 'services_url':
return get_bloginfo('wpurl') . "/" . $lang . "/services";
case 'ecology_url':
return get_bloginfo('wpurl') . "/" . $lang . "/ecology";
case 'partners_url':
return get_bloginfo('wpurl') . "/" . $lang . "/partners";
case 'news_url':
return get_bloginfo('wpurl') . "/" . $lang . "/news";
case 'contacts_url':
return get_bloginfo('wpurl') . "/" . $lang . "/contacts";
/* === Main Category Names === */
/* === Main Category Names === */
case 'main_cat':
return "main";
/* === MISC === */
/* === MISC === */
case 'ajax_queries_url':
return get_bloginfo('stylesheet_directory') . '/ajax_queries.php';
}
return $arg;
}
示例9: load_item
public static function load_item($id, $vista)
{
$settings = unserialize(get_option("chronosly-settings"));
if ($settings["disable_cache"]) {
return false;
}
if (isset($_REQUEST["small"])) {
$vista .= "_small";
}
if (function_exists("qtrans_getLanguage")) {
$vista .= qtrans_getLanguage();
}
$html = get_option("chronosly_template_{$id}_{$vista}");
if (!Chronosly_Utils::validate_closure($html)) {
return false;
}
return $html;
}
示例10: tfuse_add_js
/**
* This function include files of javascript.
*/
function tfuse_add_js()
{
wp_enqueue_script('jquery');
wp_register_script('jquery-ui', tfuse_get_file_uri('/js/lib/jquery-ui.min.js'), array('jquery'), '1.10.4', false);
wp_enqueue_script('jquery-ui');
wp_register_script('bootstrap', tfuse_get_file_uri('/js/lib/bootstrap.min.js'), array('jquery'), '3.1.0', false);
wp_enqueue_script('bootstrap');
wp_register_script('prettyPhoto', TFUSE_ADMIN_JS . '/jquery.prettyPhoto.js', array('jquery'), '3.1.4', false);
wp_enqueue_script('prettyPhoto');
// general.js can be overridden in a child theme by copying it in child theme's js folder
wp_register_script('general', tfuse_get_file_uri('/js/general.js'), array('jquery'), '2.0', false);
wp_enqueue_script('general');
wp_localize_script('general', 'TfPhpVars', array('home' => __('Home', 'tfuse')));
wp_register_script('events', tfuse_get_file_uri('/js/events.js'), array('jquery'), '', true);
wp_enqueue_script('events');
if (function_exists('qtrans_getLanguage')) {
wp_localize_script('events', 'tf_qtrans_lang', array('lang' => qtrans_getLanguage()));
}
wp_register_script('slicknav', tfuse_get_file_uri('/js/jquery.slicknav.min.js'), array('jquery'), '1.0', true);
wp_enqueue_script('slicknav');
wp_register_script('modernizr', tfuse_get_file_uri('/js/lib/modernizr.min.js'));
wp_enqueue_script('modernizr');
wp_register_script('html5shiv', tfuse_get_file_uri('/js/lib/html5shiv.js'));
wp_enqueue_script('html5shiv');
wp_register_script('respond', tfuse_get_file_uri('/js/lib/respond.min.js'));
wp_enqueue_script('respond');
wp_register_script('carouFredSel', tfuse_get_file_uri('/js/jquery.carouFredSel-6.2.1.js'), array('jquery'), '6.2.1', true);
wp_enqueue_script('carouFredSel');
wp_register_script('cusel-min', tfuse_get_file_uri('/js/cusel.min.js'), array('jquery'), '3.0', true);
wp_enqueue_script('cusel-min');
wp_register_script('parallax', tfuse_get_file_uri('/js/parallax.js'), array('jquery'), '1.1.3', true);
wp_enqueue_script('parallax');
wp_register_script('scrollto', tfuse_get_file_uri('/js/scrollto.js'), array('jquery'), '1.0', true);
wp_enqueue_script('scrollto');
if (!is_admin()) {
do_action('tf_scripts_added');
}
}
示例11: alo_em_get_language
/**
* Return the current language
*
* @param bol try lang detection form browser (eg. useful for subscription if multilang plugin not installed)
*/
function alo_em_get_language($detect_from_browser = false)
{
// Choice by custom filters
$lang_by_filter = apply_filters('alo_easymail_multilang_get_language', false, $detect_from_browser);
// Hook
if ($lang_by_filter) {
return strtolower($lang_by_filter);
}
// 1st choice: using qTranslate
if (alo_em_multilang_enabled_plugin() == "qTrans" && function_exists('qtrans_getLanguage')) {
return strtolower(qtrans_getLanguage());
}
// 2nd choice: using WPML
if (alo_em_multilang_enabled_plugin() == "WPML" && defined('ICL_LANGUAGE_CODE')) {
return strtolower(ICL_LANGUAGE_CODE);
}
// Last choice: get from browser only if requested and the lang .mo is available on blog
if ($detect_from_browser) {
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$lang = alo_em_short_langcode($_SERVER['HTTP_ACCEPT_LANGUAGE']);
}
if (!empty($lang) && in_array($lang, alo_em_get_all_languages(false))) {
return $lang;
} else {
return "";
}
} else {
// otherwise return default blog language
return alo_em_short_langcode(get_locale());
}
}
示例12: map
/**
* The map template tag.
*
* Returns HTML for a Google map. Must use with echo in a template: echo GeoMashup::map();.
*
* @since 1.0
* @link http://github.com/cyberhobo/wordpress-geo-mashup/wiki/Tag-Reference#map tag parameter documentation
* @uses $_SERVER['QUERY_STRING'] The first global map on a page uses query string parameters like tag parameters.
* @uses apply_filters() geo_mashup_static_map Modify a static map image generated by geo mashup.
* @staticvar $map_number Used to index maps per request.
*
* @param string|array $atts Template tag parameters.
* @return string The HTML for the requested map.
*/
public static function map($atts = null)
{
global $wp_query, $in_comment_loop, $geo_mashup_options;
static $map_number = 1;
$atts = wp_parse_args($atts);
$static = (bool) (!empty($atts['static']) and 'true' == $atts['static']);
unset($atts['static']);
if (empty($atts['lang'])) {
if (function_exists('qtrans_getLanguage')) {
// qTranslate integration
$atts['lang'] = qtrans_getLanguage();
} else {
if (defined('ICL_LANGUAGE_CODE')) {
// WPML integration
$atts['lang'] = ICL_LANGUAGE_CODE;
}
}
}
$click_to_load_options = array('click_to_load', 'click_to_load_text');
self::convert_map_attributes($atts);
// Default query is for posts
$object_name = isset($atts['object_name']) ? $atts['object_name'] : 'post';
// Map content type isn't required, if empty we'll choose one
$map_content = isset($atts['map_content']) ? $atts['map_content'] : null;
// Find the ID and location of the container object if it exists
if ('post' == $object_name and $wp_query->in_the_loop) {
$context_object_id = $wp_query->post->ID;
} else {
if ('comment' == $object_name and $in_comment_loop) {
$context_object_id = get_comment_ID();
} else {
if ('user' == $object_name and $wp_query->post) {
$context_object_id = $wp_query->post->post_author;
}
}
}
if (empty($atts['object_id'])) {
if (!empty($context_object_id)) {
// If we found a context object, we'll query for that by default
$atts['object_id'] = $context_object_id;
$context_location = GeoMashupDB::get_object_location($object_name, $context_object_id);
} else {
if ('single' == $map_content and 'post' == $object_name) {
// In secondary post loops we won't find a context object
// but can at least allow explicit single maps
$atts['object_id'] = get_the_ID();
}
}
}
if (empty($map_content) and !empty($atts['object_ids'])) {
$map_content = 'global';
}
if (empty($map_content)) {
if (empty($context_object_id)) {
$map_content = 'contextual';
} else {
if (empty($context_location)) {
// Not located, go global
$map_content = 'global';
} else {
// Located, go single
$map_content = 'single';
}
}
} else {
if ($map_content instanceof WP_Query) {
// We've been given a post query, put its contents in a global map
$atts['object_ids'] = implode(',', wp_list_pluck($map_content->posts, 'ID'));
$map_content = 'global';
}
}
switch ($map_content) {
case 'contextual':
$atts['map_content'] = 'contextual';
$atts += $geo_mashup_options->get('context_map', $click_to_load_options);
$object_ids = array();
if ('comment' == $object_name) {
$context_objects = $wp_query->comments;
} else {
$context_objects = $wp_query->posts;
}
if (!is_array($context_objects)) {
return '<!-- ' . __('Geo Mashup found no objects to map in this context', 'GeoMashup') . '-->';
}
foreach ($context_objects as $context_object) {
if ('post' == $object_name) {
//.........这里部分代码省略.........
示例13: qtrans_getSortedLanguages
<?php
global $qtransMETA;
global $q_config;
//Get languages
$languages = qtrans_getSortedLanguages();
//Check for & set view
if (isset($_REQUEST['qtm_view'])) {
$_SESSION['qtm_view'] = filter_var($_REQUEST['qtm_view'], FILTER_SANITIZE_STRING);
}
$_view = $_SESSION['qtm_view'] ? $_SESSION['qtm_view'] : 'flags';
//Check for & set lang
if (isset($_REQUEST['qtm_lang'])) {
$_SESSION['qtm_lang'] = filter_var($_REQUEST['qtm_lang'], FILTER_SANITIZE_STRING);
}
$_lang = $_SESSION['qtm_lang'] ? $_SESSION['qtm_lang'] : qtrans_getLanguage();
?>
<form method="post" action="">
<div class="tablenav">
<div class="alignleft actions">
<?php
_e('View', 'qtranslate-meta');
?>
:
<select name="qtm_view" onchange="this.form.submit()">
<option value="flags" <?php
if ($_view == 'flags') {
echo 'selected="selected"';
}
?>
示例14:
if (qtrans_getLanguage() == 'es') {
?>
Tarde
<?php
} else {
?>
Afternoon
<?php
}
?>
</a>
</li>
<li class="span3">
<a href="#filter" data-option-value=".noche">
<?php
if (qtrans_getLanguage() == 'es') {
?>
Noche
<?php
} else {
?>
Night
<?php
}
?>
</a>
</li>
</ul>
</section>
<p class="titulo-programacion">
<span class="icono-filters"></span>Eventos organizados de la Alcaldía de Medellín
示例15: eme_detect_lang
function eme_detect_lang() {
$language="";
if (function_exists('qtrans_getLanguage')) {
// if permalinks are on, $_GET doesn't contain lang as a parameter
// so we get it like this to be sure
$language=qtrans_getLanguage();
} elseif (function_exists('ppqtrans_getLanguage')) {
$language=ppqtrans_getLanguage();
} elseif (function_exists('qtranxf_getLanguage')) {
$language=qtranxf_getLanguage();
} elseif (function_exists('pll_current_language') && function_exists('pll_languages_list')) {
$languages=pll_languages_list();
if (is_array($languages)) {
foreach ($languages as $tmp_lang) {
if (preg_match("/^$tmp_lang\/|\/$tmp_lang\//",$_SERVER['REQUEST_URI']))
$language=$tmp_lang;
}
}
if (empty($language))
$language=pll_current_language('slug');
} elseif (defined('ICL_LANGUAGE_CODE')) {
// Both polylang and wpml define this constant, so check polylang first (above)
// if permalinks are on, $_GET doesn't contain lang as a parameter
// so we get it like this to be sure
$language=ICL_LANGUAGE_CODE;
} elseif (isset($_GET['lang'])) {
$language=eme_strip_tags($_GET['lang']);
} else {
$language="";
}
return $language;
}