admin_notices( self::$notices ); } /** * Dismisses admin notice * * @access public */ public function dismiss() { $this->dismiss_admin_notice(); } /** * Sets an admin notice for display. * * @param array $data Notice data. */ public static function set_notice( array $data ) { $type = null; $msg = null; $id = null; $dismiss = null; // phpcs:ignore WordPress.PHP.DontExtract extract( $data ); self::$notices[ $parent->args['page_slug'] ][] = array( 'type' => $type, 'msg' => $msg, 'id' => $id . '_' . $parent->args['opt_name'], 'dismiss' => $dismiss, 'color' => $color ?? '#00A2E3', ); } /** * Evaluates a user-dismissed option for displaying admin notices. * * @param array $notices Array of stored notices to display. * * @return void * @since 3.2.0 * @access public */ public function admin_notices( array $notices = array() ) { global $current_user; $core = $this->core(); if ( isset( $_GET['page'] ) && $core->args['page_slug'] === $_GET['page'] ) { // phpcs:ignore WordPress.Security.NonceVerification do_action( 'redux_admin_notices_run', $core->args ); // Check for an active admin notice array. if ( ! empty( $notices ) ) { if ( isset( $notices[ $core->args['page_slug'] ] ) ) { // Enum admin notices. foreach ( $notices[ $core->args['page_slug'] ] as $notice ) { $add_style = ''; if ( strpos( $notice['type'], 'redux-message' ) !== false ) { $add_style = 'style="border-left: 4px solid ' . esc_attr( $notice['color'] ) . '!important;"'; } if ( true === $notice['dismiss'] ) { // Get user ID. $userid = $current_user->ID; if ( ! get_user_meta( $userid, 'ignore_' . $notice['id'] ) ) { global $wp_version; $css_id = ''; // Print the notice with the dismiss link. if ( version_compare( $wp_version, '4.2', '>' ) ) { $css_id = esc_attr( $notice['id'] ); $css_class = esc_attr( $notice['type'] ) . ' redux-notice notice is-dismissible redux-notice'; $nonce = wp_create_nonce( $notice['id'] . $userid . 'nonce' ); echo '
' . wp_kses_post( $notice['msg'] ) . '
'; echo '' . wp_kses_post( $notice['msg'] ) . ' ' . esc_html__( 'Dismiss', 'redux-framework' ) . '.
' . wp_kses_post( $notice['msg'] ) . '.