PluginProbe
Polylang / 2.5
Polylang v2.5
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
← All changes | admin/admin-static-pages.php +4 -45 2.72.5 View file →
@@ -5,9 +5,8 @@
5 5 *
6 6 * @since 1.8
7 7 */
8 8 class PLL_Admin_Static_Pages extends PLL_Static_Pages {
9 - protected $links;
10 9
11 10 /**
12 11 * Constructor: setups filters and actions
13 12 *
@@ -17,10 +16,8 @@
17 16 */
18 17 public function __construct( &$polylang ) {
19 18 parent::__construct( $polylang );
20 19
21 - $this->links = &$polylang->links;
22 -
23 20 // Removes the editor and the template select dropdown for pages for posts
24 21 add_filter( 'use_block_editor_for_post', array( $this, 'use_block_editor_for_post' ), 10, 2 ); // Since WP 5.0
25 22 add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 );
26 23
@@ -35,10 +32,8 @@
35 32 add_filter( 'customize_validate_page_on_front', array( $this, 'customize_validate_page_on_front' ), 10, 2 );
36 33
37 34 // Prevents WP resetting the option
38 35 add_filter( 'pre_update_option_show_on_front', array( $this, 'update_show_on_front' ), 10, 2 );
39 -
40 - add_action( 'admin_notices', array( $this, 'notice_must_translate' ) );
41 36 }
42 37
43 38 /**
44 39 * Don't use the block editor for the translations of the pages for posts
@@ -85,19 +80,19 @@
85 80 * Add post state for translations of the front page and posts page
86 81 *
87 82 * @since 1.8
88 83 *
89 - * @param array $post_states An array of post display states.
90 - * @param object $post The current post object.
84 + * @param array $post_states
85 + * @param object $post
91 86 * @return array
92 87 */
93 88 public function display_post_states( $post_states, $post ) {
94 89 if ( in_array( $post->ID, $this->model->get_languages_list( array( 'fields' => 'page_on_front' ) ) ) ) {
95 - $post_states['page_on_front'] = __( 'Front Page', 'polylang' );
90 + $post_states['page_on_front'] = __( 'Front Page' );
96 91 }
97 92
98 93 if ( in_array( $post->ID, $this->model->get_languages_list( array( 'fields' => 'page_for_posts' ) ) ) ) {
99 - $post_states['page_for_posts'] = __( 'Posts Page', 'polylang' );
94 + $post_states['page_for_posts'] = __( 'Posts Page' );
100 95 }
101 96
102 97 return $post_states;
103 98 }
@@ -187,42 +182,6 @@
187 182 if ( ! empty( $GLOBALS['pagenow'] ) && 'options-reading.php' === $GLOBALS['pagenow'] && 'posts' === $value && ! get_pages() && get_pages( array( 'lang' => '' ) ) ) {
188 183 $value = $old_value;
189 184 }
190 185 return $value;
191 - }
192 -
193 - /**
194 - * Add a notice to translate the static front page if it is not translated in all languages
195 - * This is especially useful after a new language is created.
196 - * The notice is not dismissible and displayed on the Languages pages and the list of pages.
197 - *
198 - * @since 2.6
199 - */
200 - public function notice_must_translate() {
201 - $screen = get_current_screen();
202 -
203 - if ( $this->page_on_front && ( 'toplevel_page_mlang' === $screen->id || 'edit-page' === $screen->id ) ) {
204 - $untranslated = array();
205 -
206 - foreach ( $this->model->get_languages_list() as $language ) {
207 - if ( ! $this->model->post->get( $this->page_on_front, $language ) ) {
208 - $untranslated[] = sprintf(
209 - '<a href="%s">%s</a>',
210 - esc_url( $this->links->get_new_post_translation_link( $this->page_on_front, $language ) ),
211 - esc_html( $language->name )
212 - );
213 - }
214 - }
215 -
216 - if ( ! empty( $untranslated ) ) {
217 - printf(
218 - '<div class="error"><p>%s</p></div>',
219 - sprintf(
220 - /* translators: %s is a comma separated list of native language names */
221 - esc_html__( 'You must translate your static front page in %s.', 'polylang' ),
222 - implode( ', ', $untranslated ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
223 - )
224 - );
225 - }
226 - }
227 186 }
228 187 }