Exemplo n.º 1
0
    /**
     * $content: an object with a display() method
     * $title: title of the page
     */
    function HTMLWrapper(&$content, $metatags = array())
    {
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        echo ENCODING;
        ?>
"/>
<meta name="generator" content="bibtexbrowser v20101203" />
<?php 
        if ($content->getRSS() != '') {
            echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="' . $content->getRSS() . '&amp;rss" />';
        }
        foreach ($metatags as $item) {
            list($name, $value) = $item;
            echo '<meta name="' . $name . '" content="' . $value . '"/>' . "\n";
        }
        // end foreach
        // now the title
        echo '<title>' . strip_tags($content->getTitle()) . '</title>';
        // now the CSS
        echo '<style type="text/css"><!--  ' . "\n";
        if (is_readable(dirname(__FILE__) . '/bibtexbrowser.css')) {
            readfile(dirname(__FILE__) . '/bibtexbrowser.css');
        } else {
            bibtexbrowserDefaultCSS();
        }
        echo "\n" . ' --></style>';
        ?>
</head>
<body>
<?php 
        $content->display();
        ?>
</body>
</html>
<?php 
        //exit;
    }
    /** encapsulates the content of a delegate into full-fledged HTML (&lt;HTML>&lt;BODY> and TITLE)
    usage:
    <pre>
      $db = zetDB('metrics.bib');
      $dis = new BibEntryDisplay($db->getEntryByKey('Schmietendorf2000'));
      new HTMLTemplate($dis);
    </pre>
     * $content: an object with methods
          display()
          getRSS()
          getTitle()
     * $title: title of the page
     */
    function HTMLTemplate(&$content)
    {
        // when we load a page with AJAX
        // the HTTP header is taken into account, not the <meta http-equiv>
        header('Content-type: text/html; charset=' . OUTPUT_ENCODING);
        echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
        ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
        echo OUTPUT_ENCODING;
        ?>
"/>
<meta name="generator" content="bibtexbrowser vd4928b33fa2d82db7989e31871c75f917d0b2b8d" />
<?php 
        // if ($content->getRSS()!='') echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="'.$content->getRSS().'&amp;rss" />';
        // we may add new metadata tags
        $metatags = array();
        if (method_exists($content, 'metadata')) {
            $metatags = $content->metadata();
        }
        foreach ($metatags as $item) {
            list($name, $value) = $item;
            echo '<meta name="' . $name . '" property="' . $name . '" content="' . $value . '"/>' . "\n";
        }
        // end foreach
        // now the title
        if (method_exists($content, 'getTitle')) {
            echo '<title>' . strip_tags($content->getTitle()) . '</title>';
        }
        // now the CSS
        echo '<style type="text/css"><!--  ' . "\n";
        if (method_exists($content, 'getCSS')) {
            echo $content->getCSS();
        } else {
            if (is_readable(dirname(__FILE__) . '/bibtexbrowser.css')) {
                readfile(dirname(__FILE__) . '/bibtexbrowser.css');
            } else {
                bibtexbrowserDefaultCSS();
            }
        }
        echo "\n" . ' --></style>';
        ?>
</head>
<body>
<?php 
        if (method_exists($content, 'getTitle')) {
            echo "<div class=\"rheader\">" . $content->getTitle() . "</div>";
        }
        $content->display();
        echo poweredby();
        if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) {
            javascript();
        }
        if (BIBTEXBROWSER_RENDER_MATH) {
            javascript_math();
        }
        ?>
</body>
</html>
<?php 
        //exit;
    }
Exemplo n.º 3
0
        /**
        * $content: an object with methods
             display() 
             getRSS()
             getTitle()
        * $title: title of the page
        */
        function HTMLWrapper(&$content, $metatags = array())
        {
            // when we load a page with AJAX
            // the HTTP header is taken into account, not the <meta http-equiv>
            header('Content-type: text/html; charset=' . ENCODING);
            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\n";
            ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php 
            echo ENCODING;
            ?>
"/>
<meta name="generator" content="bibtexbrowser v20121027" />
<?php 
            // if ($content->getRSS()!='') echo '<link rel="alternate" type="application/rss+xml" title="RSS" href="'.$content->getRSS().'&amp;rss" />';
            foreach ($metatags as $item) {
                list($name, $value) = $item;
                echo '<meta name="' . $name . '" content="' . $value . '"/>' . "\n";
            }
            // end foreach
            // now the title
            if (method_exists($content, 'getTitle')) {
                echo '<title>' . strip_tags($content->getTitle()) . '</title>';
            }
            // now the CSS
            echo '<style type="text/css"><!--  ' . "\n";
            if (method_exists($content, 'getCSS')) {
                echo $content->getCSS();
            } else {
                if (is_readable('layout/Ibisc.css')) {
                    readfile('layout/Ibisc.css');
                } else {
                    bibtexbrowserDefaultCSS();
                }
            }
            echo "\n" . ' --></style>';
            ?>
</head>
<body>
<?php 
            if (method_exists($content, 'getTitle')) {
                echo "<div class=\"rheader\">" . $content->getTitle() . "</div>";
            }
            $content->display();
            if (BIBTEXBROWSER_USE_PROGRESSIVE_ENHANCEMENT) {
                javascript();
            }
            ?>
</body>
</html>
<?php 
            //exit;
        }