PluginProbe
Polylang / 3.1.1
Polylang v3.1.1
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
polylang / admin / admin-filters-post-base.php

admin-filters-post-base.php in Polylang 3.1.1, at admin/admin-filters-post-base.php

59 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 /**
7 * Some common code for PLL_Admin_Filters_Post and PLL_Admin_Filters_Media
8 *
9 * @since 1.5
10 */
11 abstract class PLL_Admin_Filters_Post_Base {
12 /**
13 * @var PLL_Model
14 */
15 public $model;
16
17 /**
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 * Constructor: setups filters and actions
31 *
32 * @since 1.2
33 *
34 * @param object $polylang
35 */
36 public function __construct( &$polylang ) {
37 $this->links = &$polylang->links;
38 $this->model = &$polylang->model;
39 $this->pref_lang = &$polylang->pref_lang;
40 }
41
42 /**
43 * Save translations from the languages metabox.
44 *
45 * @since 1.5
46 *
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.
50 */
51 protected function save_translations( $post_id, $arr ) {
52 // Security check as 'wp_insert_post' can be called from outside WP admin.
53 check_admin_referer( 'pll_language', '_pll_nonce' );
54
55 $translations = $this->model->post->save_translations( $post_id, $arr );
56 return $translations;
57 }
58 }
59