@@ -12,8 +12,8 @@ |
||
12 | 12 | |
13 | 13 | $ym = substr($date, 0, 7); |
14 | 14 | if ($ym != $last) { |
15 | - $url = WEBPATH . "news/archives/".str_replace("-", "/", $ym); |
|
16 | - print "<a href=\"$url\">".format_date($ym."-01", "F Y")."</a>"; |
|
15 | + $url = WEBPATH . "news/archives/" . str_replace("-", "/", $ym); |
|
16 | + print "<a href=\"$url\">" . format_date($ym . "-01", "F Y") . "</a>"; |
|
17 | 17 | print "<br>"; |
18 | 18 | $last = $ym; |
19 | 19 | } |
@@ -18,11 +18,16 @@ discard block |
||
18 | 18 | $htime = $q->field(0, 'htime'); |
19 | 19 | $atime = $q->field(0, 'atime'); |
20 | 20 | $adate = $q->field(0, 'adate'); |
21 | -if ($atime) $htime = $atime; |
|
22 | -if ($adate) $hdate = $adate; |
|
21 | +if ($atime) { |
|
22 | + $htime = $atime; |
|
23 | +} |
|
24 | +if ($adate) { |
|
25 | + $hdate = $adate; |
|
26 | +} |
|
23 | 27 | |
24 | -if (!$hdate || !$htime || !$time) |
|
28 | +if (!$hdate || !$htime || !$time) { |
|
25 | 29 | exit; |
30 | +} |
|
26 | 31 | |
27 | 32 | $videodb = \MySociety\TheyWorkForYou\Utility\Video::dbConnect(); |
28 | 33 | if (!$file) { |
@@ -50,7 +55,8 @@ discard block |
||
50 | 55 | if ($THEUSER->isloggedin()) { |
51 | 56 | $user_id = $THEUSER->user_id(); |
52 | 57 | $q = $db->query("insert into video_timestamps (gid, user_id, adate, atime) values ('$q_gid', $user_id, '$new_date', '$new_time') on duplicate key update adate=VALUES(adate),atime=VALUES(atime),deleted=0"); |
53 | -} else { |
|
58 | +} |
|
59 | +else { |
|
54 | 60 | $q = $db->query("insert into video_timestamps (gid, adate, atime) values ('$q_gid', '$new_date', '$new_time')"); |
55 | 61 | } |
56 | 62 | $new_id = $q->insert_id(); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $major = intval(get_http_var('major')); |
8 | 8 | if (!$major) $major = 1; |
9 | 9 | |
10 | -if ($action == 'next' || $action=='nextneeded') { |
|
10 | +if ($action == 'next' || $action == 'nextneeded') { |
|
11 | 11 | $gid = get_http_var('gid'); |
12 | 12 | $file = intval(get_http_var('file')); |
13 | 13 | $time = intval(get_http_var('time')); |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $q = $db->query("select gid, hpos from hansard |
28 | 28 | where hpos>$hpos and hdate='$hdate' and major=$major |
29 | 29 | and (htype=12 or htype=13) " |
30 | - . ($action=='nextneeded'?'and video_status in (1,3)':'') . " |
|
30 | + . ($action == 'nextneeded' ? 'and video_status in (1,3)' : '') . " |
|
31 | 31 | ORDER BY hpos LIMIT 1"); |
32 | 32 | if (!$q->rows()) { |
33 | 33 | $PAGE->page_start(); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } else { |
42 | 42 | $new_gid = $q->field(0, 'gid'); |
43 | 43 | $new_hpos = $q->field(0, 'hpos'); |
44 | - if ($action=='nextneeded') { |
|
44 | + if ($action == 'nextneeded') { |
|
45 | 45 | $q = $db->query("select adate, atime from hansard, video_timestamps |
46 | 46 | where hansard.gid = video_timestamps.gid and deleted=0 |
47 | 47 | and hpos<$new_hpos and hdate='$hdate' and major=$major |
@@ -5,7 +5,9 @@ discard block |
||
5 | 5 | $action = get_http_var('action'); |
6 | 6 | $pid = intval(get_http_var('pid')); |
7 | 7 | $major = intval(get_http_var('major')); |
8 | -if (!$major) $major = 1; |
|
8 | +if (!$major) { |
|
9 | + $major = 1; |
|
10 | +} |
|
9 | 11 | |
10 | 12 | if ($action == 'next' || $action=='nextneeded') { |
11 | 13 | $gid = get_http_var('gid'); |
@@ -38,7 +40,8 @@ discard block |
||
38 | 40 | ;-)</p>'; |
39 | 41 | $PAGE->stripe_end(); |
40 | 42 | $PAGE->page_end(); |
41 | - } else { |
|
43 | + } |
|
44 | + else { |
|
42 | 45 | $new_gid = $q->field(0, 'gid'); |
43 | 46 | $new_hpos = $q->field(0, 'hpos'); |
44 | 47 | if ($action=='nextneeded') { |
@@ -59,7 +62,8 @@ discard block |
||
59 | 62 | $new_gid = fix_gid_but_leave_section($new_gid); |
60 | 63 | header('Location: /video/?from=next&file=' . $file . '&gid=' . $new_gid . '&start=' . $time); |
61 | 64 | } |
62 | -} elseif ($action == 'random' && $pid) { |
|
65 | +} |
|
66 | +elseif ($action == 'random' && $pid) { |
|
63 | 67 | $db = new ParlDB; |
64 | 68 | $q = $db->query("select gid from hansard |
65 | 69 | where video_status in (1,3) and major=:major |
@@ -68,7 +72,8 @@ discard block |
||
68 | 72 | ORDER BY RAND() LIMIT 1", array(':major' => $major, ':pid' => $pid)); |
69 | 73 | $new_gid = fix_gid_but_leave_section($q->field(0, 'gid')); |
70 | 74 | header('Location: /video/?from=random&pid=' . $pid . '&gid=' . $new_gid); |
71 | -} elseif ($action == 'random') { |
|
75 | +} |
|
76 | +elseif ($action == 'random') { |
|
72 | 77 | $db = new ParlDB; |
73 | 78 | $q = $db->query("select gid, hpos, hdate from hansard |
74 | 79 | where video_status in (1,3) and major=:major |
@@ -96,7 +101,8 @@ discard block |
||
96 | 101 | */ |
97 | 102 | $gid = fix_gid_but_leave_section($gid); |
98 | 103 | header('Location: /video/?from=random&gid=' . $gid); |
99 | -} else { |
|
104 | +} |
|
105 | +else { |
|
100 | 106 | # Illegal action |
101 | 107 | } |
102 | 108 |
@@ -55,7 +55,7 @@ |
||
55 | 55 | $want['hpos'] = $q->field(0, 'hpos'); |
56 | 56 | |
57 | 57 | $LIST = new DEBATELIST; |
58 | - $args = array ( |
|
58 | + $args = array( |
|
59 | 59 | 's' => $search, |
60 | 60 | 'p' => 1, |
61 | 61 | 'num' => 200, |
@@ -19,7 +19,8 @@ |
||
19 | 19 | if ($search = get_http_var('s')) { |
20 | 20 | search_box($file); |
21 | 21 | day_speeches($search, $gid_type, $gid_date); |
22 | -} else { ?> |
|
22 | +} |
|
23 | +else { ?> |
|
23 | 24 | <p>If the playing speech appears to be in completely the wrong place, |
24 | 25 | enter the speaking MP's name and/or something they're saying in this search box |
25 | 26 | to search the day's speeches. Find the correct speech and it will say how |
@@ -11,7 +11,7 @@ |
||
11 | 11 | $view = new MySociety\TheyWorkForYou\SectionView\WransView(); |
12 | 12 | $data = $view->display(); |
13 | 13 | if ($data) { |
14 | - if ( $data['template'] ) { |
|
14 | + if ($data['template']) { |
|
15 | 15 | $template = $data['template']; |
16 | 16 | } else { |
17 | 17 | $template = 'section/section'; |
@@ -13,7 +13,8 @@ |
||
13 | 13 | if ($data) { |
14 | 14 | if ( $data['template'] ) { |
15 | 15 | $template = $data['template']; |
16 | - } else { |
|
16 | + } |
|
17 | + else { |
|
17 | 18 | $template = 'section/section'; |
18 | 19 | } |
19 | 20 | MySociety\TheyWorkForYou\Renderer::output($template, $data); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | 13 | } else { |
14 | - $dept = strtolower(str_replace('_',' ',$dept)); |
|
14 | + $dept = strtolower(str_replace('_', ' ', $dept)); |
|
15 | 15 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 16 | where hansard.epobject_id=epobject.epobject_id and major=3 and section_id=0 |
17 | 17 | and hdate>(select max(hdate) from hansard where major=3) - interval 7 day |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | ':dept' => $dept |
20 | 20 | )); |
21 | 21 | $ids = array(); |
22 | - for ($i=0; $i<$q->rows(); $i++) { |
|
22 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
23 | 23 | $ids[] = $q->field($i, 'epobject_id'); |
24 | 24 | } |
25 | 25 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | and section_id in (' . join(',', $ids) . ') |
31 | 31 | order by body'); |
32 | 32 | print '<ul>'; |
33 | - for ($i=0; $i<$q->rows(); $i++) { |
|
34 | - print '<li><a href="/wrans/?id=' . fix_gid_from_db($q->field($i, 'gid')). '">' . $q->field($i, 'body'). '</a>'; |
|
33 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
34 | + print '<li><a href="/wrans/?id=' . fix_gid_from_db($q->field($i, 'gid')) . '">' . $q->field($i, 'body') . '</a>'; |
|
35 | 35 | print '</li>'; |
36 | 36 | } |
37 | 37 | print '</ul>'; |
@@ -10,7 +10,8 @@ |
||
10 | 10 | $db = new ParlDB; |
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | -} else { |
|
13 | +} |
|
14 | +else { |
|
14 | 15 | $dept = strtolower(str_replace('_',' ',$dept)); |
15 | 16 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 17 | where hansard.epobject_id=epobject.epobject_id and major=3 and section_id=0 |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | 13 | } else { |
14 | - $dept = strtolower(str_replace('_',' ',$dept)); |
|
14 | + $dept = strtolower(str_replace('_', ' ', $dept)); |
|
15 | 15 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 16 | where hansard.epobject_id=epobject.epobject_id and major=4 and section_id=0 |
17 | 17 | and hdate>(select max(hdate) from hansard where major=4) - interval 7 day |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | ':dept' => $dept |
20 | 20 | )); |
21 | 21 | $ids = array(); |
22 | - for ($i=0; $i<$q->rows(); $i++) { |
|
22 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
23 | 23 | $ids[] = $q->field($i, 'epobject_id'); |
24 | 24 | } |
25 | 25 | |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | and section_id in (' . join(',', $ids) . ') |
31 | 31 | order by body'); |
32 | 32 | print '<ul>'; |
33 | - for ($i=0; $i<$q->rows(); $i++) { |
|
34 | - print '<li><a href="/wms/?id=' . fix_gid_from_db($q->field($i, 'gid')). '">' . $q->field($i, 'body'). '</a>'; |
|
33 | + for ($i = 0; $i < $q->rows(); $i++) { |
|
34 | + print '<li><a href="/wms/?id=' . fix_gid_from_db($q->field($i, 'gid')) . '">' . $q->field($i, 'body') . '</a>'; |
|
35 | 35 | print '</li>'; |
36 | 36 | } |
37 | 37 | print '</ul>'; |
@@ -10,7 +10,8 @@ |
||
10 | 10 | $db = new ParlDB; |
11 | 11 | |
12 | 12 | if (!$dept) { |
13 | -} else { |
|
13 | +} |
|
14 | +else { |
|
14 | 15 | $dept = strtolower(str_replace('_',' ',$dept)); |
15 | 16 | $q = $db->query('select epobject.epobject_id from hansard,epobject |
16 | 17 | where hansard.epobject_id=epobject.epobject_id and major=4 and section_id=0 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | } |
8 | 8 | |
9 | 9 | include_once '../../includes/easyparliament/init.php'; |
10 | -include_once INCLUDESPATH."easyparliament/glossary.php"; |
|
10 | +include_once INCLUDESPATH . "easyparliament/glossary.php"; |
|
11 | 11 | |
12 | 12 | $args = array( |
13 | 13 | 'sort' => "regexp_replace", |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | if ($term) { |
51 | - $DATA->set_page_metadata($this_page, 'title', $term['title'].': Glossary item'); |
|
51 | + $DATA->set_page_metadata($this_page, 'title', $term['title'] . ': Glossary item'); |
|
52 | 52 | $DATA->set_page_metadata($this_page, 'heading', $term['title']); |
53 | 53 | } |
54 | 54 | else { |
55 | - $DATA->set_page_metadata ($this_page, 'title', $GLOSSARY->current_letter.': Glossary index'); |
|
56 | - $DATA->set_page_metadata ($this_page, 'heading', 'Glossary index'); |
|
55 | + $DATA->set_page_metadata($this_page, 'title', $GLOSSARY->current_letter . ': Glossary index'); |
|
56 | + $DATA->set_page_metadata($this_page, 'heading', 'Glossary index'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | $PAGE->page_start(); |
@@ -72,13 +72,13 @@ discard block |
||
72 | 72 | $URL->update(array("gl" => $GLOSSARY->next_term['glossary_id'])); |
73 | 73 | $next_link = $URL->generate('url'); |
74 | 74 | |
75 | - $nextprev = array ( |
|
76 | - 'next' => array ( |
|
75 | + $nextprev = array( |
|
76 | + 'next' => array( |
|
77 | 77 | 'url' => $next_link, |
78 | 78 | 'title' => 'Next term', |
79 | 79 | 'body' => $GLOSSARY->next_term['title'] |
80 | 80 | ), |
81 | - 'prev' => array ( |
|
81 | + 'prev' => array( |
|
82 | 82 | 'url' => $previous_link, |
83 | 83 | 'title' => 'Previous term', |
84 | 84 | 'body' => $GLOSSARY->previous_term['title'] |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
114 | -$PAGE->stripe_end(array ( |
|
115 | - array ( |
|
114 | +$PAGE->stripe_end(array( |
|
115 | + array( |
|
116 | 116 | 'type' => 'nextprev', |
117 | 117 | 'content' => '' |
118 | 118 | ) |
@@ -40,10 +40,12 @@ discard block |
||
40 | 40 | if (isset($az) && array_key_exists($az, $GLOSSARY->alphabet)) { |
41 | 41 | $GLOSSARY->current_letter = $az; |
42 | 42 | // Otherwise make it the first letter of the current term |
43 | -} elseif (isset($term)) { |
|
43 | +} |
|
44 | +elseif (isset($term)) { |
|
44 | 45 | $GLOSSARY->current_letter = strtoupper($term['title']{0}); |
45 | 46 | // Otherwise make it "A" by default |
46 | -} else { |
|
47 | +} |
|
48 | +else { |
|
47 | 49 | $GLOSSARY->current_letter = "A"; |
48 | 50 | } |
49 | 51 | |
@@ -95,7 +97,8 @@ discard block |
||
95 | 97 | |
96 | 98 | $PAGE->glossary_display_term($GLOSSARY); |
97 | 99 | |
98 | -} else { |
|
100 | +} |
|
101 | +else { |
|
99 | 102 | |
100 | 103 | |
101 | 104 | // Display the results |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | |
3 | 3 | $this_page = 'bill_index'; |
4 | 4 | include_once '../../../../includes/easyparliament/init.php'; |
5 | -$DATA->set_page_metadata($this_page, 'heading','Legislative and Regulatory Reform Bill'); |
|
5 | +$DATA->set_page_metadata($this_page, 'heading', 'Legislative and Regulatory Reform Bill'); |
|
6 | 6 | $PAGE->page_start(); |
7 | 7 | $PAGE->stripe_start(); |
8 | -$PAGE->block_start(array ('title'=>'House of Commons - Normal Run')); |
|
8 | +$PAGE->block_start(array('title'=>'House of Commons - Normal Run')); |
|
9 | 9 | ?> |
10 | 10 | <ul> |
11 | 11 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | parse_bill('2006141.txt'); |
46 | 46 | $amendments = read_amendments('amendments.txt'); # The amendments, by number |
47 | 47 | parse_amendments(); |
48 | - $out = $title."\n\n"; |
|
48 | + $out = $title . "\n\n"; |
|
49 | 49 | $out .= "Page,Line\n"; |
50 | 50 | foreach ($bill as $page_num => $page) { |
51 | 51 | foreach ($page as $line_num => $line) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | print '</ul>'; |
60 | 60 | $PAGE->block_end(); |
61 | 61 | $includes = array( |
62 | - array ( |
|
62 | + array( |
|
63 | 63 | 'type' => 'include', |
64 | 64 | 'content' => 'bills_intro' |
65 | 65 | ), |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $intitle = true; |
78 | 78 | $title = ''; |
79 | 79 | foreach ($f as $r) { |
80 | - if ($line<1) { |
|
80 | + if ($line < 1) { |
|
81 | 81 | $line++; |
82 | 82 | continue; |
83 | 83 | } |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | } |
97 | 97 | continue; |
98 | 98 | } |
99 | - if (substr($r, 0, 8)=='Bill 141') continue; |
|
99 | + if (substr($r, 0, 8) == 'Bill 141') continue; |
|
100 | 100 | if (preg_match('#\s+([1-4]?[05])$#', $r, $m)) { |
101 | 101 | if ($line != $m[1]) { |
102 | 102 | print "ERROR! $line $m[1] $r"; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | if ($r == "\n") { |
142 | 142 | continue; |
143 | 143 | } |
144 | - if ($line<1) { |
|
144 | + if ($line < 1) { |
|
145 | 145 | $line++; |
146 | 146 | continue; |
147 | 147 | } |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | $number = $m[1]; |
156 | 156 | $amendments[$number] = ''; |
157 | 157 | } elseif (preg_match('#To move the following Clause#', $r)) { |
158 | - preg_match('#\n(.*?)$#', $amendments[$number-1], $m); |
|
159 | - $amendments[$number-1] = preg_replace('#\n(.*?)$#', '', $amendments[$number-1]); |
|
158 | + preg_match('#\n(.*?)$#', $amendments[$number - 1], $m); |
|
159 | + $amendments[$number - 1] = preg_replace('#\n(.*?)$#', '', $amendments[$number - 1]); |
|
160 | 160 | $amendments[$number] .= '*' . trim($m[1]) . "*\n$r"; |
161 | 161 | } else { |
162 | 162 | $amendments[$number] .= $r; |
@@ -180,9 +180,9 @@ discard block |
||
180 | 180 | $page = $m[1]; $line = $m[2]; $clause = $m[3]; |
181 | 181 | $from_text = $m[4]; $end_line = $m[5]; $insert = $m[6]; |
182 | 182 | unset($amendments[$num]); |
183 | - $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="'.$num.'">' . $insert . '</ins>'; |
|
184 | - for ($i=$line+1; $i<=$end_line; $i++) { |
|
185 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
183 | + $bill[$page][$line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$line]) . '</del><ins title="' . $num . '">' . $insert . '</ins>'; |
|
184 | + for ($i = $line + 1; $i <= $end_line; $i++) { |
|
185 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
186 | 186 | } |
187 | 187 | } |
188 | 188 | # Page 4, line 9 [Clause 6], leave out from `under' to `creating' and insert `this Part making provision' |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | $insert = $m[7]; |
200 | 200 | unset($amendments[$num]); |
201 | 201 | $bill[$page][$from_line] = str_replace($from_text, "$from_text <del title='$num'>", $bill[$page][$from_line]) . '</del>'; |
202 | - for ($i=$from_line+1; $i<$to_line; $i++) { |
|
203 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
202 | + for ($i = $from_line + 1; $i < $to_line; $i++) { |
|
203 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
204 | 204 | } |
205 | - $bill[$page][$to_line] = '<del title="'.$num.'">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]); |
|
205 | + $bill[$page][$to_line] = '<del title="' . $num . '">' . str_replace($to_text, "</del><ins title='$num'>$insert</ins> $to_text", $bill[$page][$to_line]); |
|
206 | 206 | } |
207 | 207 | # Page 3, line 13 [Clause 4], leave out from beginning to `confer' and insert `An order under this Part may not make provision to' |
208 | 208 | if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], leave out from beginning to `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) { |
@@ -223,15 +223,15 @@ discard block |
||
223 | 223 | $page = $m[1]; $line = $m[3]; $clause = $m[2]; |
224 | 224 | $insert = isset($m[4]) ? $m[4] : null; |
225 | 225 | unset($amendments[$num]); |
226 | - $bill[$page][$line] = '<del title="'.$num.'">'.$bill[$page][$line].'</del>'; |
|
227 | - if ($insert) $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>'; |
|
226 | + $bill[$page][$line] = '<del title="' . $num . '">' . $bill[$page][$line] . '</del>'; |
|
227 | + if ($insert) $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>'; |
|
228 | 228 | } |
229 | 229 | # Page 8, line 24 [Clause 14], at end insert-- `...' |
230 | 230 | if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], (?:at end|after subsection \(\d+\)) insert--\s+`(.*?)\'#s', $amendment, $m)) { |
231 | 231 | $page = $m[1]; $line = $m[2]; $clause = $m[3]; |
232 | 232 | $insert = $m[4]; |
233 | 233 | unset($amendments[$num]); |
234 | - $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>'; |
|
234 | + $bill[$page][$line] .= '<ins title="' . $num . '">' . $insert . '</ins>'; |
|
235 | 235 | } |
236 | 236 | # Title, line 1, leave out `reforming legislation' and insert `...' |
237 | 237 | if (preg_match('#Title, line.*?, leave out `(.*?)\' and insert `(.*?)\'#s', $amendment, $m)) { |
@@ -247,14 +247,14 @@ discard block |
||
247 | 247 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
248 | 248 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
249 | 249 | $startP = $subsubclause['startP']; |
250 | - if ($startP==$page && $subsubclause['startL']==$line) { |
|
250 | + if ($startP == $page && $subsubclause['startL'] == $line) { |
|
251 | 251 | if ($startP == $subsubclause['endP']) { |
252 | 252 | unset($amendments[$num]); |
253 | - for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) { |
|
254 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
253 | + for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) { |
|
254 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
255 | 255 | } |
256 | 256 | if ($insert) { |
257 | - $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>"; |
|
257 | + $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>"; |
|
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
@@ -270,21 +270,21 @@ discard block |
||
270 | 270 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
271 | 271 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
272 | 272 | $startP = $subsubclause['startP']; |
273 | - if ($startP==$page && $subsubclause['startL']==$line) { |
|
273 | + if ($startP == $page && $subsubclause['startL'] == $line) { |
|
274 | 274 | if ($startP == $subsubclause['endP']) { |
275 | 275 | unset($amendments[$num]); |
276 | 276 | $finished = true; |
277 | 277 | } |
278 | 278 | } |
279 | 279 | if ($finished) { |
280 | - for ($i = $subsubclause['startL']; $i<=$subsubclause['endL']; $i++) { |
|
281 | - $bill[$page][$i] = '<del title="'.$num.'">' . $bill[$page][$i] . '</del>'; |
|
280 | + for ($i = $subsubclause['startL']; $i <= $subsubclause['endL']; $i++) { |
|
281 | + $bill[$page][$i] = '<del title="' . $num . '">' . $bill[$page][$i] . '</del>'; |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | } |
285 | 285 | if ($finished) { |
286 | 286 | if ($insert) { |
287 | - $bill[$page][$i-1] .= "<ins title='$num'>$insert</ins>"; |
|
287 | + $bill[$page][$i - 1] .= "<ins title='$num'>$insert</ins>"; |
|
288 | 288 | } |
289 | 289 | break; |
290 | 290 | } |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | $finished = false; |
297 | 297 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
298 | 298 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
299 | - if ($subsubclause['startP']==$page && $subsubclause['startL']==$line) { |
|
299 | + if ($subsubclause['startP'] == $page && $subsubclause['startL'] == $line) { |
|
300 | 300 | unset($amendments[$num]); |
301 | 301 | $finished = true; |
302 | 302 | } |
303 | 303 | if ($finished) { |
304 | - for ($p = $subsubclause['startP']; $p<=$subsubclause['endP']; $p++) { |
|
305 | - if ($p>$subsubclause['startP']) $starti = 1; |
|
304 | + for ($p = $subsubclause['startP']; $p <= $subsubclause['endP']; $p++) { |
|
305 | + if ($p > $subsubclause['startP']) $starti = 1; |
|
306 | 306 | else $starti = $subsubclause['startL']; |
307 | - for ($i = $starti; $i<=$subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages |
|
308 | - $bill[$p][$i] = '<del title="'.$num.'">' . $bill[$p][$i] . '</del>'; |
|
307 | + for ($i = $starti; $i <= $subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages |
|
308 | + $bill[$p][$i] = '<del title="' . $num . '">' . $bill[$p][$i] . '</del>'; |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
@@ -39,7 +39,8 @@ discard block |
||
39 | 39 | |
40 | 40 | if (file_exists('diff.html')) { |
41 | 41 | $out = file_get_contents('diff.html'); |
42 | -} else { |
|
42 | +} |
|
43 | +else { |
|
43 | 44 | $bill = array(); # The bill, page by page, line by line |
44 | 45 | $clauses = array(); # The bill, clause by clause, sub-clause by sub-clause, paragraph by paragraph. Yuk. |
45 | 46 | parse_bill('2006141.txt'); |
@@ -96,7 +97,9 @@ discard block |
||
96 | 97 | } |
97 | 98 | continue; |
98 | 99 | } |
99 | - if (substr($r, 0, 8)=='Bill 141') continue; |
|
100 | + if (substr($r, 0, 8)=='Bill 141') { |
|
101 | + continue; |
|
102 | + } |
|
100 | 103 | if (preg_match('#\s+([1-4]?[05])$#', $r, $m)) { |
101 | 104 | if ($line != $m[1]) { |
102 | 105 | print "ERROR! $line $m[1] $r"; |
@@ -151,14 +154,17 @@ discard block |
||
151 | 154 | } |
152 | 155 | if (preg_match('#^\S#', $r)) { |
153 | 156 | $proposer = $r; |
154 | - } elseif (preg_match('#^\s+(\d+)$#', $r, $m)) { |
|
157 | + } |
|
158 | + elseif (preg_match('#^\s+(\d+)$#', $r, $m)) { |
|
155 | 159 | $number = $m[1]; |
156 | 160 | $amendments[$number] = ''; |
157 | - } elseif (preg_match('#To move the following Clause#', $r)) { |
|
161 | + } |
|
162 | + elseif (preg_match('#To move the following Clause#', $r)) { |
|
158 | 163 | preg_match('#\n(.*?)$#', $amendments[$number-1], $m); |
159 | 164 | $amendments[$number-1] = preg_replace('#\n(.*?)$#', '', $amendments[$number-1]); |
160 | 165 | $amendments[$number] .= '*' . trim($m[1]) . "*\n$r"; |
161 | - } else { |
|
166 | + } |
|
167 | + else { |
|
162 | 168 | $amendments[$number] .= $r; |
163 | 169 | } |
164 | 170 | } |
@@ -224,7 +230,9 @@ discard block |
||
224 | 230 | $insert = isset($m[4]) ? $m[4] : null; |
225 | 231 | unset($amendments[$num]); |
226 | 232 | $bill[$page][$line] = '<del title="'.$num.'">'.$bill[$page][$line].'</del>'; |
227 | - if ($insert) $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>'; |
|
233 | + if ($insert) { |
|
234 | + $bill[$page][$line] .= '<ins title="'.$num.'">'.$insert.'</ins>'; |
|
235 | + } |
|
228 | 236 | } |
229 | 237 | # Page 8, line 24 [Clause 14], at end insert-- `...' |
230 | 238 | if (preg_match('#Page\s+(\d+), line (\d+) \[Clause (\d+)\], (?:at end|after subsection \(\d+\)) insert--\s+`(.*?)\'#s', $amendment, $m)) { |
@@ -302,8 +310,12 @@ discard block |
||
302 | 310 | } |
303 | 311 | if ($finished) { |
304 | 312 | for ($p = $subsubclause['startP']; $p<=$subsubclause['endP']; $p++) { |
305 | - if ($p>$subsubclause['startP']) $starti = 1; |
|
306 | - else $starti = $subsubclause['startL']; |
|
313 | + if ($p>$subsubclause['startP']) { |
|
314 | + $starti = 1; |
|
315 | + } |
|
316 | + else { |
|
317 | + $starti = $subsubclause['startL']; |
|
318 | + } |
|
307 | 319 | for ($i = $starti; $i<=$subsubclause['endL']; $i++) { # XXX Doesn't really work spanning pages |
308 | 320 | $bill[$p][$i] = '<del title="'.$num.'">' . $bill[$p][$i] . '</del>'; |
309 | 321 | } |
@@ -321,7 +333,9 @@ discard block |
||
321 | 333 | foreach ($clauses[$clause] as $subclause_num => $subclause) { |
322 | 334 | foreach ($subclause as $subsubclause_num => $subsubclause) { |
323 | 335 | if ($subsubclause['endP'] > $page) { $page = $subsubclause['endP']; $line = 0; } |
324 | - if ($subsubclause['endL'] > $line) $line = $subsubclause['endL']; |
|
336 | + if ($subsubclause['endL'] > $line) { |
|
337 | + $line = $subsubclause['endL']; |
|
338 | + } |
|
325 | 339 | } |
326 | 340 | } |
327 | 341 | $bill[$page][$line] .= "<ins title='$num'>$amendment</ins>\n\n"; |