-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsettings.php
144 lines (105 loc) · 3.18 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
function wpcf7_plugin_path( $path = '' ) {
return path_join( WPCF7_PLUGIN_DIR, trim( $path, '/' ) );
}
function wpcf7_plugin_url( $path = '' ) {
global $wp_version;
if ( version_compare( $wp_version, '2.8', '<' ) ) { // Using WordPress 2.7
$path = path_join( WPCF7_PLUGIN_NAME, $path );
return plugins_url( $path );
}
return plugins_url( $path, WPCF7_PLUGIN_BASENAME );
}
function wpcf7_admin_url( $file, $query = array() ) {
$file = trim( $file, ' /' );
if ( 'admin/' != substr( $file, 0, 6 ) )
$file = 'admin/' . $file;
$path = 'admin.php';
$path .= '?page=' . WPCF7_PLUGIN_NAME . '/' . $file;
if ( $query = build_query( $query ) )
$path .= '&' . $query;
$url = admin_url( $path );
return sanitize_url( $url );
}
function wpcf7_table_name() {
global $wpdb;
return $wpdb->prefix . "contact_form_7";
}
function wpcf7_table_exists() {
global $wpdb;
$table_name = wpcf7_table_name();
return strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) ) == strtolower( $table_name );
}
// Pre-2.8 compatibility
if ( ! function_exists( 'esc_js' ) ) {
function esc_js( $text ) {
return js_escape( $text );
}
}
if ( ! function_exists( 'esc_html' ) ) {
function esc_html( $text ) {
return wp_specialchars( $text );
}
}
if ( ! function_exists( 'esc_attr' ) ) {
function esc_attr( $text ) {
return attribute_escape( $text );
}
}
if ( ! function_exists( 'esc_sql' ) ) {
function esc_sql( $text ) {
global $wpdb;
return $wpdb->escape( $text );
}
}
if ( ! function_exists( 'esc_url' ) ) {
function esc_url( $url, $protocols = null ) {
return clean_url( $url, $protocols, 'display' );
}
}
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/classes.php';
if ( is_admin() )
require_once WPCF7_PLUGIN_DIR . '/admin/admin.php';
else
require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
function wpcf7_contact_forms() {
global $wpdb;
$table_name = wpcf7_table_name();
return $wpdb->get_results( "SELECT cf7_unit_id as id, title FROM $table_name" );
}
$wpcf7_contact_form = null;
$wpcf7_request_uri = null;
$wpcf7_processing_within = null;
$wpcf7_unit_count = null;
$wpcf7_widget_count = null;
add_action( 'plugins_loaded', 'wpcf7_set_request_uri', 9 );
function wpcf7_set_request_uri() {
global $wpcf7_request_uri;
$wpcf7_request_uri = add_query_arg( array() );
}
function wpcf7_get_request_uri() {
global $wpcf7_request_uri;
return (string) $wpcf7_request_uri;
}
/* Loading modules */
add_action( 'plugins_loaded', 'wpcf7_load_modules', 1 );
function wpcf7_load_modules() {
$dir = WPCF7_PLUGIN_MODULES_DIR;
if ( ! ( is_dir( $dir ) && $dh = opendir( $dir ) ) )
return false;
while ( ( $module = readdir( $dh ) ) !== false ) {
if ( substr( $module, -4 ) == '.php' )
include_once $dir . '/' . $module;
}
}
/* L10N */
add_action( 'init', 'wpcf7_load_plugin_textdomain' );
function wpcf7_load_plugin_textdomain() {
load_plugin_textdomain( 'wpcf7',
'wp-content/plugins/contact-form-7/languages', 'contact-form-7/languages' );
}
?>