function msan_display_admin_notices() { /*$notice_id = msan_insert_notice( array( 'message' => 'hello world!', )); var_dump( $notice_id );*/ $notices = msan_get_notices(); if ($notices) { $notice_handler = Multsite_Admin_Notice_Handler::get_instance(); foreach ($notices as $notice) { $notice_handler->add_notice($notice['id'], false, $notice['message']); } } }
function page_actions() { _msan_update_notices_cache(); wp_localize_script('msan-notice-manager', 'msan', array('notices' => array_values(msan_get_notices()), 'url' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('msan-manage-notices'))); wp_enqueue_script('msan-notice-manager'); wp_enqueue_style('msan-notice-manager'); ?> <script type="text/template" id="tmpl-msan-notice"> <div class="msan-notice-message"> <%- message %></div> <div class="msan-notice-toolbar"> <span class="msan-notice-updated"> <%- last_update %> </span> <% if( typeof id != 'undefined' ){ %><span class="msan-notice-id"> #<%- id %> </span><% } %> <a href="#" class="msan-delete-notice"><?php esc_html_e('Delete', 'multisite-admin-notices'); ?> </a> <a href="#" class="msan-edit-notice"><?php esc_html_e('Edit', 'multisite-admin-notices'); ?> </a> </div> </script> <script type="text/template" id="tmpl-msan-notice-edit"> <div class="msan-notice-message"> <textarea><%- message %></textarea> </div> <div class="msan-notice-toolbar"> <span class="msan-notice-updated"> <%- last_update %> </span> <% if( typeof id != 'undefined' ){ %><span class="msan-notice-id"> #<%- id %> </span><% } %> <a href="#" class="msan-cancel-update"><?php esc_html_e('Cancel', 'multisite-admin-notices'); ?> </a> <a href="#" class="msan-update-notice"><?php esc_html_e('Update', 'multisite-admin-notices'); ?> </a> </div> </script><?php }