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