PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.3
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.3
3.3.3 3.3.2 3.3.1 3.3.0 3.2.14 3.2.13 3.2.12 3.2.11 3.2.10 3.2.9 3.2.8 3.2.7 trunk 0.2.5.5 0.2.5.6 0.2.5.7 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 158 releases
← All changes | includes/Extensions/WooCommerce/WooInline.php +12 -11 3.3.1 → 3.3.3 View file →
@@ -250,22 +250,23 @@
250 250 return $messages;
251 251 }
252 252
253 253 /**
254 - * @todo Something
254 + * Keep this source's notifications out of the popup loop in
255 + * FrontEnd::get_notifications_ids(). They render inline at the hooks
256 + * chosen in `inline_location`, never as a floating popup.
255 257 *
256 - * @param [type] $exclude
257 - * @param [type] $settings
258 - * @return void
258 + * `inline_location` is not read here on purpose: it can be saved as ''
259 + * (MCP or Quick Builder create without the field), and passing that to
260 + * array_diff() is a TypeError on PHP 8 that white-screens every page.
261 + *
262 + * @param bool $exclude Whether an earlier callback already excluded it.
263 + * @param array $settings Notification settings.
264 + * @return bool
259 265 */
260 266 public function show_on_exclude( $exclude, $settings ) {
261 - if ( $settings['source'] === $this->id ) {
262 - $woo_location = $settings['inline_location'];
263 - $hooks = ['woocommerce_before_add_to_cart_form', 'woocommerce_after_shop_loop_item_title', 'woocommerce_after_shop_loop_item', 'woocommerce_after_cart_item_name'];
264 - $diff = array_diff( $hooks, $woo_location );
265 - if ( count( $diff ) <= count( $hooks ) ) {
266 - return true;
267 - }
267 + if ( isset( $settings['source'] ) && $this->id === $settings['source'] ) {
268 + return true;
268 269 }
269 270 return $exclude;
270 271 }
271 272