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


PHP icl_update_string_status函数代码示例

本文整理汇总了PHP中icl_update_string_status函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_update_string_status函数的具体用法?PHP icl_update_string_status怎么用?PHP icl_update_string_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了icl_update_string_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: change_language_of_strings

 /**
  * @param int[] $strings
  * @param string $lang
  *
  * @return array
  */
 public function change_language_of_strings($strings, $lang)
 {
     $package_translation = new WPML_Package_Helper();
     $response = $package_translation->change_language_of_strings($strings, $lang);
     if ($response['success']) {
         $strings_in = implode(',', $strings);
         $update_query = "UPDATE {$this->wpdb->prefix}icl_strings SET language=%s WHERE id IN ({$strings_in})";
         $update_prepare = $this->wpdb->prepare($update_query, $lang);
         $this->wpdb->query($update_prepare);
         $response['success'] = true;
         foreach ($strings as $string) {
             icl_update_string_status($string);
         }
     }
     return $response;
 }
开发者ID:studiopengpeng,项目名称:ASCOMETAL,代码行数:22,代码来源:class-wpml-change-string-language-dialog.php

示例2: migrate_old_translated_values

 private function migrate_old_translated_values($form_id)
 {
     global $wpdb;
     $st_context = $this->tm_api->get_st_context($form_id);
     $form_strings = array_keys($this->tm_api->get_form_strings($form_id));
     foreach ($form_strings as &$string_name) {
         $string_name = "{$form_id}_" . $string_name;
     }
     $s_name_in = wpml_prepare_in($form_strings);
     $id_s_needing_update = $wpdb->get_results($wpdb->prepare("SELECT st.id AS id, cs.id AS right_id\n                 FROM {$wpdb->prefix}icl_strings s\n                 JOIN {$wpdb->prefix}icl_strings cs\n                  ON CONCAT(%s,cs.name) = s.name\n                 JOIN {$wpdb->prefix}icl_string_translations st\n                  ON s.id = st.string_id\n                 LEFT JOIN {$wpdb->prefix}icl_string_translations cst\n                  ON cs.id = cst.string_id AND st.language = cst.language\n                 WHERE s.context = 'gravity_form'\n                  AND cs.context = %s\n                  AND cst.language IS NULL\n                  AND s.name IN ({$s_name_in})", $form_id . '_', $st_context));
     foreach ($id_s_needing_update as $id_data) {
         $wpdb->update($wpdb->prefix . 'icl_string_translations', array('string_id' => $id_data->right_id), array('id' => $id_data->id));
         icl_update_string_status($id_data->right_id);
         icl_update_string_status($id_data->id);
     }
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:16,代码来源:gfml-migration.class.php

示例3: get_post_type_object

                     $post_type_obj = get_post_type_object($type);
                     $slug = $post_type_obj->rewrite['slug'];
                     $string_id = $wpdb->get_var($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE name = %s AND value = %s ", 'URL slug: ' . $slug, $slug));
                     if (empty($string_id)) {
                         $string_id = icl_register_string('WordPress', 'URL slug: ' . $slug, $slug);
                     }
                     if ($string_id) {
                         foreach ($this->get_active_languages() as $lang) {
                             $string_translation_settings = $this->get_setting('st');
                             if ($lang['code'] != $string_translation_settings['strings_language']) {
                                 $data['langs'][$lang['code']] = join('/', array_map('sanitize_title_with_dashes', explode('/', $data['langs'][$lang['code']])));
                                 $data['langs'][$lang['code']] = urldecode($data['langs'][$lang['code']]);
                                 icl_add_string_translation($string_id, $lang['code'], $data['langs'][$lang['code']], ICL_STRING_TRANSLATION_COMPLETE);
                             }
                         }
                         icl_update_string_status($string_id);
                     }
                 }
             }
         }
         if (isset($iclsettings)) {
             $this->save_settings($iclsettings);
         }
     }
     echo '1|';
     break;
 case 'copy_from_original':
     /*
      * apply filtering as to add further elements
      * filters will have to like as such
      * add_filter('wpml_copy_from_original_fields', 'my_copy_from_original_fields');
开发者ID:PHQ-Design,项目名称:souza-lima,代码行数:31,代码来源:ajax.php

示例4: save_string

 private function save_string($value, $allow_empty_value, $language, $context, $name)
 {
     if (($name || $value) && (!empty($value) && is_scalar($value) && trim($value) || $allow_empty_value)) {
         global $wpdb;
         $name = trim($name) ? $name : md5($value);
         $string = array('language' => $language, 'context' => $context, 'name' => $name, 'value' => $value, 'status' => ICL_TM_NOT_TRANSLATED);
         $wpdb->insert($wpdb->prefix . 'icl_strings', $string);
         $string_id = $wpdb->insert_id;
         icl_update_string_status($string_id);
     } else {
         $string_id = 0;
     }
     return $string_id;
 }
开发者ID:edgarter,项目名称:wecare,代码行数:14,代码来源:wpml-admin-string-filter.class.php

示例5: save_sync_options

 static function save_sync_options()
 {
     global $sitepress, $wpdb;
     $slug_settings = $sitepress->get_setting('posts_slug_translation');
     if (isset($slug_settings['on']) && $slug_settings['on'] && !empty($_POST['translate_slugs'])) {
         foreach ($_POST['translate_slugs'] as $type => $data) {
             $slug_settings['types'][$type] = isset($data['on']) ? intval(!empty($data['on'])) : false;
             if (empty($slug_settings['types'][$type])) {
                 continue;
             }
             $post_type_obj = get_post_type_object($type);
             $slug = trim($post_type_obj->rewrite['slug'], '/');
             $string_id = $wpdb->get_var(self::get_sql_to_get_string_id($slug));
             $string_id = empty($string_id) ? icl_register_string('WordPress', 'URL slug: ' . $slug, $slug) : $string_id;
             if ($string_id) {
                 foreach ($sitepress->get_active_languages() as $lang) {
                     $string_translation_settings = $sitepress->get_setting('st');
                     if ($lang['code'] != $string_translation_settings['strings_language']) {
                         $data['langs'][$lang['code']] = join('/', array_map(array('WPML_Slug_Translation', 'sanitize'), explode('/', $data['langs'][$lang['code']])));
                         $data['langs'][$lang['code']] = urldecode($data['langs'][$lang['code']]);
                         icl_add_string_translation($string_id, $lang['code'], $data['langs'][$lang['code']], ICL_TM_COMPLETE);
                     }
                 }
                 icl_update_string_status($string_id);
             }
         }
     }
     $sitepress->set_setting('posts_slug_translation', $slug_settings, true);
 }
开发者ID:fdelarosa191,项目名称:iftheme-docs,代码行数:29,代码来源:slug-translation.php

示例6: save_string

 private function save_string($value, $allow_empty_value, $language, $domain, $context, $name)
 {
     if ($allow_empty_value || $value) {
         $this->wpdb->insert($this->wpdb->prefix . 'icl_strings', array('language' => $language, 'context' => $domain, 'gettext_context' => $context, 'domain_name_context_md5' => md5($domain . $name . $context), 'name' => $name, 'value' => $value, 'status' => ICL_TM_NOT_TRANSLATED));
         $string_id = $this->wpdb->insert_id;
         if ($string_id === 0) {
             throw new Exception('Count not add String with arguments: value: ' . $value . ' allow_empty_value:' . $allow_empty_value . ' language: ' . $language);
         }
         icl_update_string_status($string_id);
         $key = md5($domain . $name . $context);
         $this->registered_string_cache[$domain][$key] = array('id' => $string_id, 'value' => $value);
     } else {
         $string_id = 0;
     }
     return $string_id;
 }
开发者ID:agiper,项目名称:wordpress,代码行数:16,代码来源:class-wpml-admin-string-filter.php

示例7: set_translation

 /**
  * @param string          $language
  * @param string|null     $value
  * @param int|bool|false  $status
  * @param int|null        $translator_id
  * @param string|int|null $translation_service
  * @param int|null        $batch_id
  *
  * @return bool|int id of the translation
  */
 public function set_translation($language, $value = null, $status = false, $translator_id = null, $translation_service = null, $batch_id = null)
 {
     /** @var $ICL_Pro_Translation WPML_Pro_Translation */
     global $ICL_Pro_Translation;
     $res = $this->wpdb->get_row($this->wpdb->prepare("SELECT id, value, status\n                                          " . $this->from_where_snippet(true) . " AND language=%s", $language));
     if (isset($res->status) && $res->status == ICL_TM_WAITING_FOR_TRANSLATOR && is_null($value)) {
         return false;
     }
     $translation_data = array();
     if ($translation_service) {
         $translation_data['translation_service'] = $translation_service;
     }
     if ($batch_id) {
         $translation_data['batch_id'] = $batch_id;
     }
     if (!is_null($value)) {
         $translation_data['value'] = $value;
     }
     if ($translator_id) {
         $translation_data['translator_id'] = $translator_id;
     }
     if ($res) {
         $st_id = $res->id;
         if ($status) {
             $translation_data['status'] = $status;
         } elseif ($status === ICL_TM_NOT_TRANSLATED) {
             $translation_data['status'] = ICL_TM_NOT_TRANSLATED;
         }
         if (!empty($translation_data)) {
             $st_update['translation_date'] = current_time("mysql");
             $this->wpdb->update($this->wpdb->prefix . 'icl_string_translations', $translation_data, array('id' => $st_id));
         }
     } else {
         $translation_data = array_merge($translation_data, array('string_id' => $this->string_id, 'language' => $language, 'status' => $status ? $status : ICL_TM_NOT_TRANSLATED));
         $this->wpdb->insert($this->wpdb->prefix . 'icl_string_translations', $translation_data);
         $st_id = $this->wpdb->insert_id;
     }
     if ($ICL_Pro_Translation) {
         $ICL_Pro_Translation->_content_fix_links_to_translated_content($st_id, $language, 'string');
     }
     icl_update_string_status($this->string_id);
     do_action('icl_st_add_string_translation', $st_id);
     return $st_id;
 }
开发者ID:aarongillett,项目名称:B22-151217,代码行数:54,代码来源:class-wpml-st-string.php

示例8: save_string

 private function save_string($value, $allow_empty_value, $language, $domain, $context, $name)
 {
     if (($name || $value) && (!empty($value) && is_scalar($value) && trim($value) || $allow_empty_value)) {
         $name = trim($name) ? $name : md5($value);
         $string = array('language' => $language, 'context' => $domain, 'gettext_context' => $context, 'domain_name_context_md5' => md5($domain . $name . $context), 'name' => $name, 'value' => $value, 'status' => ICL_TM_NOT_TRANSLATED);
         $this->wpdb->insert($this->wpdb->prefix . 'icl_strings', $string);
         $string_id = $this->wpdb->insert_id;
         icl_update_string_status($string_id);
         $key = md5($domain . $name . $context);
         $this->registered_string_cache[$domain][$key] = array('id' => $string_id, 'value' => $value);
     } else {
         $string_id = 0;
     }
     return $string_id;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:15,代码来源:class-wpml-admin-string-filter.php

示例9: __

     $nid = (int) $_POST['post_id'];
     $md5 = $wpdb->get_var("SELECT md5 FROM {$wpdb->prefix}icl_node WHERE nid={$nid}");
     $wpdb->query("UPDATE {$wpdb->prefix}icl_content_status SET md5 = '{$md5}' WHERE nid='{$nid}'");
     echo __('Needs update', 'sitepress');
     echo '|';
     echo __('Complete', 'sitepress');
     break;
 case 'icl_st_save_translation':
     $icl_st_complete = isset($_POST['icl_st_translation_complete']) ? $_POST['icl_st_translation_complete'] : ICL_STRING_TRANSLATION_NOT_TRANSLATED;
     if (get_magic_quotes_gpc()) {
         $_POST = stripslashes_deep($_POST);
     }
     echo icl_add_string_translation($_POST['icl_st_string_id'], $_POST['icl_st_language'], stripslashes($_POST['icl_st_translation']), $icl_st_complete);
     echo '|';
     global $icl_st_string_translation_statuses;
     echo $icl_st_string_translation_statuses[icl_update_string_status($_POST['icl_st_string_id'])];
     break;
 case 'icl_st_delete_strings':
     $arr = explode(',', $_POST['value']);
     __icl_unregister_string_multi($arr);
     break;
 case 'icl_st_send_strings':
     $arr = explode(',', $_POST['strings']);
     icl_translation_send_strings($arr, explode('#', $_POST['languages']));
     echo '1';
     break;
 case 'icl_st_send_strings_all':
     icl_translation_send_untranslated_strings(explode(',', $_POST['languages']));
     echo '1';
     break;
 case 'icl_save_theme_localization_type':
开发者ID:winyatasenjaya,项目名称:sitepress-multilingual-cms,代码行数:31,代码来源:ajax.php

示例10: cancel_local_translation

 function cancel_local_translation($id, $return_original_id = false)
 {
     global $wpdb;
     $string_id = $wpdb->get_var($wpdb->prepare("\tSELECT string_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM {$wpdb->prefix}icl_string_translations\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE id=%d AND status IN (%d, %d)", $id, ICL_TM_IN_PROGRESS, ICL_TM_WAITING_FOR_TRANSLATOR));
     if ($string_id) {
         $wpdb->update($wpdb->prefix . 'icl_string_translations', array('status' => ICL_TM_NOT_TRANSLATED, 'translation_service' => null, 'translator_id' => null, 'batch_id' => null), array('id' => $id));
         icl_update_string_status($string_id);
         $res = $return_original_id ? $string_id : $id;
     } else {
         $res = false;
     }
     return $res;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:13,代码来源:wpml-string-translation.class.php

示例11: icl_add_string_translation

function icl_add_string_translation($string_id, $language, $value = null, $status = false, $translator_id = null)
{
    global $wpdb;
    $res = $wpdb->get_row("SELECT id, value, status FROM {$wpdb->prefix}icl_string_translations WHERE string_id='" . $wpdb->escape($string_id) . "' AND language='" . $wpdb->escape($language) . "'");
    // the same string should not be sent two times to translation
    if (isset($res->status) && $res->status == ICL_STRING_TRANSLATION_WAITING_FOR_TRANSLATOR && is_null($value)) {
        return false;
    }
    if ($res) {
        $st_id = $res->id;
        $st_update = array();
        if (!is_null($value) && $value != $res->value) {
            // null $value is for sending to translation. don't override existing.
            $st_update['value'] = $value;
        }
        if ($status) {
            $st_update['status'] = $status;
        } elseif ($status === ICL_STRING_TRANSLATION_NOT_TRANSLATED) {
            $st_update['status'] = ICL_STRING_TRANSLATION_NOT_TRANSLATED;
        }
        if (!empty($st_update)) {
            if (!is_null($translator_id)) {
                $st_update['translator_id'] = get_current_user_id();
            }
            $st_update['translation_date'] = current_time("mysql");
            $wpdb->update($wpdb->prefix . 'icl_string_translations', $st_update, array('id' => $st_id));
        }
    } else {
        if (!$status) {
            $status = ICL_STRING_TRANSLATION_NOT_TRANSLATED;
        }
        $st = array('string_id' => $string_id, 'language' => $language, 'status' => $status);
        if (!is_null($value)) {
            $st['value'] = $value;
        }
        if (!is_null($translator_id)) {
            $st_update['translator_id'] = get_current_user_id();
        }
        $wpdb->insert($wpdb->prefix . 'icl_string_translations', $st);
        $st_id = $wpdb->insert_id;
    }
    $GLOBALS['ICL_Pro_Translation']->_content_fix_links_to_translated_content($st_id, $language, 'string');
    icl_update_string_status($string_id);
    do_action('icl_st_add_string_translation', $st_id);
    return $st_id;
}
开发者ID:envickery,项目名称:staging.xylemwatermark.org,代码行数:46,代码来源:functions.php

示例12: translate_strings

 /**
  * Auto translate strings with given context
  *
  * @param $context
  * @param $languages
  * @param $template
  */
 private function translate_strings($context, $languages, $template)
 {
     global $wpdb;
     //get all not translated strings (status <> 1)
     if (0 === strcmp($context, 'all_contexts')) {
         $strings = $wpdb->get_results("SELECT id, language, context, value FROM {$wpdb->prefix}icl_strings");
     } else {
         $strings = $wpdb->get_results($wpdb->prepare("SELECT id, language, context, value FROM {$wpdb->prefix}icl_strings WHERE context=%s", $context));
     }
     //for each string add information
     foreach ($strings as $v) {
         foreach ($languages as $lang) {
             icl_add_string_translation($v->id, $lang, wpml_ctt_prepare_string($template, $v->value, $lang), TRUE);
             icl_update_string_status($v->id);
         }
     }
 }
开发者ID:sonvq,项目名称:passioninvestment,代码行数:24,代码来源:wpml-compatibility-test-tools.class.php

示例13: icl_update_string_status_all

function icl_update_string_status_all()
{
    global $wpdb;
    $res = $wpdb->get_col("SELECT id FROM {$wpdb->prefix}icl_strings");
    foreach ($res as $id) {
        icl_update_string_status($id);
    }
}
开发者ID:phuocdungit,项目名称:phuocdungit.xyz,代码行数:8,代码来源:functions.php

示例14: icl_add_string_translation

function icl_add_string_translation($string_id, $language, $value = null, $status = false, $translator_id = null, $translation_service = null, $batch_id = null)
{
    global $wpdb, $sitepress;
    $current_user = $sitepress->get_current_user();
    $res = $wpdb->get_row($wpdb->prepare("SELECT id, value, status\r\n                                          FROM {$wpdb->prefix}icl_string_translations\r\n                                          WHERE string_id=%d AND language=%s", $string_id, $language));
    // the same string should not be sent two times to translation
    if (isset($res->status) && $res->status == ICL_TM_WAITING_FOR_TRANSLATOR && is_null($value)) {
        return false;
    }
    if ($res) {
        $st_id = $res->id;
        $st_update = array();
        if (!is_null($value) && $value != $res->value) {
            // null $value is for sending to translation. don't override existing.
            $st_update['value'] = $value;
        }
        if ($status) {
            $st_update['status'] = $status;
        } elseif ($status === ICL_TM_NOT_TRANSLATED) {
            $st_update['status'] = ICL_TM_NOT_TRANSLATED;
        }
        if (!empty($st_update)) {
            if (!is_null($translator_id)) {
                $st_update['translator_id'] = $current_user->ID;
            }
            if ($translation_service) {
                $st_update['translation_service'] = $translation_service;
            }
            if ($batch_id) {
                $st_update['batch_id'] = $batch_id;
            }
            $st_update['translation_date'] = current_time("mysql");
            $wpdb->update($wpdb->prefix . 'icl_string_translations', $st_update, array('id' => $st_id));
        }
    } else {
        if (!$status) {
            $status = ICL_TM_NOT_TRANSLATED;
        }
        $st = array('string_id' => $string_id, 'language' => $language, 'status' => $status);
        if (!is_null($value)) {
            $st['value'] = $value;
        }
        if (is_null($translator_id)) {
            $st['translator_id'] = $current_user->ID;
        } else {
            $st['translator_id'] = $translator_id;
        }
        if ($translation_service) {
            $st['translation_service'] = $translation_service;
        }
        if ($batch_id) {
            $st['batch_id'] = $batch_id;
        }
        $wpdb->insert($wpdb->prefix . 'icl_string_translations', $st);
        $st_id = $wpdb->insert_id;
    }
    /** @var $ICL_Pro_Translation WPML_Pro_Translation */
    global $ICL_Pro_Translation;
    if ($ICL_Pro_Translation) {
        $ICL_Pro_Translation->_content_fix_links_to_translated_content($st_id, $language, 'string');
    }
    icl_update_string_status($string_id);
    do_action('icl_st_add_string_translation', $st_id);
    return $st_id;
}
开发者ID:edgarter,项目名称:wecare,代码行数:65,代码来源:functions.php

示例15: cancel_local_translation

 function cancel_local_translation()
 {
     global $wpdb;
     $id = $_POST['id'];
     $string_id = $wpdb->get_var($wpdb->prepare("SELECT string_id FROM {$wpdb->prefix}icl_string_translations WHERE id=%d", $id));
     $wpdb->update($wpdb->prefix . 'icl_string_translations', array('status' => ICL_STRING_TRANSLATION_NOT_TRANSLATED), array('id' => $id));
     icl_update_string_status($string_id);
     echo json_encode(array('string_id' => $string_id));
     exit;
 }
开发者ID:Calraiser,项目名称:flux,代码行数:10,代码来源:wpml-string-translation.class.php


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