PluginProbe
Polylang / 1.8.2
Polylang v1.8.2
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / admin / view-translations-post.php

view-translations-post.php in Polylang 1.8.2, at admin/view-translations-post.php

54 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * displays the translations fields for posts
5 */
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // don't access directly
9 };
10 ?>
11 <p><strong><?php _e( 'Translations', 'polylang' ); ?></strong></p>
12 <?php do_action( 'pll_before_post_translations' ) ?>
13 <table><?php
14 foreach ( $this->model->get_languages_list() as $language ) {
15 if ( $language->term_id == $lang->term_id ) {
16 continue;
17 }
18
19 $value = $this->model->post->get_translation( $post_ID, $language );
20 if ( ! $value || $value == $post_ID ) { // $value == $post_ID happens if the post has been ( auto )saved before changing the language
21 $value = '';
22 }
23
24 if ( isset( $_GET['from_post'] ) ) {
25 $value = $this->model->post->get( (int) $_GET['from_post'], $language );
26 }
27
28 $link = $add_link = $this->links->new_post_translation_link( $post_ID, $language );
29
30 if ( $value ) {
31 $selected = get_post( $value );
32 $link = $this->links->edit_post_translation_link( $value );
33 } ?>
34
35 <tr>
36 <th class = "pll-language-column"><?php echo $language->flag ? $language->flag : esc_html( $language->slug ); ?></th>
37 <td class = "hidden"><?php echo $add_link;?></td>
38 <td class = "pll-edit-column"><?php echo $link;?></td>
39 <td class = "pll-translation-column"><?php
40 printf( '
41 <label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
42 <input type="hidden" name="post_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s"/>
43 <input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s>',
44 esc_attr( $language->slug ),
45 __( 'Translation', 'polylang' ),
46 empty( $value ) ? 0 : esc_attr( $selected->ID ),
47 empty( $value ) ? '' : esc_attr( $selected->post_title ),
48 empty( $link ) ? ' disabled="disabled"' : ''
49 ); ?>
50 </td>
51 </tr><?php
52 }?>
53 </table>
54