-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcf7-zoom-webinar-registration.php
66 lines (56 loc) · 1.71 KB
/
cf7-zoom-webinar-registration.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
<?php
/*
Plugin Name: CF7 Zoom Webinar registration
Plugin URI: https://github.com/usame-algan/cf7-zoom-webinar-registration
Description: Allow registrations for your Zoom Webinar through Wordpress Contact Form 7
Version: 1.0.6
Author: Usame Algan
Author URI: https://usamealgan.com
Text Domain: cf7-zwr
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Plugin constants
*/
if (!defined('CF7_ZWR_VERSION')) {
define('CF7_ZWR_VERSION', '1.0.6' );
}
if (!defined('CF7_ZWR_PATH')) {
define('CF7_ZWR_PATH', plugin_dir_path( __FILE__ ));
}
if (!defined('CF7_ZWR_PLUGIN_FILE')) {
define('CF7_ZWR_PLUGIN_FILE', __FILE__);
}
/**
* Check if Contact Form 7 is installed and activated.
*/
add_action( 'admin_init', 'cf7_zwr_has_parent_plugin' );
function cf7_zwr_has_parent_plugin() {
if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( 'contact-form-7/wp-contact-form-7.php' )) {
add_action( 'admin_notices', 'cf7_zwr_nocf7_notice' );
deactivate_plugins( plugin_basename( __FILE__ ) );
if ( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
}
}
function cf7_zwr_nocf7_notice() { ?>
<div class="error">
<p>
<?php printf(
__('%s must be installed and activated for the CF7 Zoom Webinar Registration plugin to work', 'cf7-zwr'),
'<a href="'.admin_url('plugin-install.php?tab=search&s=contact+form+7').'">Contact Form 7</a>'
); ?>
</p>
</div>
<?php
}
require_once CF7_ZWR_PATH . 'vendor/autoload.php';
require_once CF7_ZWR_PATH . 'includes/class-cf7-zwr.php';
function run_cf7_zwr() {
$cf7_zwr = new CF7_ZWR();
$cf7_zwr->run();
}
run_cf7_zwr();