Repository navigation
Expand file tree
/
Copy pathplugin.php
More file actions
74 lines (66 loc) · 2.89 KB
/
Copy pathplugin.php
File metadata and controls
74 lines (66 loc) · 2.89 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
70
71
72
73
74
<?php
/**
* Plugin Name: Event Tickets Extension: Default Attendee Fields
* Plugin URI: https://theeventscalendar.com/extensions/default-attendee-fields/
* GitHub Plugin URI: https://github.com/mt-support/tec-labs-default-attendee-fields
* Description: Select a fieldset that will be added to all RSVPs and tickets when they are created. You can find the settings under Tickets > Settings > Attendee Registration tab > Default Attendee Fields section.
* Version: 1.2.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: tec-labs-default-attendee-fields
*
* 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 the plugin path and other variables.
*
* @since 1.0.0
*
* @var string Base file that loaded the plugin.
*/
define( 'TRIBE_EXTENSION_DEFAULT_ATTENDEE_FIELDS_FILE', __FILE__ );
/**
* Register and load the service provider for loading the extension.
*
* @since 1.0.0
*/
function tribe_extension_default_attendee_fields() {
// 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\\Default_Attendee_Fields\\',
__DIR__ . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Tec',
'default-attendee-fields'
);
// Deactivates the plugin in case of the main class didn't autoload.
if ( ! class_exists( '\Tribe\Extensions\Default_Attendee_Fields\Plugin' ) ) {
tribe_transient_notice(
'default-attendee-fields',
'<p>' . esc_html__( 'Couldn\'t properly load "Event Tickets Extension: Default Attendee Fields" the extension was deactivated.', 'tec-labs-default-attendee-fields' ) . '</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\Default_Attendee_Fields\Plugin' );
}
// Loads after Event Ticket Plus is already properly loaded.
add_action( 'tec_tickets_plus_fully_loaded', 'tribe_extension_default_attendee_fields' );