コード例 #1
0
ファイル: page.php プロジェクト: archoo/twfy
    function page_header_mobile()
    {
        // TODO: would be better to set a global switch/env flag to use in page_header(), etc. - oh well this will do for the moment
        global $DATA, $this_page;
        $linkshtml = "";
        $title = '';
        $sitetitle = $DATA->page_metadata($this_page, "sitetitle");
        $keywords_title = '';
        if ($this_page == 'home') {
            $title = $sitetitle . ': ' . $DATA->page_metadata($this_page, "title");
        } else {
            if ($page_subtitle = $DATA->page_metadata($this_page, "subtitle")) {
                $title = $page_subtitle;
            } elseif ($page_title = $DATA->page_metadata($this_page, "title")) {
                $title = $page_title;
            }
            // We'll put this in the meta keywords tag.
            $keywords_title = $title;
            $parent_page = $DATA->page_metadata($this_page, 'parent');
            if ($parent_title = $DATA->page_metadata($parent_page, 'title')) {
                $title .= ": {$parent_title}";
            }
            if ($title == '') {
                $title = $sitetitle;
            } else {
                $title .= ' (' . $sitetitle . ')';
            }
        }
        if (!($metakeywords = $DATA->page_metadata($this_page, "metakeywords"))) {
            $metakeywords = "";
        }
        if (!($metadescription = $DATA->page_metadata($this_page, "metadescription"))) {
            $metadescription = "";
        }
        if ($this_page != "home") {
            $URL = new URL('home');
            $linkshtml = "\t<link rel=\"start\" title=\"Home\" href=\"" . $URL->generate() . "\">\n";
        }
        // Create the next/prev/up links for navigation.
        // Their data is put in the metadata in hansardlist.php
        $nextprev = $DATA->page_metadata($this_page, "nextprev");
        if ($nextprev) {
            // Four different kinds of back/forth links we might build.
            $links = array("first", "prev", "up", "next", "last");
            foreach ($links as $n => $type) {
                if (isset($nextprev[$type]) && isset($nextprev[$type]['listurl'])) {
                    if (isset($nextprev[$type]['body'])) {
                        $linktitle = htmlentities(trim_characters($nextprev[$type]['body'], 0, 40));
                        if (isset($nextprev[$type]['speaker']) && count($nextprev[$type]['speaker']) > 0) {
                            $linktitle = $nextprev[$type]['speaker']['first_name'] . ' ' . $nextprev[$type]['speaker']['last_name'] . ': ' . $linktitle;
                        }
                    } elseif (isset($nextprev[$type]['hdate'])) {
                        $linktitle = format_date($nextprev[$type]['hdate'], SHORTDATEFORMAT);
                    }
                    $linkshtml .= "\t<link rel=\"{$type}\" title=\"{$linktitle}\" href=\"" . $nextprev[$type]['listurl'] . "\">\n";
                }
            }
        }
        // Needs to come before any HTML is output, in case it needs to set a cookie.
        $SKIN = new SKIN();
        $SKIN->set_skin("mobile");
        if (!($keywords = $DATA->page_metadata($this_page, "keywords"))) {
            $keywords = "";
        } else {
            $keywords = "," . $DATA->page_metadata($this_page, "keywords");
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title><?php 
        echo $title;
        ?>
</title>
	<meta name="description" content="Making parliament easy.">
	<meta name="keywords" content="Parliament, government, House of Representatives, Senate, Senator, MP, Member of Parliament, MPs, Australia, Australian, <?php 
        echo htmlentities($keywords_title) . htmlentities($keywords);
        ?>
">
	<meta name="verify-v1" content="5FBaCDi8kCKdo4s64NEdB5EOJDNc310SwcLLYHmEbgg=">
    <meta name = "viewport" content = "width=device-width; initial-scale=1.0; maximum-scale=1.0" />
	<link rel="author" title="Send feedback" href="mailto:<?php 
        echo str_replace('@', '&#64;', CONTACTEMAIL);
        ?>
">
	<link rel="home" title="Home" href="http://<?php 
        echo DOMAIN;
        ?>
/">
<?php 
        echo $linkshtml;
        $SKIN->output_stylesheets();
        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
            // If this page has an RSS feed set.
            ?>
	<link rel="alternate" type="application/rss+xml" title="OpenAustralia RSS" href="http://<?php 
            echo DOMAIN . WEBPATH . $rssurl;
            ?>
">
<?php 
        }
        if (!DEVSITE) {
            ?>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3107958-3");
pageTracker._initData();
pageTracker._trackPageview();
</script>

<?php 
        }
        ?>

</head>

<?php 
    }
コード例 #2
0
ファイル: page.php プロジェクト: sebbacon/theyworkforyou
    function page_header()
    {
        global $DATA, $this_page;
        $linkshtml = "";
        $title = '';
        $sitetitle = $DATA->page_metadata($this_page, "sitetitle");
        $keywords_title = '';
        if ($this_page == 'overview') {
            $title = $sitetitle . ': ' . $DATA->page_metadata($this_page, "title");
        } else {
            if ($page_subtitle = $DATA->page_metadata($this_page, "subtitle")) {
                $title = $page_subtitle;
            } elseif ($page_title = $DATA->page_metadata($this_page, "title")) {
                $title = $page_title;
            }
            // We'll put this in the meta keywords tag.
            $keywords_title = $title;
            $parent_page = $DATA->page_metadata($this_page, 'parent');
            if ($parent_title = $DATA->page_metadata($parent_page, 'title')) {
                if ($title) {
                    $title .= ': ';
                }
                $title .= $parent_title;
            }
            if ($title == '') {
                $title = $sitetitle;
            } else {
                $title .= ' (' . $sitetitle . ')';
            }
        }
        if (!($metakeywords = $DATA->page_metadata($this_page, "metakeywords"))) {
            $metakeywords = "";
        }
        if (!($metadescription = $DATA->page_metadata($this_page, "metadescription"))) {
            $metadescription = "";
        }
        if ($this_page != "home") {
            $URL = new URL('home');
            $linkshtml = "\t<link rel=\"start\" title=\"Home\" href=\"" . $URL->generate() . "\">\n";
        }
        // Create the next/prev/up links for navigation.
        // Their data is put in the metadata in hansardlist.php
        $nextprev = $DATA->page_metadata($this_page, "nextprev");
        if ($nextprev) {
            // Four different kinds of back/forth links we might build.
            $links = array("first", "prev", "up", "next", "last");
            foreach ($links as $n => $type) {
                if (isset($nextprev[$type]) && isset($nextprev[$type]['listurl'])) {
                    if (isset($nextprev[$type]['body'])) {
                        $linktitle = htmlentities(trim_characters($nextprev[$type]['body'], 0, 40));
                        if (isset($nextprev[$type]['speaker']) && count($nextprev[$type]['speaker']) > 0) {
                            $linktitle = $nextprev[$type]['speaker']['first_name'] . ' ' . $nextprev[$type]['speaker']['last_name'] . ': ' . $linktitle;
                        }
                    } elseif (isset($nextprev[$type]['hdate'])) {
                        $linktitle = format_date($nextprev[$type]['hdate'], SHORTDATEFORMAT);
                    }
                    $linkshtml .= "\t<link rel=\"{$type}\" title=\"{$linktitle}\" href=\"" . $nextprev[$type]['listurl'] . "\">\n";
                }
            }
        }
        // Needs to come before any HTML is output, in case it needs to set a cookie.
        $SKIN = new SKIN();
        if (!($keywords = $DATA->page_metadata($this_page, "keywords"))) {
            $keywords = "";
        } else {
            $keywords = "," . $DATA->page_metadata($this_page, "keywords");
        }
        $robots = '';
        if ($robots = $DATA->page_metadata($this_page, 'robots')) {
            $robots = '<meta name="robots" content="' . $robots . '">';
        }
        header('Content-Type: text/html; charset=iso-8859-1');
        if ($this_page == 'home') {
            header('Vary: Cookie, X-GeoIP-Country');
            header('Cache-Control: max-age=600');
        }
        ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
	<title><?php 
        echo $title;
        ?>
</title>
	<meta name="description" content="Making parliament easy.">
	<meta name="keywords" content="Parliament, government, house of commons, house of lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, UK, Britain, British, Welsh, Scottish, Wales, Scotland, <?php 
        echo htmlentities($keywords_title) . htmlentities($keywords);
        ?>
">
	<?php 
        echo $robots;
        ?>
	<link rel="author" title="Send feedback" href="mailto:<?php 
        echo str_replace('@', '&#64;', CONTACTEMAIL);
        ?>
">
	<link rel="home" title="Home" href="http://<?php 
        echo DOMAIN;
        ?>
/">
	<script type="text/javascript" src="/js/jquery.js"></script>
	<script type="text/javascript" src="/js/jquery.cookie.js"></script>
	<script type="text/javascript" src="/jslib/share/share.js"></script>
	<script type="text/javascript" src="/js/main.js"></script>	
	<script type="text/javascript" src="/js/bar.js"></script>	
<?php 
        echo $linkshtml;
        $SKIN->output_stylesheets();
        if ($rssurl = $DATA->page_metadata($this_page, 'rss')) {
            // If this page has an RSS feed set.
            echo '<link rel="alternate" type="application/rss+xml" title="TheyWorkForYou RSS" href="http://', DOMAIN, WEBPATH, $rssurl, '">';
        }
        if (!DEVSITE) {
            ?>

<script src="http://www.google-analytics.com/urchin.js"
type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-660910-1";
if (typeof urchinTracker == 'function') urchinTracker();
</script>

<?php 
        }
        echo '</head>';
    }