AnsPress_Prod_Updater::init()

Description #

Set up WordPress filters to hook into WP’s update process.

Source #

File: admin/updater.php

	public function init() {

		if ( $this->is_plugin ) {
			add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
			add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
			remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 );
			add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
			add_action( 'admin_init', array( $this, 'show_changelog' ) );

		} else {
			$this->strings = array(
				'theme-license'             => __( 'Theme License', 'edd-theme-updater' ),
				'enter-key'                 => __( 'Enter your theme license key.', 'edd-theme-updater' ),
				'license-key'               => __( 'License Key', 'edd-theme-updater' ),
				'license-action'            => __( 'License Action', 'edd-theme-updater' ),
				'deactivate-license'        => __( 'Deactivate License', 'edd-theme-updater' ),
				'activate-license'          => __( 'Activate License', 'edd-theme-updater' ),
				'status-unknown'            => __( 'License status is unknown.', 'edd-theme-updater' ),
				'renew'                     => __( 'Renew?', 'edd-theme-updater' ),
				'unlimited'                 => __( 'unlimited', 'edd-theme-updater' ),
				'license-key-is-active'     => __( 'License key is active.', 'edd-theme-updater' ),
				'expires%s'                 => __( 'Expires %s.', 'edd-theme-updater' ),
				'%1$s/%2$-sites'            => __( 'You have %1$s / %2$s sites activated.', 'edd-theme-updater' ),
				'license-key-expired-%s'    => __( 'License key expired %s.', 'edd-theme-updater' ),
				'license-key-expired'       => __( 'License key has expired.', 'edd-theme-updater' ),
				'license-keys-do-not-match' => __( 'License keys do not match.', 'edd-theme-updater' ),
				'license-is-inactive'       => __( 'License is inactive.', 'edd-theme-updater' ),
				'license-key-is-disabled'   => __( 'License key is disabled.', 'edd-theme-updater' ),
				'site-is-inactive'          => __( 'Site is inactive.', 'edd-theme-updater' ),
				'license-status-unknown'    => __( 'License status is unknown.', 'edd-theme-updater' ),
				'update-notice'             => __( "Updating this theme will lose any customizations you have made. 'Cancel' to stop, 'OK' to update.", 'edd-theme-updater' ),
				'update-available'          => __( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.', 'edd-theme-updater' ),
			);

			add_filter( 'site_transient_update_themes', [ $this, 'theme_update_transient' ] );
			add_filter( 'delete_site_transient_update_themes', [ $this, 'delete_theme_update_transient' ] );
			add_action( 'load-update-core.php', [ $this, 'delete_theme_update_transient' ] );
			add_action( 'load-themes.php', [ $this, 'delete_theme_update_transient' ] );
			add_action( 'load-themes.php', [ $this, 'load_themes_screen' ] );
		}

	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment