@@ -21,12 +21,12 @@ |
||
21 | 21 | <p>It seems we already have <?= ngettext('a definition', 'some definitions', $glossary->num_search_matches) ?> for that. Would you care to see <?= ngettext('it', 'them', $glossary->num_search_matches) ?>?</p> |
22 | 22 | <ul class="glossary"> |
23 | 23 | <?php |
24 | - foreach ($glossary->search_matches as $match) { |
|
25 | - $URL = new \MySociety\TheyWorkForYou\Url('glossary'); |
|
26 | - $URL->insert(['gl' => $match['glossary_id']]); |
|
27 | - $URL->remove(['g']); |
|
28 | - $term_link = $URL->generate('url'); |
|
29 | - ?> |
|
24 | + foreach ($glossary->search_matches as $match) { |
|
25 | + $URL = new \MySociety\TheyWorkForYou\Url('glossary'); |
|
26 | + $URL->insert(['gl' => $match['glossary_id']]); |
|
27 | + $URL->remove(['g']); |
|
28 | + $term_link = $URL->generate('url'); |
|
29 | + ?> |
|
30 | 30 | <li> |
31 | 31 | <a href="<?= $term_link ?>"><?= $match['title']?></a> |
32 | 32 | </li> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | */ |
68 | 68 | |
69 | -$page = [ |
|
69 | +$page = [ |
|
70 | 70 | |
71 | 71 | // Things used on EVERY page, unless overridden for a page: |
72 | 72 | 'default' => [ |
@@ -498,24 +498,24 @@ discard block |
||
498 | 498 | 'url' => 'glossary/', |
499 | 499 | ], |
500 | 500 | 'glossary_addterm' => [ |
501 | - 'menu' => array ( |
|
501 | + 'menu' => array( |
|
502 | 502 | 'text' => 'Add a term', |
503 | 503 | 'title' => "Add a definition for a term to the glossary" |
504 | 504 | ), |
505 | 505 | 'parent' => 'help_us_out', |
506 | 506 | 'title' => 'Add a glossary item', |
507 | 507 | 'url' => 'addterm/', |
508 | - 'session_vars' => array ('g') |
|
508 | + 'session_vars' => array('g') |
|
509 | 509 | ], |
510 | 510 | 'glossary_addlink' => [ |
511 | - 'menu' => array ( |
|
511 | + 'menu' => array( |
|
512 | 512 | 'text' => 'Add a link', |
513 | 513 | 'title' => "Add an external link" |
514 | 514 | ), |
515 | 515 | 'parent' => 'help_us_out', |
516 | 516 | 'title' => 'Add a link', |
517 | 517 | 'url' => 'addlink/', |
518 | - 'session_vars' => array ('g') |
|
518 | + 'session_vars' => array('g') |
|
519 | 519 | ], |
520 | 520 | 'glossary_item' => [ |
521 | 521 | 'heading' => 'Glossary heading', |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | // The text displayed on the page itself will also be this, |
1362 | 1362 | // UNLESS the section has a 'heading', in which case that's used instead. |
1363 | 1363 | |
1364 | -$section = [ |
|
1364 | +$section = [ |
|
1365 | 1365 | |
1366 | 1366 | |
1367 | 1367 | 'about' => [ |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | include_once INCLUDESPATH . "easyparliament/searchengine.php"; |
25 | 25 | |
26 | 26 | class GLOSSARY { |
27 | - public $num_terms; // how many glossary entries do we have |
|
27 | + public $num_terms; // how many glossary entries do we have |
|
28 | 28 | // (changes depending on how GLOSSARY is called |
29 | - public $hansard_count; // how many times does the phrase appear in hansard? |
|
30 | - public $query; // search term |
|
31 | - public $glossary_id; // if this is set then we only have 1 glossary term |
|
32 | - public $current_term; // will only be set if we have a valid epobject_id |
|
29 | + public $hansard_count; // how many times does the phrase appear in hansard? |
|
30 | + public $query; // search term |
|
31 | + public $glossary_id; // if this is set then we only have 1 glossary term |
|
32 | + public $current_term; // will only be set if we have a valid epobject_id |
|
33 | 33 | public $current_letter; |
34 | 34 | |
35 | 35 | // constructor... |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | // These stop stupid submissions. |
74 | 74 | // everything should be lowercase. |
75 | - $this->stopwords = [ "the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate" ]; |
|
75 | + $this->stopwords = ["the", "of", "to", "and", "for", "in", "a", "on", "is", "that", "will", "secretary", "are", "ask", "state", "have", "be", "has", "by", "with", "i", "not", "what", "as", "it", "hon", "he", "which", "from", "if", "been", "this", "s", "we", "at", "government", "was", "my", "an", "department", "there", "make", "or", "made", "their", "all", "but", "they", "how", "debate"]; |
|
76 | 76 | |
77 | 77 | } |
78 | 78 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | global $THEUSER; |
190 | 190 | |
191 | 191 | if (!$THEUSER->is_able_to('addterm')) { |
192 | - error ("Sorry, you are not allowed to add Glossary terms."); |
|
192 | + error("Sorry, you are not allowed to add Glossary terms."); |
|
193 | 193 | return false; |
194 | 194 | } |
195 | 195 |
@@ -816,16 +816,14 @@ |
||
816 | 816 | |
817 | 817 | if (isset($args['blankform']) && $args['blankform'] == 1) { |
818 | 818 | $formcontent = ""; |
819 | - } |
|
820 | - else { |
|
819 | + } else { |
|
821 | 820 | $formcontent = _htmlentities(get_http_var('g')); |
822 | 821 | } |
823 | 822 | |
824 | 823 | if ($THEUSER->isloggedin()) { |
825 | 824 | $URL = new \MySociety\TheyWorkForYou\Url($args['action']); |
826 | 825 | $URL->remove(array('g')); |
827 | - } |
|
828 | - else { |
|
826 | + } else { |
|
829 | 827 | $URL = new \MySociety\TheyWorkForYou\Url('userprompt'); |
830 | 828 | $URL->remove(array('g')); |
831 | 829 | $type = "<input type=\"hidden\" name=\"type\" value=\"2\">"; |
@@ -1,16 +1,16 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | include_once '../../includes/easyparliament/init.php'; |
4 | -include_once INCLUDESPATH."easyparliament/glossary.php"; |
|
5 | -include_once INCLUDESPATH."easyparliament/glossarylist.php"; |
|
4 | +include_once INCLUDESPATH . "easyparliament/glossary.php"; |
|
5 | +include_once INCLUDESPATH . "easyparliament/glossarylist.php"; |
|
6 | 6 | |
7 | 7 | $this_page = "glossary_addlink"; |
8 | 8 | |
9 | -$args = array( 'action' => $this_page); |
|
9 | +$args = array('action' => $this_page); |
|
10 | 10 | |
11 | 11 | // First things first... |
12 | 12 | |
13 | -if ((get_http_var('g') != '') && (get_http_var('previewterm') == '') ) { |
|
13 | +if ((get_http_var('g') != '') && (get_http_var('previewterm') == '')) { |
|
14 | 14 | // We're searching for something. |
15 | 15 | $args['s'] = filter_user_input(get_http_var('g'), 'strict'); |
16 | 16 | $GLOSSARY = new GLOSSARY($args); |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $PAGE->stripe_start(); |
27 | 27 | |
28 | -$data = array ( |
|
28 | +$data = array( |
|
29 | 29 | 'title' => get_http_var('g'), |
30 | 30 | 'body' => get_http_var('definition') |
31 | 31 | ); |
@@ -115,8 +115,8 @@ discard block |
||
115 | 115 | |
116 | 116 | $PAGE->glossary_atoz($GLOSSARY); |
117 | 117 | |
118 | - $PAGE->stripe_end(array ( |
|
119 | - array ( |
|
118 | + $PAGE->stripe_end(array( |
|
119 | + array( |
|
120 | 120 | 'type' => 'include', |
121 | 121 | 'content' => 'glossary_add' |
122 | 122 | ) |
@@ -14,8 +14,7 @@ discard block |
||
14 | 14 | // We're searching for something. |
15 | 15 | $args['s'] = filter_user_input(get_http_var('g'), 'strict'); |
16 | 16 | $GLOSSARY = new GLOSSARY($args); |
17 | -} |
|
18 | -else { |
|
17 | +} else { |
|
19 | 18 | $args['sort'] = "regexp_replace"; |
20 | 19 | $GLOSSARY = new GLOSSARY($args); |
21 | 20 | $args['s'] = filter_user_input(get_http_var('g'), 'strict'); |
@@ -86,13 +85,11 @@ discard block |
||
86 | 85 | if ($args['count']) { |
87 | 86 | // Display the Add definition form |
88 | 87 | $PAGE->glossary_add_link_form($args); |
89 | - } |
|
90 | - else { |
|
88 | + } else { |
|
91 | 89 | print "<h4>No dice!</h4><p>Much as we'd love you to add a definition for <strong></strong>, it doesn't seem to appear in hansard at all...</p>"; |
92 | 90 | $PAGE->glossary_links(); |
93 | 91 | } |
94 | - } |
|
95 | - else { |
|
92 | + } else { |
|
96 | 93 | print "<h4>Humdinger!</h4><p>it would appear that you aren't allowed to add glossary terms. How odd...</p>"; |
97 | 94 | $PAGE->glossary_links(); |
98 | 95 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | include_once '../../includes/easyparliament/init.php'; |
4 | -include_once INCLUDESPATH."easyparliament/glossary.php"; |
|
5 | -include_once INCLUDESPATH."easyparliament/glossarylist.php"; |
|
4 | +include_once INCLUDESPATH . "easyparliament/glossary.php"; |
|
5 | +include_once INCLUDESPATH . "easyparliament/glossarylist.php"; |
|
6 | 6 | |
7 | 7 | $view = new MySociety\TheyWorkForYou\GlossaryView\AddTermView(); |
8 | 8 | $data = $view->display(); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | $html = RAWDATA . 'cmpages/'; |
16 | 16 | $xml = RAWDATA . 'scrapedxml/'; |
17 | 17 | $dir = array('debates', 'wrans', 'wms', 'westminhall', 'lordspages', 'ni'); |
18 | -$majors = array(1,3,4,2,101,5); |
|
18 | +$majors = array(1, 3, 4, 2, 101, 5); |
|
19 | 19 | |
20 | 20 | $hdates = array(); |
21 | 21 | $db = new ParlDB; |
22 | 22 | $q = $db->query('SELECT DISTINCT(hdate) AS hdate, major FROM hansard'); |
23 | -for ($i=0; $i<$q->rows(); $i++) { |
|
23 | +for ($i = 0; $i < $q->rows(); $i++) { |
|
24 | 24 | $hdates[$q->field($i, 'hdate')][$q->field($i, 'major')] = true; |
25 | 25 | } |
26 | 26 | |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $out = array(); |
37 | 37 | $dh = opendir("$html$bit/"); |
38 | 38 | while (false !== ($filename = readdir($dh))) { |
39 | - if (substr($filename, -5)!='.html' || substr($filename, -8, 3)=='tmp') continue; |
|
39 | + if (substr($filename, -5) != '.html' || substr($filename, -8, 3) == 'tmp') continue; |
|
40 | 40 | #if ($bit=='lordspages' && substr($filename,7,4)!='2005') continue; |
41 | 41 | preg_match('#^(.*?)(\d\d\d\d-\d\d-\d\d)(.*?)\.#', $filename, $m); |
42 | 42 | $part = ucfirst($m[1]); $date = $m[2]; $version = $m[3]; |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | $stat = stat("$html$bit/$filename"); |
45 | 45 | $base = substr($filename, 0, -5); |
46 | 46 | if (!is_file("$xml$bit/$base.xml")) { |
47 | - if ($date>'2001-05-11') |
|
48 | - $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified ".date('Y-m-d H:i:s', $stat[9])."</li>\n"; |
|
47 | + if ($date > '2001-05-11') |
|
48 | + $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified " . date('Y-m-d H:i:s', $stat[9]) . "</li>\n"; |
|
49 | 49 | } else { |
50 | 50 | if (!array_key_exists($date, $hdates) || !array_key_exists($majors[$k], $hdates[$date])) { |
51 | 51 | $notloaded .= "<li>$date : $part version $version</li>\n"; |
@@ -36,16 +36,21 @@ discard block |
||
36 | 36 | $out = array(); |
37 | 37 | $dh = opendir("$html$bit/"); |
38 | 38 | while (false !== ($filename = readdir($dh))) { |
39 | - if (substr($filename, -5)!='.html' || substr($filename, -8, 3)=='tmp') continue; |
|
39 | + if (substr($filename, -5)!='.html' || substr($filename, -8, 3)=='tmp') { |
|
40 | + continue; |
|
41 | + } |
|
40 | 42 | #if ($bit=='lordspages' && substr($filename,7,4)!='2005') continue; |
41 | 43 | preg_match('#^(.*?)(\d\d\d\d-\d\d-\d\d)(.*?)\.#', $filename, $m); |
42 | 44 | $part = ucfirst($m[1]); $date = $m[2]; $version = $m[3]; |
43 | - if (!isset($out[$date])) $out[$date] = array(); |
|
45 | + if (!isset($out[$date])) { |
|
46 | + $out[$date] = array(); |
|
47 | + } |
|
44 | 48 | $stat = stat("$html$bit/$filename"); |
45 | 49 | $base = substr($filename, 0, -5); |
46 | 50 | if (!is_file("$xml$bit/$base.xml")) { |
47 | - if ($date>'2001-05-11') |
|
48 | - $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified ".date('Y-m-d H:i:s', $stat[9])."</li>\n"; |
|
51 | + if ($date>'2001-05-11') { |
|
52 | + $out[$date][] = "<li>$date : $part version $version, size $stat[7] bytes, last modified ".date('Y-m-d H:i:s', $stat[9])."</li>\n"; |
|
53 | + } |
|
49 | 54 | } else { |
50 | 55 | if (!array_key_exists($date, $hdates) || !array_key_exists($majors[$k], $hdates[$date])) { |
51 | 56 | $notloaded .= "<li>$date : $part version $version</li>\n"; |
@@ -66,7 +71,9 @@ discard block |
||
66 | 71 | <p>Note this currently only works for new data - ie. if there's any data at all |
67 | 72 | in the database for the date, it won't appear hear</p> |
68 | 73 | <?php |
69 | -if ($notloaded) print "<ul>$notloaded</ul>"; |
|
74 | +if ($notloaded) { |
|
75 | + print "<ul>$notloaded</ul>"; |
|
76 | +} |
|
70 | 77 | |
71 | 78 | $PAGE->stripe_end(); |
72 | 79 | $PAGE->page_end(); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $URL->update(["gl" => $GLOSSARY->next_term['glossary_id']]); |
77 | 77 | $next_link = $URL->generate('url'); |
78 | 78 | |
79 | - $nextprev = [ |
|
79 | + $nextprev = [ |
|
80 | 80 | 'next' => [ |
81 | 81 | 'url' => $next_link, |
82 | 82 | 'title' => 'Next term', |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | $URL = new \MySociety\TheyWorkForYou\Url('glossary_addterm'); |
119 | 119 | $add_url = $URL->generate(); |
120 | -print "<p>Think you know a phrase that should be here? Help us improve the site by <a href=\"".$add_url."\">adding it</a>.</p>"; |
|
120 | +print "<p>Think you know a phrase that should be here? Help us improve the site by <a href=\"" . $add_url . "\">adding it</a>.</p>"; |
|
121 | 121 | |
122 | 122 | $PAGE->stripe_end([ |
123 | 123 | [ |
@@ -5,11 +5,11 @@ discard block |
||
5 | 5 | namespace MySociety\TheyWorkForYou\GlossaryView; |
6 | 6 | |
7 | 7 | class AddTermView { |
8 | - public $glossary; |
|
8 | + public $glossary; |
|
9 | 9 | |
10 | - public function display(): array { |
|
10 | + public function display(): array { |
|
11 | 11 | if (!$this->has_access()) { |
12 | - return ['error' => _("You don't have permission to manage the glossary")]; |
|
12 | + return ['error' => _("You don't have permission to manage the glossary")]; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | $data = []; |
@@ -26,130 +26,130 @@ discard block |
||
26 | 26 | $data['glossary'] = $this->glossary; |
27 | 27 | |
28 | 28 | if (get_http_var('submitterm') != '') { |
29 | - $data = $this->add_glossary_entry($data); |
|
29 | + $data = $this->add_glossary_entry($data); |
|
30 | 30 | } elseif ((get_http_var('g') != '') && (get_http_var('previewterm') == '')) { |
31 | - $data = $this->check_glossary_entry($data); |
|
31 | + $data = $this->check_glossary_entry($data); |
|
32 | 32 | } elseif (get_http_var('previewterm') != '') { |
33 | - $data['definition'] = get_http_var('definition'); |
|
34 | - $data['preview'] = 1; |
|
33 | + $data['definition'] = get_http_var('definition'); |
|
34 | + $data['preview'] = 1; |
|
35 | 35 | } else { |
36 | - $data = $this->add_example_urls($data); |
|
36 | + $data = $this->add_example_urls($data); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $URL = new \MySociety\TheyWorkForYou\Url('glossary_addterm'); |
40 | 40 | $data['form_url'] = $URL->generate(); |
41 | 41 | |
42 | 42 | return $data; |
43 | - } |
|
43 | + } |
|
44 | 44 | |
45 | - protected function has_access(): bool { |
|
45 | + protected function has_access(): bool { |
|
46 | 46 | global $THEUSER; |
47 | 47 | |
48 | 48 | if (!$THEUSER->is_able_to('addterm')) { |
49 | - return false; |
|
49 | + return false; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return true; |
53 | - } |
|
53 | + } |
|
54 | 54 | |
55 | - protected function has_stop_words(): bool { |
|
55 | + protected function has_stop_words(): bool { |
|
56 | 56 | if (in_array($this->glossary->query, $this->glossary->stopwords)) { |
57 | - return true; |
|
57 | + return true; |
|
58 | 58 | } |
59 | 59 | return false; |
60 | - } |
|
60 | + } |
|
61 | 61 | |
62 | - protected function check_term_is_useful(array $data): array { |
|
62 | + protected function check_term_is_useful(array $data): array { |
|
63 | 63 | if ($this->has_stop_words()) { |
64 | - $data['error'] = 'Sorry, that phrase appears too many times to be a useful as a link within the parliamentary record.'; |
|
64 | + $data['error'] = 'Sorry, that phrase appears too many times to be a useful as a link within the parliamentary record.'; |
|
65 | 65 | } elseif (isset($data['appearances']) && !$data['appearances']) { |
66 | - $data['error'] = "Unfortunately <strong>" . $data['term'] . "</strong>, doesn't seem to appear in hansard at all...</p>"; |
|
66 | + $data['error'] = "Unfortunately <strong>" . $data['term'] . "</strong>, doesn't seem to appear in hansard at all...</p>"; |
|
67 | 67 | } elseif ($this->glossary->num_search_matches > 0) { |
68 | - $data['show_matches'] = 1; |
|
69 | - $data['error'] = 'Existing matches'; |
|
70 | - $data['count'] = $this->glossary->num_search_matches; |
|
68 | + $data['show_matches'] = 1; |
|
69 | + $data['error'] = 'Existing matches'; |
|
70 | + $data['count'] = $this->glossary->num_search_matches; |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | return $data; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | - protected function get_appearance_count(string $term): int { |
|
76 | + protected function get_appearance_count(string $term): int { |
|
77 | 77 | global $SEARCHENGINE; |
78 | 78 | $SEARCHENGINE = new \SEARCHENGINE($term); |
79 | 79 | $count = $SEARCHENGINE->run_count(0, 10000); |
80 | 80 | return $count; |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | - protected function check_glossary_entry(array $data): array { |
|
84 | - $data['appearances'] = $this->get_appearance_count($data['term']); |
|
85 | - $data['definition'] = ''; |
|
86 | - $data = $this->check_term_is_useful($data); |
|
83 | + protected function check_glossary_entry(array $data): array { |
|
84 | + $data['appearances'] = $this->get_appearance_count($data['term']); |
|
85 | + $data['definition'] = ''; |
|
86 | + $data = $this->check_term_is_useful($data); |
|
87 | 87 | |
88 | - if (!isset($data['error'])) { |
|
88 | + if (!isset($data['error'])) { |
|
89 | 89 | $data['definition'] = ''; |
90 | 90 | $list = new \HANSARDLIST(); |
91 | 91 | $examples = $list->display('search', [ |
92 | - 'num' => 5, |
|
93 | - 's' => $data['term'], |
|
94 | - 'view_override' => 'glossary_search', |
|
92 | + 'num' => 5, |
|
93 | + 's' => $data['term'], |
|
94 | + 'view_override' => 'glossary_search', |
|
95 | 95 | ], 'none'); |
96 | 96 | $data['examples'] = $examples['rows']; |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - return $data; |
|
100 | - } |
|
99 | + return $data; |
|
100 | + } |
|
101 | 101 | |
102 | - protected function add_glossary_entry(array $data): array { |
|
103 | - $data['submitted'] = 1; |
|
104 | - $data['body'] = get_http_var('definition'); |
|
105 | - $data = $this->check_term_is_useful($data); |
|
102 | + protected function add_glossary_entry(array $data): array { |
|
103 | + $data['submitted'] = 1; |
|
104 | + $data['body'] = get_http_var('definition'); |
|
105 | + $data = $this->check_term_is_useful($data); |
|
106 | 106 | |
107 | - $success = false; |
|
108 | - if (!isset($data['error'])) { |
|
107 | + $success = false; |
|
108 | + if (!isset($data['error'])) { |
|
109 | 109 | $entry = [ |
110 | - 'title' => $data['term'], |
|
111 | - 'body' => $data['body'], |
|
110 | + 'title' => $data['term'], |
|
111 | + 'body' => $data['body'], |
|
112 | 112 | ]; |
113 | 113 | $success = $this->glossary->create($data); |
114 | - } |
|
114 | + } |
|
115 | 115 | |
116 | - if (is_int($success)) { |
|
116 | + if (is_int($success)) { |
|
117 | 117 | $data['success'] = 1; |
118 | - } elseif (is_array($success)) { |
|
118 | + } elseif (is_array($success)) { |
|
119 | 119 | $data = array_merge($data, $success); |
120 | - } else { |
|
120 | + } else { |
|
121 | 121 | if (!isset($data['error'])) { |
122 | - $data['error'] = "Sorry, there was an error and we were unable to add your Glossary item."; |
|
122 | + $data['error'] = "Sorry, there was an error and we were unable to add your Glossary item."; |
|
123 | + } |
|
123 | 124 | } |
124 | - } |
|
125 | 125 | |
126 | - return $data; |
|
127 | - } |
|
126 | + return $data; |
|
127 | + } |
|
128 | 128 | |
129 | - protected function add_example_urls(array $data): array { |
|
129 | + protected function add_example_urls(array $data): array { |
|
130 | 130 | $URL = new \MySociety\TheyWorkForYou\Url('glossary'); |
131 | 131 | |
132 | 132 | $examples = [ |
133 | - 'technical' => [ |
|
133 | + 'technical' => [ |
|
134 | 134 | 'name' => 'Early Day Motion', 'id' => 90, |
135 | - ], |
|
136 | - 'organisation' => [ |
|
135 | + ], |
|
136 | + 'organisation' => [ |
|
137 | 137 | 'name' => 'Devon County Council', 'id' => 12, |
138 | - ], |
|
139 | - 'document' => [ |
|
138 | + ], |
|
139 | + 'document' => [ |
|
140 | 140 | 'name' => 'Hutton Report', 'id' => 7, |
141 | - ], |
|
141 | + ], |
|
142 | 142 | ]; |
143 | 143 | |
144 | 144 | $example_urls = []; |
145 | 145 | foreach ($examples as $name => $example) { |
146 | - $URL->insert(["gl" => $example['id']]); |
|
147 | - $example['url'] = $URL->generate(); |
|
148 | - $example_urls[$name] = $example; |
|
146 | + $URL->insert(["gl" => $example['id']]); |
|
147 | + $example['url'] = $URL->generate(); |
|
148 | + $example_urls[$name] = $example; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | $data['example_urls'] = $example_urls; |
152 | 152 | return $data; |
153 | - } |
|
153 | + } |
|
154 | 154 | |
155 | 155 | } |