-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean-events.php
More file actions
58 lines (51 loc) · 1.86 KB
/
clean-events.php
File metadata and controls
58 lines (51 loc) · 1.86 KB
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
<?php
/**
* Plugin Name: Clean Events
* Plugin URI: http://robido.com/clean-events
* Description: This is an event calendar plugin for the appreciators of simple and fast code with minimalist design concepts. It uses native WP tables and is designed specifically for those who hate bloatware and bad design.
* Version: 1.0.0
* Author: robido
* Author URI: http://robido.com/blog
* License: GPLv2 or later
* Text Domain: clean_events
*
* PHP version 5.3
*
* @category PHP
* @package Clean Events
* @author Jeff Hays (jphase) <jeff@robido.com>
*/
// Define namespace
namespace CleanEvents;
// Block direct access
if ( ! defined('ABSPATH') ) {
die( 'Sorry, no script kiddies allowed...' );
}
// Define constants
define( __NAMESPACE__ . '\NS', __NAMESPACE__ . '\\' );
define( NS . 'URL', plugin_dir_url(__FILE__) );
define( NS . 'PATH', plugin_dir_path(__FILE__) );
define( NS . 'VERSION', '1.0.0' );
// Check for required version of PHP
if ( version_compare( PHP_VERSION, '5.3', '<' ) ) {
if ( is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
deactivate_plugins( __FILE__ );
wp_die( __( 'Clean events requires PHP 5.3 or higher. You currently have PHP ' . PHP_VERSION . ' installed. <a href="' . admin_url('plugins.php') . '">« Go back to plugins page</a>', 'clean_events' ) );
}
}
// Autoload classes and includes
function ce_autoload() {
$init = glob( dirname ( __FILE__ ) . '/inc/*.php' );
$classes = glob( dirname( __FILE__ ) . '/classes/*.php' );
foreach ( $init as $script ) require_once $script;
foreach ( $classes as $class ) require_once $class;
}
// Initialize clean events plugin
function ce_init() {
ce_autoload();
$admin = new Admin;
$widget = new Widget;
}
// Call bootstrap after plugins are loaded
add_action( 'plugins_loaded', __NAMESPACE__ . '\ce_init', 10, 0 );