footer
2 years ago
sui-accordion.php
10 months ago
sui-box-header.php
3 years ago
sui-button.php
4 years ago
sui-checkbox.php
3 years ago
sui-footer.php
3 years ago
sui-header.php
4 years ago
sui-icon.php
5 years ago
sui-notice.php
3 years ago
sui-row.php
3 years ago
sui-select.php
3 years ago
sui-settings-row.php
3 years ago
sui-tabs.php
3 years ago
sui-tutorials.php
4 years ago
sui-notice.php
54 lines
| 1 | <?php |
| 2 | /** |
| 3 | * SUI Notice. |
| 4 | * |
| 5 | * @package Hustle |
| 6 | * @since 4.3.0 |
| 7 | */ |
| 8 | |
| 9 | $notice_class = 'sui-notice'; |
| 10 | $notice_alert = ( isset( $alert ) && ! empty( $alert ) ) ? $alert : false; |
| 11 | $notice_type = ( isset( $type ) && ! empty( $type ) ) ? $type : ''; |
| 12 | $notice_icon = ( isset( $icon ) && ! empty( $icon ) ) ? 'sui-icon-' . $icon : 'sui-icon-info'; |
| 13 | |
| 14 | switch ( $notice_type ) { |
| 15 | |
| 16 | case 'info': |
| 17 | case 'success': |
| 18 | case 'warning': |
| 19 | case 'error': |
| 20 | case 'upsell': |
| 21 | $notice_class .= ' sui-notice-' . esc_attr( $notice_type ); |
| 22 | break; |
| 23 | |
| 24 | case 'blue': |
| 25 | case 'green': |
| 26 | case 'yellow': |
| 27 | case 'red': |
| 28 | case 'purple': |
| 29 | $notice_class .= ' sui-notice-' . esc_attr( $notice_type ); |
| 30 | break; |
| 31 | |
| 32 | default: |
| 33 | $notice_class .= ''; |
| 34 | break; |
| 35 | } |
| 36 | |
| 37 | switch ( $notice_alert ) { |
| 38 | |
| 39 | case false: |
| 40 | echo '<div class="' . esc_attr( $notice_class ) . '"> |
| 41 | <div class="sui-notice-content"> |
| 42 | <div class="sui-notice-message"> |
| 43 | <span class="sui-notice-icon ' . esc_attr( $notice_icon ) . ' sui-md" aria-hidden="true"></span> |
| 44 | <p>' . esc_html( $message ) . '</p> |
| 45 | </div> |
| 46 | </div> |
| 47 | </div>'; |
| 48 | break; |
| 49 | |
| 50 | default: |
| 51 | echo '<div role="alert" id="' . esc_attr( $id ) . '" class="' . esc_attr( $notice_class ) . '" aria-live="assertive"></div>'; |
| 52 | break; |
| 53 | } |
| 54 |