-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmichel-usage-sync.php
More file actions
52 lines (46 loc) · 1.65 KB
/
michel-usage-sync.php
File metadata and controls
52 lines (46 loc) · 1.65 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
<?php
/**
* Plugin Name: Michel Usage Sync
* Plugin URI: https://github.com/michelmoraes/michel-usage-sync
* Description: A plugin to sync and display usage data from external API with caching, AJAX endpoints, Gutenberg block, and admin interface.
* Version: 1.0.0
* Author: Michel Moraes
* Author URI: https://michelmany.com
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: michel-usage-sync
* Domain Path: /languages
* Requires at least: 6.2
* Requires PHP: 7.4
*
* @package MichelUsageSync
* @author Michel Moraes
* @version 1.0.0
*/
// Prevent direct access
defined( 'ABSPATH' ) || exit;
// Autoload classes using Composer
require_once __DIR__ . '/vendor/autoload.php';
use MichelUsageSync\Plugin;
// Define plugin constants
define( 'MICHEL_USAGE_SYNC_VERSION', '1.0.0' );
define( 'MICHEL_USAGE_SYNC_PLUGIN_FILE', __FILE__ );
define( 'MICHEL_USAGE_SYNC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'MICHEL_USAGE_SYNC_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
define( 'MICHEL_USAGE_SYNC_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
// Initialize the plugin
function michel_usage_sync_init(): void {
if (class_exists('MichelUsageSync\\Plugin')) {
new Plugin();
} else {
add_action('admin_notices', static function () {
echo '<div class="notice notice-error"><p>';
esc_html_e(
'Michel Usage Sync: Plugin classes not found. Please run "composer install" in the plugin directory.',
'michel-usage-sync'
);
echo '</p></div>';
});
}
}
add_action( 'plugins_loaded', 'michel_usage_sync_init' );