| @@ -1,11 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Admin Notifications template. |
| 4 | 4 | * |
| 5 | - * @since 1.7.0.3 | |
| 6 | - * | |
| 7 | - * @var array $notifications | |
| 5 | + * @since 1.8.3 | |
| 6 | + * @version 1.8.12 | |
| 8 | 7 | */ |
| 9 | 8 | |
| 10 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 10 | exit; |
| @@ -10,44 +9,142 @@ | ||
| 10 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 10 | exit; |
| 12 | 11 | } |
| 13 | 12 | |
| 14 | -?> | |
| 15 | -<div id="charitable-notifications"> | |
| 16 | - <div class="charitable-notifications-header"> | |
| 17 | - <div class="charitable-notifications-bell"> | |
| 18 | - <svg xmlns="http://www.w3.org/2000/svg" width="15" height="17" fill="none"> | |
| 19 | - <path fill="#777" d="M7.68 16.56c1.14 0 2.04-.95 2.04-2.17h-4.1c0 1.22.9 2.17 2.06 2.17Zm6.96-5.06c-.62-.71-1.81-1.76-1.81-5.26A5.32 5.32 0 0 0 8.69.97H6.65A5.32 5.32 0 0 0 2.5 6.24c0 3.5-1.2 4.55-1.81 5.26a.9.9 0 0 0-.26.72c0 .57.39 1.08 1.04 1.08h12.38c.65 0 1.04-.5 1.07-1.08 0-.24-.1-.51-.3-.72Z"/> | |
| 20 | - </svg> | |
| 21 | - <span class="wp-ui-notification charitable-notifications-circle"></span> | |
| 22 | - </div> | |
| 23 | - <div class="charitable-notifications-title"><?php esc_html_e( 'Notifications', 'charitable-lite' ); ?></div> | |
| 24 | - </div> | |
| 13 | +$charitable_active_count = intval( $args['notifications']['active_count'] ); | |
| 14 | +$charitable_dismissed_count = intval( $args['notifications']['dismissed_count'] ); | |
| 15 | +$charitable_notifications_title = esc_html__( 'Notifications', 'charitable' ); | |
| 25 | 16 | |
| 26 | - <div class="charitable-notifications-body"> | |
| 17 | +$charitable_notif_settings = class_exists( 'Charitable_Notification_Settings' ) ? Charitable_Notification_Settings::get_instance()->get_settings() : array(); | |
| 18 | +$charitable_notif_settings_json = wp_json_encode( $charitable_notif_settings ); | |
| 19 | +$charitable_notif_categories = array( | |
| 20 | + 'license' => __( 'License & Account', 'charitable' ), | |
| 21 | + 'lifecycle' => __( 'Campaign Lifecycle', 'charitable' ), | |
| 22 | + 'milestone' => __( 'Milestones', 'charitable' ), | |
| 23 | + 'health' => __( 'Health & Data Alerts', 'charitable' ), | |
| 24 | + 'legal' => __( 'Legal & Compliance', 'charitable' ), | |
| 25 | + 'nudge' => __( 'Engagement Nudges', 'charitable' ), | |
| 26 | + 'new_feed' => __( 'Announcements', 'charitable' ), | |
| 27 | + 'legacy_feed' => __( 'News & Updates', 'charitable' ), | |
| 28 | +); | |
| 27 | 29 | |
| 28 | - <button type="button" class="notice-dismiss dismiss"> | |
| 29 | - <span class="screen-reader-text"> | |
| 30 | - Dismiss this notice | |
| 31 | - </span> | |
| 32 | - </button> | |
| 30 | +?> | |
| 33 | 31 | |
| 34 | - <?php /* <a class="dismiss" title="<?php esc_attr_e( 'Dismiss this message', 'charitable-lite' ); ?>"><i class="fa fa-times-circle" aria-hidden="true"></i></a> */ ?> | |
| 32 | +<div class="charitable-plugin-notifications" id="charitable-plugin-notifications"> | |
| 33 | + <div class="notification-menu"> | |
| 34 | + <div class="notification-header"> | |
| 35 | + <span class="new-notifications notifications-visible"> | |
| 36 | + <?php echo esc_html( $charitable_notifications_title ); ?> | |
| 37 | + <span id="new-notifications-count" class="notif-count-pill"><?php echo intval( $charitable_active_count ); ?></span> | |
| 38 | + </span> | |
| 39 | + <span class="old-notifications"> | |
| 40 | + (<span id="dismissed-notifications-count"><strong><?php echo intval( $charitable_dismissed_count ); ?></strong></span>) | |
| 41 | + <?php esc_attr_e( 'Dismissed Notifications', 'charitable' ); ?> | |
| 42 | + </span> | |
| 43 | + <div class="dismissed-notifications"> | |
| 44 | + <a href="#" data-status="dismissed"><?php esc_attr_e( 'Dismissed Notifications', 'charitable' ); ?></a> | |
| 45 | + </div> | |
| 46 | + <div class="notification-header-actions"> | |
| 47 | + <button class="charitable-notif-gear-btn" id="charitable-notif-gear-btn" title="<?php esc_attr_e( 'Notification Settings', 'charitable' ); ?>" aria-expanded="false"> | |
| 48 | + <svg viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" width="16" height="16"> | |
| 49 | + <path fill-rule="evenodd" clip-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z"/> | |
| 50 | + </svg> | |
| 51 | + </button> | |
| 52 | + <button class="charitable-notif-close-btn" aria-label="<?php esc_attr_e( 'Close notifications', 'charitable' ); ?>"> | |
| 53 | + <svg viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg" class="charitable-close" width="12" height="12"> | |
| 54 | + <path d="M11.8211 1.3415L10.6451 0.166504L5.98305 4.82484L1.32097 0.166504L0.14502 1.3415L4.80711 5.99984L0.14502 10.6582L1.32097 11.8332L5.98305 7.17484L10.6451 11.8332L11.8211 10.6582L7.159 5.99984L11.8211 1.3415Z" fill="currentColor"/> | |
| 55 | + </svg> | |
| 56 | + </button> | |
| 57 | + </div> | |
| 58 | + </div> | |
| 35 | 59 | |
| 36 | - <?php if ( (int) $notifications['count'] > 1 ) : ?> | |
| 37 | - <div class="navigation"> | |
| 38 | - <a class="prev"> | |
| 39 | - <span class="screen-reader-text"><?php esc_attr_e( 'Previous message', 'charitable-lite' ); ?></span> | |
| 40 | - <span aria-hidden="true">‹</span> | |
| 41 | - </a> | |
| 42 | - <a class="next"> | |
| 43 | - <span class="screen-reader-text"><?php esc_attr_e( 'Next message', 'charitable-lite' ); ?></span> | |
| 44 | - <span aria-hidden="true">›</span> | |
| 45 | - </a> | |
| 60 | + <div class="charitable-notif-settings-panel" id="charitable-notif-settings-panel" style="display:none;" data-settings="<?php echo esc_attr( $charitable_notif_settings_json ); ?>"> | |
| 61 | + <p class="charitable-notif-settings-label"><?php esc_html_e( 'Show notification types:', 'charitable' ); ?></p> | |
| 62 | + <div class="charitable-notif-toggle-grid"> | |
| 63 | + <?php foreach ( $charitable_notif_categories as $charitable_cat_key => $charitable_cat_label ) : ?> | |
| 64 | + <label class="charitable-notif-toggle-row"> | |
| 65 | + <span class="charitable-notif-toggle"> | |
| 66 | + <input | |
| 67 | + type="checkbox" | |
| 68 | + name="notif_setting_<?php echo esc_attr( $charitable_cat_key ); ?>" | |
| 69 | + data-category="<?php echo esc_attr( $charitable_cat_key ); ?>" | |
| 70 | + <?php checked( isset( $charitable_notif_settings[ $charitable_cat_key ] ) ? $charitable_notif_settings[ $charitable_cat_key ] : true, true ); ?> | |
| 71 | + > | |
| 72 | + <span class="charitable-notif-toggle-slider"></span> | |
| 73 | + </span> | |
| 74 | + <span class="charitable-notif-toggle-label"><?php echo wp_kses_post( $charitable_cat_label ); ?></span> | |
| 75 | + </label> | |
| 76 | + <?php endforeach; ?> | |
| 46 | 77 | </div> |
| 47 | - <?php endif; ?> | |
| 78 | + </div> | |
| 48 | 79 | |
| 49 | - <div class="charitable-notifications-messages"> | |
| 50 | - <?php echo $notifications['html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 80 | + <div class="charitable-notification-cards notification-cards notification-cards-active notification-cards-visible"> | |
| 81 | + <?php if ( empty( $args['notifications']['active_html'] ) ) : ?> | |
| 82 | + <div aria-expanded="true" class="charitable-notification charitable-notification-intro current"> | |
| 83 | + <div class="charitable-notification-card-inner"> | |
| 84 | + <div class="notif-left"> | |
| 85 | + <div class="icon"> | |
| 86 | + <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="charitable-icon-intro" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> | |
| 87 | + <path d="M18 16v-5a6 6 0 1 0-12 0v5l-1.7 1.7a1 1 0 0 0 .7 1.7h14a1 1 0 0 0 .7-1.7L18 16z"/> | |
| 88 | + <path d="M10 20a2 2 0 0 0 4 0"/> | |
| 89 | + </svg> | |
| 90 | + </div> | |
| 91 | + </div> | |
| 92 | + <div class="body"> | |
| 93 | + <h4><?php esc_html_e( 'Welcome to your notifications center', 'charitable' ); ?></h4> | |
| 94 | + <div class="notification-content"> | |
| 95 | + <?php | |
| 96 | + $charitable_inline_gear = '<svg class="charitable-notif-inline-gear" viewBox="0 0 20 20" fill="currentColor" xmlns="http://www.w3.org/2000/svg" width="12" height="12" aria-hidden="true"><path fill-rule="evenodd" clip-rule="evenodd" d="M11.49 3.17c-.38-1.56-2.6-1.56-2.98 0a1.532 1.532 0 01-2.286.948c-1.372-.836-2.942.734-2.106 2.106.54.886.061 2.042-.947 2.287-1.561.379-1.561 2.6 0 2.978a1.532 1.532 0 01.947 2.287c-.836 1.372.734 2.942 2.106 2.106a1.532 1.532 0 012.287.947c.379 1.561 2.6 1.561 2.978 0a1.533 1.533 0 012.287-.947c1.372.836 2.942-.734 2.106-2.106a1.533 1.533 0 01.947-2.287c1.561-.379 1.561-2.6 0-2.978a1.532 1.532 0 01-.947-2.287c.836-1.372-.734-2.942-2.106-2.106a1.532 1.532 0 01-2.287-.947zM10 13a3 3 0 100-6 3 3 0 000 6z"/></svg>'; | |
| 97 | + printf( | |
| 98 | + '<p>%s</p>', | |
| 99 | + sprintf( | |
| 100 | + /* translators: %s: inline gear icon */ | |
| 101 | + esc_html__( 'Product announcements, campaign milestones, license status, and action items will appear here as they happen. Use the %s gear icon above to choose which categories you want to see.', 'charitable' ), | |
| 102 | + $charitable_inline_gear // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 103 | + ) | |
| 104 | + ); | |
| 105 | + ?> | |
| 106 | + </div> | |
| 107 | + </div> | |
| 108 | + </div> | |
| 109 | + </div> | |
| 110 | + <div aria-expanded="true" class="charitable-notification charitable-notification-empty current"> | |
| 111 | + <div class="charitable-notification-card-inner"> | |
| 112 | + <div class="notif-left"> | |
| 113 | + <div class="icon"> | |
| 114 | + <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" class="charitable-icon-empty" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"> | |
| 115 | + <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"/> | |
| 116 | + <polyline points="22 4 12 14.01 9 11.01"/> | |
| 117 | + </svg> | |
| 118 | + </div> | |
| 119 | + </div> | |
| 120 | + <div class="body"> | |
| 121 | + <h4><?php esc_html_e( "You're all caught up!", 'charitable' ); ?></h4> | |
| 122 | + <div class="notification-content"> | |
| 123 | + <p><?php esc_html_e( 'New notifications will appear here when they arrive.', 'charitable' ); ?></p> | |
| 124 | + </div> | |
| 125 | + </div> | |
| 126 | + </div> | |
| 127 | + </div> | |
| 128 | + <?php else : ?> | |
| 129 | + <?php echo $args['notifications']['active_html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 130 | + <?php endif; ?> | |
| 51 | 131 | </div> |
| 132 | + <div class="charitable-notification-cards notification-cards notification-cards-dismissed"> | |
| 133 | + <?php if ( empty( $args['notifications']['dismissed_html'] ) ) : ?> | |
| 134 | + <div class="notification-card"> | |
| 135 | + <div class="notification-card-content"> | |
| 136 | + <span class="notification-no-dismissed-title"><?php esc_attr_e( 'No dismissed notifications.', 'charitable' ); ?></span> | |
| 137 | + </div> | |
| 138 | + </div> | |
| 139 | + <?php else : ?> | |
| 140 | + <?php echo $args['notifications']['dismissed_html']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> | |
| 141 | + <?php endif; ?> | |
| 142 | + </div> | |
| 143 | + <div class="notification-footer"> | |
| 144 | + <?php if ( $charitable_active_count > 0 ) : ?> | |
| 145 | + <div class="dismiss-all"><a href="#" class="dismiss"><?php esc_attr_e( 'Dismiss All', 'charitable' ); ?></a></div> | |
| 146 | + <?php endif; ?> | |
| 147 | + </div> | |
| 52 | 148 | </div> |
| 149 | + <div class="charitable-notifications-overlay"></div> | |
| 53 | 150 | </div> |