PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 3.3.1
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v3.3.1
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 1.2.0 1.2.1 All 156 releases
notificationx / includes / Core / Limiter.php

Limiter.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 3.3.1, at includes/Core/Limiter.php

36 lines 780 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace NotificationX\Core;
4
5 use NotificationX\Admin\Entries;
6 use NotificationX\Admin\Settings;
7 use NotificationX\Core\Database;
8 use NotificationX\GetInstance;
9
10
11 /**
12 * @method static Limiter get_instance($args = null)
13 */
14 class Limiter {
15 use GetInstance;
16
17 /**
18 * Initial Invoked
19 */
20 public function __construct() {
21 }
22
23 public function remove($nx_id, $new) {
24 $count = Entries::get_instance()->count($nx_id, 'nx_id');
25 $limit = Settings::get_instance()->get('settings.cache_limit', 100);
26 if ($limit <= 0) {
27 $limit = 100;
28 }
29
30 if ($new + $count > $limit) {
31 $overflow = ($new + $count) - $limit;
32 Entries::get_instance()->delete_entries($nx_id, $overflow);
33 }
34 }
35 }
36