PluginProbe
Polylang / trunk
Polylang vtrunk
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 / src / modules / wizard / view-wizard-step-home-page.php

view-wizard-step-home-page.php in Polylang trunk, at src/modules/wizard/view-wizard-step-home-page.php

126 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Displays the wizard home page step
4 *
5 * @package Polylang
6 *
7 * @since 2.7
8 *
9 * @var PLL_Model $model `PLL_Model` instance.
10 * @var WP_Post $home_page Home page defined in WordPress options.
11 * @var PLL_Language $home_page_language Home page language if already assigned.
12 * @var int[] $translations Ids of home page translations.
13 * @var PLL_Language[] $untranslated_languages List of languages in which the home page isn't translated.
14 */
15
16 defined( 'ABSPATH' ) || exit;
17
18 ?>
19 <input type="hidden" name="home_page" value="<?php echo esc_attr( (string) $home_page->ID ); ?>" />
20 <input type="hidden" name="home_page_title" value="<?php echo esc_attr( $home_page->post_title ); ?>" />
21 <input type="hidden" name="home_page_language" value="<?php echo esc_attr( $home_page_language->slug ); ?>" />
22 <h2><?php esc_html_e( 'Homepage', 'polylang' ); ?></h2>
23 <p>
24 <?php
25 printf(
26 /* translators: %s is the post title of the front page */
27 esc_html__( 'You defined this page as your static homepage: %s.', 'polylang' ),
28 '<strong>' . esc_html( $home_page->post_title ) . '</strong>'
29 );
30 ?>
31 <br />
32 <?php
33 printf(
34 /* translators: %s is the language of the front page ( flag, native name and locale ) */
35 esc_html__( 'Its language is : %s.', 'polylang' ),
36 $home_page_language->get_admin_flag( 'aria-hidden' ) . ' <strong>' . esc_html( $home_page_language->name ) . ' ' . esc_html( $home_page_language->locale ) . '</strong>' //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
37 );
38 ?>
39 <br />
40 <?php esc_html_e( 'For your site to work correctly, this page must be translated in all available languages.', 'polylang' ); ?>
41 </p>
42 <p>
43 <?php esc_html_e( 'After the pages is created, it is up to you to put the translated content in each page linked to each language.', 'polylang' ); ?>
44 </p>
45 <?php if ( $translations ) : ?>
46 <table id="translated-languages" class="striped">
47 <thead>
48 <tr>
49 <th><?php esc_html_e( 'Your static homepage is already translated in', 'polylang' ); ?></th>
50 </tr>
51 </thead>
52 <tbody>
53 <?php
54 foreach ( array_keys( $translations ) as $lang ) {
55 $language = $model->languages->get( $lang );
56 if ( empty( $language ) ) {
57 continue;
58 }
59 ?>
60 <tr>
61 <td>
62 <?php
63 echo $language->get_admin_flag( 'aria-hidden' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
64 echo ' ' . esc_html( $language->name ) . ' ' . esc_html( $language->locale ) . ' ';
65 ?>
66 <?php if ( $language->is_default ) : ?>
67 <span class="icon-default-lang">
68 <span class="screen-reader-text">
69 <?php esc_html_e( 'Default language', 'polylang' ); ?>
70 </span>
71 </span>
72 <?php endif; ?>
73 <input type="hidden" name="translated_languages[]" value="<?php echo esc_attr( $language->slug ); ?>" />
74 </td>
75 </tr>
76 <?php
77 }
78 ?>
79 </tbody>
80 </table>
81 <?php endif; ?>
82 <table id="untranslated-languages" class="striped">
83 <caption><span class="icon-default-lang"></span> <?php esc_html_e( 'Default language', 'polylang' ); ?></caption>
84 <thead>
85 <?php if ( count( $untranslated_languages ) >= 1 ) : ?>
86 <tr>
87 <th><?php esc_html_e( 'We are going to prepare this page in', 'polylang' ); ?></th>
88 </tr>
89 <?php else : ?>
90 <tr>
91 <th>
92 <span class="dashicons dashicons-info"></span>
93 <?php esc_html_e( 'One language is well defined and assigned to your home page.', 'polylang' ); ?>
94 </th>
95 </tr>
96 <tr>
97 <td><?php esc_html_e( "If you add a new language, don't forget to translate your homepage.", 'polylang' ); ?></td>
98 </tr>
99 <?php endif; ?>
100 </thead>
101 <tbody>
102 <?php
103 foreach ( $untranslated_languages as $lg ) {
104 ?>
105 <tr>
106 <td>
107 <?php
108 echo $lg->get_admin_flag( 'aria-hidden' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
109 echo ' ' . esc_html( $lg->name ) . ' ' . esc_html( $lg->locale ) . ' ';
110 ?>
111 <?php if ( $lg->is_default ) : ?>
112 <span class="icon-default-lang">
113 <span class="screen-reader-text">
114 <?php esc_html_e( 'Default language', 'polylang' ); ?>
115 </span>
116 </span>
117 <?php endif; ?>
118 <input type="hidden" name="untranslated_languages[]" value="<?php echo esc_attr( $lg->slug ); ?>" />
119 </td>
120 </tr>
121 <?php
122 }
123 ?>
124 </tbody>
125 </table>
126