/**
  * @param Amazon_S3_And_CloudFront_Pro $as3cf
  */
 function __construct(Amazon_S3_And_CloudFront_Pro $as3cf)
 {
     $this->as3cf = $as3cf;
     $plugin = new Delicious_Brains_API_Plugin();
     $plugin->global_meta_prefix = 'aws';
     $plugin->slug = 'amazon-s3-and-cloudfront-pro';
     $plugin->name = 'WP Offload S3 - Pro Upgrade';
     $plugin->version = $GLOBALS[$plugin->global_meta_prefix . '_meta'][$plugin->slug]['version'];
     $plugin->basename = $this->as3cf->get_plugin_basename();
     $plugin->dir_path = $this->as3cf->get_plugin_dir_path();
     $plugin->prefix = 'as3cfpro';
     $plugin->settings_url_path = 'admin.php?page=amazon-s3-and-cloudfront';
     $plugin->settings_url_hash = '#support';
     $plugin->hook_suffix = 'aws_page_amazon-s3-and-cloudfront';
     $plugin->email_address_name = 'as3cf';
     $plugin->notices_hook = 'as3cf_pre_settings_render';
     $plugin->expired_licence_is_valid = false;
     $plugin->purchase_url = 'https://deliciousbrains.com/wp-offload-s3/pricing/';
     parent::__construct($plugin);
     $this->init();
 }
    /**
     * Display custom version update notices to the top of our plugin page
     *
     * @param string $basename
     */
    function version_update_notice($basename)
    {
        // We don't want to show both the "Update Required" and "Update Available" messages at the same time
        if ($this->is_addon($basename) && $this->is_addon_outdated($basename)) {
            return;
        }
        $slug = current(explode('/', $basename));
        // To reduce UI clutter we hide addon update notices if the core plugin has updates available
        if ($this->is_addon($basename) && $this->core_update_available()) {
            // Core update is available, don't show update notices for addons until core is updated
            return;
        }
        $licence = $this->licences->get_licence_key();
        $licence_response = $this->licences->is_licence_expired();
        $licence_problem = isset($licence_response['errors']);
        $update_url = wp_nonce_url($this->licences->admin_url('update.php?action=upgrade-plugin&plugin=' . urlencode($basename)), 'upgrade-plugin_' . $basename);
        $installed_version = $this->get_installed_version($slug);
        $latest_version = $this->get_latest_version($slug, $installed_version);
        $plugin_name = isset($this->licences->addons[$basename]) ? $this->licences->addons[$basename]['name'] : $this->licences->plugin->name;
        if (version_compare($installed_version, $latest_version, '<')) {
            ?>
			<div style="display: block;" class="updated warning inline-message">
				<strong><?php 
            _ex('Update Available', 'A new version of the plugin is available', 'as3cf-pro');
            ?>
</strong> &mdash;
				<?php 
            $message = sprintf(__('%1$s %2$s is now available. You currently have %3$s installed.', 'as3cf-pro'), $plugin_name, $latest_version, $installed_version);
            if (!empty($licence) && !$licence_problem) {
                $message .= ' ' . sprintf('<a href="%1$s">%2$s</a>', $update_url, _x('Update Now', 'Download and install a new version of the plugin', 'as3cf-pro'));
            }
            echo $message;
            ?>
			</div>
			<?php 
        }
    }