예제 #1
0
    public 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_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 (!($meta_keywords = $DATA->page_metadata($this_page, "meta_keywords"))) {
            $meta_keywords = $keywords_title;
            if ($meta_keywords) {
                $meta_keywords .= ', ';
            }
            $meta_keywords .= 'Hansard, Official Report, Parliament, government, House of Commons, House of Lords, MP, Peer, Member of Parliament, MPs, Peers, Lords, Commons, Scottish Parliament, Northern Ireland Assembly, MSP, MLA, MSPs, MLAs';
        }
        $meta_description = '';
        if ($meta_description = $DATA->page_metadata($this_page, "meta_description")) {
            $meta_description = '<meta name="description" content="' . _htmlentities($meta_description) . '">';
        }
        if ($this_page != 'overview') {
            $URL = new URL('overview');
            $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']['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";
                }
            }
        }
        if (!($keywords = $DATA->page_metadata($this_page, "keywords"))) {
            $keywords = "";
        } else {
            $keywords = "," . $DATA->page_metadata($this_page, "keywords");
        }
        $robots = '';
        if (DEVSITE) {
            $robots = '<meta name="robots" content="noindex,nofollow">';
        } elseif ($robots = $DATA->page_metadata($this_page, 'robots')) {
            $robots = '<meta name="robots" content="' . $robots . '">';
        }
        if (!headers_sent()) {
            header('Content-Type: text/html; charset=iso-8859-1');
            if ($this_page == 'overview') {
                header('Vary: Cookie, X-GeoIP-Country');
                if (!DEVSITE) {
                    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 preg_replace('#<[^>]*>#', '', $title);
        ?>
</title>
    <?php 
        echo $meta_description;
        ?>
    <meta name="keywords" content="<?php 
        echo _htmlentities($meta_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;
        ?>
/">

    <meta property="og:title" content="TheyWorkForYou">
    <meta property="og:type" content="website">
    <meta property="og:url" content="http://<?php 
        echo DOMAIN;
        ?>
">
    <meta property="og:image" content="http://<?php 
        echo DOMAIN;
        ?>
/images/favicon-256.png">
    <meta property="og:description" content="TheyWorkForYou is a website which makes it easy to keep track of your local MP's activities.">
    <meta property="fb:admins" content="143203489083755">

    <script type="text/javascript" src="<?php 
        echo cache_version("js/jquery.js");
        ?>
"></script>
    <script type="text/javascript" src="<?php 
        echo cache_version("js/jquery.cookie.js");
        ?>
"></script>
    <script type="text/javascript" src="<?php 
        echo cache_version("js/main.js");
        ?>
"></script>
    <script type="text/javascript" src="<?php 
        echo cache_version("js/bar.js");
        ?>
"></script>
<?php 
        echo $linkshtml;
        # XXX Below line for speed
        ?>
    <link rel="stylesheet" href="<?php 
        echo cache_version("style/global.css");
        ?>
" type="text/css">
    <link rel="stylesheet" href="<?php 
        echo cache_version("style/print.css");
        ?>
" type="text/css" media="print">
<?php 
        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, '">';
        }
        ?>

        <link rel="apple-touch-icon" href="/images/apple-touch-60.png" />
        <link rel="apple-touch-icon" sizes="76x76" href="/images/apple-touch-76.png" />
        <link rel="apple-touch-icon" sizes="120x120" href="/images/apple-touch-120.png" />
        <link rel="apple-touch-icon" sizes="152x152" href="/images/apple-touch-152.png" />

        <?php 
        if (!DEVSITE) {
            ?>

<script type="text/javascript">

    (function (i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function () {
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

    ga('create', 'UA-660910-1');  // Replace with your property ID.
    ga('set', 'anonymizeIp', true);
    ga('send', 'pageview');

  function recordWTT(link, label) {
    ga('send', 'event', 'Links', 'WriteToThem', label);
    setTimeout('document.location = "' + link.href + '"', 100);
  }

  function trackFormSubmit(form, category, name, value) {
    try {
      ga('send', 'event', category, name, value);
    } catch (err) {}
    setTimeout(function () {
      form.submit();
      }, 100);
    }

</script>

<?php 
        }
        ?>

</head>

<?php 
    }
예제 #2
0
    ?>
">
    <?php 
}
?>

    <link rel="stylesheet" href="<?php 
echo cache_version("style/stylesheets/app.css");
?>
" type="text/css">
    <!--[if IE 8]><link rel="stylesheet" href="<?php 
echo cache_version("style/stylesheets/ie8.css");
?>
" type="text/css"><![endif]-->
    <script type="text/javascript" src="<?php 
echo cache_version("js/respond.min.js");
?>
"></script>

    <?php 
if (isset($page_rss_url)) {
    ?>
    <link rel="alternate" type="application/rss+xml" title="TheyWorkForYou RSS" href="<?php 
    echo $page_rss_url;
    ?>
">
    <?php 
}
?>

    <link rel="apple-touch-icon" href="/images/apple-touch-60.png" />
예제 #3
0
<div id="whereNextModal" class="reveal-modal" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
    <h2 id="modalTitle">Where to next?</h2>
    <p class="lead">Do you know what would you like to do with the information on this page?</p>
    <p>We are looking at ways to improve this site. In one click, please tell us what you will do with the information you have found on this page.</p>
    <ul>
        <li><a id="research-quant2-bucket1-wherenext" href="/action/where-next">I&rsquo;m not sure &mdash; Click here for suggestions on what to do next</a></li>
        <li><a data-research-quant2-bucket1-linkname="write-mp">I&rsquo;m going to write to an MP</a></li>
        <li><a data-research-quant2-bucket1-linkname="social-share">I&rsquo;m going to share this information on social media</a></li>
        <li><a data-research-quant2-bucket1-linkname="work">I&rsquo;m going to use this information for work purposes</a></li>
        <li><a data-research-quant2-bucket1-linkname="browsing">I don&rsquo;t need to do anything with this information &mdash; I was just browsing</a></li>
    </ul>
</div>

<script src="<?php 
echo cache_version('js/jquery.storageapi.min.js');
?>
"></script>
<script src="<?php 
echo cache_version('js/quant2.js');
?>
"></script>