/** * Install selected themes */ private function maybe_install_themes() { /** * When a plugin can be updated; the field will be check on the settings * When all plugins have been installed, they disappear from the list. */ $install_plugins = get_option($this->option_name); if (empty($install_plugins) || !isset($install_plugins['theme']) || !is_array($install_plugins['theme'])) { return; } printf('<h2>%s</h2>', __('Installing themes...', 'stencil')); foreach ($install_plugins['theme'] as $slug => $on) { $theme = $this->installables->get_by_slug($slug); if ($theme->is_installed()) { continue; } $installed = $theme->install(); if (!$installed) { printf('<em>%s</em><br>', sprintf(__('Theme %s could not be installed!', 'stencil'), $theme)); } unset($install_plugins['theme'][$slug]); } printf('<b>%s</b>', __('Done.', 'stencil')); if (empty($install_plugins['theme'])) { unset($install_plugins['theme']); } update_option($this->option_name, $install_plugins); }
/** * Check for all upgrades * * @return bool */ public function check_for_upgrades() { // Don't check twice. static $checked = false; if (false !== $checked) { return false; } $checked = true; $this->upgrades = $this->installables->get_upgradable(); return true; }