PHP 클래스 Phergie_Plugin_Url, phergie

Has an utility method accessible via $this->getPlugin('Url')->getTitle('http://foo..').
저자: Phergie Development Team ([email protected])
상속: extends Phergie_Plugin_Abstract
파일 보기 프로젝트 열기: phergie/phergie

보호된 프로퍼티들

프로퍼티 타입 설명
$cache Phergie_Plugin_Cache Cache object to store cached URLs to prevent spamming, especially with more than one bot on the same channel.
$errorMessage
$errorStatus boolean Flag that is set to true by the custom error handler if an HTTP error code has been received
$expire integer Setting it to 0 or below disables the cache expiration
$limit integer Setting it to 0 or below disables the cache limit
$renderers Array of renderers
$shortener Shortener object
$sslFallback boolean Flag that determines if the plugin will fall back to using an HTTP stream when a URL using SSL is detected and OpenSSL support isn't available in the PHP installation in use

공개 메소드들

메소드 설명
findUrls ( string $message ) : array Detect URLs in a given string.
getTitle ( string $url ) : string Returns the title of the given page
onAction ( ) : void Checks an incoming message for the presence of a URL and, if one is found, responds with its title if it is an HTML document and the shortened equivalent of its original URL if it meets length requirements.
onLoad ( ) : void Checks for dependencies.
onPrivmsg ( ) : void Checks an incoming message for the presence of a URL and, if one is found, responds with its title if it is an HTML document and the shortened equivalent of its original URL if it meets length requirements.
preDispatch ( ) : void Processes events before they are dispatched and tries to shorten any urls in the text
registerRenderer ( object $obj ) : void Add a renderer to the stack

보호된 메소드들

메소드 설명
checkUrlCache ( string $url, string $shortenedUrl ) : boolean Checks a given URL (+shortened) against the cache to verify if they were previously posted on the channel.
checkValidIP ( string $ip ) : boolean Checks the given string to see if its a valid IP4 address
debug ( string $msg ) : void Output a debug message
decode ( string $str, integer $trim = null ) : string Transliterates a UTF-8 string into corresponding ASCII characters and truncates and appends an ellipsis to the string if it exceeds a given length.
getUrlChecksum ( string $url ) : string Takes a url, parses and cleans the URL without of all the junk and then return the hex checksum of the url.
glueUrl ( string $uri, string $base = false ) : string Parses a given URI and then glues it back together in the proper format.
handleMsg ( ) : void Handles message events and responds with url titles.
parseUrl ( string $url ) : array Parses a given URI and procceses the output to remove redundant or missing values.
updateUrlCache ( string $url, string $shortenedUrl ) : boolean Updates the cache and adds the given URL (+shortened) to the cache. It also handles cleaning the cache of old entries as well.

메소드 상세

checkUrlCache() 보호된 메소드

Checks a given URL (+shortened) against the cache to verify if they were previously posted on the channel.
protected checkUrlCache ( string $url, string $shortenedUrl ) : boolean
$url string The URL to check against
$shortenedUrl string The shortened URL to check against
리턴 boolean

checkValidIP() 보호된 메소드

Checks the given string to see if its a valid IP4 address
protected checkValidIP ( string $ip ) : boolean
$ip string the ip to validate
리턴 boolean

debug() 보호된 메소드

Output a debug message
protected debug ( string $msg ) : void
$msg string the message to output
리턴 void

decode() 보호된 메소드

Transliterates a UTF-8 string into corresponding ASCII characters and truncates and appends an ellipsis to the string if it exceeds a given length.
protected decode ( string $str, integer $trim = null ) : string
$str string String to decode
$trim integer Maximum string length, optional
리턴 string

findUrls() 공개 메소드

Detect URLs in a given string.
public findUrls ( string $message ) : array
$message string the string to detect urls in
리턴 array the array of urls found

getTitle() 공개 메소드

Returns the title of the given page
public getTitle ( string $url ) : string
$url string url to the page
리턴 string title

getUrlChecksum() 보호된 메소드

Takes a url, parses and cleans the URL without of all the junk and then return the hex checksum of the url.
protected getUrlChecksum ( string $url ) : string
$url string url to checksum
리턴 string the hex checksum of the cleaned url

glueUrl() 보호된 메소드

If base is set, then it chops off the scheme, user and pass and fragment information to return a more unique base URI.
protected glueUrl ( string $uri, string $base = false ) : string
$uri string uri to rebuild
$base string set to true to only return the base components
리턴 string the rebuilt uri

handleMsg() 보호된 메소드

Handles message events and responds with url titles.
protected handleMsg ( ) : void
리턴 void

onAction() 공개 메소드

Checks an incoming message for the presence of a URL and, if one is found, responds with its title if it is an HTML document and the shortened equivalent of its original URL if it meets length requirements.
public onAction ( ) : void
리턴 void

onLoad() 공개 메소드

Checks for dependencies.
public onLoad ( ) : void
리턴 void

onPrivmsg() 공개 메소드

Checks an incoming message for the presence of a URL and, if one is found, responds with its title if it is an HTML document and the shortened equivalent of its original URL if it meets length requirements.
public onPrivmsg ( ) : void
리턴 void

parseUrl() 보호된 메소드

Parses a given URI and procceses the output to remove redundant or missing values.
protected parseUrl ( string $url ) : array
$url string the url to parse
리턴 array the url components

preDispatch() 공개 메소드

Processes events before they are dispatched and tries to shorten any urls in the text
public preDispatch ( ) : void
리턴 void

registerRenderer() 공개 메소드

Add a renderer to the stack
public registerRenderer ( object $obj ) : void
$obj object the renderer to add
리턴 void

updateUrlCache() 보호된 메소드

Updates the cache and adds the given URL (+shortened) to the cache. It also handles cleaning the cache of old entries as well.
protected updateUrlCache ( string $url, string $shortenedUrl ) : boolean
$url string The URL to add to the cache
$shortenedUrl string The shortened to add to the cache
리턴 boolean

프로퍼티 상세

$cache 보호되어 있는 프로퍼티

Cache object to store cached URLs to prevent spamming, especially with more than one bot on the same channel.
protected Phergie_Plugin_Cache $cache
리턴 Phergie_Plugin_Cache

$errorMessage 보호되어 있는 프로퍼티

protected $errorMessage

$errorStatus 보호되어 있는 프로퍼티

Flag that is set to true by the custom error handler if an HTTP error code has been received
protected bool $errorStatus
리턴 boolean

$expire 보호되어 있는 프로퍼티

Setting it to 0 or below disables the cache expiration
protected int $expire
리턴 integer

$limit 보호되어 있는 프로퍼티

Setting it to 0 or below disables the cache limit
protected int $limit
리턴 integer

$renderers 보호되어 있는 프로퍼티

Array of renderers
protected $renderers

$shortener 보호되어 있는 프로퍼티

Shortener object
protected $shortener

$sslFallback 보호되어 있는 프로퍼티

Flag that determines if the plugin will fall back to using an HTTP stream when a URL using SSL is detected and OpenSSL support isn't available in the PHP installation in use
protected bool $sslFallback
리턴 boolean