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

Class: Structures_BibTex

Source Location: /Structures_BibTex-1.0.0RC6/Structures/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 72]
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.  $bibtex->parse();
  4.  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.  $bibtex->parse();
  4.  foreach ($bibtex->data as $entry{
  5.   print $entry['title']."<br />";
  6.  }
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 129]

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

Type:   array


[ Top ]

$authorstring =

[line 136]

Author Format Strings
  • Access: public

Type:   string


[ Top ]

$content =

[line 87]

String with the BibTex content
  • Access: public

Type:   string


[ Top ]

$data =

[line 80]

Array with the BibTex Data
  • Access: public

Type:   array


[ Top ]

$htmlstring =

[line 122]

HTML Format String
  • Access: public

Type:   string


[ Top ]

$rtfstring =

[line 115]

RTF Format String
  • Access: public

Type:   string


[ Top ]

$warnings =

[line 101]

Array to store warnings
  • Access: public

Type:   array


[ Top ]



Method Detail

Structures_BibTex (Constructor)   [line 144]

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

Constructor
  • Access: public

Parameters:

   $options   — 

[ Top ]

addEntry   [line 1015]

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

int amount( )

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

[ Top ]

bibTex   [line 973]

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

void clearWarnings( )

Cleares all warnings
  • Access: public

[ Top ]

getStatistic   [line 1029]

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

true hasWarning( )

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

[ Top ]

html   [line 1113]

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

mixed loadFile( string $filename)

Reads a give BibTex File
  • Return: true on success
  • Throws: Structures_BibTex_Exception
  • Access: public

Parameters:

string   $filename   —  Name of the file

[ Top ]

parse   [line 236]

boolean parse( )

Parses what is stored in content and clears the content if the parsing is successfull.
  • Return: true on success
  • Throws: Structures_BibTex_Exception
  • Access: public

[ Top ]

rtf   [line 1056]

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

mixed setOption( string $option, mixed $value)

Sets run-time configuration options
  • Return: true on success
  • Throws: InvalidArgumentException
  • Access: public

Parameters:

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

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:12 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.