contact-form-7
Last commit date
admin
11 years ago
images
14 years ago
includes
11 years ago
languages
11 years ago
modules
11 years ago
license.txt
16 years ago
readme.txt
11 years ago
settings.php
11 years ago
uninstall.php
14 years ago
wp-contact-form-7.php
11 years ago
settings.php
76 lines
| 1 | <?php |
| 2 | |
| 3 | require_once WPCF7_PLUGIN_DIR . '/includes/functions.php'; |
| 4 | require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php'; |
| 5 | require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php'; |
| 6 | require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php'; |
| 7 | require_once WPCF7_PLUGIN_DIR . '/includes/capabilities.php'; |
| 8 | require_once WPCF7_PLUGIN_DIR . '/includes/contact-form.php'; |
| 9 | require_once WPCF7_PLUGIN_DIR . '/includes/mail.php'; |
| 10 | require_once WPCF7_PLUGIN_DIR . '/includes/submission.php'; |
| 11 | require_once WPCF7_PLUGIN_DIR . '/includes/upgrade.php'; |
| 12 | |
| 13 | if ( is_admin() ) |
| 14 | require_once WPCF7_PLUGIN_DIR . '/admin/admin.php'; |
| 15 | else |
| 16 | require_once WPCF7_PLUGIN_DIR . '/includes/controller.php'; |
| 17 | |
| 18 | add_action( 'plugins_loaded', 'wpcf7' ); |
| 19 | |
| 20 | function wpcf7() { |
| 21 | wpcf7_load_textdomain(); |
| 22 | wpcf7_load_modules(); |
| 23 | } |
| 24 | |
| 25 | add_action( 'init', 'wpcf7_init' ); |
| 26 | |
| 27 | function wpcf7_init() { |
| 28 | wpcf7_get_request_uri(); |
| 29 | wpcf7_register_post_types(); |
| 30 | |
| 31 | do_action( 'wpcf7_init' ); |
| 32 | } |
| 33 | |
| 34 | add_action( 'admin_init', 'wpcf7_upgrade' ); |
| 35 | |
| 36 | function wpcf7_upgrade() { |
| 37 | $opt = get_option( 'wpcf7' ); |
| 38 | |
| 39 | if ( ! is_array( $opt ) ) |
| 40 | $opt = array(); |
| 41 | |
| 42 | $old_ver = isset( $opt['version'] ) ? (string) $opt['version'] : '0'; |
| 43 | $new_ver = WPCF7_VERSION; |
| 44 | |
| 45 | if ( $old_ver == $new_ver ) |
| 46 | return; |
| 47 | |
| 48 | do_action( 'wpcf7_upgrade', $new_ver, $old_ver ); |
| 49 | |
| 50 | $opt['version'] = $new_ver; |
| 51 | |
| 52 | update_option( 'wpcf7', $opt ); |
| 53 | } |
| 54 | |
| 55 | /* Install and default settings */ |
| 56 | |
| 57 | add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' ); |
| 58 | |
| 59 | function wpcf7_install() { |
| 60 | if ( $opt = get_option( 'wpcf7' ) ) |
| 61 | return; |
| 62 | |
| 63 | wpcf7_load_textdomain(); |
| 64 | wpcf7_register_post_types(); |
| 65 | wpcf7_upgrade(); |
| 66 | |
| 67 | if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) ) |
| 68 | return; |
| 69 | |
| 70 | $contact_form = WPCF7_ContactForm::get_template( array( |
| 71 | 'title' => sprintf( __( 'Contact form %d', 'contact-form-7' ), 1 ) ) ); |
| 72 | |
| 73 | $contact_form->save(); |
| 74 | } |
| 75 | |
| 76 | ?> |