From c2156dcb7979cac801275ae39a494bf9f5246a21 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 31 Jan 2018 00:38:30 -0500 Subject: [PATCH 1/4] refactor into heredoc for readability --- .gitignore | 17 +++++++++++++++++ bibtexbrowser.php | 43 ++++++++++++++++++++++++------------------- 2 files changed, 41 insertions(+), 19 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b7cd887 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db + +# emacs +*~ + + +bibtexbrowser*.dat +public/ +vendor/ \ No newline at end of file diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 613de6d..6978056 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -1228,7 +1228,7 @@ class BibEntry { // we assume that "comment" is never latex code // but instead could contain HTML code (with links using the character "~" for example) // so "comment" is not transformed too - if ($name!='url' && $name!='comment' + if ($name!='url' && $name!='comment' && !preg_match('/^hp_/',$name) // homepage links should not be transformed with latex2html ) { $value = $this->transformValue($value); @@ -4152,7 +4152,7 @@ echo "\n".' -->'; ?> - @@ -4740,23 +4740,28 @@ class Dispatcher { exit; } - function frameset() { ?> - - - - - - - - You are browsing <?php echo htmlentities($_GET[Q_FILE], ENT_QUOTES); ?> with bibtexbrowser - - - - - - - - + + + + +You are browsing $bibFilename with bibtexbrowser + + + + + + +HTML; + // return 'END_DISPATCH'; } From a95ba5f0fb6ea8b6315bcc83004568d4eb9e6789 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 31 Jan 2018 00:46:36 -0500 Subject: [PATCH 2/4] refactor another heredoc --- bibtexbrowser.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 6978056..3e7568c 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -4102,23 +4102,23 @@ usage: getRSS() getTitle() * $title: title of the page - */ -function HTMLTemplate($content) { +*/ +function HTMLTemplate($content) { +$OUTPUT_ENCODING = OUTPUT_ENCODING; // when we load a page with AJAX // the HTTP header is taken into account, not the header('Content-type: text/html; charset='.OUTPUT_ENCODING); -echo ''."\n"; - -?> +print << - + -getRSS()!='') echo ''; -?> - - + From d23d4ad8a32e0480558fcb5616cbc19acbe714e8 Mon Sep 17 00:00:00 2001 From: Chris Date: Wed, 31 Jan 2018 01:33:18 -0500 Subject: [PATCH 3/4] refactor another heredoc --- bibtexbrowser.php | 134 +++++++++++++++++++++++----------------------- 1 file changed, 66 insertions(+), 68 deletions(-) diff --git a/bibtexbrowser.php b/bibtexbrowser.php index 3e7568c..d63a443 100755 --- a/bibtexbrowser.php +++ b/bibtexbrowser.php @@ -2669,7 +2669,9 @@ if (!function_exists('bibtexbrowser_top_banner')) { function javascript() { // we use jquery with the official content delivery URLs // Microsoft and Google also provide jquery with their content delivery networks -?> + $JQUERY_URI = JQUERY_URI; +print << +JS; } // end function javascript @@ -3959,8 +3960,7 @@ class BibDataBase { /** returns the default CSS of bibtexbrowser */ function bibtexbrowserDefaultCSS() { -?> - +$css = <<<BODY> and TITLE) @@ -4105,58 +4105,54 @@ usage: */ function HTMLTemplate($content) { -$OUTPUT_ENCODING = OUTPUT_ENCODING; -// when we load a page with AJAX -// the HTTP header is taken into account, not the -header('Content-type: text/html; charset='.OUTPUT_ENCODING); -print << - - - - -HTML; - -// if ($content->getRSS()!='') echo ''; - - // we may add new metadata tags $metatags = array(); if (method_exists($content, 'metadata')) { $metatags = $content->metadata(); -} + } + + $htmlMetatags = ""; foreach($metatags as $item) { list($name,$value) = $item; - echo ''."\n"; + $htmlMetatags .= ''."\n"; } // end foreach - - // now the title if (method_exists($content, 'getTitle')) { - echo ''.strip_tags($content->getTitle()).''; + $htmlTitle = ''.strip_tags($content->getTitle()).''; } -// now the CSS -echo ''; +$OUTPUT_ENCODING = OUTPUT_ENCODING; +// when we load a page with AJAX +// the HTTP header is taken into account, not the +header('Content-type: text/html; charset='.OUTPUT_ENCODING); +print << + + + + + $htmlMetatags + $htmlTitle + + + +HTML; + +// if ($content->getRSS()!='') echo ''; -?> - - - -" . $content->getTitle() . ""; } @@ -4369,42 +4365,43 @@ class RSSDisplay { $this->entries = $entries; } - function setWrapper($x) { $x->wrapper = 'NoWrapper'; } +function setWrapper($x) { $x->wrapper = 'NoWrapper'; } - function display() { - header('Content-type: application/rss+xml'); - echo ''; +function display() { + +foreach($this->entries as $bibentry) { +$bibEntryKey = urlencode(@$_GET[Q_FILE].'::'.$bibentry->getKey()); +$bibEntryUrl = $bibentry->getURL(); +$bibEntryTitle = $this->text2rss($bibentry->getTitle()); +$bibEntryAbstract = $this->text2rss(bib2html($bibentry)."\n".$bibentry->getAbstract()); // +$rssItems .= << + $bibEntryTitle + $bibEntryUrl + $bibEntryAbstract + $bibEntryKey + +RSS; +} -?> + header('Content-type: application/rss+xml'); + echo ''; + +$rssLink = 'http://' . @$_SERVER['HTTP_HOST'].htmlentities(@$_SERVER['REQUEST_URI']); +$atomLink = 'http://' . @$_SERVER['HTTP_HOST'].htmlentities(@$_SERVER['REQUEST_URI']); +print << - <?php echo $this->title;?> - http:// - + $this->title + $rssLink + bibtexbrowser v__GITHUB__ - -entries as $bibentry) { - ?> - - <?php echo $this->text2rss($bibentry->getTitle());?> - getURL();?> - - text2rss(bib2html($bibentry)."\n".$bibentry->getAbstract()); - ?> - - getKey());?> - - + $rssItems - -main(); */ + class Dispatcher { /** this is the query */ From b6278cc39283c90c9d3e44c1cf3703ced05c91f2 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 6 Feb 2018 12:43:32 -0500 Subject: [PATCH 4/4] bump --- .gitignore | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index b7cd887..91f1d3d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,13 +5,9 @@ ._* .Spotlight-V100 .Trashes -ehthumbs.db Thumbs.db +# other files to ignore # # emacs *~ - - bibtexbrowser*.dat -public/ -vendor/ \ No newline at end of file