PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.1
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
← All changes | classes/Controllers/RestAPI.php +4 -32 trunk2.6.1 View file →
@@ -24,15 +24,11 @@
24 24 */
25 25 public function init() {
26 26 add_action( 'rest_api_init', [ $this, 'register_routes' ] );
27 27
28 - if ( $this->container->is_legacy_pro_active() ) {
29 - add_filter( 'rest_endpoints', [ $this, 'disable_legacy_pro_installer_route' ], PHP_INT_MAX );
30 - }
31 -
32 28 // Handle CPT & Taxonomy that are not registered with the `show_in_rest` arg when searching from our settings pages.
33 - add_filter( 'register_post_type_args', [ $this, 'modify_post_type_show_in_rest' ], 10 );
34 - add_filter( 'register_taxonomy_args', [ $this, 'modify_taxonomy_show_in_rest' ], 10 );
29 + add_filter( 'register_post_type_args', [ $this, 'modify_post_type_show_in_rest' ], 10, 2 );
30 + add_filter( 'register_taxonomy_args', [ $this, 'modify_taxonomy_show_in_rest' ], 10, 2 );
35 31 }
36 32
37 33 /**
38 34 * Register Rest API routes.
@@ -40,38 +36,14 @@
40 36 * @return void
41 37 */
42 38 public function register_routes() {
43 39 ( new \ContentControl\RestAPI\BlockTypes() )->register_routes();
44 -
45 - if ( $this->container->is_legacy_pro_active() ) {
46 - ( new \ContentControl\RestAPI\License() )->register_routes();
47 - }
48 -
40 + ( new \ContentControl\RestAPI\License() )->register_routes();
49 41 ( new \ContentControl\RestAPI\ObjectSearch() )->register_routes();
50 42 ( new \ContentControl\RestAPI\Settings() )->register_routes();
51 43 }
52 44
53 45 /**
54 - * Remove the installer route registered by active Pro versions below 1.3.0.
55 - *
56 - * Those versions resolve an upgrader service that is unavailable in Core
57 - * 2.7.0. Removing the endpoint prevents a fatal request while Pro is updated
58 - * manually. Core does not register or implement the endpoint.
59 - *
60 - * @since 2.7.0
61 - * @deprecated 2.7.0 Remove after Pro 1.3.0 is the minimum supported version.
62 - *
63 - * @param array<string,array<int,array<string,mixed>>> $endpoints Registered REST endpoints.
64 - *
65 - * @return array<string,array<int,array<string,mixed>>>
66 - */
67 - public function disable_legacy_pro_installer_route( $endpoints ) {
68 - unset( $endpoints['/content-control/v2/addons/install'] );
69 -
70 - return $endpoints;
71 - }
72 -
73 - /**
74 46 * Modify show_in_rest for post types.
75 47 *
76 48 * @param array<string,mixed> $args Post type args.
77 49 *
@@ -144,9 +116,9 @@
144 116 return false;
145 117 }
146 118
147 119 // Return false if referrer is not our settings page. /wp-admin/options-general.php?page=content-control-settings.
148 - if ( ! isset( $_SERVER['HTTP_REFERER'] ) || ! is_string( $_SERVER['HTTP_REFERER'] ) ) {
120 + if ( ! isset( $_SERVER['HTTP_REFERER'] ) ) {
149 121 return false;
150 122 }
151 123
152 124 if ( ! check_referrer_is_admin() ) {