/** * The plugin loader. */ function wp_requirements_example_plugin_loader() { if (class_exists('WP_Requirements')) { $my_requirements = array('php' => array('version' => '5.3', 'extensions' => array('mbstring', 'curl')), 'mysql' => array('version' => '5.6'), 'wordpress' => array('version' => '4.6', 'plugins' => array('wpglobus/wpglobus.php' => '1.6.1', 'wpglobus-plus/wpglobus-plus.php' => true), 'theme' => array('my-theme' => '1.5')), 'params' => array('requirements_details_url' => '//google.com', 'version_compare_operator' => '>=', 'not_valid_actions' => array('deactivate', 'admin_notice'), 'show_valid_results' => true)); // If the second parameter is omitted, will look for a `wp-requirements.json` file. $requirements = new WP_Requirements(__FILE__, $my_requirements); if (!$requirements->valid()) { $requirements->process_failure(); return; } } }
* * @package SimpleCalendar * @copyright 2015 Moonstone Media/Phil Derksen. All rights reserved. */ // Exit if accessed directly. if (!defined('ABSPATH')) { exit; } // Composer fallback for PHP < 5.3.0. if (version_compare(PHP_VERSION, '5.3.0') === -1) { include_once 'vendor/autoload_52.php'; } else { include_once 'vendor/autoload.php'; } // Plugin constants. $this_plugin_path = trailingslashit(dirname(__FILE__)); $this_plugin_dir = plugin_dir_url(__FILE__); $this_plugin_constants = array('SIMPLE_CALENDAR_VERSION' => '3.0.8', 'SIMPLE_CALENDAR_MAIN_FILE' => __FILE__, 'SIMPLE_CALENDAR_URL' => $this_plugin_dir, 'SIMPLE_CALENDAR_ASSETS' => $this_plugin_dir . 'assets/', 'SIMPLE_CALENDAR_PATH' => $this_plugin_path, 'SIMPLE_CALENDAR_INC' => $this_plugin_path . 'includes/'); foreach ($this_plugin_constants as $constant => $value) { if (!defined($constant)) { define($constant, $value); } } // Check plugin requirements before loading plugin. $this_plugin_checks = new WP_Requirements('Simple Calendar', plugin_basename(__FILE__), array('PHP' => '5.3.0', 'WordPress' => '4.0.0', 'Extensions' => array('curl', 'mbstring'))); if ($this_plugin_checks->pass() === false) { $this_plugin_checks->halt(); return; } // Load plugin. include_once 'includes/main.php';
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * WP CAS Server main plugin file. * * @version 1.2.0 */ if (!defined('WPINC')) { die; } require_once dirname(__FILE__) . '/wp-requirements.php'; $wp_cas_server_requirements = new WP_Requirements(__('Cassava CAS Server', 'wp-cas-server'), plugin_basename(__FILE__), array('PHP' => '5.3.2', 'WordPress' => '3.9.0', 'Extensions' => array('libxml'))); if ($wp_cas_server_requirements->pass() === false) { $wp_cas_server_requirements->halt(); return; } if (file_exists(dirname(__FILE__) . '/vendor/autoload.php')) { require_once dirname(__FILE__) . '/vendor/autoload.php'; } require_once dirname(__FILE__) . '/plugin.php';
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ // Composer fallback for PHP < 5.3.0. if (-1 === version_compare(PHP_VERSION, '5.3.0')) { require_once dirname(__FILE__) . '/vendor/autoload_52.php'; } else { require_once dirname(__FILE__) . '/vendor/autoload.php'; } /** * WP PHP Console requires PHP 5.4.0 minimum. * @link https://make.wordpress.org/plugins/2015/06/05/policy-on-php-versions/ * @link https://github.com/unfulvio/wp-requirements */ $this_plugin_checks = new WP_Requirements('WP PHP Console', plugin_basename(__FILE__), array('PHP' => '5.4.0')); if (false === $this_plugin_checks->pass()) { // Stop. $this_plugin_checks->halt(); return; } else { // Load the main class of this plugin. require_once dirname(__FILE__) . '/includes/class-wp-php-console.php'; return new \WP_PHP_Console\Plugin(); }
/** * Shortcut to construct the object and process the failure actions. * * @param string $the__file__ Pass `__FILE__` from the loader. * @param array $requirements The array of requirements. * * @return bool True if requirements met. */ public static function validate($the__file__, array $requirements = array()) { $_wpr = new WP_Requirements($the__file__, $requirements); $is_valid = $_wpr->valid(); if (!$is_valid) { $_wpr->process_failure(); } return $is_valid; }