@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $DATA->set_page_metadata($this_page, 'title', 'Hansard'); |
8 | 8 | $DATA->set_page_metadata($this_page, 'meta_description', |
9 | - 'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.'); |
|
9 | + 'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.'); |
|
10 | 10 | $DATA->set_page_metadata($this_page, 'meta_keywords', "hansard, search hansard, hansard transcriptions, hansard record, parliamentary transcripts, parliament transcripts, parliament records, uk hansard, hansard uk, house of commons transcript, house of commons debates, house of commons records"); |
11 | 11 | |
12 | 12 | $PAGE->supress_heading = true; |
@@ -14,20 +14,25 @@ discard block |
||
14 | 14 | $sender_email = get_http_var('sender_mail'); |
15 | 15 | $sender_name = get_http_var('sender_name'); |
16 | 16 | $pid = intval(get_http_var('pid')); |
17 | -if ($pid) |
|
17 | +if ($pid) { |
|
18 | 18 | $MEMBER = new MEMBER(array('person_id' => $pid)); |
19 | +} |
|
19 | 20 | |
20 | 21 | //validate them |
21 | 22 | $errors = array(); |
22 | 23 | |
23 | -if (!$pid) |
|
24 | +if (!$pid) { |
|
24 | 25 | $errors[] = 'You did not get to this page from an MP or Peer page. Please go back and try again.'; |
25 | -if (!preg_match('#^[^@]+@#', $recipient_email)) |
|
26 | +} |
|
27 | +if (!preg_match('#^[^@]+@#', $recipient_email)) { |
|
26 | 28 | $errors[] = "'$recipient_email' is not a valid recipient email address. Please have another go."; |
27 | -if (!validate_email($sender_email)) |
|
29 | +} |
|
30 | +if (!validate_email($sender_email)) { |
|
28 | 31 | $errors[] = "'$sender_email' is not a valid sender email address. Please have another go."; |
29 | -if (!$sender_name) |
|
32 | +} |
|
33 | +if (!$sender_name) { |
|
30 | 34 | $errors[] = "If you don't give us your name, we can't tell the recipient who sent them the link. We won't store it or use for any other purpose than sending this email."; |
35 | +} |
|
31 | 36 | |
32 | 37 | if (sizeof($errors)) { |
33 | 38 | print '<p>Please correct the following errors:</p>'; |
@@ -45,8 +50,11 @@ discard block |
||
45 | 50 | <?php |
46 | 51 | } else { |
47 | 52 | $rep_name = $MEMBER->full_name(); |
48 | - if ($MEMBER->house_disp==1) $rep_name .= ' MP'; |
|
49 | - elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA'; |
|
53 | + if ($MEMBER->house_disp==1) { |
|
54 | + $rep_name .= ' MP'; |
|
55 | + } elseif ($MEMBER->house_disp==3) { |
|
56 | + $rep_name .= ' MLA'; |
|
57 | + } |
|
50 | 58 | $data = array ( |
51 | 59 | 'template' => 'email_a_friend', |
52 | 60 | 'to' => $recipient_email, |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | <?php |
46 | 46 | } else { |
47 | 47 | $rep_name = $MEMBER->full_name(); |
48 | - if ($MEMBER->house_disp==1) $rep_name .= ' MP'; |
|
49 | - elseif ($MEMBER->house_disp==3) $rep_name .= ' MLA'; |
|
50 | - $data = array ( |
|
48 | + if ($MEMBER->house_disp == 1) $rep_name .= ' MP'; |
|
49 | + elseif ($MEMBER->house_disp == 3) $rep_name .= ' MLA'; |
|
50 | + $data = array( |
|
51 | 51 | 'template' => 'email_a_friend', |
52 | 52 | 'to' => $recipient_email, |
53 | 53 | 'subject' => 'Find out all about ' . $rep_name |
54 | 54 | ); |
55 | 55 | $url = $MEMBER->url(true); |
56 | - $merge = array ( |
|
56 | + $merge = array( |
|
57 | 57 | 'NAME' => $sender_name, |
58 | 58 | 'EMAIL' => $sender_email, |
59 | 59 | 'REP_NAME' => $rep_name, |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | $success = send_template_email($data, $merge); |
64 | 64 | if ($success) { |
65 | - print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to ".$MEMBER->full_name()."'s page</a></p>"; |
|
65 | + print "<p>Your email has been sent successfully. Thank you for using TheyWorkForYou.</p> <p><a href=\"$url\">Return to " . $MEMBER->full_name() . "'s page</a></p>"; |
|
66 | 66 | } else { |
67 | 67 | print "<p>Sorry, something went wrong trying to send an email. Please wait a few minutes and try again.</p>"; |
68 | 68 | } |
@@ -28,7 +28,9 @@ |
||
28 | 28 | |
29 | 29 | function out($h1, $h2, $title) { |
30 | 30 | global $out; |
31 | - if (!isset($out[$h1][$h2])) return; |
|
31 | + if (!isset($out[$h1][$h2])) { |
|
32 | + return; |
|
33 | + } |
|
32 | 34 | print "<h3>$title</h3>\n<ul>\n"; |
33 | 35 | foreach ($out[$h1][$h2] as $m) { |
34 | 36 | print '<li><a href="' . $m->url() . '">' . $m->full_name() . "</a></li>\n"; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | $args = $people->getArgs(); |
19 | 19 | $people->setMetaData($args); |
20 | 20 | $data = $people->getData($args); |
21 | -if ( isset($args['f']) && $args['f'] == 'csv' ) { |
|
21 | +if (isset($args['f']) && $args['f'] == 'csv') { |
|
22 | 22 | $people->sendAsCSV($data); |
23 | 23 | } else { |
24 | 24 | MySociety\TheyWorkForYou\Renderer::output("people/index", $data); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | $DATA->set_page_metadata($this_page, 'title', 'Parliament'); |
8 | 8 | $DATA->set_page_metadata($this_page, 'meta_description', |
9 | - 'What goes on in Parliament? Up-to-the-minute records on all MPs, debates, speeches and statements from the House of Commons, House of Lords, Scottish Parliament, and Northern Ireland Assembly.'); |
|
9 | + 'What goes on in Parliament? Up-to-the-minute records on all MPs, debates, speeches and statements from the House of Commons, House of Lords, Scottish Parliament, and Northern Ireland Assembly.'); |
|
10 | 10 | $DATA->set_page_metadata($this_page, 'meta_keywords', 'parliament, uk parliament, parliamentary, house of commons, house commons, house of lords, house lords, house of parliament, parliment, houses parliament, parliament uk, member of parliament, welsh assembly, scottish parliament, the parliament, house of parliment, houses of parliment, parliment uk, uk parliment, houses of parliament, parliament houses, parliament of uk, parliament in uk, the house of parliament, scottish parliment, members of parliament, parliament members, scotish parliament, parliament scottish, the house of commons, british parliament, what is parliament, the house of lords, the scottish parliament, london parliament, parliament london, the houses of parliament, english parliament, northern ireland parliament, the british parliament, northern ireland assembly, history of parliament, parliament history, parliament of england, england parliament'); |
11 | 11 | |
12 | 12 | $PAGE->supress_heading = true; |
@@ -7,7 +7,9 @@ |
||
7 | 7 | |
8 | 8 | $c = 0; |
9 | 9 | foreach ($all_news as $id => $news_row) { |
10 | - if ($c++ == 2) break; |
|
10 | + if ($c++ == 2) { |
|
11 | + break; |
|
12 | + } |
|
11 | 13 | list($title, $content, $date) = $news_row; |
12 | 14 | $url = news_individual_link($date, $title); |
13 | 15 | print "<h5><a href=\"$url\">" . $title . "</a></h5>"; |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | <?php |
26 | 26 | $c = 0; |
27 | 27 | foreach ($all_news as $id => $news_row) { |
28 | - if ($c++ == 10) break; |
|
28 | + if ($c++ == 10) { |
|
29 | + break; |
|
30 | + } |
|
29 | 31 | list($title, $content, $date) = $news_row; |
30 | 32 | $url = "https://www.theyworkforyou.com".news_individual_link($date, $title); |
31 | 33 | print "<rdf:li rdf:resource=\"$url\" />\n"; |
@@ -39,7 +41,9 @@ discard block |
||
39 | 41 | <?php |
40 | 42 | $c = 0; |
41 | 43 | foreach ($all_news as $id => $news_row) { |
42 | - if ($c++ == 10) break; |
|
44 | + if ($c++ == 10) { |
|
45 | + break; |
|
46 | + } |
|
43 | 47 | list($title, $content, $date) = $news_row; |
44 | 48 | $url = "https://www.theyworkforyou.com".news_individual_link($date, $title); |
45 | 49 | $excerpt = trim_characters(news_format_body($content), 0, 250); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | foreach ($all_news as $id => $news_row) { |
28 | 28 | if ($c++ == 10) break; |
29 | 29 | list($title, $content, $date) = $news_row; |
30 | - $url = "https://www.theyworkforyou.com".news_individual_link($date, $title); |
|
30 | + $url = "https://www.theyworkforyou.com" . news_individual_link($date, $title); |
|
31 | 31 | print "<rdf:li rdf:resource=\"$url\" />\n"; |
32 | 32 | } |
33 | 33 | ?> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | foreach ($all_news as $id => $news_row) { |
42 | 42 | if ($c++ == 10) break; |
43 | 43 | list($title, $content, $date) = $news_row; |
44 | - $url = "https://www.theyworkforyou.com".news_individual_link($date, $title); |
|
44 | + $url = "https://www.theyworkforyou.com" . news_individual_link($date, $title); |
|
45 | 45 | $excerpt = trim_characters(news_format_body($content), 0, 250); |
46 | 46 | $date = str_replace(" ", "T", $date) . "+00:00"; |
47 | 47 | ?> |
@@ -9,10 +9,14 @@ discard block |
||
9 | 9 | if (preg_match("#/(\d\d\d\d)/(\d\d)/(\d\d)/([a-z0-9_]+)(\.php)?$#", $uri, $matches)) { |
10 | 10 | // Individual item |
11 | 11 | list($all, $year, $month, $day, $ref) = $matches; |
12 | - if ($ref == "please_build_on_") $ref = "new_full_source_"; |
|
12 | + if ($ref == "please_build_on_") { |
|
13 | + $ref = "new_full_source_"; |
|
14 | + } |
|
13 | 15 | foreach ($all_news as $id => $news_row) { |
14 | 16 | list($title, $content, $date) = $news_row; |
15 | - if (news_format_ref($title) != $ref) continue; |
|
17 | + if (news_format_ref($title) != $ref) { |
|
18 | + continue; |
|
19 | + } |
|
16 | 20 | |
17 | 21 | $this_page = 'sitenews_individual'; |
18 | 22 | $DATA->set_page_metadata($this_page, 'title', $title); |
@@ -20,7 +24,9 @@ discard block |
||
20 | 24 | $PAGE->stripe_start(); |
21 | 25 | print news_format_body($content); |
22 | 26 | print "<p>Posted on " . format_date(substr($date, 0, 10), LONGDATEFORMAT) . " at " . substr($date, 11); |
23 | - if (isset($news_row[3])) print " by $news_row[3]"; |
|
27 | + if (isset($news_row[3])) { |
|
28 | + print " by $news_row[3]"; |
|
29 | + } |
|
24 | 30 | print " | <a href=\"" . news_individual_link($date, $title) . "\">Link to this</a>"; |
25 | 31 | break; |
26 | 32 | } |
@@ -37,12 +43,16 @@ discard block |
||
37 | 43 | $PAGE->stripe_start(); |
38 | 44 | foreach (array_reverse($all_news) as $id => $news_row) { |
39 | 45 | list($title, $content, $date) = $news_row; |
40 | - if (substr($date, 0, 7) != "$year-$month") continue; |
|
46 | + if (substr($date, 0, 7) != "$year-$month") { |
|
47 | + continue; |
|
48 | + } |
|
41 | 49 | print "<h3>" . format_date(substr($date, 0, 10), LONGDATEFORMAT) . "</h3>"; |
42 | 50 | print "<h4>" . $title . "</h4>"; |
43 | 51 | print news_format_body($content); |
44 | 52 | print "<p>Posted at " . substr($date, 11); |
45 | - if (isset($news_row[3])) print " by $news_row[3]"; |
|
53 | + if (isset($news_row[3])) { |
|
54 | + print " by $news_row[3]"; |
|
55 | + } |
|
46 | 56 | print " | <a href=\"" . news_individual_link($date, $title) . "\">Link to this</a>"; |
47 | 57 | } |
48 | 58 | } else { |
@@ -52,13 +62,17 @@ discard block |
||
52 | 62 | $PAGE->stripe_start(); |
53 | 63 | $c = 0; |
54 | 64 | foreach ($all_news as $id => $news_row) { |
55 | - if ($c++ == 10) break; |
|
65 | + if ($c++ == 10) { |
|
66 | + break; |
|
67 | + } |
|
56 | 68 | list($title, $content, $date) = $news_row; |
57 | 69 | print "<h3>" . format_date(substr($date, 0, 10), LONGDATEFORMAT) . "</h3>"; |
58 | 70 | print "<h4>" . $title . "</h4>"; |
59 | 71 | print news_format_body($content); |
60 | 72 | print "<p>Posted at " . substr($date, 11); |
61 | - if (isset($news_row[3])) print " by $news_row[3]"; |
|
73 | + if (isset($news_row[3])) { |
|
74 | + print " by $news_row[3]"; |
|
75 | + } |
|
62 | 76 | print " | <a href=\"" . news_individual_link($date, $title) . "\">Link to this</a>"; |
63 | 77 | } |
64 | 78 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function api_getAlerts_start_date($start_date) { |
4 | - $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date')); |
|
5 | - $alert = new ALERT(); |
|
6 | - $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']); |
|
7 | - api_output($data); |
|
4 | + $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date')); |
|
5 | + $alert = new ALERT(); |
|
6 | + $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']); |
|
7 | + api_output($data); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | ?> |
@@ -1,9 +1,9 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | function api_getAlerts_start_date($start_date) { |
4 | - $args = array ('start_date' => $start_date, 'end_date' => get_http_var('end_date')); |
|
4 | + $args = array('start_date' => $start_date, 'end_date' => get_http_var('end_date')); |
|
5 | 5 | $alert = new ALERT(); |
6 | - $data = $alert->fetch_between($confirmed=1, $deleted=0, $args['start_date'], $args['end_date']); |
|
6 | + $data = $alert->fetch_between($confirmed = 1, $deleted = 0, $args['start_date'], $args['end_date']); |
|
7 | 7 | api_output($data); |
8 | 8 | } |
9 | 9 |