本文整理汇总了PHP中qtrans_join函数的典型用法代码示例。如果您正苦于以下问题:PHP qtrans_join函数的具体用法?PHP qtrans_join怎么用?PHP qtrans_join使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qtrans_join函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update_value
function update_value($value, $post_id, $field)
{
if (acf_qtranslate_enabled()) {
$value = qtrans_join($value);
}
return $value;
}
示例2: qs_UpdateOrder
function qs_UpdateOrder($order_id)
{
global $wpdb;
$orders = get_option('qs_orders');
if (!is_array($orders)) {
return false;
}
foreach ($orders as $key => $order) {
// search for wanted order
if ($order['order']['order_id'] != $order_id) {
continue;
}
// query server for updates
$order['order']['order_url'] = get_option('home');
$result = qs_queryQS(QS_RETRIEVE_TRANSLATION, $order['order']);
$orders[$key]['status'] = $result['order_comment'];
// update db if post is updated
if (isset($result['order_status']) && $result['order_status'] == QS_STATE_CLOSED) {
$order['post_id'] = intval($order['post_id']);
$post =& get_post($order['post_id']);
$title = qtrans_split($post->post_title);
$content = qtrans_split($post->post_content);
$title[$order['target_language']] = $result['order_translated_title'];
$content[$order['target_language']] = $result['order_translated_text'];
$post->post_title = qtrans_join($title);
$post->post_content = qtrans_join($content);
$wpdb->show_errors();
$wpdb->query('UPDATE ' . $wpdb->posts . ' SET post_title="' . mysql_escape_string($post->post_title) . '", post_content = "' . mysql_escape_string($post->post_content) . '" WHERE ID = "' . $post->ID . '"');
wp_cache_add($post->ID, $post, 'posts');
unset($orders[$key]);
}
update_option('qs_orders', $orders);
return true;
}
return false;
}
示例3: update_value
function update_value($value, $post_id, $field)
{
return qtrans_join($value);
}
示例4: update_value
function update_value($value, $post_id, $field)
{
$value = parent::update_value($value, $post_id, $field);
return qtrans_join($value);
}
示例5: join
/**
* Merges multiple values into a string.
*
* @param mixed[] $values The items to be joined
* @return string The joined data.
*/
public function join($values)
{
$nice = array();
foreach ($values as $lang => $data) {
$nice[$lang] = maybe_serialize($data);
}
return empty($nice) ? array() : apply_filters('uf_ml_q_join', qtrans_join($nice));
}
示例6: hook_save_post
function hook_save_post($post_id)
{
// Fix bug when auto-saving revisions
// Since 0.8, thanks to Benoit Gauthier
$revision_id = wp_is_post_revision($post_id);
if ($revision_id !== false && $revision_id !== $post_id) {
return;
}
//Iterate over field names and languages and copile into array
$languages = qtrans_getSortedLanguages();
$meta = array();
foreach ($languages as $lang) {
foreach ($this->field_names as $field => $field_label) {
//Get field data
$field_id = "qtrans_meta_{$field}_{$lang}";
$field_data = trim(str_replace('"', '', $_POST[$field_id]));
$meta[$field][$lang] = $field_data;
}
//end of iterating over field names
}
//end of iterating over langauges
// Join and save
foreach ($meta as $field => $data) {
$field_id = "qtrans_meta:{$field}";
$field_data = qtrans_join($data);
update_post_meta($post_id, $field_id, $field_data);
}
}
示例7: qtranslate_conf
//.........这里部分代码省略.........
$language_name = $_POST['language_name'];
$language_locale = $_POST['language_locale'];
$language_date_format = $_POST['language_date_format'];
$language_time_format = $_POST['language_time_format'];
$language_na_message = $_POST['language_na_message'];
$language_flag = $_POST['language_flag'];
$language_default = $_POST['language_default'];
}
} elseif (isset($_GET['convert'])) {
// update language tags
global $wpdb;
$wpdb->show_errors();
foreach ($q_config['enabled_languages'] as $lang) {
$wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[lang_' . $lang . ']","<!--:' . $lang . '-->")');
$wpdb->query('UPDATE ' . $wpdb->posts . ' set post_title = REPLACE(post_title, "[/lang_' . $lang . ']","<!--:-->")');
$wpdb->query('UPDATE ' . $wpdb->posts . ' set post_content = REPLACE(post_content, "[lang_' . $lang . ']","<!--:' . $lang . '-->")');
$wpdb->query('UPDATE ' . $wpdb->posts . ' set post_content = REPLACE(post_content, "[/lang_' . $lang . ']","<!--:-->")');
}
$message = "Database Update successful!";
} elseif (isset($_GET['markdefault'])) {
// update language tags
global $wpdb;
$wpdb->show_errors();
$result = $wpdb->get_results('SELECT ID, post_title, post_content FROM ' . $wpdb->posts . ' WHERE NOT (post_content LIKE "%<!--:-->%" OR post_title LIKE "%<!--:-->%")');
foreach ($result as $post) {
$content = qtrans_split($post->post_content);
$title = qtrans_split($post->post_title);
foreach ($q_config['enabled_languages'] as $language) {
if ($language != $q_config['default_language']) {
$content[$language] = "";
$title[$language] = "";
}
}
$content = qtrans_join($content);
$title = qtrans_join($title);
$wpdb->query('UPDATE ' . $wpdb->posts . ' set post_content = "' . mysql_escape_string($content) . '", post_title = "' . mysql_escape_string($title) . '" WHERE ID=' . $post->ID);
}
$message = "All Posts marked as default language!";
} elseif (isset($_GET['edit'])) {
$original_lang = $_GET['edit'];
$language_code = $_GET['edit'];
$language_name = $q_config['language_name'][$_GET['edit']];
$language_locale = $q_config['locale'][$_GET['edit']];
$language_date_format = $q_config['date_format'][$_GET['edit']];
$language_time_format = $q_config['time_format'][$_GET['edit']];
$language_na_message = $q_config['not_available'][$_GET['edit']];
$language_flag = $q_config['flag'][$_GET['edit']];
} elseif (isset($_GET['delete'])) {
// validate delete (protect code)
if ($q_config['default_language'] == $_GET['delete']) {
$error = 'Cannot delete Default Language!';
}
if (!isset($q_config['language_name'][$_GET['delete']]) || strtolower($_GET['delete']) == 'code') {
$error = 'No such language!';
}
if ($error == '') {
// everything seems fine, delete language
qtrans_disableLanguage($_GET['delete']);
unset($q_config['language_name'][$_GET['delete']]);
unset($q_config['flag'][$_GET['delete']]);
unset($q_config['locale'][$_GET['delete']]);
unset($q_config['date_format'][$_GET['delete']]);
unset($q_config['time_format'][$_GET['delete']]);
unset($q_config['not_available'][$_GET['delete']]);
}
} elseif (isset($_GET['enable'])) {
示例8: mqtrans_postUpdated
function mqtrans_postUpdated($post_ID, $after, $before)
{
global $wpdb, $q_config;
// Don't handle custom post types
if (!in_array($after->post_type, array('post', 'page')) && !in_array($after->post_type, $q_config['allowed_custom_post_types'])) {
return;
}
$titleMap = array();
$contentMap = array();
$cu = wp_get_current_user();
if ($cu->has_cap('edit_users') || empty($q_config['ul_lang_protection'])) {
$title = qtrans_split($after->post_title, true, $titleMap);
foreach ($title as $k => $v) {
if (qtrans_isEmptyContent($v)) {
unset($title[$k]);
}
}
$content = qtrans_split($after->post_content, true, $contentMap);
foreach ($content as $k => $v) {
if (qtrans_isEmptyContent($v)) {
unset($content[$k]);
}
}
} else {
$titleBeforeMap = array();
$titleBefore = qtrans_split($before->post_title, true, $titleBeforeMap);
$titleAfter = qtrans_split($after->post_title, true, $titleMap);
foreach ($titleAfter as $k => $v) {
if (!mqtrans_currentUserCanEdit($k)) {
unset($titleAfter[$k], $titleMap[$k]);
}
}
$title = array_merge($titleBefore, $titleAfter);
$titleMap = array_merge($titleBeforeMap, $titleMap);
$contentBeforeMap = array();
$contentBefore = qtrans_split($before->post_content, true, $contentBeforeMap);
$contentAfter = qtrans_split($after->post_content, true, $contentMap);
foreach ($contentAfter as $k => $v) {
if (qtrans_isEmptyContent($v) || !mqtrans_currentUserCanEdit($k)) {
unset($contentAfter[$k], $contentMap[$k]);
}
}
$content = array_merge($contentBefore, $contentAfter);
$contentMap = array_merge($contentBeforeMap, $contentMap);
}
$data = array('post_title' => qtrans_join($title, $titleMap), 'post_content' => qtrans_join($content, $contentMap));
if (get_magic_quotes_gpc()) {
$data = stripslashes_deep($data);
}
$where = array('ID' => $post_ID);
$wpdb->update($wpdb->posts, $data, $where);
}
示例9: save
function save($data = null, $validate = true)
{
global $wpdb;
$this->errors = false;
$defaults = method_exists($this, 'defaults') ? $this->defaults() : false;
$data = empty($data[$this->model]) ? $data : $data[$this->model];
$r = wp_parse_args($data, $defaults);
$this->data = (object) $r;
switch ($this->model) {
case 'Slide':
if ($this->language_do()) {
$this->data->title = qtrans_join($this->data->title);
$this->data->description = qtrans_join($this->data->description);
}
break;
case 'Gallery':
if ($this->language_do()) {
$this->data->title = qtrans_join($this->data->title);
}
break;
}
if ($validate == true) {
if (method_exists($this, 'validate')) {
$this->validate((array) $this->data);
}
}
if (empty($this->errors)) {
switch ($this->model) {
case 'Slide':
if ($this->data->type == "file") {
//$this -> data -> image = $_FILES['image_file']['name'];
} else {
$this->data->image = basename($this->data->image_url);
}
if (empty($this->data->uselink) || $this->data->uselink == "N") {
$this->data->link = "";
}
break;
}
$query = empty($this->data->id) ? $this->insert_query($this->model) : $this->update_query($this->model);
if ($wpdb->query($query)) {
$this->insertid = $insertid = empty($this->data->id) ? $wpdb->insert_id : $this->data->id;
switch ($this->model) {
case 'Slide':
$slide_id = $this->insertid;
$deletequery = "DELETE FROM `" . $wpdb->prefix . strtolower($this->pre) . "_galleriesslides` WHERE `slide_id` = '" . $slide_id . "'";
$wpdb->query($deletequery);
if (!empty($this->data->galleries)) {
foreach ($this->data->galleries as $gallery_id) {
$date = date("Y-m-d H:i:s", time());
$galleryslidequery = "INSERT INTO `" . $wpdb->prefix . strtolower($this->pre) . "_galleriesslides` (`slide_id`, `gallery_id`, `created`, `modified`) VALUES ('" . $slide_id . "', '" . $gallery_id . "', '" . $date . "', '" . $date . "');";
$wpdb->query($galleryslidequery);
}
}
break;
}
return true;
}
}
return false;
}
示例10: _soundmap_mountPostTitle
function _soundmap_mountPostTitle($info)
{
$t = "";
if (function_exists("qtrans_init")) {
//we are using multilanguage;
global $q_config;
foreach ($q_config['enabled_languages'] as $key => $value) {
$sel_Lang = $value;
$lang_Name = $q_config['language_name'][$sel_Lang];
$texts[$sel_Lang] = $info["title_" . $sel_Lang];
}
$t = qtrans_join($texts);
}
return $t;
}