@@ -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 | } |
@@ -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 (!current_user_can(glsr()->constant('CAPABILITY'))) { |
|
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 (!current_user_can(glsr()->constant('CAPABILITY'))) { |
|
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 | } |
@@ -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 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | class RegisterWidgets |
6 | 6 | { |
7 | - public $widgets; |
|
7 | + public $widgets; |
|
8 | 8 | |
9 | - public function __construct($input) |
|
10 | - { |
|
11 | - $this->widgets = $input; |
|
12 | - } |
|
9 | + public function __construct($input) |
|
10 | + { |
|
11 | + $this->widgets = $input; |
|
12 | + } |
|
13 | 13 | } |
@@ -4,14 +4,14 @@ |
||
4 | 4 | |
5 | 5 | class ChangeStatus |
6 | 6 | { |
7 | - public $id; |
|
8 | - public $status; |
|
7 | + public $id; |
|
8 | + public $status; |
|
9 | 9 | |
10 | - public function __construct($input) |
|
11 | - { |
|
12 | - $this->id = $input['post_id']; |
|
13 | - $this->status = 'approve' == $input['status'] |
|
14 | - ? 'publish' |
|
15 | - : 'pending'; |
|
16 | - } |
|
10 | + public function __construct($input) |
|
11 | + { |
|
12 | + $this->id = $input['post_id']; |
|
13 | + $this->status = 'approve' == $input['status'] |
|
14 | + ? 'publish' |
|
15 | + : 'pending'; |
|
16 | + } |
|
17 | 17 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | class RegisterTinymcePopups |
6 | 6 | { |
7 | - public $popups; |
|
7 | + public $popups; |
|
8 | 8 | |
9 | - public function __construct($input) |
|
10 | - { |
|
11 | - $this->popups = $input; |
|
12 | - } |
|
9 | + public function __construct($input) |
|
10 | + { |
|
11 | + $this->popups = $input; |
|
12 | + } |
|
13 | 13 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | class RegisterTaxonomy |
6 | 6 | { |
7 | - public $args; |
|
7 | + public $args; |
|
8 | 8 | |
9 | - public function __construct($input) |
|
10 | - { |
|
11 | - $this->args = $input; |
|
12 | - } |
|
9 | + public function __construct($input) |
|
10 | + { |
|
11 | + $this->args = $input; |
|
12 | + } |
|
13 | 13 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | class EnqueueAdminAssets |
6 | 6 | { |
7 | - public $pointers; |
|
7 | + public $pointers; |
|
8 | 8 | |
9 | - public function __construct(array $input) |
|
10 | - { |
|
11 | - $this->pointers = $input['pointers']; |
|
12 | - } |
|
9 | + public function __construct(array $input) |
|
10 | + { |
|
11 | + $this->pointers = $input['pointers']; |
|
12 | + } |
|
13 | 13 | } |
@@ -4,10 +4,10 @@ |
||
4 | 4 | |
5 | 5 | class RegisterShortcodes |
6 | 6 | { |
7 | - public $shortcodes; |
|
7 | + public $shortcodes; |
|
8 | 8 | |
9 | - public function __construct($input) |
|
10 | - { |
|
11 | - $this->shortcodes = $input; |
|
12 | - } |
|
9 | + public function __construct($input) |
|
10 | + { |
|
11 | + $this->shortcodes = $input; |
|
12 | + } |
|
13 | 13 | } |