web/app/plugins/wpml-string-translation/inc/functions.php
// fix links in existing strings according to the new translation added
fix links in existing strings according to the new translation added
fix links in existing strings according to the new translation added
function icl_st_fix_links_in_strings($post_id){
    static $runnonce = false;
    if($runnonce){
        return;
    }
    $runonce = true;
    if(isset($_POST['autosave']) && $_POST['autosave']) return;
    if(isset($_POST['post_ID'])){
        $post_id = $_POST['post_ID'];
    }
    global $wpdb, $sitepress;
    $language = $wpdb->get_var($wpdb->prepare("SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE element_type='post' AND element_id=%d", $post_id));    
    if($language){
        if($sitepress->get_default_language()==$language){
            $strings = $wpdb->get_col($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_strings WHERE language=%s",$language));
        }else{
            $strings = $wpdb->get_col($wpdb->prepare("SELECT id FROM {$wpdb->prefix}icl_string_translations WHERE language=%s",$language));
        }
        foreach($strings as $string_id){
            _icl_content_fix_links_to_translated_content($string_id, $language, 'string');
        }
    }
}
function icl_st_fix_links_in_strings ( $ post_id ) { static $ runnonce = false ; if ( $ runnonce ) { return ; } $ runonce = true ; if ( isset ( $ _POST [ 'autosave' ] ) && $ _POST [ 'autosave' ] ) return ; if ( isset ( $ _POST [ 'post_ID' ] ) ) { $ post_id = $ _POST [ 'post_ID' ] ; } global $ wpdb , $ sitepress ; $ language = $ wpdb -> get_var ( $ wpdb -> prepare ( " SELECT language_code FROM  { $ wpdb -> prefix } icl_translations WHERE element_type='post' AND element_id=%d " , $ post_id ) ) ; if ( $ language ) { if ( $ sitepress -> get_default_language ( ) == $ language ) { $ strings = $ wpdb -> get_col ( $ wpdb -> prepare ( " SELECT id FROM  { $ wpdb -> prefix } icl_strings WHERE language=%s " , $ language ) ) ; } else { $ strings = $ wpdb -> get_col ( $ wpdb -> prepare ( " SELECT id FROM  { $ wpdb -> prefix } icl_string_translations WHERE language=%s " , $ language ) ) ; } foreach ( $ strings as $ string_id ) { _icl_content_fix_links_to_translated_content ( $ string_id , $ language , 'string' ) ; } } }
fix links in existing strings according to the new translation added
fix links in existing strings according to the new translation added