PluginProbe
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar / 1.0.2
NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar v1.0.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 1.2.0 1.2.1 All 156 releases
notificationx / includes / class-nx-db.php

class-nx-db.php in NotificationX – FOMO, Live Sales Notification, WooCommerce Sales Popup, GDPR, Social Proof, Announcement Banner & Floating Notification Bar 1.0.2, at includes/class-nx-db.php

53 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This class responsible for database work
4 * using wordpress functionality
5 * get_option and update_option.
6 */
7 class NotificationX_DB {
8 /**
9 * Get all the notification
10 * saved in options table.
11 * @return array
12 */
13 public static function get_notifications(){
14 $notifications = get_option( 'notificationx_data', true );
15 return is_array( $notifications ) ? $notifications : [];
16 }
17 /**
18 * Update notifications.
19 * @param array $new_value
20 * @return boolean
21 */
22 public static function update_notifications( $new_value ){
23 return update_option( 'notificationx_data', $new_value );
24 }
25 /**
26 * Get all settings value from options table.
27 * or, get settings for a specific $key
28 *
29 * @param string $name
30 * @return array
31 */
32 public static function get_settings( $name = '' ){
33 $settings = get_option( 'notificationx_settings', true );
34
35 if( ! empty( $name ) && isset( $settings[ $name ] ) ) {
36 return $settings[ $name ];
37 }
38
39 if( ! empty( $name ) && ! isset( $settings[ $name ] ) ) {
40 return '';
41 }
42
43 return is_array( $settings ) ? $settings : [];
44 }
45 /**
46 * Update settings
47 * @param array $value
48 * @return boolean
49 */
50 public static function update_settings( $value ){
51 return update_option( 'notificationx_settings', $value );
52 }
53 }