Todo List
A class which provides common methods to access and create Strings in BibTex format. Example 1: Parsing a BibTex File and returning the number of entries $foo = new Structures_BibTex(); $ret=$foo->loadFile('foo.bib'); if(PEAR::isError($ret)) { print $ret->getMessage(); die(); } $foo->parse(); print "There are ".$foo->amount()." entries"; Example 2: Parsing a BibTex File and getting all Titles $foo = new Structures_BibTex(); $ret=$foo->loadFile('foo.bib'); if(PEAR::isError($ret)) { print $ret->getMessage(); die(); } $foo->parse(); foreach($foo->data as $entry) { print $entry['title']."<br />"; } Example 3: Adding an entry and printing it in BibTex Format $foo = new Structures_BibTex(); $addarray = array(); $addarray['type'] = 'Article'; $addarray['cite'] = 'art2'; $addarray['title'] = 'Titel2'; $addarray['author'][0]['first'] = 'John'; $addarray['author'][0]['last'] = 'Doe'; $addarray['author'][1]['first'] = 'Jane'; $addarray['author'][1]['last'] = 'Doe'; $foo->addEntry($addarray); print nl2br($foo->bibTex());
$foo = new Structures_BibTex(); $ret=$foo->loadFile('foo.bib'); if(PEAR::isError($ret)) { print $ret->getMessage(); die(); } $foo->parse(); print "There are ".$foo->amount()." entries";
$foo = new Structures_BibTex(); $ret=$foo->loadFile('foo.bib'); if(PEAR::isError($ret)) { print $ret->getMessage(); die(); } $foo->parse(); foreach($foo->data as $entry) { print $entry['title']."<br />"; }
$foo = new Structures_BibTex(); $addarray = array(); $addarray['type'] = 'Article'; $addarray['cite'] = 'art2'; $addarray['title'] = 'Titel2'; $addarray['author'][0]['first'] = 'John'; $addarray['author'][0]['last'] = 'Doe'; $addarray['author'][1]['first'] = 'Jane'; $addarray['author'][1]['last'] = 'Doe'; $foo->addEntry($addarray); print nl2br($foo->bibTex());
[line 93]
[line 86]
[line 107]
void Structures_BibTex( [ $options = array()])
void addEntry( array $newentry)
int amount( )
string bibTex( )
In the field list, the author is the last field.
void clearWarnings( )
array getStatistic( )
This functions returns a hash table. The keys are the different entry types and the values are the amount of these entries.
true hasWarning( )
mixed loadFile( string $filename)
boolean parse( )
mixed setOption( string $option, mixed $value)