Plib_XH

Response
in package

FinalYes

The (partial) response to a CMSimple_XH page request

This class encapsulates access to some of CMSimple_XH globals, e.g. $o and $title, as well as sending of cookies, redirecting to another page, and generally calls to header(), and http_response_code().

A Response does not cause any side-effects until it is invoked.

Table of Contents

Methods

__invoke()  : string|never
attachment()  : string|null
bjs()  : string|null
canonicalParams()  : array<int, string>|null
contentType()  : string|null
cookie()  : array{: string, : string, : int}|null
create()  : self
description()  : string|null
error()  : self
hjs()  : string|null
length()  : int|null
location()  : string|null
output()  : string
redirect()  : self
status()  : int
title()  : string|null
withAttachment()  : self
withBjs()  : self
withCanonicalParams()  : self
Adds the parameters to the canonical link of the page
withContentType()  : self
withCookie()  : self
Set a cookie for the whole CMSimple_XH installation
withDescription()  : self
Changes $tx[meta][description]
withHjs()  : self
Appends to $hjs
withLength()  : self
withTitle()  : self

Methods

__invoke()

public __invoke() : string|never
Return values
string|never

attachment()

public attachment() : string|null
Return values
string|null

bjs()

public bjs() : string|null
Tags
since
1.2
Return values
string|null

canonicalParams()

public canonicalParams() : array<int, string>|null
Tags
since
1.8
Return values
array<int, string>|null

contentType()

public contentType() : string|null
Return values
string|null
public cookie() : array{: string, : string, : int}|null
Return values
array{: string, : string, : int}|null

create()

public static create([string $output = "" ]) : self
Parameters
$output : string = ""
Return values
self

description()

public description() : string|null
Tags
since
1.8
Return values
string|null

error()

public static error(int $status[, string $output = "" ]) : self
Parameters
$status : int
$output : string = ""
Return values
self

hjs()

public hjs() : string|null
Tags
since
1.3
Return values
string|null

length()

public length() : int|null
Return values
int|null

location()

public location() : string|null
Return values
string|null

output()

public output() : string
Return values
string

redirect()

public static redirect(string $location) : self
Parameters
$location : string
Return values
self

status()

public status() : int
Return values
int

title()

public title() : string|null
Return values
string|null

withAttachment()

public withAttachment(string $attachment) : self
Parameters
$attachment : string
Return values
self

withBjs()

public withBjs(string $bjs) : self
Parameters
$bjs : string
Tags
since
1.2
Return values
self

withCanonicalParams()

Adds the parameters to the canonical link of the page

public withCanonicalParams(array<int, string> $params) : self

A simple wrapper over the $CanonicalLinkInc API that is available as of CMSimple_XH 1.8, and may need to be explicitly enabled in the configuration.

Parameters
$params : array<int, string>
Tags
since
1.8
Return values
self

withContentType()

public withContentType(string $contentType) : self
Parameters
$contentType : string
Return values
self

withCookie()

Set a cookie for the whole CMSimple_XH installation

public withCookie(string $name, string $value, int $expires) : self
Parameters
$name : string
$value : string
$expires : int
Tags
link
https://github.com/cmb69/plib_xh/issues/1
Return values
self

withDescription()

Changes $tx[meta][description]

public withDescription(string $description) : self

Must only be called, if there is no chance that the core language will be saved during the request.

Parameters
$description : string
Tags
since
1.8
Return values
self

withHjs()

Appends to $hjs

public withHjs(string $hjs) : self

This does not work from templates, and therefore is better avoided, but sometimes it is just necessary.

Parameters
$hjs : string
Tags
since
1.3
Return values
self

withLength()

public withLength(int $length) : self
Parameters
$length : int
Return values
self

withTitle()

public withTitle(string $title) : self
Parameters
$title : string
Return values
self

        
On this page

Search results