allowed_actions = $allowed_actions; add_action( 'wp_ajax_sk_dismiss_warning', array( $this, 'notice_dismiss' ) ); } /** * Check if we are on the right page */ function is_url( $url_part = '' ) { if ( !isset( $_SERVER ) || !isset( $_SERVER['REQUEST_URI'] ) ) { return false; } if ( strpos( $_SERVER['REQUEST_URI'], $url_part ) !== false ) { return true; } return false; } /** * Add this message to the $this->notices array */ function add_notice($id, $message, $class = '') { if ( get_option($id) != false ) return false; $notice = array( 'id' => $id, 'message' => $message, ); if ( !empty($class) ) $notice['class'] = $class; $this->notices[] = $notice; } function show_warnings() { add_action( 'admin_notices', array($this, 'show_admin_notice') ); } /** * Show the admin notices * */ function show_admin_notice() { if ( !is_array($this->notices) || count($this->notices) == 0 ) return; foreach( $this->notices as $_n ) { $nonce = wp_create_nonce( $_n['id'] ); if ( !isset($_n['class'])) $_n['class'] = 'notice notice-warning is-dismissible'; $_n['class'] .= ' sk-notice-dismiss'; printf( '
%4$s