%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
| Server IP : 54.36.91.62 / Your IP : 216.73.217.162 Web Server : Apache System : Linux webm002.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : wellingtpa ( 97533) PHP Version : 7.4.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wellingtpa/www/wp-content/plugins/elementor/modules/design-system-sync/classes/ |
Upload File : |
<?php
namespace Elementor\Modules\DesignSystemSync\Classes;
use Exception;
use WP_REST_Server;
use WP_REST_Response;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class Controller {
const API_NAMESPACE = 'elementor/v1';
const API_BASE = 'design-system-sync';
const HTTP_CREATED = 201;
const HTTP_NO_CONTENT = 204;
const HTTP_INTERNAL_SERVER_ERROR = 500;
public function register_hooks() {
add_action( 'rest_api_init', [ $this, 'register_routes' ] );
}
public function register_routes() {
register_rest_route( self::API_NAMESPACE, '/' . self::API_BASE . '/stylesheet', [
'methods' => WP_REST_Server::CREATABLE,
'callback' => [ $this, 'generate' ],
'permission_callback' => [ $this, 'has_permission' ],
] );
}
public function generate(): WP_REST_Response {
try {
$stylesheet = new Stylesheet_Manager();
$result = $stylesheet->generate();
if ( null === $result ) {
return new WP_REST_Response( null, self::HTTP_NO_CONTENT );
}
return new WP_REST_Response( $result, self::HTTP_CREATED );
} catch ( Exception $e ) {
return new WP_REST_Response(
[ 'message' => $e->getMessage() ],
self::HTTP_INTERNAL_SERVER_ERROR
);
}
}
public function has_permission(): bool {
return current_user_can( 'edit_posts' );
}
}