PluginProbe
Polylang / 2.6.3
Polylang v2.6.3
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 2.6.3, at admin/view-translations-post.php

71 lines 2.3 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 esc_html_e( 'Translations', 'polylang' ); ?></strong></p>
12 <table>
13 <?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 ( ! empty( $from_post_id ) ) {
25 $value = $this->model->post->get( $from_post_id, $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 ); // phpcs:ignore WordPress.Security.EscapeOutput ?></th>
37 <td class = "hidden"><?php echo $add_link; // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
38 <td class = "pll-edit-column pll-column-icon"><?php echo $link; // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
39 <?php
40
41 /**
42 * Fires before the translation column is outputted in the language metabox
43 * The dynamic portion of the hook name, `$lang`, refers to the language code
44 *
45 * @since 2.1
46 */
47 do_action( 'pll_before_post_translation_' . $language->slug );
48 ?>
49 <td class = "pll-translation-column">
50 <?php
51 printf(
52 '<label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
53 <input type="hidden" name="post_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s" />
54 <span lang="%6$s" dir="%7$s"><input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s /></span>',
55 esc_attr( $language->slug ),
56 /* translators: accessibility text */
57 esc_html__( 'Translation', 'polylang' ),
58 ( empty( $value ) ? 0 : esc_attr( $selected->ID ) ),
59 ( empty( $value ) ? '' : esc_attr( $selected->post_title ) ),
60 disabled( empty( $link ), true, false ),
61 esc_attr( $language->get_locale( 'display' ) ),
62 ( $language->is_rtl ? 'rtl' : 'ltr' )
63 );
64 ?>
65 </td>
66 </tr>
67 <?php
68 }
69 ?>
70 </table>
71