@@ -6,28 +6,28 @@ |
||
6 | 6 | |
7 | 7 | class SiteReviewsFormDefaults extends Defaults |
8 | 8 | { |
9 | - /** |
|
10 | - * @var array |
|
11 | - */ |
|
12 | - protected $guarded = [ |
|
13 | - 'description', |
|
14 | - 'title', |
|
15 | - ]; |
|
9 | + /** |
|
10 | + * @var array |
|
11 | + */ |
|
12 | + protected $guarded = [ |
|
13 | + 'description', |
|
14 | + 'title', |
|
15 | + ]; |
|
16 | 16 | |
17 | - /** |
|
18 | - * @return array |
|
19 | - */ |
|
20 | - protected function defaults() |
|
21 | - { |
|
22 | - return [ |
|
23 | - 'assign_to' => '', |
|
24 | - 'category' => '', |
|
25 | - 'class' => '', |
|
26 | - 'description' => '', |
|
27 | - 'excluded' => '', |
|
28 | - 'hide' => '', |
|
29 | - 'id' => '', |
|
30 | - 'title' => '', |
|
31 | - ]; |
|
32 | - } |
|
17 | + /** |
|
18 | + * @return array |
|
19 | + */ |
|
20 | + protected function defaults() |
|
21 | + { |
|
22 | + return [ |
|
23 | + 'assign_to' => '', |
|
24 | + 'category' => '', |
|
25 | + 'class' => '', |
|
26 | + 'description' => '', |
|
27 | + 'excluded' => '', |
|
28 | + 'hide' => '', |
|
29 | + 'id' => '', |
|
30 | + 'title' => '', |
|
31 | + ]; |
|
32 | + } |
|
33 | 33 | } |
@@ -6,20 +6,20 @@ |
||
6 | 6 | |
7 | 7 | class StyleFieldsDefaults extends Defaults |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - protected function defaults() |
|
13 | - { |
|
14 | - return [ |
|
15 | - 'input' => '', |
|
16 | - 'input_checkbox' => '', |
|
17 | - 'input_radio' => '', |
|
18 | - 'label' => '', |
|
19 | - 'label_checkbox' => '', |
|
20 | - 'label_radio' => '', |
|
21 | - 'select' => '', |
|
22 | - 'textarea' => '', |
|
23 | - ]; |
|
24 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + protected function defaults() |
|
13 | + { |
|
14 | + return [ |
|
15 | + 'input' => '', |
|
16 | + 'input_checkbox' => '', |
|
17 | + 'input_radio' => '', |
|
18 | + 'label' => '', |
|
19 | + 'label_checkbox' => '', |
|
20 | + 'label_radio' => '', |
|
21 | + 'select' => '', |
|
22 | + 'textarea' => '', |
|
23 | + ]; |
|
24 | + } |
|
25 | 25 | } |
@@ -6,19 +6,19 @@ |
||
6 | 6 | |
7 | 7 | class SlackDefaults extends Defaults |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - protected function defaults() |
|
13 | - { |
|
14 | - return [ |
|
15 | - 'button_text' => __('View Review', 'site-reviews'), |
|
16 | - 'button_url' => '', |
|
17 | - 'color' => '#665068', |
|
18 | - 'fallback' => '', |
|
19 | - 'icon_url' => glsr()->url('assets/images/icon.png'), |
|
20 | - 'pretext' => '', |
|
21 | - 'username' => glsr()->name, |
|
22 | - ]; |
|
23 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + protected function defaults() |
|
13 | + { |
|
14 | + return [ |
|
15 | + 'button_text' => __('View Review', 'site-reviews'), |
|
16 | + 'button_url' => '', |
|
17 | + 'color' => '#665068', |
|
18 | + 'fallback' => '', |
|
19 | + 'icon_url' => glsr()->url('assets/images/icon.png'), |
|
20 | + 'pretext' => '', |
|
21 | + 'username' => glsr()->name, |
|
22 | + ]; |
|
23 | + } |
|
24 | 24 | } |
@@ -12,11 +12,11 @@ |
||
12 | 12 | protected function defaults() |
13 | 13 | { |
14 | 14 | return [ |
15 | - 'button_text' => __('View Review', 'site-reviews'), |
|
15 | + 'button_text' => __( 'View Review', 'site-reviews' ), |
|
16 | 16 | 'button_url' => '', |
17 | 17 | 'color' => '#665068', |
18 | 18 | 'fallback' => '', |
19 | - 'icon_url' => glsr()->url('assets/images/icon.png'), |
|
19 | + 'icon_url' => glsr()->url( 'assets/images/icon.png' ), |
|
20 | 20 | 'pretext' => '', |
21 | 21 | 'username' => glsr()->name, |
22 | 22 | ]; |
@@ -6,19 +6,19 @@ |
||
6 | 6 | |
7 | 7 | class BuilderDefaults extends Defaults |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - protected function defaults() |
|
13 | - { |
|
14 | - return [ |
|
15 | - 'class' => '', |
|
16 | - 'id' => '', |
|
17 | - 'label' => '', |
|
18 | - 'options' => [], |
|
19 | - 'text' => '', |
|
20 | - 'type' => '', |
|
21 | - 'value' => '', |
|
22 | - ]; |
|
23 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + protected function defaults() |
|
13 | + { |
|
14 | + return [ |
|
15 | + 'class' => '', |
|
16 | + 'id' => '', |
|
17 | + 'label' => '', |
|
18 | + 'options' => [], |
|
19 | + 'text' => '', |
|
20 | + 'type' => '', |
|
21 | + 'value' => '', |
|
22 | + ]; |
|
23 | + } |
|
24 | 24 | } |
@@ -6,32 +6,32 @@ |
||
6 | 6 | |
7 | 7 | class PostTypeDefaults extends Defaults |
8 | 8 | { |
9 | - /** |
|
10 | - * @return array |
|
11 | - */ |
|
12 | - protected function defaults() |
|
13 | - { |
|
14 | - return [ |
|
15 | - 'columns' => [ |
|
16 | - 'title' => __('Title', 'site-reviews'), |
|
17 | - 'date' => __('Date', 'site-reviews'), |
|
18 | - ], |
|
19 | - 'has_archive' => false, |
|
20 | - 'hierarchical' => false, |
|
21 | - 'labels' => [], |
|
22 | - 'menu_icon' => null, |
|
23 | - 'menu_name' => '', |
|
24 | - 'menu_position' => 25, |
|
25 | - 'plural' => '', //Required |
|
26 | - 'post_type' => '', //Required |
|
27 | - 'public' => false, |
|
28 | - 'query_var' => true, |
|
29 | - 'rewrite' => ['with_front' => false], |
|
30 | - 'show_in_menu' => true, |
|
31 | - 'show_ui' => true, |
|
32 | - 'single' => '', //Required |
|
33 | - 'supports' => ['title', 'editor'], |
|
34 | - 'taxonomies' => [], |
|
35 | - ]; |
|
36 | - } |
|
9 | + /** |
|
10 | + * @return array |
|
11 | + */ |
|
12 | + protected function defaults() |
|
13 | + { |
|
14 | + return [ |
|
15 | + 'columns' => [ |
|
16 | + 'title' => __('Title', 'site-reviews'), |
|
17 | + 'date' => __('Date', 'site-reviews'), |
|
18 | + ], |
|
19 | + 'has_archive' => false, |
|
20 | + 'hierarchical' => false, |
|
21 | + 'labels' => [], |
|
22 | + 'menu_icon' => null, |
|
23 | + 'menu_name' => '', |
|
24 | + 'menu_position' => 25, |
|
25 | + 'plural' => '', //Required |
|
26 | + 'post_type' => '', //Required |
|
27 | + 'public' => false, |
|
28 | + 'query_var' => true, |
|
29 | + 'rewrite' => ['with_front' => false], |
|
30 | + 'show_in_menu' => true, |
|
31 | + 'show_ui' => true, |
|
32 | + 'single' => '', //Required |
|
33 | + 'supports' => ['title', 'editor'], |
|
34 | + 'taxonomies' => [], |
|
35 | + ]; |
|
36 | + } |
|
37 | 37 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | { |
14 | 14 | return [ |
15 | 15 | 'columns' => [ |
16 | - 'title' => __('Title', 'site-reviews'), |
|
17 | - 'date' => __('Date', 'site-reviews'), |
|
16 | + 'title' => __( 'Title', 'site-reviews' ), |
|
17 | + 'date' => __( 'Date', 'site-reviews' ), |
|
18 | 18 | ], |
19 | 19 | 'has_archive' => false, |
20 | 20 | 'hierarchical' => false, |
@@ -11,27 +11,27 @@ |
||
11 | 11 | |
12 | 12 | class RestCategoryController extends RestController |
13 | 13 | { |
14 | - public function __construct() |
|
15 | - { |
|
16 | - $this->meta = new WP_REST_Term_Meta_Fields(Application::TAXONOMY); |
|
17 | - $this->namespace = Application::ID.'/v1'; |
|
18 | - $this->rest_base = 'categories'; |
|
19 | - $this->taxonomy = Application::TAXONOMY; |
|
20 | - } |
|
14 | + public function __construct() |
|
15 | + { |
|
16 | + $this->meta = new WP_REST_Term_Meta_Fields(Application::TAXONOMY); |
|
17 | + $this->namespace = Application::ID.'/v1'; |
|
18 | + $this->rest_base = 'categories'; |
|
19 | + $this->taxonomy = Application::TAXONOMY; |
|
20 | + } |
|
21 | 21 | |
22 | - /** |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - public function register_routes() |
|
26 | - { |
|
27 | - register_rest_route($this->namespace, '/'.$this->rest_base, [ |
|
28 | - [ |
|
29 | - 'args' => $this->get_collection_params(), |
|
30 | - 'callback' => [$this, 'get_items'], |
|
31 | - 'methods' => Server::READABLE, |
|
32 | - 'permission_callback' => [$this, 'get_items_permissions_check'], |
|
33 | - ], |
|
34 | - 'schema' => [$this, 'get_public_item_schema'], |
|
35 | - ]); |
|
36 | - } |
|
22 | + /** |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + public function register_routes() |
|
26 | + { |
|
27 | + register_rest_route($this->namespace, '/'.$this->rest_base, [ |
|
28 | + [ |
|
29 | + 'args' => $this->get_collection_params(), |
|
30 | + 'callback' => [$this, 'get_items'], |
|
31 | + 'methods' => Server::READABLE, |
|
32 | + 'permission_callback' => [$this, 'get_items_permissions_check'], |
|
33 | + ], |
|
34 | + 'schema' => [$this, 'get_public_item_schema'], |
|
35 | + ]); |
|
36 | + } |
|
37 | 37 | } |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | { |
14 | 14 | public function __construct() |
15 | 15 | { |
16 | - $this->meta = new WP_REST_Term_Meta_Fields(Application::TAXONOMY); |
|
16 | + $this->meta = new WP_REST_Term_Meta_Fields( Application::TAXONOMY ); |
|
17 | 17 | $this->namespace = Application::ID.'/v1'; |
18 | 18 | $this->rest_base = 'categories'; |
19 | 19 | $this->taxonomy = Application::TAXONOMY; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function register_routes() |
26 | 26 | { |
27 | - register_rest_route($this->namespace, '/'.$this->rest_base, [ |
|
27 | + register_rest_route( $this->namespace, '/'.$this->rest_base, [ |
|
28 | 28 | [ |
29 | 29 | 'args' => $this->get_collection_params(), |
30 | 30 | 'callback' => [$this, 'get_items'], |
@@ -32,6 +32,6 @@ discard block |
||
32 | 32 | 'permission_callback' => [$this, 'get_items_permissions_check'], |
33 | 33 | ], |
34 | 34 | 'schema' => [$this, 'get_public_item_schema'], |
35 | - ]); |
|
35 | + ] ); |
|
36 | 36 | } |
37 | 37 | } |
@@ -38,7 +38,8 @@ |
||
38 | 38 | } |
39 | 39 | try { |
40 | 40 | return glsr($handlerClass)->handle($command); |
41 | - } catch (Exception $e) { |
|
41 | + } |
|
42 | + catch (Exception $e) { |
|
42 | 43 | status_header(400); |
43 | 44 | glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage())); |
44 | 45 | glsr_log()->error($e->getMessage()); |
@@ -10,55 +10,55 @@ |
||
10 | 10 | |
11 | 11 | abstract class Controller |
12 | 12 | { |
13 | - /** |
|
14 | - * @return void |
|
15 | - */ |
|
16 | - public function download($filename, $content) |
|
17 | - { |
|
18 | - if (!glsr()->can('edit_others_posts')) { |
|
19 | - return; |
|
20 | - } |
|
21 | - nocache_headers(); |
|
22 | - header('Content-Type: text/plain'); |
|
23 | - header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
24 | - echo html_entity_decode($content); |
|
25 | - exit; |
|
26 | - } |
|
13 | + /** |
|
14 | + * @return void |
|
15 | + */ |
|
16 | + public function download($filename, $content) |
|
17 | + { |
|
18 | + if (!glsr()->can('edit_others_posts')) { |
|
19 | + return; |
|
20 | + } |
|
21 | + nocache_headers(); |
|
22 | + header('Content-Type: text/plain'); |
|
23 | + header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
24 | + echo html_entity_decode($content); |
|
25 | + exit; |
|
26 | + } |
|
27 | 27 | |
28 | - /** |
|
29 | - * @param object $command |
|
30 | - * @return mixed |
|
31 | - * @throws InvalidArgumentException |
|
32 | - */ |
|
33 | - public function execute($command) |
|
34 | - { |
|
35 | - $handlerClass = str_replace('Commands', 'Handlers', get_class($command)); |
|
36 | - if (!class_exists($handlerClass)) { |
|
37 | - throw new InvalidArgumentException('Handler '.$handlerClass.' not found.'); |
|
38 | - } |
|
39 | - try { |
|
40 | - return glsr($handlerClass)->handle($command); |
|
41 | - } catch (Exception $e) { |
|
42 | - status_header(400); |
|
43 | - glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage())); |
|
44 | - glsr_log()->error($e->getMessage()); |
|
45 | - } |
|
46 | - } |
|
28 | + /** |
|
29 | + * @param object $command |
|
30 | + * @return mixed |
|
31 | + * @throws InvalidArgumentException |
|
32 | + */ |
|
33 | + public function execute($command) |
|
34 | + { |
|
35 | + $handlerClass = str_replace('Commands', 'Handlers', get_class($command)); |
|
36 | + if (!class_exists($handlerClass)) { |
|
37 | + throw new InvalidArgumentException('Handler '.$handlerClass.' not found.'); |
|
38 | + } |
|
39 | + try { |
|
40 | + return glsr($handlerClass)->handle($command); |
|
41 | + } catch (Exception $e) { |
|
42 | + status_header(400); |
|
43 | + glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage())); |
|
44 | + glsr_log()->error($e->getMessage()); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | |
48 | - /** |
|
49 | - * @return int |
|
50 | - */ |
|
51 | - protected function getPostId() |
|
52 | - { |
|
53 | - return intval(filter_input(INPUT_GET, 'post')); |
|
54 | - } |
|
48 | + /** |
|
49 | + * @return int |
|
50 | + */ |
|
51 | + protected function getPostId() |
|
52 | + { |
|
53 | + return intval(filter_input(INPUT_GET, 'post')); |
|
54 | + } |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param int $postId |
|
58 | - * @return bool |
|
59 | - */ |
|
60 | - protected function isReviewPostId($postId) |
|
61 | - { |
|
62 | - return Application::POST_TYPE == get_post_field('post_type', $postId); |
|
63 | - } |
|
56 | + /** |
|
57 | + * @param int $postId |
|
58 | + * @return bool |
|
59 | + */ |
|
60 | + protected function isReviewPostId($postId) |
|
61 | + { |
|
62 | + return Application::POST_TYPE == get_post_field('post_type', $postId); |
|
63 | + } |
|
64 | 64 | } |
@@ -13,15 +13,15 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * @return void |
15 | 15 | */ |
16 | - public function download($filename, $content) |
|
16 | + public function download( $filename, $content ) |
|
17 | 17 | { |
18 | - if (!glsr()->can('edit_others_posts')) { |
|
18 | + if( !glsr()->can( 'edit_others_posts' ) ) { |
|
19 | 19 | return; |
20 | 20 | } |
21 | 21 | nocache_headers(); |
22 | - header('Content-Type: text/plain'); |
|
23 | - header('Content-Disposition: attachment; filename="'.$filename.'"'); |
|
24 | - echo html_entity_decode($content); |
|
22 | + header( 'Content-Type: text/plain' ); |
|
23 | + header( 'Content-Disposition: attachment; filename="'.$filename.'"' ); |
|
24 | + echo html_entity_decode( $content ); |
|
25 | 25 | exit; |
26 | 26 | } |
27 | 27 | |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | * @return mixed |
31 | 31 | * @throws InvalidArgumentException |
32 | 32 | */ |
33 | - public function execute($command) |
|
33 | + public function execute( $command ) |
|
34 | 34 | { |
35 | - $handlerClass = str_replace('Commands', 'Handlers', get_class($command)); |
|
36 | - if (!class_exists($handlerClass)) { |
|
37 | - throw new InvalidArgumentException('Handler '.$handlerClass.' not found.'); |
|
35 | + $handlerClass = str_replace( 'Commands', 'Handlers', get_class( $command ) ); |
|
36 | + if( !class_exists( $handlerClass ) ) { |
|
37 | + throw new InvalidArgumentException( 'Handler '.$handlerClass.' not found.' ); |
|
38 | 38 | } |
39 | 39 | try { |
40 | - return glsr($handlerClass)->handle($command); |
|
41 | - } catch (Exception $e) { |
|
42 | - status_header(400); |
|
43 | - glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage())); |
|
44 | - glsr_log()->error($e->getMessage()); |
|
40 | + return glsr( $handlerClass )->handle( $command ); |
|
41 | + } catch( Exception $e ) { |
|
42 | + status_header( 400 ); |
|
43 | + glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() ) ); |
|
44 | + glsr_log()->error( $e->getMessage() ); |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | */ |
51 | 51 | protected function getPostId() |
52 | 52 | { |
53 | - return intval(filter_input(INPUT_GET, 'post')); |
|
53 | + return intval( filter_input( INPUT_GET, 'post' ) ); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * @param int $postId |
58 | 58 | * @return bool |
59 | 59 | */ |
60 | - protected function isReviewPostId($postId) |
|
60 | + protected function isReviewPostId( $postId ) |
|
61 | 61 | { |
62 | - return Application::POST_TYPE == get_post_field('post_type', $postId); |
|
62 | + return Application::POST_TYPE == get_post_field( 'post_type', $postId ); |
|
63 | 63 | } |
64 | 64 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | { |
15 | 15 | public function __construct() |
16 | 16 | { |
17 | - $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE); |
|
17 | + $this->meta = new WP_REST_Post_Meta_Fields( Application::POST_TYPE ); |
|
18 | 18 | $this->namespace = Application::ID.'/v1'; |
19 | 19 | $this->post_type = Application::POST_TYPE; |
20 | 20 | $this->rest_base = 'reviews'; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | // ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE], |
30 | 30 | // ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE], |
31 | 31 | // ]); |
32 | - register_rest_route($this->namespace, '/types', [ |
|
32 | + register_rest_route( $this->namespace, '/types', [ |
|
33 | 33 | ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE], |
34 | - ]); |
|
34 | + ] ); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | public function createReview() |
41 | 41 | { |
42 | 42 | $response = []; |
43 | - return rest_ensure_response($response); |
|
43 | + return rest_ensure_response( $response ); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | public function getReviews() |
50 | 50 | { |
51 | 51 | $response = []; |
52 | - return rest_ensure_response($response); |
|
52 | + return rest_ensure_response( $response ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -58,12 +58,12 @@ discard block |
||
58 | 58 | public function getReviewTypes() |
59 | 59 | { |
60 | 60 | $response = []; |
61 | - foreach (glsr()->reviewTypes as $slug => $name) { |
|
61 | + foreach( glsr()->reviewTypes as $slug => $name ) { |
|
62 | 62 | $response[] = [ |
63 | 63 | 'name' => $name, |
64 | 64 | 'slug' => $slug, |
65 | 65 | ]; |
66 | 66 | } |
67 | - return rest_ensure_response($response); |
|
67 | + return rest_ensure_response( $response ); |
|
68 | 68 | } |
69 | 69 | } |
@@ -12,58 +12,58 @@ |
||
12 | 12 | |
13 | 13 | class RestReviewController extends RestController |
14 | 14 | { |
15 | - public function __construct() |
|
16 | - { |
|
17 | - $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE); |
|
18 | - $this->namespace = Application::ID.'/v1'; |
|
19 | - $this->post_type = Application::POST_TYPE; |
|
20 | - $this->rest_base = 'reviews'; |
|
21 | - } |
|
15 | + public function __construct() |
|
16 | + { |
|
17 | + $this->meta = new WP_REST_Post_Meta_Fields(Application::POST_TYPE); |
|
18 | + $this->namespace = Application::ID.'/v1'; |
|
19 | + $this->post_type = Application::POST_TYPE; |
|
20 | + $this->rest_base = 'reviews'; |
|
21 | + } |
|
22 | 22 | |
23 | - /** |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - public function register_routes() |
|
27 | - { |
|
28 | - // register_rest_route($this->namespace, '/'.$this->rest_base, [ |
|
29 | - // ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE], |
|
30 | - // ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE], |
|
31 | - // ]); |
|
32 | - register_rest_route($this->namespace, '/types', [ |
|
33 | - ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE], |
|
34 | - ]); |
|
35 | - } |
|
23 | + /** |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + public function register_routes() |
|
27 | + { |
|
28 | + // register_rest_route($this->namespace, '/'.$this->rest_base, [ |
|
29 | + // ['callback' => [$this, 'createReview'], 'methods' => Server::CREATABLE], |
|
30 | + // ['callback' => [$this, 'getReviews'], 'methods' => Server::READABLE], |
|
31 | + // ]); |
|
32 | + register_rest_route($this->namespace, '/types', [ |
|
33 | + ['callback' => [$this, 'getReviewTypes'], 'methods' => Server::READABLE], |
|
34 | + ]); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * @return WP_Error|Response|mixed |
|
39 | - */ |
|
40 | - public function createReview() |
|
41 | - { |
|
42 | - $response = []; |
|
43 | - return rest_ensure_response($response); |
|
44 | - } |
|
37 | + /** |
|
38 | + * @return WP_Error|Response|mixed |
|
39 | + */ |
|
40 | + public function createReview() |
|
41 | + { |
|
42 | + $response = []; |
|
43 | + return rest_ensure_response($response); |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * @return WP_Error|Response|mixed |
|
48 | - */ |
|
49 | - public function getReviews() |
|
50 | - { |
|
51 | - $response = []; |
|
52 | - return rest_ensure_response($response); |
|
53 | - } |
|
46 | + /** |
|
47 | + * @return WP_Error|Response|mixed |
|
48 | + */ |
|
49 | + public function getReviews() |
|
50 | + { |
|
51 | + $response = []; |
|
52 | + return rest_ensure_response($response); |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return WP_Error|Response|mixed |
|
57 | - */ |
|
58 | - public function getReviewTypes() |
|
59 | - { |
|
60 | - $response = []; |
|
61 | - foreach (glsr()->reviewTypes as $slug => $name) { |
|
62 | - $response[] = [ |
|
63 | - 'name' => $name, |
|
64 | - 'slug' => $slug, |
|
65 | - ]; |
|
66 | - } |
|
67 | - return rest_ensure_response($response); |
|
68 | - } |
|
55 | + /** |
|
56 | + * @return WP_Error|Response|mixed |
|
57 | + */ |
|
58 | + public function getReviewTypes() |
|
59 | + { |
|
60 | + $response = []; |
|
61 | + foreach (glsr()->reviewTypes as $slug => $name) { |
|
62 | + $response[] = [ |
|
63 | + 'name' => $name, |
|
64 | + 'slug' => $slug, |
|
65 | + ]; |
|
66 | + } |
|
67 | + return rest_ensure_response($response); |
|
68 | + } |
|
69 | 69 | } |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | class TogglePinned |
6 | 6 | { |
7 | - public $id; |
|
8 | - public $pinned; |
|
7 | + public $id; |
|
8 | + public $pinned; |
|
9 | 9 | |
10 | - public function __construct($input) |
|
11 | - { |
|
12 | - $this->id = $input['id']; |
|
13 | - $this->pinned = isset($input['pinned']) |
|
14 | - ? wp_validate_boolean($input['pinned']) |
|
15 | - : null; |
|
16 | - } |
|
10 | + public function __construct($input) |
|
11 | + { |
|
12 | + $this->id = $input['id']; |
|
13 | + $this->pinned = isset($input['pinned']) |
|
14 | + ? wp_validate_boolean($input['pinned']) |
|
15 | + : null; |
|
16 | + } |
|
17 | 17 | } |
@@ -7,11 +7,11 @@ |
||
7 | 7 | public $id; |
8 | 8 | public $pinned; |
9 | 9 | |
10 | - public function __construct($input) |
|
10 | + public function __construct( $input ) |
|
11 | 11 | { |
12 | 12 | $this->id = $input['id']; |
13 | 13 | $this->pinned = isset($input['pinned']) |
14 | - ? wp_validate_boolean($input['pinned']) |
|
14 | + ? wp_validate_boolean( $input['pinned'] ) |
|
15 | 15 | : null; |
16 | 16 | } |
17 | 17 | } |