/** * Display a custom install notice if the plugin is not setup */ function get_admin_notice() { $plugins_not_installed = $this->required_plugins_not_installed(); if (empty($plugins_not_installed)) { parent::get_admin_notice(); return; } $this->plugin_installer->load_installer_assets(); if ($notices = get_site_transient('as3cfpro_installer_notices')) { if (isset($notices['filesystem_error'])) { // Don't show the installer notice if we have filesystem credential issues return; } } $install_notice = untrailingslashit(plugin_dir_path($this->plugin_file_path)) . '/view/install-notice.php'; include $install_notice; }
/** * Change the addon compatibility notice * * @param string $notice * @param array $addons_to_install * * @return string */ function compatibility_addon_notice($notice, $addons_to_install) { $available_addons = array(); $unavailable_addons = array(); $valid_licence = $this->as3cf->is_valid_licence(); if (false === $valid_licence) { $notice = $this->render_addon_list($addons_to_install); $notice .= '<p>' . __('You must have a valid license to install these addons.', 'as3cf-pro'); return $notice; } if (false === get_site_transient('as3cfpro_addons_available')) { // Addons available for license data not stored, don't show notice return false; } $licence_addons = $this->as3cf->get_plugin_addons(); foreach ($licence_addons as $base => $addon) { if (!isset($addons_to_install[$addon['slug']])) { continue; } if (false === $addon['available']) { $unavailable_addons[$addon['slug']] = $addons_to_install[$addon['slug']]; } else { $available_addons[$addon['slug']] = $addons_to_install[$addon['slug']]; } } $available_singular_text = __('Install & Activate Addon', 'as3cf-pro'); $available_plural_text = __('Install & Activate Addons', 'as3cf-pro'); $available = $this->render_addon_list($available_addons); $available .= '<p style="margin-bottom: 10px;">'; $available .= '<a href="#" class="button button-large install-plugins" data-process="' . $this->plugin_installer->process_key . '">'; $available .= _n($available_singular_text, $available_plural_text, count($available_addons)); $available .= '</a></p>'; if (!empty($available_addons)) { // Clean the plugin names $plugins_to_install = array(); foreach ($available_addons as $slug => $addon) { $plugins_to_install[$slug] = array('name' => $addon . ' ' . __('Addon', 'as3cf-pro')); } // Fire up the plugin installer $this->plugin_installer->set_plugins_to_install($plugins_to_install); $this->plugin_installer->load_installer_assets(); } if (empty($unavailable_addons)) { // All addons available return $available; } $unavailable_singular_text = __('Unfortunately, your current license does not give you access to the following addon. You need to upgrade your license to get this addon.', 'as3cf-pro'); $unavailable_plural_text = __('Unfortunately, your current license does not give you access to the following addons. You need to upgrade your license to get these addons.', 'as3cf-pro'); $unavailable = '<p>' . _n($unavailable_singular_text, $unavailable_plural_text, count($unavailable_addons)) . '</p>'; $unavailable .= $this->render_addon_list($unavailable_addons); $account_url = 'https://deliciousbrains.com/my-account/'; $unavailable .= '<p><a href="' . $account_url . '">'; $unavailable .= __('View License Upgrades', 'as3cf-pro'); $unavailable .= '</a></p>'; if (empty($available_addons)) { // All addons unavailable return $unavailable; } // Split addon availability return $available . $unavailable; }