Structures_BibTex
[ class tree: Structures_BibTex ] [ index: Structures_BibTex ] [ all elements ]

Class: Structures_BibTex

Source Location: /Structures_BibTex-0.1.0/BibTex.php

Class Overview


Structures_BibTex


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 1997-2005 The PHP Group

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 79]
Structures_BibTex

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

  1.  $foo = new Structures_BibTex();
  2.  $ret=$foo->loadFile('foo.bib');
  3.  if(PEAR::isError($ret)) {
  4.    print $ret->getMessage();
  5.    die();
  6.  }
  7.  $foo->parse();
  8.  print "There are ".$foo->amount()." entries";
Example 2: Parsing a BibTex File and getting all Titles
  1.  $foo = new Structures_BibTex();
  2.  $ret=$foo->loadFile('foo.bib');
  3.  if(PEAR::isError($ret)) {
  4.    print $ret->getMessage();
  5.    die();
  6.  }
  7.  $foo->parse();
  8.  foreach($foo->data as $entry{
  9.     print $entry['title']."<br />";
  10.  }
Example 3: Adding an entry and printing it in BibTex Format
  1.  $foo = new Structures_BibTex();
  2.  $addarray = array();
  3.  $addarray['type''Article';
  4.  $addarray['cite''art2';
  5.  $addarray['title''Titel2';
  6.  $addarray['author'][0]['first''John';
  7.  $addarray['author'][0]['last''Doe';
  8.  $addarray['author'][1]['first''Jane';
  9.  $addarray['author'][1]['last''Doe';
  10.  $foo->addEntry($addarray);
  11.  print nl2br($foo->bibTex());



[ Top ]


Class Variables

$content =

[line 93]

String with the BibTex content
  • Access: public

Type:   string


[ Top ]

$data =

[line 86]

Array with the BibTex Data
  • Access: public

Type:   array


[ Top ]

$warnings =

[line 107]

Array to store warnings
  • Access: public

Type:   array


[ Top ]



Method Detail

Structures_BibTex (Constructor)   [line 122]

void Structures_BibTex( [ $options = array()])

Constructor
  • Access: public

Parameters:

   $options   — 

[ Top ]

addEntry   [line 785]

void addEntry( array $newentry)

Adds a new BibTex entry to the data
  • Access: public

Parameters:

array   $newentry   —  The new data to add

[ Top ]

amount   [line 731]

int amount( )

Returns the amount of available BibTex entries
  • Return: The amount of available BibTex entries
  • Access: public

[ Top ]

bibTex   [line 744]

string bibTex( )

Converts the stored BibTex entries to a BibTex String

In the field list, the author is the last field.

  • Return: The BibTex string
  • Access: public

[ Top ]

clearWarnings   [line 709]

void clearWarnings( )

Cleares all warnings
  • Access: public

[ Top ]

getStatistic   [line 799]

array 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.

  • Return: Hash Table with the data
  • Access: public

[ Top ]

hasWarning   [line 719]

true hasWarning( )

Is there a warning?
  • Return: if there is, false otherwise
  • Access: public

[ Top ]

loadFile   [line 172]

mixed loadFile( string $filename)

Reads a give BibTex File
  • Return: true on success PEAR_Error on failure
  • Access: public

Parameters:

string   $filename   —  Name of the file

[ Top ]

parse   [line 193]

boolean parse( )

Parses what is stored in content and clears the content if the parsing is successfull.
  • Return: true on success and PEAR_Error if there was a problem
  • Access: public

[ Top ]

setOption   [line 154]

mixed setOption( string $option, mixed $value)

Sets run-time configuration options
  • Return: true on success PEAR_Error on failure
  • Access: public

Parameters:

string   $option   —  option name
mixed   $value   —  value for the option

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:41:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.