public function create_error_message($type = '')
{
global $pagenow;
$update_pages = array('update-core.php', 'plugins.php', 'themes.php');
$settings_pages = array('settings.php', 'options-general.php');
if (!in_array($pagenow, array_merge($update_pages, $settings_pages)) || in_array($pagenow, $settings_pages) && (!isset($_GET['page']) || 'github-updater' !== $_GET['page'])) {
return false;
}
if (is_admin() && !parent::is_doing_ajax()) {
switch ($type) {
case is_wp_error($type):
self::$error_message = $type->get_error_message();
if (false !== strstr(self::$error_message, 'timed out')) {
break;
}
add_action('admin_notices', array(&$this, 'show_wp_error'));
add_action('network_admin_notices', array(&$this, 'show_wp_error'));
break;
case 'gitlab':
add_action('admin_notices', array(&$this, 'gitlab_error'));
add_action('network_admin_notices', array(&$this, 'gitlab_error'));
case 'git':
default:
add_action('admin_notices', array(&$this, 'show_403_error_message'));
add_action('network_admin_notices', array(&$this, 'show_403_error_message'));
add_action('admin_notices', array(&$this, 'show_401_error_message'));
add_action('network_admin_notices', array(&$this, 'show_401_error_message'));
}
}
return true;
}