Add_Ons::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 16
Code Lines 9

Duplication

Lines 16
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
nc 1
nop 0
dl 16
loc 16
rs 9.4285
c 0
b 0
f 0
1
<?php
2
/**
3
 * Add-ons Page
4
 *
5
 * @package SimpleCalendar/Admin
6
 */
7
namespace SimpleCalendar\Admin\Pages;
8
9
use SimpleCalendar\Abstracts\Admin_Page;
10
11
if ( ! defined( 'ABSPATH' ) ) {
12
	exit;
13
}
14
15
/**
16
 * Add-ons page.
17
 *
18
 * @since 3.0.0
19
 */
20
class Add_Ons extends Admin_Page {
21
22
	/**
23
	 * Constructor.
24
	 *
25
	 * @since 3.0.0
26
	 */
27 View Code Duplication
	public function __construct() {
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...
28
29
		$this->id           = $tab = 'add-ons';
30
		$this->option_group = $page = 'add-ons';
31
		$this->label        = __( 'Add-ons', 'google-calendar-events' );
32
		$this->description  = '';
33
		$this->sections     = $this->add_sections();
34
		$this->fields       = $this->add_fields();
35
36
		// Disable the submit button for this page.
37
		add_filter( 'simcal_admin_page_' . $page . '_' . $tab . '_submit', function() { return false; } );
38
39
		// Add html.
40
		add_action( 'simcal_admin_page_' . $page . '_' . $tab . '_end', array( $this, 'html' ) );
41
42
	}
43
44
	/**
45
	 * Output page markup.
46
	 *
47
	 * @since 3.0.0
48
	 */
49
	public function html() {
50
51
		// @todo pull data from simplecalendar.io to showcase add-ons
52
		$js_redirect = '<script type="text/javascript">';
53
		$js_redirect .= 'window.location = "' . simcal_ga_campaign_url( simcal_get_url( 'addons' ), 'core-plugin', 'plugin-submenu-link', true ) . '"';
54
		$js_redirect .= '</script>';
55
56
		echo $js_redirect;
57
	}
58
59
	/**
60
	 * Add sections.
61
	 *
62
	 * @since  3.0.0
63
	 *
64
	 * @return array
65
	 */
66
	public function add_sections() {
67
		return array();
68
	}
69
70
	/**
71
	 * Add fields.
72
	 *
73
	 * @since  3.0.0
74
	 *
75
	 * @return array
76
	 */
77
	public function add_fields() {
78
		return array();
79
	}
80
81
}
82