PluginProbe
Meow Gallery / 4.2.2
Meow Gallery v4.2.2
5.5.5 5.5.4 5.5.3 5.5.2 5.5.1 5.5.0 5.4.9 5.4.8 5.4.7 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 All 157 releases
← All changes | classes/rest.php +7 -10 4.1.9 → 4.2.2 View file →
@@ -22,28 +22,24 @@
22 22
23 23
24 24 function rest_api_init() {
25 25
26 - //$accessOptions = $can_access_options;
27 - //error_log( $canDo );
28 - //$accessOptions = $this->core->can_access_options();
29 -
30 - // SETTINGS
26 + // Settings
31 27 register_rest_route( $this->namespace, '/update_option/', array(
32 28 'methods' => 'POST',
33 - 'permission_callback' => function () { return true; },
29 + 'permission_callback' => array( $this->core, 'can_access_settings' ),
34 30 'callback' => array( $this, 'rest_update_option' )
35 31 ) );
36 32 register_rest_route( $this->namespace, '/all_settings/', array(
37 33 'methods' => 'GET',
38 - 'permission_callback' => array( $this->core, 'can_access_options' ),
34 + 'permission_callback' => array( $this->core, 'can_access_settings' ),
39 35 'callback' => array( $this, 'rest_all_settings' )
40 36 ) );
41 37
42 - // BLOCK
38 + // Gutenberg Block
43 39 register_rest_route( $this->namespace, '/preview', array(
44 40 'methods' => 'POST',
45 - 'permission_callback' => function () { return true; },
41 + 'permission_callback' => array( $this->core, 'can_access_features' ),
46 42 'callback' => array( $this, 'preview' ),
47 43 ) );
48 44 }
49 45
@@ -51,9 +47,10 @@
51 47 $params = $request->get_body();
52 48 $params = json_decode( $params );
53 49 $params->ids = implode( ',', $params->ids );
54 50 $atts = (array) $params;
55 - return $this->core->gallery( $atts, true );
51 + $html = $this->core->gallery( $atts, true );
52 + return new WP_REST_Response( [ 'success' => true, 'data' => $html ], 200 );
56 53 }
57 54
58 55 function rest_all_settings() {
59 56 return new WP_REST_Response( [ 'success' => true, 'data' => $this->get_all_options() ], 200 );