/**
  * AS3CF_Pro_Installer constructor.
  *
  * @param $plugin_file_path
  * @param $as3cf_plugin_version_required
  */
 public function __construct($plugin_file_path, $as3cf_plugin_version_required)
 {
     parent::__construct('WP Offload S3 - Pro Upgrade', 'amazon-s3-and-cloudfront-pro', $plugin_file_path, 'WP Offload S3', 'amazon-s3-and-cloudfront', $as3cf_plugin_version_required, 'wordpress-s3.php');
     // Fire up the plugin installer
     $this->plugin_installer = new AS3CF_Pro_Plugin_Installer('installer', $this->plugin_slug, $this->plugin_file_path);
     $this->plugin_installer->set_plugins_to_install($this->required_plugins_not_installed());
 }
 /**
  * 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;
 }