updated plugin Easy Digital Downloads version 3.1.1.4.2

This commit is contained in:
2023-06-05 11:21:17 +00:00
committed by Gitium
parent e5482aabb7
commit b7bbe6d733
105 changed files with 3161 additions and 1326 deletions

View File

@ -51,6 +51,11 @@ class EDD_Notices {
*/
public function add_notice( $args = array() ) {
// Avoid malformed notices variable
if ( ! is_array( $this->notices ) ) {
$this->notices = array();
}
// Parse args
$r = wp_parse_args( $args, array(
'id' => '',
@ -59,6 +64,11 @@ class EDD_Notices {
'is_dismissible' => true,
) );
// Prevent a notice from being added more than once.
if ( ! empty( $r['id'] ) && array_key_exists( $r['id'], $this->notices ) ) {
return;
}
$default_class = 'updated';
// One message as string
@ -93,9 +103,10 @@ class EDD_Notices {
}
// CSS Classes
$classes = ! empty( $r['class'] )
? array( $r['class'] )
: array( $default_class );
$classes = array( $default_class );
if ( ! empty( $r['class'] ) ) {
$classes = explode( ' ', $r['class'] );
}
// Add dismissible class
if ( ! empty( $r['is_dismissible'] ) ) {
@ -106,13 +117,8 @@ class EDD_Notices {
$message = '<div class="notice ' . implode( ' ', array_map( 'sanitize_html_class', $classes ) ) . '">' . $message . '</div>';
$message = str_replace( "'", "\'", $message );
// Avoid malformed notices variable
if ( ! is_array( $this->notices ) ) {
$this->notices = array();
}
// Add notice to notices array
$this->notices[] = $message;
$this->notices[ $r['id'] ] = $message;
}
/**