GithubHelp home page GithubHelp logo

skilledpeople / reaktiv-remote-repo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from norcross/reaktiv-remote-repo

0.0 2.0 0.0 339 KB

A plugin to provide a self-hosted WP plugin repository

License: GNU General Public License v2.0

PHP 87.48% CSS 3.66% JavaScript 8.86%

reaktiv-remote-repo's Introduction

Reaktiv Remote Repo

A plugin to provide a self-hosted WP plugin repository

General Setup

To properly set this up, you must add some code to your plugin, with data from the site you have set up Reaktiv Remote Repo on. All of this should reside in your root file. Note: all of this code resides in your individual plugin. The actual updater class does not get modified in any way.

You first add your repository update URL as a constant. It should be the domain of your site, with update on the end.

if ( ! defined( 'YOUR_REPO_URL' ) ) {
	define( 'YOUR_REPO_URL', 'http://yourdomain.com/update/' );
}

You then need to add the unique key as a constant. This key is generated in your individual item in the repo.

if ( ! defined( 'YOUR_PLUGIN_UNIQUE' ) ) {
	define( 'YOUR_PLUGIN_UNIQUE', 'XXXXXXXXXX' );
}

Include a version number, which is what the update will check against.

if ( ! defined( 'YOUR_PLUGIN_VER' ) ) {
	define( 'YOUR_PLUGIN_VER', '0.0.1' );
}

Include the updater class file in your plugin, and load it.

add_action( 'plugins_loaded', 'rkv_load_updater' );

function rkv_load_updater() {

	if ( ! class_exists( 'RKV_Remote_Updater' ) ) {
		include( 'lib/RKV_Remote_Updater.php' );
	}
}

And then add the update function in your plugin

add_action( 'admin_init', 'rkv_remote_update' );

function rkv_remote_update() {

	// ensure the class exists before running
	if ( ! class_exists( 'RKV_Remote_Updater' ) ) {
		return;
	}

	$updater = new RKV_Remote_Updater( YOUR_REPO_URL, __FILE__, array(
		'unique'    => YOUR_PLUGIN_UNIQUE,
		'version'   => YOUR_PLUGIN_VER,
		)
	);
}

reaktiv-remote-repo's People

Contributors

norcross avatar jjeaton avatar peterknight avatar

Watchers

James Cloos avatar Daniel Dahlström avatar

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.