Changeset 56603 for trunk/src/wp-admin/includes/misc.php
- Timestamp:
- 09/18/2023 12:28:24 AM (17 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/misc.php
r56549 r56603 1659 1659 * @type string $id Optional. The value of the admin notice's ID attribute. Default empty string. 1660 1660 * @type string[] $additional_classes Optional. A string array of class names. Default empty array. 1661 * @type string[] $attributes Optional. Additional attributes for the notice div. Default empty array. 1661 1662 * @type bool $paragraph_wrap Optional. Whether to wrap the message in paragraph tags. Default true. 1662 1663 * } … … 1669 1670 'id' => '', 1670 1671 'additional_classes' => array(), 1672 'attributes' => array(), 1671 1673 'paragraph_wrap' => true, 1672 1674 ); … … 1682 1684 * @param string $message The message for the admin notice. 1683 1685 */ 1684 $args = apply_filters( 'wp_admin_notice_args', $args, $message ); 1685 $id = ''; 1686 $classes = 'notice'; 1686 $args = apply_filters( 'wp_admin_notice_args', $args, $message ); 1687 $id = ''; 1688 $classes = 'notice'; 1689 $attributes = ''; 1687 1690 1688 1691 if ( is_string( $args['id'] ) ) { … … 1722 1725 } 1723 1726 1727 if ( is_array( $args['attributes'] ) && ! empty( $args['attributes'] ) ) { 1728 $attributes = ''; 1729 foreach ( $args['attributes'] as $attr => $val ) { 1730 if ( is_bool( $val ) ) { 1731 $attributes .= $val ? ' ' . $attr : ''; 1732 } elseif ( is_int( $attr ) ) { 1733 $attributes .= ' ' . esc_attr( trim( $val ) ); 1734 } elseif ( $val ) { 1735 $attributes .= ' ' . $attr . '="' . esc_attr( trim( $val ) ) . '"'; 1736 } 1737 } 1738 } 1739 1724 1740 if ( false !== $args['paragraph_wrap'] ) { 1725 1741 $message = "<p>$message</p>"; 1726 1742 } 1727 1743 1728 $markup = sprintf( '<div %1$sclass="%2$s" >%3$s</div>', $id, $classes, $message );1744 $markup = sprintf( '<div %1$sclass="%2$s"%3$s>%4$s</div>', $id, $classes, $attributes, $message ); 1729 1745 1730 1746 /**
Note: See TracChangeset
for help on using the changeset viewer.