subscriptions.php
Helper functions for retrieving subscriptions.
Tags
Table of Contents
- load_subscriptions() : array<string|int, mixed>
- Takes an array of subscription post_ids and instantiates them into an array of Subscription objects.
- get_subscription_ids() : array<string|int, mixed>
- paywall_interval_text() : string
- Convert a duration in seconds to human readable.
Functions
load_subscriptions()
Takes an array of subscription post_ids and instantiates them into an array of Subscription objects.
load_subscriptions(array<string|int, mixed> $post_ids) : array<string|int, mixed>
If a subscription cannot be loaded due to Subscription::load() throwing (i.e. bad DB data), then the error will be logged and the rest of the subscriptions will be loaded.
Parameters
- $post_ids : array<string|int, mixed>
-
The array of integer post_ids
Return values
array<string|int, mixed> —The array of Subscription objects.
get_subscription_ids()
get_subscription_ids() : array<string|int, mixed>
Return values
array<string|int, mixed> —paywall_interval_text()
Convert a duration in seconds to human readable.
paywall_interval_text(int $seconds[, int $detail = 2 ]) : string
Parameters
- $seconds : int
-
The duration.
- $detail : int = 2
-
How many non-zero units to display, starting to count from larger units first. 0 means show all.
Return values
string —The human-readable text, ready to display.