| @@ -24,9 +24,9 @@ | ||
| 24 | 24 | $this->curlang = &$polylang->curlang; |
| 25 | 25 | $this->pref_lang = &$polylang->pref_lang; |
| 26 | 26 | |
| 27 | 27 | // Adds the Languages box in the 'Edit Post' and 'Edit Page' panels |
| 28 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); | |
| 28 | + add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 ); | |
| 29 | 29 | |
| 30 | 30 | // Ajax response for changing the language in the post metabox |
| 31 | 31 | add_action( 'wp_ajax_post_lang_choice', array( $this, 'post_lang_choice' ) ); |
| 32 | 32 | add_action( 'wp_ajax_pll_posts_not_translated', array( $this, 'ajax_posts_not_translated' ) ); |
| @@ -43,10 +43,11 @@ | ||
| 43 | 43 | * |
| 44 | 44 | * @since 0.1 |
| 45 | 45 | * |
| 46 | 46 | * @param string $post_type Current post type |
| 47 | + * @param object $post Current post | |
| 47 | 48 | */ |
| 48 | - public function add_meta_boxes( $post_type ) { | |
| 49 | + public function add_meta_boxes( $post_type, $post ) { | |
| 49 | 50 | if ( $this->model->is_translated_post_type( $post_type ) ) { |
| 50 | 51 | add_meta_box( |
| 51 | 52 | 'ml_box', |
| 52 | 53 | __( 'Languages', 'polylang' ), |
| @@ -69,9 +70,9 @@ | ||
| 69 | 70 | public function post_language() { |
| 70 | 71 | global $post_ID; |
| 71 | 72 | $post_type = get_post_type( $post_ID ); |
| 72 | 73 | |
| 73 | - // phpcs:ignore WordPress.Security.NonceVerification, VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable | |
| 74 | + // phpcs:ignore WordPress.Security.NonceVerification, WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable | |
| 74 | 75 | $from_post_id = isset( $_GET['from_post'] ) ? (int) $_GET['from_post'] : 0; |
| 75 | 76 | |
| 76 | 77 | $lang = ( $lg = $this->model->post->get_language( $post_ID ) ) ? $lg : |
| 77 | 78 | ( isset( $_GET['new_lang'] ) ? $this->model->get_language( sanitize_key( $_GET['new_lang'] ) ) : // phpcs:ignore WordPress.Security.NonceVerification |