PHP 클래스 Essence\Replacer

파일 보기 프로젝트 열기: benjamminf/craft-embedded-assets 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_Extractor Extractor Extractor.
$_urlPattern string A pattern to match URLs.

공개 메소드들

메소드 설명
__construct ( Extractor $Extractor ) Constructor.
replace ( string $text, callable $template = null, array $options = [] ) : string Replaces URLs in the given text by media informations if they point on an extractable resource.
setUrlPattern ( string $pattern ) Sets the URL pattern for replacements.

보호된 메소드들

메소드 설명
_defaultTemplate ( ) : Closure Returns a default templating callback for replace().
_replaceFunction ( callable $template, array $options ) : Closure Returns a function used to replace URLs by informations.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( Extractor $Extractor )
$Extractor Extractor Extractor.

_defaultTemplate() 보호된 메소드

Returns a default templating callback for replace().
또한 보기: replace()
protected _defaultTemplate ( ) : Closure
리턴 Closure Templating function.

_replaceFunction() 보호된 메소드

Returns a function used to replace URLs by informations.
또한 보기: replace()
protected _replaceFunction ( callable $template, array $options ) : Closure
$template callable Templating callback.
$options array Custom options to be interpreted by a provider.
리턴 Closure Function.

replace() 공개 메소드

By default, links will be replaced by the html property of Media. If $template is a callable function, it will be used to generate replacement strings, given a Media object.
public replace ( string $text, callable $template = null, array $options = [] ) : string
$text string Text in which to replace URLs.
$template callable Templating callback.
$options array Custom options to be interpreted by a provider.
리턴 string Text with replaced URLs.

setUrlPattern() 공개 메소드

Sets the URL pattern for replacements.
또한 보기: replace()
public setUrlPattern ( string $pattern )
$pattern string URL pattern.

프로퍼티 상세

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

Extractor.
protected Extractor,Essence $_Extractor
리턴 Extractor

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

A pattern to match URLs.
또한 보기: http://daringfireball.net/2010/07/improved_regex_for_matching_urls
protected string $_urlPattern
리턴 string