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 | settings/settings-cpt.php +3 -41 2.82.6.2 View file →
@@ -1,8 +1,5 @@
1 1 <?php
2 -/**
3 - * @package Polylang
4 - */
5 2
6 3 /**
7 4 * Settings class for custom post types and taxonomies language and translation management
8 5 *
@@ -8,44 +5,11 @@
8 5 *
9 6 * @since 1.8
10 7 */
11 8 class PLL_Settings_CPT extends PLL_Settings_Module {
12 - /**
13 - * Stores the display order priority.
14 - *
15 - * @var int
16 - */
17 - public $priority = 40;
9 + private $post_types, $disabled_post_types, $taxonomies, $disabled_taxonomies;
18 10
19 11 /**
20 - * The list of post types to show in the form.
21 - *
22 - * @var array
23 - */
24 - private $post_types;
25 -
26 - /**
27 - * The list of post types to disable in the form.
28 - *
29 - * @var array
30 - */
31 - private $disabled_post_types;
32 -
33 - /**
34 - * The list of taxonomies to show in the form.
35 - *
36 - * @var array
37 - */
38 - private $taxonomies;
39 -
40 - /**
41 - * The list of taxonomies to disable in the form.
42 - *
43 - * @var array
44 - */
45 - private $disabled_taxonomies;
46 -
47 - /**
48 12 * Constructor
49 13 *
50 14 * @since 1.8
51 15 *
@@ -64,10 +28,10 @@
64 28 $public_post_types = get_post_types( array( 'public' => true, '_builtin' => false ) );
65 29 /** This filter is documented in include/model.php */
66 30 $this->post_types = array_unique( apply_filters( 'pll_get_post_types', $public_post_types, true ) );
67 31
32 + $programmatically_active_post_types = array_unique( apply_filters( 'pll_get_post_types', array(), false ) );
68 33 /** This filter is documented in include/model.php */
69 - $programmatically_active_post_types = array_unique( apply_filters( 'pll_get_post_types', array(), false ) );
70 34 $this->disabled_post_types = array_intersect( $programmatically_active_post_types, $this->post_types );
71 35
72 36 $public_taxonomies = get_taxonomies( array( 'public' => true, '_builtin' => false ) );
73 37 $public_taxonomies = array_diff( $public_taxonomies, get_taxonomies( array( '_pll' => true ) ) );
@@ -73,10 +37,10 @@
73 37 $public_taxonomies = array_diff( $public_taxonomies, get_taxonomies( array( '_pll' => true ) ) );
74 38 /** This filter is documented in include/model.php */
75 39 $this->taxonomies = array_unique( apply_filters( 'pll_get_taxonomies', $public_taxonomies, true ) );
76 40
41 + $programmatically_active_taxonomies = array_unique( apply_filters( 'pll_get_taxonomies', array(), false ) );
77 42 /** This filter is documented in include/model.php */
78 - $programmatically_active_taxonomies = array_unique( apply_filters( 'pll_get_taxonomies', array(), false ) );
79 43 $this->disabled_taxonomies = array_intersect( $programmatically_active_taxonomies, $this->taxonomies );
80 44 }
81 45
82 46 /**
@@ -151,10 +115,8 @@
151 115 *
152 116 * @param array $options
153 117 */
154 118 protected function update( $options ) {
155 - $newoptions = array();
156 -
157 119 foreach ( array( 'post_types', 'taxonomies' ) as $key ) {
158 120 $newoptions[ $key ] = empty( $options[ $key ] ) ? array() : array_keys( $options[ $key ], 1 );
159 121 }
160 122 return $newoptions; // Take care to return only validated options