Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: WordPress 6.5.4 Compatibility #27

Merged
merged 5 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
js/scrollTo.js
tests
5 changes: 4 additions & 1 deletion js/mailchimp.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
});
$('#mc_submit_type').val('js');
}
$.scrollTo('#mc_signup', { offset: { top: -28 } });
window.scrollTo({
top: document.getElementById('mc_signup').offsetTop - 28,
behavior: 'smooth',
});
}

$(function ($) {
Expand Down
11 changes: 0 additions & 11 deletions js/scrollTo.js

This file was deleted.

3 changes: 1 addition & 2 deletions mailchimp.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://mailchimp.com/help/connect-or-disconnect-list-subscribe-for-wordpress/
* Description: Add a Mailchimp signup form widget to your WordPress site.
* Version: 1.5.8
* Requires at least: 2.8
* Requires at least: 6.1
* Requires PHP: 7.0
* PHP tested up to: 8.3
* Author: Mailchimp
Expand Down Expand Up @@ -105,7 +105,6 @@ function mailchimp_sf_load_resources() {
// JS
if ( get_option( 'mc_use_javascript' ) === 'on' ) {
if ( ! is_admin() ) {
wp_enqueue_script( 'jquery_scrollto', MCSF_URL . 'js/scrollTo.js', array( 'jquery' ), MCSF_VER, true );
wp_enqueue_script( 'mailchimp_sf_main_js', MCSF_URL . 'js/mailchimp.js', array( 'jquery', 'jquery-form' ), MCSF_VER, true );
// some javascript to get ajax version submitting to the proper location
global $wp_scripts;
Expand Down
86 changes: 0 additions & 86 deletions mailchimp_compat.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,95 +31,9 @@ function mailchimp_sf_display_widget( $args = array() ) {
}
}


/* Shortcodes */
add_shortcode( 'mailchimpsf_widget', 'mailchimp_sf_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' ), true ) ) {
$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;
}
}

/**
* Deprecates functions for plugin version 1.6.0
*
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== Mailchimp List Subscribe Form ===
Contributors: Mailchimp
Tags: mailchimp, email, newsletter, signup, marketing
Tested up to: 4.5
Tested up to: 6.5
Stable tag: 1.5.8
License: GPL-2.0-or-later
License URI: https://spdx.org/licenses/GPL-2.0-or-later.html
Expand Down
Loading