Class SimplePage

Description

A wrapper for a web page.

Located in /page.php (line 24)


	
			
Method Summary
 static string normalise (string $html)
 SimplePage __construct ([SimpleHttpResponse $response = false])
 void addLink (SimpleAnchorTag $tag)
 void clearFrameFocus ()
 string getAuthentication ()
 string/boolean getField (SimpleSelector $selector)
 SimpleForm getFormById (string $id)
 SimpleForm getFormByImage (SimpleSelector $selector)
 SimpleForm getFormBySubmit (SimpleSelector $selector)
 array getFrameFocus ()
 array/string getFrames ()
 boolean/array getFrameset ()
 string getHeaders ()
 string getMethod ()
 string getMimeType ()
 string getRaw ()
 string getRealm ()
 mixed getRequest ()
 mixed getRequestData ()
 integer getResponseCode ()
 string getText ()
 string getTitle ()
 string getTransportError ()
 SimpleUrl getUrlById (string $id)
 SimpleUrl getUrlFromLink (SimpleAnchor $link)
 array getUrls ()
 array getUrlsByLabel (string $label)
 boolean hasFrames ()
 boolean linkIsAbsolute (string $url)
 void noResponse ()
 void setBase (string $url)
 boolean setField (SimpleSelector $selector, string $value, [ $position = false])
 void setForms (array $forms)
 boolean setFrameFocus (string $name)
 boolean setFrameFocusByIndex (integer $choice)
 void setFrames ( $frames)
 void setTitle (SimpleTitleTag $tag)
Methods
static normalise (line 532)

Turns HTML into text browser visible text. Images are converted to their alt text and tags are supressed.

Entities are converted to their visible representation.

  • return: Plain text.
  • access: public
string normalise (string $html)
  • string $html: HTML to convert.
Constructor __construct (line 46)

Parses a page ready to access it's contents.

  • access: public
SimplePage __construct ([SimpleHttpResponse $response = false])
addLink (line 280)

Adds a link to the page.

void addLink (SimpleAnchorTag $tag)
clearFrameFocus (line 255)

Clears the frame focus. Does nothing for a leaf page.

  • access: public
void clearFrameFocus ()
expandUrl (line 401)

Expands expandomatic URLs into fully qualified URLs.

  • return: Absolute URL.
  • access: public
SimpleUrl expandUrl (SimpleUrl $url)
extractResponse (line 59)

Extracts all of the response information.

  • access: protected
void extractResponse (SimpleHttpResponse $response)
getAuthentication (line 201)

Accessor for last Authentication type. Only valid straight after a challenge (401).

  • return: Description of challenge type.
  • access: public
string getAuthentication ()
getBaseUrl (line 149)

Base URL if set via BASE tag page url otherwise

  • return: Base url.
  • access: public
SimpleUrl getBaseUrl ()
getField (line 514)

Accessor for a form element value within a page.

  • return: A string if the field is present, false if unchecked and null if missing.
  • access: public
string/boolean getField (SimpleSelector $selector)
  • SimpleSelector $selector: Field finder.
getFormById (line 479)

Finds a held form by the form ID. A way of identifying a specific form when we have control of the HTML code.

  • return: Form object containing the matching ID.
  • access: public
SimpleForm getFormById (string $id)
  • string $id: Form label.
getFormByImage (line 462)

Finds a held form by image using a selector.

Will only search correctly built forms.

  • return: Form object containing the image.
  • access: public
SimpleForm getFormByImage (SimpleSelector $selector)
  • SimpleSelector $selector: Image finder.
getFormBySubmit (line 445)

Finds a held form by button label. Will only search correctly built forms.

  • return: Form object containing the button.
  • access: public
SimpleForm getFormBySubmit (SimpleSelector $selector)
  • SimpleSelector $selector: Button finder.
getFrameFocus (line 227)

Accessor for current frame focus. Will be false as no frames.

  • return: Always empty.
  • access: public
array getFrameFocus ()
getFrames (line 328)

Fetches a list of loaded frames.

  • return: Just the URL for a single page.
  • access: public
array/string getFrames ()
getFrameset (line 310)

Accessor for frame name and source URL for every frame that will need to be loaded. Immediate children only.

  • return: False if no frameset or otherwise a hash of frame URLs. The key is either a numerical base one index or the name attribute.
  • access: public
boolean/array getFrameset ()
getHeaders (line 119)

Accessor for raw headers of page.

  • return: Header block as text.
  • access: public
string getHeaders ()
getMethod (line 131)

Original request method.

  • return: GET, POST or HEAD.
  • access: public
string getMethod ()
getMimeType (line 176)

Accessor for current MIME type.

  • return: MIME type as string; e.g. 'text/html'
  • access: public
string getMimeType ()
getRaw (line 97)

Accessor for raw text of page.

  • return: Raw unparsed content.
  • access: public
string getRaw ()
getRealm (line 214)

Accessor for last Authentication realm. Only valid straight after a challenge (401).

  • return: Name of security realm.
  • access: public
string getRealm ()
getRequest (line 88)

Original request as bytes sent down the wire.

  • return: Sent content.
  • access: public
mixed getRequest ()
getRequestData (line 158)

Original request data.

  • return: Sent content.
  • access: public
mixed getRequestData ()
getResponseCode (line 188)

Accessor for HTTP response code.

  • return: HTTP response code received.
  • access: public
integer getResponseCode ()
getText (line 107)

Accessor for plain text of page as a text browser would see it.

  • return: Plain text of page.
  • access: public
string getText ()
getTitle (line 430)

Accessor for parsed title.

  • return: Title or false if no title is present.
  • access: public
string getTitle ()
getTransportError (line 167)

Accessor for last error.

  • return: Error from last response.
  • access: public
string getTransportError ()
getUrl (line 140)

Original resource name.

  • return: Current url.
  • access: public
SimpleUrl getUrl ()
getUrlById (line 371)

Accessor for a URL by the id attribute.

  • return: URL with that id of false if none.
  • access: public
SimpleUrl getUrlById (string $id)
  • string $id: Id attribute of link.
getUrlFromLink (line 386)

Converts a link tag into a target URL.

  • return: URL with frame target if any.
  • access: protected
SimpleUrl getUrlFromLink (SimpleAnchor $link)
  • SimpleAnchor $link: Parsed link.
getUrls (line 339)

Accessor for a list of all links.

  • return: List of urls with scheme of http or https and hostname.
  • access: public
array getUrls ()
getUrlsByLabel (line 355)

Accessor for URLs by the link label. Label will match regardess of whitespace issues and case.

  • return: List of links with that label.
  • access: public
array getUrlsByLabel (string $label)
  • string $label: Text of link.
hasFrames (line 297)

Test for the presence of a frameset.

  • return: True if frameset.
  • access: public
boolean hasFrames ()
linkIsAbsolute (line 271)

Test to see if link is an absolute one.

  • return: True if absolute.
  • access: protected
boolean linkIsAbsolute (string $url)
  • string $url: Url to test.
noResponse (line 73)

Sets up a missing response.

  • access: protected
void noResponse ()
setBase (line 413)

Sets the base url for the page.

void setBase (string $url)
  • string $url: Base URL for page.
setField (line 496)

Sets a field on each form in which the field is available.

  • return: True if value is valid.
  • access: public
boolean setField (SimpleSelector $selector, string $value, [ $position = false])
  • SimpleSelector $selector: Field finder.
  • string $value: Value to set field to.
  • $position
setForms (line 288)

Set the forms

void setForms (array $forms)
  • array $forms: An array of SimpleForm objects
setFrameFocus (line 247)

Sets the focus by name. Always fails for a leaf page.

  • return: False as no frames.
  • access: public
boolean setFrameFocus (string $name)
  • string $name: Chosen frame.
setFrameFocusByIndex (line 237)

Sets the focus by index. The integer index starts from 1.

  • return: Always false.
  • access: public
boolean setFrameFocusByIndex (integer $choice)
  • integer $choice: Chosen frame.
setFrames (line 261)

TODO: write docs

void setFrames ( $frames)
  • $frames
setTitle (line 421)

Sets the title tag contents.

void setTitle (SimpleTitleTag $tag)

Documentation generated on Sun, 31 Oct 2010 16:31:54 -0500 by phpDocumentor 1.4.3