PHP 클래스 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}.
저자: Nick Pope ([email protected])
상속: extends Twitter_Regex
파일 보기 프로젝트 열기: ngnpope/twitter-text-php 1 사용 예제들

공개 메소드들

메소드 설명
__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.

보호된 메소드들

메소드 설명
isValidMatch ( string $string, string $pattern, boolean $optional = false ) : boolean A helper function to check for a valid match. Used in URL validation.

메소드 상세

__construct() 공개 메소드

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

create() 공개 정적인 메소드

Provides fluent method chaining.
또한 보기: __construct()
public static create ( string $tweet ) : Twitter_Validation
$tweet string The tweet to be validated.
리턴 Twitter_Validation

getLength() 공개 메소드

Determines the length of a tweet. Takes shortening of URLs into account.
public getLength ( ) : integer
리턴 integer the length of a tweet.

isValidMatch() 보호된 정적인 메소드

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.
리턴 boolean Whether an exact match was found.

validateHashtag() 공개 메소드

Check whether a hashtag is valid.
public validateHashtag ( ) : boolean
리턴 boolean Whether the hashtag is valid.

validateList() 공개 메소드

Check whether a list is valid.
public validateList ( ) : boolean
리턴 boolean Whether the list is valid.

validateTweet() 공개 메소드

Check whether a tweet is valid.
public validateTweet ( ) : boolean
리턴 boolean Whether the tweet is valid.

validateURL() 공개 메소드

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?
리턴 boolean Whether the URL is valid.

validateUsername() 공개 메소드

Check whether a username is valid.
public validateUsername ( ) : boolean
리턴 boolean Whether the username is valid.