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
Pull Request — master (#1073)
by
unknown
02:42
created

menu.php ➔ admin_menu()   B

Complexity

Conditions 8
Paths 2

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 8
eloc 6
nc 2
nop 0
dl 0
loc 11
rs 7.7777
c 1
b 1
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
 * Add a link to the backups page to the plugin action links.
46
 *
47
 * @param array $links
48
 * @param string $file
49
 *
50
 * @return array $links
51
 */
52
function plugin_action_link( $links, $file ) {
53
54
	if ( false !== strpos( $file, HMBKP_PLUGIN_SLUG ) ) {
55
		array_push( $links, '<a href="' . esc_url( HMBKP_ADMIN_URL ) . '">' . __( 'Backups', 'backupwordpress' ) . '</a>' );
56
	}
57
58
	return $links;
59
60
}
61
add_filter( 'plugin_action_links', 'HM\BackUpWordPress\plugin_action_link', 10, 2 );
62
63
/**
64
 * Add Contextual Help to Backups tools page.
65
 *
66
 * Help is pulled from the readme FAQ.
67
 *
68
 * @return null
69
 */
70
function contextual_help() {
71
72
	// Pre WordPress 3.3 compat
73
	if ( ! method_exists( get_current_screen(), 'add_help_tab' ) ) {
74
		return;
75
	}
76
77
	ob_start();
78
	require_once( HMBKP_PLUGIN_PATH . 'admin/constants.php' );
79
	$constants = ob_get_clean();
80
81
	ob_start();
82
	include_once( HMBKP_PLUGIN_PATH . 'admin/faq.php' );
83
	$faq = ob_get_clean();
84
85
	get_current_screen()->add_help_tab( array(
86
		'title'   => __( 'FAQ', 'backupwordpress' ),
87
		'id'      => 'hmbkp_faq',
88
		'content' => wp_kses_post( $faq ),
89
	) );
90
91
	get_current_screen()->add_help_tab( array(
92
		'title'   => __( 'Constants', 'backupwordpress' ),
93
		'id'      => 'hmbkp_constants',
94
		'content' => wp_kses_post( $constants ),
95
	) );
96
97
	require_once( HMBKP_PLUGIN_PATH . 'classes/class-requirements.php' );
98
99
	ob_start();
100
	require_once( HMBKP_PLUGIN_PATH . 'admin/server-info.php' );
101
	$info = ob_get_clean();
102
103
	get_current_screen()->add_help_tab(
104
		array(
105
			'title'   => __( 'Server Info', 'backupwordpress' ),
106
			'id'      => 'hmbkp_server',
107
			'content' => $info,
108
		)
109
	);
110
111
	get_current_screen()->set_help_sidebar(
112
		'<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>'
113
	);
114
115
}
116
add_action( 'load-' . HMBKP_ADMIN_PAGE, 'HM\BackUpWordPress\contextual_help' );
117