forked from crowdfavorite/wp-mailchimp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mailchimp_compat.php
100 lines (84 loc) · 2.69 KB
/
mailchimp_compat.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
<?php
/* Home for Backwards Compatibility Functions */
/* Form Display Functions */
if (!function_exists('mc_display_widget')){
function mc_display_widget($args=array()){
mailchimpSF_signup_form($args);
}
}
if (!function_exists('mailchimpSF_display_widget')){
function mailchimpSF_display_widget($args=array()){
mailchimpSF_signup_form($args);
}
}
/* Shortcodes */
add_shortcode('mailchimpsf_widget', 'mailchimpSF_shortcode');
/* Functions for < WP 3.0 Compat */
if (!function_exists('home_url')) {
/**
* Retrieve the home url for the current site.
*
* Returns the 'home' option with the appropriate protocol, 'https' if
* is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
* overridden.
*
* @package WordPress
* @since 3.0.0
*
* @uses get_home_url()
*
* @param string $path (optional) Path relative to the home url.
* @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
* @return string Home url link with optional path appended.
*/
function home_url( $path = '', $scheme = null ) {
return get_home_url(null, $path, $scheme);
}
}
if (!function_exists('get_home_url')) {
/**
* Retrieve the home url for a given site.
*
* Returns the 'home' option with the appropriate protocol, 'https' if
* is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
* overridden.
*
* @package WordPress
* @since 3.0.0
*
* @param int $blog_id (optional) Blog ID. Defaults to current blog.
* @param string $path (optional) Path relative to the home url.
* @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https'
* @return string Home url link with optional path appended.
*/
function get_home_url( $blog_id = null, $path = '', $scheme = null ) {
$orig_scheme = $scheme;
if ( !in_array( $scheme, array( 'http', 'https' ) ) )
$scheme = is_ssl() && !is_admin() ? 'https' : 'http';
if ( empty( $blog_id ) || !is_multisite() )
$home = get_option( 'home' );
else
$home = get_blog_option( $blog_id, 'home' );
$url = str_replace( 'http://', "$scheme://", $home );
if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false )
$url .= '/' . ltrim( $path, '/' );
return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id );
}
}
if (!function_exists('is_multisite')) {
/**
* Whether Multisite support is enabled
*
* @since 3.0.0
*
* @return bool True if multisite is enabled, false otherwise.
*/
function is_multisite() {
if ( defined( 'MULTISITE' ) )
return MULTISITE;
if ( defined( 'VHOST' ) || defined( 'SUNRISE' ) )
return true;
return false;
}
}
?>