PluginProbe
Gutenberg Essential Blocks – Page Builder for Gutenberg Blocks & Patterns / 6.4.1
Gutenberg Essential Blocks – Page Builder for Gutenberg Blocks & Patterns v6.4.1
6.4.3 6.4.2 6.4.1 6.4.0 6.3.0 6.2.1 6.2.0 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 2.0.0 2.0.1 2.0.2 2.1.0 2.2.0 All 198 releases
essential-blocks / includes / API / Common.php

Common.php in Gutenberg Essential Blocks – Page Builder for Gutenberg Blocks & Patterns 6.4.1, at includes/API/Common.php

36 lines 676 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace EssentialBlocks\API;
4
5 class Common extends Base
6 {
7 /**
8 * Register REST Routes
9 *
10 * @return void
11 */
12 public function register()
13 {
14 $this->get('roles', [
15 'callback' => [$this, 'get_roles'],
16 'permission_callback' => [$this, 'check_edit_page_permission']
17 ]);
18 }
19
20 /**
21 * Check if user has permission to edit pages
22 *
23 * @return bool
24 */
25 public function check_edit_page_permission()
26 {
27 return current_user_can('edit_posts');
28 }
29
30 public function get_roles()
31 {
32 global $wp_roles;
33 return rest_ensure_response($wp_roles->roles);
34 }
35 }
36