PHP Class Twitter_Validation, twitter-text-php

Performs "validation" on tweets. Originally written by {@link http://github.com/mikenz Mike Cochrane}, this is based on code by {@link http://github.com/mzsanford Matt Sanford} and heavily modified by {@link http://github.com/ngnpope Nick Pope}.
Author: Nick Pope ([email protected])
Inheritance: extends Twitter_Regex
Afficher le fichier Open project: ngnpope/twitter-text-php Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( string $tweet ) Reads in a tweet to be parsed and validates it.
create ( string $tweet ) : Twitter_Validation Provides fluent method chaining.
getLength ( ) : integer Determines the length of a tweet. Takes shortening of URLs into account.
validateHashtag ( ) : boolean Check whether a hashtag is valid.
validateList ( ) : boolean Check whether a list is valid.
validateTweet ( ) : boolean Check whether a tweet is valid.
validateURL ( boolean $unicode_domains = true, boolean $require_protocol = true ) : boolean Check whether a URL is valid.
validateUsername ( ) : boolean Check whether a username is valid.

Méthodes protégées

Méthode Description
isValidMatch ( string $string, string $pattern, boolean $optional = false ) : boolean A helper function to check for a valid match. Used in URL validation.

Method Details

__construct() public méthode

Reads in a tweet to be parsed and validates it.
public __construct ( string $tweet )
$tweet string The tweet to validate.

create() public static méthode

Provides fluent method chaining.
See also: __construct()
public static create ( string $tweet ) : Twitter_Validation
$tweet string The tweet to be validated.
Résultat Twitter_Validation

getLength() public méthode

Determines the length of a tweet. Takes shortening of URLs into account.
public getLength ( ) : integer
Résultat integer the length of a tweet.

isValidMatch() protected static méthode

A helper function to check for a valid match. Used in URL validation.
protected static isValidMatch ( string $string, string $pattern, boolean $optional = false ) : boolean
$string string The subject string to test.
$pattern string The pattern to match against.
$optional boolean Whether a match is compulsory or not.
Résultat boolean Whether an exact match was found.

validateHashtag() public méthode

Check whether a hashtag is valid.
public validateHashtag ( ) : boolean
Résultat boolean Whether the hashtag is valid.

validateList() public méthode

Check whether a list is valid.
public validateList ( ) : boolean
Résultat boolean Whether the list is valid.

validateTweet() public méthode

Check whether a tweet is valid.
public validateTweet ( ) : boolean
Résultat boolean Whether the tweet is valid.

validateURL() public méthode

Check whether a URL is valid.
public validateURL ( boolean $unicode_domains = true, boolean $require_protocol = true ) : boolean
$unicode_domains boolean Consider the domain to be unicode.
$require_protocol boolean Require a protocol for valid domain?
Résultat boolean Whether the URL is valid.

validateUsername() public méthode

Check whether a username is valid.
public validateUsername ( ) : boolean
Résultat boolean Whether the username is valid.