-
Notifications
You must be signed in to change notification settings - Fork 1
Bump WordPress Tested up to version 7.0 #205
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
Open
qasumitbagthariya
wants to merge
6
commits into
develop
Choose a base branch
from
wp_7.0
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2f038f0
Bump WordPress Tested up to version 7.0
qasumitbagthariya 0561bf3
Add Mailchimp_Admin_Notices class for improved admin notice handling.
iamdharmesh 79ed2ac
Enhance radio button styling in admin CSS by adding a background colo…
iamdharmesh 5be4460
Refactor admin notice functions to remove return type declarations fo…
iamdharmesh aa18972
E2E: Ignore "uncaught:exception" to prevent test from failing.
iamdharmesh bd3a89a
Update minimum supported WordPress version to 6.6 in phpcs-compat.xml
iamdharmesh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| <?php | ||
| /** | ||
| * Mailchimp admin notices class. | ||
| * | ||
| * Registers notices and renders them on the admin_notices hook in the same request. | ||
| * | ||
| * @since x.x.x | ||
| * | ||
| * @package Mailchimp | ||
|
iamdharmesh marked this conversation as resolved.
|
||
| */ | ||
|
|
||
| // Exit if accessed directly. | ||
| if ( ! defined( 'ABSPATH' ) ) { | ||
| exit; | ||
| } | ||
|
|
||
| /** | ||
| * Class Mailchimp_Admin_Notices | ||
| * | ||
| * @since x.x.x | ||
| */ | ||
| class Mailchimp_Admin_Notices { | ||
|
|
||
| /** | ||
| * Singleton instance. | ||
| * | ||
| * @var Mailchimp_Admin_Notices|null | ||
| */ | ||
| private static $instance = null; | ||
|
|
||
| /** | ||
| * Queued notices for the current request. | ||
| * | ||
| * @var array<int, array{message: string, type: string}> | ||
| */ | ||
| private $notices = array(); | ||
|
|
||
| /** | ||
| * Get the singleton instance. | ||
| * | ||
| * @return Mailchimp_Admin_Notices | ||
| */ | ||
| public static function instance(): Mailchimp_Admin_Notices { | ||
| if ( null === self::$instance ) { | ||
| self::$instance = new self(); | ||
| } | ||
|
|
||
| return self::$instance; | ||
| } | ||
|
|
||
| /** | ||
| * Register the admin_notices hook. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function init() { | ||
| add_action( 'admin_notices', array( $this, 'render' ) ); | ||
| } | ||
|
|
||
| /** | ||
| * Queue an admin notice. | ||
| * | ||
| * @param string $message Notice message (already escaped/translated by caller). | ||
| * @param string $type Notice type: success or error. | ||
| * @return void | ||
| */ | ||
| public function add( string $message, string $type ) { | ||
| if ( ! is_admin() ) { | ||
| return; | ||
| } | ||
|
|
||
| if ( did_action( 'admin_notices' ) ) { | ||
| $this->print_notice( $message, $type ); | ||
| return; | ||
| } | ||
|
|
||
| $this->notices[] = array( | ||
| 'message' => $message, | ||
| 'type' => $type, | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Render all queued notices. | ||
| * | ||
| * @return void | ||
| */ | ||
| public function render() { | ||
| foreach ( $this->notices as $notice ) { | ||
| $this->print_notice( $notice['message'], $notice['type'] ); | ||
| } | ||
|
|
||
| $this->notices = array(); | ||
| } | ||
|
|
||
| /** | ||
| * Print a single admin notice. | ||
| * | ||
| * @param string $message Notice message. | ||
| * @param string $type Notice type: success or error. | ||
| * @return void | ||
| */ | ||
| private function print_notice( string $message, string $type ) { | ||
| $classes = array( 'notice', 'notice-' . sanitize_html_class( $type ) ); | ||
|
|
||
| if ( 'success' === $type ) { | ||
| $classes[] = 'is-dismissible'; | ||
| } | ||
|
|
||
| $allowed_html = array( | ||
| 'a' => array( | ||
| 'href' => array(), | ||
| 'title' => array(), | ||
| 'target' => array(), | ||
| ), | ||
| 'strong' => array(), | ||
| 'em' => array(), | ||
| 'br' => array(), | ||
| ); | ||
|
|
||
| ?> | ||
| <div class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>"> | ||
| <p> | ||
| <?php echo wp_kses( $message, $allowed_html ); ?> | ||
| </p> | ||
| </div> | ||
| <?php | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.