@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | class UtilityTest extends UnitTestCase{ |
14 | 14 | |
15 | - public function testVerpEnvelopeSenderCanCreateStandardSender() { |
|
15 | + public function testVerpEnvelopeSenderCanCreateStandardSender() { |
|
16 | 16 | $sender = twfy_verp_envelope_sender('[email protected]'); |
17 | 17 | $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; |
18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
22 | 22 |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * SimpleTest tests for the functions in utility.php |
4 | 4 | * $Id: utility_test.php,v 1.3 2009-06-25 12:23:58 louise Exp $ |
5 | 5 | */ |
6 | -error_reporting (E_ALL); |
|
6 | +error_reporting(E_ALL); |
|
7 | 7 | ini_set("display_errors", 1); |
8 | 8 | include_once dirname(__FILE__) . '/../../../conf/general'; |
9 | 9 | include_once '../utility.php'; |
10 | 10 | include_once 'simpletest/unit_tester.php'; |
11 | 11 | include_once 'simpletest/reporter.php'; |
12 | 12 | |
13 | -class UtilityTest extends UnitTestCase{ |
|
13 | +class UtilityTest extends UnitTestCase { |
|
14 | 14 | |
15 | 15 | public function testVerpEnvelopeSenderCanCreateStandardSender() { |
16 | 16 | $sender = twfy_verp_envelope_sender('[email protected]'); |
17 | - $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; |
|
17 | + $expected_sender = 'twfy+aperson=a.nother.dom@' +EMAILDOMAIN; |
|
18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); |
19 | 19 | } |
20 | 20 |
@@ -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 |
@@ -92,7 +92,7 @@ |
||
92 | 92 | include_once (INCLUDESPATH."easyparliament/user.php"); |
93 | 93 | |
94 | 94 | // Test to see if this is a new-style template using the renderer class. |
95 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
95 | +if (! isset($new_style_template) or $new_style_template !== true) { |
|
96 | 96 | |
97 | 97 | // This is an old-style page. Use the old page classes. |
98 | 98 | include_once (INCLUDESPATH."easyparliament/page.php"); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | First some things to help make our PHP nicer and betterer |
5 | 5 | ********************************************************************************/ |
6 | 6 | |
7 | -error_reporting (E_ALL); |
|
7 | +error_reporting(E_ALL); |
|
8 | 8 | |
9 | 9 | /******************************************************************************** |
10 | 10 | Now some constants that are the same for live and dev versions |
@@ -12,21 +12,21 @@ discard block |
||
12 | 12 | ********************************************************************************/ |
13 | 13 | |
14 | 14 | // In case we need to switch these off globally at some point... |
15 | -define ("ALLOWCOMMENTS", true); |
|
15 | +define("ALLOWCOMMENTS", true); |
|
16 | 16 | |
17 | 17 | // These variables are so we can keep date/time formats consistent across the site |
18 | 18 | // and change them easily. |
19 | 19 | // Formats here: http://www.php.net/manual/en/function.date.php |
20 | -define ("LONGERDATEFORMAT", "l, j F Y");// Monday, 31 December 2003 |
|
21 | -define ("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
22 | -define ("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
23 | -define ("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
20 | +define("LONGERDATEFORMAT", "l, j F Y"); // Monday, 31 December 2003 |
|
21 | +define("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
22 | +define("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
23 | +define("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
24 | 24 | |
25 | -define ("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
26 | -define ("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
25 | +define("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
26 | +define("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
27 | 27 | |
28 | 28 | // Where we store the postcode of users if they search for an MP by postcode. |
29 | -define ('POSTCODE_COOKIE', 'eppc'); |
|
29 | +define('POSTCODE_COOKIE', 'eppc'); |
|
30 | 30 | |
31 | 31 | /******************************************************************************** |
32 | 32 | And now all the files we'll include on every page. |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | twfy_debug_timestamp("after including utility.php"); |
41 | 41 | |
42 | 42 | // Set the default timezone |
43 | -if(function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
43 | +if (function_exists('date_default_timezone_set')) date_default_timezone_set(TIMEZONE); |
|
44 | 44 | |
45 | 45 | // Only do clever things with errors if we're not testing, otherwise show as default |
46 | 46 | |
@@ -69,39 +69,39 @@ discard block |
||
69 | 69 | |
70 | 70 | // The time the page starts, so we can display the total at the end. |
71 | 71 | // getmicrotime() is in utiltity.php. |
72 | -define ("STARTTIME", getmicrotime()); |
|
72 | +define("STARTTIME", getmicrotime()); |
|
73 | 73 | if (!isset($_SERVER['WINDIR'])) { |
74 | 74 | $rusage = getrusage(); |
75 | - define ('STARTTIMES', $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec']); |
|
76 | - define ('STARTTIMEU', $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec']); |
|
75 | + define('STARTTIMES', $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec']); |
|
76 | + define('STARTTIMEU', $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | $DATA = new \MySociety\TheyWorkForYou\Data; |
80 | 80 | |
81 | 81 | class ParlDB extends \MySociety\TheyWorkForYou\Db\Connection { |
82 | 82 | public function __construct() { |
83 | - $this->init (OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
83 | + $this->init(OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | 87 | $filter = new \MySociety\TheyWorkForYou\Utility\LibFilter; |
88 | 88 | |
89 | -include_once (INCLUDESPATH."easyparliament/user.php"); |
|
89 | +include_once (INCLUDESPATH . "easyparliament/user.php"); |
|
90 | 90 | |
91 | 91 | // Test to see if this is a new-style template using the renderer class. |
92 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
92 | +if (!isset($new_style_template) OR $new_style_template !== TRUE) { |
|
93 | 93 | |
94 | 94 | // This is an old-style page. Use the old page classes. |
95 | - include_once (INCLUDESPATH."easyparliament/page.php"); |
|
95 | + include_once (INCLUDESPATH . "easyparliament/page.php"); |
|
96 | 96 | |
97 | 97 | } |
98 | 98 | |
99 | -include_once (INCLUDESPATH."easyparliament/hansardlist.php"); |
|
100 | -include_once (INCLUDESPATH."dbtypes.php"); |
|
101 | -include_once (INCLUDESPATH."easyparliament/commentlist.php"); |
|
102 | -include_once (INCLUDESPATH."easyparliament/comment.php"); |
|
99 | +include_once (INCLUDESPATH . "easyparliament/hansardlist.php"); |
|
100 | +include_once (INCLUDESPATH . "dbtypes.php"); |
|
101 | +include_once (INCLUDESPATH . "easyparliament/commentlist.php"); |
|
102 | +include_once (INCLUDESPATH . "easyparliament/comment.php"); |
|
103 | 103 | |
104 | 104 | // Added in as new module by Richard Allan MP |
105 | -include_once (INCLUDESPATH."easyparliament/alert.php"); |
|
105 | +include_once (INCLUDESPATH . "easyparliament/alert.php"); |
|
106 | 106 | |
107 | 107 | twfy_debug_timestamp("at end of init.php"); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | 'url' => 'peer/' |
531 | 531 | ), |
532 | 532 | 'peers' => array ( |
533 | - 'menu' => array ( |
|
533 | + 'menu' => array ( |
|
534 | 534 | 'text' => 'Lords', |
535 | 535 | 'title' => "List of all Lords" |
536 | 536 | ), |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | 'url' => 'peers/' |
540 | 540 | ), |
541 | 541 | 'overview' => array ( |
542 | - 'menu' => array ( |
|
542 | + 'menu' => array ( |
|
543 | 543 | 'text' => 'Overview', |
544 | 544 | 'title' => "Overview of the UK Parliament" |
545 | 545 | ), |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | 'url' => 'rss/mp/' |
592 | 592 | ), |
593 | 593 | 'mps' => array ( |
594 | - 'menu' => array ( |
|
594 | + 'menu' => array ( |
|
595 | 595 | 'text' => 'MPs', |
596 | 596 | 'title' => "List of all Members of Parliament (MPs)" |
597 | 597 | ), |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | |
66 | 66 | */ |
67 | 67 | |
68 | -$this->page = array ( |
|
68 | +$this->page = array( |
|
69 | 69 | |
70 | 70 | // Things used on EVERY page, unless overridden for a page: |
71 | - 'default' => array ( |
|
71 | + 'default' => array( |
|
72 | 72 | 'parent' => '', |
73 | 73 | 'session_vars' => array('super_debug'), |
74 | 74 | 'sitetitle' => 'TheyWorkForYou', |
@@ -78,122 +78,122 @@ discard block |
||
78 | 78 | |
79 | 79 | // KEEP THE PAGES IN ALPHABETICAL ORDER! TA. |
80 | 80 | |
81 | - 'about' => array ( |
|
81 | + 'about' => array( |
|
82 | 82 | 'title' => 'About us', |
83 | 83 | 'url' => 'about/' |
84 | 84 | ), |
85 | - 'parliaments' => array ( |
|
85 | + 'parliaments' => array( |
|
86 | 86 | 'title' => 'Parliaments and assemblies', |
87 | 87 | 'url' => 'parliaments/' |
88 | 88 | ), |
89 | 89 | |
90 | - 'alert_stats' => array ( |
|
90 | + 'alert_stats' => array( |
|
91 | 91 | 'title' => 'Email alerts statistics', |
92 | 92 | 'parent' => 'admin', |
93 | 93 | 'url' => 'admin/alert_stats.php', |
94 | 94 | ), |
95 | - 'admin_badusers' => array ( |
|
95 | + 'admin_badusers' => array( |
|
96 | 96 | 'title' => 'Bad users', |
97 | 97 | 'parent' => 'admin', |
98 | 98 | 'url' => 'admin/badusers.php' |
99 | 99 | ), |
100 | - 'admin_home' => array ( |
|
100 | + 'admin_home' => array( |
|
101 | 101 | 'title' => 'Home', |
102 | 102 | 'parent' => 'admin', |
103 | 103 | 'url' => 'admin/' |
104 | 104 | ), |
105 | - 'admin_comments' => array ( |
|
105 | + 'admin_comments' => array( |
|
106 | 106 | 'title' => 'Recent comments', |
107 | 107 | 'parent' => 'admin', |
108 | 108 | 'url' => 'admin/comments.php' |
109 | 109 | ), |
110 | - 'admin_commentreport' => array ( |
|
110 | + 'admin_commentreport' => array( |
|
111 | 111 | 'title' => 'Processing a comment report', |
112 | 112 | 'parent' => 'admin', |
113 | 113 | 'url' => 'admin/report.php', |
114 | - 'session_vars' => array ('rid', 'cid') |
|
114 | + 'session_vars' => array('rid', 'cid') |
|
115 | 115 | ), |
116 | - 'admin_commentreports' => array ( |
|
116 | + 'admin_commentreports' => array( |
|
117 | 117 | 'title' => 'Outstanding comment reports', |
118 | 118 | 'parent' => 'admin', |
119 | 119 | 'url' => 'admin/reports.php' |
120 | 120 | ), |
121 | - 'admin_failedsearches' => array ( |
|
121 | + 'admin_failedsearches' => array( |
|
122 | 122 | 'title' => 'Failed searches', |
123 | 123 | 'parent' => 'admin', |
124 | 124 | 'url' => 'admin/failedsearches.php' |
125 | 125 | ), |
126 | - 'admin_glossary' => array ( |
|
126 | + 'admin_glossary' => array( |
|
127 | 127 | 'title' => 'Manage glossary entries', |
128 | 128 | 'parent' => 'admin', |
129 | 129 | 'url' => 'admin/glossary.php' |
130 | 130 | ), |
131 | - 'admin_glossary_pending' => array ( |
|
131 | + 'admin_glossary_pending' => array( |
|
132 | 132 | 'title' => 'Review pending glossary entries', |
133 | 133 | 'parent' => 'admin', |
134 | 134 | 'url' => 'admin/glossary_pending.php' |
135 | 135 | ), |
136 | - 'admin_searchlogs' => array ( |
|
136 | + 'admin_searchlogs' => array( |
|
137 | 137 | 'title' => 'Recent searches', |
138 | 138 | 'parent' => 'admin', |
139 | 139 | 'url' => 'admin/searchlogs.php' |
140 | 140 | ), |
141 | - 'admin_popularsearches' => array ( |
|
141 | + 'admin_popularsearches' => array( |
|
142 | 142 | 'title' => 'Popular searches in last 30 days (first 1000)', |
143 | 143 | 'parent' => 'admin', |
144 | 144 | 'url' => 'admin/popularsearches.php' |
145 | 145 | ), |
146 | - 'admin_statistics' => array ( |
|
146 | + 'admin_statistics' => array( |
|
147 | 147 | 'title' => 'General statistics', |
148 | 148 | 'parent' => 'admin', |
149 | 149 | 'url' => 'admin/statistics.php' |
150 | 150 | ), |
151 | - 'admin_reportstats' => array ( |
|
151 | + 'admin_reportstats' => array( |
|
152 | 152 | 'title' => 'Reporting statistics', |
153 | 153 | 'parent' => 'admin', |
154 | 154 | 'url' => 'admin/reporting_stats.php' |
155 | 155 | ), |
156 | - 'admin_photos' => array ( |
|
156 | + 'admin_photos' => array( |
|
157 | 157 | 'title' => 'Photo upload/attribution', |
158 | 158 | 'parent' => 'admin', |
159 | 159 | 'url' => 'admin/photos.php', |
160 | 160 | ), |
161 | - 'admin_profile_message' => array ( |
|
161 | + 'admin_profile_message' => array( |
|
162 | 162 | 'title' => 'Profile message banner', |
163 | 163 | 'parent' => 'admin', |
164 | 164 | 'url' => 'admin/profile-message.php', |
165 | 165 | ), |
166 | - 'admin_mpurls' => array ( |
|
166 | + 'admin_mpurls' => array( |
|
167 | 167 | 'title' => 'MP Websites', |
168 | 168 | 'parent' => 'admin', |
169 | 169 | 'url' => 'admin/websites.php', |
170 | 170 | ), |
171 | - 'admin_policies' => array ( |
|
171 | + 'admin_policies' => array( |
|
172 | 172 | 'title' => 'MP Policy details', |
173 | 173 | 'parent' => 'admin', |
174 | 174 | 'url' => 'admin/policies.php', |
175 | 175 | ), |
176 | - 'admin_banner' => array ( |
|
176 | + 'admin_banner' => array( |
|
177 | 177 | 'title' => 'Edit Banner', |
178 | 178 | 'parent' => 'admin', |
179 | 179 | 'url' => 'admin/banner.php', |
180 | 180 | ), |
181 | - 'admin_featured' => array ( |
|
181 | + 'admin_featured' => array( |
|
182 | 182 | 'title' => 'Featured debates', |
183 | 183 | 'parent' => 'admin', |
184 | 184 | 'url' => 'admin/featured.php', |
185 | 185 | ), |
186 | - 'admin_topics' => array ( |
|
186 | + 'admin_topics' => array( |
|
187 | 187 | 'title' => 'Topics', |
188 | 188 | 'parent' => 'admin', |
189 | 189 | 'url' => 'admin/topics.php', |
190 | 190 | ), |
191 | - 'admin_edittopics' => array ( |
|
191 | + 'admin_edittopics' => array( |
|
192 | 192 | 'title' => 'Edit Topic', |
193 | 193 | 'parent' => 'admin_topics', |
194 | 194 | 'url' => 'admin/edittopic.php', |
195 | 195 | ), |
196 | - 'admin_wikipedia' => array ( |
|
196 | + 'admin_wikipedia' => array( |
|
197 | 197 | 'title' => 'Wikipedia links', |
198 | 198 | 'parent' => 'admin', |
199 | 199 | 'url' => 'admin/wikipedia.php', |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | |
202 | 202 | // Added by Richard Allan for email alert functions |
203 | 203 | |
204 | - 'alert' => array ( |
|
205 | - 'menu' => array ( |
|
204 | + 'alert' => array( |
|
205 | + 'menu' => array( |
|
206 | 206 | 'text' => 'Email Alerts', |
207 | 207 | 'title' => "Set up alerts for updates on an MP or Peer by email", |
208 | 208 | 'sidebar' => 'alert' |
@@ -211,30 +211,30 @@ discard block |
||
211 | 211 | 'title' => 'TheyWorkForYou Email Alerts', |
212 | 212 | 'url' => 'alert/', |
213 | 213 | ), |
214 | - 'alertwelcome' => array ( |
|
214 | + 'alertwelcome' => array( |
|
215 | 215 | 'title' => 'Email Alerts', |
216 | 216 | 'url' => 'alert/', |
217 | 217 | ), |
218 | 218 | |
219 | 219 | // End of ALERTS additions |
220 | 220 | |
221 | - 'api_front' => array ( |
|
222 | - 'menu' => array ( |
|
221 | + 'api_front' => array( |
|
222 | + 'menu' => array( |
|
223 | 223 | 'text' => 'API', |
224 | 224 | 'title' => 'Access our data' |
225 | 225 | ), |
226 | 226 | 'title' => 'TheyWorkForYou API', |
227 | 227 | 'url' => 'api/' |
228 | 228 | ), |
229 | - 'api_doc_front' => array ( |
|
230 | - 'menu' => array ( |
|
229 | + 'api_doc_front' => array( |
|
230 | + 'menu' => array( |
|
231 | 231 | 'text' => 'API', |
232 | 232 | 'title' => 'Access our data' |
233 | 233 | ), |
234 | 234 | 'parent' => 'api_front', |
235 | 235 | 'url' => 'api/' |
236 | 236 | ), |
237 | - 'api_key' => array ( |
|
237 | + 'api_key' => array( |
|
238 | 238 | 'title' => 'Plan and keys', |
239 | 239 | 'parent' => 'api_front', |
240 | 240 | 'url' => 'api/key' |
@@ -245,69 +245,69 @@ discard block |
||
245 | 245 | 'url' => 'boundaries/', |
246 | 246 | ), |
247 | 247 | |
248 | - 'calendar_summary' => array ( |
|
249 | - 'menu' => array ( |
|
248 | + 'calendar_summary' => array( |
|
249 | + 'menu' => array( |
|
250 | 250 | 'text' => 'Upcoming', |
251 | 251 | 'title' => '', |
252 | 252 | ), |
253 | 253 | 'parent' => 'hansard', |
254 | 254 | 'url' => 'calendar/' |
255 | 255 | ), |
256 | - 'calendar_future_head' => array ( |
|
256 | + 'calendar_future_head' => array( |
|
257 | 257 | 'parent' => 'calendar_summary', |
258 | 258 | 'title' => 'Upcoming business', |
259 | 259 | 'url' => 'calendar/' |
260 | 260 | ), |
261 | - 'calendar_future' => array ( |
|
261 | + 'calendar_future' => array( |
|
262 | 262 | 'parent' => 'calendar_future_head', |
263 | 263 | 'url' => 'calendar/' |
264 | 264 | ), |
265 | - 'calendar_today_head' => array ( |
|
265 | + 'calendar_today_head' => array( |
|
266 | 266 | 'parent' => 'calendar_summary', |
267 | 267 | 'title' => 'Today’s business', |
268 | 268 | 'url' => 'calendar/' |
269 | 269 | ), |
270 | - 'calendar_today' => array ( |
|
270 | + 'calendar_today' => array( |
|
271 | 271 | 'parent' => 'calendar_today_head', |
272 | 272 | 'url' => 'calendar/' |
273 | 273 | ), |
274 | - 'calendar_past_head' => array ( |
|
274 | + 'calendar_past_head' => array( |
|
275 | 275 | 'parent' => 'calendar_summary', |
276 | 276 | 'title' => 'Previous business', |
277 | 277 | 'url' => 'calendar/' |
278 | 278 | ), |
279 | - 'calendar_past' => array ( |
|
279 | + 'calendar_past' => array( |
|
280 | 280 | 'parent' => 'calendar_past_head', |
281 | 281 | 'url' => 'calendar/' |
282 | 282 | ), |
283 | 283 | |
284 | - 'cards' => array ( |
|
284 | + 'cards' => array( |
|
285 | 285 | 'title' => 'MP Stats Cards', |
286 | 286 | 'url' => 'cards/' |
287 | 287 | ), |
288 | 288 | |
289 | - 'campaign_foi' => array ( |
|
289 | + 'campaign_foi' => array( |
|
290 | 290 | 'title' => 'Freedom of Information (Parliament) Order 2009', |
291 | 291 | 'url' => 'foiorder2009/' |
292 | 292 | ), |
293 | - 'campaign' => array ( |
|
293 | + 'campaign' => array( |
|
294 | 294 | 'title' => '', #Free Our Bills!', |
295 | 295 | 'url' => 'freeourbills/' |
296 | 296 | ), |
297 | - 'campaign_edm' => array ( |
|
297 | + 'campaign_edm' => array( |
|
298 | 298 | 'title' => 'Early Day Motion', |
299 | 299 | 'parent' => 'campaign', |
300 | 300 | 'url' => 'freeourbills/' |
301 | 301 | ), |
302 | 302 | |
303 | - 'commentreport' => array ( |
|
303 | + 'commentreport' => array( |
|
304 | 304 | 'title' => 'Reporting a comment', |
305 | 305 | 'url' => 'report/', |
306 | - 'session_vars' => array ('id') |
|
306 | + 'session_vars' => array('id') |
|
307 | 307 | ), |
308 | 308 | |
309 | - 'comments_recent' => array ( |
|
310 | - 'menu' => array ( |
|
309 | + 'comments_recent' => array( |
|
310 | + 'menu' => array( |
|
311 | 311 | 'text' => 'Recent comments', |
312 | 312 | 'title' => "Recently posted comments" |
313 | 313 | ), |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | 'url' => 'comments/recent/' |
317 | 317 | ), |
318 | 318 | |
319 | - 'contact' => array ( |
|
320 | - 'menu' => array ( |
|
319 | + 'contact' => array( |
|
320 | + 'menu' => array( |
|
321 | 321 | 'text' => 'Contact', |
322 | 322 | 'title' => '', |
323 | 323 | ), |
@@ -328,23 +328,23 @@ discard block |
||
328 | 328 | 'title' => 'News', |
329 | 329 | 'url' => 'https://www.mysociety.org/category/projects/theyworkforyou/' |
330 | 330 | ), |
331 | - 'debate' => array ( |
|
331 | + 'debate' => array( |
|
332 | 332 | 'parent' => 'debatesfront', |
333 | 333 | 'url' => 'debates/', |
334 | - 'session_vars' => array ('id'), |
|
334 | + 'session_vars' => array('id'), |
|
335 | 335 | ), |
336 | - 'debates' => array ( |
|
336 | + 'debates' => array( |
|
337 | 337 | 'parent' => 'debatesfront', |
338 | 338 | 'url' => 'debates/', |
339 | - 'session_vars' => array ('id'), |
|
339 | + 'session_vars' => array('id'), |
|
340 | 340 | ), |
341 | - 'debatesday' => array ( |
|
341 | + 'debatesday' => array( |
|
342 | 342 | 'parent' => 'debatesfront', |
343 | - 'session_vars' => array ('d'), |
|
343 | + 'session_vars' => array('d'), |
|
344 | 344 | 'url' => 'debates/', |
345 | 345 | ), |
346 | - 'alldebatesfront' => array ( |
|
347 | - 'menu' => array ( |
|
346 | + 'alldebatesfront' => array( |
|
347 | + 'menu' => array( |
|
348 | 348 | 'text' => 'Debates', |
349 | 349 | 'title' => "Debates in the House of Commons, Westminster Hall, and the House of Lords" |
350 | 350 | ), |
@@ -353,8 +353,8 @@ discard block |
||
353 | 353 | 'rss' => 'rss/debates.rss', |
354 | 354 | 'url' => 'debates/' |
355 | 355 | ), |
356 | - 'debatesfront' => array ( |
|
357 | - 'menu' => array ( |
|
356 | + 'debatesfront' => array( |
|
357 | + 'menu' => array( |
|
358 | 358 | 'text' => 'Commons debates', |
359 | 359 | 'title' => "Debates in the House of Commons" |
360 | 360 | ), |
@@ -363,12 +363,12 @@ discard block |
||
363 | 363 | 'rss' => 'rss/debates.rss', |
364 | 364 | 'url' => 'debates/' |
365 | 365 | ), |
366 | - 'debatesyear' => array ( |
|
366 | + 'debatesyear' => array( |
|
367 | 367 | 'parent' => 'debatesfront', |
368 | 368 | 'url' => 'debates/' |
369 | 369 | ), |
370 | - 'divisions_recent' => array ( |
|
371 | - 'menu' => array ( |
|
370 | + 'divisions_recent' => array( |
|
371 | + 'menu' => array( |
|
372 | 372 | 'text' => 'Recent Votes', |
373 | 373 | 'title' => '' |
374 | 374 | ), |
@@ -376,13 +376,13 @@ discard block |
||
376 | 376 | 'title' => 'Recent Votes', |
377 | 377 | 'url' => 'divisions/' |
378 | 378 | ), |
379 | - 'divisions_vote' => array ( |
|
379 | + 'divisions_vote' => array( |
|
380 | 380 | 'parent' => 'divisions_recent', |
381 | 381 | 'title' => 'Vote', |
382 | 382 | 'url' => 'divisions/division.php', |
383 | 383 | 'session_vars' => array('vote'), |
384 | 384 | ), |
385 | - 'epvote' => array ( |
|
385 | + 'epvote' => array( |
|
386 | 386 | 'url' => 'vote/' |
387 | 387 | ), |
388 | 388 | |
@@ -391,19 +391,19 @@ discard block |
||
391 | 391 | 'title' => 'TheyWorkForYou Google gadget', |
392 | 392 | ), |
393 | 393 | |
394 | - 'glossary' => array ( |
|
394 | + 'glossary' => array( |
|
395 | 395 | 'heading' => 'Glossary', |
396 | 396 | 'parent' => 'help_us_out', |
397 | 397 | 'url' => 'glossary/' |
398 | 398 | ), |
399 | - 'glossary_item' => array ( |
|
399 | + 'glossary_item' => array( |
|
400 | 400 | 'heading' => 'Glossary heading', |
401 | 401 | 'parent' => 'help_us_out', |
402 | 402 | 'url' => 'glossary/', |
403 | - 'session_vars' => array ('g') |
|
403 | + 'session_vars' => array('g') |
|
404 | 404 | ), |
405 | - 'hansard' => array ( |
|
406 | - 'menu' => array ( |
|
405 | + 'hansard' => array( |
|
406 | + 'menu' => array( |
|
407 | 407 | 'text' => 'UK Parliament', |
408 | 408 | 'title' => "Houses of Parliament debates, Written Answers, Statements, Westminster Hall debates, and Bill Committees" |
409 | 409 | ), |
@@ -411,16 +411,16 @@ discard block |
||
411 | 411 | 'url' => '' |
412 | 412 | ), |
413 | 413 | // Hansard landing page |
414 | - 'hansard_landing' => array ( |
|
414 | + 'hansard_landing' => array( |
|
415 | 415 | 'title' => 'Hansard', |
416 | 416 | 'url' => 'search-hansard/', |
417 | 417 | ), |
418 | - 'help' => array ( |
|
418 | + 'help' => array( |
|
419 | 419 | 'title' => 'Help - Frequently Asked Questions', |
420 | 420 | 'url' => 'help/' |
421 | 421 | ), |
422 | - 'help_us_out' => array ( |
|
423 | - 'menu' => array ( |
|
422 | + 'help_us_out' => array( |
|
423 | + 'menu' => array( |
|
424 | 424 | 'text' => 'Glossary', |
425 | 425 | 'title' => "Parliament's jargon explained" |
426 | 426 | ), |
@@ -429,88 +429,88 @@ discard block |
||
429 | 429 | 'url' => 'addterm/', |
430 | 430 | 'sidebar' => 'glossary_add' |
431 | 431 | ), |
432 | - 'home' => array ( |
|
432 | + 'home' => array( |
|
433 | 433 | 'title' => "UK Parliament", |
434 | 434 | 'rss' => 'news/index.rdf', |
435 | 435 | 'url' => '' |
436 | 436 | ), |
437 | - 'houserules' => array ( |
|
437 | + 'houserules' => array( |
|
438 | 438 | 'title' => 'House rules', |
439 | 439 | 'url' => 'houserules/' |
440 | 440 | ), |
441 | 441 | |
442 | - 'linktous' => array ( |
|
442 | + 'linktous' => array( |
|
443 | 443 | 'title' => 'Link to us', |
444 | 444 | 'heading' => 'How to link to us', |
445 | 445 | 'url' => 'help/linktous/' |
446 | 446 | ), |
447 | - 'api' => array ( |
|
447 | + 'api' => array( |
|
448 | 448 | 'title' => 'API', |
449 | 449 | 'heading' => 'API - Query the TheyWorkForYou database', |
450 | 450 | 'url' => 'api/' |
451 | 451 | ), |
452 | - 'data' => array ( |
|
452 | + 'data' => array( |
|
453 | 453 | 'title' => 'Raw Data', |
454 | 454 | 'heading' => 'Raw data (XML) - the data behind TheyWorkForYou and Public Whip', |
455 | 455 | 'url' => 'http://parser.theyworkforyou.com' |
456 | 456 | ), |
457 | - 'pombola' => array ( |
|
457 | + 'pombola' => array( |
|
458 | 458 | 'title' => 'Pombola', |
459 | 459 | 'heading' => 'mySociety\'s platform for running a Parliamentary monitoring site like this', |
460 | 460 | 'url' => 'https://www.mysociety.org/projects/parliamentarymonitoring/pombola' |
461 | 461 | ), |
462 | - 'devmailinglist' => array ( |
|
462 | + 'devmailinglist' => array( |
|
463 | 463 | 'title' => 'Developer mailing list', |
464 | 464 | 'heading' => 'Developer mailing list', |
465 | 465 | 'url' => 'https://groups.google.com/a/mysociety.org/forum/#!forum/theyworkforyou' |
466 | 466 | ), |
467 | - 'code' => array ( |
|
467 | + 'code' => array( |
|
468 | 468 | 'title' => 'Source code', |
469 | 469 | 'heading' => 'TheyWorkForYou Source code', |
470 | 470 | 'url' => 'https://github.com/mysociety/theyworkforyou' |
471 | 471 | ), |
472 | - 'irc' => array ( |
|
472 | + 'irc' => array( |
|
473 | 473 | 'title' => 'IRC chat channel', |
474 | 474 | 'heading' => 'IRC chat channel', |
475 | 475 | 'url' => 'http://www.irc.mysociety.org/' |
476 | 476 | ), |
477 | - 'newzealand' => array ( |
|
477 | + 'newzealand' => array( |
|
478 | 478 | 'title' => 'New Zealand', |
479 | 479 | 'heading' => 'They Work For You - New Zealand', |
480 | 480 | 'url' => 'http://www.theyworkforyou.co.nz/' |
481 | 481 | ), |
482 | - 'australia' => array ( |
|
482 | + 'australia' => array( |
|
483 | 483 | 'title' => 'Australia', |
484 | 484 | 'heading' => 'Open Australia', |
485 | 485 | 'url' => 'http://www.openaustralia.org/' |
486 | 486 | ), |
487 | - 'ireland' => array ( |
|
487 | + 'ireland' => array( |
|
488 | 488 | 'title' => 'Ireland', |
489 | 489 | 'heading' => 'TheyWorkForYou for the Houses of the Oireachtas', |
490 | 490 | 'url' => 'http://www.kildarestreet.com/' |
491 | 491 | ), |
492 | - 'mzalendo' => array ( |
|
492 | + 'mzalendo' => array( |
|
493 | 493 | 'title' => 'Mzalendo', |
494 | 494 | 'heading' => 'Keeping an eye on the Kenyan Parliament', |
495 | 495 | 'url' => 'http://info.mzalendo.com/' |
496 | 496 | ), |
497 | - 'lordsdebate' => array ( |
|
497 | + 'lordsdebate' => array( |
|
498 | 498 | 'parent' => 'lordsdebatesfront', |
499 | 499 | 'url' => 'lords/', |
500 | - 'session_vars' => array ('id'), |
|
500 | + 'session_vars' => array('id'), |
|
501 | 501 | ), |
502 | - 'lordsdebates' => array ( |
|
502 | + 'lordsdebates' => array( |
|
503 | 503 | 'parent' => 'lordsdebatesfront', |
504 | 504 | 'url' => 'lords/', |
505 | - 'session_vars' => array ('id'), |
|
505 | + 'session_vars' => array('id'), |
|
506 | 506 | ), |
507 | - 'lordsdebatesday' => array ( |
|
507 | + 'lordsdebatesday' => array( |
|
508 | 508 | 'parent' => 'lordsdebatesfront', |
509 | - 'session_vars' => array ('d'), |
|
509 | + 'session_vars' => array('d'), |
|
510 | 510 | 'url' => 'lords/', |
511 | 511 | ), |
512 | - 'lordsdebatesfront' => array ( |
|
513 | - 'menu' => array ( |
|
512 | + 'lordsdebatesfront' => array( |
|
513 | + 'menu' => array( |
|
514 | 514 | 'text' => 'Lords debates', |
515 | 515 | 'title' => "House of Lords debates" |
516 | 516 | ), |
@@ -519,24 +519,24 @@ discard block |
||
519 | 519 | 'rss' => 'rss/lords.rss', |
520 | 520 | 'url' => 'lords/' |
521 | 521 | ), |
522 | - 'lordsdebatesyear' => array ( |
|
522 | + 'lordsdebatesyear' => array( |
|
523 | 523 | 'parent' => 'lordsdebatesfront', |
524 | 524 | 'url' => 'lords/' |
525 | 525 | ), |
526 | 526 | |
527 | 527 | // Parliament landing page |
528 | - 'parliament_landing' => array ( |
|
528 | + 'parliament_landing' => array( |
|
529 | 529 | 'title' => 'Parliament', |
530 | 530 | 'url' => 'parliament/', |
531 | 531 | ), |
532 | 532 | |
533 | - 'peer' => array ( |
|
533 | + 'peer' => array( |
|
534 | 534 | 'parent' => 'peers', |
535 | 535 | 'title' => 'Peer', |
536 | 536 | 'url' => 'peer/' |
537 | 537 | ), |
538 | - 'peers' => array ( |
|
539 | - 'menu' => array ( |
|
538 | + 'peers' => array( |
|
539 | + 'menu' => array( |
|
540 | 540 | 'text' => 'Lords', |
541 | 541 | 'title' => "List of all Lords" |
542 | 542 | ), |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | 'title' => '', |
545 | 545 | 'url' => 'peers/' |
546 | 546 | ), |
547 | -'overview' => array ( |
|
548 | - 'menu' => array ( |
|
547 | +'overview' => array( |
|
548 | + 'menu' => array( |
|
549 | 549 | 'text' => 'Overview', |
550 | 550 | 'title' => "Overview of the UK Parliament" |
551 | 551 | ), |
@@ -554,50 +554,50 @@ discard block |
||
554 | 554 | 'rss' => 'news/index.rdf', |
555 | 555 | 'url' => '' |
556 | 556 | ), |
557 | - 'mla' => array ( |
|
557 | + 'mla' => array( |
|
558 | 558 | 'parent' => 'mlas', |
559 | 559 | 'title' => 'Find your MLA', |
560 | 560 | 'url' => 'mla/' |
561 | 561 | ), |
562 | - 'mlas' => array ( |
|
562 | + 'mlas' => array( |
|
563 | 563 | 'parent' => 'ni_home', |
564 | - 'menu' => array ( |
|
564 | + 'menu' => array( |
|
565 | 565 | 'text' => 'MLAs', |
566 | 566 | 'title' => "List of all Members of the Northern Ireland Assembly (MLAs)" |
567 | 567 | ), |
568 | 568 | 'title' => '', |
569 | 569 | 'url' => 'mlas/' |
570 | 570 | ), |
571 | - 'msps' => array ( |
|
571 | + 'msps' => array( |
|
572 | 572 | 'parent' => 'sp_home', |
573 | - 'menu' => array ( |
|
573 | + 'menu' => array( |
|
574 | 574 | 'text' => 'MSPs', |
575 | 575 | 'title' => "List of Members of the Scottish Parliament (MSPs)" |
576 | 576 | ), |
577 | 577 | 'title' => '', |
578 | 578 | 'url' => 'msps/' |
579 | 579 | ), |
580 | - 'msp' => array ( |
|
580 | + 'msp' => array( |
|
581 | 581 | 'parent' => 'msps', |
582 | 582 | 'title' => 'Find your MSP', |
583 | 583 | 'url' => 'msp/' |
584 | 584 | ), |
585 | 585 | /* Not 'Your MP', whose name is 'yourmp'... */ |
586 | - 'mp' => array ( |
|
586 | + 'mp' => array( |
|
587 | 587 | 'parent' => 'mps', |
588 | 588 | 'title' => 'Find your MP', |
589 | 589 | 'url' => 'mp/' |
590 | 590 | ), |
591 | - 'emailfriend' => array ( |
|
591 | + 'emailfriend' => array( |
|
592 | 592 | 'title' => 'Send this page to a friend', |
593 | 593 | 'url' => 'email/' |
594 | 594 | ), |
595 | 595 | // The directory MPs' RSS feeds are stored in. |
596 | - 'mp_rss' => array ( |
|
596 | + 'mp_rss' => array( |
|
597 | 597 | 'url' => 'rss/mp/' |
598 | 598 | ), |
599 | - 'mps' => array ( |
|
600 | - 'menu' => array ( |
|
599 | + 'mps' => array( |
|
600 | + 'menu' => array( |
|
601 | 601 | 'text' => 'MPs', |
602 | 602 | 'title' => "List of all Members of Parliament (MPs)" |
603 | 603 | ), |
@@ -608,16 +608,16 @@ discard block |
||
608 | 608 | |
609 | 609 | /* Northern Ireland Assembly */ |
610 | 610 | 'ni_home' => array( |
611 | - 'menu' => array ( |
|
611 | + 'menu' => array( |
|
612 | 612 | 'text' => 'Northern Ireland Assembly', |
613 | 613 | 'title' => 'Full authority over <em>transferred matters</em>, which include agriculture, education, employment, the environment and health' |
614 | 614 | ), |
615 | 615 | 'title' => 'Northern Ireland Assembly', |
616 | 616 | 'url' => 'ni/' |
617 | 617 | ), |
618 | - 'nioverview' => array ( |
|
618 | + 'nioverview' => array( |
|
619 | 619 | 'parent' => 'ni_home', |
620 | - 'menu' => array ( |
|
620 | + 'menu' => array( |
|
621 | 621 | 'text' => 'Debates', |
622 | 622 | 'title' => "Overview of the Northern Ireland Assembly debates" |
623 | 623 | ), |
@@ -625,23 +625,23 @@ discard block |
||
625 | 625 | 'rss' => 'rss/ni.rss', |
626 | 626 | 'url' => 'ni/' |
627 | 627 | ), |
628 | - 'nidebate' => array ( |
|
628 | + 'nidebate' => array( |
|
629 | 629 | 'parent' => 'nidebatesfront', |
630 | 630 | 'url' => 'ni/', |
631 | - 'session_vars' => array ('id'), |
|
631 | + 'session_vars' => array('id'), |
|
632 | 632 | ), |
633 | - 'nidebates' => array ( |
|
633 | + 'nidebates' => array( |
|
634 | 634 | 'parent' => 'nidebatesfront', |
635 | 635 | 'url' => 'ni/', |
636 | - 'session_vars' => array ('id'), |
|
636 | + 'session_vars' => array('id'), |
|
637 | 637 | ), |
638 | - 'nidebatesday' => array ( |
|
638 | + 'nidebatesday' => array( |
|
639 | 639 | 'parent' => 'nidebatesfront', |
640 | - 'session_vars' => array ('d'), |
|
640 | + 'session_vars' => array('d'), |
|
641 | 641 | 'url' => 'ni/', |
642 | 642 | ), |
643 | - 'nidebatesfront' => array ( |
|
644 | - 'menu' => array ( |
|
643 | + 'nidebatesfront' => array( |
|
644 | + 'menu' => array( |
|
645 | 645 | 'text' => 'Debates', |
646 | 646 | 'title' => "Northern Ireland Assembly debates" |
647 | 647 | ), |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | 'rss' => 'rss/ni.rss', |
651 | 651 | 'url' => 'ni/' |
652 | 652 | ), |
653 | - 'nidebatesyear' => array ( |
|
653 | + 'nidebatesyear' => array( |
|
654 | 654 | 'parent' => 'nidebatesfront', |
655 | 655 | 'url' => 'ni/' |
656 | 656 | ), |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | /* London Assembly */ |
659 | 659 | |
660 | 660 | 'london_home' => array( |
661 | - 'menu' => array ( |
|
661 | + 'menu' => array( |
|
662 | 662 | 'text' => 'London Assembly', |
663 | 663 | 'title' => 'Members of the London Assembly, answers from the Mayor of London' |
664 | 664 | ), |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | 'url' => 'london/' |
667 | 667 | ), |
668 | 668 | |
669 | - 'lmqoverview' => array ( |
|
669 | + 'lmqoverview' => array( |
|
670 | 670 | 'parent' => 'london_home', |
671 | - 'menu' => array ( |
|
671 | + 'menu' => array( |
|
672 | 672 | 'text' => 'Questions to the Mayor of London', |
673 | 673 | 'title' => "Questions to the Mayor of London" |
674 | 674 | ), |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | 'url' => 'london/' |
678 | 678 | ), |
679 | 679 | |
680 | - 'london_assembly_members' => array ( |
|
680 | + 'london_assembly_members' => array( |
|
681 | 681 | 'parent' => 'london_home', |
682 | - 'menu' => array ( |
|
682 | + 'menu' => array( |
|
683 | 683 | 'text' => 'London Assembly Members', |
684 | 684 | 'title' => "List of Members of the London Assembly)" |
685 | 685 | ), |
@@ -687,25 +687,25 @@ discard block |
||
687 | 687 | 'url' => 'london-assembly-members/' |
688 | 688 | ), |
689 | 689 | |
690 | - 'london_assembly_member' => array ( |
|
690 | + 'london_assembly_member' => array( |
|
691 | 691 | 'parent' => 'london_assembly_members', |
692 | 692 | 'title' => 'Find your London Assembly Member', |
693 | 693 | 'url' => 'london-assembly-member/' |
694 | 694 | ), |
695 | 695 | |
696 | - 'otheruseredit' => array ( |
|
696 | + 'otheruseredit' => array( |
|
697 | 697 | 'pg' => 'editother', |
698 | 698 | 'title' => "Editing a user's data", |
699 | 699 | 'url' => 'user/' |
700 | 700 | ), |
701 | - 'privacy' => array ( |
|
701 | + 'privacy' => array( |
|
702 | 702 | 'title' => 'Privacy Policy', |
703 | 703 | 'url' => 'privacy/' |
704 | 704 | ), |
705 | 705 | |
706 | 706 | /* Public bill committees */ |
707 | - 'pbc_front' => array ( |
|
708 | - 'menu' => array ( |
|
707 | + 'pbc_front' => array( |
|
708 | + 'menu' => array( |
|
709 | 709 | 'text' => 'Bill Committees', |
710 | 710 | 'title' => "Public Bill Committees (formerly Standing Committees) debates" |
711 | 711 | ), |
@@ -723,17 +723,17 @@ discard block |
||
723 | 723 | 'title' => '', |
724 | 724 | 'url' => 'pbc/', |
725 | 725 | 'parent' => 'pbc_front', |
726 | - 'session_vars' => array ('bill'), |
|
726 | + 'session_vars' => array('bill'), |
|
727 | 727 | ), |
728 | 728 | 'pbc_clause' => array( |
729 | 729 | 'parent' => 'pbc_front', |
730 | 730 | 'url' => 'pbc/', |
731 | - 'session_vars' => array ('id'), |
|
731 | + 'session_vars' => array('id'), |
|
732 | 732 | ), |
733 | 733 | 'pbc_speech' => array( |
734 | 734 | 'parent' => 'pbc_front', |
735 | 735 | 'url' => 'pbc/', |
736 | - 'session_vars' => array ('id'), |
|
736 | + 'session_vars' => array('id'), |
|
737 | 737 | ), |
738 | 738 | |
739 | 739 | 'people' => array( |
@@ -745,62 +745,62 @@ discard block |
||
745 | 745 | 'url' => '', |
746 | 746 | ), |
747 | 747 | |
748 | - 'raw' => array ( |
|
748 | + 'raw' => array( |
|
749 | 749 | 'title' => 'Raw data', |
750 | 750 | 'url' => 'raw/' |
751 | 751 | ), |
752 | 752 | |
753 | - 'regmem' => array ( |
|
753 | + 'regmem' => array( |
|
754 | 754 | 'title' => 'Changes to the Register of Members\' Interests', |
755 | 755 | 'url' => 'regmem/' |
756 | 756 | ), |
757 | 757 | |
758 | - 'regmem_date' => array ( |
|
758 | + 'regmem_date' => array( |
|
759 | 759 | 'url' => 'regmem/', |
760 | 760 | 'parent' => 'regmem' |
761 | 761 | ), |
762 | 762 | |
763 | - 'regmem_mp' => array ( |
|
763 | + 'regmem_mp' => array( |
|
764 | 764 | 'url' => 'regmem/', |
765 | 765 | 'parent' => 'regmem' |
766 | 766 | ), |
767 | 767 | |
768 | - 'regmem_diff' => array ( |
|
768 | + 'regmem_diff' => array( |
|
769 | 769 | 'url' => 'regmem/', |
770 | 770 | 'parent' => 'regmem' |
771 | 771 | ), |
772 | 772 | |
773 | - 'royal' => array ( |
|
773 | + 'royal' => array( |
|
774 | 774 | 'parent' => 'hansard', |
775 | 775 | 'title' => 'Royal', |
776 | 776 | 'url' => 'royal/', |
777 | 777 | ), |
778 | 778 | |
779 | - 'topic' => array ( |
|
779 | + 'topic' => array( |
|
780 | 780 | 'parent' => 'topics', |
781 | 781 | 'url' => 'topic/topic.php', |
782 | 782 | ), |
783 | 783 | |
784 | - 'topics' => array ( |
|
784 | + 'topics' => array( |
|
785 | 785 | 'title' => 'Topics', |
786 | 786 | 'url' => 'topic/', |
787 | 787 | ), |
788 | 788 | |
789 | - 'search' => array ( |
|
789 | + 'search' => array( |
|
790 | 790 | 'sidebar' => 'search', |
791 | 791 | 'url' => 'search/', |
792 | 792 | 'robots' => 'noindex, nofollow', |
793 | 793 | 'heading' => '', |
794 | - 'session_vars' => array ('q', 's', 'pid', 'o', 'pop') |
|
794 | + 'session_vars' => array('q', 's', 'pid', 'o', 'pop') |
|
795 | 795 | ), |
796 | - 'search_help' => array ( |
|
796 | + 'search_help' => array( |
|
797 | 797 | 'sidebar' => 'search', |
798 | 798 | 'title' => 'Help with searching', |
799 | 799 | 'url' => 'search/' |
800 | 800 | ), |
801 | 801 | |
802 | - 'sitenews' => array ( |
|
803 | - 'menu' => array ( |
|
802 | + 'sitenews' => array( |
|
803 | + 'menu' => array( |
|
804 | 804 | 'text' => 'TheyWorkForYou news', |
805 | 805 | 'title' => "News about changes to this website" |
806 | 806 | ), |
@@ -810,68 +810,68 @@ discard block |
||
810 | 810 | 'title' => 'TheyWorkForYou news', |
811 | 811 | 'url' => 'news/' |
812 | 812 | ), |
813 | - 'sitenews_archive' => array ( |
|
813 | + 'sitenews_archive' => array( |
|
814 | 814 | 'parent' => 'sitenews', |
815 | 815 | 'rss' => 'news/index.rdf', |
816 | 816 | 'sidebar' => 'sitenews', |
817 | 817 | 'title' => 'Archive', |
818 | 818 | 'url' => 'news/archives/' |
819 | 819 | ), |
820 | - 'sitenews_atom' => array ( |
|
820 | + 'sitenews_atom' => array( |
|
821 | 821 | 'url' => 'news/atom.xml' |
822 | 822 | ), |
823 | - 'sitenews_date' => array ( |
|
823 | + 'sitenews_date' => array( |
|
824 | 824 | 'parent' => 'sitenews', |
825 | 825 | 'rss' => 'news/index.rdf', |
826 | 826 | 'sidebar' => 'sitenews' |
827 | 827 | ), |
828 | - 'sitenews_individual' => array ( |
|
828 | + 'sitenews_individual' => array( |
|
829 | 829 | 'parent' => 'sitenews', |
830 | 830 | 'rss' => 'news/index.rdf', |
831 | 831 | 'sidebar' => 'sitenews', |
832 | 832 | ), |
833 | - 'sitenews_rss1' => array ( |
|
833 | + 'sitenews_rss1' => array( |
|
834 | 834 | 'url' => 'news/index.rdf' |
835 | 835 | ), |
836 | - 'sitenews_rss2' => array ( |
|
836 | + 'sitenews_rss2' => array( |
|
837 | 837 | 'url' => 'news/index.xml' |
838 | 838 | ), |
839 | 839 | |
840 | 840 | /* Scottish Parliament */ |
841 | 841 | 'sp_home' => array( |
842 | - 'menu' => array ( |
|
842 | + 'menu' => array( |
|
843 | 843 | 'text' => 'Scottish Parliament', |
844 | 844 | 'title' => 'Scottish education, health, agriculture, justice, prisons and other devolved areas. Some tax-varying powers' |
845 | 845 | ), |
846 | 846 | 'title' => 'Scottish Parliament', |
847 | 847 | 'url' => 'scotland/' |
848 | 848 | ), |
849 | - 'spoverview' => array ( |
|
849 | + 'spoverview' => array( |
|
850 | 850 | 'parent' => 'sp_home', |
851 | - 'menu' => array ( |
|
851 | + 'menu' => array( |
|
852 | 852 | 'text' => 'Overview', |
853 | 853 | 'title' => "Overview of the Scottish Parliament" |
854 | 854 | ), |
855 | 855 | 'title' => '', |
856 | 856 | 'url' => 'scotland/' |
857 | 857 | ), |
858 | - 'spdebate' => array ( |
|
858 | + 'spdebate' => array( |
|
859 | 859 | 'parent' => 'spdebatesfront', |
860 | 860 | 'url' => 'sp/', |
861 | - 'session_vars' => array ('id'), |
|
861 | + 'session_vars' => array('id'), |
|
862 | 862 | ), |
863 | - 'spdebates' => array ( |
|
863 | + 'spdebates' => array( |
|
864 | 864 | 'parent' => 'spdebatesfront', |
865 | 865 | 'url' => 'sp/', |
866 | - 'session_vars' => array ('id'), |
|
866 | + 'session_vars' => array('id'), |
|
867 | 867 | ), |
868 | - 'spdebatesday' => array ( |
|
868 | + 'spdebatesday' => array( |
|
869 | 869 | 'parent' => 'spdebatesfront', |
870 | - 'session_vars' => array ('d'), |
|
870 | + 'session_vars' => array('d'), |
|
871 | 871 | 'url' => 'sp/', |
872 | 872 | ), |
873 | - 'spdebatesfront' => array ( |
|
874 | - 'menu' => array ( |
|
873 | + 'spdebatesfront' => array( |
|
874 | + 'menu' => array( |
|
875 | 875 | 'text' => 'Debates', |
876 | 876 | 'title' => '' |
877 | 877 | ), |
@@ -880,21 +880,21 @@ discard block |
||
880 | 880 | 'url' => 'sp/' |
881 | 881 | ), |
882 | 882 | |
883 | - 'spdebatesyear' => array ( |
|
883 | + 'spdebatesyear' => array( |
|
884 | 884 | 'parent' => 'spdebatesfront', |
885 | 885 | 'url' => 'sp/' |
886 | 886 | ), |
887 | - 'spwrans' => array ( |
|
887 | + 'spwrans' => array( |
|
888 | 888 | 'parent' => 'spwransfront', |
889 | 889 | 'url' => 'spwrans/', |
890 | 890 | #'session_vars' => array ('id'), |
891 | 891 | ), |
892 | - 'spwransday' => array ( |
|
892 | + 'spwransday' => array( |
|
893 | 893 | 'parent' => 'spwransfront', |
894 | 894 | 'url' => 'spwrans/' |
895 | 895 | ), |
896 | - 'spwransfront' => array ( |
|
897 | - 'menu' => array ( |
|
896 | + 'spwransfront' => array( |
|
897 | + 'menu' => array( |
|
898 | 898 | 'text' => 'Written Answers', |
899 | 899 | 'title' => '' |
900 | 900 | ), |
@@ -907,31 +907,31 @@ discard block |
||
907 | 907 | 'title' => 'For questions asked by ', |
908 | 908 | 'url' => 'spwrans/' |
909 | 909 | ), |
910 | - 'spwransyear' => array ( |
|
910 | + 'spwransyear' => array( |
|
911 | 911 | 'parent' => 'spwransfront', |
912 | 912 | 'url' => 'spwrans/' |
913 | 913 | ), |
914 | 914 | |
915 | 915 | // Topic pages |
916 | 916 | |
917 | - 'topic' => array ( |
|
917 | + 'topic' => array( |
|
918 | 918 | 'url' => 'topic/', |
919 | 919 | 'title' => 'Topics' |
920 | 920 | ), |
921 | 921 | |
922 | - 'topicbenefits' => array ( |
|
922 | + 'topicbenefits' => array( |
|
923 | 923 | 'url' => 'topic/benefits', |
924 | 924 | 'parent' => 'topic', |
925 | 925 | 'title' => 'Benefits' |
926 | 926 | ), |
927 | 927 | |
928 | - 'topiccrimestats' => array ( |
|
928 | + 'topiccrimestats' => array( |
|
929 | 929 | 'url' => 'topic/crime-stats', |
930 | 930 | 'parent' => 'topic', |
931 | 931 | 'title' => 'Crime Statistics' |
932 | 932 | ), |
933 | 933 | |
934 | - 'topicnhs' => array ( |
|
934 | + 'topicnhs' => array( |
|
935 | 935 | 'url' => 'topic/nhs', |
936 | 936 | 'parent' => 'topic', |
937 | 937 | 'title' => 'NHS' |
@@ -946,29 +946,29 @@ discard block |
||
946 | 946 | 'url' => 'user/alerts/', |
947 | 947 | 'parent' => 'userviewself' |
948 | 948 | ), |
949 | - 'userchangepc' => array ( |
|
949 | + 'userchangepc' => array( |
|
950 | 950 | 'title' => 'Change your postcode', |
951 | 951 | 'url' => 'user/changepc/' |
952 | 952 | ), |
953 | - 'userconfirm' => array ( |
|
953 | + 'userconfirm' => array( |
|
954 | 954 | 'url' => 'user/confirm/' |
955 | 955 | ), |
956 | - 'userconfirmed' => array ( |
|
956 | + 'userconfirmed' => array( |
|
957 | 957 | 'sidebar' => 'userconfirmed', |
958 | 958 | 'title' => 'Welcome to TheyWorkForYou!', |
959 | 959 | 'url' => 'user/confirm/' |
960 | 960 | ), |
961 | - 'userconfirmfailed' => array ( |
|
961 | + 'userconfirmfailed' => array( |
|
962 | 962 | 'title' => 'Oops!', |
963 | 963 | 'url' => 'user/confirm/' |
964 | 964 | ), |
965 | - 'useredit' => array ( |
|
965 | + 'useredit' => array( |
|
966 | 966 | 'pg' => 'edit', |
967 | 967 | 'title' => 'Edit your details', |
968 | 968 | 'url' => 'user/' |
969 | 969 | ), |
970 | - 'userjoin' => array ( |
|
971 | - 'menu' => array ( |
|
970 | + 'userjoin' => array( |
|
971 | + 'menu' => array( |
|
972 | 972 | 'text' => 'Join', |
973 | 973 | 'title' => "Joining is free and allows you to annotate speeches" |
974 | 974 | ), |
@@ -977,8 +977,8 @@ discard block |
||
977 | 977 | 'title' => 'Join TheyWorkForYou', |
978 | 978 | 'url' => 'user/' |
979 | 979 | ), |
980 | - 'getinvolved' => array ( |
|
981 | - 'menu' => array ( |
|
980 | + 'getinvolved' => array( |
|
981 | + 'menu' => array( |
|
982 | 982 | 'text' => 'Get involved', |
983 | 983 | 'title' => "Contribute to TheyWorkForYou" |
984 | 984 | ), |
@@ -987,8 +987,8 @@ discard block |
||
987 | 987 | 'title' => 'Contribute to TheyWorkForYou', |
988 | 988 | 'url' => 'getinvolved/' |
989 | 989 | ), |
990 | - 'userlogin' => array ( |
|
991 | - 'menu' => array ( |
|
990 | + 'userlogin' => array( |
|
991 | + 'menu' => array( |
|
992 | 992 | 'text' => 'Sign in', |
993 | 993 | 'title' => "If you've already joined , sign in to add annotations" |
994 | 994 | ), |
@@ -997,33 +997,33 @@ discard block |
||
997 | 997 | 'url' => 'user/login/' |
998 | 998 | ), |
999 | 999 | |
1000 | - 'userlogout' => array ( |
|
1001 | - 'menu' => array ( |
|
1000 | + 'userlogout' => array( |
|
1001 | + 'menu' => array( |
|
1002 | 1002 | 'text' => 'Sign out', |
1003 | 1003 | 'title' => "Sign out" |
1004 | 1004 | ), |
1005 | 1005 | 'url' => 'user/logout/' |
1006 | 1006 | ), |
1007 | - 'userpassword' => array ( |
|
1007 | + 'userpassword' => array( |
|
1008 | 1008 | 'title' => 'Change password', |
1009 | 1009 | 'url' => 'user/password/' |
1010 | 1010 | ), |
1011 | - 'userprompt' => array ( |
|
1011 | + 'userprompt' => array( |
|
1012 | 1012 | 'title' => 'Please sign in', |
1013 | 1013 | 'url' => 'user/prompt/' |
1014 | 1014 | ), |
1015 | - 'userview' => array ( |
|
1015 | + 'userview' => array( |
|
1016 | 1016 | 'session_vars' => array('u'), |
1017 | 1017 | 'url' => 'user/' |
1018 | 1018 | ), |
1019 | - 'userviewself' => array ( |
|
1020 | - 'menu' => array ( |
|
1019 | + 'userviewself' => array( |
|
1020 | + 'menu' => array( |
|
1021 | 1021 | 'text' => 'Your details', |
1022 | 1022 | 'title' => "View and edit your details" |
1023 | 1023 | ), |
1024 | 1024 | 'url' => 'user/' |
1025 | 1025 | ), |
1026 | - 'userwelcome' => array ( |
|
1026 | + 'userwelcome' => array( |
|
1027 | 1027 | 'title' => 'Welcome!', |
1028 | 1028 | 'url' => 'user/' |
1029 | 1029 | ), |
@@ -1051,23 +1051,23 @@ discard block |
||
1051 | 1051 | ), |
1052 | 1052 | |
1053 | 1053 | /* Westminster Hall */ |
1054 | - 'whall' => array ( |
|
1054 | + 'whall' => array( |
|
1055 | 1055 | 'parent' => 'whallfront', |
1056 | 1056 | 'url' => 'whall/', |
1057 | - 'session_vars' => array ('id'), |
|
1057 | + 'session_vars' => array('id'), |
|
1058 | 1058 | ), |
1059 | - 'whalls' => array ( |
|
1059 | + 'whalls' => array( |
|
1060 | 1060 | 'parent' => 'whallfront', |
1061 | 1061 | 'url' => 'whall/', |
1062 | - 'session_vars' => array ('id'), |
|
1062 | + 'session_vars' => array('id'), |
|
1063 | 1063 | ), |
1064 | - 'whallday' => array ( |
|
1064 | + 'whallday' => array( |
|
1065 | 1065 | 'parent' => 'whallfront', |
1066 | - 'session_vars' => array ('d'), |
|
1066 | + 'session_vars' => array('d'), |
|
1067 | 1067 | 'url' => 'whall/', |
1068 | 1068 | ), |
1069 | - 'whallfront' => array ( |
|
1070 | - 'menu' => array ( |
|
1069 | + 'whallfront' => array( |
|
1070 | + 'menu' => array( |
|
1071 | 1071 | 'text' => 'Westminster Hall', |
1072 | 1072 | 'title' => "Westminster Hall debates" |
1073 | 1073 | ), |
@@ -1076,23 +1076,23 @@ discard block |
||
1076 | 1076 | 'rss' => 'rss/whall.rss', |
1077 | 1077 | 'url' => 'whall/' |
1078 | 1078 | ), |
1079 | - 'whallyear' => array ( |
|
1079 | + 'whallyear' => array( |
|
1080 | 1080 | 'parent' => 'whallfront', |
1081 | 1081 | 'url' => 'whall/' |
1082 | 1082 | ), |
1083 | 1083 | |
1084 | - 'wms' => array ( |
|
1084 | + 'wms' => array( |
|
1085 | 1085 | 'parent' => 'wranswmsfront', |
1086 | 1086 | 'url' => 'wms/', |
1087 | 1087 | 'session_vars' => array('id') |
1088 | 1088 | ), |
1089 | - 'wmsday' => array ( |
|
1089 | + 'wmsday' => array( |
|
1090 | 1090 | 'parent' => 'wmsfront', |
1091 | 1091 | 'session_vars' => array('d'), |
1092 | 1092 | 'url' => 'wms/' |
1093 | 1093 | ), |
1094 | - 'wmsfront' => array ( |
|
1095 | - 'menu' => array ( |
|
1094 | + 'wmsfront' => array( |
|
1095 | + 'menu' => array( |
|
1096 | 1096 | 'text' => 'Written Ministerial Statements', |
1097 | 1097 | 'title' => '' |
1098 | 1098 | ), |
@@ -1101,22 +1101,22 @@ discard block |
||
1101 | 1101 | 'rss' => 'rss/wms.rss', |
1102 | 1102 | 'url' => 'wms/' |
1103 | 1103 | ), |
1104 | - 'wmsyear' => array ( |
|
1104 | + 'wmsyear' => array( |
|
1105 | 1105 | 'parent' => 'wmsfront', |
1106 | 1106 | 'url' => 'wms/' |
1107 | 1107 | ), |
1108 | 1108 | |
1109 | - 'wrans' => array ( |
|
1109 | + 'wrans' => array( |
|
1110 | 1110 | 'parent' => 'wranswmsfront', |
1111 | 1111 | 'url' => 'wrans/', |
1112 | - 'session_vars' => array ('id') |
|
1112 | + 'session_vars' => array('id') |
|
1113 | 1113 | ), |
1114 | - 'wransday' => array ( |
|
1114 | + 'wransday' => array( |
|
1115 | 1115 | 'parent' => 'wransfront', |
1116 | 1116 | 'url' => 'wrans/' |
1117 | 1117 | ), |
1118 | - 'wransfront' => array ( |
|
1119 | - 'menu' => array ( |
|
1118 | + 'wransfront' => array( |
|
1119 | + 'menu' => array( |
|
1120 | 1120 | 'text' => 'Written Answers', |
1121 | 1121 | 'title' => "Written Answers" |
1122 | 1122 | ), |
@@ -1129,13 +1129,13 @@ discard block |
||
1129 | 1129 | 'title' => 'For questions asked by ', |
1130 | 1130 | 'url' => 'wrans/' |
1131 | 1131 | ), |
1132 | - 'wransyear' => array ( |
|
1132 | + 'wransyear' => array( |
|
1133 | 1133 | 'parent' => 'wransfront', |
1134 | 1134 | 'url' => 'wrans/' |
1135 | 1135 | ), |
1136 | 1136 | |
1137 | - 'wranswmsfront' => array ( |
|
1138 | - 'menu' => array ( |
|
1137 | + 'wranswmsfront' => array( |
|
1138 | + 'menu' => array( |
|
1139 | 1139 | 'text' => 'Written Answers', |
1140 | 1140 | 'title' => 'Written Answers and Statements', |
1141 | 1141 | ), |
@@ -1152,8 +1152,8 @@ discard block |
||
1152 | 1152 | 'title' => 'Your representative', |
1153 | 1153 | 'url' => 'your/', |
1154 | 1154 | ), |
1155 | - 'yourmp' => array ( |
|
1156 | - 'menu' => array ( |
|
1155 | + 'yourmp' => array( |
|
1156 | + 'menu' => array( |
|
1157 | 1157 | 'text' => 'Your MP', |
1158 | 1158 | 'title' => "Find out about your Member of Parliament" |
1159 | 1159 | ), |
@@ -1162,8 +1162,8 @@ discard block |
||
1162 | 1162 | 'url' => 'mp/', |
1163 | 1163 | 'parent' => 'mps', |
1164 | 1164 | ), |
1165 | - 'yourmp_recent' => array ( |
|
1166 | - 'menu' => array ( |
|
1165 | + 'yourmp_recent' => array( |
|
1166 | + 'menu' => array( |
|
1167 | 1167 | 'text' => 'Recent appearances', |
1168 | 1168 | 'title' => "Recent speeches and written answers by this MP" |
1169 | 1169 | ), |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | 'title' => "Your MP's recent appearances in parliament", |
1172 | 1172 | 'url' => 'mp/?recent=1' |
1173 | 1173 | ), |
1174 | - 'yourmsp' => array ( |
|
1175 | - 'menu' => array ( |
|
1174 | + 'yourmsp' => array( |
|
1175 | + 'menu' => array( |
|
1176 | 1176 | 'text' => 'Your MSPs', |
1177 | 1177 | 'title' => "Find out about your Members of the Scottish Parliament" |
1178 | 1178 | ), |
@@ -1181,8 +1181,8 @@ discard block |
||
1181 | 1181 | 'title' => 'Your MSPs', |
1182 | 1182 | 'url' => 'msp/' |
1183 | 1183 | ), |
1184 | - 'yourmla' => array ( |
|
1185 | - 'menu' => array ( |
|
1184 | + 'yourmla' => array( |
|
1185 | + 'menu' => array( |
|
1186 | 1186 | 'text' => 'Your MLAs', |
1187 | 1187 | 'title' => "Find out about your Members of the Legislative Assembly" |
1188 | 1188 | ), |
@@ -1198,38 +1198,38 @@ discard block |
||
1198 | 1198 | // The text displayed on the page itself will also be this, |
1199 | 1199 | // UNLESS the section has a 'heading', in which case that's used instead. |
1200 | 1200 | |
1201 | -$this->section = array ( |
|
1201 | +$this->section = array( |
|
1202 | 1202 | |
1203 | 1203 | |
1204 | - 'about' => array ( |
|
1204 | + 'about' => array( |
|
1205 | 1205 | 'title' => 'About Us' |
1206 | 1206 | ), |
1207 | - 'admin' => array ( |
|
1207 | + 'admin' => array( |
|
1208 | 1208 | 'title' => 'Admin' |
1209 | 1209 | ), |
1210 | - 'debates' => array ( |
|
1210 | + 'debates' => array( |
|
1211 | 1211 | 'title' => 'Debates', |
1212 | 1212 | 'heading' => 'House of Commons Debates' |
1213 | 1213 | ), |
1214 | - 'help_us_out' => array ( |
|
1214 | + 'help_us_out' => array( |
|
1215 | 1215 | 'title' => 'Help Us Out' |
1216 | 1216 | ), |
1217 | - 'hansard' => array ( |
|
1217 | + 'hansard' => array( |
|
1218 | 1218 | 'title' => 'Hansard' |
1219 | 1219 | ), |
1220 | - 'home' => array ( |
|
1220 | + 'home' => array( |
|
1221 | 1221 | 'title' => 'Home' |
1222 | 1222 | ), |
1223 | - 'mp' => array ( |
|
1223 | + 'mp' => array( |
|
1224 | 1224 | 'title' => 'Your MP' |
1225 | 1225 | ), |
1226 | - 'search' => array ( |
|
1226 | + 'search' => array( |
|
1227 | 1227 | 'title' => 'Search' |
1228 | 1228 | ), |
1229 | - 'sitenews' => array ( |
|
1229 | + 'sitenews' => array( |
|
1230 | 1230 | 'title' => 'TheyWorkForYou news' |
1231 | 1231 | ), |
1232 | - 'wrans' => array ( |
|
1232 | + 'wrans' => array( |
|
1233 | 1233 | 'title' => 'Written Answers' |
1234 | 1234 | ) |
1235 | 1235 |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | return $data; |
319 | 319 | } |
320 | 320 | |
321 | - public function _get_data_by_dates($args) { |
|
321 | + public function _get_data_by_dates($args) { |
|
322 | 322 | // $args should contain start_date and end_date |
323 | 323 | |
324 | 324 | twfy_debug (get_class($this), "getting data by recent"); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $commentsdata = $this->_get_comment_data($input); |
339 | 339 | $data['comments'] = $commentsdata; |
340 | 340 | return $data; |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | 343 | public function _get_data_by_search($args) { |
344 | 344 | // $args should contain 'num', indicating how many to get. |
@@ -542,11 +542,11 @@ |
||
542 | 542 | } |
543 | 543 | if ($limit != '') { |
544 | 544 | # Can't use parameter as >1 argument |
545 | - $limit = "LIMIT $limit"; |
|
545 | + $limit = "limit $limit"; |
|
546 | 546 | } |
547 | 547 | |
548 | 548 | // Finally, do the query! |
549 | - $q = $this->db->query ("SELECT $fields |
|
549 | + $q = $this->db->query ("select $fields |
|
550 | 550 | FROM comments |
551 | 551 | $join |
552 | 552 | WHERE $where |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | |
45 | - public function display ($view, $args=array(), $format='html') { |
|
45 | + public function display($view, $args = array(), $format = 'html') { |
|
46 | 46 | // $view is what we're viewing by: |
47 | 47 | // 'ep' is all the comments attached to an epobject. |
48 | 48 | // 'user' is all the comments written by a user. |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | |
61 | 61 | if ($view == 'ep' || $view == 'user' || $view == 'recent' || $view == 'search' || $view == 'dates') { |
62 | 62 | // What function do we call for this view? |
63 | - $function = '_get_data_by_'.$view; |
|
63 | + $function = '_get_data_by_' . $view; |
|
64 | 64 | // Get all the dta that's to be rendered. |
65 | 65 | $data = $this->$function($args); |
66 | 66 | |
67 | 67 | } else { |
68 | 68 | // Don't have a valid $view; |
69 | - $PAGE->error_message ("You haven't specified a view type."); |
|
69 | + $PAGE->error_message("You haven't specified a view type."); |
|
70 | 70 | return false; |
71 | 71 | } |
72 | 72 | |
@@ -85,29 +85,29 @@ discard block |
||
85 | 85 | return true; |
86 | 86 | } |
87 | 87 | |
88 | - public function render($data, $format='html', $template='comments') { |
|
89 | - include (INCLUDESPATH."easyparliament/templates/$format/$template.php"); |
|
88 | + public function render($data, $format = 'html', $template = 'comments') { |
|
89 | + include (INCLUDESPATH . "easyparliament/templates/$format/$template.php"); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | public function _get_data_by_ep($args) { |
93 | 93 | // Get all the data attached to an epobject. |
94 | 94 | global $PAGE; |
95 | 95 | |
96 | - twfy_debug (get_class($this), "getting data by epobject"); |
|
96 | + twfy_debug(get_class($this), "getting data by epobject"); |
|
97 | 97 | |
98 | 98 | // What we return. |
99 | 99 | $data = array(); |
100 | 100 | if (!is_numeric($args['epobject_id'])) { |
101 | - $PAGE->error_message ("Sorry, we don't have a valid epobject id"); |
|
101 | + $PAGE->error_message("Sorry, we don't have a valid epobject id"); |
|
102 | 102 | return $data; |
103 | 103 | } |
104 | 104 | |
105 | 105 | // For getting the data. |
106 | - $input = array ( |
|
107 | - 'amount' => array ( |
|
106 | + $input = array( |
|
107 | + 'amount' => array( |
|
108 | 108 | 'user' => true |
109 | 109 | ), |
110 | - 'where' => array ( |
|
110 | + 'where' => array( |
|
111 | 111 | 'comments.epobject_id=' => $args['epobject_id'], |
112 | 112 | #'visible=' => '1' |
113 | 113 | ), |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | // comments by things in $args? |
136 | 136 | global $PAGE; |
137 | 137 | |
138 | - twfy_debug (get_class($this), "getting data by user"); |
|
138 | + twfy_debug(get_class($this), "getting data by user"); |
|
139 | 139 | |
140 | 140 | // What we return. |
141 | 141 | $data = array(); |
142 | 142 | |
143 | 143 | if (!is_numeric($args['user_id'])) { |
144 | - $PAGE->error_message ("Sorry, we don't have a valid user id"); |
|
144 | + $PAGE->error_message("Sorry, we don't have a valid user id"); |
|
145 | 145 | return $data; |
146 | 146 | } |
147 | 147 | |
@@ -151,13 +151,13 @@ discard block |
||
151 | 151 | $num = 10; |
152 | 152 | } |
153 | 153 | |
154 | - if (isset($args['page']) && is_numeric($args['page']) && $args['page']>1) { |
|
154 | + if (isset($args['page']) && is_numeric($args['page']) && $args['page'] > 1) { |
|
155 | 155 | $page = $args['page']; |
156 | 156 | } else { |
157 | 157 | $page = 1; |
158 | 158 | } |
159 | 159 | |
160 | - $limit = $num*($page-1) . ',' . $num; |
|
160 | + $limit = $num * ($page - 1) . ',' . $num; |
|
161 | 161 | |
162 | 162 | // We're getting the most recent comments posted to epobjects. |
163 | 163 | // We're grouping them by epobject so we can just link to each hansard thing once. |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | // This does rely on both this and the previous query returning |
239 | 239 | // stuff in the same order... |
240 | 240 | foreach ($comments as $n => $commentdata) { |
241 | - $comments[$n]['body'] = $commentbodies[ $comments[$n]['comment_id'] ]; |
|
241 | + $comments[$n]['body'] = $commentbodies[$comments[$n]['comment_id']]; |
|
242 | 242 | } |
243 | 243 | } |
244 | 244 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | // $args should contain 'num', indicating how many to get. |
259 | 259 | // and perhaps pid too, for a particular person |
260 | 260 | |
261 | - twfy_debug (get_class($this), "getting data by recent"); |
|
261 | + twfy_debug(get_class($this), "getting data by recent"); |
|
262 | 262 | |
263 | 263 | // What we return. |
264 | 264 | $data = array(); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $page = 1; |
276 | 276 | } |
277 | 277 | |
278 | - $limit = $num*($page-1) . ',' . $num; |
|
278 | + $limit = $num * ($page - 1) . ',' . $num; |
|
279 | 279 | |
280 | 280 | $where = array( |
281 | 281 | 'visible=' => '1' |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | if (isset($args['pid']) && is_numeric($args['pid'])) { |
284 | 284 | $where['person_id='] = $args['pid']; |
285 | 285 | } |
286 | - $input = array ( |
|
287 | - 'amount' => array ( |
|
286 | + $input = array( |
|
287 | + 'amount' => array( |
|
288 | 288 | 'user' => true |
289 | 289 | ), |
290 | 290 | 'where' => $where, |
@@ -316,15 +316,15 @@ discard block |
||
316 | 316 | public function _get_data_by_dates($args) { |
317 | 317 | // $args should contain start_date and end_date |
318 | 318 | |
319 | - twfy_debug (get_class($this), "getting data by recent"); |
|
319 | + twfy_debug(get_class($this), "getting data by recent"); |
|
320 | 320 | $data = array(); |
321 | 321 | $where = array( |
322 | 322 | 'visible=' => '1', |
323 | 323 | 'date(posted)>=' => $args['start_date'], |
324 | 324 | 'date(posted)<=' => $args['end_date'] |
325 | 325 | ); |
326 | - $input = array ( |
|
327 | - 'amount' => array ( |
|
326 | + $input = array( |
|
327 | + 'amount' => array( |
|
328 | 328 | 'user' => true |
329 | 329 | ), |
330 | 330 | 'where' => $where, |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | public function _get_data_by_search($args) { |
339 | 339 | // $args should contain 'num', indicating how many to get. |
340 | 340 | |
341 | - twfy_debug (get_class($this), "getting data by search"); |
|
341 | + twfy_debug(get_class($this), "getting data by search"); |
|
342 | 342 | |
343 | 343 | // What we return. |
344 | 344 | $data = array(); |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | $page = 1; |
356 | 356 | } |
357 | 357 | |
358 | - $limit = $num*($page-1) . ',' . $num; |
|
358 | + $limit = $num * ($page - 1) . ',' . $num; |
|
359 | 359 | |
360 | - $input = array ( |
|
361 | - 'amount' => array ( |
|
360 | + $input = array( |
|
361 | + 'amount' => array( |
|
362 | 362 | 'user'=> true |
363 | 363 | ), |
364 | - 'where' => array ( |
|
364 | + 'where' => array( |
|
365 | 365 | 'comments.body LIKE' => "%$args[s]%" |
366 | 366 | ), |
367 | 367 | 'order' => 'posted DESC', |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | // It returns the URL for the comment. |
389 | 389 | |
390 | 390 | $major = $urldata['major']; |
391 | - $gid = $urldata['gid']; |
|
391 | + $gid = $urldata['gid']; |
|
392 | 392 | $comment_id = $urldata['comment_id']; |
393 | 393 | $user_id = isset($urldata['user_id']) ? $urldata['user_id'] : false; |
394 | 394 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | $URL = new \MySociety\TheyWorkForYou\Url($page); |
403 | 403 | |
404 | 404 | $gid = fix_gid_from_db($gid); // In includes/utility.php |
405 | - $URL->insert(array('id' => $gid )); |
|
405 | + $URL->insert(array('id' => $gid)); |
|
406 | 406 | if ($user_id) { |
407 | 407 | $URL->insert(array('u' => $user_id)); |
408 | 408 | } |
@@ -480,9 +480,9 @@ discard block |
||
480 | 480 | $limit = isset($input['limit']) ? $input['limit'] : ''; |
481 | 481 | |
482 | 482 | // The fields to fetch from db. 'table' => array ('field1', 'field2'). |
483 | - $fieldsarr = array ( |
|
484 | - 'comments' => array ('comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'), |
|
485 | - 'hansard' => array ('major', 'gid') |
|
483 | + $fieldsarr = array( |
|
484 | + 'comments' => array('comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'), |
|
485 | + 'hansard' => array('major', 'gid') |
|
486 | 486 | ); |
487 | 487 | |
488 | 488 | // Yes, we need the gid of a comment's associated hansard object |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | // Add on the stuff for getting a user's details. |
495 | 495 | if (isset($amount['user']) && $amount['user'] == true) { |
496 | - $fieldsarr['users'] = array ('firstname', 'lastname', 'user_id'); |
|
496 | + $fieldsarr['users'] = array('firstname', 'lastname', 'user_id'); |
|
497 | 497 | // Like doing "FROM comments, users" but it's easier to add |
498 | 498 | // an "INNER JOIN..." automatically to the query. |
499 | 499 | $join .= ' INNER JOIN users ON comments.user_id = users.user_id '; |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $fieldsarr['epobject'] = array('body'); |
505 | 505 | } |
506 | 506 | |
507 | - $fieldsarr2 = array (); |
|
507 | + $fieldsarr2 = array(); |
|
508 | 508 | // Construct the $fields clause. |
509 | 509 | foreach ($fieldsarr as $table => $tablesfields) { |
510 | 510 | foreach ($tablesfields as $n => $field) { |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | if ($table == 'epobject' && $field == 'body') { |
516 | 516 | $field .= ' AS hbody'; |
517 | 517 | } |
518 | - $fieldsarr2[] = $table.'.'.$field; |
|
518 | + $fieldsarr2[] = $table . '.' . $field; |
|
519 | 519 | } |
520 | 520 | } |
521 | 521 | $fields = implode(', ', $fieldsarr2); |
522 | 522 | |
523 | 523 | |
524 | - $wherearr2 = array (); |
|
524 | + $wherearr2 = array(); |
|
525 | 525 | $params = array(); |
526 | 526 | $i = 0; |
527 | 527 | // Construct the $where clause. |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | $params[":where$i"] = $val; |
531 | 531 | $i++; |
532 | 532 | } |
533 | - $where = implode (" AND ", $wherearr2); |
|
533 | + $where = implode(" AND ", $wherearr2); |
|
534 | 534 | |
535 | 535 | if ($order != '') { |
536 | 536 | $order = "ORDER BY $order"; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | } |
542 | 542 | |
543 | 543 | // Finally, do the query! |
544 | - $q = $this->db->query ("SELECT $fields |
|
544 | + $q = $this->db->query("SELECT $fields |
|
545 | 545 | FROM comments |
546 | 546 | $join |
547 | 547 | WHERE $where |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | ", $params); |
551 | 551 | |
552 | 552 | // Format the data into an array for returning. |
553 | - $data = array (); |
|
553 | + $data = array(); |
|
554 | 554 | |
555 | 555 | // If you change stuff here, you might have to change it in |
556 | 556 | // $COMMENT->_set_url() too... |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | } |
334 | 334 | |
335 | 335 | public function get_spelling_correction() { |
336 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
336 | + if (!defined('XAPIANDB') || !XAPIANDB) |
|
337 | 337 | return null; |
338 | 338 | |
339 | 339 | $qd = $this->queryparser->get_corrected_query_string(); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | { |
560 | 560 | $wordpos = strpos( $lcbody, $matches[0] ); |
561 | 561 | if ($wordpos) { |
562 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
562 | + if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
563 | 563 | $pos = $wordpos; |
564 | 564 | } |
565 | 565 | } |
@@ -38,8 +38,9 @@ discard block |
||
38 | 38 | public $error; |
39 | 39 | |
40 | 40 | public function __construct($query) { |
41 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
42 | - return null; |
|
41 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
42 | + return null; |
|
43 | + } |
|
43 | 44 | |
44 | 45 | global $xapiandb, $PAGE; |
45 | 46 | if (!$xapiandb) { |
@@ -54,8 +55,12 @@ discard block |
||
54 | 55 | } |
55 | 56 | } |
56 | 57 | $this->query = $query; |
57 | - if (!isset($this->stemmer)) $this->stemmer = new XapianStem('english'); |
|
58 | - if (!isset($this->enquire)) $this->enquire = new XapianEnquire($xapiandb); |
|
58 | + if (!isset($this->stemmer)) { |
|
59 | + $this->stemmer = new XapianStem('english'); |
|
60 | + } |
|
61 | + if (!isset($this->enquire)) { |
|
62 | + $this->enquire = new XapianEnquire($xapiandb); |
|
63 | + } |
|
59 | 64 | if (!isset($this->queryparser)) { |
60 | 65 | $this->queryparser = new XapianQueryParser(); |
61 | 66 | $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') { |
@@ -264,7 +290,9 @@ discard block |
||
264 | 290 | $end = $this->queryparser->unstem_end($mm); |
265 | 291 | while (!$iter->equals($end)) { |
266 | 292 | $tt = $iter->get_term(); |
267 | - if (!in_array($tt, $used)) break; |
|
293 | + if (!in_array($tt, $used)) { |
|
294 | + break; |
|
295 | + } |
|
268 | 296 | $iter->next(); |
269 | 297 | } |
270 | 298 | $used[] = $tt; |
@@ -343,8 +371,9 @@ discard block |
||
343 | 371 | } |
344 | 372 | |
345 | 373 | public function get_spelling_correction() { |
346 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
347 | - return null; |
|
374 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
375 | + return null; |
|
376 | + } |
|
348 | 377 | |
349 | 378 | $qd = $this->queryparser->get_corrected_query_string(); |
350 | 379 | return $qd; |
@@ -352,8 +381,9 @@ discard block |
||
352 | 381 | |
353 | 382 | // Perform partial query to get a count of number of matches |
354 | 383 | public function run_count($first_result, $results_per_page, $sort_order='relevance') { |
355 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
356 | - return null; |
|
384 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
385 | + return null; |
|
386 | + } |
|
357 | 387 | |
358 | 388 | $start = getmicrotime(); |
359 | 389 | |
@@ -383,16 +413,18 @@ discard block |
||
383 | 413 | $collapsed = true; |
384 | 414 | if ($items[1] == 'speech') |
385 | 415 | ; // no collapse key |
386 | - elseif ($items[1] == 'debate') |
|
387 | - $this->enquire->set_collapse_key(3); |
|
388 | - else |
|
389 | - $PAGE->error_message("Unknown group by '$items[1]' ignored"); |
|
416 | + elseif ($items[1] == 'debate') { |
|
417 | + $this->enquire->set_collapse_key(3); |
|
418 | + } else { |
|
419 | + $PAGE->error_message("Unknown group by '$items[1]' ignored"); |
|
420 | + } |
|
390 | 421 | } |
391 | 422 | } |
392 | 423 | |
393 | 424 | // default to grouping by subdebate, i.e. by page |
394 | - if (!$collapsed) |
|
395 | - $this->enquire->set_collapse_key(3); |
|
425 | + if (!$collapsed) { |
|
426 | + $this->enquire->set_collapse_key(3); |
|
427 | + } |
|
396 | 428 | |
397 | 429 | /* |
398 | 430 | XXX Helping to debug possible Xapian bug |
@@ -472,8 +504,9 @@ discard block |
||
472 | 504 | |
473 | 505 | // Puts HTML highlighting round all the matching words in the text |
474 | 506 | public function highlight($body) { |
475 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
476 | - return $body; |
|
507 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
508 | + return $body; |
|
509 | + } |
|
477 | 510 | |
478 | 511 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
479 | 512 | if (is_array($body)) { |
@@ -491,8 +524,9 @@ discard block |
||
491 | 524 | private $specialchars_upper = array('<', '>', '"', '&'); |
492 | 525 | |
493 | 526 | public function highlight_internal($body, $stemmed_words) { |
494 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
495 | - return $body; |
|
527 | + if (!defined('XAPIANDB') || !XAPIANDB) { |
|
528 | + return $body; |
|
529 | + } |
|
496 | 530 | |
497 | 531 | # Does html_entity_decode without the htmlspecialchars |
498 | 532 | $body = str_replace($this->specialchars, $this->specialchars_upper, $body); |
@@ -513,7 +547,9 @@ discard block |
||
513 | 547 | $hl = false; |
514 | 548 | $matchword = $this->stem($extractword); |
515 | 549 | foreach ($stemmed_words as $word) { |
516 | - if ($word == '') continue; |
|
550 | + if ($word == '') { |
|
551 | + continue; |
|
552 | + } |
|
517 | 553 | if ($matchword == $word) { |
518 | 554 | $hl = true; |
519 | 555 | break; |
@@ -565,8 +601,7 @@ discard block |
||
565 | 601 | // look for phrases |
566 | 602 | foreach ($this->phrases as $phrase) { |
567 | 603 | $phrasematch = join($phrase, '[^'.$this->wordchars.']+'); |
568 | - if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) |
|
569 | - { |
|
604 | + if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) { |
|
570 | 605 | $wordpos = strpos( $lcbody, $matches[0] ); |
571 | 606 | if ($wordpos) { |
572 | 607 | if ( ($wordpos < $pos) || ($pos==-1) ) { |
@@ -575,17 +610,25 @@ discard block |
||
575 | 610 | } |
576 | 611 | } |
577 | 612 | } |
578 | - if ($pos != -1) return $pos; |
|
613 | + if ($pos != -1) { |
|
614 | + return $pos; |
|
615 | + } |
|
579 | 616 | |
580 | 617 | $splitextract = preg_split('/([0-9,.]+|['.$this->wordcharsnodigit.']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
581 | 618 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
582 | 619 | foreach ($splitextract as $extractword) { |
583 | 620 | $extractword = preg_replace('/&$/', '', $extractword); |
584 | - if (!$extractword) continue; |
|
621 | + if (!$extractword) { |
|
622 | + continue; |
|
623 | + } |
|
585 | 624 | $wordpos = strpos($lcbody, $extractword); |
586 | - if (!$wordpos) continue; |
|
625 | + if (!$wordpos) { |
|
626 | + continue; |
|
627 | + } |
|
587 | 628 | foreach ($stemmed_words as $word) { |
588 | - if ($word == '') continue; |
|
629 | + if ($word == '') { |
|
630 | + continue; |
|
631 | + } |
|
589 | 632 | $matchword = $this->stem($extractword); |
590 | 633 | if ($matchword == $word && ($wordpos < $pos || $pos==-1)) { |
591 | 634 | $pos = $wordpos; |
@@ -593,10 +636,14 @@ discard block |
||
593 | 636 | } |
594 | 637 | } |
595 | 638 | // only look for earlier words if phrases weren't found |
596 | - if ($pos != -1) return $pos; |
|
639 | + if ($pos != -1) { |
|
640 | + return $pos; |
|
641 | + } |
|
597 | 642 | |
598 | 643 | foreach ($this->words as $word) { |
599 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
644 | + if (ctype_digit($word)) { |
|
645 | + $word = '(?:'.$word.'|'.number_format($word).')'; |
|
646 | + } |
|
600 | 647 | if (preg_match('/([^'.$this->wordchars.']' . $word . '[^'.$this->wordchars. '])/', $lcbody, $matches)) { |
601 | 648 | $wordpos = strpos( $lcbody, $matches[0] ); |
602 | 649 | if ($wordpos) { |
@@ -607,10 +654,14 @@ discard block |
||
607 | 654 | } |
608 | 655 | } |
609 | 656 | // only look for something containing the word (ie. something stemmed, but doesn't work all the time) if no whole word was found |
610 | - if ($pos != -1) return $pos; |
|
657 | + if ($pos != -1) { |
|
658 | + return $pos; |
|
659 | + } |
|
611 | 660 | |
612 | 661 | foreach ($this->words as $word) { |
613 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
662 | + if (ctype_digit($word)) { |
|
663 | + $word = '(?:'.$word.'|'.number_format($word).')'; |
|
664 | + } |
|
614 | 665 | if (preg_match('/(' . $word . ')/', $lcbody, $matches)) { |
615 | 666 | $wordpos = strpos( $lcbody, $matches[0] ); |
616 | 667 | if ($wordpos) { |
@@ -621,8 +672,9 @@ discard block |
||
621 | 672 | } |
622 | 673 | } |
623 | 674 | |
624 | - if ($pos == -1) |
|
625 | - $pos = 0; |
|
675 | + if ($pos == -1) { |
|
676 | + $pos = 0; |
|
677 | + } |
|
626 | 678 | |
627 | 679 | return $pos; |
628 | 680 | } |
@@ -96,10 +96,10 @@ discard block |
||
96 | 96 | // Split words up into individual words, and quoted phrases |
97 | 97 | preg_match_all('/(' . |
98 | 98 | '"|' . # match either a quote, or... |
99 | - '(?:(?<![' .$this->wordchars. '])-)?' . # optionally a - (exclude) |
|
99 | + '(?:(?<![' . $this->wordchars . '])-)?' . # optionally a - (exclude) |
|
100 | 100 | # if at start of word (i.e. not preceded by a word character, in |
101 | 101 | # which case it is probably a hyphenated-word) |
102 | - '['.$this->wordchars.']+' . # followed by a string of word-characters |
|
102 | + '[' . $this->wordchars . ']+' . # followed by a string of word-characters |
|
103 | 103 | ')/', $this->query, $all_words); |
104 | 104 | if ($all_words) { |
105 | 105 | $all_words = $all_words[0]; |
@@ -124,8 +124,8 @@ discard block |
||
124 | 124 | if (strpos($word, ':') !== false) { |
125 | 125 | $items = explode(":", strtolower($word)); |
126 | 126 | $type = $items[0]; |
127 | - if (substr($type, 0, 1)=='-') $type = substr($type, 1); |
|
128 | - $value = strtolower(join(":", array_slice($items,1))); |
|
127 | + if (substr($type, 0, 1) == '-') $type = substr($type, 1); |
|
128 | + $value = strtolower(join(":", array_slice($items, 1))); |
|
129 | 129 | if ($type == 'section') { |
130 | 130 | $newv = $value; |
131 | 131 | if ($value == 'debates' || $value == 'debate') $newv = 1; |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | elseif ($value == 'pbc' || $value == 'standing') $newv = 6; |
138 | 138 | elseif ($value == 'sp') $newv = 7; |
139 | 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); |
|
140 | + elseif ($value == 'uk') $newv = array(1, 2, 3, 4, 6, 101); |
|
141 | + elseif ($value == 'scotland') $newv = array(7, 8); |
|
142 | 142 | elseif ($value == 'future') $newv = 'F'; |
143 | 143 | if (is_array($newv)) { |
144 | 144 | $newv = 'major:' . join(' major:', $newv); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $this->query .= " $from..$to"; |
173 | 173 | } elseif ($from) { |
174 | 174 | $this->query = str_ireplace("from:$from", '', $this->query); |
175 | - $this->query .= " $from..".date('Ymd'); |
|
175 | + $this->query .= " $from.." . date('Ymd'); |
|
176 | 176 | } elseif ($to) { |
177 | 177 | $this->query = str_ireplace("to:$to", '', $this->query); |
178 | 178 | $this->query .= " 19990101..$to"; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | |
190 | 190 | twfy_debug("SEARCH", "prefixed: " . var_export($this->prefixed, true)); |
191 | 191 | |
192 | - twfy_debug("SEARCH", "query -- ". $this->query); |
|
192 | + twfy_debug("SEARCH", "query -- " . $this->query); |
|
193 | 193 | $flags = XapianQueryParser::FLAG_BOOLEAN | XapianQueryParser::FLAG_LOVEHATE | |
194 | 194 | XapianQueryParser::FLAG_WILDCARD | XapianQueryParser::FLAG_SPELLING_CORRECTION; |
195 | 195 | $flags = $flags | XapianQueryParser::FLAG_PHRASE; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | foreach ($m[1] as $phrase) { |
221 | 221 | $phrase_new = preg_replace('# PHRASE \d+#', '', $phrase); |
222 | 222 | #$this->phrases[] = preg_split('#\s+#', $phrase_new); |
223 | - $qd = str_replace("($phrase)", '"'.$phrase_new.'"', $qd); |
|
223 | + $qd = str_replace("($phrase)", '"' . $phrase_new . '"', $qd); |
|
224 | 224 | } |
225 | 225 | preg_match_all('#\(([^(]*? NEAR [^(]*?)\)#', $qd, $m); |
226 | 226 | foreach ($m[1] as $mm) { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | // Perform partial query to get a count of number of matches |
354 | - public function run_count($first_result, $results_per_page, $sort_order='relevance') { |
|
354 | + public function run_count($first_result, $results_per_page, $sort_order = 'relevance') { |
|
355 | 355 | if (!defined('XAPIANDB') || !XAPIANDB) |
356 | 356 | return null; |
357 | 357 | |
@@ -424,13 +424,13 @@ discard block |
||
424 | 424 | #} |
425 | 425 | |
426 | 426 | $duration = getmicrotime() - $start; |
427 | - twfy_debug ("SEARCH", "Search count took $duration seconds."); |
|
427 | + twfy_debug("SEARCH", "Search count took $duration seconds."); |
|
428 | 428 | |
429 | 429 | return $count; |
430 | 430 | } |
431 | 431 | |
432 | 432 | // Perform the full search... |
433 | - public function run_search($first_result, $results_per_page, $sort_order='relevance') { |
|
433 | + public function run_search($first_result, $results_per_page, $sort_order = 'relevance') { |
|
434 | 434 | $start = getmicrotime(); |
435 | 435 | |
436 | 436 | #$matches = $this->enquire->get_mset($first_result, $results_per_page); |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | array_push($this->created, join('', unpack('N', $doc->get_value(2)))); # XXX Needs fixing |
452 | 452 | } |
453 | 453 | twfy_debug("SEARCH", "gid: $gid relevancy: $relevancy% weight: $weight"); |
454 | - array_push($this->gids, "uk.org.publicwhip/".$gid); |
|
454 | + array_push($this->gids, "uk.org.publicwhip/" . $gid); |
|
455 | 455 | array_push($this->collapsed, $collapsed); |
456 | 456 | array_push($this->relevances, $relevancy); |
457 | 457 | $iter->next(); |
458 | 458 | } |
459 | 459 | $duration = getmicrotime() - $start; |
460 | - twfy_debug ("SEARCH", "Run search took $duration seconds."); |
|
460 | + twfy_debug("SEARCH", "Run search took $duration seconds."); |
|
461 | 461 | } |
462 | 462 | // ... use these to get the results |
463 | 463 | public function get_gids() { |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | $body = str_replace($this->specialchars, $this->specialchars_upper, $body); |
499 | 499 | $body = mb_convert_encoding($body, "UTF-8", "HTML-ENTITIES"); |
500 | 500 | $body = str_replace($this->specialchars_upper, $this->specialchars, $body); |
501 | - $splitextract = preg_split('/(<[^>]*>|[0-9,.]+|['.$this->wordcharsnodigit.']+)/', $body, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
501 | + $splitextract = preg_split('/(<[^>]*>|[0-9,.]+|[' . $this->wordcharsnodigit . ']+)/', $body, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
502 | 502 | $hlextract = ""; |
503 | 503 | foreach ($splitextract as $extractword) { |
504 | 504 | if (preg_match('/^<[^>]*>$/', $extractword)) { |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | */ |
547 | 547 | |
548 | 548 | foreach ($this->phrases as $phrase) { |
549 | - $phrasematch = join($phrase, '[^'.$this->wordchars.']+'); |
|
549 | + $phrasematch = join($phrase, '[^' . $this->wordchars . ']+'); |
|
550 | 550 | array_push($findwords, "/\b($phrasematch)\b(?!(?>[^<>]*>))/i"); |
551 | 551 | $replacewords[] = "<span class=\"hi\">\\1</span>"; |
552 | 552 | } |
@@ -564,12 +564,12 @@ discard block |
||
564 | 564 | |
565 | 565 | // look for phrases |
566 | 566 | foreach ($this->phrases as $phrase) { |
567 | - $phrasematch = join($phrase, '[^'.$this->wordchars.']+'); |
|
568 | - if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) |
|
567 | + $phrasematch = join($phrase, '[^' . $this->wordchars . ']+'); |
|
568 | + if (preg_match('/([^' . $this->wordchars . ']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches)) |
|
569 | 569 | { |
570 | - $wordpos = strpos( $lcbody, $matches[0] ); |
|
570 | + $wordpos = strpos($lcbody, $matches[0]); |
|
571 | 571 | if ($wordpos) { |
572 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
572 | + if (($wordpos < $pos) || ($pos == -1)) { |
|
573 | 573 | $pos = $wordpos; |
574 | 574 | } |
575 | 575 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | } |
578 | 578 | if ($pos != -1) return $pos; |
579 | 579 | |
580 | - $splitextract = preg_split('/([0-9,.]+|['.$this->wordcharsnodigit.']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
580 | + $splitextract = preg_split('/([0-9,.]+|[' . $this->wordcharsnodigit . ']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
581 | 581 | $stemmed_words = array_map(array($this, 'stem'), $this->words); |
582 | 582 | foreach ($splitextract as $extractword) { |
583 | 583 | $extractword = preg_replace('/&$/', '', $extractword); |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | foreach ($stemmed_words as $word) { |
588 | 588 | if ($word == '') continue; |
589 | 589 | $matchword = $this->stem($extractword); |
590 | - if ($matchword == $word && ($wordpos < $pos || $pos==-1)) { |
|
590 | + if ($matchword == $word && ($wordpos < $pos || $pos == -1)) { |
|
591 | 591 | $pos = $wordpos; |
592 | 592 | } |
593 | 593 | } |
@@ -596,11 +596,11 @@ discard block |
||
596 | 596 | if ($pos != -1) return $pos; |
597 | 597 | |
598 | 598 | foreach ($this->words as $word) { |
599 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
600 | - if (preg_match('/([^'.$this->wordchars.']' . $word . '[^'.$this->wordchars. '])/', $lcbody, $matches)) { |
|
601 | - $wordpos = strpos( $lcbody, $matches[0] ); |
|
599 | + if (ctype_digit($word)) $word = '(?:' . $word . '|' . number_format($word) . ')'; |
|
600 | + if (preg_match('/([^' . $this->wordchars . ']' . $word . '[^' . $this->wordchars . '])/', $lcbody, $matches)) { |
|
601 | + $wordpos = strpos($lcbody, $matches[0]); |
|
602 | 602 | if ($wordpos) { |
603 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
603 | + if (($wordpos < $pos) || ($pos == -1)) { |
|
604 | 604 | $pos = $wordpos; |
605 | 605 | } |
606 | 606 | } |
@@ -610,11 +610,11 @@ discard block |
||
610 | 610 | if ($pos != -1) return $pos; |
611 | 611 | |
612 | 612 | foreach ($this->words as $word) { |
613 | - if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')'; |
|
613 | + if (ctype_digit($word)) $word = '(?:' . $word . '|' . number_format($word) . ')'; |
|
614 | 614 | if (preg_match('/(' . $word . ')/', $lcbody, $matches)) { |
615 | - $wordpos = strpos( $lcbody, $matches[0] ); |
|
615 | + $wordpos = strpos($lcbody, $matches[0]); |
|
616 | 616 | if ($wordpos) { |
617 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
617 | + if (($wordpos < $pos) || ($pos == -1)) { |
|
618 | 618 | $pos = $wordpos; |
619 | 619 | } |
620 | 620 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | */ |
27 | 27 | |
28 | -if (defined('XAPIANDB') AND XAPIANDB != '') { |
|
28 | +if (defined('XAPIANDB') and XAPIANDB != '') { |
|
29 | 29 | if (file_exists('/usr/share/php/xapian.php')) { |
30 | 30 | include_once '/usr/share/php/xapian.php'; |
31 | 31 | } else { |
@@ -275,15 +275,15 @@ discard block |
||
275 | 275 | foreach ($merged as $row) { |
276 | 276 | $from_id = str_replace('uk.org.publicwhip/person/', '', $row['gid_from']); |
277 | 277 | $to_id = str_replace('uk.org.publicwhip/person/', '', $row['gid_to']); |
278 | - $qd = str_replace("(S$from_id OR S$to_id)", "S$to_id", $qd); |
|
279 | - $qd = str_replace("S$from_id OR S$to_id", "S$to_id", $qd); |
|
278 | + $qd = str_replace("(S$from_id OR S$to_id)", "s$to_id", $qd); |
|
279 | + $qd = str_replace("s$from_id OR S$to_id", "s$to_id", $qd); |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | preg_match_all('#S(\d+)#', $qd, $m); |
283 | 283 | foreach ($m[1] as $mm) { |
284 | 284 | $member = new MEMBER(array('person_id' => $mm)); |
285 | 285 | $name = $member->full_name(); |
286 | - $qd = str_replace("S$mm", "speaker:$name", $qd); |
|
286 | + $qd = str_replace("s$mm", "speaker:$name", $qd); |
|
287 | 287 | } |
288 | 288 | |
289 | 289 | # Simplify display of excluded words |
@@ -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 |
@@ -21,20 +21,20 @@ discard block |
||
21 | 21 | */ |
22 | 22 | |
23 | 23 | // This handles basic insertion and approval functions for all epobjects |
24 | -include_once INCLUDESPATH."easyparliament/searchengine.php"; |
|
24 | +include_once INCLUDESPATH . "easyparliament/searchengine.php"; |
|
25 | 25 | |
26 | 26 | class GLOSSARY { |
27 | 27 | |
28 | - public $num_terms; // how many glossary entries do we have |
|
28 | + public $num_terms; // how many glossary entries do we have |
|
29 | 29 | // (changes depending on how GLOSSARY is called |
30 | - public $hansard_count; // how many times does the phrase appear in hansard? |
|
31 | - public $query; // search term |
|
32 | - public $glossary_id; // if this is set then we only have 1 glossary term |
|
33 | - public $current_term; // will only be set if we have a valid epobject_id |
|
30 | + public $hansard_count; // how many times does the phrase appear in hansard? |
|
31 | + public $query; // search term |
|
32 | + public $glossary_id; // if this is set then we only have 1 glossary term |
|
33 | + public $current_term; // will only be set if we have a valid epobject_id |
|
34 | 34 | public $current_letter; |
35 | 35 | |
36 | 36 | // constructor... |
37 | - public function __construct($args=array()) { |
|
37 | + public function __construct($args = array()) { |
|
38 | 38 | // We can optionally start the glossary with one of several arguments |
39 | 39 | // 1. glossary_id - treat the glossary as a single term |
40 | 40 | // 2. glossary_term - search within glossary for a term |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | |
74 | 74 | // These stop stupid submissions. |
75 | 75 | // everything should be lowercase. |
76 | - $this->stopwords = array( "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 | + $this->stopwords = array("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"); |
|
77 | 77 | |
78 | 78 | } |
79 | 79 | |
80 | - public function get_glossary_item($args=array()) { |
|
80 | + public function get_glossary_item($args = array()) { |
|
81 | 81 | // Search for and fetch glossary item with title or glossary_id |
82 | 82 | // We could also search glossary text that contains the title text, for cross references |
83 | 83 | |
84 | 84 | $this->alphabet = array(); |
85 | - foreach (range ("A", "Z") as $letter) { |
|
85 | + foreach (range("A", "Z") as $letter) { |
|
86 | 86 | $this->alphabet[$letter] = array(); |
87 | 87 | } |
88 | 88 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | - public function search_glossary($args=array()) { |
|
141 | + public function search_glossary($args = array()) { |
|
142 | 142 | // Search for and fetch glossary item with a title |
143 | 143 | // Useful for the search page, and nowhere else (so far) |
144 | 144 | |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | global $THEUSER; |
191 | 191 | |
192 | 192 | if ($data['title'] == '') { |
193 | - error ("Sorry, you can't define a term without a title"); |
|
193 | + error("Sorry, you can't define a term without a title"); |
|
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | 197 | if ($data['body'] == '') { |
198 | - error ("You haven't entered a definition!"); |
|
198 | + error("You haven't entered a definition!"); |
|
199 | 199 | return false; |
200 | 200 | } |
201 | 201 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | } |
249 | 249 | } |
250 | 250 | |
251 | - public function glossarise($body, $tokenize=0, $urlize=0) { |
|
251 | + public function glossarise($body, $tokenize = 0, $urlize = 0) { |
|
252 | 252 | // Turn a body of text into a link-up wonderland of glossary joy |
253 | 253 | |
254 | 254 | global $this_page; |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | } |
292 | 292 | else { |
293 | 293 | if ($this_page == "admin_glossary") { |
294 | - $link_url = "#gl".$glossary_id; |
|
294 | + $link_url = "#gl" . $glossary_id; |
|
295 | 295 | } |
296 | 296 | else { |
297 | 297 | $link_url = $URL->generate('url'); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | <p><?= $error ?></p> |
8 | 8 | |
9 | - <?php if ( $rep_search_url ) { ?> |
|
9 | + <?php if ($rep_search_url) { ?> |
|
10 | 10 | </div> |
11 | 11 | |
12 | 12 | <div class="full-page__unit"> |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <?php foreach ($segment['votes']->positions as $key_vote) { |
61 | 61 | |
62 | 62 | if (isset($policy_last_update[$key_vote['policy_id']]) && $policy_last_update[$key_vote['policy_id']] > $most_recent) { |
63 | - $most_recent = $policy_last_update[$key_vote['policy_id']]; |
|
63 | + $most_recent = $policy_last_update[$key_vote['policy_id']]; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | include '_vote_description.php'; |
83 | 83 | |
84 | - } ?> |
|
84 | + } ?> |
|
85 | 85 | </ul> |
86 | 86 | |
87 | 87 | <div class="share-vote-descriptions"> |
@@ -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 |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | <?php if ($has_voting_record): ?> |
44 | 44 | |
45 | - <?php $displayed_votes = FALSE; ?> |
|
45 | + <?php $displayed_votes = false; ?> |
|
46 | 46 | |
47 | 47 | <?php foreach ($key_votes_segments as $segment): ?> |
48 | 48 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | <small>Last updated: <?= format_date($most_recent, LONGDATEFORMAT) ?></small> |
95 | 95 | </div> |
96 | 96 | |
97 | - <?php $displayed_votes = TRUE; ?> |
|
97 | + <?php $displayed_votes = true; ?> |
|
98 | 98 | |
99 | 99 | <?php endif; ?> |
100 | 100 |
@@ -63,7 +63,7 @@ |
||
63 | 63 | $most_recent = $policy_last_update[$key_vote['policy_id']]; |
64 | 64 | } |
65 | 65 | |
66 | - if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) { |
|
66 | + if ($key_vote['has_strong'] || $key_vote['position'] == 'has never voted on') { |
|
67 | 67 | $description = ucfirst($key_vote['desc']); |
68 | 68 | } else { |
69 | 69 | $description = sprintf( |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | if ( isset($divisions) && $divisions ) { |
39 | 39 | if ($has_voting_record) { |
40 | 40 | foreach ($divisions as $division) { |
41 | - $displayed_votes = TRUE; |
|
41 | + $displayed_votes = TRUE; |
|
42 | 42 | |
43 | - if ($current_date != $division['date']) { |
|
43 | + if ($current_date != $division['date']) { |
|
44 | 44 | if ($current_date != '' ) { |
45 | - print('</ul></div>'); |
|
45 | + print('</ul></div>'); |
|
46 | 46 | } |
47 | 47 | $current_date = $division['date']; |
48 | 48 | $sidebar_links[] = $division['date']; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | <h2><?= strftime('%e %b %Y', strtotime($division['date'])) ?></h2> |
52 | 52 | <ul class="vote-descriptions policy-votes"> |
53 | 53 | <?php } |
54 | - include('_division_description.php'); |
|
54 | + include('_division_description.php'); |
|
55 | 55 | } |
56 | 56 | echo('</div>'); |
57 | 57 | } |
@@ -30,15 +30,15 @@ |
||
30 | 30 | |
31 | 31 | <?php |
32 | 32 | |
33 | - $displayed_votes = FALSE; |
|
34 | - $show_all = TRUE; |
|
33 | + $displayed_votes = false; |
|
34 | + $show_all = true; |
|
35 | 35 | $current_date = ''; |
36 | 36 | $sidebar_links = array(); |
37 | 37 | |
38 | 38 | if ( isset($divisions) && $divisions ) { |
39 | 39 | if ($has_voting_record) { |
40 | 40 | foreach ($divisions as $division) { |
41 | - $displayed_votes = TRUE; |
|
41 | + $displayed_votes = true; |
|
42 | 42 | |
43 | 43 | if ($current_date != $division['date']) { |
44 | 44 | if ($current_date != '' ) { |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | $current_date = ''; |
36 | 36 | $sidebar_links = array(); |
37 | 37 | |
38 | - if ( isset($divisions) && $divisions ) { |
|
38 | + if (isset($divisions) && $divisions) { |
|
39 | 39 | if ($has_voting_record) { |
40 | 40 | foreach ($divisions as $division) { |
41 | 41 | $displayed_votes = TRUE; |
42 | 42 | |
43 | 43 | if ($current_date != $division['date']) { |
44 | - if ($current_date != '' ) { |
|
44 | + if ($current_date != '') { |
|
45 | 45 | print('</ul></div>'); |
46 | 46 | } |
47 | 47 | $current_date = $division['date']; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | <div class="sidebar__unit in-page-nav"> |
69 | 69 | <ul data-magellan-expedition="fixed"> |
70 | - <?php foreach($sidebar_links as $date) { ?> |
|
70 | + <?php foreach ($sidebar_links as $date) { ?> |
|
71 | 71 | <li data-magellan-arrival="<?= strftime('%Y-%m-%d', strtotime($date)) ?>"> |
72 | 72 | <a href="#<?= strftime('%Y-%m-%d', strtotime($date)) ?>"> |
73 | 73 | <?= strftime('%e %b %Y', strtotime($date)) ?> |