@@ -14,7 +14,9 @@ discard block |
||
14 | 14 | if ($string == 'minute' && $ago > 59) { $ago /= 60; $string = 'hour'; } |
15 | 15 | if ($string == 'hour' && $ago > 23) { $ago /= 24; $string = 'day'; } |
16 | 16 | if ($string == 'day' && $ago > 13) { $ago /= 7; $string = 'week'; } |
17 | - $ago = round($ago); if ($ago != 1) $string .= 's'; |
|
17 | + $ago = round($ago); if ($ago != 1) { |
|
18 | + $string .= 's'; |
|
19 | + } |
|
18 | 20 | $body .= '<li><a href="' . $item->xLink . '">' . $item->xTitle . '</a> ('.$ago.' '.$string.' ago)</li>'; |
19 | 21 | } |
20 | 22 | if ($body) { |
@@ -64,7 +66,9 @@ discard block |
||
64 | 66 | #echo "cache miss!"; |
65 | 67 | |
66 | 68 | $a = file($techRati); |
67 | - if (!$a) return false; |
|
69 | + if (!$a) { |
|
70 | + return false; |
|
71 | + } |
|
68 | 72 | set_time_limit (10); |
69 | 73 | $contents = implode('', $a); |
70 | 74 | // $cachefp = fopen("cache/{$cacheFilename}.xml", "w"); |
@@ -121,12 +125,10 @@ discard block |
||
121 | 125 | $arItems[$itemCount] = new xItem(); |
122 | 126 | // set new item object's properties |
123 | 127 | $arItems[$itemCount]->xTitle = $data; |
124 | - } |
|
125 | - elseif ($curTag == $permalinkKey) { |
|
128 | + } elseif ($curTag == $permalinkKey) { |
|
126 | 129 | $arItems[$itemCount]->xPermalink = $data; |
127 | 130 | # $itemCount++; |
128 | - } |
|
129 | - elseif ($curTag == $linkKey) { |
|
131 | + } elseif ($curTag == $linkKey) { |
|
130 | 132 | $arItems[$itemCount]->xLink = $data; |
131 | 133 | #$itemCount++; |
132 | 134 | } elseif ($curTag == $createdKey) { |
@@ -156,8 +156,9 @@ |
||
156 | 156 | foreach ($var as $v) { |
157 | 157 | $url_args[] = "$key=" . urlencode(stripslashes($v)); |
158 | 158 | } |
159 | - } elseif ($var != null) |
|
160 | - $url_args[] = "$key=" . urlencode(stripslashes($var)); |
|
159 | + } elseif ($var != null) { |
|
160 | + $url_args[] = "$key=" . urlencode(stripslashes($var)); |
|
161 | + } |
|
161 | 162 | } |
162 | 163 | |
163 | 164 | $page_url = WEBPATH . $DATA->page_metadata($this->destinationpage, "url"); |
@@ -41,7 +41,9 @@ |
||
41 | 41 | twfy_debug_timestamp("after including utility.php"); |
42 | 42 | |
43 | 43 | // Set the default timezone |
44 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
44 | +if(function_exists('date_default_timezone_set')) { |
|
45 | + date_default_timezone_set(TIMEZONE); |
|
46 | +} |
|
45 | 47 | |
46 | 48 | // Only do clever things with errors if we're not testing, otherwise show as default |
47 | 49 |
@@ -40,8 +40,9 @@ discard block |
||
40 | 40 | public $error; |
41 | 41 | |
42 | 42 | public function __construct($query) { |
43 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
44 | - return null; |
|
43 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
44 | + return null; |
|
45 | + } |
|
45 | 46 | |
46 | 47 | global $xapiandb, $PAGE, $hansardmajors, $parties; |
47 | 48 | if (!$xapiandb) { |
@@ -56,8 +57,12 @@ discard block |
||
56 | 57 | } |
57 | 58 | } |
58 | 59 | $this->query = $query; |
59 | - if (!isset($this->stemmer)) $this->stemmer = new XapianStem('english'); |
|
60 | - if (!isset($this->enquire)) $this->enquire = new XapianEnquire($xapiandb); |
|
60 | + if (!isset($this->stemmer)) { |
|
61 | + $this->stemmer = new XapianStem('english'); |
|
62 | + } |
|
63 | + if (!isset($this->enquire)) { |
|
64 | + $this->enquire = new XapianEnquire($xapiandb); |
|
65 | + } |
|
61 | 66 | if (!isset($this->queryparser)) { |
62 | 67 | $this->queryparser = new XapianQueryParser(); |
63 | 68 | $this->datevaluerange = new XapianDateValueRangeProcessor(1); |
@@ -111,7 +116,9 @@ discard block |
||
111 | 116 | foreach ($all_words as $word) { |
112 | 117 | if ($word == '"') { |
113 | 118 | $in_quote = !$in_quote; |
114 | - if ($in_quote) array_push($this->phrases, array()); |
|
119 | + if ($in_quote) { |
|
120 | + array_push($this->phrases, array()); |
|
121 | + } |
|
115 | 122 | if (!$in_quote && !count($this->phrases[count($this->phrases) - 1])) { |
116 | 123 | array_pop($this->phrases); |
117 | 124 | } |
@@ -124,22 +131,37 @@ discard block |
||
124 | 131 | if (strpos($word, ':') !== false) { |
125 | 132 | $items = explode(":", strtolower($word)); |
126 | 133 | $type = $items[0]; |
127 | - if (substr($type, 0, 1)=='-') $type = substr($type, 1); |
|
134 | + if (substr($type, 0, 1)=='-') { |
|
135 | + $type = substr($type, 1); |
|
136 | + } |
|
128 | 137 | $value = strtolower(join(":", array_slice($items,1))); |
129 | 138 | if ($type == 'section') { |
130 | 139 | $newv = $value; |
131 | - if ($value == 'debates' || $value == 'debate') $newv = 1; |
|
132 | - elseif ($value == 'whall' || $value == 'westminster' || $value == 'westminhall') $newv = 2; |
|
133 | - elseif ($value == 'wrans' || $value == 'wran') $newv = 3; |
|
134 | - elseif ($value == 'wms' || $value == 'statements' || $value == 'statement') $newv = 4; |
|
135 | - elseif ($value == 'lordsdebates' || $value == 'lords') $newv = 101; |
|
136 | - elseif ($value == 'ni' || $value == 'nidebates') $newv = 5; |
|
137 | - elseif ($value == 'pbc' || $value == 'standing') $newv = 6; |
|
138 | - elseif ($value == 'sp') $newv = 7; |
|
139 | - elseif ($value == 'spwrans' || $value == 'spwran') $newv = 8; |
|
140 | - elseif ($value == 'uk') $newv = array(1,2,3,4,6,101); |
|
141 | - elseif ($value == 'scotland') $newv = array(7,8); |
|
142 | - elseif ($value == 'future') $newv = 'F'; |
|
140 | + if ($value == 'debates' || $value == 'debate') { |
|
141 | + $newv = 1; |
|
142 | + } elseif ($value == 'whall' || $value == 'westminster' || $value == 'westminhall') { |
|
143 | + $newv = 2; |
|
144 | + } elseif ($value == 'wrans' || $value == 'wran') { |
|
145 | + $newv = 3; |
|
146 | + } elseif ($value == 'wms' || $value == 'statements' || $value == 'statement') { |
|
147 | + $newv = 4; |
|
148 | + } elseif ($value == 'lordsdebates' || $value == 'lords') { |
|
149 | + $newv = 101; |
|
150 | + } elseif ($value == 'ni' || $value == 'nidebates') { |
|
151 | + $newv = 5; |
|
152 | + } elseif ($value == 'pbc' || $value == 'standing') { |
|
153 | + $newv = 6; |
|
154 | + } elseif ($value == 'sp') { |
|
155 | + $newv = 7; |
|
156 | + } elseif ($value == 'spwrans' || $value == 'spwran') { |
|
157 | + $newv = 8; |
|
158 | + } elseif ($value == 'uk') { |
|
159 | + $newv = array(1,2,3,4,6,101); |
|
160 | + } elseif ($value == 'scotland') { |
|
161 | + $newv = array(7,8); |
|
162 | + } elseif ($value == 'future') { |
|
163 | + $newv = 'F'; |
|
164 | + } |
|
143 | 165 | if (is_array($newv)) { |
144 | 166 | $newv = 'major:' . join(' major:', $newv); |
145 | 167 | } else { |
@@ -148,8 +170,12 @@ discard block |
||
148 | 170 | $this->query = str_ireplace("$type:$value", $newv, $this->query); |
149 | 171 | } elseif ($type == 'groupby') { |
150 | 172 | $newv = $value; |
151 | - if ($value == 'debates' || $value == 'debate') $newv = 'debate'; |
|
152 | - if ($value == 'speech' || $value == 'speeches') $newv = 'speech'; |
|
173 | + if ($value == 'debates' || $value == 'debate') { |
|
174 | + $newv = 'debate'; |
|
175 | + } |
|
176 | + if ($value == 'speech' || $value == 'speeches') { |
|
177 | + $newv = 'speech'; |
|
178 | + } |
|
153 | 179 | $this->query = str_ireplace("$type:$value", '', $this->query); |
154 | 180 | array_push($this->prefixed, array($type, $newv)); |
155 | 181 | } elseif ($type == 'from') { |
@@ -254,7 +280,9 @@ discard block |
||
254 | 280 | $end = $this->queryparser->unstem_end($mm); |
255 | 281 | while (!$iter->equals($end)) { |
256 | 282 | $tt = $iter->get_term(); |
257 | - if (!in_array($tt, $used)) break; |
|
283 | + if (!in_array($tt, $used)) { |
|
284 | + break; |
|
285 | + } |
|
258 | 286 | $iter->next(); |
259 | 287 | } |
260 | 288 | $used[] = $tt; |
@@ -333,8 +361,9 @@ discard block |
||
333 | 361 | } |
334 | 362 | |
335 | 363 | public function get_spelling_correction() { |
336 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
337 | - return null; |
|
364 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
365 | + return null; |
|
366 | + } |
|
338 | 367 | |
339 | 368 | $qd = $this->queryparser->get_corrected_query_string(); |
340 | 369 | return $qd; |
@@ -342,8 +371,9 @@ discard block |
||
342 | 371 | |
343 | 372 | // Perform partial query to get a count of number of matches |
344 | 373 | public function run_count($first_result, $results_per_page, $sort_order='relevance') { |
345 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
346 | - return null; |
|
374 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
375 | + return null; |
|
376 | + } |
|
347 | 377 | |
348 | 378 | $start = getmicrotime(); |
349 | 379 | |
@@ -373,16 +403,18 @@ discard block |
||
373 | 403 | $collapsed = true; |
374 | 404 | if ($items[1] == 'speech') |
375 | 405 | ; // no collapse key |
376 | - elseif ($items[1] == 'debate') |
|
377 | - $this->enquire->set_collapse_key(3); |
|
378 | - else |
|
379 | - $PAGE->error_message("Unknown group by '$items[1]' ignored"); |
|
406 | + elseif ($items[1] == 'debate') { |
|
407 | + $this->enquire->set_collapse_key(3); |
|
408 | + } else { |
|
409 | + $PAGE->error_message("Unknown group by '$items[1]' ignored"); |
|
410 | + } |
|
380 | 411 | } |
381 | 412 | } |
382 | 413 | |
383 | 414 | // default to grouping by subdebate, i.e. by page |
384 | - if (!$collapsed) |
|
385 | - $this->enquire->set_collapse_key(3); |
|
415 | + if (!$collapsed) { |
|
416 | + $this->enquire->set_collapse_key(3); |
|
417 | + } |
|
386 | 418 | |
387 | 419 | /* |
388 | 420 | XXX Helping to debug possible Xapian bug |
@@ -462,8 +494,9 @@ discard block |
||
462 | 494 | |
463 | 495 | // Puts HTML highlighting round all the matching words in the text |
464 | 496 | public function highlight($body) { |
465 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
466 | - return $body; |
|
497 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
498 | + return $body; |
|
499 | + } |
|
467 | 500 | |
468 | 501 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
469 | 502 | if (is_array($body)) { |
@@ -481,8 +514,9 @@ discard block |
||
481 | 514 | private $specialchars_upper = array('<', '>', '"', '&'); |
482 | 515 | |
483 | 516 | public function highlight_internal($body, $stemmed_words) { |
484 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
485 | - return $body; |
|
517 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
518 | + return $body; |
|
519 | + } |
|
486 | 520 | |
487 | 521 | # Does html_entity_decode without the htmlspecialchars |
488 | 522 | $body = str_replace($this->specialchars, $this->specialchars_upper, $body); |
@@ -503,7 +537,9 @@ discard block |
||
503 | 537 | $hl = false; |
504 | 538 | $matchword = $this->stem($extractword); |
505 | 539 | foreach ($stemmed_words as $word) { |
506 | - if ($word == '') continue; |
|
540 | + if ($word == '') { |
|
541 | + continue; |
|
542 | + } |
|
507 | 543 | if ($matchword == $word) { |
508 | 544 | $hl = true; |
509 | 545 | break; |
@@ -565,17 +601,25 @@ discard block |
||
565 | 601 | } |
566 | 602 | } |
567 | 603 | } |
568 | - if ($pos != -1) return $pos; |
|
604 | + if ($pos != -1) { |
|
605 | + return $pos; |
|
606 | + } |
|
569 | 607 | |
570 | 608 | $splitextract = preg_split('/([0-9,.]+|['.$this->wordcharsnodigit.']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
571 | 609 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
572 | 610 | foreach ($splitextract as $extractword) { |
573 | 611 | $extractword = preg_replace('/&$/', '', $extractword); |
574 | - if (!$extractword) continue; |
|
612 | + if (!$extractword) { |
|
613 | + continue; |
|
614 | + } |
|
575 | 615 | $wordpos = strpos($lcbody, $extractword); |
576 | - if (!$wordpos) continue; |
|
616 | + if (!$wordpos) { |
|
617 | + continue; |
|
618 | + } |
|
577 | 619 | foreach ($stemmed_words as $word) { |
578 | - if ($word == '') continue; |
|
620 | + if ($word == '') { |
|
621 | + continue; |
|
622 | + } |
|
579 | 623 | $matchword = $this->stem($extractword); |
580 | 624 | if ($matchword == $word && ($wordpos < $pos || $pos==-1)) { |
581 | 625 | $pos = $wordpos; |
@@ -583,10 +627,14 @@ discard block |
||
583 | 627 | } |
584 | 628 | } |
585 | 629 | // only look for earlier words if phrases weren't found |
586 | - if ($pos != -1) return $pos; |
|
630 | + if ($pos != -1) { |
|
631 | + return $pos; |
|
632 | + } |
|
587 | 633 | |
588 | 634 | foreach ($this->words as $word) { |
589 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
635 | + if (ctype_digit($word)) { |
|
636 | + $word = '(?:'.$word.'|'.number_format($word).')'; |
|
637 | + } |
|
590 | 638 | if (preg_match('/([^'.$this->wordchars.']' . $word . '[^'.$this->wordchars. '])/', $lcbody, $matches)) { |
591 | 639 | $wordpos = strpos( $lcbody, $matches[0] ); |
592 | 640 | if ($wordpos) { |
@@ -597,10 +645,14 @@ discard block |
||
597 | 645 | } |
598 | 646 | } |
599 | 647 | // only look for something containing the word (ie. something stemmed, but doesn't work all the time) if no whole word was found |
600 | - if ($pos != -1) return $pos; |
|
648 | + if ($pos != -1) { |
|
649 | + return $pos; |
|
650 | + } |
|
601 | 651 | |
602 | 652 | foreach ($this->words as $word) { |
603 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
653 | + if (ctype_digit($word)) { |
|
654 | + $word = '(?:'.$word.'|'.number_format($word).')'; |
|
655 | + } |
|
604 | 656 | if (preg_match('/(' . $word . ')/', $lcbody, $matches)) { |
605 | 657 | $wordpos = strpos( $lcbody, $matches[0] ); |
606 | 658 | if ($wordpos) { |
@@ -611,8 +663,9 @@ discard block |
||
611 | 663 | } |
612 | 664 | } |
613 | 665 | |
614 | - if ($pos == -1) |
|
615 | - $pos = 0; |
|
666 | + if ($pos == -1) { |
|
667 | + $pos = 0; |
|
668 | + } |
|
616 | 669 | |
617 | 670 | return $pos; |
618 | 671 | } |
@@ -107,15 +107,17 @@ discard block |
||
107 | 107 | $query .= 'LEFT OUTER JOIN personinfo ON member.person_id = personinfo.person_id AND data_key="' . $personinfo_key . '" '; |
108 | 108 | } |
109 | 109 | $query .= ' JOIN person_names p ON p.person_id = member.person_id AND p.type = "name" '; |
110 | - if (isset($args['date'])) |
|
111 | - $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
112 | - else |
|
113 | - $query .= 'AND end_date="9999-12-31" '; |
|
110 | + if (isset($args['date'])) { |
|
111 | + $query .= 'AND start_date <= :date AND :date <= end_date '; |
|
112 | + } else { |
|
113 | + $query .= 'AND end_date="9999-12-31" '; |
|
114 | + } |
|
114 | 115 | $query .= 'WHERE house=' . $args['house'] . ' '; |
115 | - if (isset($args['date'])) |
|
116 | - $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
117 | - elseif (!isset($args['all']) || $args['house'] == 1) |
|
118 | - $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
116 | + if (isset($args['date'])) { |
|
117 | + $query .= 'AND entered_house <= :date AND :date <= left_house '; |
|
118 | + } elseif (!isset($args['all']) || $args['house'] == 1) { |
|
119 | + $query .= 'AND left_house = (SELECT MAX(left_house) FROM member) '; |
|
120 | + } |
|
119 | 121 | |
120 | 122 | if (isset($args['order'])) { |
121 | 123 | $order = $args['order']; |
@@ -174,8 +176,9 @@ discard block |
||
174 | 176 | $data[$p_id] = $narray; |
175 | 177 | } |
176 | 178 | } |
177 | - if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) |
|
178 | - uasort($data, array($this, 'by_peer_name')); |
|
179 | + if ($args['house'] == 2 && ($order == 'name' || $order == 'constituency')) { |
|
180 | + uasort($data, array($this, 'by_peer_name')); |
|
181 | + } |
|
179 | 182 | |
180 | 183 | $data = array ( |
181 | 184 | 'info' => array ( |
@@ -188,14 +191,18 @@ discard block |
||
188 | 191 | |
189 | 192 | } |
190 | 193 | public function by_peer_name($a, $b) { |
191 | - if (!$a['family_name'] && !$b['family_name']) |
|
192 | - return strcmp($a['lordofname'], $b['lordofname']); |
|
193 | - if (!$a['family_name']) |
|
194 | - return strcmp($a['lordofname'], $b['family_name']); |
|
195 | - if (!$b['family_name']) |
|
196 | - return strcmp($a['family_name'], $b['lordofname']); |
|
197 | - if (strcmp($a['family_name'], $b['family_name'])) |
|
198 | - return strcmp($a['family_name'], $b['family_name']); |
|
194 | + if (!$a['family_name'] && !$b['family_name']) { |
|
195 | + return strcmp($a['lordofname'], $b['lordofname']); |
|
196 | + } |
|
197 | + if (!$a['family_name']) { |
|
198 | + return strcmp($a['lordofname'], $b['family_name']); |
|
199 | + } |
|
200 | + if (!$b['family_name']) { |
|
201 | + return strcmp($a['family_name'], $b['lordofname']); |
|
202 | + } |
|
203 | + if (strcmp($a['family_name'], $b['family_name'])) { |
|
204 | + return strcmp($a['family_name'], $b['family_name']); |
|
205 | + } |
|
199 | 206 | return strcmp($a['lordofname'], $b['lordofname']); |
200 | 207 | } |
201 | 208 |
@@ -174,8 +174,7 @@ discard block |
||
174 | 174 | WHERE edit_id=" . $approval_id . ";"); |
175 | 175 | if (!$q->success()) { |
176 | 176 | break; |
177 | - } |
|
178 | - else { |
|
177 | + } else { |
|
179 | 178 | // Now send them an email telling them they've been approved |
180 | 179 | |
181 | 180 | |
@@ -216,8 +215,7 @@ discard block |
||
216 | 215 | WHERE edit_id=" . $decline_id . ";"); |
217 | 216 | if (!$q->success()) { |
218 | 217 | break; |
219 | - } |
|
220 | - else { |
|
218 | + } else { |
|
221 | 219 | // Scrub that one from the list of pending items |
222 | 220 | unset ($this->pending[$decline_id]); |
223 | 221 | } |
@@ -255,8 +253,7 @@ discard block |
||
255 | 253 | $this->update_pending_count(); |
256 | 254 | |
257 | 255 | return true; |
258 | - } |
|
259 | - else { |
|
256 | + } else { |
|
260 | 257 | return false; |
261 | 258 | } |
262 | 259 | } |
@@ -368,8 +365,7 @@ discard block |
||
368 | 365 | WHERE edit_id=" . $approval_id . ";"); |
369 | 366 | if (!$q->success()) { |
370 | 367 | break; |
371 | - } |
|
372 | - else { |
|
368 | + } else { |
|
373 | 369 | // Scrub that one from the list of pending items |
374 | 370 | unset ($this->pending[$approval_id]); |
375 | 371 | } |
@@ -107,19 +107,19 @@ discard block |
||
107 | 107 | if (isset($args['glossary_id']) && ($args['glossary_id'] != "")) { |
108 | 108 | $next = 0; $first_term = null; |
109 | 109 | foreach ($this->terms as $term) { |
110 | - if (!$first_term) $first_term = $term; |
|
110 | + if (!$first_term) { |
|
111 | + $first_term = $term; |
|
112 | + } |
|
111 | 113 | $last_term = $term; |
112 | 114 | if ($next == 1) { |
113 | 115 | $this->next_term = $term; |
114 | 116 | break; |
115 | - } |
|
116 | - elseif ($term['glossary_id'] == $args['glossary_id']) { |
|
117 | + } elseif ($term['glossary_id'] == $args['glossary_id']) { |
|
117 | 118 | $this->glossary_id = $args['glossary_id']; |
118 | 119 | $this->current_term = $term; |
119 | 120 | $next = 1; |
120 | 121 | |
121 | - } |
|
122 | - else { |
|
122 | + } else { |
|
123 | 123 | $this->previous_term = $term; |
124 | 124 | } |
125 | 125 | } |
@@ -134,8 +134,7 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | return ($this->num_terms); |
137 | - } |
|
138 | - else { |
|
137 | + } else { |
|
139 | 138 | return false; |
140 | 139 | } |
141 | 140 | } |
@@ -278,8 +277,9 @@ discard block |
||
278 | 277 | |
279 | 278 | // check for any glossary terms to replace |
280 | 279 | foreach ($this->replace_order as $glossary_id => $count) { |
281 | - if ($glossary_id == $this->glossary_id) |
|
282 | - continue; |
|
280 | + if ($glossary_id == $this->glossary_id) { |
|
281 | + continue; |
|
282 | + } |
|
283 | 283 | |
284 | 284 | $term_body = $this->terms[$glossary_id]['body']; |
285 | 285 | $term_title = $this->terms[$glossary_id]['title']; |
@@ -290,12 +290,10 @@ discard block |
||
290 | 290 | // catch glossary terms within their own definitions |
291 | 291 | if ($glossary_id == $this->glossary_id) { |
292 | 292 | $replacewords[] = "<strong>\\1</strong>"; |
293 | - } |
|
294 | - else { |
|
293 | + } else { |
|
295 | 294 | if ($this_page == "admin_glossary") { |
296 | 295 | $link_url = "#gl".$glossary_id; |
297 | - } |
|
298 | - else { |
|
296 | + } else { |
|
299 | 297 | $link_url = $URL->generate('url'); |
300 | 298 | } |
301 | 299 | $title = _htmlentities(trim_characters($term_body, 0, 80)); |
@@ -304,8 +302,9 @@ discard block |
||
304 | 302 | } |
305 | 303 | // Highlight all occurrences of another glossary term in the definition. |
306 | 304 | $body = preg_replace($findwords, $replacewords, $body, 1); |
307 | - if (isset($this->glossary_id)) |
|
308 | - $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1); |
|
305 | + if (isset($this->glossary_id)) { |
|
306 | + $body = preg_replace("/(?<![>\.\'\/])\b(" . $this->terms[$this->glossary_id]['title'] . ")\b(?![<\'])/i", '<strong>\\1</strong>', $body, 1); |
|
307 | + } |
|
309 | 308 | |
310 | 309 | // Replace any phrases in wikipedia |
311 | 310 | // TODO: Merge this code into above, so our gloss and wikipedia |
@@ -110,13 +110,16 @@ |
||
110 | 110 | |
111 | 111 | <?php endif; ?> |
112 | 112 | |
113 | - <?php else: ?> |
|
113 | + <?php else { |
|
114 | + : ?> |
|
114 | 115 | |
115 | 116 | <div class="panel"> |
116 | 117 | <p>This person has not voted on any of the key issues which we keep track of.</p> |
117 | 118 | </div> |
118 | 119 | |
119 | - <?php endif; ?> |
|
120 | + <?php endif; |
|
121 | +} |
|
122 | +?> |
|
120 | 123 | |
121 | 124 | <?php endif; ?> |
122 | 125 |
@@ -190,11 +190,14 @@ |
||
190 | 190 | <?= $recent_appearances['additional_links'] ?> |
191 | 191 | <?php endif; ?> |
192 | 192 | |
193 | - <?php else: ?> |
|
193 | + <?php else { |
|
194 | + : ?> |
|
194 | 195 | |
195 | 196 | <p>No recent appearances to display.</p> |
196 | 197 | |
197 | - <?php endif; ?> |
|
198 | + <?php endif; |
|
199 | +} |
|
200 | +?> |
|
198 | 201 | |
199 | 202 | </div> |
200 | 203 | <?php endif; ?> |