/** * Instantiate Plugin, Theme, and Settings for proper user capabilities. * * @return bool */ public function init() { global $pagenow; $load_multisite = is_network_admin() && current_user_can('manage_network'); $load_single_site = !is_multisite() && current_user_can('manage_options'); self::$load_repo_meta = $load_multisite || $load_single_site; // Set $force_meta_update = true on appropriate admin pages. $force_meta_update = false; $admin_pages = array('plugins.php', 'plugin-install.php', 'themes.php', 'theme-install.php', 'update-core.php', 'update.php', 'options-general.php', 'settings.php'); foreach (array_keys(Settings::$remote_management) as $key) { // Remote management only needs to be active for admin pages. if (is_admin() && !empty(self::$options_remote[$key])) { $admin_pages = array_merge($admin_pages, array('index.php', 'admin-ajax.php')); } } if (in_array($pagenow, array_unique($admin_pages))) { $force_meta_update = true; // Run GitHub Updater upgrade functions. new GHU_Upgrade(); // Ensure transient updated on plugins.php and themes.php pages. add_action('admin_init', array(&$this, 'admin_pages_update_transient')); } if (isset($_POST['ghu_refresh_cache'])) { /** * Fires later in cycle when Refreshing Cache. * * @since 6.0.0 */ do_action('ghu_refresh_transients'); } if ($force_meta_update) { $this->forced_meta_update_plugins(); } if ($force_meta_update) { $this->forced_meta_update_themes(); } if (is_admin() && self::$load_repo_meta && !apply_filters('github_updater_hide_settings', false)) { new Settings(); } return true; }