SimpleFFS Class Reference
[File format support]

A very basic FFS module that implements some basic functionality and a simple binary based file format. More...

Inheritance diagram for SimpleFFS:
Inheritance graph
[legend]
Collaboration diagram for SimpleFFS:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 supportsFuzzy ()
 Query the capabilities of this FFS.
 getFileExtensions ()
 Return the commonly used file extensions for these formats.
 __construct (FileBasedMessageGroup $group)
 setGroup (FileBasedMessageGroup $group)
 getGroup ()
 setWritePath ($writePath)
 getWritePath ()
 exists ($code=false)
 Returns true if the file for this message group in a given language exists.
 read ($code)
 Reads messages from the file in a given language and returns an array of AUTHORS, MESSAGES and possibly other properties.
 readFromVariable ($data)
 Parse the message data given as a string in the SimpleFFS format and return it as an array of AUTHORS and MESSAGES.
 write (MessageCollection $collection)
 Write the collection to file.
 writeIntoVariable (MessageCollection $collection)
 Read a collection and return it as a SimpleFFS formatted string.

Static Public Member Functions

static fixNewLines ($data)
 Replaces all Windows and Mac line endings with Unix line endings.

Public Attributes

const RECORD_SEPARATOR = "\0"
const PART_SEPARATOR = "\0\0\0\0"

Protected Member Functions

 writeReal (MessageCollection $collection)
 tryReadSource ($filename, MessageCollection $collection)
 tryReadFile ($filename)
 Read the contents of $filename and return it as a string.
 filterAuthors (array $authors, $code)
 Remove blacklisted authors.

Protected Attributes

 $group
 $writePath
 $extra
 Stores the FILES section of the YAML configuration, which can be accessed for extra FFS class specific options.

Detailed Description

A very basic FFS module that implements some basic functionality and a simple binary based file format.

Other FFS classes can extend SimpleFFS and override suitable methods.

Definition at line 93 of file FFS.php.


Constructor & Destructor Documentation

SimpleFFS::__construct ( FileBasedMessageGroup group  ) 

Implements FFS.

Reimplemented in JavaFFS.

Definition at line 118 of file FFS.php.

Here is the call graph for this function:


Member Function Documentation

SimpleFFS::exists ( code = false  ) 

Returns true if the file for this message group in a given language exists.

If no $code is given, the groups source language is assumed. NB: Some formats store all languages in the same file, and then this function will return true even if there are no translations to that language.

Parameters:
$code string|bool
Returns:
bool

Definition at line 162 of file FFS.php.

Referenced by XliffFFS::read(), and read().

SimpleFFS::filterAuthors ( array $  authors,
code 
) [protected]

Remove blacklisted authors.

Parameters:
$authors array
$code string
Returns:
array

Definition at line 383 of file FFS.php.

Referenced by YamlFFS::doAuthors(), GettextFFS::doAuthors(), FlatPhpFFS::doAuthors(), DtdFFS::doAuthors(), PythonSingleFFS::writeReal(), MediaWikiExtensionFFS::writeReal(), and writeReal().

static SimpleFFS::fixNewLines ( data  )  [static]

Replaces all Windows and Mac line endings with Unix line endings.

This is needed in some file types.

Parameters:
$data string
Returns:
string

Definition at line 419 of file FFS.php.

Referenced by JavaFFS::readFromVariable(), PythonSingleFFS::splitSections(), and MediaWikiExtensionFFS::splitSections().

SimpleFFS::getFileExtensions (  ) 

Return the commonly used file extensions for these formats.

Include the dot.

Returns:
string[]
Since:
2013-04

Implements FFS.

Reimplemented in AndroidXmlFFS, DtdFFS, FlatPhpFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, MediaWikiExtensionFFS, PythonSingleFFS, RubyYamlFFS, XliffFFS, and YamlFFS.

Definition at line 98 of file FFS.php.

SimpleFFS::getGroup (  ) 
Returns:
FileBasedMessageGroup

Definition at line 134 of file FFS.php.

SimpleFFS::getWritePath (  ) 
Returns:
string

Implements FFS.

Definition at line 148 of file FFS.php.

SimpleFFS::read ( code  ) 

Reads messages from the file in a given language and returns an array of AUTHORS, MESSAGES and possibly other properties.

Parameters:
$code string
Returns:
array|bool false if the file does not exist
Exceptions:
MWException if the file appears to exist, but cannot be read

Implements FFS.

Reimplemented in MediaWikiExtensionFFS, PythonSingleFFS, and XliffFFS.

Definition at line 187 of file FFS.php.

Referenced by GettextFFS::writeReal().

Here is the call graph for this function:

SimpleFFS::readFromVariable ( data  ) 

Parse the message data given as a string in the SimpleFFS format and return it as an array of AUTHORS and MESSAGES.

Parameters:
$data string
Returns:
array
Exceptions:
MWException 

Implements FFS.

Reimplemented in AndroidXmlFFS, DtdFFS, FlatPhpFFS, GettextFFS, IniFFS, JavaFFS, JavaScriptFFS, JsonFFS, MediaWikiExtensionFFS, PythonSingleFFS, and YamlFFS.

Definition at line 209 of file FFS.php.

Referenced by read(), and tryReadSource().

SimpleFFS::setGroup ( FileBasedMessageGroup group  ) 
Parameters:
$group FileBasedMessageGroup

Definition at line 127 of file FFS.php.

Referenced by __construct().

SimpleFFS::setWritePath ( writePath  ) 
Parameters:
$writePath string

Implements FFS.

Definition at line 141 of file FFS.php.

SimpleFFS::supportsFuzzy (  ) 

Query the capabilities of this FFS.

Allowed values are:

  • yes
  • write (ignored on read)
  • no (stripped on write)
    Returns:
    string
    Since:
    2013-03-05

Implements FFS.

Reimplemented in AndroidXmlFFS, GettextFFS, IniFFS, JavaFFS, MediaWikiExtensionFFS, and XliffFFS.

Definition at line 94 of file FFS.php.

SimpleFFS::tryReadFile ( filename  )  [protected]

Read the contents of $filename and return it as a string.

Return false if the file doesn't exist. Throw an exception if the file isn't readable or if the reading fails strangely.

Parameters:
$filename string
Returns:
bool|string
Exceptions:
MWException 

Definition at line 355 of file FFS.php.

Referenced by tryReadSource().

SimpleFFS::tryReadSource ( filename,
MessageCollection collection 
) [protected]
Todo:
get rid of this
Parameters:
$filename string
$collection MessageCollection

Definition at line 323 of file FFS.php.

Referenced by write(), and writeIntoVariable().

Here is the call graph for this function:

SimpleFFS::write ( MessageCollection collection  ) 

Write the collection to file.

Parameters:
$collection MessageCollection
Exceptions:
MWException 

Implements FFS.

Definition at line 250 of file FFS.php.

Here is the call graph for this function:

SimpleFFS::writeIntoVariable ( MessageCollection collection  ) 

Read a collection and return it as a SimpleFFS formatted string.

Parameters:
$collection MessageCollection
Returns:
string

Implements FFS.

Definition at line 287 of file FFS.php.

Here is the call graph for this function:

SimpleFFS::writeReal ( MessageCollection collection  )  [protected]
Parameters:
$collection MessageCollection
Returns:
string

Reimplemented in GettextFFS, MediaWikiExtensionFFS, PythonSingleFFS, and XliffFFS.

Definition at line 298 of file FFS.php.

Referenced by write(), and writeIntoVariable().

Here is the call graph for this function:


Member Data Documentation

SimpleFFS::$extra [protected]

Stores the FILES section of the YAML configuration, which can be accessed for extra FFS class specific options.

Definition at line 113 of file FFS.php.

Referenced by GettextFFS::doGettextHeader(), and MediaWikiExtensionFFS::quote().

SimpleFFS::$group [protected]

Definition at line 105 of file FFS.php.

SimpleFFS::$writePath [protected]

Definition at line 107 of file FFS.php.

Referenced by setWritePath(), and write().

const SimpleFFS::PART_SEPARATOR = "\0\0\0\0"

Definition at line 116 of file FFS.php.

Definition at line 115 of file FFS.php.


The documentation for this class was generated from the following file:
Generated on Tue Oct 29 00:00:52 2013 for MediaWiki Translate Extension by  doxygen 1.6.3