ManiaLib 1.0b1 API Reference

 Class RequestEngine

Description

Request engine

The Request Engine helps handling GET variables and referers as well as creating links and redirection. It also handles session ID propagation when the client doesn't accept cookies.

Located in /libraries/RequestEngine.class.php (line 17)


	
			
Direct descendents
Class Description
 class RequestEngineMVC RequestEngine designed for MVC framework
Method Summary
 string createAbsoluteLinkArgList (string $absoluteLink)
 string createLink ([string $file = null], [boolean $relativePath = true])
 string createLinkArgList ([string $file = null])
 void delete (string $name)
 mixed get (string $name, [mixed $default = null])
 void getReferer ([string $default = null])
 mixed getStrict (string $name, [string $message = null])
 void redirectManialink ([string $file = 'index.php'])
 void redirectManialinkAbsolute (string $absoluteUri)
 void registerGlobalParam (string $name)
 void registerProtectedParam (string $name)
 void registerReferer ()
 void restore (string $name)
 void set (string $name, mixed $value)
Methods
static getInstance (line 38)

Use this methode to retrieve a reference on the request object from anywhere in the code

  • access: public
RequestEngine getInstance ()

Redefined in descendants as:
createAbsoluteLinkArgList (line 198)

Returns an URL with the request parameters specified as method arguments

string createAbsoluteLinkArgList (string $absoluteLink)
  • string $absoluteLink: The absolute URL
createLink (line 158)

Returns an URL containing all the currently defined GET parameters

Example:

  1.  // Current page: http://url/index.php?toto=a&foo=bar
  2.  $request RequestEngine::getInstance();
  3.  $request->createLink('page.php')// Returns http://url/page.php?toto=a&foo=bar

string createLink ([string $file = null], [boolean $relativePath = true])
  • string $file: The filename
  • boolean $relativePath: Whether the first parameter is a relative URL (default: true). Set this parameter to false if you want to create and external link.

Redefined in descendants as:
createLinkArgList (line 178)

Returns an URL with the request parameters specified as method arguments (eg. )

Example:

  1.  // Current page: http://url/index.php?toto=a&foo=bar&bla=bla
  2.  $request RequestEngine::getInstance();
  3.  $request->createLinkArgList("page.php""toto""bla")// Returns http://url/page.php?toto=a&bla=bla

string createLinkArgList ([string $file = null])
  • string $file: The filename (eg: "index.php" or "admin/login.php")

Redefined in descendants as:
delete (line 120)

Deletes a GET parameter

void delete (string $name)
  • string $name
get (line 68)

Retrieves a GET parameter, or the default value if not found

mixed get (string $name, [mixed $default = null])
  • string $name
  • mixed $default
getReferer (line 299)

Returns the referer, or the specified default page, or index.php

void getReferer ([string $default = null])
  • string $default
getStrict (line 88)

Retrieves a GET parameter, or throws an exception if not found or null

  • throws: RequestParameterNotFoundException
mixed getStrict (string $name, [string $message = null])
  • string $name
  • string $message: Optional human readable name for error dialog
redirectManialink (line 224)

Creates a Manialink redirection to the specified file with GET parameters specified as method arguments.

Example:

  1.  $request->redirectManialink("index.php""param1""param2");

void redirectManialink ([string $file = 'index.php'])
  • string $file: The filename of the link target

Redefined in descendants as:
redirectManialinkAbsolute (line 239)

Creates a Manialink redirection to the specified absolute URI

void redirectManialinkAbsolute (string $absoluteUri)
  • string $absoluteUri
redirectToReferer (line 248)

Creates a Manialink redirection to the previously registered referer, or

the index if no referer was previously registered

void redirectToReferer ()
registerGlobalParam (line 271)

Registers the "$name" parameter as protected parameters. Global parameters atr always removed from the parameter array and saved as a session parameter when the page is loaded.

void registerGlobalParam (string $name)
  • string $name
registerProtectedParam (line 259)

Registers the '$name' parameter as protected parameters. Protected parameters are always removed from the parameter array when the page is loaded.

void registerProtectedParam (string $name)
  • string $name
registerReferer (line 288)

Registers the current page as referer

void registerReferer ()
restore (line 130)

Restores a GET parameter to the value it had when the page was loaded

void restore (string $name)
  • string $name
set (line 110)

Sets a GET parameter

void set (string $name, mixed $value)
  • string $name
  • mixed $value