/** * Returns an array of PopUp objects that should be displayed for the * current page/user. The PopUps are in the order in which they are defined * in the admin list. * * @since 4.6 * @return array List of all popups that fit the current page. */ protected function find_popups() { $popups = array(); lib2()->array->equip_request('po_id', 'preview'); /** * Allow other modules to provide a single popup ID to display. * The value 0 will use the default logic, which evaluates all active * Popups instead of displaying a single Popup. * * @since 4.8.0.0 */ $popup_id = apply_filters('popup-find-popup-single', absint($_REQUEST['po_id'])); if ($popup_id) { // Check for forced popup. $popup_ids = array($popup_id); } else { $popup_ids = IncPopupDatabase::get_active_ids(); } /** * Filter the list of Popup IDs that will be considered for display. * These Popups will be loaded and their rules evaluated in the next step. * * @since 4.8.0.0 */ $popup_ids = apply_filters('popup-active-popup-ids', $popup_ids, $popup_id, $this); foreach ($popup_ids as $id) { $popup = IncPopupDatabase::get($id); if ($popup_id) { // Forced popup ignores all conditions. $show = true; } else { // Apply the conditions to decide if the popup should be displayed. $show = apply_filters('popup-apply-rules', true, $popup); } // Stop here if the popup failed in some conditions. if (!$show) { continue; } // Stop here if the user did choose to hide the popup. if (!$_REQUEST['preview'] && $this->is_hidden($id)) { continue; } $popups[] = $popup; } return $popups; }
/** * Returns an array of PopUp objects that should be displayed for the * current page/user. The PopUps are in the order in which they are defined * in the admin list. * * @since 4.6 * @return array List of all popups that fit the current page. */ protected function find_popups() { $popups = array(); WDev()->load_request_fields('po_id', 'preview'); $popup_id = absint($_REQUEST['po_id']); if ($popup_id) { // Check for forced popup. $active_ids = array($popup_id); } else { $active_ids = IncPopupDatabase::get_active_ids(); } foreach ($active_ids as $id) { $popup = IncPopupDatabase::get($id); if ($popup_id) { // Forced popup ignores all conditions. $show = true; } else { // Apply the conditions to decide if the popup should be displayed. $show = apply_filters('popup-apply-rules', true, $popup); } // Stop here if the popup failed in some conditions. if (!$show) { continue; } // Stop here if the user did choose to hide the popup. if (!$_REQUEST['preview'] && $this->is_hidden($id)) { continue; } $popups[] = $popup; } return $popups; }