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 3.9 3.9-beta 3.9.1 3.9.2 3.9.3 4.0 4.0.1 4.0.2 4.0.3 4.1 4.1-beta 4.1.1 4.1.2 4.2 4.2-beta 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.2 4.5 4.5.1 4.6 4.6.1 4.7 4.8 4.8.1 4.9 4.9.1 4.9.2 5.0 5.0.1
contact-form-7 / settings.php
contact-form-7 Last commit date
admin 13 years ago images 14 years ago includes 12 years ago languages 12 years ago modules 13 years ago license.txt 16 years ago readme.txt 12 years ago settings.php 13 years ago uninstall.php 14 years ago wp-contact-form-7.php 12 years ago
settings.php
207 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
11 if ( is_admin() )
12 require_once WPCF7_PLUGIN_DIR . '/admin/admin.php';
13 else
14 require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
15
16 add_action( 'plugins_loaded', 'wpcf7_init_shortcode_manager', 1 );
17
18 function wpcf7_init_shortcode_manager() {
19 global $wpcf7_shortcode_manager;
20
21 $wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();
22 }
23
24 /* Loading modules */
25
26 add_action( 'plugins_loaded', 'wpcf7_load_modules', 1 );
27
28 function wpcf7_load_modules() {
29 $dir = WPCF7_PLUGIN_MODULES_DIR;
30
31 if ( ! ( is_dir( $dir ) && $dh = opendir( $dir ) ) )
32 return false;
33
34 while ( ( $module = readdir( $dh ) ) !== false ) {
35 if ( substr( $module, -4 ) == '.php' && substr( $module, 0, 1 ) != '.' )
36 include_once $dir . '/' . $module;
37 }
38 }
39
40 add_action( 'plugins_loaded', 'wpcf7_set_request_uri', 9 );
41
42 function wpcf7_set_request_uri() {
43 global $wpcf7_request_uri;
44
45 $wpcf7_request_uri = add_query_arg( array() );
46 }
47
48 function wpcf7_get_request_uri() {
49 global $wpcf7_request_uri;
50
51 return (string) $wpcf7_request_uri;
52 }
53
54 add_action( 'init', 'wpcf7_init' );
55
56 function wpcf7_init() {
57 wpcf7();
58
59 // L10N
60 wpcf7_load_plugin_textdomain();
61
62 // Custom Post Type
63 wpcf7_register_post_types();
64
65 do_action( 'wpcf7_init' );
66 }
67
68 function wpcf7() {
69 global $wpcf7;
70
71 if ( is_object( $wpcf7 ) )
72 return;
73
74 $wpcf7 = (object) array(
75 'processing_within' => '',
76 'widget_count' => 0,
77 'unit_count' => 0,
78 'global_unit_count' => 0,
79 'result' => array() );
80 }
81
82 function wpcf7_load_plugin_textdomain() {
83 load_plugin_textdomain( 'wpcf7', false, 'contact-form-7/languages' );
84 }
85
86 function wpcf7_register_post_types() {
87 WPCF7_ContactForm::register_post_type();
88 }
89
90 /* Upgrading */
91
92 add_action( 'admin_init', 'wpcf7_upgrade' );
93
94 function wpcf7_upgrade() {
95 $opt = get_option( 'wpcf7' );
96
97 if ( ! is_array( $opt ) )
98 $opt = array();
99
100 $old_ver = isset( $opt['version'] ) ? (string) $opt['version'] : '0';
101 $new_ver = WPCF7_VERSION;
102
103 if ( $old_ver == $new_ver )
104 return;
105
106 do_action( 'wpcf7_upgrade', $new_ver, $old_ver );
107
108 $opt['version'] = $new_ver;
109
110 update_option( 'wpcf7', $opt );
111 }
112
113 add_action( 'wpcf7_upgrade', 'wpcf7_convert_to_cpt', 10, 2 );
114
115 function wpcf7_convert_to_cpt( $new_ver, $old_ver ) {
116 global $wpdb;
117
118 if ( ! version_compare( $old_ver, '3.0-dev', '<' ) )
119 return;
120
121 $old_rows = array();
122
123 $table_name = $wpdb->prefix . "contact_form_7";
124
125 if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) ) {
126 $old_rows = $wpdb->get_results( "SELECT * FROM $table_name" );
127 } elseif ( ( $opt = get_option( 'wpcf7' ) ) && ! empty( $opt['contact_forms'] ) ) {
128 foreach ( (array) $opt['contact_forms'] as $key => $value ) {
129 $old_rows[] = (object) array_merge( $value, array( 'cf7_unit_id' => $key ) );
130 }
131 }
132
133 foreach ( (array) $old_rows as $row ) {
134 $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
135 . $wpdb->prepare( " AND meta_value = %d", $row->cf7_unit_id );
136
137 if ( $wpdb->get_var( $q ) )
138 continue;
139
140 $postarr = array(
141 'post_type' => 'wpcf7_contact_form',
142 'post_status' => 'publish',
143 'post_title' => maybe_unserialize( $row->title ) );
144
145 $post_id = wp_insert_post( $postarr );
146
147 if ( $post_id ) {
148 update_post_meta( $post_id, '_old_cf7_unit_id', $row->cf7_unit_id );
149
150 $metas = array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' );
151
152 foreach ( $metas as $meta ) {
153 update_post_meta( $post_id, '_' . $meta,
154 wpcf7_normalize_newline_deep( maybe_unserialize( $row->{$meta} ) ) );
155 }
156 }
157 }
158 }
159
160 add_action( 'wpcf7_upgrade', 'wpcf7_prepend_underscore', 10, 2 );
161
162 function wpcf7_prepend_underscore( $new_ver, $old_ver ) {
163 if ( version_compare( $old_ver, '3.0-dev', '<' ) )
164 return;
165
166 if ( ! version_compare( $old_ver, '3.3-dev', '<' ) )
167 return;
168
169 $posts = WPCF7_ContactForm::find( array(
170 'post_status' => 'any',
171 'posts_per_page' => -1 ) );
172
173 foreach ( $posts as $post ) {
174 $props = $post->get_properties();
175
176 foreach ( $props as $prop => $value ) {
177 if ( metadata_exists( 'post', $post->id, '_' . $prop ) )
178 continue;
179
180 update_post_meta( $post->id, '_' . $prop, $value );
181 delete_post_meta( $post->id, $prop );
182 }
183 }
184 }
185
186 /* Install and default settings */
187
188 add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' );
189
190 function wpcf7_install() {
191 if ( $opt = get_option( 'wpcf7' ) )
192 return;
193
194 wpcf7_load_plugin_textdomain();
195 wpcf7_register_post_types();
196 wpcf7_upgrade();
197
198 if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) )
199 return;
200
201 $contact_form = wpcf7_get_contact_form_default_pack(
202 array( 'title' => sprintf( __( 'Contact form %d', 'wpcf7' ), 1 ) ) );
203
204 $contact_form->save();
205 }
206
207 ?>