PluginProbe
WP Popular Posts / 7.4.2
WP Popular Posts v7.4.2
7.4.2 7.4.1 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 5.0.0 5.0.1 5.0.2 5.1.0 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 All 93 releases
wordpress-popular-posts / src / Rest / Controller.php
Controller.php
97 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace WordPressPopularPosts\Rest;
3
4 class Controller {
5
6 /**
7 * Posts Endpoint.
8 *
9 * @var \WordPressPopularPosts\Rest\PostsEndpoint
10 * @access private
11 */
12 private $posts_endpoint;
13
14 /**
15 * View Logger Endpoint.
16 *
17 * @var \WordPressPopularPosts\Rest\ViewLoggerEndpoint
18 * @access private
19 */
20 private $view_logger_endpoint;
21
22 /**
23 * View Logger Endpoint.
24 *
25 * @var \WordPressPopularPosts\Rest\WidgetEndpoint
26 * @access private
27 */
28 private $widget_endpoint;
29
30 /**
31 * Themes Endpoint.
32 *
33 * @var \WordPressPopularPosts\Rest\ThemesEndpoint
34 * @access private
35 */
36 private $themes_endpoint;
37
38 /**
39 * Themes Endpoint.
40 *
41 * @var \WordPressPopularPosts\Rest\ThumbnailsEndpoint
42 * @access private
43 */
44 private $thumbnails_endpoint;
45
46 /**
47 * Themes Endpoint.
48 *
49 * @var \WordPressPopularPosts\Rest\TaxonomiesEndpoint
50 * @access private
51 */
52 private $taxonomies_endpoint;
53
54 /**
55 * Initialize class.
56 *
57 * @param \WordPressPopularPosts\Rest\PostsEndpoint
58 * @param \WordPressPopularPosts\Rest\ViewLoggerEndpoint
59 * @param \WordPressPopularPosts\Rest\WidgetEndpoint
60 * @param \WordPressPopularPosts\Rest\ThemesEndpoint
61 * @param \WordPressPopularPosts\Rest\ThumbnailsEndpoint
62 * @param \WordPressPopularPosts\Rest\TaxonomiesEndpoint
63 */
64 public function __construct(PostsEndpoint $posts_endpoint, ViewLoggerEndpoint $view_logger_endpoint, WidgetEndpoint $widget_endpoint, ThemesEndpoint $themes_endpoint, ThumbnailsEndpoint $thumbnails_endpoint, TaxonomiesEndpoint $taxonomies_endpoint)
65 {
66 $this->posts_endpoint = $posts_endpoint;
67 $this->view_logger_endpoint = $view_logger_endpoint;
68 $this->widget_endpoint = $widget_endpoint;
69 $this->themes_endpoint = $themes_endpoint;
70 $this->thumbnails_endpoint = $thumbnails_endpoint;
71 $this->taxonomies_endpoint = $taxonomies_endpoint;
72 }
73
74 /**
75 * WordPress hooks.
76 *
77 * @since 5.0.0
78 */
79 public function hooks()
80 {
81 add_action('rest_api_init', [$this, 'register_routes']);
82 }
83
84 /**
85 * Registers REST endpoints.
86 */
87 public function register_routes()
88 {
89 $this->posts_endpoint->register();
90 $this->view_logger_endpoint->register();
91 $this->widget_endpoint->register();
92 $this->themes_endpoint->register();
93 $this->thumbnails_endpoint->register();
94 $this->taxonomies_endpoint->register();
95 }
96 }
97