forked from JohnProvidence/libcal-for-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libcal-for-wordpress.php
69 lines (50 loc) · 1.43 KB
/
libcal-for-wordpress.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
<?php
/**
* Plugin Name: Library Event Calendars
* Plugin URI: https://github.com/ppldev/ppl-event-calendar
* Description: A simple plugin that pulls LibCal events from the LibCal API for the purposes of creating event calendar widgets and a full event calendars.
* Version: 1.0
* Author: John Bent
* License: GPL2
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* */
function libcal_event_feed_install() {
global $wpdb, $wnm_db_version;
$charset_collate = $wpdb->get_charset_collate();
$event_table = $wpdb->prefix . 'library_events';
$library_details_table = $wpdb->prefix . 'library_information';
$event_tags_table = $wpdb->prefix . 'libcal_tags';
require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
$sql = " CREATE TABLE IF NOT EXISTS $event_tags_table (
id int(9) NOT NULL AUTO_INCREMENT,
tag varchar(150) NOT NULL,
PRIMARY KEY (id)
) $charset_collate;";
dbDelta( $sql );
}
register_activation_hook(__FILE__, 'libcal_event_feed_install');
// Load plugin functions from inc directory
function loadDep($type, $file) {
$file_base = 'inc/'.$type.'/';
include($file_base.$file.'.php');
}
$admin = array(
'load_scripts',
'admin_menu',
'admin_main_page',
'admin_tags',
'admin_featured_events'
);
foreach($admin as $a) {
loadDep('admin', $a);
}
$display = array(
'load_scripts',
'event_feed_widget',
'event_feed_full',
'featured_events_display'
);
foreach($display as $d) {
loadDep('display', $d);
}
?>