Site
in package
Installation-wide site config. One row (site_id = 1).
body is the public landing HTML. Empty / NULL means index.php uses its built-in welcome text unless json.use_catalog is true, in which case the public landing page is the course catalog.
Table of Contents
Constants
- SITE_ID : mixed = 1
Properties
- $purifier : HTMLPurifier|null
Methods
- body() : string|null
- Stored landing HTML, or null when there is no custom copy.
- clear() : mixed
- Drop the custom landing page. Other json flags stay. The row is removed only when nothing else is stored.
- isEmptyHtml() : mixed
- Blank, NULL, or CKEditor empty markup (e.g. <p> </p>).
- jsonFlag() : mixed
- True when $json is an object with a non-empty $key.
- mergeJsonFlag() : array<string, mixed>
- Copy $json and set or remove one boolean flag.
- purify() : mixed
- save() : bool
- Save landing HTML and/or catalog-as-landing.
- tableExists() : mixed
- True when the site table exists (after database upgrade).
- useCatalog() : mixed
- True when index.php should render the course catalog instead of HTML.
- deleteRow() : mixed
- Remove the singleton row.
- encodeJson() : string|null
- jsonArray() : array<string, mixed>
- purifier() : mixed
- row() : array{site_id: mixed, body: ?string, json: ?string}|null
- write() : mixed
Constants
SITE_ID
public
mixed
SITE_ID
= 1
Properties
$purifier
private
static HTMLPurifier|null
$purifier
= null
Methods
body()
Stored landing HTML, or null when there is no custom copy.
public
static body() : string|null
Catalog-as-landing does not count as a custom body.
Return values
string|nullclear()
Drop the custom landing page. Other json flags stay. The row is removed only when nothing else is stored.
public
static clear() : mixed
isEmptyHtml()
Blank, NULL, or CKEditor empty markup (e.g. <p> </p>).
public
static isEmptyHtml(mixed $html) : mixed
An image-only body is not empty.
Parameters
- $html : mixed
jsonFlag()
True when $json is an object with a non-empty $key.
public
static jsonFlag(mixed $json, string $key) : mixed
Parameters
- $json : mixed
- $key : string
mergeJsonFlag()
Copy $json and set or remove one boolean flag.
public
static mergeJsonFlag(mixed $json, string $key, bool $on) : array<string, mixed>
Parameters
- $json : mixed
- $key : string
- $on : bool
Return values
array<string, mixed>purify()
public
static purify(mixed $html) : mixed
Parameters
- $html : mixed
save()
Save landing HTML and/or catalog-as-landing.
public
static save(mixed $html[, bool $use_catalog = false ]) : bool
Empty HTML with catalog off drops the landing page. A row remains when another site flag, such as anonymous lessons, is still on.
Parameters
- $html : mixed
- $use_catalog : bool = false
Return values
bool —True when a site row is stored, false when the default is used.
tableExists()
True when the site table exists (after database upgrade).
public
static tableExists() : mixed
useCatalog()
True when index.php should render the course catalog instead of HTML.
public
static useCatalog() : mixed
deleteRow()
Remove the singleton row.
private
static deleteRow() : mixed
encodeJson()
private
static encodeJson(array<string, mixed> $data) : string|null
Parameters
- $data : array<string, mixed>
Return values
string|nulljsonArray()
private
static jsonArray(mixed $json) : array<string, mixed>
Parameters
- $json : mixed
Return values
array<string, mixed>purifier()
private
static purifier() : mixed
row()
private
static row() : array{site_id: mixed, body: ?string, json: ?string}|null
Return values
array{site_id: mixed, body: ?string, json: ?string}|nullwrite()
private
static write(string|null $body, array<string, mixed> $data) : mixed
Parameters
- $body : string|null
- $data : array<string, mixed>