|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Sets up the admin page for the plaats enhance features where the updater |
|
5
|
|
|
* process can be triggered. |
|
6
|
|
|
* |
|
7
|
|
|
* @link https://wordlift.io |
|
8
|
|
|
* @since 1.0.0 |
|
9
|
|
|
* |
|
10
|
|
|
* @package Wordlift_Framework\Tasks\Admin |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace Wordlift\Tasks\Admin; |
|
14
|
|
|
|
|
15
|
|
|
use Wordlift\Tasks\Task_Ajax_Adapters_Registry; |
|
16
|
|
|
use Wordlift\Wordpress\Submenu_Page_Base; |
|
17
|
|
|
use Wordlift\Wordpress\Page; |
|
18
|
|
|
|
|
19
|
|
|
abstract class Tasks_Page_Base extends Submenu_Page_Base { |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* The ID of this admin page. |
|
23
|
|
|
* |
|
24
|
|
|
* @since 1.0.0 |
|
25
|
|
|
* @access private |
|
26
|
|
|
* @var string $menu_slug The ID of this page. |
|
27
|
|
|
*/ |
|
28
|
|
|
private $menu_slug; |
|
|
|
|
|
|
29
|
|
|
|
|
30
|
|
|
/** |
|
31
|
|
|
* @var Task_Ajax_Adapters_Registry |
|
32
|
|
|
*/ |
|
33
|
|
|
private $task_ajax_adapters_registry; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
private $version; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Define the {@link Wordlift_Admin_Page} constructor. |
|
42
|
|
|
* |
|
43
|
|
|
* @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry |
|
44
|
|
|
* |
|
45
|
|
|
* @param string $version |
|
46
|
|
|
* @param string $menu_slug |
|
47
|
|
|
* @param string $page_title |
|
48
|
|
|
* @param string $capability |
|
49
|
|
|
* @param string|null $parent_slug |
|
50
|
|
|
* @param string|null $menu_title |
|
51
|
|
|
* |
|
52
|
|
|
* @since 1.0.0 |
|
53
|
|
|
*/ |
|
54
|
|
|
public function __construct( $task_ajax_adapters_registry, $version, $menu_slug, $page_title, $capability = 'manage_options', $parent_slug = null, $menu_title = null ) { |
|
55
|
|
|
parent::__construct( $menu_slug, $page_title, $capability, $parent_slug, $menu_title ); |
|
56
|
|
|
|
|
57
|
|
|
$this->task_ajax_adapters_registry = $task_ajax_adapters_registry; |
|
58
|
|
|
$this->version = $version; |
|
59
|
|
|
$this->menu_slug = $menu_slug; |
|
60
|
|
|
|
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Register the stylesheets and scripts for the admin area. |
|
65
|
|
|
* |
|
66
|
|
|
* @since 1.0.0 |
|
67
|
|
|
*/ |
|
68
|
|
View Code Duplication |
public function enqueue_scripts() { |
|
|
|
|
|
|
69
|
|
|
wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->version, 'all' ); |
|
70
|
|
|
wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array( |
|
71
|
|
|
'jquery', |
|
72
|
|
|
'wp-util' |
|
73
|
|
|
), $this->version, true ); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* Render the page. |
|
78
|
|
|
* |
|
79
|
|
|
* @since 1.0.0 |
|
80
|
|
|
*/ |
|
81
|
|
|
public function render() { |
|
82
|
|
|
|
|
83
|
|
|
// Include the partial. |
|
84
|
|
|
include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' ); |
|
85
|
|
|
|
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|