-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
86 lines (73 loc) · 2.67 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
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/*
Plugin Name: WPSEA Meetup Events to Posts
Plugin URI: https://github.com/WordPress-Seattle/wpsea-meetup-events-to-posts
Description: Creates WordPress posts from a Meetup group's events
Version: 0.1a
Author: Seattle WordPress Meetup
Author URI: http://wpseattle.org
License: GPL2
*/
/*
* Copyright 2011-2012 Seattle WordPress Meetup (website : http://wpseattle.org)
*
* 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
*/
if( $_SERVER[ 'SCRIPT_FILENAME' ] == __FILE__ )
die( 'Access denied.' );
define( 'WSMETP_NAME', 'WPSEA Meetup Events to Posts' );
define( 'WSMETP_REQUIRED_PHP_VERSION', '5.3' ); // because of __DIR__
define( 'WSMETP_REQUIRED_WP_VERSION', '3.5' ); // because of WP_Post goodness
/**
* Checks if the system requirements are met
* @author Ian Dunn <[email protected]>
* @return bool True if system requirements are met, false if not
*/
function wsmetp_requirements_met()
{
global $wp_version;
if( version_compare( PHP_VERSION, WSMETP_REQUIRED_PHP_VERSION, '<' ) )
return false;
if( version_compare( $wp_version, WSMETP_REQUIRED_WP_VERSION, '<' ) )
return false;
return true;
}
/**
* Prints an error that the system requirements weren't met.
* @author Ian Dunn <[email protected]>
*/
function wsmetp_requirements_error()
{
global $wp_version;
ob_start();
require_once( __DIR__ . '/views/requirements-error.php' );
$message = ob_get_contents();
ob_end_clean();
echo $message;
}
// 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( wsmetp_requirements_met() )
{
require_once( __DIR__ . '/wpsea-meetup-events-to-posts.php' );
if( class_exists( 'wpSeaMeetupEventsToPosts' ) )
{
$GLOBALS[ 'wsmetp' ] = new wpSeaMeetupEventsToPosts();
register_activation_hook( __FILE__, array( $GLOBALS[ 'wsmetp' ], 'activate' ) );
register_deactivation_hook( __FILE__, array( $GLOBALS[ 'wsmetp' ], 'deactivate' ) );
}
}
else
add_action( 'admin_notices', 'wsmetp_requirements_error' );
?>