Coder Social home page Coder Social logo

automatic-theme-plugin-update's Introduction

MW Automatic Theme Plugin Updater for Self-Hosted Themes/Plugins


General Info

For themes and plugins that can't be submitted to official WordPress repository, ie ... commercial themes/plugins/, written for one client.

Folder structure

  • api (Folder to upload to server where updates will be housed)

    • .htaccess (set Options+Indexes to allow checking to work properly)
    • index.php (holds code used to check request for new versions)
    • packages.php (file containing all info about plugins and themes)
    • download.php (validates md5 key of date and package zip file)
    • update (folder to hold all zip file updates for url masking - protected by .htaccess to disallow file listings)
  • update (default folder for holding theme and plugin zip files)

    • .htaccess (prevents indexing and viewing of any zip files in directory)
  • plugin-update.php (File to include in the plugin to check for updates)

  • theme-update.php (File to include in the theme to check for updates)

Setup

Example: Include to the parent theme:

require_once( 'theme-update.php' );
$ATPU_Theme = new ATPU_Theme( 'http://your-api-server/api/' );

Example: Include to the child theme:

require_once( 'theme-update.php' );
$ATPU_Theme = new ATPU_Theme( 'http://your-api-server/api/', 'child' );

Example: Include to the plugin:

require_once( 'plugin-update.php' );
$ATPU_Plugin = new ATPU_Plugin( 'http://your-api-server/api/', 'your-plugin-slug' );

Adding new versions

Edit the packages.php under api folder on your server. Commented thoroughly throughout with sections that need to be changed to reflect themes/plugins that are to be updated.

Adding additional themes/plugins

Simply create another $package array with the key of the new theme/plugin slug and add all the appropriate info. When releasing the theme/plugin make sure that functions and variables are prefixed to prevent errors and allow multiple themes/plugins to be updated.

Securing Download location

Downloads are now always secured by a md5 hash of the package file_name and timestamp of current date. When downloading file current timestamp and timestamp of previous day are compared to key received from update request, if either match zip file is passed, and file can be downloaded.

automatic-theme-plugin-update's People

Contributors

foxinni avatar inc2734 avatar jeremyclark13 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.