# copy-the-code/3.4.2/classes/class-copy-the-code-update.php

Copy Anything to Clipboard for WordPress – Copy Button, Copy Text &amp; Copy Code, version 3.4.2. 86 lines.

- Page: https://pluginprobe.com/plugins/copy-the-code/3.4.2/code/classes/class-copy-the-code-update.php
- Raw: https://pluginprobe.com/plugins/copy-the-code/3.4.2/raw/classes/class-copy-the-code-update.php
- Modified: 2023-10-21T20:26:50+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/copy-the-code/3.4.2/code/classes/class-copy-the-code-update.php#L10-L20`.

```php
<?php
/**
 * Update
 *
 * @package Copy the Code
 * @since 2.0.0
 */

if ( ! class_exists( 'Copy_The_Code_Update' ) ) :

	/**
	 * Copy The Code Update
	 *
	 * @since 2.0.0
	 */
	class Copy_The_Code_Update {

		/**
		 * Instance
		 *
		 * @var object Class object.
		 * @access private
		 * @since 2.0.0
		 */
		private static $instance;

		/**
		 * Initiator
		 *
		 * @since 2.0.0
		 * @return object initialized object of class.
		 */
		public static function get_instance() {
			if ( ! isset( self::$instance ) ) {
				self::$instance = new self();
			}
			return self::$instance;
		}

		/**
		 * Constructor
		 *
		 * @since 2.0.0
		 */
		public function __construct() {
			add_action( 'admin_init', __CLASS__ . '::init' );
		}

		/**
		 * Init
		 *
		 * @since 2.0.0
		 * @return void
		 */
		public static function init() {

			do_action( 'copy_the_code_update_before' );

			// Get auto saved version number.
			$saved_version = get_option( 'copy-the-code-auto-version', false );

			// Update auto saved version number.
			if ( ! $saved_version ) {
				update_option( 'copy-the-code-auto-version', COPY_THE_CODE_VER );
			}

			// If equals then return.
			if ( version_compare( $saved_version, COPY_THE_CODE_VER, '=' ) ) {
				return;
			}

			// Update auto saved version number.
			update_option( 'copy-the-code-auto-version', COPY_THE_CODE_VER );

			do_action( 'copy_the_code_update_after' );
		}

	}

	/**
	 * Kicking this off by calling 'get_instance()' method
	 */
	Copy_The_Code_Update::get_instance();

endif;

```
