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

Class: Structures_BibTex

Source Location: /Structures_BibTex-1.0.0RC4/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 77]
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.  $bibtex = new Structures_BibTex();
  2.  $ret    $bibtex->loadFile('foo.bib');
  3.  if (PEAR::isError($ret)) {
  4.    die($ret->getMessage());
  5.  }
  6.  $bibtex->parse();
  7.  print "There are ".$bibtex->amount()." entries";
Example 2: Parsing a BibTex File and getting all Titles
  1.  $bibtex = new Structures_BibTex();
  2.  $ret    $bibtex->loadFile('bibtex.bib');
  3.  if (PEAR::isError($ret)) {
  4.    die($ret->getMessage());
  5.  }
  6.  $bibtex->parse();
  7.  foreach ($bibtex->data as $entry{
  8.   print $entry['title']."<br />";
  9.  }
Example 3: Adding an entry and printing it in BibTex Format
  1.  $bibtex                         = new Structures_BibTex();
  2.  $addarray                       = array();
  3.  $addarray['entryType']          '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.  $bibtex->addEntry($addarray);
  11.  print nl2br($bibtex->bibTex());



[ Top ]


Class Variables

$allowedEntryTypes =

[line 134]

Array with the "allowed" entry types
  • Access: public

Type:   array


[ Top ]

$authorstring =

[line 141]

Author Format Strings
  • Access: public

Type:   string


[ Top ]

$content =

[line 92]

String with the BibTex content
  • Access: public

Type:   string


[ Top ]

$data =

[line 85]

Array with the BibTex Data
  • Access: public

Type:   array


[ Top ]

$htmlstring =

[line 127]

HTML Format String
  • Access: public

Type:   string


[ Top ]

$rtfstring =

[line 120]

RTF Format String
  • Access: public

Type:   string


[ Top ]

$warnings =

[line 106]

Array to store warnings
  • Access: public

Type:   array


[ Top ]



Method Detail

Structures_BibTex (Constructor)   [line 149]

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

Constructor
  • Access: public

Parameters:

   $options   — 

[ Top ]

addEntry   [line 1008]

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 914]

int amount( )

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

[ Top ]

bibTex   [line 966]

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 891]

void clearWarnings( )

Cleares all warnings
  • Access: public

[ Top ]

getStatistic   [line 1022]

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 902]

true hasWarning( )

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

[ Top ]

html   [line 1106]

string 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!

  • Return: the HTML Strings

[ Top ]

loadFile   [line 221]

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 242]

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 ]

rtf   [line 1049]

string 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!

  • Return: the RTF Strings

[ Top ]

setOption   [line 203]

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 Thu, 10 Dec 2015 05:44:11 +0000 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.