Repository navigation
Expand file tree
/
Copy pathcloudflare-meet.php
More file actions
69 lines (59 loc) · 1.86 KB
/
Copy pathcloudflare-meet.php
File metadata and controls
69 lines (59 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
59
60
61
62
63
64
65
66
67
68
69
<?php
/**
* Plugin Name: Cloudflare Meet
* Description: Professional video meetings using Cloudflare RealtimeKit
* Version: 2.0.0
* Author: Your Name
* Text Domain: cloudflare-meet
* Domain Path: /languages
* Requires at least: 5.0
* Tested up to: 6.4
* Requires PHP: 7.4
* Network: false
*/
namespace CloudflareMeet;
// Prevent direct access
use CloudflareMeet\Database\DatabaseManager;
if (!defined('ABSPATH')) {
exit;
}
// Define plugin constants
define('CLOUDFLARE_MEET_VERSION', '2.0.0');
define('CLOUDFLARE_MEET_PLUGIN_DIR', plugin_dir_path(__FILE__));
define('CLOUDFLARE_MEET_PLUGIN_URL', plugin_dir_url(__FILE__));
define('CLOUDFLARE_MEET_PLUGIN_FILE', __FILE__);
define('CLOUDFLARE_MEET_BASENAME', plugin_basename(__FILE__));
// Load Composer autoloader
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
} else {
add_action('admin_notices', function() {
echo '<div class="notice notice-error"><p>';
echo esc_html__('Cloudflare Meet: Please run "composer install" to install dependencies.', 'cloudflare-meet');
echo '</p></div>';
});
return;
}
// Initialize the plugin
add_action('plugins_loaded', function() {
Plugin::getInstance();
});
//Plugin activation hook
register_activation_hook(__FILE__, function() {
// Load autoloader if not already loaded
if (!class_exists('CloudflareMeet\\Database\\DatabaseManager')) {
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}
}
// Create database tables
$database_manager = new DatabaseManager();
$database_manager->createTables();
// Flush rewrite rules
flush_rewrite_rules();
});
// Plugin deactivation hook
register_deactivation_hook(__FILE__, function() {
// Flush rewrite rules
flush_rewrite_rules();
});