tp TouchPointWP Stats - TenthPres/TouchPoint-WP GitHub Wiki
tp\TouchPointWP\Stats
Keep track of some basic stats that are helpful for Tenth to support other churches using the plugin.
- Class name: Stats
- Namespace: \tp\TouchPointWP
- This class implements: tp\TouchPointWP\api, JsonSerializable, tp\TouchPointWP\updatesViaCron
Constants
CRON_HOOK
const CRON_HOOK = \tp\TouchPointWP\TouchPointWP::HOOK_PREFIX . 'stats_submit'
SUBMISSION_ENDPOINT
const SUBMISSION_ENDPOINT = 'https://www.tenth.org/touchpoint-api/stats/submit'
Methods
load
bool tp\TouchPointWP\Stats::load()
Loads the module and initializes the other actions.
- Visibility: public
- This method is static.
Returns
- bool -
migrate
void tp\TouchPointWP\Stats::migrate()
Call home, triggered by migration.
- Visibility: public
- This method is static.
updateCron
void tp\TouchPointWP\updatesViaCron::updateCron()
Run the updating cron task. Fail quietly to not disturb the visitor experience if using WP default cron handling.
- Visibility: public
- This method is static.
- This method is defined by tp\TouchPointWP\updatesViaCron
checkUpdates
void tp\TouchPointWP\updatesViaCron::checkUpdates()
Check to see if a cron run is needed, and run it if so. Connected to an init function.
- Visibility: public
- This method is static.
- This method is defined by tp\TouchPointWP\updatesViaCron
updateDb
bool tp\TouchPointWP\Stats::updateDb()
Save the stats to the database.
- Visibility: public
Returns
- bool - true on success (or if an update wasn't needed), false on failure.
__set
void tp\TouchPointWP\Stats::__set(mixed name, mixed value)
Setter. Allows particular statistics to be set.
- Visibility: public
Arguments
- name mixed* value mixed
__get
void tp\TouchPointWP\Stats::__get(string name)
- Visibility: public
Arguments
- name string
getStatsForSubmission
array tp\TouchPointWP\Stats::getStatsForSubmission(bool updateQueried)
Assemble the information that's submitted.
- Visibility: public
Arguments
- updateQueried bool
Returns
- array -
jsonSerialize
mixed tp\TouchPointWP\Stats::jsonSerialize()
Assemble the object into a format that can be serialized to JSON. Only includes the parameters that are part of this class, not those that are loaded from the database separately, such as version numbers.
- Visibility: public
Returns
- mixed
instance
\tp\TouchPointWP\Stats tp\TouchPointWP\Stats::instance()
Get the singleton.
- Visibility: public
- This method is static.
Returns
- \tp\TouchPointWP\Stats -
api
bool tp\TouchPointWP\api::api(array uri)
Handle API requests
- Visibility: public
- This method is static.
- This method is defined by tp\TouchPointWP\api
Arguments
- uri array - The request URI already parsed by parse_url()
Returns
- bool - False if endpoint is not found. Should print the result.
handleSubmission
bool tp\TouchPointWP\Stats::handleSubmission()
Handle submissions received to this site (presumably tenth.org) from other users of the plugin.
- Visibility: public
- This method is static.
Returns
- bool - True on success