ILIAS
Release_4_4_x_branch Revision 61816
|
Public Member Functions | |
Structures_BibTex ($options=array()) | |
Constructor. | |
setOption ($option, $value) | |
Sets run-time configuration options. | |
loadFile ($filename) | |
Reads a give BibTex File. | |
parse () | |
Parses what is stored in content and clears the content if the parsing is successfull. | |
_parseEntry ($entry) | |
Extracting the data of one content. | |
_checkEqualSign ($entry, $position) | |
Checking whether the position of the '=' is correct. | |
_checkAllowedEntryType ($entry) | |
Checking if the entry type is allowed. | |
_checkAt ($entry) | |
Checking whether an at is outside an entry. | |
_stripDelimiter ($entry) | |
Stripping Delimiter. | |
_unwrap ($entry) | |
Unwrapping entry. | |
_wordwrap ($entry) | |
Wordwrap an entry. | |
_extractAuthors ($entry) | |
Extracting the authors. | |
_determineCase ($word) | |
Case Determination according to the needs of BibTex. | |
_validateValue ($entry, $wholeentry) | |
Validation of a value. | |
_removeCurlyBraces ($value) | |
Remove curly braces from entry. | |
_generateWarning ($type, $entry, $wholeentry='') | |
Generates a warning. | |
clearWarnings () | |
Cleares all warnings. | |
hasWarning () | |
Is there a warning? | |
amount () | |
Returns the amount of available BibTex entries. | |
_formatAuthor ($array) | |
Returns the author formatted. | |
bibTex () | |
Converts the stored BibTex entries to a BibTex String. | |
addEntry ($newentry) | |
Adds a new BibTex entry to the data. | |
getStatistic () | |
Returns statistic. | |
rtf () | |
Returns the stored data in RTF format. | |
html () | |
Returns the stored data in HTML format. |
Data Fields | |
$data | |
$content | |
$_delimiters | |
$warnings | |
$_options | |
$rtfstring | |
$htmlstring | |
$allowedEntryTypes | |
$authorstring |
Definition at line 77 of file BibTex.php.
Structures_BibTex::_checkAllowedEntryType | ( | $entry | ) |
Checking if the entry type is allowed.
private
string | $entry | The entry to check |
Definition at line 508 of file BibTex.php.
Referenced by _parseEntry().
Structures_BibTex::_checkAt | ( | $entry | ) |
Checking whether an at is outside an entry.
Sometimes an entry misses an entry brace. Then the at of the next entry seems to be inside an entry. This is checked here. When it is most likely that the at is an opening at of the next entry this method returns true.
private
string | $entry | The text of the entry until the at |
Definition at line 524 of file BibTex.php.
References $ret.
Referenced by parse().
Structures_BibTex::_checkEqualSign | ( | $entry, | |
$position | |||
) |
Checking whether the position of the '=' is correct.
Sometimes there is a problem if a '=' is used inside an entry (for example abstract). This method checks if the '=' is outside braces then the '=' is correct and true is returned. If the '=' is inside braces it contains to a equation and therefore false is returned.
private
string | $entry | The text of the whole remaining entry |
int | the current used place of the '=' |
Definition at line 450 of file BibTex.php.
References $ret.
Referenced by _parseEntry().
Structures_BibTex::_determineCase | ( | $word | ) |
Case Determination according to the needs of BibTex.
To parse the Author(s) correctly a determination is needed to get the Case of a word. There are three possible values:
private
string | $word |
Definition at line 760 of file BibTex.php.
References $ret, and PEAR\raiseError().
Referenced by _extractAuthors().
Structures_BibTex::_extractAuthors | ( | $entry | ) |
Extracting the authors.
private
string | $entry | The entry with the authors |
Definition at line 625 of file BibTex.php.
References $size, _determineCase(), _unwrap(), and PEAR\isError().
Referenced by _parseEntry().
Structures_BibTex::_formatAuthor | ( | $array | ) |
Returns the author formatted.
The Author is formatted as setted in the authorstring
private
array | $array | Author array |
Definition at line 928 of file BibTex.php.
References $authorstring, and $ret.
Referenced by bibTex(), html(), and rtf().
Structures_BibTex::_generateWarning | ( | $type, | |
$entry, | |||
$wholeentry = '' |
|||
) |
Generates a warning.
private
string | $type | The type of the warning |
string | $entry | The line of the entry where the warning occurred |
string | $wholeentry | OPTIONAL The whole entry where the warning occurred |
Definition at line 878 of file BibTex.php.
Referenced by _parseEntry(), _validateValue(), html(), parse(), and rtf().
Structures_BibTex::_parseEntry | ( | $entry | ) |
Extracting the data of one content.
The parse function splits the content into its entries. Then every entry is parsed by this function. It parses the entry backwards. First the last '=' is searched and the value extracted from that. A copy is made of the entry if warnings should be generated. This takes quite some memory but it is needed to get good warnings. If nor warnings are generated then you don have to worry about memory. Then the last ',' is searched and the field extracted from that. Again the entry is shortened. Finally after all field=>value pairs the cite and type is extraced and the authors are splitted. If there is a problem false is returned.
private
string | $entry | The entry |
Definition at line 354 of file BibTex.php.
References $ret, _checkAllowedEntryType(), _checkEqualSign(), _extractAuthors(), _generateWarning(), _removeCurlyBraces(), _stripDelimiter(), _unwrap(), and _validateValue().
Referenced by parse().
Structures_BibTex::_removeCurlyBraces | ( | $value | ) |
Remove curly braces from entry.
private
string | $value | The value in which curly braces to be removed |
string | Value with removed curly braces |
Definition at line 842 of file BibTex.php.
Referenced by _parseEntry().
Structures_BibTex::_stripDelimiter | ( | $entry | ) |
Stripping Delimiter.
private
string | $entry | The entry where the Delimiter should be stripped from |
Definition at line 572 of file BibTex.php.
Referenced by _parseEntry().
Structures_BibTex::_unwrap | ( | $entry | ) |
Unwrapping entry.
private
string | $entry | The entry to unwrap |
Definition at line 597 of file BibTex.php.
Referenced by _extractAuthors(), _parseEntry(), html(), and rtf().
Structures_BibTex::_validateValue | ( | $entry, | |
$wholeentry | |||
) |
Validation of a value.
There may be several problems with the value of a field. These problems exist but do not break the parsing. If a problem is detected a warning is appended to the array warnings.
private
string | $entry | The entry aka one line which which should be validated |
string | $wholeentry | The whole BibTex Entry which the one line is part of |
Definition at line 806 of file BibTex.php.
References _generateWarning().
Referenced by _parseEntry().
Structures_BibTex::_wordwrap | ( | $entry | ) |
Wordwrap an entry.
private
string | $entry | The entry to wrap |
Definition at line 610 of file BibTex.php.
Structures_BibTex::addEntry | ( | $newentry | ) |
Adds a new BibTex entry to the data.
public
array | $newentry | The new data to add |
Definition at line 1008 of file BibTex.php.
Structures_BibTex::amount | ( | ) |
Returns the amount of available BibTex entries.
public
Definition at line 914 of file BibTex.php.
References $data.
Structures_BibTex::bibTex | ( | ) |
Converts the stored BibTex entries to a BibTex String.
In the field list, the author is the last field.
public
Definition at line 966 of file BibTex.php.
References $bibtex, and _formatAuthor().
Structures_BibTex::clearWarnings | ( | ) |
Cleares all warnings.
public
Definition at line 891 of file BibTex.php.
Structures_BibTex::getStatistic | ( | ) |
Returns statistic.
This functions returns a hash table. The keys are the different entry types and the values are the amount of these entries.
public
Definition at line 1022 of file BibTex.php.
References $ret.
Structures_BibTex::hasWarning | ( | ) |
Is there a warning?
public
Definition at line 902 of file BibTex.php.
Structures_BibTex::html | ( | ) |
Returns the stored data in HTML format.
This method simply returns a HTML formatted string. This is done very simple and is not intended for heavy using and fine formatting. This should be done by BibTex! It is intended to give some kind of quick preview. If you want to change the default format you have to override the class variable "htmlstring". This variable is used and the placeholders simply replaced. Lines with no data cause an warning!
Definition at line 1106 of file BibTex.php.
References $htmlstring, $ret, _formatAuthor(), _generateWarning(), and _unwrap().
Structures_BibTex::loadFile | ( | $filename | ) |
Reads a give BibTex File.
public
string | $filename | Name of the file |
Definition at line 221 of file BibTex.php.
References $filename, and PEAR\raiseError().
Structures_BibTex::parse | ( | ) |
Parses what is stored in content and clears the content if the parsing is successfull.
public
This is not yet used. We are here if the Entry is either not correct or not supported. But this should already generate a warning. Therefore it should not be necessary to do anything here
Definition at line 242 of file BibTex.php.
References $valid, _checkAt(), _generateWarning(), _parseEntry(), and PEAR\raiseError().
Structures_BibTex::rtf | ( | ) |
Returns the stored data in RTF format.
This method simply returns a RTF formatted string. This is done very simple and is not intended for heavy using and fine formatting. This should be done by BibTex! It is intended to give some kind of quick preview or to send someone a reference list as word/rtf format (even some people in the scientific field still use word). If you want to change the default format you have to override the class variable "rtfstring". This variable is used and the placeholders simply replaced. Lines with no data cause an warning!
Definition at line 1049 of file BibTex.php.
References $ret, $rtfstring, _formatAuthor(), _generateWarning(), and _unwrap().
Structures_BibTex::setOption | ( | $option, | |
$value | |||
) |
Sets run-time configuration options.
public
string | $option | option name |
mixed | $value | value for the option |
Definition at line 203 of file BibTex.php.
References $ret, and PEAR\raiseError().
Referenced by Structures_BibTex().
Structures_BibTex::Structures_BibTex | ( | $options = array() | ) |
Constructor.
public
Definition at line 149 of file BibTex.php.
References $options, $test, PEAR\isError(), and setOption().
Structures_BibTex::$_delimiters |
Definition at line 99 of file BibTex.php.
Structures_BibTex::$_options |
Definition at line 113 of file BibTex.php.
Structures_BibTex::$allowedEntryTypes |
Definition at line 134 of file BibTex.php.
Structures_BibTex::$authorstring |
Definition at line 141 of file BibTex.php.
Referenced by _formatAuthor().
Structures_BibTex::$content |
Definition at line 92 of file BibTex.php.
Structures_BibTex::$data |
Definition at line 85 of file BibTex.php.
Referenced by amount().
Structures_BibTex::$htmlstring |
Definition at line 127 of file BibTex.php.
Referenced by html().
Structures_BibTex::$rtfstring |
Definition at line 120 of file BibTex.php.
Referenced by rtf().
Structures_BibTex::$warnings |
Definition at line 106 of file BibTex.php.