-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.php
74 lines (63 loc) · 2.31 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
/*
Plugin Name: Untappd
Plugin URI: https://github.com/olipayne/Untappd-Shortcode-Plugin
Description: Plugin to show Untappd info
Version: 0.1
Author: Oliver Payne
Author URI: https://github.com/olipayne/
*/
/*
* This plugin was built on top of WordPress-Plugin-Skeleton by Ian Dunn.
* See https://github.com/iandunn/WordPress-Plugin-Skeleton for details.
*/
if (! defined('ABSPATH')) {
die('Access denied.');
}
define('Untappd_NAME', 'Untappd');
define('Untappd_REQUIRED_PHP_VERSION', '5.3'); // because of get_called_class()
define('Untappd_REQUIRED_WP_VERSION', '3.1'); // because of esc_textarea()
/**
* Checks if the system requirements are met
*
* @return bool True if system requirements are met, false if not
*/
function untappd_requirements_met()
{
global $wp_version;
if (version_compare(PHP_VERSION, Untappd_REQUIRED_PHP_VERSION, '<')) {
return false;
}
if (version_compare($wp_version, Untappd_REQUIRED_WP_VERSION, '<')) {
return false;
}
return true;
}
/**
* Prints an error that the system requirements weren't met.
*/
function untappd_requirements_error()
{
global $wp_version;
require_once(dirname(__FILE__) . '/views/requirements-error.php');
}
/*
* Check requirements and load main class
* The main program needs to be in a separate file that only gets loaded if the plugin requirements are met. Otherwise older PHP installations could crash when trying to parse it.
*/
if (untappd_requirements_met()) {
require_once(__DIR__ . '/vendor/autoload.php');
require_once(__DIR__ . '/classes/untappd-module.php');
require_once(__DIR__ . '/classes/untappd-plugin.php');
require_once(__DIR__ . '/includes/admin-notice-helper/admin-notice-helper.php');
require_once(__DIR__ . '/classes/untappd-settings.php');
require_once(__DIR__ . '/classes/untappd-cron.php');
require_once(__DIR__ . '/classes/untappd-instance-class.php');
if (class_exists('Untappd_Plugin')) {
$GLOBALS['untappd'] = Untappd_Plugin::get_instance();
register_activation_hook(__FILE__, array( $GLOBALS['untappd'], 'activate' ));
register_deactivation_hook(__FILE__, array( $GLOBALS['untappd'], 'deactivate' ));
}
} else {
add_action('admin_notices', 'untappd_requirements_error');
}