PHP 클래스 Sepia\PoParser

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. https://github.com/raulferras/PHP-po-parser Class to parse .po file and extract its strings.
파일 보기 프로젝트 열기: raulferras/PHP-po-parser 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$entries
$headers
$options
$sourceHandle

공개 메소드들

메소드 설명
__construct ( sepia\InterfaceHandler $handler = null, $options = [] )
compile ( ) : string Compiles entries into a string
entries ( ) Gets entries.
getEntries ( )
getHeaders ( ) : array Get headers from .po file
getOptions ( )
parse ( sepia\InterfaceHandler $handle = null ) : array. Reads and parses strings of a .po file.
parseFile ( string $filepath, array $options = [] ) : array. Reads and parses a file
parseString ( $string, array $options = [] ) : array. Reads and parses a string
setEntry ( String $msgid, Array $entry, boolean $createNew = true ) Updates an entry.
setEntryContext ( $msgid, $context = false )
setEntryPlural ( $msgid, $plural = false )
setHeaders ( array $newHeaders ) : boolean Set new headers
writeFile ( string $filepath ) : boolean Writes entries to a po file

보호된 메소드들

메소드 설명
clean ( string | array $x ) : string | array. Undos cleanExport actions on a string.
cleanExport ( string $string ) : string Prepares a string to be outputed into a file.
getEntryId ( array $entry ) : string Generates the internal key for a msgid.
isHeader ( array $entry ) : boolean Checks if entry is a header by

메소드 상세

__construct() 공개 메소드

public __construct ( sepia\InterfaceHandler $handler = null, $options = [] )
$handler sepia\InterfaceHandler

clean() 보호된 메소드

Undos cleanExport actions on a string.
protected clean ( string | array $x ) : string | array.
$x string | array
리턴 string | array.

cleanExport() 보호된 메소드

Prepares a string to be outputed into a file.
protected cleanExport ( string $string ) : string
$string string The string to be converted.
리턴 string

compile() 공개 메소드

Compiles entries into a string
public compile ( ) : string
리턴 string

entries() 공개 메소드

Gets entries.
public entries ( )

getEntries() 공개 메소드

public getEntries ( )

getEntryId() 보호된 메소드

Generates the internal key for a msgid.
protected getEntryId ( array $entry ) : string
$entry array
리턴 string

getHeaders() 공개 메소드

Get headers from .po file
public getHeaders ( ) : array
리턴 array

getOptions() 공개 메소드

public getOptions ( )

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

Checks if entry is a header by
protected static isHeader ( array $entry ) : boolean
$entry array
리턴 boolean

parse() 공개 메소드

Reads and parses strings of a .po file.
public parse ( sepia\InterfaceHandler $handle = null ) : array.
$handle sepia\InterfaceHandler
리턴 array.

parseFile() 공개 정적인 메소드

Reads and parses a file
public static parseFile ( string $filepath, array $options = [] ) : array.
$filepath string
$options array
리턴 array.

parseString() 공개 정적인 메소드

Reads and parses a string
public static parseString ( $string, array $options = [] ) : array.
$options array
리턴 array.

setEntry() 공개 메소드

If entry not found returns false. If $createNew is true, a new entry will be created. $entry is an array that can contain following indexes: - msgid: String Array. Required. - msgstr: String Array. Required. - reference: String Array. - msgctxt: String. Disambiguating context. - tcomment: String Array. Translator comments. - ccomment: String Array. Source comments. - msgid_plural: String Array. - flags: Array. List of entry flags. Example: array('fuzzy','php-format') - previous: Array: Contains previous untranslated strings in a sub array with msgid and msgstr.
public setEntry ( String $msgid, Array $entry, boolean $createNew = true )
$msgid String Id of entry. Be aware that some entries have a multiline msgid. In that case \n must be replaced by the value of 'multiline-glue' option (by default "<##EOL##>").
$entry Array Array with all entry data. Fields not setted will be removed.
$createNew boolean If msgid not found, it will create a new entry. By default true. You want to set this to false if need to change the msgid of an entry.

setEntryContext() 공개 메소드

public setEntryContext ( $msgid, $context = false )

setEntryPlural() 공개 메소드

public setEntryPlural ( $msgid, $plural = false )

setHeaders() 공개 메소드

{code} array( '"Project-Id-Version: \n"', '"Report-Msgid-Bugs-To: \n"', '"POT-Creation-Date: \n"', '"PO-Revision-Date: \n"', '"Last-Translator: none\n"', '"Language-Team: \n"', '"MIME-Version: 1.0\n"', '"Content-Type: text/plain; charset=UTF-8\n"', ); {code}
public setHeaders ( array $newHeaders ) : boolean
$newHeaders array
리턴 boolean

writeFile() 공개 메소드

Writes entries to a po file
public writeFile ( string $filepath ) : boolean
$filepath string
리턴 boolean

프로퍼티 상세

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

protected $entries

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

protected $headers

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

protected $options

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

protected $sourceHandle