| @@ -1,100 +1,52 @@ | ||
| 1 | 1 | <?php |
| 2 | -/* Home for Backwards Compatibility Functions */ | |
| 2 | +/** | |
| 3 | + * Home for Backwards Compatibility Functions | |
| 4 | + * | |
| 5 | + * @package Mailchimp | |
| 6 | + */ | |
| 3 | 7 | |
| 4 | 8 | /* Form Display Functions */ |
| 5 | -if (!function_exists('mc_display_widget')){ | |
| 6 | - function mc_display_widget($args=array()){ | |
| 7 | - mailchimpSF_signup_form($args); | |
| 8 | - } | |
| 9 | -} | |
| 10 | -if (!function_exists('mailchimpSF_display_widget')){ | |
| 11 | - function mailchimpSF_display_widget($args=array()){ | |
| 12 | - mailchimpSF_signup_form($args); | |
| 13 | - } | |
| 14 | -} | |
| 9 | +if ( ! function_exists( 'mc_display_widget' ) ) { | |
| 15 | 10 | |
| 16 | - | |
| 17 | -/* Shortcodes */ | |
| 18 | -add_shortcode('mailchimpsf_widget', 'mailchimpSF_shortcode'); | |
| 19 | - | |
| 20 | - | |
| 21 | -/* Functions for < WP 3.0 Compat */ | |
| 22 | - | |
| 23 | -if (!function_exists('home_url')) { | |
| 24 | 11 | /** |
| 25 | - * Retrieve the home url for the current site. | |
| 12 | + * Alias for `mailchimp_sf_signup_form` | |
| 26 | 13 | * |
| 27 | - * Returns the 'home' option with the appropriate protocol, 'https' if | |
| 28 | - * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is | |
| 29 | - * overridden. | |
| 30 | - * | |
| 31 | - * @package WordPress | |
| 32 | - * @since 3.0.0 | |
| 33 | - * | |
| 34 | - * @uses get_home_url() | |
| 35 | - * | |
| 36 | - * @param string $path (optional) Path relative to the home url. | |
| 37 | - * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' | |
| 38 | - * @return string Home url link with optional path appended. | |
| 39 | - */ | |
| 40 | - function home_url( $path = '', $scheme = null ) { | |
| 41 | - return get_home_url(null, $path, $scheme); | |
| 14 | + * @param array $args Signup form args. | |
| 15 | + * @return void | |
| 16 | + */ | |
| 17 | + function mc_display_widget( $args = array() ) { | |
| 18 | + mailchimp_sf_signup_form( $args ); | |
| 42 | 19 | } |
| 43 | - | |
| 44 | 20 | } |
| 21 | +if ( ! function_exists( 'mailchimp_sf_display_widget' ) ) { | |
| 45 | 22 | |
| 46 | -if (!function_exists('get_home_url')) { | |
| 47 | 23 | /** |
| 48 | - * Retrieve the home url for a given site. | |
| 24 | + * Alias for `mailchimp_sf_signup_form` | |
| 49 | 25 | * |
| 50 | - * Returns the 'home' option with the appropriate protocol, 'https' if | |
| 51 | - * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is | |
| 52 | - * overridden. | |
| 53 | - * | |
| 54 | - * @package WordPress | |
| 55 | - * @since 3.0.0 | |
| 56 | - * | |
| 57 | - * @param int $blog_id (optional) Blog ID. Defaults to current blog. | |
| 58 | - * @param string $path (optional) Path relative to the home url. | |
| 59 | - * @param string $scheme (optional) Scheme to give the home url context. Currently 'http','https' | |
| 60 | - * @return string Home url link with optional path appended. | |
| 61 | - */ | |
| 62 | - function get_home_url( $blog_id = null, $path = '', $scheme = null ) { | |
| 63 | - $orig_scheme = $scheme; | |
| 64 | - | |
| 65 | - if ( !in_array( $scheme, array( 'http', 'https' ) ) ) | |
| 66 | - $scheme = is_ssl() && !is_admin() ? 'https' : 'http'; | |
| 67 | - | |
| 68 | - if ( empty( $blog_id ) || !is_multisite() ) | |
| 69 | - $home = get_option( 'home' ); | |
| 70 | - else | |
| 71 | - $home = get_blog_option( $blog_id, 'home' ); | |
| 72 | - | |
| 73 | - $url = str_replace( 'http://', "$scheme://", $home ); | |
| 74 | - | |
| 75 | - if ( !empty( $path ) && is_string( $path ) && strpos( $path, '..' ) === false ) | |
| 76 | - $url .= '/' . ltrim( $path, '/' ); | |
| 77 | - | |
| 78 | - return apply_filters( 'home_url', $url, $path, $orig_scheme, $blog_id ); | |
| 26 | + * @param array $args Signup form args. | |
| 27 | + * @return void | |
| 28 | + */ | |
| 29 | + function mailchimp_sf_display_widget( $args = array() ) { | |
| 30 | + mailchimp_sf_signup_form( $args ); | |
| 79 | 31 | } |
| 80 | 32 | } |
| 81 | 33 | |
| 82 | -if (!function_exists('is_multisite')) { | |
| 83 | - /** | |
| 84 | - * Whether Multisite support is enabled | |
| 85 | - * | |
| 86 | - * @since 3.0.0 | |
| 87 | - * | |
| 88 | - * @return bool True if multisite is enabled, false otherwise. | |
| 89 | - */ | |
| 90 | - function is_multisite() { | |
| 91 | - if ( defined( 'MULTISITE' ) ) | |
| 92 | - return MULTISITE; | |
| 34 | +/* Shortcodes */ | |
| 35 | +add_shortcode( 'mailchimpsf_widget', 'mailchimp_sf_shortcode' ); | |
| 93 | 36 | |
| 94 | - if ( defined( 'VHOST' ) || defined( 'SUNRISE' ) ) | |
| 95 | - return true; | |
| 37 | +/** | |
| 38 | + * Deprecates functions for plugin version 1.6.0 | |
| 39 | + * | |
| 40 | + * Changes function names to snake case | |
| 41 | + */ | |
| 96 | 42 | |
| 97 | - return false; | |
| 98 | - } | |
| 43 | +/** | |
| 44 | + * (Deprecated) Displays a Mailchimp Signup Form | |
| 45 | + * | |
| 46 | + * @param array $args Args | |
| 47 | + * @return void | |
| 48 | + */ | |
| 49 | +function mailchimpSF_signup_form( $args = array() ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid -- ignored due to deprecating function | |
| 50 | + _deprecated_function( __FUNCTION__, '1.6.0', 'mailchimp_sf_signup_form' ); | |
| 51 | + mailchimp_sf_signup_form( $args ); | |
| 99 | 52 | } |
| 100 | -?> | |