PluginProbe
Polylang / 2.5.2
Polylang v2.5.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-filters-post-base.php +7 -27 3.02.5.2 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Some common code for PLL_Admin_Filters_Post and PLL_Admin_Filters_Media
8 5 *
@@ -8,26 +5,11 @@
8 5 *
9 6 * @since 1.5
10 7 */
11 8 abstract class PLL_Admin_Filters_Post_Base {
12 - /**
13 - * @var PLL_Model
14 - */
15 - public $model;
9 + public $links, $model, $pref_lang;
16 10
17 11 /**
18 - * @var PLL_Links
19 - */
20 - public $links;
21 -
22 - /**
23 - * Language selected in the admin language filter.
24 - *
25 - * @var PLL_Language
26 - */
27 - public $filter_lang;
28 -
29 - /**
30 12 * Constructor: setups filters and actions
31 13 *
32 14 * @since 1.2
33 15 *
@@ -39,23 +21,21 @@
39 21 $this->pref_lang = &$polylang->pref_lang;
40 22 }
41 23
42 24 /**
43 - * Save translations from the languages metabox.
25 + * Save translations from language metabox
44 26 *
45 27 * @since 1.5
46 28 *
47 - * @param int $post_id Post id of the post being saved.
48 - * @param int[] $arr An array with language codes as key and post id as value.
49 - * @return int[] The array of translated post ids.
29 + * @param int $post_id
30 + * @param array $arr
31 + * @return array
50 32 */
51 33 protected function save_translations( $post_id, $arr ) {
52 - // Security check as 'wp_insert_post' can be called from outside WP admin.
34 + // Security check as 'wp_insert_post' can be called from outside WP admin
53 35 check_admin_referer( 'pll_language', '_pll_nonce' );
54 36
55 - $translations = array();
56 -
57 - // Save translations after checking the translated post is in the right language.
37 + // Save translations after checking the translated post is in the right language
58 38 foreach ( $arr as $lang => $tr_id ) {
59 39 $translations[ $lang ] = ( $tr_id && $this->model->post->get_language( (int) $tr_id )->slug == $lang ) ? (int) $tr_id : 0;
60 40 }
61 41