: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
'responsive_min_width' => 'responsive_min_width',
'responsive_min_width_unit' => 'responsive_min_width_unit',
'responsive_max_width' => 'responsive_max_width',
'responsive_max_width_unit' => 'responsive_max_width_unit',
'custom_width' => 'custom_width',
'custom_width_unit' => 'custom_width_unit',
'custom_height' => 'custom_height',
'custom_height_unit' => 'custom_height_unit',
'custom_height_auto' => 'custom_height_auto',
'location' => 'location',
'position_from_trigger' => 'position_from_trigger',
'position_top' => 'position_top',
'position_left' => 'position_left',
'position_bottom' => 'position_bottom',
'position_right' => 'position_right',
'position_fixed' => 'position_fixed',
'animation_type' => 'animation_type',
'animation_speed' => 'animation_speed',
'animation_origin' => 'animation_origin',
'overlay_zindex' => 'overlay_zindex',
'button_delay' => 'close_button_delay',
'overlay_click' => 'close_on_overlay_click',
'esc_press' => 'close_on_esc_press',
'f4_press' => 'close_on_f4_press',
return isset( $remapped_meta_settings_keys[ $group ] ) ? $remapped_meta_settings_keys[ $group ] : [];
* Returns all or single display settings.
* @deprecated 1.7.0 Use get_setting instead.
* @param string|null $key Settings -> Display key to get.
public function get_display( $key = null ) {
$display = $this->dep_get_settings_group( 'display', $key );
$temp = isset( $display[ $key ] ) ? $display[ $key ] : false;
if ( $temp && is_string( $temp ) ) {
$display[ $key ] = preg_replace( '/\D/', '', $temp );
$display[ $key . '_unit' ] = str_replace( $display[ $key ], '', $temp );
* Returns all or single close settings.
* @deprecated 1.7.0 Use get_setting instead.
* @param string|null $key Settings key to get.
public function get_close( $key = null ) {
return $this->dep_get_settings_group( 'close', $key );
* Returns the slug for a theme. Used for CSS classes.
private function get_theme_slug() {
$theme_slug = $this->get_setting( 'theme_slug' );
if ( false === $theme_slug ) {
$theme_slug = get_post_field( 'post_name', $this->get_theme_id() );
$this->update_setting( 'theme_slug', $theme_slug );
* Returns array of classes for this popup.
* @param string $element The key or html element identifier.
public function get_classes( $element = 'overlay' ) {
'pum-theme-' . $this->get_theme_id(),
'pum-theme-' . $this->get_theme_slug(),
'popmake-overlay', // Backward Compatibility.
'popmake', // Backward Compatibility.
'theme-' . $this->get_theme_id(), // Backward Compatibility.
'popmake-title', // Backward Compatibility.
'popmake-content', // Backward Compatibility.
'popmake-close', // Backward Compatibility.
$size = $this->get_setting( 'size', 'medium' );
if ( in_array( $size, [ 'nano', 'micro', 'tiny', 'small', 'medium', 'normal', 'large', 'xlarge' ], true ) ) {
$classes['container'] = array_merge(
'pum-responsive-' . $size,
'responsive', // Backward Compatibility.
'size-' . $size, // Backward Compatibility.
} elseif ( 'custom' === $size ) {
$classes['container'][] = 'size-custom'; // Backward Compatibility.
if ( ! $this->get_setting( 'custom_height_auto' ) && $this->get_setting( 'scrollable_content' ) ) {
$classes['container'] = array_merge(
'scrollable', // Backward Compatibility.
if ( $this->get_setting( 'position_fixed' ) ) {
$classes['container'][] = 'pum-position-fixed';
if ( $this->get_setting( 'overlay_disabled' ) ) {
$classes['overlay'][] = 'pum-overlay-disabled';
if ( $this->get_setting( 'disable_accessibility' ) ) {
$classes['overlay'][] = 'pum-accessibility-disabled';
if ( $this->get_setting( 'close_on_overlay_click' ) ) {
$classes['overlay'][] = 'pum-click-to-close';
// Add a class for each trigger type.
foreach ( $this->get_triggers() as $trigger ) {
if ( ! in_array( $trigger['type'], $classes['overlay'], true ) ) {
$classes['overlay'][] = $trigger['type'];
if ( is_singular( 'popup' ) ) {
$classes['overlay'][] = 'pum-preview';
$classes = apply_filters( 'pum_popup_classes', $classes, $this->ID );
if ( ! isset( $classes[ $element ] ) ) {
$classes[ $element ] = [];
return apply_filters( "pum_popup_{$element}_classes", $classes[ $element ], $this->ID );
* Returns array for data attribute of this popup.
public function get_data_attr() {
'slug' => $this->post_name,
'theme_id' => $this->get_theme_id(),
'cookies' => $this->get_cookies(),
'triggers' => $this->get_triggers(),
'mobile_disabled' => $this->mobile_disabled() ? true : null,
'tablet_disabled' => $this->tablet_disabled() ? true : null,
'display' => $this->get_display(),
'close' => $this->get_close(),
// Added here for backward compatibility in extensions.
'click_open' => popmake_get_popup_meta( 'click_open', $this->ID ),
// Pass conditions only if there are JS conditions.
if ( $this->has_conditions( [ 'js_only' => true ] ) ) {
$data_attr['conditions'] = $this->get_parsed_js_conditions();
return apply_filters( 'pum_popup_data_attr', $data_attr, $this->ID );
* Returns the close button text.
public function close_text() {
$text = $this->get_setting( 'close_text', '×' );
$theme_text = pum_get_theme_close_text( $this->get_theme_id() );
if ( empty( $text ) && ! empty( $theme_text ) ) {
return apply_filters( 'pum_popup_close_text', $text, $this->ID );
* Returns true if the close button should be rendered.
* @uses apply_filters `pum_popup_show_close_button`
public function show_close_button() {
return (bool) apply_filters( 'pum_popup_show_close_button', true, $this->ID );
* Placeholder in a series of changes to officially remove condition filtering.
* This is a temporary method to allow for backwards compatibility.
* @param array $filters Array of condition filters.
public function get_conditions_with_filters( $filters = [ 'string' => false, 'string2' => true] ) {
$js_only = isset( $filters[ 'js_only'] ) && $filters[ 'js_only' ];
$php_only = isset( $filters[ 'php_only'] ) && $filters[ 'php_only' ];
$conditions = $this->get_setting( 'conditions', [] );
// Sanity Check on the values not operand value.
foreach ( $conditions as $group_key => $group ) {
foreach ( $group as $key => $condition ) {
( $js_only && ! $this->is_js_condition( $condition ) ) ||
( $php_only && $this->is_js_condition( $condition ) )
unset( $conditions[ $group_key ][ $key ] );
if ( empty( $conditions[ $group_key ] ) ) {
unset( $conditions[ $group_key ] );
* Get the popups conditions.
* @param boolean|string[] $filters Array of condition filters.
public function get_conditions( $filters = false ) {
// Backwards compatibility for old filters.
$conditions = false === $filters ? $this->get_setting( 'conditions', [] ) : $this->get_conditions_with_filters( $filters );
foreach ( $conditions as $group_key => $group ) {
foreach ( $group as $key => $condition ) {
$conditions[ $group_key ][ $key ] = $this->parse_condition( $condition );
if ( ! empty( $conditions[ $group_key ] ) ) {
// Renumber each subarray.
$conditions[ $group_key ] = array_values( $conditions[ $group_key ] );
$conditions = array_values( $conditions );
return apply_filters( 'pum_popup_get_conditions', $conditions, $this->ID, $filters );
* Return a flattened list of conditions (no groups).
* @param boolean|string[] $filters Array of condition filters.
public function get_conditions_list( $filters = false ) {
$conditions = $this->get_conditions( $filters );
foreach ( $conditions as $group ) {
foreach ( $group as $condition ) {
$conditions_list[] = $condition;
* Ensures condition data integrity.
* @param array $condition Condition.
public function parse_condition( $condition ) {
$condition = wp_parse_args(
$condition['not_operand'] = (bool) $condition['not_operand'];
/** Backward compatibility layer */
foreach ( $condition['settings'] as $key => $value ) {
$condition[ $key ] = $value;
// The not operand value is missing, set it to false.
* Checks if this popup has any conditions.
* @param false|string[] $filters Array of filters to use.
public function has_conditions( $filters = false ) {
return (bool) count( $this->get_conditions( $filters ) );
* Checks if the popup has a specific condition.
* Generally used for conditional asset loading.
* @param string[]|string $conditions Array of condition to check for.
public function has_condition( $conditions ) {
if ( ! $this->has_conditions() ) {
if ( ! is_array( $conditions ) ) {
$conditions = [ $conditions ];
foreach ( $this->get_conditions() as $group ) {
foreach ( $group as $condition ) {
if ( in_array( $condition['target'], $conditions, true ) ) {
* Retrieves the 'enabled' meta key and returns true if popup is enabled
* @return bool True if enabled
public function is_enabled() {
$enabled = $this->get_meta( 'enabled' );
if ( false === $enabled ) {
// If the key is missing...
$this->update_meta( 'enabled', $enabled );
$enabled = intval( $enabled );
if ( ! in_array( $enabled, [ 0, 1 ], true ) ) {
* Returns whether or not the popup is visible in the loop.
public function is_loadable() {
// Loadable defaults to true if no conditions. Making the popup available everywhere.
// If popup is not enabled, this popup is not loadable.
if ( ! $this->is_enabled() ) {
if ( $this->has_conditions() ) {
// All Groups Must Return True. Break if any is false and set $loadable to false.
foreach ( $this->get_conditions() as $group => $conditions ) {
// Groups are false until a condition proves true.
// At least one group condition must be true. Break this loop if any condition is true.
foreach ( $conditions as $condition ) {
// If this is JS condition, popup must load to check it later. Group can't be known false til then.
if ( $this->is_js_condition( $condition ) ) {
// If any condition passes, set $group_check true and break.
if ( ! $condition['not_operand'] && $this->check_condition( $condition ) ) {
} elseif ( $condition['not_operand'] && ! $this->check_condition( $condition ) ) {
// If any group of conditions doesn't pass, popup is not loadable.