/**
     * @param WP_Notice $notice
     * @param string    $unqId
     *
     * @return string
     * @author Panagiotis Vagenas <*****@*****.**>
     * @since  TODO ${VERSION}
     */
    protected function dismissibleScript(WP_Notice $notice, $unqId)
    {
        return '
		<script type="text/javascript">
			jQuery(document).ready(function ($) {
				var data = {
					"action": "' . WP_Admin_Notices::KILL_STICKY_NTC_AJAX_ACTION . '",
					"' . WP_Admin_Notices::KILL_STICKY_NTC_AJAX_NTC_ID_VAR . '": "' . $notice->getId() . '",
					"' . WP_Admin_Notices::KILL_STICKY_NTC_AJAX_NONCE_VAR . '": "' . wp_create_nonce(WP_Admin_Notices::KILL_STICKY_NTC_AJAX_ACTION) . '"
				};

				var $notice = $("#' . $unqId . '").parent().parent();
				$("#' . $unqId . '").click(function(){
					jQuery.post(ajaxurl, data,
						function(){
							$notice.slideUp();
						}
					);
				});
			});
		</script>
		';
    }
Esempio n. 2
0
 /**
  * @param WP_Notice $notice
  *
  * @return string
  * @author Panagiotis Vagenas <*****@*****.**>
  * @since  2.0.0
  */
 public function formatOutput(WP_Notice $notice)
 {
     $out = "\n\t\t<div style=\"position: relative;\" class=\"{$notice->getType()}\">\n\t\t\t<h4 style=\"margin-top: 4px; margin-bottom: 0;\">{$notice->getTitle()}</h4>\n\t\t\t<p>\n\t\t\t\t{$notice->getContent()}\n\t\t\t</p>\n\t\t</div>\n\t\t";
     return $out;
 }