Full Site Editing - Version 3.46638

Version Description

Download this release

Release Info

Developer rcrdortiz
Plugin Icon wp plugin Full Site Editing
Version 3.46638
Comparing to
See all releases

Code changes from version 3.46566 to 3.46638

build_meta.txt CHANGED
@@ -1,3 +1,3 @@
1
- commit_hash=e07bdf69a5594054763b24019b540c6494d10538
2
- commit_url=https://github.com/Automattic/wp-calypso/commit/e07bdf69a5594054763b24019b540c6494d10538
3
- build_number=3.46566
1
+ commit_hash=fe0bff0f4bd22b4194781332ccebf0bc467a9e1e
2
+ commit_url=https://github.com/Automattic/wp-calypso/commit/fe0bff0f4bd22b4194781332ccebf0bc467a9e1e
3
+ build_number=3.46638
full-site-editing-plugin.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: WordPress.com Editing Toolkit
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
- * Version: 3.46566
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
@@ -42,7 +42,7 @@ namespace A8C\FSE;
42
  *
43
  * @var string
44
  */
45
- define( 'A8C_ETK_PLUGIN_VERSION', '3.46566' );
46
 
47
  // Always include these helper files for dotcom FSE.
48
  require_once __DIR__ . '/dotcom-fse/helpers.php';
2
  /**
3
  * Plugin Name: WordPress.com Editing Toolkit
4
  * Description: Enhances your page creation workflow within the Block Editor.
5
+ * Version: 3.46638
6
  * Author: Automattic
7
  * Author URI: https://automattic.com/wordpress-plugins/
8
  * License: GPLv2 or later
42
  *
43
  * @var string
44
  */
45
+ define( 'A8C_ETK_PLUGIN_VERSION', '3.46638' );
46
 
47
  // Always include these helper files for dotcom FSE.
48
  require_once __DIR__ . '/dotcom-fse/helpers.php';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: automattic
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.5
5
  Tested up to: 6.0
6
- Stable tag: 3.46566
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
3
  Tags: block, blocks, editor, gutenberg, page
4
  Requires at least: 5.5
5
  Tested up to: 6.0
6
+ Stable tag: 3.46638
7
  Requires PHP: 5.6.20
8
  License: GPLv2 or later
9
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
wpcom-global-styles/api/class-global-styles-status-rest-api.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * WPCOM Global Styles Info API.
4
+ *
5
+ * @package full-site-editing-plugin
6
+ */
7
+
8
+ /**
9
+ * This class contains the necessary endpoints to interact with global styles outside the editor context.
10
+ */
11
+ class Global_Styles_Status_Rest_API extends WP_REST_Controller {
12
+
13
+ /**
14
+ * Class constructor
15
+ */
16
+ public function __construct() {
17
+ $this->namespace = 'wpcom/v2';
18
+ $this->rest_base = 'global-styles/status';
19
+ $this->wpcom_is_site_specific_endpoint = true;
20
+ $this->wpcom_is_wpcom_only_endpoint = true;
21
+ add_action( 'rest_api_init', array( $this, 'register_routes' ) );
22
+ }
23
+
24
+ /**
25
+ * Here we register the routes this API will expose.
26
+ *
27
+ * @return void
28
+ */
29
+ public function register_routes() {
30
+
31
+ register_rest_route(
32
+ $this->namespace,
33
+ '/' . $this->rest_base,
34
+ array(
35
+ array(
36
+ 'methods' => WP_REST_Server::READABLE,
37
+ 'callback' => array( $this, 'get_global_styles_info' ),
38
+ 'permission_callback' => array( $this, 'permissions_check' ),
39
+ ),
40
+ )
41
+ );
42
+ }
43
+
44
+ /**
45
+ * Checks if the user has the necessary permissions to get global styles information.
46
+ *
47
+ * @return bool|WP_Error
48
+ */
49
+ public function permissions_check() {
50
+ if ( ! current_user_can( 'edit_theme_options' ) ) {
51
+ return new WP_Error(
52
+ 'rest_cannot_view',
53
+ __( 'Your user is not permitted to access this resource.', 'full-site-editing' ),
54
+ array( 'status' => rest_authorization_required_code() )
55
+ );
56
+ }
57
+
58
+ return true;
59
+ }
60
+
61
+ /**
62
+ * Returns if the current blog has Global Styles in use and if Global Styles should be limited.
63
+ *
64
+ * @return array
65
+ */
66
+ public function get_global_styles_info() {
67
+ return array(
68
+ 'globalStylesInUse' => wpcom_global_styles_in_use(),
69
+ 'shouldLimitGlobalStyles' => wpcom_should_limit_global_styles(),
70
+ );
71
+ }
72
+ }
73
+
74
+ if ( function_exists( 'wpcom_rest_api_v2_load_plugin' ) ) {
75
+ wpcom_rest_api_v2_load_plugin( 'Global_Styles_Status_Rest_API' );
76
+ }
wpcom-global-styles/index.php CHANGED
@@ -230,6 +230,11 @@ function wpcom_display_global_styles_banner( $custom_controls ) {
230
  }
231
  add_filter( 'wpcom_custom_launch_bar_controls', 'wpcom_display_global_styles_banner' );
232
 
 
 
 
 
 
233
  /**
234
  * Checks if the necessary conditions are met in order to establish that the supplied user should be considered as previewing Global Styles.
235
  *
230
  }
231
  add_filter( 'wpcom_custom_launch_bar_controls', 'wpcom_display_global_styles_banner' );
232
 
233
+ /**
234
+ * Include the Rest API that returns the global style information for a give WordPress site.
235
+ */
236
+ require_once __DIR__ . '/api/class-global-styles-status-rest-api.php';
237
+
238
  /**
239
  * Checks if the necessary conditions are met in order to establish that the supplied user should be considered as previewing Global Styles.
240
  *