class OldPageRedirector extends Extension

Methods

__construct()

No description

from Extension
static 
add_to_class(string $class, string $extensionClass, mixed $args = null)

Called when this extension is added to a particular class

from Extension
setOwner(object $owner)

Set the owner of this extension.

from Extension
mixed
withOwner(mixed $owner, callable $callback, array $args = [])

Temporarily modify the owner. The original owner is ensured to be restored

from Extension
clearOwner()

Clear the current owner, and restore extension to the state prior to the last setOwner()

from Extension
Object
getOwner()

Returns the owner of this extension.

from Extension
static string
get_classname_without_arguments(string $extensionStr)

Helper method to strip eval'ed arguments from a string that's passed to {@link DataObject::$extensions} or {@link Object::add_extension()}.

from Extension
mixed
invokeExtension(object $owner, string $method, array $arguments)

Invoke extension point. This will prefer explicit extend prefixed methods.

from Extension
onBeforeHTTPError404(HTTPRequest $request)

On every URL that generates a 404, we'll capture it here and see if we can find an old URL that it should be redirecting to.

static string|boolean
find_old_page(array $params, SiteTree|null $parent = null, boolean $redirect = false)

Attempt to find an old/renamed page from some given the URL as an array

Details

in Extension at line 39
__construct()

in Extension at line 50
static add_to_class(string $class, string $extensionClass, mixed $args = null)

Called when this extension is added to a particular class

Parameters

string $class
string $extensionClass
mixed $args

in Extension at line 60
setOwner(object $owner)

Set the owner of this extension.

Parameters

object $owner The owner object

in Extension at line 74
mixed withOwner(mixed $owner, callable $callback, array $args = [])

Temporarily modify the owner. The original owner is ensured to be restored

Parameters

mixed $owner Owner to set
callable $callback Callback to invoke
array $args Args to pass to callback

Return Value

mixed

in Extension at line 87
clearOwner()

Clear the current owner, and restore extension to the state prior to the last setOwner()

in Extension at line 100
Object getOwner()

Returns the owner of this extension.

Return Value

Object

in Extension at line 113
static string get_classname_without_arguments(string $extensionStr)

Helper method to strip eval'ed arguments from a string that's passed to {@link DataObject::$extensions} or {@link Object::add_extension()}.

Parameters

string $extensionStr E.g. "Versioned('Stage','Live')"

Return Value

string Extension classname, e.g. "Versioned"

in Extension at line 128
mixed invokeExtension(object $owner, string $method, array $arguments)

Invoke extension point. This will prefer explicit extend prefixed methods.

Parameters

object $owner
string $method
array $arguments &...$arguments

Return Value

mixed

at line 23
onBeforeHTTPError404(HTTPRequest $request)

On every URL that generates a 404, we'll capture it here and see if we can find an old URL that it should be redirecting to.

Parameters

HTTPRequest $request The request object

Exceptions

HTTPResponse_Exception

at line 60
static string|boolean find_old_page(array $params, SiteTree|null $parent = null, boolean $redirect = false)

Attempt to find an old/renamed page from some given the URL as an array

Parameters

array $params The array of URL, e.g. /foo/bar as array('foo', 'bar')
SiteTree|null $parent The current parent in the recursive flow
boolean $redirect Whether we've found an old page worthy of a redirect

Return Value

string|boolean False, or the new URL