GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (71fca9)
by
unknown
04:39
created

menu.php ➔ highlight_submenu()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 1
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace HM\BackUpWordPress;
4
5
/**
6
 * Add the backups menu item
7
 * to the tools menu
8
 */
9
function admin_menu() {
10
11
	if ( is_multisite() ) {
12
		add_submenu_page( 'settings.php', __( 'Manage Backups | BackUpWordPress', 'backupwordpress' ), __( 'Backups', 'backupwordpress' ), ( defined( 'HMBKP_CAPABILITY' ) && HMBKP_CAPABILITY ) ? HMBKP_CAPABILITY : 'manage_options', HMBKP_PLUGIN_SLUG, 'HM\BackUpWordPress\manage_backups' );
13
	} else {
14
		add_management_page( __( 'Manage Backups', 'backupwordpress' ), __( 'Backups', 'backupwordpress' ), ( defined( 'HMBKP_CAPABILITY' ) && HMBKP_CAPABILITY ) ? HMBKP_CAPABILITY : 'manage_options', HMBKP_PLUGIN_SLUG, 'HM\BackUpWordPress\manage_backups' );
15
	}
16
17
	add_submenu_page( null, __( 'BackUpWordPress Extensions', 'backupwordpress' ), __( 'Extensions', 'backupwordpress' ), ( defined( 'HMBKP_CAPABILITY' ) && HMBKP_CAPABILITY ) ? HMBKP_CAPABILITY : 'manage_options', HMBKP_PLUGIN_SLUG . '_extensions', 'HM\BackUpWordPress\extensions' );
18
19
}
20
add_action( 'network_admin_menu', 'HM\BackUpWordPress\admin_menu' );
21
add_action( 'admin_menu', 'HM\BackUpWordPress\admin_menu' );
22
23
/**
24
 * Load the backups admin page
25
 * when the menu option is clicked
26
 *
27
 * @return null
28
 */
29
function manage_backups() {
30
	require_once( HMBKP_PLUGIN_PATH . 'admin/page.php' );
31
}
32
33
34
/**
35
 * Load the backups admin page
36
 * when the menu option is clicked
37
 *
38
 * @return null
39
 */
40
function extensions() {
41
	require_once( HMBKP_PLUGIN_PATH . 'admin/extensions.php' );
42
}
43
44
/**
45
 * Highlights the 'Backups' submenu item when on the Extensions page
46
 *
47
 * @param string $submenu_file
48
 * @return string $submenu_file The slug of the menu item to highlight
49
 */
50
function highlight_submenu( $submenu_file ) {
51
52
	$screen = get_current_screen();
53
54
	if ( 'tools_page_' . HMBKP_PLUGIN_SLUG . '_extensions' === $screen->id ) {
55
56
		// Set the main plugin page to be the active submenu page
57
		$submenu_file = HMBKP_PLUGIN_SLUG;
58
59
	}
60
61
	return $submenu_file;
62
63
}
64
add_filter( 'submenu_file', 'HM\BackUpWordPress\highlight_submenu' );
65
66
/**
67
 * Add a link to the backups page to the plugin action links.
68
 *
69
 * @param array $links
70
 * @param string $file
71
 *
72
 * @return array $links
73
 */
74
function plugin_action_link( $links, $file ) {
75
76
	if ( false !== strpos( $file, HMBKP_PLUGIN_SLUG ) ) {
77
		array_push( $links, '<a href="' . esc_url( HMBKP_ADMIN_URL ) . '">' . __( 'Backups', 'backupwordpress' ) . '</a>' );
78
	}
79
80
	return $links;
81
82
}
83
add_filter( 'plugin_action_links', 'HM\BackUpWordPress\plugin_action_link', 10, 2 );
84
85
/**
86
 * Add Contextual Help to Backups tools page.
87
 *
88
 * Help is pulled from the readme FAQ.
89
 *
90
 * @return null
91
 */
92
function contextual_help() {
93
94
	// Pre WordPress 3.3 compat
95
	if ( ! method_exists( get_current_screen(), 'add_help_tab' ) ) {
96
		return;
97
	}
98
99
	ob_start();
100
	require_once( HMBKP_PLUGIN_PATH . 'admin/constants.php' );
101
	$constants = ob_get_clean();
102
103
	ob_start();
104
	include_once( HMBKP_PLUGIN_PATH . 'admin/faq.php' );
105
	$faq = ob_get_clean();
106
107
	get_current_screen()->add_help_tab( array(
108
		'title'   => __( 'FAQ', 'backupwordpress' ),
109
		'id'      => 'hmbkp_faq',
110
		'content' => wp_kses_post( $faq ),
111
	) );
112
113
	get_current_screen()->add_help_tab( array(
114
		'title'   => __( 'Constants', 'backupwordpress' ),
115
		'id'      => 'hmbkp_constants',
116
		'content' => wp_kses_post( $constants ),
117
	) );
118
119
	require_once( HMBKP_PLUGIN_PATH . 'classes/class-requirements.php' );
120
121
	ob_start();
122
	require_once( HMBKP_PLUGIN_PATH . 'admin/server-info.php' );
123
	$info = ob_get_clean();
124
125
	get_current_screen()->add_help_tab(
126
		array(
127
			'title'   => __( 'Server Info', 'backupwordpress' ),
128
			'id'      => 'hmbkp_server',
129
			'content' => $info,
130
		)
131
	);
132
133
	get_current_screen()->set_help_sidebar(
134
		'<p><strong>' . esc_html__( 'For more information:', 'backupwordpress' ) . '</strong></p><p><a href="https://github.com/humanmade/backupwordpress" target="_blank">GitHub</a></p><p><a href="http://wordpress.org/tags/backupwordpress?forum_id=10" target="_blank">' . esc_html__( 'Support Forums', 'backupwordpress' ) . '</a></p><p><a href="https://translate.wordpress.org/projects/wp-plugins/backupwordpress/dev/" target="_blank">' . esc_html__( 'Help with translation', 'backupwordpress' ) . '</a></p>'
135
	);
136
137
}
138
add_action( 'load-' . HMBKP_ADMIN_PAGE, 'HM\BackUpWordPress\contextual_help' );
139