Code Monkey home page Code Monkey logo

edd_sl_plugin_updater's Introduction

EDD_SL_Plugin_Updater

Find updated copies at https://github.com/awesomemotive/easy-digital-downloads/blob/main/includes/EDD_SL_Plugin_Updater.php

Example usage

Updater invoking

/**
 * Fire up our updater processes.
 *
 * @since 1.0.0
 */
public function updater() {
	$config          = [
		'license_key' => get_option( PREMIUM_PLUGIN_SLUG . '_license_key', '' ),
		'store_url'   => PREMIUM_STORE_URL,
		'version'     => PREMIUM_VERSION,
		'item_name'   => PREMIUM_PLUGIN_NAME,
	];
	$license_handler = new Updater( $config );
	$license_handler->do_update();
}
<?php
/**
 * Updater Class file
 *
 * @package WebDevStudios\namespace
 * @since   1.0.0
 */

namespace WebDevStudios\namespace;

require_once PREMIUM_PATH . 'vendor/autoload.php';

/**
 * Class Updater
 *
 * @since 1.0.0
 */
class Updater {

	/**
	 * Domain to check for updates at.
	 *
	 * @var string
	 */
	private $store_url;

	/**
	 * License key to check.
	 *
	 * @var string
	 */
	private $license_key;

	/**
	 * Current installed version.
	 *
	 * @var string
	 */
	private $version;

	/**
	 * Product name to check.
	 *
	 * @var string
	 */
	private $item_name;

	/**
	 * Constructor
	 *
	 * @param array $config Array of Updater configuration settings.
	 *
	 * @since 1.0.0
	 */
	public function __construct( array $config = [] ) {
		$this->store_url   = $config['store_url'];
		$this->license_key = $config['license_key'];
		$this->version     = $config['version'];
		$this->item_name   = $config['item_name'];
	}

	/**
	 * Run our updater process.
	 *
	 * @since 1.0.0
	 */
	public function do_update() {
		$edd_updater = new \EDD_SL_Plugin_Updater(
			$this->store_url,
			MAIN_PREMIUM_FILE,
			[
				'version'   => $this->version,
				'license'   => $this->license_key,
				'item_name' => $this->item_name,
				'author'    => 'Pluginize',
			]
		);
	}
}

edd_sl_plugin_updater's People

Contributors

tw2113 avatar

Stargazers

Rihards Mantejs avatar  avatar

Watchers

Brad Williams avatar James Cloos avatar Lisa Sabin-Wilson avatar  avatar

Forkers

domaingood

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.