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

72 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 * Displays the translations fields for posts
4 *
5 * @package Polylang
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Don't access directly
10 };
11 ?>
12 <p><strong><?php esc_html_e( 'Translations', 'polylang' ); ?></strong></p>
13 <table>
14 <?php
15 foreach ( $this->model->get_languages_list() as $language ) {
16 if ( $language->term_id == $lang->term_id ) {
17 continue;
18 }
19
20 $value = $this->model->post->get_translation( $post_ID, $language );
21 if ( ! $value || $value == $post_ID ) { // $value == $post_ID happens if the post has been (auto)saved before changing the language
22 $value = '';
23 }
24
25 if ( ! empty( $from_post_id ) ) {
26 $value = $this->model->post->get( $from_post_id, $language );
27 }
28
29 $link = $add_link = $this->links->new_post_translation_link( $post_ID, $language );
30
31 if ( $value ) {
32 $selected = get_post( $value );
33 $link = $this->links->edit_post_translation_link( $value );
34 }
35 ?>
36 <tr>
37 <th class = "pll-language-column"><?php echo $language->flag ? $language->flag : esc_html( $language->slug ); // phpcs:ignore WordPress.Security.EscapeOutput ?></th>
38 <td class = "hidden"><?php echo $add_link; // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
39 <td class = "pll-edit-column pll-column-icon"><?php echo $link; // phpcs:ignore WordPress.Security.EscapeOutput ?></td>
40 <?php
41
42 /**
43 * Fires before the translation column is outputted in the language metabox
44 * The dynamic portion of the hook name, `$lang`, refers to the language code
45 *
46 * @since 2.1
47 */
48 do_action( 'pll_before_post_translation_' . $language->slug );
49 ?>
50 <td class = "pll-translation-column">
51 <?php
52 printf(
53 '<label class="screen-reader-text" for="tr_lang_%1$s">%2$s</label>
54 <input type="hidden" name="post_tr_lang[%1$s]" id="htr_lang_%1$s" value="%3$s" />
55 <span lang="%6$s" dir="%7$s"><input type="text" class="tr_lang" id="tr_lang_%1$s" value="%4$s"%5$s /></span>',
56 esc_attr( $language->slug ),
57 /* translators: accessibility text */
58 esc_html__( 'Translation', 'polylang' ),
59 ( empty( $value ) ? 0 : esc_attr( $selected->ID ) ),
60 ( empty( $value ) ? '' : esc_attr( $selected->post_title ) ),
61 disabled( empty( $link ), true, false ),
62 esc_attr( $language->get_locale( 'display' ) ),
63 ( $language->is_rtl ? 'rtl' : 'ltr' )
64 );
65 ?>
66 </td>
67 </tr>
68 <?php
69 }
70 ?>
71 </table>
72