protected function isApplicablePage(array $notice): bool
    {
        $notice = $this->normalize($notice);

        if ($notice['for_page'] && $notice['for_page'][0] === '/') {
            // If it begins with a `/`, treat it as pure regex like `isMenuPage()` does.
            $applicable_pages = [$notice['for_page']]; // Delimiters not supported here.
        } else { // May contain WRegx, but `|` is not a reserved char, so this is OK.
            $applicable_pages = preg_split('/[|\s]+/u', $notice['for_page'], -1, PREG_SPLIT_NO_EMPTY);
            // e.g., `index.php|post.php`, `page-slug{-*,} || another-page-slug`, or `slug1{-*,} slug2`.
        }
        if ($notice['not_for_page'] && $notice['not_for_page'][0] === '/') {
            // If it begins with a `/`, treat it as pure regex like `isMenuPage()` does.
            $not_applicable_pages = [$notice['not_for_page']]; // Delimiters not supported here.
        } else { // May contain WRegx, but `|` is not a reserved char, so this is OK.
            $not_applicable_pages = preg_split('/[|\s]+/u', $notice['not_for_page'], -1, PREG_SPLIT_NO_EMPTY);
            // e.g., `index.php|post.php`, `page-slug{-*,} || another-page-slug`, or `slug1{-*,} slug2`.
        }
        foreach ($applicable_pages as $_applicable_page) {
            if ($this->s::isMenuPage($_applicable_page)) {
                $is_an_applicable_page = true;
                break; // Have what's needed here.
            } // In short, if any match current page.
        } // unset($_applicable_page); // Housekeeping.

        if ($applicable_pages && empty($is_an_applicable_page)) {
            return false; // Not an applicable page.
        }
        foreach ($not_applicable_pages as $_not_applicable_page) {
            if ($this->s::isMenuPage($_not_applicable_page)) {
                return false; // Not applicable.
            } // In short, if any match current page.
        } // unset($_not_applicable_page); // Housekeeping.

        return true; // Applicable page (default behavior).
    }
protected function isApplicablePage(array $notice): bool
    {
        $notice = $this->normalize($notice);

        if ($notice['for_page'] && $notice['for_page'][0] === '/') {
            // If it begins with a `/`, treat it as pure regex like `isMenuPage()` does.
            $applicable_pages = [$notice['for_page']]; // Delimiters not supported here.
        } else { // May contain WRegx, but `|` is not a reserved char, so this is OK.
            $applicable_pages = preg_split('/[|\s]+/u', $notice['for_page'], -1, PREG_SPLIT_NO_EMPTY);
            // e.g., `index.php|post.php`, `page-slug{-*,} || another-page-slug`, or `slug1{-*,} slug2`.
        }
        if ($notice['not_for_page'] && $notice['not_for_page'][0] === '/') {
            // If it begins with a `/`, treat it as pure regex like `isMenuPage()` does.
            $not_applicable_pages = [$notice['not_for_page']]; // Delimiters not supported here.
        } else { // May contain WRegx, but `|` is not a reserved char, so this is OK.
            $not_applicable_pages = preg_split('/[|\s]+/u', $notice['not_for_page'], -1, PREG_SPLIT_NO_EMPTY);
            // e.g., `index.php|post.php`, `page-slug{-*,} || another-page-slug`, or `slug1{-*,} slug2`.
        }
        foreach ($applicable_pages as $_applicable_page) {
            if ($this->s::isMenuPage($_applicable_page)) {
                $is_an_applicable_page = true;
                break; // Have what's needed here.
            } // In short, if any match current page.
        } // unset($_applicable_page); // Housekeeping.

        if ($applicable_pages && empty($is_an_applicable_page)) {
            return false; // Not an applicable page.
        }
        foreach ($not_applicable_pages as $_not_applicable_page) {
            if ($this->s::isMenuPage($_not_applicable_page)) {
                return false; // Not applicable.
            } // In short, if any match current page.
        } // unset($_not_applicable_page); // Housekeeping.

        return true; // Applicable page (default behavior).
    }
protected function isApplicablePage ( array $ notice ) : bool { $ notice = $ this -> normalize ( $ notice ) ; if ( $ notice [ 'for_page' ] && $ notice [ 'for_page' ] [ 0 ] === '/' ) { // If it begins with a `/`, treat it as pure regex like `isMenuPage()` does. $ applicable_pages = [ $ notice [ 'for_page' ] ] ; // Delimiters not supported here. } else { // May contain WRegx, but `|` is not a reserved char, so this is OK. $ applicable_pages = preg_split ( '/[|\s]+/u' , $ notice [ 'for_page' ] , - 1 , PREG_SPLIT_NO_EMPTY ) ; // e.g., `index.php|post.php`, `page-slug{-*,} || another-page-slug`, or `slug1{-*,} slug2`. } if ( $ notice [ 'not_for_page' ] && $ notice [ 'not_for_page' ] [ 0 ] === '/' ) { // If it begins with a `/`, treat it as pure regex like `isMenuPage()` does. $ not_applicable_pages = [ $ notice [ 'not_for_page' ] ] ; // Delimiters not supported here. } else { // May contain WRegx, but `|` is not a reserved char, so this is OK. $ not_applicable_pages = preg_split ( '/[|\s]+/u' , $ notice [ 'not_for_page' ] , - 1 , PREG_SPLIT_NO_EMPTY ) ; // e.g., `index.php|post.php`, `page-slug{-*,} || another-page-slug`, or `slug1{-*,} slug2`. } foreach ( $ applicable_pages as $ _applicable_page ) { if ( $ this -> s :: isMenuPage ( $ _applicable_page ) ) { $ is_an_applicable_page = true ; break ; // Have what's needed here. } // In short, if any match current page. } // unset($_applicable_page); // Housekeeping. if ( $ applicable_pages && empty ( $ is_an_applicable_page ) ) { return false ; // Not an applicable page. } foreach ( $ not_applicable_pages as $ _not_applicable_page ) { if ( $ this -> s :: isMenuPage ( $ _not_applicable_page ) ) { return false ; // Not applicable. } // In short, if any match current page. } // unset($_not_applicable_page); // Housekeeping. return true ; // Applicable page (default behavior). }
Is an applicable page?

@since 160715 Notice contexts.

@param array $notice Input notice.

@return bool True if an applicable page.
Is an applicable page?