Documentation

Subsites
in package

Provides functions for getting information about subsites

Table of Contents

Properties

$configs  : mixed
$default  : mixed
$subsites  : mixed

Methods

checkRequireSubsite()  : void
Assert that this request requires a valid subsite.
getAbsRoot()  : string
Returns the abs root (including protocol and server name) of the specified subsite Falls back to the current root if no abs root can be found in the database
getAbsRootAdmin()  : mixed
Returns the abs root (including protocol and server name) of the current admin subsite
getCode()  : mixed
Returns the name of the specified subsite
getCodes()  : array<string|int, mixed>
Gets the list of subsite codes which are available, by reading the appropriate directory
getConfig()  : mixed
Get a config value for a given subsite
getConfigAdmin()  : mixed
Admin version of the getConfig function, uses the currently active subsite
getDefaultSubsite()  : array<string|int, mixed>
Get the default subsite.
getFirstAccessable()  : mixed
Returns the id of the first subsite in the list (alphabetical) that the user is able to access.
getName()  : mixed
Returns the name of the specified subsite
getSubsiteByCode()  : null|array<string|int, mixed>
Get a subsite by code.
getSubsiteById()  : null|array<string|int, mixed>
Get a subsite by ID.
hasMultiple()  : bool
Determines if multiple subsites can be accessed by the currently logged in administrator
listSelector()  : mixed
Outputs a select UL for choosing a subsite from within the admin area
loadConfig()  : array<string|int, mixed>
Load the configuration for a subsite code.
requireSubsite()  : bool
Does this request require a subsite?
determineBestDomain()  : mixed
For a given list of domains, determine the best match based on the current HTTP_HOST
loadSubsites()  : mixed
Loads all the subsites into memory, ready for further processing

Properties

$configs

private static mixed $configs = null

$default

private static mixed $default = null

$subsites

private static mixed $subsites = null

Methods

checkRequireSubsite()

Assert that this request requires a valid subsite.

public static checkRequireSubsite() : void
Tags
throws
Exception

getAbsRoot()

Returns the abs root (including protocol and server name) of the specified subsite Falls back to the current root if no abs root can be found in the database

public static getAbsRoot(int $id[, string $protocol = null ]) : string
Parameters
$id : int

The subsite ID, e.g. SubsiteSelector::$subsite_id

$protocol : string = null

The protocol to use for the link. Specifying null (the default) will cause the protocol to be automatically determined based on the request.

Return values
string —

An absolute URL including protocol

getAbsRootAdmin()

Returns the abs root (including protocol and server name) of the current admin subsite

public static getAbsRootAdmin() : mixed

getCode()

Returns the name of the specified subsite

public static getCode(mixed $id) : mixed
Parameters
$id : mixed

getCodes()

Gets the list of subsite codes which are available, by reading the appropriate directory

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

getConfig()

Get a config value for a given subsite

public static getConfig(string $key, int $subsite_id) : mixed

Use this instead of Kohana::config, if you need to target a specific subsite. It always looks in the "sprout" config file, doesn't support other files.

Parameters
$key : string

Configuration key

$subsite_id : int

Subsite to get config value for

Return values
mixed —

Configuration value

getConfigAdmin()

Admin version of the getConfig function, uses the currently active subsite

public static getConfigAdmin(mixed $key) : mixed
Parameters
$key : mixed

getDefaultSubsite()

Get the default subsite.

public static getDefaultSubsite() : array<string|int, mixed>

This is the 'first' subsite in the list.

OR if the database is not available, a pseudo 'default' subsite instead.

Return values
array<string|int, mixed> —

db row

getFirstAccessable()

Returns the id of the first subsite in the list (alphabetical) that the user is able to access.

public static getFirstAccessable() : mixed

Returns null if there are no subsites the user can access.

getName()

Returns the name of the specified subsite

public static getName(mixed $id) : mixed
Parameters
$id : mixed

getSubsiteByCode()

Get a subsite by code.

public static getSubsiteByCode(string $code) : null|array<string|int, mixed>
Parameters
$code : string
Return values
null|array<string|int, mixed> —

db row

getSubsiteById()

Get a subsite by ID.

public static getSubsiteById(int $id) : null|array<string|int, mixed>
Parameters
$id : int
Return values
null|array<string|int, mixed> —

db row

hasMultiple()

Determines if multiple subsites can be accessed by the currently logged in administrator

public static hasMultiple() : bool
Return values
bool —

True if multiple subsites are available, false if they are not

listSelector()

Outputs a select UL for choosing a subsite from within the admin area

public static listSelector([int $selected_id = null ]) : mixed
Parameters
$selected_id : int = null

The currently selected subsite, if any

loadConfig()

Load the configuration for a subsite code.

public static loadConfig(string $subsite_code) : array<string|int, mixed>

It will only be loaded once per request - it gets cached in a static var

Parameters
$subsite_code : string

The subsite code to load and return config for

Return values
array<string|int, mixed> —

Configuration for that subsite

requireSubsite()

Does this request require a subsite?

public static requireSubsite() : bool
Return values
bool

determineBestDomain()

For a given list of domains, determine the best match based on the current HTTP_HOST

private static determineBestDomain(mixed $domains) : mixed

If there is an exact match, it is used If there is an ends-with match, it is used Failing all that, the first domain in the list is used

Parameters
$domains : mixed

loadSubsites()

Loads all the subsites into memory, ready for further processing

private static loadSubsites() : mixed
On this page

Search results