-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtsevent-plugin.php
More file actions
56 lines (46 loc) · 1.4 KB
/
tsevent-plugin.php
File metadata and controls
56 lines (46 loc) · 1.4 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
<?php
/**
* Plugin Name: Events Plugin
* Description: An event management plugin.
* Version: 1.0
* Author: Tuba Saif
* Text Domain: events-plugin
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
// Autoload classes
if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
// Autoload classes
use TSEventPlugin\classes\Core;
if ( ! class_exists( 'TSEVENT_Class' ) ) {
class TS_Event_Manager {
public function __construct() {
$this->define_constants();
$this->run_event();
$this->register_uninstall();
}
// Run the event manager
public function run_event() {
$event = new Core();
$event->init();
}
// Define constants
public function define_constants() {
define( 'EVENTS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'EVENTS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Cleanup on plugin uninstall
public static function events_plugin_uninstall() {
delete_option( 'events_plugin_settings' );
}
// Register uninstallation hook
public function register_uninstall() {
register_uninstall_hook( __FILE__, ['TS_Event_Manager', 'events_plugin_uninstall'] );
}
}
}
// Initialize the plugin
$ts_event_manager = new TS_Event_Manager();