Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/tutor-pro/addons/subscription/src/Menu.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
/**
3
+
* Menu handler.
4
+
*
5
+
* @package TutorPro\Subscription
6
+
* @author Themeum <support@themeum.com>
7
+
* @link https://themeum.com
8
+
* @since 3.0.0
9
+
*/
10
+
11
+
namespace TutorPro\Subscription;
12
+
13
+
use TUTOR\Input;
14
+
use Tutor\Models\OrderModel;
15
+
use TutorPro\Subscription\Models\PlanModel;
16
+
use TutorPro\Subscription\Models\SubscriptionModel;
17
+
18
+
/**
19
+
* Menu Class.
20
+
*
21
+
* @since 3.0.0
22
+
*/
23
+
class Menu {
24
+
const PAGE_SLUG = 'tutor-subscriptions';
25
+
26
+
/**
27
+
* Register hooks and dependencies
28
+
*
29
+
* @since 3.0.0
30
+
*
31
+
* @param bool $register_hooks whether to register hooks or not.
32
+
*/
33
+
public function __construct( $register_hooks = true ) {
34
+
if ( ! $register_hooks ) {
35
+
return;
36
+
}
37
+
38
+
add_action( 'tutor_after_orders_admin_menu', array( $this, 'register_admin_menu' ) );
39
+
}
40
+
41
+
/**
42
+
* Register admin menu.
43
+
*
44
+
* @since 3.0.0
45
+
*
46
+
* @return void
47
+
*/
48
+
public function register_admin_menu() {
49
+
add_submenu_page( 'tutor', __( 'Subscriptions', 'tutor-pro' ), __( 'Subscriptions', 'tutor-pro' ), 'manage_options', self::PAGE_SLUG, array( $this, 'admin_subscriptions_view' ) );
50
+
}
51
+
52
+
/**
53
+
* Show admin subscriptions list page.
54
+
*
55
+
* @since 3.0.0
56
+
*
57
+
* @return void
58
+
*/
59
+
public function admin_subscriptions_view() {
60
+
$current_page = Input::get( 'page' );
61
+
$action = Input::get( 'action' );
62
+
63
+
if ( self::PAGE_SLUG === $current_page && 'edit' === $action ) {
64
+
include_once Utils::view_path( 'pages/subscription-edit.php' );
65
+
return;
66
+
}
67
+
68
+
include_once Utils::view_path( 'pages/subscription-list.php' );
69
+
}
70
+
}
71
+