Completed
Push — master ( 9f3eac...f0c1b5 )
by David
02:49 queued 13s
created

Tasks_Page::render()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
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
class Tasks_Page 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 = 'wl_tasks_page';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
29
30
	/**
31
	 * Used when enqueueing styles or scripts as the version string.
32
	 *
33
	 * @since  1.0.0
34
	 * @access private
35
	 * @var    string
36
	 */
37
	private $asset_version = '1.0.0';
38
39
	/**
40
	 * @var Task_Ajax_Adapters_Registry
41
	 */
42
	private $task_ajax_adapters_registry;
43
44
	/**
45
	 * Define the {@link Wordlift_Admin_Page} constructor.
46
	 *
47
	 * @param Task_Ajax_Adapters_Registry $task_ajax_adapters_registry
48
	 *
49
	 * @since 1.0.0
50
	 */
51
	public function __construct( $task_ajax_adapters_registry ) {
52
		parent::__construct( $this->menu_slug, __( 'Tasks', 'wordlift-framework' ), 'manage_options', 'wl_admin_menu', __( 'Tasks', 'wordlift-framework' ) );
53
54
		$this->task_ajax_adapters_registry = $task_ajax_adapters_registry;
55
56
	}
57
58
	/**
59
	 * Register the stylesheets and scripts for the admin area.
60
	 *
61
	 * @since    1.0.0
62
	 */
63 View Code Duplication
	public function enqueue_scripts() {
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
64
		wp_enqueue_style( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.css', array(), $this->asset_version, 'all' );
65
		wp_enqueue_script( $this->menu_slug, plugin_dir_url( __FILE__ ) . 'assets/tasks-page.js', array(
66
			'jquery',
67
			'wp-util'
68
		), $this->asset_version, true );
69
	}
70
71
	/**
72
	 * Render the page.
73
	 *
74
	 * @since 1.0.0
75
	 */
76
	public function render() {
77
78
		// Include the partial.
79
		include( plugin_dir_path( __FILE__ ) . 'assets/tasks-page.php' );
80
81
	}
82
83
}
84