/** * 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 }
GitHub Plugin URI: https://github.com/afragen/github-updater GitHub Branch: master 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
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(); }
wp_enqueue_style('zws_contacts_db_css'); } // prevent caching in adminview public static function add_no_cache() { header("Cache-Control: no-cache, must-revalidate"); //HTTP 1.1 header("Pragma: no-cache"); //HTTP 1.0 } } // autoload the vendor packages require_once __DIR__ . '/vendor/autoload.php'; // check minimum version before initiating installer using the vendor WPUpdatePHP library require_once __DIR__ . '/vendor/wp-update-php/src/WPUpdatePhp.php'; $updatePhp = new \WPUpdatePhp($minimum_version = '5.5.0', $plugin_name = 'ZWS Contacts Database'); if ($updatePhp->does_it_meet_required_php_version()) { // include the filters require_once __DIR__ . '/src/Filters.php'; // add action for our enqueued scripts and stylesheets add_action('init', array('\\ZwsContactsDatabase\\ZwsContactsDatabase', 'load_scripts')); add_action('init', array('\\ZwsContactsDatabase\\ZwsContactsDatabase', 'load_styles')); // add action to send additional headers add_action('send_headers', array('\\ZwsContactsDatabase\\ZwsContactsDatabase', 'add_no_cache')); // add additional links on plugins page add_filter('plugin_action_links_' . plugin_basename(__FILE__), array('\\ZwsContactsDatabase\\ZwsContactsDatabase', 'add_action_links')); // create the administration page add_action('admin_menu', array('\\ZwsContactsDatabase\\ZwsContactsDatabase', 'run_admin')); // add the installer to the activation hook register_activation_hook(__FILE__, array('\\ZwsContactsDatabase\\ZwsContactsDatabase', 'run_installer')); // add the shortcodes