src/Modules/Notification.php
public static function get_random_notification() {
		if ( ( time() - self::get_last_active_notification_timestamp() ) < self::TIME_BETWEEN_NOTIFICATIONS * DAY_IN_SECONDS ) {
			return [];
		}

		$notifications = self::$notifications;
		$notifications = array_filter(
			$notifications,
			function ( $value ) {
				if ( isset( $value['sticky'] ) && true === $value['sticky'] ) {
					return true;
				}

				return false;
			}
		);
		// No priority notifications, use all.
		if ( empty( $notifications ) ) {
			$notifications = self::$notifications;
		}
		if ( empty( $notifications ) ) {
			return [];
		}
		$notifications = array_values( $notifications );

		return $notifications[ array_rand( $notifications, 1 ) ];

	}
public static function get_random_notification() {
		if ( ( time() - self::get_last_active_notification_timestamp() ) < self::TIME_BETWEEN_NOTIFICATIONS * DAY_IN_SECONDS ) {
			return [];
		}

		$notifications = self::$notifications;
		$notifications = array_filter(
			$notifications,
			function ( $value ) {
				if ( isset( $value['sticky'] ) && true === $value['sticky'] ) {
					return true;
				}

				return false;
			}
		);
		// No priority notifications, use all.
		if ( empty( $notifications ) ) {
			$notifications = self::$notifications;
		}
		if ( empty( $notifications ) ) {
			return [];
		}
		$notifications = array_values( $notifications );

		return $notifications[ array_rand( $notifications, 1 ) ];

	}
public static function get_random_notification ( ) { if ( ( time ( ) - self :: get_last_active_notification_timestamp ( ) ) < self :: TIME_BETWEEN_NOTIFICATIONS * DAY_IN_SECONDS ) { return [ ] ; } $ notifications = self :: $ notifications ; $ notifications = array_filter ( $ notifications , function ( $ value ) { if ( isset ( $ value [ 'sticky' ] ) && true === $ value [ 'sticky' ] ) { return true ; } return false ; } ) ; // No priority notifications, use all. if ( empty ( $ notifications ) ) { $ notifications = self :: $ notifications ; } if ( empty ( $ notifications ) ) { return [ ] ; } $ notifications = array_values ( $ notifications ) ; return $ notifications [ array_rand ( $ notifications , 1 ) ] ; }
Return notification to show.

@return array Notification data.
Return notification to show .