acf_settings_info   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 93
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 93
rs 10
c 0
b 0
f 0
wmc 6
lcom 0
cbo 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A admin_menu() 0 14 2
A html() 0 26 3
1
<?php
2
3
class acf_settings_info {
4
5
	/*
6
	*  __construct
7
	*
8
	*  Initialize filters, action, variables and includes
9
	*
10
	*  @type	function
11
	*  @date	23/06/12
12
	*  @since	5.0.0
13
	*
14
	*  @param	n/a
15
	*  @return	n/a
16
	*/
0 ignored issues
show
Documentation introduced by
The doc-type n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
17
18
	function __construct() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
19
20
		// actions
21
		add_action('admin_menu',	array($this, 'admin_menu'));
22
		
23
	}
24
25
26
	/*
27
	*  admin_menu
28
	*
29
	*  This function will add the ACF menu item to the WP admin
30
	*
31
	*  @type	action (admin_menu)
32
	*  @date	28/09/13
33
	*  @since	5.0.0
34
	*
35
	*  @param	n/a
36
	*  @return	n/a
37
	*/
0 ignored issues
show
Documentation introduced by
The doc-type n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
38
39
	function admin_menu() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
40
41
		// bail early if no show_admin
42
		if( !acf_get_setting('show_admin') ) {
43
		
44
			return;
45
			
46
		}
47
48
49
		// add page
50
		add_submenu_page('edit.php?post_type=acf-field-group', __('Info','acf'), __('Info','acf'), acf_get_setting('capability'),'acf-settings-info', array($this,'html'));
51
52
	}
53
54
55
	/*
56
	*  html
57
	*
58
	*  description
59
	*
60
	*  @type	function
61
	*  @date	7/01/2014
62
	*  @since	5.0.0
63
	*
64
	*  @param	$post_id (int)
65
	*  @return	$post_id (int)
66
	*/
0 ignored issues
show
Documentation introduced by
The doc-type $post_id could not be parsed: Unknown type name "$post_id" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
67
68
	function html() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
69
		
70
		// vars
71
		$view = array(
72
			'version'		=> acf_get_setting('version'),
73
			'have_pro'		=> acf_get_setting('pro'),
74
			'tabs'			=> array(
75
				'new'			=> __("What's New", 'acf'),
76
				'changelog'		=> __("Changelog", 'acf')
77
			),
78
			'active'		=> 'new'
79
		);
80
		
81
		
82
		// set active tab
83
		if( !empty($_GET['tab']) && array_key_exists($_GET['tab'], $view['tabs']) ) {
84
			
85
			$view['active'] = $_GET['tab'];
86
			
87
		}
88
		
89
		
90
		// load view
91
		acf_get_view('settings-info', $view);
92
93
	}
94
95
}
96
97
98
// initialize
99
new acf_settings_info();
100
101
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
102