当前位置: 首页>>代码示例>>PHP>>正文


PHP qtrans_join函数代码示例

本文整理汇总了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;
 }
开发者ID:warruda,项目名称:portalsaudecrianca,代码行数:7,代码来源:textarea.php

示例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;
}
开发者ID:xenda,项目名称:camaraitalia,代码行数:36,代码来源:qtranslate_services.php

示例3: update_value

 function update_value($value, $post_id, $field)
 {
     return qtrans_join($value);
 }
开发者ID:AndreyLanko,项目名称:perevorot-prozorro-wp,代码行数:4,代码来源:wysiwyg.php

示例4: update_value

 function update_value($value, $post_id, $field)
 {
     $value = parent::update_value($value, $post_id, $field);
     return qtrans_join($value);
 }
开发者ID:Tusko,项目名称:acf-qtranslate,代码行数:5,代码来源:file.php

示例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));
 }
开发者ID:shesser,项目名称:selenenw,代码行数:14,代码来源:UF_Qtranslate.php

示例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);
     }
 }
开发者ID:popovdenis,项目名称:kmst,代码行数:28,代码来源:qtranslate-meta.php

示例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'])) {
开发者ID:alubeck,项目名称:qTranslate,代码行数:67,代码来源:qtranslate_configuration.php

示例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);
}
开发者ID:Roman921,项目名称:Step-21,代码行数:52,代码来源:mqtranslate_xhaleera_addons.php

示例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;
 }
开发者ID:HeliWang,项目名称:EngSoc-Website,代码行数:61,代码来源:db.php

示例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;
}
开发者ID:sluna,项目名称:SoundMap-Wordpress-Plugin,代码行数:15,代码来源:soundmap.php


注:本文中的qtrans_join函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。