From 9c81344ac3cc4f5c5a284045873b4936681cf701 Mon Sep 17 00:00:00 2001 From: Martin Monperrus Date: Fri, 10 Jun 2011 10:53:44 +0200 Subject: [PATCH] =?UTF-8?q?added=20the=20possibility=20to=20include=20bibt?= =?UTF-8?q?exbrowser=20several=20times=20in=20the=20same=20script=20(in=20?= =?UTF-8?q?order=20to=20have=20different=20publication=20lists=20on=20the?= =?UTF-8?q?=20same=20page).=20Feature=20requested=20by=20Carlos=20Br=C3=A1?= =?UTF-8?q?s=20on=20June=201,=202011.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bibtexbrowser.php | 134 +++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 62 deletions(-) diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 2f715a6..eaa0d5c 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -234,6 +234,13 @@ License, or (at your option) any later version. */ +// Wednesday, June 01 2011: bug found by Carlos Brás +// it should be possible to include( 'bibtexbrowser.php' ); several times in the same script +if (!defined('BIBTEXBROWSER')) { +// this if block ends at the very end of this file, after all class and function declarations. +define('BIBTEXBROWSER','v__MTIME__'); + + // *************** CONFIGURATION // I recommend to put your changes in bibtexbrowser.local.php // it will help you to upgrade the script with a new version @@ -1484,6 +1491,67 @@ class IndependentYearMenu { } } +/** Class to encapsulates the header formatting and the powered by footer */ +class BibtexBrowserDisplay { + /** the title */ + var $title; + + function getTitle() { return $this->title; } + + function display() { /* unimplemented */ } + + /** returns the url of this display (e.g. base on the query)*/ + function getURL() { return '';} + + /** returns the url of the RSS */ + function getRSS() { return '';} + + /** Returns the powered by part */ + function poweredby() { + $poweredby = "\n".'
'; + $poweredby .= ''; + $poweredby .= 'Powered by bibtexbrowser'; + $poweredby .= '
'."\n"; + return $poweredby; + } + + function formatedHeader() { return "
{$this->title}
\n";} + + /** Adds a touch of AJAX in bibtexbrowser to display bibtex entries inline. + * It uses the HIJAX design pattern: the Javascript code fetches the normal bibtex HTML page + * and extracts the bibtex. + * In other terms, URLs and content are left perfectly optimized for crawlers + * Note how beautiful is this piece of code thanks to JQuery. + */ + function javascript() { + // we use jquery with the official content delivery URLs + // Microsoft and Google also provide jquery with their content delivery networks +?> +title; } - - function display() { /* unimplemented */ } - - /** returns the url of this display (e.g. base on the query)*/ - function getURL() { return '';} - - /** returns the url of the RSS */ - function getRSS() { return '';} - - /** Returns the powered by part */ - function poweredby() { - $poweredby = "\n".'
'; - $poweredby .= ''; - $poweredby .= 'Powered by bibtexbrowser'; - $poweredby .= '
'."\n"; - return $poweredby; - } - - function formatedHeader() { return "
{$this->title}
\n";} - - /** Adds a touch of AJAX in bibtexbrowser to display bibtex entries inline. - * It uses the HIJAX design pattern: the Javascript code fetches the normal bibtex HTML page - * and extracts the bibtex. - * In other terms, URLs and content are left perfectly optimized for crawlers - * Note how beautiful is this piece of code thanks to JQuery. - */ - function javascript() { - // we use jquery with the official content delivery URLs - // Microsoft and Google also provide jquery with their content delivery networks -?> -'; /** NoWrapper calls method display() on the content. */ class NoWrapper { function NoWrapper(&$content) { - header('Content-type: text/html; charset='.ENCODING); + @header('Content-type: text/html; charset='.ENCODING); echo $content->display(); } } @@ -2887,7 +2895,9 @@ class Dispatcher { return 'END_DISPATCH'; } -} +} // end class Dispatcher + +} // end if (!defined('BIBTEXBROWSER')) new Dispatcher();