WiseLoop PHP Web Media Grabber 3.1.1
Advanced PHP web resources extractor
wlWmgMedia Class Reference

Public Member Functions

 __construct ($processor, $url=null)
 setUrl ($url)
 getCurl ()
 getUrl ()
 getTagName ()
 setSearchString ($search)
 getSearchString ()
 setFullTag ($fullTag)
 getFullTag ()
 setTagContent ($tagContent)
 getTagContent ()
 getSrcIni ()
 getGrabber ()
 setParentMedia ($media)
 getParentMedia ()
 getExists ()
 getSize ()
 getContentType ()
 getResponse ()
 setAttribute ($name, $value, $persistent=false)
 getAttribute ($name)
 getAttributes ()
 setAttributes ($attributes)
 hasAttributes ()
 getLocalDownloadFile ()
 getGrabbedUrl ()
 getLocalFileName ()
 download ()
 deleteDownload ()

Private Member Functions

 getHeaders ()
 getLocalCacheFile ($attribute)
 getLocalDownloadUrl ()

Private Attributes

 $_urlIni
 $_curl
 $_fullTag
 $_tagContent
 $_searchString
 $_headers
 $_attributes
 $_processor
 $_parent

Detailed Description

WiseLoop Web Media Grabber Media class definition
An object of this class represents a downloadable web media resource; it can be anything: image, video, flash application, css file, javascript file, a document etc.
This class provides needed functions to handle web media such as getting HTML response headers, contents, size, content-type, url, getting and setting various attributes, downloading etc.

Author:
WiseLoop

Constructor & Destructor Documentation

__construct ( processor,
url = null 
)

Constructor.
Creates a media object.

Parameters:
wlWmgProcessor$processorthe parent media grabber processor
string$urlthe initial media url
Returns:
wlWmgMedia
See also:
wlWmgProcessor

Member Function Documentation

deleteDownload ( )

Deletes the downloaded media from the localhost.

Returns:
void
download ( )

Downloads the media to localhost.

Returns:
string the local file name
getAttribute ( name)

Returns a various media attribute.

Parameters:
string$namethe attribute name
Returns:
string the attribute value, or null if the attribute name does not exists for the current media
getAttributes ( )

Returns the media attributes array.

Returns:
array the media attributes
getContentType ( )

Returns the media HTTP content-type.

Returns:
string the content-type string
getCurl ( )

Returns the media curl object.

Returns:
wlCurl the curl object
See also:
wlCurl
getExists ( )

Tests if the media url exists.

Returns:
bool if the media url exists
getFullTag ( )

Returns the full tag that envelopes the actual media url.

Returns:
string the full tag
getGrabbedUrl ( )

Returns the grabbed media url - ie. if the media was downloaded, the local download url will be returned, else, the media internet url will be returned; practically this is the method that returns the media url to be used after grabbing.

Returns:
string the grabbed media url
getGrabber ( )

Returns the parent media grabber processor object that founded the current media.

Returns:
wlWmgProcessor the web media grabbed processor
See also:
wlWmgProcessor
getHeaders ( ) [private]

Returns and computes if necessary the cached HTTP response headers of the current media $_curl object.

Returns:
array the headers
getLocalCacheFile ( attribute) [private]

Returns the media local cache file path for a specified attribute name.

Parameters:
string$attributethe attribute name
Returns:
string the local cache file path
getLocalDownloadFile ( )

Returns the media local download file path.

Returns:
string the local download file path
getLocalDownloadUrl ( ) [private]

Returns the media local download url.

Returns:
string the media local download url
getLocalFileName ( )

Computes and return the local file name for the current media.

Returns:
string the local file name
getParentMedia ( )

Returns the parent media (ex. the image thumbnail that leads to current full size image media).

Returns:
wlWmgMedia
getResponse ( )

Returns the media HTTP response.

Returns:
string the HTTP response
getSearchString ( )

Returns the media search string that was used to search through the grabbed targeted url page; obviously the search was successful, the current media was founded.

Returns:
string the search string
getSize ( )

Returns the media size (in bytes).

Returns:
float the media size, or -1 if the size could not be measured
getSrcIni ( )

Returns the initial media url (it can be invalid if its path is relative to the grabbed targeted url page).

Returns:
string the initial media url
getTagContent ( )

Returns the inner HTML content of the full tag that envelopes the actual media url.

Returns:
string the full tag
getTagName ( )

Computes and returns only the tag name that envelopes the media url.

Returns:
string the tag name
getUrl ( )

Returns the media url string.

Returns:
string the url string
hasAttributes ( )

Tests if the current media has attributes.

Returns:
bool if media has attributes
setAttribute ( name,
value,
persistent = false 
)

Sets a various media attribute.

Parameters:
string$namethe attribute name
string$valuethe attribute value
bool$persistentif the attribute should be saved in cache for future usage
Returns:
void
setAttributes ( attributes)

Sets the media attributes array.

Parameters:
array$attributesthe new attributes
Returns:
void
setFullTag ( fullTag)

Sets the full tag that envelopes the actual media url.

Parameters:
string$fullTagthe full tag string
Returns:
void
setParentMedia ( media)

Sets the parent media (ex. the image thumbnail that leads to current full size image media).

Parameters:
wlWmgMedia$media
Returns:
void
setSearchString ( search)

Sets the media search string

Parameters:
string$searchthe search string
Returns:
void
setTagContent ( tagContent)

Sets the inner HTML content of the full tag that envelopes the actual media url.

Parameters:
string$tagContentthe tag content
Returns:
void
setUrl ( url)

Sets the media url.

Parameters:
string$urlthe url string
Returns:
void

Field Documentation

$_attributes [private]

Type: array - various cached attributes for the current media (ex. width and height for images)

$_curl [private]

Type: wlCurl - the curl object for the current media

$_fullTag [private]

Type: string - the full tag description that envelopes the actual media url

$_headers [private]

Type: array - the cached HTTP response headers returned by the $_curl object

See also:
$_curl
$_parent [private]

Type: wlWmgMedia - the parent media (ex. the image thumbnail that leads to current full size image media)

$_processor [private]

Type: wlWmgProcessor - the parent media grabber processor object that founded the current media

See also:
wlWmgProcessor
$_searchString [private]

Type: string - the string that was used to search through the grabbed targeted url page; obviously the search was successful, the current media was founded

$_tagContent [private]

Type: string - the inner HTML of the $_fullTag

$_urlIni [private]

Type: string - the initial media url (it can be invalid if its path is relative to the grabbed targeted url page)


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables