| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Event Monster |
| 4 |
* Plugin URI: https://awplife.com/wordpress-plugins/event-monster-premium/ |
| 5 |
* Description: A free event management plugin for WordPress. Create and manage events with ease. Upgrade to Pro for payment gateways, tickets, coupons, and more! |
| 6 |
* Version: 2.1.2 |
| 7 |
* Author: A WP Life |
| 8 |
* Author URI: https://awplife.com/ |
| 9 |
* License: GPL-2.0+ |
| 10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 11 |
* Text Domain: event-monster |
| 12 |
* Domain Path: /languages |
| 13 |
* Requires at least: 6.0 |
| 14 |
* Tested up to: 7.0 |
| 15 |
* Requires PHP: 7.4 |
| 16 |
*/ |
| 17 |
|
| 18 |
// If this file is called directly, abort. |
| 19 |
if ( ! defined( 'WPINC' ) ) { |
| 20 |
die; |
| 21 |
} |
| 22 |
|
| 23 |
/** |
| 24 |
* ------------------------------------------------------------------------- |
| 25 |
* Define Core Constants |
| 26 |
* ------------------------------------------------------------------------- |
| 27 |
* These are the only constants that should be defined globally. |
| 28 |
*/ |
| 29 |
define( 'EM_FREE_VERSION', '2.1.2' ); |
| 30 |
define( 'EM_FREE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 31 |
define( 'EM_FREE_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 32 |
define( 'EM_FREE_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); |
| 33 |
if (!defined('EM_IS_PRO')) { |
| 34 |
define( 'EM_IS_PRO', false ); |
| 35 |
} |
| 36 |
|
| 37 |
|
| 38 |
/** |
| 39 |
* ------------------------------------------------------------------------- |
| 40 |
* Register Activation & Deactivation Hooks |
| 41 |
* ------------------------------------------------------------------------- |
| 42 |
* This handles what happens when the user clicks "Activate" or "Deactivate". |
| 43 |
* All logic is delegated to dedicated classes. |
| 44 |
*/ |
| 45 |
/** |
| 46 |
* Prevent activation if Event Monster Premium is already active. |
| 47 |
*/ |
| 48 |
function activate_Event_Monster_Free_free() { |
| 49 |
if ( is_plugin_active( 'event-monster-premium/event-monster-premium.php' ) ) { |
| 50 |
wp_die( |
| 51 |
esc_html__( 'Event Monster (Free) cannot be activated while Event Monster Premium is active. Please deactivate the Premium version first.', 'event-monster' ), |
| 52 |
esc_html__( 'Plugin Activation Error', 'event-monster' ), |
| 53 |
array( 'back_link' => true ) |
| 54 |
); |
| 55 |
} |
| 56 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-activator.php'; |
| 57 |
Event_Monster_Free_Activator::activate(); |
| 58 |
} |
| 59 |
|
| 60 |
function deactivate_Event_Monster_Free_free() { |
| 61 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-deactivator.php'; |
| 62 |
Event_Monster_Free_Deactivator::deactivate(); |
| 63 |
} |
| 64 |
|
| 65 |
register_activation_hook( __FILE__, 'activate_Event_Monster_Free_free' ); |
| 66 |
register_deactivation_hook( __FILE__, 'deactivate_Event_Monster_Free_free' ); |
| 67 |
|
| 68 |
|
| 69 |
/** |
| 70 |
* ------------------------------------------------------------------------- |
| 71 |
* Load and Run the Core Plugin |
| 72 |
* ------------------------------------------------------------------------- |
| 73 |
* This is the main entry point. We load the main class and tell it to run, |
| 74 |
* which will set up all the hooks, shortcodes, and admin pages. |
| 75 |
*/ |
| 76 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-main.php'; |
| 77 |
|
| 78 |
// Include shortcodes class |
| 79 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-shortcodes.php'; |
| 80 |
|
| 81 |
// Include frontend renderer class |
| 82 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-frontend-renderer.php'; |
| 83 |
|
| 84 |
// Include calendar class |
| 85 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-calendar.php'; |
| 86 |
|
| 87 |
// Include updater class (handles migrations and update notices) |
| 88 |
require_once EM_FREE_PLUGIN_DIR . 'includes/class-event-monster-updater.php'; |
| 89 |
|
| 90 |
/** |
| 91 |
* Begins execution of the plugin. |
| 92 |
*/ |
| 93 |
function run_Event_Monster_Free_free() { |
| 94 |
// Bail if Pro version is active to prevent conflicts. |
| 95 |
$active_plugins = (array) get_option('active_plugins', array()); |
| 96 |
if (is_multisite()) { |
| 97 |
$active_plugins = array_merge($active_plugins, array_keys((array) get_site_option('active_sitewide_plugins', array()))); |
| 98 |
} |
| 99 |
|
| 100 |
if (in_array('event-monster-premium/event-monster-premium.php', $active_plugins) || defined('EM_IS_PRO') && EM_IS_PRO === true) { |
| 101 |
return; |
| 102 |
} |
| 103 |
$plugin = new Event_Monster_Free_Main(); |
| 104 |
$plugin->run(); |
| 105 |
} |
| 106 |
|
| 107 |
run_Event_Monster_Free_free(); |
| 108 |
|