: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Functions for Admin Conditionals
* @copyright Copyright (c) 2023, Code Atlantic LLC
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
* Determines whether the current page is an popup maker admin page.
function pum_is_admin_page() {
if ( ! is_admin() || ! did_action( 'wp_loaded' ) ) {
$typenow = pum_typenow();
'popup_theme' === $typenow,
! empty( $GLOBALS['hook_suffix'] ) && in_array( $GLOBALS['hook_suffix'], PUM_Admin_Pages::$pages ),
return in_array( true, $tests );
* Determines whether the current admin page is the All Popups page.
* @return bool True if current page is All Popups page.
function pum_is_all_popups_page() {
$screen = get_current_screen();
'edit-popup' === $screen->id,
pum_typenow() === 'popup',
return ! in_array( false, $tests, true );
* Determines whether the current admin page is the popup editor.
function pum_is_popup_editor() {
'popup' === pum_typenow(),
in_array( $pagenow, [ 'post-new.php', 'post.php' ] ),
return ! in_array( false, $tests );
* Determines whether the current admin page is the popup theme editor.
function pum_is_popup_theme_editor() {
'popup_theme' === pum_typenow(),
in_array( $pagenow, [ 'post-new.php', 'post.php' ] ),
return ! in_array( false, $tests );
* Determines whether the current admin page is the extensions page.
* @param null|string $key
function pum_is_submenu_page( $key = null ) {
! pum_is_popup_theme_editor(),
$key && ! empty( $GLOBALS['hook_suffix'] ) ? PUM_Admin_Pages::get_page( $key ) === $GLOBALS['hook_suffix'] : true,
! isset( $key ) && ! empty( $GLOBALS['hook_suffix'] ) ? in_array( $GLOBALS['hook_suffix'], PUM_Admin_Pages::$pages ) : true,
return ! in_array( false, $tests );
* Determines whether the current admin page is the subscriptions page.
function pum_is_subscriptions_page() {
return pum_is_submenu_page( 'subscriptions' );
* Determines whether the current admin page is the extensions page.
function pum_is_extensions_page() {
return pum_is_submenu_page( 'extensions' );
* Determines whether the current admin page is the settings page.
function pum_is_settings_page() {
return pum_is_submenu_page( 'settings' );
* Determines whether the current admin page is the tools page.
function pum_is_tools_page() {
return pum_is_submenu_page( 'tools' );
* Determines whether the current admin page is the support page.
function pum_is_support_page() {
return pum_is_submenu_page( 'support' );