Documentation

AnnouncementPool
in package
Uses UtilsProvider

Represent a set of announcements synced to the backend (for a given plugin update).

A announcement pool is a dependency of the plugin update because they should only be shown, when a valid license is active.

Table of Contents

Constants

DEFAULT_ENABLED  = true
OPTION_EXPIRE  = 60 * 60 * 6
OPTION_NAME  = RPM_WP_CLIENT_OPT_PREFIX . '-announcements'
OPTION_NAME_ENABLED  = RPM_WP_CLIENT_OPT_PREFIX . '-announcements-active_'

Properties

$client  : mixed
Announcement client.
$dismissed  : array<string|int, int>
List of all dismissed announcement IDs of remote.
$items  : array<string|int, Announcement>
List of all announcements fetched from remote.
$option  : mixed
Expired option for announcement cache.
$pluginUpdate  : PluginUpdate
Plugin update instance.
$view  : AnnouncementView
View handler.
$viewed  : array<string|int, int>
List of all viewed announcement IDs of remote.

Methods

dismiss()  : mixed
Dismiss an announcement by ID.
getClient()  : mixed
Self-explanatory.
getDismissed()  : mixed
Self-explanatory.
getItems()  : mixed
Self-explanatory.
getOption()  : mixed
Self-explanatory.
getPluginConstantPrefix()  : string
Get the prefix of this package so we can utils package natively.
getPluginUpdate()  : mixed
Self-explanatory.
getView()  : mixed
Self-explanatory.
getViewed()  : mixed
Self-explanatory.
initialize()  : mixed
This function should only be called when a valid license was found. This is before the `init` hook was called!
instance()  : mixed
New instance.
isActive()  : mixed
Check if announcements are currently active (announcements can be disabled by the user).
setupConstants()  : mixed
Make sure the RPM_WP_CLIENT constants are available.
sync()  : mixed
Sync all current available announcements and fetch from remote all x hours.
syncViewStatus()  : mixed
Sync the view status to the remote server. It automatically uses all valid licenses in a multisite installation.
__construct()  : mixed
C'tor.

Constants

OPTION_NAME

public mixed OPTION_NAME = RPM_WP_CLIENT_OPT_PREFIX . '-announcements'

OPTION_NAME_ENABLED

public mixed OPTION_NAME_ENABLED = RPM_WP_CLIENT_OPT_PREFIX . '-announcements-active_'

Properties

$dismissed

List of all dismissed announcement IDs of remote.

private array<string|int, int> $dismissed = []

$viewed

List of all viewed announcement IDs of remote.

private array<string|int, int> $viewed = []

Methods

dismiss()

Dismiss an announcement by ID.

public dismiss(int $id) : mixed
Parameters
$id : int

Announcement ID

getClient()

Self-explanatory.

public getClient() : mixed
Tags
codeCoverageIgnore

getDismissed()

Self-explanatory.

public getDismissed() : mixed
Tags
codeCoverageIgnore

getItems()

Self-explanatory.

public getItems() : mixed
Tags
codeCoverageIgnore

getOption()

Self-explanatory.

public getOption() : mixed
Tags
codeCoverageIgnore

getPluginConstantPrefix()

Get the prefix of this package so we can utils package natively.

public getPluginConstantPrefix() : string
Return values
string

getPluginUpdate()

Self-explanatory.

public getPluginUpdate() : mixed
Tags
codeCoverageIgnore

getView()

Self-explanatory.

public getView() : mixed
Tags
codeCoverageIgnore

getViewed()

Self-explanatory.

public getViewed() : mixed
Tags
codeCoverageIgnore

initialize()

This function should only be called when a valid license was found. This is before the `init` hook was called!

public initialize() : mixed

instance()

New instance.

public static instance(PluginUpdate $pluginUpdate) : mixed
Parameters
$pluginUpdate : PluginUpdate

The associated plugin to the announcements

Tags
codeCoverageIgnore

isActive()

Check if announcements are currently active (announcements can be disabled by the user).

public isActive([bool $set = null ]) : mixed
Parameters
$set : bool = null

setupConstants()

Make sure the RPM_WP_CLIENT constants are available.

public static setupConstants() : mixed

sync()

Sync all current available announcements and fetch from remote all x hours.

public sync([bool $force = false ]) : mixed

This method may only be called when the user has a valid license!

Parameters
$force : bool = false

syncViewStatus()

Sync the view status to the remote server. It automatically uses all valid licenses in a multisite installation.

public syncViewStatus(Announcement $announcement) : mixed
Parameters
$announcement : Announcement

        
On this page

Search results