PluginProbe
Hello Plus / 1.4.0
Hello Plus v1.4.0
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.5.3 1.6.0 1.6.1 1.6.2 1.7.0 1.7.1 1.7.2 1.7.3 All 30 releases
hello-plus / modules / admin / classes / rest / whats-new.php

whats-new.php in Hello Plus 1.4.0, at modules/admin/classes/rest/whats-new.php

37 lines 894 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace HelloPlus\Modules\Admin\Classes\Rest;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 use HelloPlus\Modules\Admin\Module;
9
10 class Whats_New {
11 public function get_notifications() {
12 /**
13 * @var \HelloPlus\Modules\Admin\Components\Notificator $notifications_component
14 */
15 $notifications_component = Module::instance()->get_component( 'Notificator' );
16 return $notifications_component->get_notifications_by_conditions( true );
17 }
18
19 public function rest_api_init() {
20 register_rest_route(
21 'elementor-hello-plus/v1',
22 '/whats-new',
23 [
24 'methods' => \WP_REST_Server::READABLE,
25 'callback' => [ $this, 'get_notifications' ],
26 'permission_callback' => function () {
27 return current_user_can( 'manage_options' );
28 },
29 ]
30 );
31 }
32
33 public function __construct() {
34 add_action( 'rest_api_init', [ $this, 'rest_api_init' ] );
35 }
36 }
37