PluginProbe
Elementor Website Builder – more than just a page builder / 4.1.1
Elementor Website Builder – more than just a page builder v4.1.1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / core / editor / data / globals / controller.php

controller.php in Elementor Website Builder – more than just a page builder 4.1.1, at core/editor/data/globals/controller.php

46 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Editor\Data\Globals;
3
4 use Elementor\Data\V2\Base\Controller as Controller_Base;
5 use Elementor\Data\V2\Base\Endpoint;
6 use Elementor\Plugin;
7
8 class Controller extends Controller_Base {
9 public function get_name() {
10 return 'globals';
11 }
12
13 public function register_endpoints() {
14 $this->register_endpoint( new Endpoints\Colors( $this ) );
15 $this->register_endpoint( new Endpoints\Typography( $this ) );
16 }
17
18 public function get_collection_params() {
19 // Does not have 'get_items' args (OPTIONS).
20 // Maybe TODO: try `$this->get_index_endpoint()->get_collection_params()`.
21 return [];
22 }
23
24 public function get_permission_callback( $request ) {
25 $method_type = $request->get_method();
26 if ( \WP_REST_Server::READABLE === $method_type ) {
27 // Allow internal get global values. (e.g render global.css for a visitor)
28 if ( Plugin::$instance->data_manager_v2->is_internal() ) {
29 return true;
30 }
31
32 return current_user_can( 'edit_posts' );
33 }
34
35 if ( \WP_REST_Server::CREATABLE === $method_type || \WP_REST_Server::DELETABLE === $method_type ) {
36 return current_user_can( 'manage_options' );
37 }
38
39 return false;
40 }
41
42 protected function register_index_endpoint() {
43 $this->register_endpoint( new Endpoint\Index\AllChildren( $this ) );
44 }
45 }
46