Documentation

TrackIP
in package
implements ActionInterface, Routable uses ActionRouter, ActionTrait, BackwardCompatibility

Rename here and in the exportStatic call at the end of the file.

Table of Contents

Interfaces

ActionInterface
Interface for all action classes.
Routable
Classes implementing this interface can build routes from URL query parameters and parse routes back into URL query parameters.

Properties

$memID  : int
$standalone  : bool
$obj  : static

Methods

buildRoute()  : array<string|int, mixed>
Builds a routing path based on URL query parameters.
call()  : void
Convenience method to load() and execute() an instance of this class.
canBeLogged()  : bool
Determines whether this action can be logged in the online log.
canShowDebuggingInfo()  : bool
Determines whether debugging info should be shown.
canShowInMaintenanceMode()  : bool
Determines whether this action allows access in maintenance mode.
execute()  : void
Do the job.
getOutputType()  : OutputTypeInterface
Gets the output type for this action.
isAgreementAction()  : bool
Determines whether this action can be accessed without accepting the registration agreement and privacy policy.
isRestrictedGuestAccessAllowed()  : bool
Determines whether this action allows access if guest access is restricted.
isSimpleAction()  : bool
Determines whether this is a simple action.
list_getIPMessageCount()  : int
Gets the number of posts made from a particular IP
list_getIPMessages()  : array<string|int, mixed>
Gets all the posts made from a particular IP
load()  : static
Static wrapper for constructor.
parseRoute()  : array<string|int, mixed>
Parses a route to get URL query parameters.
subActionProvider()  : void
Backwards compatibility function for handling profile-related subactions
__construct()  : mixed
Constructor. Protected to force instantiation via self::load().
buildActionRoute()  : array<string|int, mixed>
Builds a routing path for an action based on URL query parameters.
parseActionRoute()  : array<string|int, mixed>
Parses a route for an action to get URL query parameters.

Properties

$memID

public int $memID

ID of the member to track.

$standalone

public bool $standalone

True if this was called via ?action=trackip. False if this was called via ?action=profile;area=tracking;sa=ip.

$obj

protected static static $obj

An instance of this class. This is used by the load() method to prevent multiple instantiations.

Methods

buildRoute()

Builds a routing path based on URL query parameters.

public static buildRoute(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

URL query parameters.

Return values
array<string|int, mixed>

Contains two elements: ['route' => [], 'params' => []]. The 'route' element contains the routing path. The 'params' element contains any $params that weren't incorporated into the route.

call()

Convenience method to load() and execute() an instance of this class.

public static call() : void

canBeLogged()

Determines whether this action can be logged in the online log.

public canBeLogged() : bool
Return values
bool

canShowDebuggingInfo()

Determines whether debugging info should be shown.

public canShowDebuggingInfo() : bool
Return values
bool

canShowInMaintenanceMode()

Determines whether this action allows access in maintenance mode.

public canShowInMaintenanceMode() : bool
Return values
bool

True if access is allowed, false otherwise.

execute()

Do the job.

public execute() : void

isAgreementAction()

Determines whether this action can be accessed without accepting the registration agreement and privacy policy.

public isAgreementAction() : bool
Return values
bool

isRestrictedGuestAccessAllowed()

Determines whether this action allows access if guest access is restricted.

public isRestrictedGuestAccessAllowed() : bool
Return values
bool

True if access is allowed, false otherwise.

isSimpleAction()

Determines whether this is a simple action.

public isSimpleAction() : bool
Return values
bool

list_getIPMessageCount()

Gets the number of posts made from a particular IP

public static list_getIPMessageCount(string $where[, array<string|int, mixed> $where_vars = [] ]) : int
Parameters
$where : string

A query indicating which posts to count

$where_vars : array<string|int, mixed> = []

The parameters for $where

Return values
int

Count of messages matching the IP

list_getIPMessages()

Gets all the posts made from a particular IP

public static list_getIPMessages(int $start, int $items_per_page, string $sort, string $where[, array<string|int, mixed> $where_vars = [] ]) : array<string|int, mixed>
Parameters
$start : int

Which item to start with (for pagination purposes)

$items_per_page : int

How many items to show on each page

$sort : string

A string indicating how to sort the results

$where : string

A query to filter which posts are returned

$where_vars : array<string|int, mixed> = []

An array of parameters for $where

Return values
array<string|int, mixed>

An array containing information about the posts

load()

Static wrapper for constructor.

public static load() : static
Return values
static

An instance of this class.

parseRoute()

Parses a route to get URL query parameters.

public static parseRoute(array<string|int, mixed> $route[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$route : array<string|int, mixed>

Array of routing path components.

$params : array<string|int, mixed> = []

Any existing URL query parameters.

Return values
array<string|int, mixed>

URL query parameters

subActionProvider()

Backwards compatibility function for handling profile-related subactions

public static subActionProvider(int $memID[, null|string $sa = null ][, bool $updateRequest = false ][, bool $loadSelfFirst = true ][, bool $loadProfile = false ][, bool $defaultSettings = false ]) : void
Parameters
$memID : int

The member ID

$sa : null|string = null

The subaction

$updateRequest : bool = false

Whether to update $_REQUEST['u']

$loadSelfFirst : bool = true

Whether to load the current user's profile first

$loadProfile : bool = false

Whether to load the profile of the specified member

$defaultSettings : bool = false

Not used?

__construct()

Constructor. Protected to force instantiation via self::load().

protected __construct() : mixed

buildActionRoute()

Builds a routing path for an action based on URL query parameters.

protected static buildActionRoute(array<string|int, mixed> &$params) : array<string|int, mixed>

The 'action', 'area', and 'sa' parameters will be mapped to route path components in that order. The 'action' parameter is required, whereas 'area' and 'sa' are optional and will be silently skipped if not set.

The parameters are passed by reference and parameters are removed from the array when recognized. This lets wrapper methods continue parsing the remainder of the parameters without worrying about duplicate elements.

Parameters
$params : array<string|int, mixed>

URL query parameters.

Return values
array<string|int, mixed>

The route path elements.

parseActionRoute()

Parses a route for an action to get URL query parameters.

protected static parseActionRoute(array<string|int, mixed> &$route) : array<string|int, mixed>

The first element of the route path is mapped to the 'action' parameter.

For the 'admin', 'moderate', and 'profile' actions, the second element of the route is mapped to the 'area' parameter and the third element is mapped to the 'sa' parameter.

For all other actions, the second element of the route path is mapped to the 'sa' parameter.

The route passed by reference and route path elements are removed from the route when recognized. This lets wrapper methods continue parsing the remainder of the route without worrying about duplicate elements.

Parameters
$route : array<string|int, mixed>

Array of routing path components.

Return values
array<string|int, mixed>

URL query parameters


        
On this page

Search results