function copy_from_original()
    {
        global $wpdb;
        $show = false;
        $trid = false;
        $source_lang = false;
        $source_lang_name = false;
        $disabled = '';
        if (isset($_GET['source_lang']) && isset($_GET['trid'])) {
            $source_lang = $_GET['source_lang'];
            $trid = intval($_GET['trid']);
            $_lang_details = $this->get_language_details($source_lang);
            $source_lang_name = $_lang_details['display_name'];
            $show = true;
        } elseif (isset($_GET['post']) && isset($_GET['lang']) && $_GET['lang'] != $this->get_default_language()) {
            global $post;
            if (trim($post->post_content)) {
                $disabled = ' disabled="disabled"';
            }
            $trid = $this->get_element_trid($post->ID, 'post_' . $post->post_type);
            $source_lang = $wpdb->get_var($wpdb->prepare("SELECT language_code FROM {$wpdb->prefix}icl_translations WHERE source_language_code IS NULL AND trid=%d", $trid));
            $_lang_details = $this->get_language_details($source_lang);
            $source_lang_name = $_lang_details['display_name'];
            $show = true && $source_lang;
        }
        if ($show) {
            wp_nonce_field('copy_from_original_nonce', '_icl_nonce_cfo_' . $trid);
            echo '<input id="icl_cfo" class="button-secondary" type="button" value="' . sprintf(__('Copy content from %s', 'sitepress'), $source_lang_name) . '"
				onclick="icl_copy_from_original(\'' . esc_js($source_lang) . '\', \'' . esc_js($trid) . '\')"' . $disabled . ' style="white-space:normal;height:auto;line-height:normal;"/>';
            icl_pop_info(__("This operation copies the content from the original language onto this translation. It's meant for when you want to start with the original content, but keep translating in this language. This button is only enabled when there's no content in the editor.", 'sitepress'), 'question');
            echo '<br clear="all" />';
        }
    }
            $link['flag'] = str_replace('<img ', '<img style="float:right;margin-right:0;margin-left:4px;" ', $link['flag']);
        }
        ?>
                    <div class="icl-als-action"><a href="<?php 
        echo $link['url'];
        ?>
"><?php 
        echo $link['flag'];
        echo $link['anchor'];
        ?>
</a></div>
                <?php 
    }
}
?>
            </div>
    </div>

    <?php 
if (!$this->is_rtl()) {
    ?>
    <div id="icl-als-info">
    <?php 
    icl_pop_info(sprintf(__('This language selector determines which content to display. You can choose items in a specific language or in all languages. To change the language of the WordPress Admin interface, go to <a%s>your profile</a>.', 'sitepress'), ' href="' . admin_url('profile.php') . '"'), 'question');
    ?>
    </div>
    <?php 
}
?>

</span>
    } elseif ($element->field_format == 'csv_base64') {
        ?>
                                <?php 
        foreach ($icl_tm_original_content as $c) {
            ?>
                                <div class="icl_multiple"<?php 
            echo $rtl_original_attribute;
            ?>
>
                                    <div style="float: left;margin-right:4px;"><?php 
            echo $c;
            ?>
</div>
                                    <?php 
            if (isset($term_descriptions[$c])) {
                icl_pop_info($term_descriptions[$c], 'info', array('icon_size' => 10));
            }
            ?>
                                    <br clear="all"/>
                                </div>
                                <?php 
        }
        ?>
                                <?php 
    } else {
        ?>
                                <div class="icl_single"<?php 
        if ($rtl_original) {
            echo ' dir="rtl" style="text-align:right;"';
        } else {
            echo ' dir="ltr" style="text-align:left;"';
    /**
     * Renders the "Overwrite" button on the post edit screen that allows setting the post as a duplicate of its
     * original.
     *
     * @param WP_Post $post
     * @param string  $source_lang_name
     * @param int     $original_post_id
     * @param string  $post_lang
     */
    private function display_set_as_dupl_btn($post, $source_lang_name, $original_post_id, $post_lang)
    {
        wp_nonce_field('set_duplication_nonce', '_icl_nonce_sd');
        ?>
		<input id="icl_set_duplicate" type="button" class="button-secondary"
		       value="<?php 
        printf(__('Overwrite with %s content.', 'sitepress'), $source_lang_name);
        ?>
"
		       style="white-space:normal;height:auto;line-height:normal;"
		       data-wpml_original_post_id="<?php 
        echo $original_post_id;
        ?>
"
		       data-post_lang="<?php 
        echo $post_lang;
        ?>
"/>
		<span style="display: none;"><?php 
        echo esc_js(sprintf(__('The current content of this %s will be permanently lost. WPML will copy the %s content and replace the current content.', 'sitepress'), $post->post_type, $source_lang_name));
        ?>
</span>
		<?php 
        icl_pop_info(__("This operation will synchronize this translation with the original language. When you edit the original, this translation will update immediately. It's meant when you want the content in this language to always be the same as the content in the original language.", 'sitepress'), 'question');
        ?>
		<br clear="all"/>
		<?php 
    }
示例#5
0
            }
        }
    }
    if ($tr_original_id != $post->ID && $show_dup_button) {
        ?>
    <?php 
        wp_nonce_field('set_duplication_nonce', '_icl_nonce_sd');
        ?>
    <input id="icl_set_duplicate" type="button" class="button-secondary" value="<?php 
        printf(__('Overwrite with %s content.', 'sitepress'), $original_language);
        ?>
" style="float: left;" />
    <span style="display: none;"><?php 
        echo esc_js(sprintf(__('The current content of this %s will be permanently lost. WPML will copy the %s content and replace the current content.', 'sitepress'), $post->post_type, $original_language));
        ?>
</span>
    <?php 
        icl_pop_info(__("This operation will synchronize this translation with the original language. When you edit the original, this translation will update immediately. It's meant when you want the content in this language to always be the same as the content in the original language.", 'sitepress'), 'question');
        ?>
    <br clear="all" />
    
    
<?php 
    }
    ?>
    
<?php 
}
?>

示例#6
0
    private function render_current_element_field_original_csv_base64()
    {
        foreach ($this->current_element_content_original as $c) {
            ?>
			<div class="icl_multiple"<?php 
            echo $this->rtl_original_attribute_object;
            ?>
>
				<div style="float: left;margin-right:4px;"><?php 
            echo $c;
            ?>
</div>
				<?php 
            if (isset($term_descriptions[$c])) {
                icl_pop_info($term_descriptions[$c], 'info', array('icon_size' => 10));
            }
            ?>
				<br clear="all"/>
			</div>
		<?php 
        }
    }