diff --git a/CHANGELOG.md b/CHANGELOG.md index 00fc826f9..daf7990b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Changelog +## [4.1.1] (2026-11-25) + +### Changed +* Promotional banners now appear in a full-width bar above the plugin header, with a countdown to the end of the offer. +* Promotional banner text is now limited to links and basic formatting. + +### Fixed +* Fixed welcome and announcement banners no longer appearing on the plugin's admin screens, and dismissing a banner + only hiding it until the next page load. +* Fixed admin pages failing to load when a release date in the changelog could not be read. +* Fixed snippets that were deactivated or deleted while file-based execution was turned off running again once it was + turned back on, as the file index is now rebuilt from the active snippets. +* Fixed an `Undefined array key "condition_id"` warning on sites with a file index written by an earlier version. +* Fixed snippets no longer running with file-based execution after the site's security keys and salts change. +* Fixed saved settings not being read back correctly on sites with a persistent object cache. +* Fixed warnings on the Welcome screen when its content feed lists fewer than four articles or partners. +* Fixed the plugin failing to uninstall when Complete uninstall is enabled. +* Improved validation of the importer selected on the Import screen. Thanks to crow (via Wordfence) for responsibly + disclosing this issue. + ## [4.1.0] (2026-11-05) ### Added diff --git a/package-lock.json b/package-lock.json index 374dac049..478252581 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "code-snippets", - "version": "4.1.0", + "version": "4.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "code-snippets", - "version": "4.1.0", + "version": "4.1.1", "license": "GPL-2.0-or-later", "dependencies": { "@codemirror/fold": "^0.19.4", diff --git a/package.json b/package.json index ca6423d73..8af2c3555 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "code-snippets", "description": "Manage code snippets running on a WordPress-powered site through a graphical interface.", "homepage": "https://codesnippets.pro", - "version": "4.1.0", + "version": "4.1.1", "main": "src/dist/edit.js", "directories": { "test": "tests" diff --git a/src/code-snippets.php b/src/code-snippets.php index bff602991..1665fa7ba 100644 --- a/src/code-snippets.php +++ b/src/code-snippets.php @@ -8,11 +8,11 @@ * License: GPL-2.0-or-later * License URI: license.txt * Text Domain: code-snippets - * Version: 4.1.0 + * Version: 4.1.1 * Requires PHP: 7.4 * Requires at least: 5.5 * - * @version 4.1.0 + * @version 4.1.1 * @package Code_Snippets * @author Shea Bunge * @copyright 2012-2026 Code Snippets Pro @@ -37,7 +37,7 @@ * * @const string */ - define( 'CODE_SNIPPETS_VERSION', '4.1.0' ); + define( 'CODE_SNIPPETS_VERSION', '4.1.1' ); /** * The full path to the main file of this plugin. diff --git a/src/css/common/_promo-banner.scss b/src/css/common/_promo-banner.scss new file mode 100644 index 000000000..7a89aab17 --- /dev/null +++ b/src/css/common/_promo-banner.scss @@ -0,0 +1,138 @@ +.code-snippets-has-promo-banner { + --cs-promo-banner-block-size: 50px; +} + +.code-snippets-promo-banner { + --cs-promo-banner-background: #1d4a47; + --cs-promo-banner-grid: rgb(255 255 255 / 6%); + --cs-promo-banner-text: #fff; + --cs-promo-banner-text-muted: rgb(255 255 255 / 72%); + --cs-promo-banner-chip: rgb(255 255 255 / 12%); + --cs-promo-banner-label: #f0c24b; + --cs-promo-banner-action: var(--cs-color-secondary); + --cs-promo-banner-action-hover: #bd5c3b; + + position: relative; + display: flex; + flex: none; + align-items: center; + justify-content: center; + gap: 22px; + box-sizing: border-box; + min-block-size: 50px; + padding-block: 8px; + padding-inline: 56px; + color: var(--cs-promo-banner-text); + background-color: var(--cs-promo-banner-background); + background-image: + linear-gradient(var(--cs-promo-banner-grid) 1px, transparent 1px), + linear-gradient(90deg, var(--cs-promo-banner-grid) 1px, transparent 1px); + background-size: 18px 18px; + font-size: 15px; + line-height: 1.4; + white-space: nowrap; +} + +.code-snippets-promo-banner-label { + color: var(--cs-promo-banner-label); + font-size: 14px; + font-weight: 700; + letter-spacing: 0.12em; + text-transform: uppercase; +} + +.code-snippets-promo-banner-text { + min-inline-size: 0; + font-weight: 600; + white-space: normal; + + a { + color: inherit; + } +} + +.code-snippets-promo-banner-countdown { + display: flex; + gap: 6px; + + span { + padding-block: 3px; + padding-inline: 7px; + border-radius: 4px; + background: var(--cs-promo-banner-chip); + font-size: 13px; + font-weight: 600; + font-variant-numeric: tabular-nums; + } +} + +.code-snippets-promo-banner-action { + padding-block: 6px; + padding-inline: 14px; + border-radius: var(--cs-control-radius); + color: var(--cs-promo-banner-text); + background: var(--cs-promo-banner-action); + font-weight: 600; + text-decoration: none; + + &:hover, + &:focus { + color: var(--cs-promo-banner-text); + background: var(--cs-promo-banner-action-hover); + } +} + +.code-snippets-promo-banner-secondary { + padding-inline-start: 22px; + border-inline-start: 1px solid var(--cs-promo-banner-chip); + color: var(--cs-promo-banner-text-muted); + font-size: 14px; + + a { + color: var(--cs-promo-banner-text); + font-weight: 600; + } +} + +.code-snippets-promo-banner-dismiss { + position: absolute; + inset-inline-end: 16px; + display: flex; + color: var(--cs-promo-banner-text-muted); + text-decoration: none; + + &:hover, + &:focus { + color: var(--cs-promo-banner-text); + } +} + +.code-snippets-promo-banner a:focus-visible { + outline: 2px solid var(--cs-color-accent); + outline-offset: 2px; + box-shadow: none; +} + +@media (width <= 1280px) { + .code-snippets-promo-banner-secondary { + display: none; + } +} + +@media (width <= 960px) { + .code-snippets-promo-banner-countdown { + display: none; + } +} + +@media (width <= 600px) { + .code-snippets-promo-banner { + justify-content: flex-start; + gap: 12px; + padding-inline: 16px 48px; + } + + .code-snippets-promo-banner-label { + display: none; + } +} diff --git a/src/css/common/_theme.scss b/src/css/common/_theme.scss index 23d5de55e..2fa049df8 100644 --- a/src/css/common/_theme.scss +++ b/src/css/common/_theme.scss @@ -30,6 +30,7 @@ --cs-cloud-status-pro-verified-color: #41a269; --cs-tooltip-background-color: rgb(19 18 18 / 90%); --cs-toolbar-block-size: 136px; + --cs-promo-banner-block-size: 0px; --cs-wpcontent-inline-start-indent: 20px; --cs-sidebar-width: 320px; --cs-sidebar-gap: 30px; diff --git a/src/css/common/_toolbar.scss b/src/css/common/_toolbar.scss index 4c6da47ab..3fafa4678 100644 --- a/src/css/common/_toolbar.scss +++ b/src/css/common/_toolbar.scss @@ -1,8 +1,9 @@ +@use 'promo-banner'; @use 'upsell'; @use 'universal-search'; #wpbody { - padding-block-start: var(--cs-toolbar-block-size); + padding-block-start: calc(var(--cs-toolbar-block-size) + var(--cs-promo-banner-block-size)); } .code-snippets-toolbar { @@ -12,7 +13,7 @@ margin-inline-start: calc(-1 * var(--cs-wpcontent-inline-start-indent) - 2px); position: absolute; inline-size: calc(100% + var(--cs-wpcontent-inline-start-indent)); - block-size: var(--cs-toolbar-block-size); + block-size: calc(var(--cs-toolbar-block-size) + var(--cs-promo-banner-block-size)); inset-block-start: 0; display: flex; flex-direction: column; @@ -470,7 +471,7 @@ // padding the body rather than the page, so the toolbar has to clear it itself. @media (width <= 600px) { #wpbody { - padding-block-start: calc(var(--cs-toolbar-block-size) + 46px); + padding-block-start: calc(var(--cs-toolbar-block-size) + var(--cs-promo-banner-block-size) + 46px); } .code-snippets-toolbar { diff --git a/src/css/common/_upsell.scss b/src/css/common/_upsell.scss index 1746642bc..0bfaaa362 100644 --- a/src/css/common/_upsell.scss +++ b/src/css/common/_upsell.scss @@ -127,12 +127,12 @@ // Bleed the upsell to the full width of the admin content area and fill the // remaining viewport height, so it reads as a full page rather than a small // boxed card floating in the subpage. 168px accounts for the WP admin bar -// (32px) plus the plugin toolbar (136px). +// (32px) plus the plugin toolbar (136px), which grows by any promotional banner. .code-snippets-upsell-page { box-sizing: border-box; margin-inline-start: -22px; inline-size: calc(100% + 42px); - min-block-size: calc(100vh - 168px); + min-block-size: calc(100vh - 168px - var(--cs-promo-banner-block-size)); border-radius: 0; justify-content: center; } diff --git a/src/js/components/common/PromoBanner.tsx b/src/js/components/common/PromoBanner.tsx new file mode 100644 index 000000000..635430caa --- /dev/null +++ b/src/js/components/common/PromoBanner.tsx @@ -0,0 +1,141 @@ +import { __, _x, sprintf } from '@wordpress/i18n' +import React, { useEffect, useRef, useState } from 'react' +import { buildUrl } from '../../utils/urls' +import type { MouseEvent } from 'react' + +const BODY_CLASS = 'code-snippets-has-promo-banner' +const SIZE_PROPERTY = '--cs-promo-banner-block-size' + +const SECOND_MS = 1000 +const SECONDS_PER_MINUTE = 60 +const MINUTES_PER_HOUR = 60 +const HOURS_PER_DAY = 24 +const MINUTE_MS = SECONDS_PER_MINUTE * SECOND_MS +const HOUR_MS = MINUTES_PER_HOUR * MINUTE_MS +const DAY_MS = HOURS_PER_DAY * HOUR_MS +const UNIT_DIGITS = 2 + +const padUnit = (value: number): string => + String(value).padStart(UNIT_DIGITS, '0') + +interface PromoCountdownProps { + remaining: number +} + +const PromoCountdown: React.FC = ({ remaining }) => { + const units = { + // translators: %s: number of days left in the offer. + days: sprintf(_x('%sd', 'countdown days', 'code-snippets'), padUnit(Math.floor(remaining / DAY_MS))), + // translators: %s: number of hours left in the offer. + hours: sprintf(_x('%sh', 'countdown hours', 'code-snippets'), padUnit(Math.floor(remaining % DAY_MS / HOUR_MS))), + // translators: %s: number of minutes left in the offer. + minutes: sprintf(_x('%sm', 'countdown minutes', 'code-snippets'), padUnit(Math.floor(remaining % HOUR_MS / MINUTE_MS))), + // translators: %s: number of seconds left in the offer. + seconds: sprintf(_x('%ss', 'countdown seconds', 'code-snippets'), padUnit(Math.floor(remaining % MINUTE_MS / SECOND_MS))) + } + + return ( + + {Object.entries(units).map(([unit, text]) => {text})} + + ) +} + +const usePromoTimeLeft = (endsAtValue: string | null | undefined) => { + const endsAt = endsAtValue ? Date.parse(endsAtValue) : NaN + const hasEnd = Number.isFinite(endsAt) + + const [now, setNow] = useState(Date.now) + const isExpired = hasEnd && now >= endsAt + + useEffect(() => { + if (!hasEnd || isExpired) { + return undefined + } + + const timer = window.setInterval(() => setNow(Date.now()), SECOND_MS) + return () => window.clearInterval(timer) + }, [hasEnd, isExpired]) + + return { hasEnd, isExpired, remaining: endsAt - now } +} + +// The toolbar sits above the page content, which is pushed down by the banner's height. The server reserves an +// estimate through a body class; the banner then reports its real height, which grows when its text wraps, and +// gives the space back once it is no longer shown. +const useReservedSpace = (isShown: boolean) => { + const ref = useRef(null) + + useEffect(() => { + const banner = ref.current + + if (!isShown || !banner) { + document.body.classList.remove(BODY_CLASS) + return undefined + } + + const observer = new ResizeObserver(() => + document.body.style.setProperty(SIZE_PROPERTY, `${banner.offsetHeight}px`)) + + observer.observe(banner) + + return () => { + observer.disconnect() + document.body.style.removeProperty(SIZE_PROPERTY) + } + }, [isShown]) + + return ref +} + +export const PromoBanner = () => { + const promo = window.CODE_SNIPPETS_MANAGE?.promoBanner + const { hasEnd, isExpired, remaining } = usePromoTimeLeft(promo?.endsAt) + const ref = useReservedSpace(!!promo && !isExpired) + + if (!promo || isExpired) { + return null + } + + // The screen rewrites its own query string as people filter and page through it, so the dismissal + // returns them to where they are now rather than to the address the page was first loaded with. + const dismiss = (event: MouseEvent) => { + event.preventDefault() + window.location.assign(buildUrl(window.location.href, promo.dismissArgs)) + } + + return ( +
+ {'' !== promo.label && {promo.label}} + + {/* The server limits the feed text to post HTML before it reaches the page. */} + + + {hasEnd && } + + {'' !== promo.actionUrl && '' !== promo.actionLabel && ( + + {promo.actionLabel} + + )} + + {'' !== promo.secondary && ( + + )} + + + + {__('Dismiss', 'code-snippets')} + +
+ ) +} diff --git a/src/js/components/common/Toolbar.tsx b/src/js/components/common/Toolbar.tsx index 7b08ed788..d500b378f 100644 --- a/src/js/components/common/Toolbar.tsx +++ b/src/js/components/common/Toolbar.tsx @@ -13,6 +13,7 @@ import { SearchIcon } from './icons/SearchIcon' import { SettingsIcon } from './icons/SettingsIcon' import { SnippetsIcon } from './icons/SnippetsIcon' import { UnifiedSnippetsIcon } from './icons/UnifiedSnippetsIcon' +import { PromoBanner } from './PromoBanner' import { UniversalSearch } from './UniversalSearch/UniversalSearch' import { UpsellDialog } from './UpsellDialog' import type { SVGProps } from 'react' @@ -244,6 +245,7 @@ const LowerNav = () => export const Toolbar = () =>
+
diff --git a/src/js/types/Window.ts b/src/js/types/Window.ts index 85f612aeb..4dc01b02b 100644 --- a/src/js/types/Window.ts +++ b/src/js/types/Window.ts @@ -101,6 +101,17 @@ declare global { siteName: string homeUrl: string } + promoBanner?: { + key: string + label: string + text: string + secondary: string + actionUrl: string + actionLabel: string + endsAt: string | null + dismissUrl: string + dismissArgs: Record + } } readonly CODE_SNIPPETS_EDIT?: { snippet: SnippetSchema diff --git a/src/php/Admin/Bootstrap_Admin.php b/src/php/Admin/Bootstrap_Admin.php index c6ed9b965..b8875ca4e 100644 --- a/src/php/Admin/Bootstrap_Admin.php +++ b/src/php/Admin/Bootstrap_Admin.php @@ -10,9 +10,9 @@ use Code_Snippets\Admin\Menus\Settings_Menu; use Code_Snippets\Admin\Menus\Welcome_Menu; use Code_Snippets\Client\Welcome_Client; +use Code_Snippets\Utils\System_Info; use DateTimeImmutable; use DateTimeZone; -use Exception; use function Code_Snippets\code_snippets; use function Code_Snippets\get_snippets; use function Code_Snippets\Settings\are_settings_unified; @@ -25,6 +25,20 @@ */ class Bootstrap_Admin { + /** + * User meta key listing the notices each user has dismissed. + * + * @var string + */ + private const DISMISSED_NOTICES_META_KEY = 'ignore_code_snippets_survey_message'; + + /** + * Notice style that is rendered as the promotional banner above the plugin toolbar. + * + * @var string + */ + private const PROMO_BANNER_STYLE = 'promo'; + /** * Admin_Menu class instances * @@ -57,6 +71,7 @@ public function __construct() { add_filter( 'plugin_action_links_' . plugin_basename( PLUGIN_FILE ), array( $this, 'plugin_action_links' ), 10, 2 ); add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); add_filter( 'debug_information', array( $this, 'debug_information' ) ); + add_action( 'admin_init', array( $this, 'handle_notice_dismissal' ) ); add_action( 'code_snippets/admin/manage', array( $this, 'print_notices' ) ); } @@ -266,68 +281,221 @@ public function debug_information( array $info ): array { } /** - * Print any admin notices that have not been dismissed. + * Record the dismissal of a notice for the current user, then return to the page without the dismissal parameters. * * @return void - * @noinspection PhpRedundantOptionalArgumentInspection */ - public function print_notices() { - global $current_user; + public function handle_notice_dismissal() { + $meta_key = self::DISMISSED_NOTICES_META_KEY; - if ( apply_filters( 'code_snippets/hide_welcome_banner', false ) ) { + if ( ! isset( $_GET[ $meta_key ], $_REQUEST['_wpnonce'] ) || + ! wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), $meta_key ) || + ! code_snippets()->current_user_can() ) { return; } - $meta_key = 'ignore_code_snippets_survey_message'; - $dismissed = get_user_meta( $current_user->ID, $meta_key, false ); + add_user_meta( get_current_user_id(), $meta_key, sanitize_key( wp_unslash( $_GET[ $meta_key ] ) ) ); - if ( isset( $_GET[ $meta_key ], $_REQUEST['_wpnonce'] ) && wp_verify_nonce( sanitize_key( $_REQUEST['_wpnonce'] ), $meta_key ) ) { - add_user_meta( $current_user->ID, $meta_key, sanitize_key( wp_unslash( $_GET[ $meta_key ] ) ) ); - return; - } + wp_safe_redirect( remove_query_arg( [ $meta_key, '_wpnonce' ] ) ); + exit; + } - $welcome = $this->welcome_client->get_banner(); + /** + * Build the query arguments that dismiss a notice for the current user. + * + * @param string $notice Notice key. + * + * @return array + */ + private function get_notice_dismiss_args( string $notice ): array { + return [ + self::DISMISSED_NOTICES_META_KEY => $notice, + '_wpnonce' => wp_create_nonce( self::DISMISSED_NOTICES_META_KEY ), + ]; + } + + /** + * Build the URL that dismisses a notice for the current user. + * + * @param string $notice Notice key. + * + * @return string Unescaped URL. + */ + private function get_notice_dismiss_url( string $notice ): string { + return add_query_arg( $this->get_notice_dismiss_args( $notice ) ); + } - try { - $now = new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) ); - } catch ( Exception $e ) { - $now = $welcome['start_datetime']; + /** + * Determine which notice, if any, should be shown to the current user. + * + * A banner from the remote welcome feed is shown as the promotional banner while it is scheduled and has not been + * dismissed, using its short headline when the feed provides one and its full text otherwise. Otherwise, the + * survey notice is shown until it is dismissed. + * + * @param DateTimeImmutable|null $now Current time. Defaults to now. + * + * @return array{ + * key: string, + * style: string, + * label: string, + * text: string, + * secondary: string, + * action_url: string, + * action_label: string, + * end_datetime: ?DateTimeImmutable + * }|null + */ + public function get_active_notice( ?DateTimeImmutable $now = null ): ?array { + if ( apply_filters( 'code_snippets/hide_welcome_banner', false ) ) { + return null; } + $now = $now ?? new DateTimeImmutable( 'now', new DateTimeZone( 'UTC' ) ); + $dismissed = get_user_meta( get_current_user_id(), self::DISMISSED_NOTICES_META_KEY, false ); + $welcome = $this->welcome_client->get_banner(); + if ( ! empty( $welcome['key'] ) && ! in_array( $welcome['key'], $dismissed, true ) && ( empty( $welcome['start_datetime'] ) || $now >= $welcome['start_datetime'] ) && ( empty( $welcome['end_datetime'] ) || $now <= $welcome['end_datetime'] ) ) { - $notice = $welcome['key']; + return [ + 'key' => $welcome['key'], + 'style' => self::PROMO_BANNER_STYLE, + 'label' => $welcome['label'] ?? '', + 'text' => '' === ( $welcome['headline_free'] ?? '' ) ? ( $welcome['text_free'] ?? '' ) : $welcome['headline_free'], + 'secondary' => $welcome['secondary_free'] ?? '', + 'action_url' => $welcome['action_url_free'] ?? '', + 'action_label' => $welcome['action_label_free'] ?? '', + 'end_datetime' => $welcome['end_datetime'] ?? null, + ]; + } - $text = $welcome['text_free']; - $action_url = $welcome['action_url_free']; - $action_label = $welcome['action_label_free']; + if ( ! in_array( 'survey', $dismissed, true ) && ! in_array( 'true', $dismissed, true ) ) { + return [ + 'key' => 'survey', + 'style' => '', + 'label' => '', + 'text' => __( "Have feedback on Code Snippets? Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future.", 'code-snippets' ), + 'secondary' => '', + 'action_url' => 'https://codesnippets.pro/survey/', + 'action_label' => __( 'Take the survey now', 'code-snippets' ), + 'end_datetime' => null, + ]; + } - } elseif ( ! in_array( 'survey', $dismissed, true ) && ! in_array( 'true', $dismissed, true ) ) { - $notice = 'survey'; - $action_url = 'https://codesnippets.pro/survey/'; - $action_label = __( 'Take the survey now', 'code-snippets' ); - $text = __( "Have feedback on Code Snippets? Please take the time to answer a short survey on how you use this plugin and what you'd like to see changed or added in the future.", 'code-snippets' ); - } else { + return null; + } + + /** + * Add the details the store uses to tailor an offer to an action URL from the welcome feed. + * + * @param string $url Action URL from the feed. + * + * @return string Unescaped URL, or an empty string when the feed provides none. + */ + private function add_offer_query_args( string $url ): string { + if ( '' === $url ) { + return ''; + } + + return add_query_arg( + [ + 'cs_user' => code_snippets()->licensing->is_licensed() ? 'existing' : 'new', + 'plugin' => 'pro' === System_Info::get_edition() ? 'cs_pro' : 'cs_core', + ], + $url + ); + } + + /** + * Limit remote banner HTML to links and basic emphasis, with links opening safely in a new tab. + * + * @param string $html Banner HTML from the welcome feed. + * + * @return string Sanitized HTML. + */ + private static function kses_promo_html( string $html ): string { + $allowed_html = [ + 'a' => [ 'href' => true ], + 'strong' => [], + 'em' => [], + 'br' => [], + ]; + + return preg_replace( + '//', + '', + wp_kses( $html, $allowed_html, [ 'https' ] ) + ); + } + + /** + * Retrieve the active promotional banner, prepared for the manage screen script. + * + * Only welcome feed banners are returned; the survey notice keeps the standard notice markup printed by + * print_notices(). + * + * @param DateTimeImmutable|null $now Current time. Defaults to now. + * + * @return array{ + * key: string, + * label: string, + * text: string, + * secondary: string, + * actionUrl: string, + * actionLabel: string, + * endsAt: ?string, + * dismissUrl: string, + * dismissArgs: array + * }|null + */ + public function get_promo_banner( ?DateTimeImmutable $now = null ): ?array { + $notice = $this->get_active_notice( $now ); + + if ( ! $notice || self::PROMO_BANNER_STYLE !== $notice['style'] ) { + return null; + } + + return [ + 'key' => $notice['key'], + 'label' => sanitize_text_field( $notice['label'] ), + 'text' => self::kses_promo_html( $notice['text'] ), + 'secondary' => self::kses_promo_html( $notice['secondary'] ), + 'actionUrl' => esc_url_raw( $this->add_offer_query_args( $notice['action_url'] ) ), + 'actionLabel' => sanitize_text_field( $notice['action_label'] ), + 'endsAt' => $notice['end_datetime'] ? $notice['end_datetime']->format( DATE_ATOM ) : null, + 'dismissUrl' => esc_url_raw( $this->get_notice_dismiss_url( $notice['key'] ) ), + 'dismissArgs' => $this->get_notice_dismiss_args( $notice['key'] ), + ]; + } + + /** + * Print the active notice, unless it is a promotional banner, which the manage screen script renders instead. + * + * @return void + */ + public function print_notices() { + $notice = $this->get_active_notice(); + + if ( ! $notice || self::PROMO_BANNER_STYLE === $notice['style'] ) { return; } printf( '