forked from wp-plugins/contact-form-7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.php
81 lines (58 loc) · 2.08 KB
/
settings.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
77
78
79
80
81
<?php
require_once WPCF7_PLUGIN_DIR . '/includes/functions.php';
require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php';
require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php';
require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php';
require_once WPCF7_PLUGIN_DIR . '/includes/capabilities.php';
require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-template.php';
require_once WPCF7_PLUGIN_DIR . '/includes/contact-form.php';
require_once WPCF7_PLUGIN_DIR . '/includes/mail.php';
require_once WPCF7_PLUGIN_DIR . '/includes/submission.php';
require_once WPCF7_PLUGIN_DIR . '/includes/upgrade.php';
require_once WPCF7_PLUGIN_DIR . '/includes/integration.php';
if ( is_admin() ) {
require_once WPCF7_PLUGIN_DIR . '/admin/admin.php';
} else {
require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
}
add_action( 'plugins_loaded', 'wpcf7' );
function wpcf7() {
wpcf7_load_textdomain();
wpcf7_load_modules();
/* Shortcodes */
add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' );
add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' );
}
add_action( 'init', 'wpcf7_init' );
function wpcf7_init() {
wpcf7_get_request_uri();
wpcf7_register_post_types();
do_action( 'wpcf7_init' );
}
add_action( 'admin_init', 'wpcf7_upgrade' );
function wpcf7_upgrade() {
$opt = get_option( 'wpcf7' );
if ( ! is_array( $opt ) )
$opt = array();
$old_ver = isset( $opt['version'] ) ? (string) $opt['version'] : '0';
$new_ver = WPCF7_VERSION;
if ( $old_ver == $new_ver )
return;
do_action( 'wpcf7_upgrade', $new_ver, $old_ver );
$opt['version'] = $new_ver;
update_option( 'wpcf7', $opt );
}
/* Install and default settings */
add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' );
function wpcf7_install() {
if ( $opt = get_option( 'wpcf7' ) )
return;
wpcf7_load_textdomain();
wpcf7_register_post_types();
wpcf7_upgrade();
if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) )
return;
$contact_form = WPCF7_ContactForm::get_template( array(
'title' => sprintf( __( 'Contact form %d', 'contact-form-7' ), 1 ) ) );
$contact_form->save();
}