PluginProbe
Polylang / 2.6.2
Polylang v2.6.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
← All changes | admin/admin-classic-editor.php +9 -21 2.82.6.2 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Manages filters and actions related to the classic editor
8 5 *
@@ -68,12 +65,12 @@
68 65 * @since 0.1
69 66 */
70 67 public function post_language() {
71 68 global $post_ID;
69 + $post_id = $post_ID;
72 70 $post_type = get_post_type( $post_ID );
73 71
74 - // phpcs:ignore WordPress.Security.NonceVerification, WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable
75 - $from_post_id = isset( $_GET['from_post'] ) ? (int) $_GET['from_post'] : 0;
72 + $from_post_id = isset( $_GET['from_post'] ) ? (int) $_GET['from_post'] : 0; // phpcs:ignore WordPress.Security.NonceVerification
76 73
77 74 $lang = ( $lg = $this->model->post->get_language( $post_ID ) ) ? $lg :
78 75 ( isset( $_GET['new_lang'] ) ? $this->model->get_language( sanitize_key( $_GET['new_lang'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification
79 76 $this->pref_lang );
@@ -83,9 +80,8 @@
83 80 $id = ( 'attachment' === $post_type ) ? sprintf( 'attachments[%d][language]', (int) $post_ID ) : 'post_lang_choice';
84 81
85 82 $dropdown_html = $dropdown->walk(
86 83 $this->model->get_languages_list(),
87 - -1,
88 84 array(
89 85 'name' => $id,
90 86 'class' => 'post_lang_choice tags-input',
91 87 'selected' => $lang ? $lang->slug : '',
@@ -114,13 +110,9 @@
114 110 do_action( 'pll_before_post_translations', $post_type );
115 111
116 112 echo '<div id="post-translations" class="translations">';
117 113 if ( $lang ) {
118 - if ( 'attachment' === $post_type ) {
119 - include __DIR__ . '/view-translations-media.php';
120 - } else {
121 - include __DIR__ . '/view-translations-post.php';
122 - }
114 + include PLL_ADMIN_INC . '/view-translations-' . ( 'attachment' == $post_type ? 'media' : 'post' ) . '.php';
123 115 }
124 116 echo '</div>' . "\n";
125 117 }
126 118
@@ -136,10 +128,11 @@
136 128 wp_die( 0 );
137 129 }
138 130
139 131 global $post_ID; // Obliged to use the global variable for wp_popular_terms_checklist
140 - $post_ID = (int) $_POST['post_id'];
141 - $lang = $this->model->get_language( sanitize_key( $_POST['lang'] ) );
132 + $post_id = $post_ID = (int) $_POST['post_id'];
133 + $lang = $this->model->get_language( sanitize_key( $_POST['lang'] ) );
134 +
142 135 $post_type = sanitize_key( $_POST['post_type'] );
143 136
144 137 if ( ! post_type_exists( $post_type ) ) {
145 138 wp_die( 0 );
@@ -158,21 +151,16 @@
158 151 $this->model->post->save_translations( $post_ID, $translations );
159 152
160 153 ob_start();
161 154 if ( $lang ) {
162 - if ( 'attachment' === $post_type ) {
163 - include __DIR__ . '/view-translations-media.php';
164 - } else {
165 - include __DIR__ . '/view-translations-post.php';
166 - }
155 + include PLL_ADMIN_INC . '/view-translations-' . ( 'attachment' == $post_type ? 'media' : 'post' ) . '.php';
167 156 }
168 157 $x = new WP_Ajax_Response( array( 'what' => 'translations', 'data' => ob_get_contents() ) );
169 158 ob_end_clean();
170 159
171 160 // Categories
172 - if ( isset( $_POST['taxonomies'] ) ) { // Not set for pages
173 - $supplemental = array();
174 -
161 + if ( isset( $_POST['taxonomies'] ) ) {
162 + // Not set for pages
175 163 foreach ( array_map( 'sanitize_key', $_POST['taxonomies'] ) as $taxname ) {
176 164 $taxonomy = get_taxonomy( $taxname );
177 165
178 166 ob_start();