PHP 클래스 Bolt\Helpers\Html

파일 보기 프로젝트 열기: bolt/bolt 1 사용 예제들

공개 메소드들

메소드 설명
addScheme ( string $url, string $scheme = 'http://' ) : string Add 'http://' to a link, if it has no protocol already.
decorateTT ( string $str ) : string Transforms plain text to HTML. Plot twist: text between backticks (`) is wrapped in a element.
isURL ( string $str ) : boolean Check if a given string looks like it could be a URL, with or without the protocol.
providerLink ( array $providedby ) : string Create 'provider' link, as used in the footer, to link to either an email address or website URL.
trimText ( string $str, integer $desiredLength, boolean $hellip = true, integer $cutOffCap = 10 ) : string Trim text to a given length.

메소드 상세

addScheme() 공개 정적인 메소드

Add 'http://' to a link, if it has no protocol already.
public static addScheme ( string $url, string $scheme = 'http://' ) : string
$url string
$scheme string
리턴 string

decorateTT() 공개 정적인 메소드

Transforms plain text to HTML. Plot twist: text between backticks (`) is wrapped in a element.
public static decorateTT ( string $str ) : string
$str string Input string. Treated as plain text.
리턴 string The resulting HTML

isURL() 공개 정적인 메소드

Check if a given string looks like it could be a URL, with or without the protocol.
또한 보기: https://mathiasbynens.be/demo/url-regex
public static isURL ( string $str ) : boolean
$str string
리턴 boolean

trimText() 공개 정적인 메소드

Trim text to a given length.
public static trimText ( string $str, integer $desiredLength, boolean $hellip = true, integer $cutOffCap = 10 ) : string
$str string String to trim
$desiredLength integer Target string length
$hellip boolean Add dots when the string is too long
$cutOffCap integer Maximum difference between string length when removing words
리턴 string Trimmed string