本文整理汇总了PHP中qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage函数的典型用法代码示例。如果您正苦于以下问题:PHP qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage函数的具体用法?PHP qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage怎么用?PHP qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: acf_qtranslate_plugin_format_value_for_api
function acf_qtranslate_plugin_format_value_for_api($value)
{
if (acf_qtranslate_enabled() && is_string($value)) {
$value = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
}
return $value;
}
示例2: format_value_for_api
function format_value_for_api($value, $post_id, $field)
{
if (acf_qtranslate_enabled()) {
$value = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
}
return acf_field_textarea::format_value_for_api($value, $post_id, $field);
}
示例3: format_value_for_api
/**
* This filter is applied to the $value after it is loaded from the db and
* before it is returned to the template via functions such as get_field().
*/
public function format_value_for_api($value)
{
if (is_string($value)) {
$value = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
}
return $value;
}
示例4: qTrans
protected function qTrans($output)
{
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
$output = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($output);
}
return $output;
}
示例5: translate
public function translate($text)
{
if (function_exists('qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
return qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
} else {
return qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
}
}
示例6: filterLang
public function filterLang($text, $lang = NULL)
{
if (!empty($lang) && function_exists('qtrans_use')) {
return qtrans_use($lang, $text);
}
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
return qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
}
return $text;
}
示例7: alo_em___
/**
* Return a text after applying a multilanguage filter
*/
function alo_em___($text)
{
// 1st choice: using qTranslate
if (alo_em_multilang_enabled_plugin() == "qTrans" && function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
return qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
}
// Choice by custom filters
$text = apply_filters('alo_easymail_multilang_alo_em___', $text);
// Hook
// last case: return without translating
return $text;
}
示例8: get_options
function get_options()
{
$saved_options = unserialize(get_option('arras_options'));
if (!empty($saved_options) && is_object($saved_options)) {
foreach ($saved_options as $name => $value) {
// Apply filters if qTranslate is enabled
if (function_exists('qtrans_init') && (!isset($_GET['page']) || $_GET['page'] != 'arras-options')) {
$value = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
}
$this->{$name} = $value;
}
}
}
示例9: find
/**
* @param int $postId
* @param string $metaId
* @param bool $single
* @return mixed
*/
public function find($postId, $metaId, $single = true)
{
$metaId = $this->gummOptionId($metaId, true);
$meta = false;
if (strpos($metaId, '.') !== false) {
$parts = explode('.', $metaId);
$rootId = array_shift($parts);
$rootMetaData = get_post_meta($postId, $rootId, $single);
$metaXPath = implode('.', $parts);
$meta = Set::classicExtract($rootMetaData, $metaXPath);
if ($meta === null || $rootMetaData === '' && !$meta) {
$meta = false;
}
} else {
$meta = get_post_meta($postId, $metaId, $single);
// if ($postId == 442 && $metaId == 'nova_postmeta') {
// debug(get_post_meta(442, 'nova_postmeta'), true);
// d($meta);
// } else {
// debug($postId);
// debug($metaId);
// }
}
// debug($metaId);
$_post = get_post($postId);
$friendlyId = $this->friendlyOptionId($metaId);
$postTypes = array($_post->post_type);
if (in_array($_post->post_type, $this->Post->getPostTypes())) {
$postTypes[] = 'single';
}
if (!$meta && isset($this->_schema[$friendlyId])) {
$meta = $this->_schema[$friendlyId];
} elseif ($friendlyId == 'postmeta') {
foreach ($postTypes as $postType) {
if (isset($this->_schema[$postType]) && isset($this->_schema[$postType]['postmeta'])) {
if (!$meta) {
$meta = $this->_schema[$postType]['postmeta'];
} else {
$meta = array_merge($this->_schema[$postType]['postmeta'], (array) $meta);
}
if (is_array($meta)) {
$meta = Set::booleanize($meta);
}
}
}
}
if ($meta && !is_admin() && function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
$meta = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($meta);
}
return $meta;
}
示例10: qtrans_fixAdminBar
function qtrans_fixAdminBar($wp_admin_bar)
{
global $wp_admin_bar;
$nodes = $wp_admin_bar->get_nodes();
if (is_array($nodes)) {
foreach ($wp_admin_bar->get_nodes() as $node) {
$wp_admin_bar->add_node(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($node));
}
}
}
示例11: relevanssi_do_query
//.........这里部分代码省略.........
if ($cache) {
$params = md5(serialize(array($q, $tax_query, $tax_query_relation, $post_query, $meta_query, $expids, $post_type, $operator, $search_blogs, $author, $orderby, $order)));
$return = relevanssi_fetch_hits($params);
if (!$return) {
$return = relevanssi_search($q, $tax_query, $tax_query_relation, $post_query, $meta_query, $expids, $post_type, $operator, $search_blogs, $author, $orderby, $order);
$return_ser = serialize($return);
relevanssi_store_hits($params, $return_ser);
}
} else {
$return = relevanssi_search($q, $tax_query, $tax_query_relation, $post_query, $meta_query, $expids, $post_type, $operator, $search_blogs, $author, $orderby, $order);
}
}
isset($return['hits']) ? $hits = $return['hits'] : ($hits = array());
isset($return['query']) ? $q = $return['query'] : ($q = "");
$filter_data = array($hits, $q);
$hits_filters_applied = apply_filters('relevanssi_hits_filter', $filter_data);
$hits = $hits_filters_applied[0];
$query->found_posts = sizeof($hits);
if ($query->query_vars["posts_per_page"] == 0) {
// assume something sensible to prevent "division by zero error";
$query->query_vars["posts_per_page"] = -1;
}
if ($query->query_vars["posts_per_page"] == -1) {
$query->max_num_pages = sizeof($hits);
} else {
$query->max_num_pages = ceil(sizeof($hits) / $query->query_vars["posts_per_page"]);
}
$update_log = get_option('relevanssi_log_queries');
if ('on' == $update_log) {
relevanssi_update_log($q, sizeof($hits));
}
$make_excerpts = get_option('relevanssi_excerpts');
if ($query->is_admin) {
$make_excerpts = false;
}
if ($query->query_vars['paged'] > 0) {
$wpSearch_low = ($query->query_vars['paged'] - 1) * $query->query_vars["posts_per_page"];
} else {
$wpSearch_low = 0;
}
if ($query->query_vars["posts_per_page"] == -1) {
$wpSearch_high = sizeof($hits);
} else {
$wpSearch_high = $wpSearch_low + $query->query_vars["posts_per_page"] - 1;
}
if (isset($query->query_vars['offset']) && $query->query_vars['offset'] > 0) {
$wpSearch_high += $query->query_vars['offset'];
$wpSearch_low += $query->query_vars['offset'];
}
if ($wpSearch_high > sizeof($hits)) {
$wpSearch_high = sizeof($hits);
}
for ($i = $wpSearch_low; $i <= $wpSearch_high; $i++) {
if (isset($hits[intval($i)])) {
$post = $hits[intval($i)];
} else {
continue;
}
if ($post == NULL) {
// apparently sometimes you can get a null object
continue;
}
//Added by OdditY - Highlight Result Title too ->
if ("on" == get_option('relevanssi_hilite_title')) {
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
$post->post_title = strip_tags(qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title));
} else {
$post->post_title = strip_tags($post->post_title);
}
$highlight = get_option('relevanssi_highlight');
if ("none" != $highlight) {
if (!is_admin()) {
$post->post_title = relevanssi_highlight_terms($post->post_title, $q);
}
}
}
// OdditY end <-
if ('on' == $make_excerpts) {
if ($cache) {
$post->post_excerpt = relevanssi_fetch_excerpt($post->ID, $q);
if ($post->post_excerpt == null) {
$post->post_excerpt = relevanssi_do_excerpt($post, $q);
relevanssi_store_excerpt($post->ID, $q, $post->post_excerpt);
}
} else {
$post->post_excerpt = relevanssi_do_excerpt($post, $q);
}
if ('on' == get_option('relevanssi_show_matches')) {
$post->post_excerpt .= relevanssi_show_matches($return, $post->ID);
}
}
if (isset($return['scores'][$post->ID])) {
$post->relevance_score = round($return['scores'][$post->ID], 2);
}
$posts[] = $post;
}
$query->posts = $posts;
$query->post_count = count($posts);
return $posts;
}
示例12: notify_user
/**
* Sends the notification message to a given user
*/
public function notify_user($_post_ID = 0, $_email = '', $_comment_ID = 0)
{
// Retrieve the options from the database
$from_name = html_entity_decode(stripslashes(get_option('subscribe_reloaded_from_name', 'admin')), ENT_QUOTES, 'UTF-8');
$from_email = get_option('subscribe_reloaded_from_email', get_bloginfo('admin_email'));
$subject = html_entity_decode(stripslashes(get_option('subscribe_reloaded_notification_subject', 'There is a new comment on the post [post_title]')), ENT_QUOTES, 'UTF-8');
$message = html_entity_decode(stripslashes(get_option('subscribe_reloaded_notification_content', '')), ENT_COMPAT, 'UTF-8');
$manager_link = get_bloginfo('url') . get_option('subscribe_reloaded_manager_page', '/comment-subscriptions/');
if (function_exists('qtrans_convertURL')) {
$manager_link = qtrans_convertURL($manager_link);
}
$clean_email = $this->clean_email($_email);
$subscriber_salt = $this->generate_temp_key($clean_email);
$manager_link .= (strpos($manager_link, '?') !== false ? '&' : '?') . "sre=" . $this->get_subscriber_key($clean_email) . "&srk={$subscriber_salt}";
$headers = "From: {$from_name} <{$from_email}>\n";
$content_type = get_option('subscribe_reloaded_enable_html_emails', 'no') == 'yes' ? 'text/html' : 'text/plain';
$headers .= "Content-Type: {$content_type}; charset=" . get_bloginfo('charset') . "\n";
if (get_option('subscribe_reloaded_admin_bcc', 'no') == 'yes') {
$headers .= "Bcc: {$from_name} <{$from_email}>\n";
}
$post = get_post($_post_ID);
$comment = get_comment($_comment_ID);
$post_permalink = get_permalink($_post_ID);
$comment_permalink = get_comment_link($_comment_ID);
$comment_reply_permalink = get_permalink($_post_ID) . '?replytocom=' . $_comment_ID . '#respond';
$comment_content = $comment->comment_content;
// Add HTML paragraph tags to comment
// See wp-includes/formatting.php for details on the wpautop() function
if ($content_type == 'text/html') {
$comment_content = wpautop($comment->comment_content);
}
// Replace tags with their actual values
$subject = str_replace('[post_title]', $post->post_title, $subject);
$message = str_replace('[post_permalink]', $post_permalink, $message);
$message = str_replace('[comment_permalink]', $comment_permalink, $message);
$message = str_replace('[comment_reply_permalink]', $comment_reply_permalink, $message);
$message = str_replace('[comment_author]', $comment->comment_author, $message);
$message = str_replace('[comment_content]', $comment_content, $message);
$message = str_replace('[manager_link]', $manager_link, $message);
// QTranslate support
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
$subject = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($subject);
$message = str_replace('[post_title]', qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title), $message);
$message = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($message);
} else {
$message = str_replace('[post_title]', $post->post_title, $message);
}
$message = apply_filters('stcr_notify_user_message', $message, $_post_ID, $_email, $_comment_ID);
if ($content_type == 'text/html') {
if (get_option('subscribe_reloaded_htmlify_message_links') == 'yes') {
$message = $this->htmlify_message_links($message);
}
$message = $this->wrap_html_message($message, $subject);
}
wp_mail($clean_email, $subject, $message, $headers);
}
示例13: ym_membership_content_page
function ym_membership_content_page($with_boxes = false, $with_snippets = TRUE, $with_expires = FALSE, $show = 'posts,bundles,premium')
{
get_currentuserinfo();
global $current_user, $wpdb, $ym_res;
$snippet_length = 200;
$max_loops = 30;
$html = '';
$membership_level = ym_get_user_package_type($current_user->ID);
$posts = false;
$show = explode(',', $show);
if (in_array('posts', $show)) {
if ($pp = ym_render_my_purchased_posts($current_user->ID, false, true, $with_expires, $with_snippets)) {
if ($with_boxes) {
$html .= ym_start_box(__('My Purchased Posts', 'ym'));
}
$html .= $pp;
if ($with_boxes) {
$html .= ym_end_box();
}
}
}
if (in_array('bundles', $show)) {
// bundle
if ($bundles = ym_render_my_purchased_bundles($current_user->ID, $with_expires, TRUE, $with_snippets)) {
if ($with_boxes) {
$html .= ym_start_box(__('My Purchased Bundles', 'ym'));
}
$html .= $bundles;
if ($with_boxes) {
$html .= ym_end_box();
}
}
}
if (in_array('premium', $show)) {
$sql = 'SELECT DISTINCT(ID), post_title, post_date, post_content
FROM
' . $wpdb->posts . ' p
JOIN ' . $wpdb->postmeta . ' pm ON (
p.ID = pm.post_id
AND p.post_status = "publish"
AND pm.meta_key = "_ym_account_type"
AND pm.meta_value LIKE "%' . $membership_level . '%"
AND post_type = "post"
)
ORDER BY post_date DESC';
$results = $wpdb->get_results($sql);
$loops = 0;
if ($members_pages = count($results)) {
foreach ($results as $id => $obj) {
if (!ym_user_has_access($obj->ID)) {
$membership_pages--;
continue;
}
$published = date(YM_DATEFORMAT, strtotime($obj->post_date));
$full_content = apply_filters('the_content', $obj->post_content);
$title = $obj->post_title;
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
$title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($title);
$full_content = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($full_content);
}
$row = '<tr>
<td style="border-top: 1px solid silver;">
<div style="margin-bottom: 5px;"><a href="' . get_permalink($obj->ID) . '">' . $title . '</a></div>
';
if ($with_snippets) {
$content = substr(strip_tags($full_content), 0, $snippet_length);
//$content = preg_replace("'\[/?\s?private\s?\]'i",'', $content);
$ending = strlen($full_content) > strip_tags($snippet_length) ? '...' : '';
$row .= '<div style="font-size: 10px; margin-bottom: 5px;">' . $content . $ending . '</div>';
}
$row .= '
</td>
<td style="vertical-align: top; border-top: 1px solid silver;">' . $published . '</td>
</tr>';
$posts .= $row;
$loops++;
if ($loops >= $max_loops) {
break;
}
}
}
$table_intro = 'Showing the most recent ' . $loops . ' posts of a total ' . $members_pages . ' available to you.';
$html .= $ym_res->members_content_divider_html;
if ($with_boxes) {
$html .= ym_start_box(__('Premium Content', 'ym'));
}
$html .= ' <div class="premium_content_intro">' . __('Your membership level is:', "ym") . ' <strong>' . $membership_level . '</strong>.
' . __('You have access to a total of', "ym") . ' ' . $members_pages . ' ' . __('premium', 'ym') . ' ' . ($members_pages == 1 ? __('post', 'ym') : __('posts', 'ym')) . '
</div>';
if ($members_pages > 0) {
$html .= $table_intro;
$html .= '<div style="padding-top: 10px; margin-bottom: 10px;">
<table style="width: 100%" cellspacing="0" cellpadding="2">
<tr>
<th style="text-align: left;">Post Title</th>
<th style="width: 160px; text-align: left;">Published</th>
</tr>
' . $posts . '
</table></div>';
}
//.........这里部分代码省略.........
示例14: get_summary
function get_summary($id, $instance)
{
if (!is_numeric($id)) {
return false;
}
global $wpdb;
$excerpt = "";
$result = "";
$result = $wpdb->get_results("SELECT post_excerpt FROM {$wpdb->posts} WHERE ID = " . $id, ARRAY_A);
if (empty($result[0]['post_excerpt'])) {
// no custom excerpt defined, how lazy of you!
$result = $wpdb->get_results("SELECT post_content FROM {$wpdb->posts} WHERE ID = " . $id, ARRAY_A);
$excerpt = preg_replace("/\\[caption.*\\[\\/caption\\]/", "", $result[0]['post_content']);
} else {
// user has defined a custom excerpt, yay!
$excerpt = preg_replace("/\\[caption.*\\[\\/caption\\]/", "", $result[0]['post_excerpt']);
}
// RRR added call to the_content filters, allows qTranslate to hook in.
if ($this->qTrans) {
$excerpt = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($excerpt);
}
// remove flash objects
$excerpt = preg_replace("/<object[0-9 a-z_?*=\":\\-\\/\\.#\\,\\n\\r\\t]+/smi", "", $excerpt);
// remove shortcodes
$excerpt = strip_shortcodes($excerpt);
if ($instance['post-excerpt']['keep_format']) {
$excerpt = strip_tags($excerpt, '<a><b><i><strong><em>');
} else {
$excerpt = strip_tags($excerpt);
}
if (strlen($excerpt) > $instance['post-excerpt']['length']) {
$excerpt = $this->truncate($excerpt, $instance['post-excerpt']['length'], '', true, true);
}
return $excerpt;
}
示例15: i18n
/**
* Support for i18n with wpml, polyglot or qtrans
*
* @param string $in
* @param string $name (optional) required for wpml to determine the type of translation
* @return string $in localized
*/
static function i18n($in, $name = null)
{
if (function_exists('langswitch_filter_langs_with_message')) {
$in = langswitch_filter_langs_with_message($in);
}
if (function_exists('polyglot_filter')) {
$in = polyglot_filter($in);
}
if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
$in = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($in);
}
if (is_string($name) && !empty($name) && function_exists('icl_translate')) {
$in = icl_translate('plugin_ngg', $name, $in, true);
}
$in = apply_filters('localization', $in);
return $in;
}