forked from Make-Lemonade/lemonsqueezy-wp-updater-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-plugin.php
48 lines (43 loc) · 1.24 KB
/
example-plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* Plugin Name: Example Plugin
* Plugin URI: PLUGIN SITE HERE
* Description: PLUGIN DESCRIPTION HERE
* Author: YOUR NAME HERE
* Author URI: YOUR SITE HERE
* Text Domain: example-plugin
* Domain Path: /languages
* Version: 0.1.0
*/
// If this file is called directly, abort.
defined( 'ABSPATH' ) || exit;
/**
* Current plugin version.
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'EXAMPLE_PLUGIN_VERSION', '1.0.0' );
if ( ! defined( 'EXAMPLE_PLUGIN_API_URL' ) ) {
/**
* The API URL to check for updates.
* This should be unique to this plugin and point to a remote server
* running the Lemon Squeezy plugin.
*/
define( 'EXAMPLE_PLUGIN_API_URL', 'http://example.com/wp-json/lsq/v1' );
}
/**
* Import the plugin updater class.
*/
require plugin_dir_path( __FILE__ ) . 'includes/class-plugin-updater.php';
/**
* Instanciate the updater class.
*
* Everything within the updater is registered via hooks,
* so it's safe to instanciate this at any time.
*/
new ExamplePluginUpdater(
plugin_basename( __FILE__ ),
plugin_basename( __DIR__ ),
EXAMPLE_PLUGIN_VERSION,
EXAMPLE_PLUGIN_API_URL
);