/** * Constructor. * * @access public * @since 1.0.0 */ public function __construct() { // Fetch the Php version checker. require_once 'wp-update-php/WPUpdatePhp.php'; $updatePhp = new WPUpdatePhp(Plugin_Name::$php_required_min); // If the miniumum version of PHP required is available then install the plugin. if ($updatePhp->does_it_meet_required_php_version(PHP_VERSION)) { add_action('plugins_loaded', array($this, 'run_activation')); } else { // If the required PHP version is not avaialble then deactivate the plugin. deactivate_plugins(plugin_basename(PLUGIN_NAME_FILE)); } // END if/else }
Requires WP: 3.8 Requires PHP: 5.3 */ /* * Exit if called directly. * PHP version check and exit. */ if (!defined('WPINC')) { die; } if (!class_exists('WPUpdatePhp')) { require_once plugin_dir_path(__FILE__) . '/vendor/wp-update-php/src/WPUpdatePhp.php'; } $updatePhp = new WPUpdatePhp('5.3.0'); $updatePhp->set_plugin_name('GitHub Updater'); if (!$updatePhp->does_it_meet_required_php_version()) { return false; } // Load textdomain load_plugin_textdomain('github-updater', false, __DIR__ . '/languages'); // Plugin namespace root $root = array('Fragen\\GitHub_Updater' => __DIR__ . '/src/GitHub_Updater'); // Add extra classes $extra_classes = array('Parsedown' => __DIR__ . '/vendor/parsedown/Parsedown.php', 'WPUpdatePHP' => __DIR__ . '/vendor/wp-update-php/src/WPUpdatePhp.php', 'Automattic_Readme' => __DIR__ . '/vendor/parse-readme.php'); // Load Autoloader require_once __DIR__ . '/src/GitHub_Updater/Autoloader.php'; $loader = 'Fragen\\GitHub_Updater\\Autoloader'; new $loader($root, $extra_classes); // Instantiate class GitHub_Updater $instantiate = 'Fragen\\GitHub_Updater\\Base'; new $instantiate();
static $version = '0.1.0'; public static function init() { if (null == self::$app) { self::$app = new Plugin_Name\App(); self::$app->run(); } return self::$app; } } /** * Begins execution of the plugin. * * Since everything within the plugin is registered via hooks, * then kicking off the plugin from this point in the file does * not affect the page life cycle. * * Also returns copy of the app object so 3rd party developers * can interact with the plugin's hooks contained within. * * @return Plugin_Name\App App Plugin's app object * @since 1.0.0 */ function plugin_name() { return Plugin_Name::init(); } $updatePhp = new WPUpdatePhp('5.3.0'); if ($updatePhp->does_it_meet_required_php_version(PHP_VERSION)) { plugin_name(); }