-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.php
76 lines (57 loc) · 2.14 KB
/
plugin.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
70
71
72
73
74
75
76
<?php
/**
* Plugin Name: Intermedia Events Carousel
* Plugin URI: https://www.intermedia.com.au/
* Description: Display Tribe events in a carousel.
* Author: Jose Anton
* Author URI: https://www.intermedia.com.au/
* Version: 1.0.0
* License: GPL2+
* License URI: https://www.gnu.org/licenses/gpl-2.0.txt
*
* @package CGB
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if (!function_exists('self_deactivate_plugin')) {
function self_deactivate_plugin (){
//Plugins
$plugin_a = '../the-events-calendar/the-events-calendar.php';
$plugin_b = '../intermedia-carousel-events/plugin.php';
// check for plugin using plugin name
if ( !is_plugin_active( $plugin_a ) ) {
$category_error = true;
} else {
$category_error = false;
}
if ( $category_error ) {
deactivate_plugins($plugin_b);
}
}
//add_action( 'init', 'self_deactivate_plugin' );
}
if ( !function_exists('intermedia_events_carousel_activate') ) {
function intermedia_events_carousel_activate ( $network_wide ) {
//Plugin path
$plugin_a = 'the-events-calendar/the-events-calendar.php';
// check for plugin using plugin name
if ( !is_plugin_active( $plugin_a ) ) {
$category_error = true;
} else {
$category_error = false;
}
if ( $category_error ) {
echo '<h3>'.__('Please install The Events Calendar plugin by Tribe Events before activating. <a target="_blank" href="https://wordpress.org/plugins/the-events-calendar/">Here is the link!</a>', 'ap').'</h3>';
//Adding @ before will prevent XDebug output
@trigger_error(__('Please install The Events Calendar plugin by Tribe Events before activating.', 'ap'), E_USER_ERROR);
}
}
register_activation_hook(__FILE__, 'intermedia_events_carousel_activate');
}
/**
* Block Initializer.
*/
require_once plugin_dir_path( __FILE__ ) . 'src/init.php';
require_once plugin_dir_path( __FILE__ ) . '/src/includes/class-carousel-block.php';