@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <a href="<?= $item['list_url'] ?>" class="business-list__title"> |
2 | 2 | <h3> |
3 | - <?php if ( isset( $item['parent'] ) ) { ?> |
|
3 | + <?php if (isset($item['parent'])) { ?> |
|
4 | 4 | <?= $item['parent']['body'] ?> |
5 | 5 | <br><?= $item['body'] ?> |
6 | 6 | <?php } else { ?> |
@@ -9,14 +9,14 @@ discard block |
||
9 | 9 | </h3> |
10 | 10 | <span class="business-list__meta"> |
11 | 11 | <?= format_date($item['hdate'], LONGERDATEFORMAT) ?> |
12 | - <?= isset($item['contentcount']) ? '· ' . $item['contentcount'] . ( $item['contentcount'] == 1 ? ' speech' : ' speeches' ) : '' ?> |
|
12 | + <?= isset($item['contentcount']) ? '· ' . $item['contentcount'] . ($item['contentcount'] == 1 ? ' speech' : ' speeches') : '' ?> |
|
13 | 13 | </span> |
14 | 14 | </a> |
15 | -<?php if ( isset( $item['child'] ) ) { ?> |
|
15 | +<?php if (isset($item['child'])) { ?> |
|
16 | 16 | <p class="business-list__excerpt"> |
17 | - <?php if ( isset($item['child']['speaker']) && count($item['child']['speaker']) > 0 ) { ?> |
|
17 | + <?php if (isset($item['child']['speaker']) && count($item['child']['speaker']) > 0) { ?> |
|
18 | 18 | <a href="<?= $item['child']['speaker']['url'] ?>"><?= $item['child']['speaker']['name'] ?></a> |
19 | 19 | <?php } ?> |
20 | - <?= strip_tags(trim_characters( $item['child']['body'], 0, 200 )) ?> |
|
20 | + <?= strip_tags(trim_characters($item['child']['body'], 0, 200)) ?> |
|
21 | 21 | </p> |
22 | 22 | <?php } ?> |
@@ -33,17 +33,17 @@ |
||
33 | 33 | |
34 | 34 | echo '“' . $row['extract'] . "”</dd>\n"; |
35 | 35 | echo '<dd><em><small>This speech is '; |
36 | - if ($row['hpos']-$want['hpos']>0) { |
|
37 | - echo ($row['hpos']-$want['hpos']) . ' later than'; |
|
36 | + if ($row['hpos'] - $want['hpos'] > 0) { |
|
37 | + echo ($row['hpos'] - $want['hpos']) . ' later than'; |
|
38 | 38 | } else { |
39 | - echo ($want['hpos']-$row['hpos']) . ' earlier than'; |
|
39 | + echo ($want['hpos'] - $row['hpos']) . ' earlier than'; |
|
40 | 40 | } |
41 | 41 | echo ' the one you want – '; |
42 | - if ($row['video_status']&8 || !($row['video_status']&1)) { |
|
42 | + if ($row['video_status'] & 8 || !($row['video_status'] & 1)) { |
|
43 | 43 | echo ' it doesn\'t have any video'; |
44 | - } elseif ($row['video_status']&4) { |
|
44 | + } elseif ($row['video_status'] & 4) { |
|
45 | 45 | echo ' it has already been matched'; |
46 | - } elseif ($row['video_status']&1) { |
|
46 | + } elseif ($row['video_status'] & 1) { |
|
47 | 47 | # Only for Commons currently |
48 | 48 | echo ' if you prefer, <a target="_top" onclick="t = parent.document[\'video\'].currentTime(); this.href += t;" href="/video/?gid=debate/' . $row['gid'] . '&file=' . $want['file'] . '&start=">switch to matching this speech instead</a>'; |
49 | 49 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $USERURL->insert(array('u'=>$comment['user_id'])); |
78 | 78 | ?> |
79 | 79 | <div class="comment"> |
80 | - <p><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) .' '. _htmlentities($comment['lastname']); ?></strong></a><br> |
|
80 | + <p><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) . ' ' . _htmlentities($comment['lastname']); ?></strong></a><br> |
|
81 | 81 | <?php |
82 | 82 | // Make URLs into links and do <br>s. |
83 | 83 | $body = prepare_comment_for_display($comment['body']); // In utility.php |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | |
107 | 107 | if (($this_page != 'commentreport' && |
108 | - $this_page != 'addcomment' && |
|
108 | + $this_page != 'addcomment' && |
|
109 | 109 | $this_page != 'admin_commentreport') |
110 | 110 | && $THEUSER->is_able_to('reportcomment') |
111 | 111 | && !$comment['modflagged'] |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | // COMMENT REPORTING LINK. |
83 | 83 | |
84 | 84 | if (($this_page != 'commentreport' && |
85 | - $this_page != 'addcomment' && |
|
85 | + $this_page != 'addcomment' && |
|
86 | 86 | $this_page != 'admin_commentreport') |
87 | 87 | && $THEUSER->is_able_to('reportcomment') |
88 | 88 | && $THEUSER->user_id() != $comment['user_id'] |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $date = format_date($date, SHORTDATEFORMAT); |
118 | 118 | $time = format_time($time, TIMEFORMAT); |
119 | 119 | ?> |
120 | - <p class="credit"><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) .' '. _htmlentities($comment['lastname']); ?></strong></a><br> |
|
120 | + <p class="credit"><a href="<?php echo $USERURL->generate(); ?>" title="See information about this user"><strong><?php echo _htmlentities($comment['firstname']) . ' ' . _htmlentities($comment['lastname']); ?></strong></a><br> |
|
121 | 121 | <small>Posted on <?php echo $date; |
122 | 122 | |
123 | 123 | if (isset($comment['url'])) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | |
126 | 126 | } else { |
127 | 127 | // There won't be a URL when we're just previewing a comment. |
128 | - print ' '.$time; |
|
128 | + print ' ' . $time; |
|
129 | 129 | } |
130 | 130 | ?> <?php echo $reporthtml; ?></small></p> |
131 | 131 |
@@ -9,7 +9,7 @@ |
||
9 | 9 | 'body'=>'')); |
10 | 10 | ?> |
11 | 11 | <p> |
12 | - Vacher Dods charge <a href="http://www.dodonline.co.uk/engine.asp?showPage=article&id=2564"> 95 pounds </a> for this list of MPs names. We think democracy should be free. Click <?php echo '<a href="'.$csvurl.'">here</a>'; ?> to download a CSV (Comma Separated Values) file that you can load into Excel. |
|
12 | + Vacher Dods charge <a href="http://www.dodonline.co.uk/engine.asp?showPage=article&id=2564"> 95 pounds </a> for this list of MPs names. We think democracy should be free. Click <?php echo '<a href="' . $csvurl . '">here</a>'; ?> to download a CSV (Comma Separated Values) file that you can load into Excel. |
|
13 | 13 | </p> |
14 | 14 | <?php |
15 | 15 | $this->block_end(); |
@@ -36,7 +36,8 @@ |
||
36 | 36 | public function add($searchlogdata) { |
37 | 37 | |
38 | 38 | $ip = getenv('REMOTE_ADDR'); |
39 | - if (preg_match('#66\.249\.(6[4-9]|[78]\d|9[0-5])\.#', $ip)) { # Googlebot |
|
39 | + if (preg_match('#66\.249\.(6[4-9]|[78]\d|9[0-5])\.#', $ip)) { |
|
40 | +# Googlebot |
|
40 | 41 | return; |
41 | 42 | } |
42 | 43 | if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('#simplepie|bot#i', $_SERVER['HTTP_USER_AGENT'])) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | // Select popular queries |
72 | 72 | public function popular_recent($count, $max_chars = null) { |
73 | 73 | |
74 | - $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
74 | + $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
75 | 75 | WHERE count_hits != 0 AND query_string != 'twat' |
76 | 76 | AND query_string != 'suffragettes' AND page_number=1 |
77 | 77 | AND query_time > date_sub(NOW(), INTERVAL 1 DAY) |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $rowarray['query'] = $query; |
125 | 125 | $rowarray['visible_name'] = $visible_name; |
126 | 126 | $rowarray['url'] = $url; |
127 | - $rowarray['display'] = '<a href="' . $url . '">' . ($htmlescape ? _htmlentities($visible_name) : $visible_name). '</a>'; |
|
127 | + $rowarray['display'] = '<a href="' . $url . '">' . ($htmlescape ? _htmlentities($visible_name) : $visible_name) . '</a>'; |
|
128 | 128 | |
129 | 129 | return $rowarray; |
130 | 130 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | public function admin_popular_searches($count) { |
145 | 145 | |
146 | - $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
146 | + $q = $this->db->query("SELECT query_string, count(*) AS c FROM search_query_log |
|
147 | 147 | WHERE count_hits != 0 AND query_string NOT LIKE '%speaker:%' |
148 | 148 | AND query_time > date_sub(NOW(), INTERVAL 30 DAY) |
149 | 149 | GROUP BY query_string ORDER BY c desc LIMIT $count;"); |
@@ -9,8 +9,8 @@ |
||
9 | 9 | <div class="search-page__section search-page__section--results"> |
10 | 10 | <div class="search-page__section__primary"> |
11 | 11 | <?php |
12 | - # XXX Hack |
|
13 | - if (preg_match('#budget#', $searchstring)) { ?> |
|
12 | + # XXX Hack |
|
13 | + if (preg_match('#budget#', $searchstring)) { ?> |
|
14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
15 | 15 | <?php } ?> |
16 | 16 |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <div class="full-page"> |
2 | - <div class="full-page__row search-page <?php if ( !$searchstring ) { ?>search-page--blank<?php } ?>"> |
|
2 | + <div class="full-page__row search-page <?php if (!$searchstring) { ?>search-page--blank<?php } ?>"> |
|
3 | 3 | |
4 | 4 | <form class="js-search-form-without-options"> |
5 | 5 | <?php include 'form_main.php'; ?> |
6 | 6 | </form> |
7 | 7 | |
8 | - <?php if ( $searchstring && !isset($warnings) ) { ?> |
|
8 | + <?php if ($searchstring && !isset($warnings)) { ?> |
|
9 | 9 | <div class="search-page__section search-page__section--results"> |
10 | 10 | <div class="search-page__section__primary"> |
11 | 11 | <?php |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
15 | 15 | <?php } ?> |
16 | 16 | |
17 | - <?php if ( $cons ) { ?> |
|
18 | - <?php if ( count($cons) > 1 ) { |
|
17 | + <?php if ($cons) { ?> |
|
18 | + <?php if (count($cons) > 1) { |
|
19 | 19 | $types = array(); |
20 | - if ( $mp_types['mp'] > 0 ) { |
|
20 | + if ($mp_types['mp'] > 0) { |
|
21 | 21 | $types[] = 'MPs'; |
22 | 22 | } |
23 | - if ( $mp_types['former'] > 0 ) { |
|
23 | + if ($mp_types['former'] > 0) { |
|
24 | 24 | $types[] = 'former MPs'; |
25 | 25 | } |
26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | <?php } else { // count($cons) <= 1 ?> |
30 | 30 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
31 | 31 | <?php } ?> |
32 | - <?php foreach ( $cons as $member ) { ?> |
|
32 | + <?php foreach ($cons as $member) { ?> |
|
33 | 33 | <?php include('person.php'); ?> |
34 | 34 | <?php } ?> |
35 | 35 | <?php } ?> |
36 | 36 | |
37 | - <?php if ( $members ) { ?> |
|
37 | + <?php if ($members) { ?> |
|
38 | 38 | <h2>People matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
39 | - <?php foreach ( $members as $member ) { ?> |
|
39 | + <?php foreach ($members as $member) { ?> |
|
40 | 40 | <?php include('person.php'); ?> |
41 | 41 | <?php } ?> |
42 | 42 | <hr> |
@@ -44,25 +44,25 @@ discard block |
||
44 | 44 | |
45 | 45 | <?php if ($glossary) { ?> |
46 | 46 | <h2>Glossary items matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
47 | - <?php foreach ( $glossary as $item ) { ?> |
|
47 | + <?php foreach ($glossary as $item) { ?> |
|
48 | 48 | <?php include('glossary.php'); ?> |
49 | 49 | <?php } ?> |
50 | 50 | <hr> |
51 | 51 | <?php } ?> |
52 | 52 | |
53 | - <?php if ( isset($pid) && $wtt == 2 ) { ?> |
|
53 | + <?php if (isset($pid) && $wtt == 2) { ?> |
|
54 | 54 | <p>I want to <a href="https://www.writetothem.com/lords/?pid=<?= $pid ?>">write to <?= $wtt_lord_name ?></a></p> |
55 | 55 | <?php } ?> |
56 | 56 | |
57 | - <?php if ( isset($error) ) { ?> |
|
57 | + <?php if (isset($error)) { ?> |
|
58 | 58 | There was an error – <?= $error ?> – searching for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em>. |
59 | 59 | <?php } else { ?> |
60 | 60 | <h2> |
61 | - <?php if ( $pagination_links ) { ?> |
|
61 | + <?php if ($pagination_links) { ?> |
|
62 | 62 | Results <?= $pagination_links['first_result'] ?>–<?= $pagination_links['last_result'] ?> of <?= $info['total_results'] ?> |
63 | - <?php } else if ( $info['total_results'] == 1 ) { ?> |
|
63 | + <?php } else if ($info['total_results'] == 1) { ?> |
|
64 | 64 | The only result |
65 | - <?php } else if ( $info['total_results'] == 0 ) { ?> |
|
65 | + <?php } else if ($info['total_results'] == 0) { ?> |
|
66 | 66 | There were no results |
67 | 67 | <?php } else { ?> |
68 | 68 | All <?= $info['total_results'] ?> results |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | for <em class="current-search-term"><?= _htmlentities($searchdescription) ?></em> |
71 | 71 | </h2> |
72 | 72 | |
73 | - <?php if ( $info['spelling_correction'] ) { ?> |
|
74 | - <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities( $info['spelling_correction_display'] ) ?></a>?</p> |
|
73 | + <?php if ($info['spelling_correction']) { ?> |
|
74 | + <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities($info['spelling_correction_display']) ?></a>?</p> |
|
75 | 75 | <?php } ?> |
76 | 76 | |
77 | - <?php if ( $info['total_results'] ) { ?> |
|
77 | + <?php if ($info['total_results']) { ?> |
|
78 | 78 | <ul class="search-result-display-options"> |
79 | - <?php if ( $sort_order == 'relevance' ) { ?> |
|
79 | + <?php if ($sort_order == 'relevance') { ?> |
|
80 | 80 | <li>Sorted by relevance</li> |
81 | 81 | <li>Sort by date: <a href="<?= $urls['newest'] ?>">newest</a> / <a href="<?= $urls['oldest'] ?>">oldest</a></li> |
82 | - <?php } else if ( $sort_order == 'oldest' ) { ?> |
|
82 | + <?php } else if ($sort_order == 'oldest') { ?> |
|
83 | 83 | <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li> |
84 | 84 | <li>Sorted by date: <a href="<?= $urls['newest'] ?>">newest</a> / oldest</li> |
85 | 85 | <?php } else { ?> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | </ul> |
91 | 91 | <?php } ?> |
92 | 92 | |
93 | - <?php foreach ( $rows as $result ) { ?> |
|
93 | + <?php foreach ($rows as $result) { ?> |
|
94 | 94 | <div class="search-result search-result--generic"> |
95 | 95 | <h3 class="search-result__title"><a href="<?= $result['listurl'] ?>"><?= $result['parent']['body'] ?></a> (<?= format_date($result['hdate'], SHORTDATEFORMAT) ?>)</h3> |
96 | 96 | <p class="search-result__description"><?= isset($result['speaker']) ? $result['speaker']['name'] . ': ' : '' ?><?= $result['extract'] ?></p> |
@@ -99,16 +99,16 @@ discard block |
||
99 | 99 | |
100 | 100 | <hr> |
101 | 101 | |
102 | - <?php if ( $pagination_links ) { ?> |
|
102 | + <?php if ($pagination_links) { ?> |
|
103 | 103 | <div class="search-result-pagination"> |
104 | - <?php if ( isset($pagination_links['prev']) ) { ?> |
|
104 | + <?php if (isset($pagination_links['prev'])) { ?> |
|
105 | 105 | <a href="<?= $pagination_links['firstpage']['url'] ?>" title="First page"><<</a> |
106 | 106 | <a href="<?= $pagination_links['prev']['url'] ?>" title="Previous page"><</a> |
107 | 107 | <?php } ?> |
108 | - <?php foreach ( $pagination_links['nums'] as $link ) { ?> |
|
108 | + <?php foreach ($pagination_links['nums'] as $link) { ?> |
|
109 | 109 | <a href="<?= $link['url'] ?>"<?= $link['current'] ? ' class="search-result-pagination__current-page"' : '' ?>><?= $link['page'] ?></a> |
110 | 110 | <?php } ?> |
111 | - <?php if ( isset($pagination_links['next']) ) { ?> |
|
111 | + <?php if (isset($pagination_links['next'])) { ?> |
|
112 | 112 | <a href="<?= $pagination_links['next']['url'] ?>" title="Next page">></a> |
113 | 113 | <a href="<?= $pagination_links['lastpage']['url'] ?>" title="Final page">>></a> |
114 | 114 | <?php } ?> |
@@ -26,7 +26,8 @@ |
||
26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
27 | 27 | ?> |
28 | 28 | <h2><?= $desc ?> in constituencies matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
29 | - <?php } else { // count($cons) <= 1 ?> |
|
29 | + <?php } else { |
|
30 | +// count($cons) <= 1 ?> |
|
30 | 31 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
31 | 32 | <?php } ?> |
32 | 33 | <?php foreach ( $cons as $member ) { ?> |
@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | if ($hide_question) { |
34 | 34 | $always_ask = 0; |
35 | 35 | $show_survey_qn = $current_question; |
36 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
36 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
37 | 37 | } elseif ($has_answered_question == $current_question && !$always_ask) { |
38 | 38 | $show_survey_qn = $current_question; |
39 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
39 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
40 | 40 | } elseif (isset($_COOKIE['survey'])) { |
41 | 41 | $show_survey_qn = $_COOKIE['survey']; |
42 | 42 | } |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | if ($show_survey_qn < $current_question && !$has_answered_question) { |
50 | 50 | $page_url = ''; |
51 | 51 | $hide_url = ''; |
52 | - if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) { |
|
52 | + if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) { |
|
53 | 53 | global $MEMBER; |
54 | 54 | $page_url = $MEMBER->url(true) . "?answered_survey=$current_question"; |
55 | 55 | $hide_url = $MEMBER->url() . "?hide_survey=$current_question"; |
56 | 56 | } else { |
57 | 57 | $URL = new \MySociety\TheyWorkForYou\Url($this_page); |
58 | - $URL->insert(array('answered_survey' => $current_question )); |
|
58 | + $URL->insert(array('answered_survey' => $current_question)); |
|
59 | 59 | $page_url = 'https://' . DOMAIN . $URL->generate(); |
60 | 60 | $URL = new \MySociety\TheyWorkForYou\Url($this_page); |
61 | - $URL->insert(array('hide_survey' => $current_question )); |
|
61 | + $URL->insert(array('hide_survey' => $current_question)); |
|
62 | 62 | $hide_url = $URL->generate(); |
63 | 63 | } |
64 | 64 |
@@ -20,7 +20,7 @@ |
||
20 | 20 | $anchor = '#addcomment'; |
21 | 21 | |
22 | 22 | $URL = new \MySociety\TheyWorkForYou\Url('userjoin'); |
23 | -$URL->insert(array('ret'=>$returl.$anchor)); |
|
23 | +$URL->insert(array('ret'=>$returl . $anchor)); |
|
24 | 24 | $joinurl = $URL->generate(); |
25 | 25 | |
26 | 26 |