2017 © Pedro Peláez
 

wordpress-plugin minimum-requirements

Check the minimum requirements for your WordPress theme or plugin

image

overclokk/minimum-requirements

Check the minimum requirements for your WordPress theme or plugin

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Minimum requirements for WordPress Themes or Plugins (Beta Version)

Check the minimum requirements for your WordPress theme or plugin, (*1)

Installation

To install simply require the package in the composer.json file like, (*2)

  "require":
    {
      "overclokk/minimum-requirements": "*"
    }

and then use composer install or composer update to fetch the package., (*3)

CLI

Or simply run, (*4)

composer require overclokk/minimum-requirements

Or, (*5)

php composer.phar  require overclokk/minimum-requirements

Example

/**
 * Require minimum-requirements class to load minimum compatibility theme/plugin
 */
require( dirname( __FILE__ ) . '/vendor/overclokk/minimum-requirements/minimum-requirements.php' );

/**
 * Instantiate the class
 *
 * @param string $php_ver The minimum PHP version.
 * @param string $wp_ver  The minimum WP version.
 * @param string $name    The name of the theme/plugin to check.
 * @param array  $plugins Required plugins format plugin_path/plugin_name.
 *
 * @var Minimum_Requirements
 */
$requirements = new Minimum_Requirements( '5.3', '3.5', 'YOUR PLUGIN NAME', array( 'plugin-a', 'plugin-b' ) );

/**
 * Check compatibility on install
 * If is not compatible on install print an admin_notice
 */
register_activation_hook( __FILE__, array( $requirements, 'check_compatibility_on_install' ) );

/**
 * If it is already installed and activated check if example new version is compatible, if is not don't load plugin code and prin admin_notice
 * This part need more test
 */
if ( ! $requirements->is_compatible_version() ) {

    add_action( 'admin_notices', array( $requirements, 'load_plugin_admin_notices' ) );
    return;

}
/**
 * If it is compatible load the rest of the theme/plugin code
 */
// Your stuff here

Credits

The original code (only the part of cheking requirements) comes from SZ-Google of Massimo della Rovere with my personal improvements and a little piece of code from WordPress-Plugin-Boilerplate-Powered of Mte90 (the part that check the plugin needed)., (*6)

Thanks to Luca Tumedei for his help for improving the code and writing test with wp-browser, (*7)

The Versions

10/06 2017

dev-master

9999999-dev https://github.com/overclokk/minimum-requirements

Check the minimum requirements for your WordPress theme or plugin

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.2

 

The Development Requires

plugin wordpress wordpress plugin

10/06 2017

1.0.0

1.0.0.0 https://github.com/overclokk/minimum-requirements

Check the minimum requirements for your WordPress theme or plugin

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.2

 

The Development Requires

plugin wordpress wordpress plugin