generated from mt-support/tec-labs-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.php
74 lines (66 loc) · 2.52 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
<?php
/**
* Plugin Name: Event Tickets Extension: Ticket_User_Limit
* Plugin URI:
* GitHub Plugin URI: https://github.com/mt-support/tec-labs-ticketuserlimit
* Description:
* Version: 1.0.0
* Author: The Events Calendar
* Author URI: https://evnt.is/1971
* License: GPL version 3 or any later version
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: __TRIBE_DOMAIN__
*
* This plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/**
* Define the base file that loaded the plugin for determining plugin path and other variables.
*
* @since 1.0.0
*
* @var string Base file that loaded the plugin.
*/
define( 'TRIBE_EXTENSION___TRIBE_SLUG_CLEAN_ALLCAPS___FILE', __FILE__ );
/**
* Register and load the service provider for loading the extension.
*
* @since 1.0.0
*/
function tribe_extension_ticketuserlimit() {
// When we don't have autoloader from common we bail.
if ( ! class_exists( 'Tribe__Autoloader' ) ) {
return;
}
// Register the namespace so we can the plugin on the service provider registration.
Tribe__Autoloader::instance()->register_prefix(
'\\Tribe\\Extensions\\Ticket_User_Limit\\',
__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Tec',
'ticketuserlimit'
);
// Deactivates the plugin in case of the main class didn't autoload.
if ( ! class_exists( '\Tribe\Extensions\Ticket_User_Limit\Plugin' ) ) {
tribe_transient_notice(
'ticketuserlimit',
'<p>' . esc_html__( 'Couldn\'t properly load "Event Tickets Extension: Ticket_User_Limit" the extension was deactivated.', '__TRIBE_DOMAIN__' ) . '</p>',
[],
// 1 second after that make sure the transient is removed.
1
);
if ( ! function_exists( 'deactivate_plugins' ) ) {
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
deactivate_plugins( __FILE__, true );
return;
}
tribe_register_provider( '\Tribe\Extensions\Ticket_User_Limit\Plugin' );
}
// Loads after common is already properly loaded.
add_action( 'tribe_common_loaded', 'tribe_extension_ticketuserlimit' );