PHP 클래스 PHPePub\Helpers\StringHelper

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

공개 메소드들

메소드 설명
createDomFragment ( DOMDocument $dom, string $markup ) : DOMNode Helper function to create a DOM fragment with given markup.
createUUID ( integer $bookVersion = 4, string $url = null ) : string Generates an UUID.
decodeHtmlEntities ( string $string ) : string Remove all non essential html tags and entities.
encodeHtml ( string $string ) : string Encode html code to use html entities, safeguarding it from potential character encoding problems This function is a bit different from the vanilla htmlentities function in that it does not encode html tags.
fixEncoding ( string $in_str ) : string Ensure the encoded string is a valid UTF-8 string.
html2text ( string $string ) : string Simply remove all HTML tags, brute force and no finesse.
removeComments ( $doc ) : string

메소드 상세

createDomFragment() 공개 정적인 메소드

Helper function to create a DOM fragment with given markup.
저자: Adam Schmalhofer
public static createDomFragment ( DOMDocument $dom, string $markup ) : DOMNode
$dom DOMDocument
$markup string
리턴 DOMNode fragment in a node.

createUUID() 공개 정적인 메소드

Default version (4) will generate a random UUID, version 3 will URL based UUID. Added for convenience
public static createUUID ( integer $bookVersion = 4, string $url = null ) : string
$bookVersion integer UUID version to retrieve, See lib.uuid.manual.html for details.
$url string
리턴 string The formatted uuid

decodeHtmlEntities() 공개 정적인 메소드

Remove all non essential html tags and entities.
public static decodeHtmlEntities ( string $string ) : string
$string string
리턴 string with the stripped entities.

encodeHtml() 공개 정적인 메소드

The regexp is taken from the PHP Manual discussion, it was written by user "busbyjon". http://www.php.net/manual/en/function.htmlentities.php#90111
public static encodeHtml ( string $string ) : string
$string string string to encode.
리턴 string

fixEncoding() 공개 정적인 메소드

Note, that a mb_detect_encoding on the returned string will still return ASCII if the entire string is comprised of characters in the 1-127 range.
public static fixEncoding ( string $in_str ) : string
$in_str string
리턴 string converted string.

html2text() 공개 정적인 메소드

Simply remove all HTML tags, brute force and no finesse.
public static html2text ( string $string ) : string
$string string html
리턴 string

removeComments() 공개 정적인 메소드

public static removeComments ( $doc ) : string
$doc
리턴 string