| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin Notifications template. |
| 4 |
* |
| 5 |
* @since 1.8.3 |
| 6 |
* @version 1.8.12 |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
exit; |
| 11 |
} |
| 12 |
|
| 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' ); |
| 16 |
|
| 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 |
); |
| 29 |
|
| 30 |
?> |
| 31 |
|
| 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> |
| 59 |
|
| 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; ?> |
| 77 |
</div> |
| 78 |
</div> |
| 79 |
|
| 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; ?> |
| 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> |
| 148 |
</div> |
| 149 |
<div class="charitable-notifications-overlay"></div> |
| 150 |
</div> |
| 151 |
|