Giter Site home page Giter Site logo

ilueckel / plugin-update-checker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yahniselsts/plugin-update-checker

0.0 2.0 0.0 185 KB

A custom update checker for WordPress plugins. Ufseful if you can't or don't want to host your plugin in the official WP plugin repository, but would still like it to support automatic plugin updates.

License: MIT License

CSS 1.50% PHP 96.51% JavaScript 1.99%

plugin-update-checker's Introduction

Plugin Update Checker

This is a custom update checker library for WordPress plugins. It lets you add automatic update notifications and one-click upgrades to your commercial and private plugins. All you need to do is put your plugin details in a JSON file, place the file on your server, and pass the URL to the library. The library periodically checks the URL to see if there's a new version available and displays an update notification to the user if necessary.

From the users' perspective, it works just like with plugins hosted on WordPress.org. The update checker uses the default plugin upgrade UI that will already be familiar to most WordPress users.

See this blog post for more information and usage instructions.

Getting Started

Self-hosted Plugins

  1. Make a JSON file that describes your plugin. Here's a minimal example:

    {
    	"name" : "My Cool Plugin",
    	"version" : "2.0",
    	"author" : "John Smith",
    	"download_url" : "http://example.com/plugins/my-cool-plugin.zip",
    	"sections" : {
    		"description" : "Plugin description here. You can use HTML."
    	}
    }

    See this table for a full list of supported fields.

  2. Upload this file to a publicly accessible location.

  3. Download the update checker, unzip the archive and copy the plugin-update-checker directory to your plugin.

  4. Add the following code to the main plugin file:

    require 'plugin-update-checker/plugin-update-checker.php';
    $myUpdateChecker = PucFactory::buildUpdateChecker(
    	'http://example.com/path/to/metadata.json',
    	__FILE__
    );

Notes

  • You could use wp-update-server to automatically generate JSON metadata from ZIP packages.
  • The second argument passed to buildUpdateChecker should be the full path to the main plugin file.
  • There are more options available - see the blog for details.

Plugins Hosted on GitHub

(GitHub support is experimental.)

  1. Download the latest release, unzip it and copy the plugin-update-checker directory to your plugin.

  2. Add the following code to the main file of your plugin:

    require 'plugin-update-checker/plugin-update-checker.php';
    $className = PucFactory::getLatestClassVersion('PucGitHubChecker');
    $myUpdateChecker = new $className(
    	'https://github.com/user-name/plugin-repo-name/',
    	__FILE__,
    	'master'
    );

    The third argument specifies the branch to use for updating your plugin. The default is master. If the branch name is omitted or set to master, the update checker will use the latest release or tag (if available). Otherwise it will use the specified branch.

  3. Optional: Add a readme.txt file formatted according to the WordPress.org plugin readme standard. The contents of this file will be shown when the user clicks the "View version 1.2.3 details" link.

Notes

If your GitHub repository requires an access token, you can specify it like this:

$myUpdateChecker->setAccessToken('your-token-here');

The GitHub version of the library will pull update details from the following parts of a release/tag/branch:

  • Changelog
    • The "Changelog" section of readme.txt.
    • One of the following files: CHANGES.md, CHANGELOG.md, changes.md, changelog.md
    • Release notes.
  • Version number
    • The "Version" plugin header.
    • The latest release or tag name.
  • Required and tested WordPress versions
    • The "Requires at least" and "Tested up to" fields in readme.txt.
    • The following plugin headers: Required WP, Tested WP, Requires at least, Tested up to
  • "Last updated" timestamp
    • The creation timestamp of the latest release.
    • The latest commit of the selected tag or branch that changed the main plugin file.
  • Number of downloads
    • The download_count statistic of the latest release.
    • If you're not using GitHub releases, there will be no download stats.
  • Other plugin details - author, homepage URL, description
    • The "Description" section of readme.txt.
    • Remote plugin headers (i.e. the latest version on GitHub).
    • Local plugin headers (i.e. the currently installed version).
  • Ratings, banners, screenshots
    • Not supported.

Resources

plugin-update-checker's People

Contributors

dangoodman avatar doublesharp avatar hareesh-pillai avatar icetee avatar ilueckel avatar jrfnl avatar lengthofrope avatar rvola avatar yahniselsts avatar

Watchers

 avatar  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.