Class SimplePage

Description

A wrapper for a web page.

Located in /libraries/pear/simpletest/page.php (line 244)


	
			
Variable Summary
 mixed $_frames
 mixed $_frameset
 mixed $_headers
 mixed $_links
 mixed $_method
 mixed $_open_forms
 mixed $_raw
 mixed $_sent
 mixed $_title
 mixed $_url
Method Summary
 SimplePage SimplePage ([SimpleHttpResponse $response = false])
 void acceptFormEnd ()
 void acceptFrame (SimpleFrameTag &$tag)
 void acceptFramesetStart (SimpleFramesetTag &$tag)
 void acceptTag (SimpleTag &$tag)
 void clearFrameFocus ()
 array getAbsoluteUrls ()
 string getAuthentication ()
 string/boolean getField (string $name)
 string/boolean getFieldById (string/integer $id)
 SimpleForm &getFormById (string $id)
 SimpleForm &getFormByImageLabel (string $label)
 array getFrameFocus ()
 array/string getFrames ()
 boolean/array getFrameset ()
 string getHeaders ()
 string getMethod ()
 string getMimeType ()
 string getRaw ()
 string getRealm ()
 array getRelativeUrls ()
 mixed getRequest ()
 mixed getRequestData ()
 integer getResponseCode ()
 string getTitle ()
 string getTransportError ()
 SimpleUrl getUrlById (string $id)
 array getUrlsByLabel (string $label)
 boolean hasFrames ()
 boolean setField (string $name, string $value)
 boolean setFieldById (string/integer $id, string $value)
 boolean setFrameFocus (string $name)
 boolean setFrameFocusByIndex (integer $choice)
 void _addLink (SimpleAnchorTag $tag)
 SimpleUrl _getUrlFromLink (SimpleAnchor $link)
 boolean _isFormElement (string $name)
 boolean _isLoadingFrames ()
 boolean _isNormalMatch (string $first, string $second)
 boolean _linkIsAbsolute (string $url)
 void _noResponse ()
 string _normalise (string $html)
 void _setTitle (SimpleTitleTag &$tag)
Variables
mixed $_complete_forms (line 248)
mixed $_frames (line 250)
mixed $_frameset (line 249)
mixed $_frameset_nesting_level (line 251)
mixed $_headers (line 255)
mixed $_links (line 245)
mixed $_method (line 256)
mixed $_open_forms (line 247)
mixed $_raw (line 253)
mixed $_request_data (line 258)
mixed $_sent (line 254)
mixed $_title (line 246)
mixed $_transport_error (line 252)
mixed $_url (line 257)
Methods
Constructor SimplePage (line 265)

Parses a page ready to access it's contents.

  • access: public
SimplePage SimplePage ([SimpleHttpResponse $response = false])
acceptFormEnd (line 503)

Closes the most recently opened form.

  • access: public
void acceptFormEnd ()
acceptFormStart (line 495)

Opens a form. New widgets go here.

  • access: public
void acceptFormStart (SimpleFormTag &$tag)
acceptFrame (line 538)

Takes a single frame tag and stashes it in the current frame set.

  • access: public
void acceptFrame (SimpleFrameTag &$tag)
acceptFramesetEnd (line 526)

Closes the most recently opened frameset.

  • access: public
void acceptFramesetEnd ()
acceptFramesetStart (line 515)

Opens a frameset. A frameset may contain nested frameset tags.

  • access: public
void acceptFramesetStart (SimpleFramesetTag &$tag)
  • SimpleFramesetTag $tag: Tag to accept.
acceptTag (line 467)

Adds a tag to the page.

  • access: public
void acceptTag (SimpleTag &$tag)
clearFrameFocus (line 459)

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

  • access: public
void clearFrameFocus ()
getAbsoluteUrls (line 627)

Accessor for a list of all fixed links.

  • return: List of urls with scheme of http or https and hostname.
  • access: public
array getAbsoluteUrls ()
getAuthentication (line 405)

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

  • return: Description of challenge type.
  • access: public
string getAuthentication ()
getField (line 913)

Accessor for a form element value within a page.

Finds the first match.

  • return: A string if the field is present, false if unchecked and null if missing.
  • access: public
string/boolean getField (string $name)
  • string $name: Field name.
getFieldById (line 932)

Accessor for a form element value within a page.

Finds the first match.

  • return: A string if the field is present, false if unchecked and null if missing.
  • access: public
string/boolean getFieldById (string/integer $id)
  • string/integer $id: Field ID attribute.
getFormById (line 860)

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.
getFormByImageId (line 843)

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

  • return: Form object containing the image.
  • access: public
SimpleForm &getFormByImageId (string $id)
  • string $id: Image ID attribute.
getFormByImageLabel (line 811)

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

  • return: Form object containing the image.
  • access: public
SimpleForm &getFormByImageLabel (string $label)
  • string $label: Usually the alt attribute.
getFormByImageName (line 827)

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

  • return: Form object containing the image.
  • access: public
SimpleForm &getFormByImageName (string $name)
  • string $name: Image name.
getFormBySubmitId (line 795)

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

  • return: Form object containing the button.
  • access: public
SimpleForm &getFormBySubmitId (string $id)
  • string $id: Button ID attribute.
getFormBySubmitLabel (line 763)

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

  • return: Form object containing the button.
  • access: public
SimpleForm &getFormBySubmitLabel (string $label)
  • string $label: Button label, default 'Submit'.
getFormBySubmitName (line 779)

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

  • return: Form object containing the button.
  • access: public
SimpleForm &getFormBySubmitName (string $name)
  • string $name: Button name attribute.
getFrameFocus (line 431)

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

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

Fetches a list of loaded frames.

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

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 332)

Accessor for raw headers of page.

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

Original request method.

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

Accessor for current MIME type.

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

Accessor for raw text of page.

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

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

  • return: Name of security realm.
  • access: public
string getRealm ()
getRelativeUrls (line 642)

Accessor for a list of all relative links.

  • return: List of urls without hostname.
  • access: public
array getRelativeUrls ()
getRequest (line 314)

Original request as bytes sent down the wire.

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

Original request data.

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

Accessor for HTTP response code.

  • return: HTTP response code received.
  • access: public
integer getResponseCode ()
getTitle (line 749)

Accessor for parsed title.

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

Accessor for last error.

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

Original resource name.

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

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.
getUrlsByLabel (line 682)

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 584)

Test for the presence of a frameset.

  • return: True if frameset.
  • access: public
boolean hasFrames ()
setField (line 877)

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

  • return: True if value is valid.
  • access: public
boolean setField (string $name, string $value)
  • string $name: Field name.
  • string $value: Value to set field to.
setFieldById (line 895)

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

  • return: True if value is valid.
  • access: public
boolean setFieldById (string/integer $id, string $value)
  • string/integer $id: Field ID attribute.
  • string $value: Value to set field to.
setFrameFocus (line 451)

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 441)

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

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

Adds a link to the page.

  • access: protected
void _addLink (SimpleAnchorTag $tag)
_extractResponse (line 285)

Extracts all of the response information.

  • access: private
void _extractResponse (SimpleHttpResponse $response)
_getUrlFromLink (line 713)

Converts a link into a target URL.

  • return: URL with frame target if any.
  • access: private
SimpleUrl _getUrlFromLink (SimpleAnchor $link)
  • SimpleAnchor $link: Parsed link.
_isFormElement (line 486)

Tests to see if a tag is a possible form element.

  • return: True if form element.
  • access: private
boolean _isFormElement (string $name)
  • string $name: HTML element name.
_isLoadingFrames (line 552)

Test to see if in the middle of reading a frameset.

  • return: True if inframeset.
  • access: private
boolean _isLoadingFrames ()
_isNormalMatch (line 671)

Matches strings regardles of varying whitespace.

  • return: True if matches even with whitespace differences.
  • access: private
boolean _isNormalMatch (string $first, string $second)
  • string $first: First to match with.
  • string $second: Second to match against.
_linkIsAbsolute (line 565)

Test to see if link is an absolute one.

  • return: True if absolute.
  • access: protected
boolean _linkIsAbsolute (string $url)
  • string $url: Url to test.
_makeAbsolute (line 728)

Expands expandomatic URLs into fully qualified URLs.

  • return: Absolute URL.
  • access: protected
SimpleUrl _makeAbsolute (SimpleUrl $url)
_noResponse (line 299)

Sets up a missng response.

  • access: private
void _noResponse ()
_normalise (line 659)

Space at the ends will be stripped and space in between is reduced to one space.

  • return: Content as big string.
  • access: private
string _normalise (string $html)
  • string $html: Typical HTML code.
_setTitle (line 740)

Sets the title tag contents.

  • access: protected
void _setTitle (SimpleTitleTag &$tag)

Documentation generated on Fri, 11 Feb 2005 18:13:43 +0000 by phpDocumentor 1.3.0RC3