| @@ -65,12 +65,12 @@ | ||
| 65 | 65 | * @since 0.1 |
| 66 | 66 | */ |
| 67 | 67 | public function post_language() { |
| 68 | 68 | global $post_ID; |
| 69 | + $post_id = $post_ID; | |
| 69 | 70 | $post_type = get_post_type( $post_ID ); |
| 70 | 71 | |
| 71 | - // phpcs:ignore WordPress.Security.NonceVerification, WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable | |
| 72 | - $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 | |
| 73 | 73 | |
| 74 | 74 | $lang = ( $lg = $this->model->post->get_language( $post_ID ) ) ? $lg : |
| 75 | 75 | ( isset( $_GET['new_lang'] ) ? $this->model->get_language( sanitize_key( $_GET['new_lang'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification |
| 76 | 76 | $this->pref_lang ); |
| @@ -80,9 +80,8 @@ | ||
| 80 | 80 | $id = ( 'attachment' === $post_type ) ? sprintf( 'attachments[%d][language]', (int) $post_ID ) : 'post_lang_choice'; |
| 81 | 81 | |
| 82 | 82 | $dropdown_html = $dropdown->walk( |
| 83 | 83 | $this->model->get_languages_list(), |
| 84 | - -1, | |
| 85 | 84 | array( |
| 86 | 85 | 'name' => $id, |
| 87 | 86 | 'class' => 'post_lang_choice tags-input', |
| 88 | 87 | 'selected' => $lang ? $lang->slug : '', |
| @@ -129,10 +128,11 @@ | ||
| 129 | 128 | wp_die( 0 ); |
| 130 | 129 | } |
| 131 | 130 | |
| 132 | 131 | global $post_ID; // Obliged to use the global variable for wp_popular_terms_checklist |
| 133 | - $post_ID = (int) $_POST['post_id']; | |
| 134 | - $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 | + | |
| 135 | 135 | $post_type = sanitize_key( $_POST['post_type'] ); |
| 136 | 136 | |
| 137 | 137 | if ( ! post_type_exists( $post_type ) ) { |
| 138 | 138 | wp_die( 0 ); |
| @@ -157,11 +157,10 @@ | ||
| 157 | 157 | $x = new WP_Ajax_Response( array( 'what' => 'translations', 'data' => ob_get_contents() ) ); |
| 158 | 158 | ob_end_clean(); |
| 159 | 159 | |
| 160 | 160 | // Categories |
| 161 | - if ( isset( $_POST['taxonomies'] ) ) { // Not set for pages | |
| 162 | - $supplemental = array(); | |
| 163 | - | |
| 161 | + if ( isset( $_POST['taxonomies'] ) ) { | |
| 162 | + // Not set for pages | |
| 164 | 163 | foreach ( array_map( 'sanitize_key', $_POST['taxonomies'] ) as $taxname ) { |
| 165 | 164 | $taxonomy = get_taxonomy( $taxname ); |
| 166 | 165 | |
| 167 | 166 | ob_start(); |