Documentation

Involvement
in package
implements api, updatesViaCron, geo, module Uses jsInstantiation, jsonLd

Fundamental object meant to correspond to an Involvement in TouchPoint

Table of Contents

Interfaces

api
API Interface
updatesViaCron
Interface to standardize items that are updated with Cron.
geo
For classes that have geographic attributes, or potential geographic attributes
module
This is a base interface for all feature classes.

Constants

CRON_HOOK  = \tp\TouchPointWP\TouchPointWP::HOOK_PREFIX . "inv_cron_hook"
CRON_OFFSET  = 86400 + 3600
INVOLVEMENT_META_KEY  = \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "invId"
SCHEDULE_STRING_CACHE_EXPIRATION  = 3600 * 8
SCHEDULE_STRING_CACHE_GROUP  = \tp\TouchPointWP\TouchPointWP::HOOK_PREFIX . "inv_schedule_string"
SHORTCODE_ACTIONS  = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Actions"
SHORTCODE_FILTER  = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Filters"
SHORTCODE_LIST  = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-List"
SHORTCODE_MAP  = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Map"
SHORTCODE_NEARBY  = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Nearby"

Properties

$attributes  : object
$color  : string|null
$containerClass  : string
$geo  : object|null
$invId  : int
$invType  : string
$itemClass  : string
$name  : string
$post_excerpt  : string
$post_id  : int

Methods

acceptingNewMembers()  : bool|string
Whether the involvement can be joined
actionsShortcode()  : string
Display action buttons for an involvement. Takes an id parameter for the Involvement ID. If not provided, the current post will be used.
ajaxNearby()  : void
Handles the API call to get nearby involvements (probably small groups)
api()  : bool
Handle API requests
asGeoIFace()  : object|null
Returns a standardized stdObject, or null if not viable.
checkUpdates()  : void
Check to see if a cron run is needed, and run it if so. Connected to an init function.
doInvolvementList()  : void
filterAuthor()  : string
Replace the author with the leaders
filterPublishDate()  : mixed
Replace the date with the schedule summary
filterShortcode()  : string
fromPost()  : Involvement
Create an Involvement object from an object from a WP_Post object.
getActionButtons()  : string
Returns the html with buttons for actions the user can perform. This must be called *within* an element with the `data-tp-involvement` attribute with the post_id (NOT the Inv ID) as the value.
getDistance()  : float
Returns distance to the given involvement from the $compareGeo point.
getDivisionsStrings()  : array<string|int, string>
Returns an array of the Involvement's Divisions, excluding those that cause it to be included.
getJsInstantiationString()  : string
Get the JS for instantiation.
getPermalink()  : string
Returns the permalink corresponding to the JSON-LD object.
getPostTypes()  : array<string|int, mixed>
Get an array of Involvement Post Types
getSettingsForPostType()  : Involvement_PostTypeSettings|null
Get the setting object for a specific post type or involvement type
getTouchPointId()  : int
Gets a TouchPoint item ID number, regardless of what type of object this is.
hasGeo()  : bool
Indicates whether a map of a single Involvement can be displayed.
hosts()  : PersonArray|null
Get the hosts of the involvement. Returns null if not a geo-enabled post type.
init()  : void
Register stuff
leaders()  : PersonArray
Get the leaders of the Involvement
listShortcode()  : string
Print a list of involvements that match the given criteria.
load()  : bool
Loads the module and initializes the other actions.
mapShortcode()  : string
members()  : PersonArray
Get the members of the involvement. Note that not all members are necessarily synced to WordPress from TouchPoint.
nearbyShortcode()  : string
nextMeeting()  : DateTimeImmutable|null
Get the next meeting date/time from either the meetings or schedules.
notableAttributes()  : array<string|int, string>
Get notable attributes, such as gender restrictions, as strings.
printJsonLd()  : void
Print the full JSON-LD info, including script tags.
registerScriptsAndStyles()  : void
Register scripts and styles to be used on display pages.
requireAllObjectsInJs()  : void
If all objects need to be included in the JS,
scheduleString()  : string
Get a description of the meeting schedule in a human-friendly phrase, e.g. Sundays at 11:00am, starting January 14.
setComparisonGeo()  : void
sort()  : int
Put SmallGroup objects in order of increasing distance. Closed groups go to the end.
sortPosts()  : int
Put Post objects that represent Small Groups in order of increasing distance.
templateFilter()  : string
toJsonLD()  : object|null
Return an object that turns into JSON-LD as an event, compliant with schema.org. Return null if the object can't be printed to jsonLd for some reason (e.g. required fields are missing).
updateCron()  : void
Run the updating cron task. Fail quietly to not disturb the visitor experience if using WP default cron handling.
updateFromTouchPoint()  : false|int
Query TouchPoint and update Involvements in WordPress
useRegistrationForm()  : bool
Whether the involvement should link to a registration form, rather than directly joining the org.

Constants

CRON_HOOK

public mixed CRON_HOOK = \tp\TouchPointWP\TouchPointWP::HOOK_PREFIX . "inv_cron_hook"

INVOLVEMENT_META_KEY

public mixed INVOLVEMENT_META_KEY = \tp\TouchPointWP\TouchPointWP::SETTINGS_PREFIX . "invId"

SCHEDULE_STRING_CACHE_EXPIRATION

public mixed SCHEDULE_STRING_CACHE_EXPIRATION = 3600 * 8

SCHEDULE_STRING_CACHE_GROUP

public mixed SCHEDULE_STRING_CACHE_GROUP = \tp\TouchPointWP\TouchPointWP::HOOK_PREFIX . "inv_schedule_string"

SHORTCODE_ACTIONS

public mixed SHORTCODE_ACTIONS = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Actions"

SHORTCODE_FILTER

public mixed SHORTCODE_FILTER = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Filters"

SHORTCODE_LIST

public mixed SHORTCODE_LIST = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-List"

SHORTCODE_MAP

public mixed SHORTCODE_MAP = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Map"

SHORTCODE_NEARBY

public mixed SHORTCODE_NEARBY = \tp\TouchPointWP\TouchPointWP::SHORTCODE_PREFIX . "Inv-Nearby"

Properties

$containerClass

public static string $containerClass = 'inv-list'

$invType

public string $invType

The Involvement Type is the post Type WITHOUT the possible prefix.

$itemClass

public static string $itemClass = 'inv-list-item'

Methods

acceptingNewMembers()

Whether the involvement can be joined

public acceptingNewMembers() : bool|string
Return values
bool|string

True if involvement can be joined. False if no registration exists. Or, a string with why it can't be joined otherwise.

actionsShortcode()

Display action buttons for an involvement. Takes an id parameter for the Involvement ID. If not provided, the current post will be used.

public static actionsShortcode([array<string|int, mixed>|string $params = [] ][, string $content = "" ]) : string
Parameters
$params : array<string|int, mixed>|string = []
$content : string = ""
Tags
noinspection

PhpUnusedParameterInspection

Return values
string

ajaxNearby()

Handles the API call to get nearby involvements (probably small groups)

public static ajaxNearby() : void

api()

Handle API requests

public static api(array<string|int, mixed> $uri) : bool
Parameters
$uri : array<string|int, mixed>

The request URI already parsed by parse_url()

Return values
bool

False if endpoint is not found. Should print the result.

asGeoIFace()

Returns a standardized stdObject, or null if not viable.

public asGeoIFace([string $type = "unknown" ]) : object|null

Return object properties are lat, lng, human, and type.

Parameters
$type : string = "unknown"

'loc' for navigator location, or 'ip' for ip address location

Return values
object|null

checkUpdates()

Check to see if a cron run is needed, and run it if so. Connected to an init function.

public static checkUpdates() : void

doInvolvementList()

public static doInvolvementList(WP_Query $q[, mixed $params = [] ]) : void
Parameters
$q : WP_Query
$params : mixed = []

filterAuthor()

Replace the author with the leaders

public static filterAuthor( $author) : string
Parameters
$author :

Author's display name

Tags
noinspection

PhpUnusedParameterInspection WordPress API

Return values
string

filterPublishDate()

Replace the date with the schedule summary

public static filterPublishDate( $theDate,  $format[,  $post = null ]) : mixed
Parameters
$theDate :
$format :
$post : = null
Tags
noinspection

PhpUnusedParameterInspection WordPress API

filterShortcode()

public static filterShortcode([array<string|int, mixed>|string $params = [] ]) : string
Parameters
$params : array<string|int, mixed>|string = []
Return values
string

fromPost()

Create an Involvement object from an object from a WP_Post object.

public static fromPost(WP_Post $post) : Involvement
Parameters
$post : WP_Post
Tags
throws
TouchPointWP_Exception

If the involvement can't be created from the post, an exception is thrown.

Return values
Involvement

getActionButtons()

Returns the html with buttons for actions the user can perform. This must be called *within* an element with the `data-tp-involvement` attribute with the post_id (NOT the Inv ID) as the value.

public getActionButtons([string|null $context = null ][, string $btnClass = "" ]) : string
Parameters
$context : string|null = null

A reference to where the action buttons are meant to be used.

$btnClass : string = ""

A string for classes to add to the buttons. Note that buttons can be a or button elements.

Return values
string

getDistance()

Returns distance to the given involvement from the $compareGeo point.

public getDistance([bool $useHiForFalse = false ]) : float

Math thanks to https://stackoverflow.com/a/574736/2339939

Parameters
$useHiForFalse : bool = false

Set to true if a high number should be used for distances that can't be computed. Used for sorting by distance with the closest first.

Return values
float

getDivisionsStrings()

Returns an array of the Involvement's Divisions, excluding those that cause it to be included.

public getDivisionsStrings() : array<string|int, string>
Return values
array<string|int, string>

getJsInstantiationString()

Get the JS for instantiation.

public abstract static getJsInstantiationString() : string
Return values
string

Returns the permalink corresponding to the JSON-LD object.

public getPermalink() : string
Return values
string

getPostTypes()

Get an array of Involvement Post Types

public static getPostTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSettingsForPostType()

Get the setting object for a specific post type or involvement type

public static getSettingsForPostType(string|null $postType) : Involvement_PostTypeSettings|null
Parameters
$postType : string|null

Accepts either the post type string, or the inv type string

Return values
Involvement_PostTypeSettings|null

getTouchPointId()

Gets a TouchPoint item ID number, regardless of what type of object this is.

public abstract getTouchPointId() : int
Return values
int

hasGeo()

Indicates whether a map of a single Involvement can be displayed.

public hasGeo() : bool
Return values
bool

listShortcode()

Print a list of involvements that match the given criteria.

public static listShortcode([array<string|int, mixed>|string $params = [] ][, string $content = "" ]) : string
Parameters
$params : array<string|int, mixed>|string = []
$content : string = ""
Tags
noinspection

PhpUnusedParameterInspection

Return values
string

load()

Loads the module and initializes the other actions.

public static load() : bool
Return values
bool

mapShortcode()

public static mapShortcode([string|array<string|int, mixed> $params = [] ][, string $content = "" ]) : string
Parameters
$params : string|array<string|int, mixed> = []
$content : string = ""
Tags
noinspection

PhpUnusedParameterInspection WordPress API

Return values
string

members()

Get the members of the involvement. Note that not all members are necessarily synced to WordPress from TouchPoint.

public members() : PersonArray
Return values
PersonArray

nearbyShortcode()

public static nearbyShortcode([array<string|int, mixed>|string $params = [] ][, string $content = "" ]) : string
Parameters
$params : array<string|int, mixed>|string = []
$content : string = ""
Tags
noinspection

PhpUnusedParameterInspection

Return values
string

nextMeeting()

Get the next meeting date/time from either the meetings or schedules.

public nextMeeting() : DateTimeImmutable|null
Return values
DateTimeImmutable|null

notableAttributes()

Get notable attributes, such as gender restrictions, as strings.

public notableAttributes([array<string|int, mixed> $exclude = [] ]) : array<string|int, string>
Parameters
$exclude : array<string|int, mixed> = []

Attributes listed here will be excluded. (e.g. if shown for a parent inv, not needed here.)

Return values
array<string|int, string>

printJsonLd()

Print the full JSON-LD info, including script tags.

public static printJsonLd() : void

registerScriptsAndStyles()

Register scripts and styles to be used on display pages.

public static registerScriptsAndStyles() : void

requireAllObjectsInJs()

If all objects need to be included in the JS,

public static requireAllObjectsInJs([bool $require = true ]) : void
Parameters
$require : bool = true

Whether all objects should be required. Almost always should be left with the default.

scheduleString()

Get a description of the meeting schedule in a human-friendly phrase, e.g. Sundays at 11:00am, starting January 14.

public static scheduleString(int $invId[, Involvement|null $inv = null ]) : string

This is separated out to a static method to prevent involvement from being instantiated (with those database hits) when the content is cached. (10x faster or more)

Parameters
$invId : int
$inv : Involvement|null = null
Return values
string

setComparisonGeo()

public static setComparisonGeo(object $geo) : void
Parameters
$geo : object

Set a geo object to use for distance comparisons. Needs to be called before getDistance()

sortPosts()

Put Post objects that represent Small Groups in order of increasing distance.

public static sortPosts(WP_Post $a, WP_Post $b) : int
Parameters
$a : WP_Post
$b : WP_Post
Return values
int

templateFilter()

public static templateFilter(string $template) : string
Parameters
$template : string
Tags
noinspection

unused

Return values
string

toJsonLD()

Return an object that turns into JSON-LD as an event, compliant with schema.org. Return null if the object can't be printed to jsonLd for some reason (e.g. required fields are missing).

public abstract toJsonLD() : object|null
Return values
object|null

updateCron()

Run the updating cron task. Fail quietly to not disturb the visitor experience if using WP default cron handling.

public static updateCron() : void

updateFromTouchPoint()

Query TouchPoint and update Involvements in WordPress

public static updateFromTouchPoint([bool $verbose = false ]) : false|int
Parameters
$verbose : bool = false

Whether to print debugging info.

Return values
false|int

False on failure, or the number of groups that were updated or deleted.

useRegistrationForm()

Whether the involvement should link to a registration form, rather than directly joining the org.

public useRegistrationForm() : bool
Return values
bool

        
On this page

Search results