| 1 |
<?php |
| 2 |
namespace Elementor\Core\Editor\Data\Globals; |
| 3 |
|
| 4 |
use Elementor\Data\Base\Controller as Controller_Base; |
| 5 |
use Elementor\Plugin; |
| 6 |
|
| 7 |
class Controller extends Controller_Base { |
| 8 |
public function get_name() { |
| 9 |
return 'globals'; |
| 10 |
} |
| 11 |
|
| 12 |
public function register_endpoints() { |
| 13 |
$this->register_endpoint( Endpoints\Colors::class ); |
| 14 |
$this->register_endpoint( Endpoints\Typography::class ); |
| 15 |
} |
| 16 |
|
| 17 |
protected function register_internal_endpoints() { |
| 18 |
$this->register_endpoint( Endpoints\Index::class ); |
| 19 |
} |
| 20 |
|
| 21 |
public function get_permission_callback( $request ) { |
| 22 |
// Allow internal get global values. (e.g render global.css for a visitor) |
| 23 |
if ( 'GET' === $request->get_method() && Plugin::$instance->data_manager->is_internal() ) { |
| 24 |
return true; |
| 25 |
} |
| 26 |
|
| 27 |
return current_user_can( 'edit_posts' ); |
| 28 |
} |
| 29 |
} |
| 30 |
|