Passed
Pull Request — master (#1389)
by Struan
32:19
created
www/includes/test/utility_test.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,18 +3,18 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
www/includes/technorati.php 4 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-  /*
2
+    /*
3 3
 
4 4
   mysql> load data infile '/home/stefan/whitelabel.org/wp/convertedtitles' ignore into table titles;
5 5
   */
@@ -24,21 +24,21 @@  discard block
 block discarded – undo
24 24
 }
25 25
 
26 26
 class xItem {
27
-  public $xTitle;
28
-  public $xLink;
29
-  public $xPermalink;
27
+    public $xTitle;
28
+    public $xLink;
29
+    public $xPermalink;
30 30
 }
31 31
 
32 32
 function technorati($url) {
33
-  global $arItems, $itemCount;
33
+    global $arItems, $itemCount;
34 34
 
35 35
 # array of technorati links
36
-  $arItems = array();
36
+    $arItems = array();
37 37
 
38
-  $itemCount = 0;
38
+    $itemCount = 0;
39 39
 
40 40
 # right. now get the technorati links.
41
-  doCosmos($url);
41
+    doCosmos($url);
42 42
 }
43 43
 
44 44
 ## functions/classes bits and pieces  from elsewhere below
@@ -50,16 +50,16 @@  discard block
 block discarded – undo
50 50
 
51 51
 function doCosmos($urlstring) {
52 52
 
53
-  $techRati = "http://api.technorati.com/cosmos?format=xml&url=$urlstring&key=7e64960cc7e9b1cb4315e56a6544fce7" ;
53
+    $techRati = "http://api.technorati.com/cosmos?format=xml&url=$urlstring&key=7e64960cc7e9b1cb4315e56a6544fce7" ;
54 54
 
55
-  /* No caching for now */
55
+    /* No caching for now */
56 56
 #generate cachefilename
57 57
 //  preg_match ("/\d{7}/", $urlstring, $nums) ;
58 58
 
59 59
 //  $cacheFilename= $nums[0];
60 60
 
61
-  // cache for 30 mins only
62
-  //  if (!file_exists("cache/{$cacheFilename}.xml")||  (time() - filemtime("cache/{$cacheFilename}.xml") > 1800)||filesize ("cache/{$cacheFilename}.xml")==0 ) {
61
+    // cache for 30 mins only
62
+    //  if (!file_exists("cache/{$cacheFilename}.xml")||  (time() - filemtime("cache/{$cacheFilename}.xml") > 1800)||filesize ("cache/{$cacheFilename}.xml")==0 ) {
63 63
 
64 64
 #echo "cache miss!";
65 65
 
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
     //    fwrite($cachefp, $contents);
72 72
     //    fclose($cachefp);
73 73
 
74
-  $xml_parser = xml_parser_create();
75
-  xml_set_element_handler($xml_parser, "start1Element", "end1Element");
76
-  xml_set_character_data_handler($xml_parser, "character1Data");
77
-  //character1Data = fopen("cache/$cacheFilename.xml", "r")
78
-  #  $fp = fopen($a, "r")
79
-  #  or die("Error reading XML data.");
80
-  #while ($data = fread($fp, 16384)) {
74
+    $xml_parser = xml_parser_create();
75
+    xml_set_element_handler($xml_parser, "start1Element", "end1Element");
76
+    xml_set_character_data_handler($xml_parser, "character1Data");
77
+    //character1Data = fopen("cache/$cacheFilename.xml", "r")
78
+    #  $fp = fopen($a, "r")
79
+    #  or die("Error reading XML data.");
80
+    #while ($data = fread($fp, 16384)) {
81 81
     // Parse each 4KB chunk with the XML parser created above
82 82
     xml_parse($xml_parser, $contents, TRUE);
83 83
 
@@ -85,52 +85,52 @@  discard block
 block discarded – undo
85 85
 
86 86
 #  }
87 87
 #  fclose($fp);
88
-  xml_parser_free($xml_parser);
88
+    xml_parser_free($xml_parser);
89 89
 
90 90
 #echo "parsing complete";
91 91
 #  global $arItems;
92 92
 #  global $itemCount;
93
-  // write out the items
93
+    // write out the items
94 94
 
95 95
 #echo count($arItems);
96 96
 
97 97
 }
98 98
 
99 99
 function start1Element($parser, $tagName, $attrs) {
100
-  global $curTag;
101
-  $curTag .= "^$tagName";
102
-  // 	echo $counter." ".$curTag."<br> ";
100
+    global $curTag;
101
+    $curTag .= "^$tagName";
102
+    // 	echo $counter." ".$curTag."<br> ";
103 103
 }
104 104
 
105 105
 function end1Element($parser, $tagName) {
106
-  global $curTag;
107
-  $caret_pos = strrpos($curTag,'^');
108
-  $curTag = substr($curTag,0,$caret_pos);
109
-  // 	echo $counter." ".$curTag."<br> ";
106
+    global $curTag;
107
+    $caret_pos = strrpos($curTag,'^');
108
+    $curTag = substr($curTag,0,$caret_pos);
109
+    // 	echo $counter." ".$curTag."<br> ";
110 110
 }
111 111
 
112 112
 function character1Data($parser, $data) {
113
-  global $itemCount, $curTag, $arItems;
114
-  $titleKey = "^TAPI^DOCUMENT^ITEM^WEBLOG^NAME";
115
-  $permalinkKey = "^TAPI^DOCUMENT^ITEM^NEARESTPERMALINK";
116
-  $linkKey = "^TAPI^DOCUMENT^ITEM^WEBLOG^URL";
117
-  $createdKey = "^TAPI^DOCUMENT^ITEM^LINKCREATED";
118
-  if ($curTag == $titleKey) {
113
+    global $itemCount, $curTag, $arItems;
114
+    $titleKey = "^TAPI^DOCUMENT^ITEM^WEBLOG^NAME";
115
+    $permalinkKey = "^TAPI^DOCUMENT^ITEM^NEARESTPERMALINK";
116
+    $linkKey = "^TAPI^DOCUMENT^ITEM^WEBLOG^URL";
117
+    $createdKey = "^TAPI^DOCUMENT^ITEM^LINKCREATED";
118
+    if ($curTag == $titleKey) {
119 119
     // make new xItem
120 120
 
121 121
     $arItems[$itemCount] = new xItem();
122 122
     // set new item object's properties
123 123
     $arItems[$itemCount]->xTitle = $data;
124
-  }
125
-  elseif ($curTag == $permalinkKey) {
124
+    }
125
+    elseif ($curTag == $permalinkKey) {
126 126
     $arItems[$itemCount]->xPermalink = $data;
127 127
     #    $itemCount++;
128
-  }
129
-  elseif ($curTag == $linkKey) {
128
+    }
129
+    elseif ($curTag == $linkKey) {
130 130
     $arItems[$itemCount]->xLink = $data;
131 131
     #$itemCount++;
132
-  } elseif ($curTag == $createdKey) {
133
-      $arItems[$itemCount]->xCreated = $data;
134
-      $itemCount++;
132
+    } elseif ($curTag == $createdKey) {
133
+        $arItems[$itemCount]->xCreated = $data;
134
+        $itemCount++;
135 135
     }
136 136
 }
Please login to merge, or discard this patch.
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
         if ($string == 'minute' && $ago > 59) { $ago /= 60; $string = 'hour'; }
15 15
         if ($string == 'hour' && $ago > 23) { $ago /= 24; $string = 'day'; }
16 16
         if ($string == 'day' && $ago > 13) { $ago /= 7; $string = 'week'; }
17
-        $ago = round($ago); if ($ago != 1) $string .= 's';
17
+        $ago = round($ago); if ($ago != 1) {
18
+            $string .= 's';
19
+        }
18 20
         $body .= '<li><a href="' . $item->xLink . '">' . $item->xTitle . '</a> ('.$ago.' '.$string.' ago)</li>';
19 21
     }
20 22
     if ($body) {
@@ -64,7 +66,9 @@  discard block
 block discarded – undo
64 66
 #echo "cache miss!";
65 67
 
66 68
     $a = file($techRati);
67
-    if (!$a) return false;
69
+    if (!$a) {
70
+        return false;
71
+    }
68 72
     set_time_limit (10);
69 73
     $contents = implode('', $a);
70 74
     //    $cachefp = fopen("cache/{$cacheFilename}.xml", "w");
@@ -121,12 +125,10 @@  discard block
 block discarded – undo
121 125
     $arItems[$itemCount] = new xItem();
122 126
     // set new item object's properties
123 127
     $arItems[$itemCount]->xTitle = $data;
124
-  }
125
-  elseif ($curTag == $permalinkKey) {
128
+  } elseif ($curTag == $permalinkKey) {
126 129
     $arItems[$itemCount]->xPermalink = $data;
127 130
     #    $itemCount++;
128
-  }
129
-  elseif ($curTag == $linkKey) {
131
+  } elseif ($curTag == $linkKey) {
130 132
     $arItems[$itemCount]->xLink = $data;
131 133
     #$itemCount++;
132 134
   } elseif ($curTag == $createdKey) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
   #  or die("Error reading XML data.");
80 80
   #while ($data = fread($fp, 16384)) {
81 81
     // Parse each 4KB chunk with the XML parser created above
82
-    xml_parse($xml_parser, $contents, TRUE);
82
+    xml_parse($xml_parser, $contents, true);
83 83
 
84 84
 #echo "reading...";
85 85
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
         if ($string == 'hour' && $ago > 23) { $ago /= 24; $string = 'day'; }
16 16
         if ($string == 'day' && $ago > 13) { $ago /= 7; $string = 'week'; }
17 17
         $ago = round($ago); if ($ago != 1) $string .= 's';
18
-        $body .= '<li><a href="' . $item->xLink . '">' . $item->xTitle . '</a> ('.$ago.' '.$string.' ago)</li>';
18
+        $body .= '<li><a href="' . $item->xLink . '">' . $item->xTitle . '</a> (' . $ago . ' ' . $string . ' ago)</li>';
19 19
     }
20 20
     if ($body) {
21 21
         $body = "<ul>$body</ul>";
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
 function doCosmos($urlstring) {
52 52
 
53
-  $techRati = "http://api.technorati.com/cosmos?format=xml&url=$urlstring&key=7e64960cc7e9b1cb4315e56a6544fce7" ;
53
+  $techRati = "http://api.technorati.com/cosmos?format=xml&url=$urlstring&key=7e64960cc7e9b1cb4315e56a6544fce7";
54 54
 
55 55
   /* No caching for now */
56 56
 #generate cachefilename
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
     $a = file($techRati);
67 67
     if (!$a) return false;
68
-    set_time_limit (10);
68
+    set_time_limit(10);
69 69
     $contents = implode('', $a);
70 70
     //    $cachefp = fopen("cache/{$cacheFilename}.xml", "w");
71 71
     //    fwrite($cachefp, $contents);
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 
105 105
 function end1Element($parser, $tagName) {
106 106
   global $curTag;
107
-  $caret_pos = strrpos($curTag,'^');
108
-  $curTag = substr($curTag,0,$caret_pos);
107
+  $caret_pos = strrpos($curTag, '^');
108
+  $curTag = substr($curTag, 0, $caret_pos);
109 109
   // 	echo $counter." ".$curTag."<br> ";
110 110
 }
111 111
 
Please login to merge, or discard this patch.
www/includes/easyparliament/init.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -41,7 +41,9 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@
 block discarded – undo
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");
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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");
Please login to merge, or discard this patch.
www/includes/easyparliament/metadata.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
         ),
Please login to merge, or discard this patch.
Spacing   +234 added lines, -234 removed lines patch added patch discarded remove patch
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
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,117 +78,117 @@  discard block
 block discarded – undo
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',
@@ -196,8 +196,8 @@  discard block
 block discarded – undo
196 196
 
197 197
 // Added by Richard Allan for email alert functions
198 198
 
199
-    'alert' => array (
200
-        'menu'			=> array (
199
+    'alert' => array(
200
+        'menu'			=> array(
201 201
             'text'			=> 'Email Alerts',
202 202
             'title'			=> "Set up alerts for updates on an MP or Peer by email",
203 203
             'sidebar'		=> 'alert'
@@ -206,30 +206,30 @@  discard block
 block discarded – undo
206 206
         'title'			=> 'TheyWorkForYou Email Alerts',
207 207
         'url'			=> 'alert/',
208 208
     ),
209
-    'alertwelcome' => array (
209
+    'alertwelcome' => array(
210 210
         'title'			=> 'Email Alerts',
211 211
         'url'			=> 'alert/',
212 212
     ),
213 213
 
214 214
 // End of ALERTS additions
215 215
 
216
-    'api_front'		=> array (
217
-        'menu'			=> array (
216
+    'api_front'		=> array(
217
+        'menu'			=> array(
218 218
             'text'			=> 'API',
219 219
             'title'			=> 'Access our data'
220 220
         ),
221 221
         'title'			=> 'TheyWorkForYou API',
222 222
         'url'			=> 'api/'
223 223
     ),
224
-    'api_doc_front'		=> array (
225
-        'menu'			=> array (
224
+    'api_doc_front'		=> array(
225
+        'menu'			=> array(
226 226
             'text'			=> 'API',
227 227
             'title'			=> 'Access our data'
228 228
         ),
229 229
         'parent'		=> 'api_front',
230 230
         'url'			=> 'api/'
231 231
     ),
232
-    'api_key'		=> array (
232
+    'api_key'		=> array(
233 233
         'title'			=> 'Plan and keys',
234 234
         'parent'		=> 'api_front',
235 235
         'url'			=> 'api/key'
@@ -240,69 +240,69 @@  discard block
 block discarded – undo
240 240
         'url' => 'boundaries/',
241 241
     ),
242 242
 
243
-    'calendar_summary' => array (
244
-        'menu'			=> array (
243
+    'calendar_summary' => array(
244
+        'menu'			=> array(
245 245
             'text'			=> 'Upcoming',
246 246
             'title'			=> '',
247 247
         ),
248 248
         'parent'		=> 'hansard',
249 249
         'url'			=> 'calendar/'
250 250
     ),
251
-    'calendar_future_head' => array (
251
+    'calendar_future_head' => array(
252 252
         'parent'		=> 'calendar_summary',
253 253
         'title'			=> 'Upcoming business',
254 254
         'url'			=> 'calendar/'
255 255
     ),
256
-    'calendar_future' => array (
256
+    'calendar_future' => array(
257 257
         'parent'		=> 'calendar_future_head',
258 258
         'url'			=> 'calendar/'
259 259
     ),
260
-    'calendar_today_head' => array (
260
+    'calendar_today_head' => array(
261 261
         'parent'		=> 'calendar_summary',
262 262
         'title'			=> 'Today&rsquo;s business',
263 263
         'url'			=> 'calendar/'
264 264
     ),
265
-    'calendar_today' => array (
265
+    'calendar_today' => array(
266 266
         'parent'		=> 'calendar_today_head',
267 267
         'url'			=> 'calendar/'
268 268
     ),
269
-    'calendar_past_head' => array (
269
+    'calendar_past_head' => array(
270 270
         'parent'		=> 'calendar_summary',
271 271
         'title'			=> 'Previous business',
272 272
         'url'			=> 'calendar/'
273 273
     ),
274
-    'calendar_past' => array (
274
+    'calendar_past' => array(
275 275
         'parent'		=> 'calendar_past_head',
276 276
         'url'			=> 'calendar/'
277 277
     ),
278 278
 
279
-    'cards' => array (
279
+    'cards' => array(
280 280
         'title'			=> 'MP Stats Cards',
281 281
         'url'			=> 'cards/'
282 282
     ),
283 283
 
284
-    'campaign_foi' => array (
284
+    'campaign_foi' => array(
285 285
         'title'			=> 'Freedom of Information (Parliament) Order 2009',
286 286
         'url'			=> 'foiorder2009/'
287 287
     ),
288
-    'campaign' => array (
288
+    'campaign' => array(
289 289
         'title'			=> '', #Free Our Bills!',
290 290
         'url'			=> 'freeourbills/'
291 291
     ),
292
-    'campaign_edm' => array (
292
+    'campaign_edm' => array(
293 293
         'title'			=> 'Early Day Motion',
294 294
         'parent'		=> 'campaign',
295 295
         'url'			=> 'freeourbills/'
296 296
     ),
297 297
 
298
-    'commentreport' => array (
298
+    'commentreport' => array(
299 299
         'title'			=> 'Reporting a comment',
300 300
         'url'			=> 'report/',
301
-        'session_vars'	=> array ('id')
301
+        'session_vars'	=> array('id')
302 302
     ),
303 303
 
304
-    'comments_recent' => array (
305
-        'menu'			=> array (
304
+    'comments_recent' => array(
305
+        'menu'			=> array(
306 306
             'text'			=> 'Recent comments',
307 307
             'title'			=> "Recently posted comments"
308 308
         ),
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
         'url'			=> 'comments/recent/'
312 312
     ),
313 313
 
314
-    'contact' => array (
315
-        'menu'			=> array (
314
+    'contact' => array(
315
+        'menu'			=> array(
316 316
             'text'			=> 'Contact',
317 317
             'title'			=> '',
318 318
         ),
@@ -323,23 +323,23 @@  discard block
 block discarded – undo
323 323
         'title' => 'News',
324 324
         'url' => 'https://www.mysociety.org/category/projects/theyworkforyou/'
325 325
     ),
326
-    'debate'  => array (
326
+    'debate'  => array(
327 327
         'parent'		=> 'debatesfront',
328 328
         'url'			=> 'debates/',
329
-        'session_vars'	=> array ('id'),
329
+        'session_vars'	=> array('id'),
330 330
     ),
331
-    'debates'  => array (
331
+    'debates'  => array(
332 332
         'parent'		=> 'debatesfront',
333 333
         'url'			=> 'debates/',
334
-        'session_vars'	=> array ('id'),
334
+        'session_vars'	=> array('id'),
335 335
     ),
336
-    'debatesday' => array (
336
+    'debatesday' => array(
337 337
         'parent'		=> 'debatesfront',
338
-        'session_vars'	=> array ('d'),
338
+        'session_vars'	=> array('d'),
339 339
         'url'			=> 'debates/',
340 340
     ),
341
-    'alldebatesfront' => array (
342
-        'menu'			=> array (
341
+    'alldebatesfront' => array(
342
+        'menu'			=> array(
343 343
             'text'			=> 'Debates',
344 344
             'title'			=> "Debates in the House of Commons, Westminster Hall, and the House of Lords"
345 345
         ),
@@ -348,8 +348,8 @@  discard block
 block discarded – undo
348 348
         'rss'			=> 'rss/debates.rss',
349 349
         'url'			=> 'debates/'
350 350
     ),
351
-    'debatesfront' => array (
352
-        'menu'			=> array (
351
+    'debatesfront' => array(
352
+        'menu'			=> array(
353 353
             'text'			=> 'Commons debates',
354 354
             'title'			=> "Debates in the House of Commons"
355 355
         ),
@@ -358,12 +358,12 @@  discard block
 block discarded – undo
358 358
         'rss'			=> 'rss/debates.rss',
359 359
         'url'			=> 'debates/'
360 360
     ),
361
-    'debatesyear' => array (
361
+    'debatesyear' => array(
362 362
         'parent'		=> 'debatesfront',
363 363
         'url'			=> 'debates/'
364 364
     ),
365
-    'divisions_recent' => array (
366
-        'menu'			=> array (
365
+    'divisions_recent' => array(
366
+        'menu'			=> array(
367 367
             'text'			=> 'Recent Votes',
368 368
             'title'			=> ''
369 369
         ),
@@ -371,12 +371,12 @@  discard block
 block discarded – undo
371 371
         'title'			=> 'Recent Votes',
372 372
         'url'			=> 'divisions/'
373 373
     ),
374
-    'divisions_vote' => array (
374
+    'divisions_vote' => array(
375 375
         'parent'		=> 'divisions_recent',
376 376
         'title'			=> 'Vote',
377 377
         'url'			=> 'divisions/division.php'
378 378
     ),
379
-    'epvote' => array (
379
+    'epvote' => array(
380 380
         'url'			=> 'vote/'
381 381
     ),
382 382
 
@@ -385,19 +385,19 @@  discard block
 block discarded – undo
385 385
         'title'			=> 'TheyWorkForYou Google gadget',
386 386
     ),
387 387
 
388
-    'glossary' => array (
388
+    'glossary' => array(
389 389
         'heading'		=> 'Glossary',
390 390
         'parent'		=> 'help_us_out',
391 391
         'url'			=> 'glossary/'
392 392
     ),
393
-    'glossary_item' => array (
393
+    'glossary_item' => array(
394 394
         'heading'		=> 'Glossary heading',
395 395
         'parent'		=> 'help_us_out',
396 396
         'url'			=> 'glossary/',
397
-        'session_vars'	=> array ('g')
397
+        'session_vars'	=> array('g')
398 398
     ),
399
-    'hansard' => array (
400
-        'menu'			=> array (
399
+    'hansard' => array(
400
+        'menu'			=> array(
401 401
             'text'			=> 'UK Parliament',
402 402
             'title'			=> "Houses of Parliament debates, Written Answers, Statements, Westminster Hall debates, and Bill Committees"
403 403
         ),
@@ -405,16 +405,16 @@  discard block
 block discarded – undo
405 405
         'url'			=> ''
406 406
     ),
407 407
         // Hansard landing page
408
-        'hansard_landing' => array (
408
+        'hansard_landing' => array(
409 409
                 'title'                 => 'Hansard',
410 410
                 'url'                   => 'search-hansard/',
411 411
         ),
412
-    'help' => array (
412
+    'help' => array(
413 413
         'title'			=> 'Help - Frequently Asked Questions',
414 414
         'url'			=> 'help/'
415 415
     ),
416
-    'help_us_out' => array (
417
-        'menu'			=> array (
416
+    'help_us_out' => array(
417
+        'menu'			=> array(
418 418
             'text'			=> 'Glossary',
419 419
             'title'			=> "Parliament's jargon explained"
420 420
         ),
@@ -423,88 +423,88 @@  discard block
 block discarded – undo
423 423
         'url'			=> 'addterm/',
424 424
         'sidebar'		=> 'glossary_add'
425 425
     ),
426
-    'home' => array (
426
+    'home' => array(
427 427
         'title'			=> "UK Parliament",
428 428
         'rss'			=> 'news/index.rdf',
429 429
         'url'			=> ''
430 430
     ),
431
-    'houserules' => array (
431
+    'houserules' => array(
432 432
         'title'			=> 'House rules',
433 433
         'url'			=> 'houserules/'
434 434
     ),
435 435
 
436
-    'linktous' => array (
436
+    'linktous' => array(
437 437
         'title'			=> 'Link to us',
438 438
         'heading'		=> 'How to link to us',
439 439
         'url'			=> 'help/linktous/'
440 440
     ),
441
-    'api' => array (
441
+    'api' => array(
442 442
         'title'			=> 'API',
443 443
         'heading'		=> 'API - Query the TheyWorkForYou database',
444 444
         'url'			=> 'api/'
445 445
     ),
446
-    'data' => array (
446
+    'data' => array(
447 447
         'title'			=> 'Raw Data',
448 448
         'heading'		=> 'Raw data (XML) - the data behind TheyWorkForYou and Public Whip',
449 449
         'url'			=> 'http://parser.theyworkforyou.com'
450 450
     ),
451
-    'pombola' => array (
451
+    'pombola' => array(
452 452
         'title'			=> 'Pombola',
453 453
         'heading'		=> 'mySociety\'s platform for running a Parliamentary monitoring site like this',
454 454
         'url'			=> 'https://www.mysociety.org/projects/parliamentarymonitoring/pombola'
455 455
     ),
456
-    'devmailinglist' => array (
456
+    'devmailinglist' => array(
457 457
         'title'			=> 'Developer mailing list',
458 458
         'heading'		=> 'Developer mailing list',
459 459
         'url'			=> 'https://groups.google.com/a/mysociety.org/forum/#!forum/theyworkforyou'
460 460
     ),
461
-    'code' => array (
461
+    'code' => array(
462 462
         'title'			=> 'Source code',
463 463
         'heading'		=> 'TheyWorkForYou Source code',
464 464
         'url'			=> 'https://github.com/mysociety/theyworkforyou'
465 465
     ),
466
-    'irc' => array (
466
+    'irc' => array(
467 467
         'title'			=> 'IRC chat channel',
468 468
         'heading'		=> 'IRC chat channel',
469 469
         'url'			=> 'http://www.irc.mysociety.org/'
470 470
     ),
471
-    'newzealand' => array (
471
+    'newzealand' => array(
472 472
         'title'			=> 'New Zealand',
473 473
         'heading'		=> 'They Work For You - New Zealand',
474 474
         'url'			=> 'http://www.theyworkforyou.co.nz/'
475 475
     ),
476
-    'australia' => array (
476
+    'australia' => array(
477 477
         'title'			=> 'Australia',
478 478
         'heading'		=> 'Open Australia',
479 479
         'url'			=> 'http://www.openaustralia.org/'
480 480
     ),
481
-    'ireland' => array (
481
+    'ireland' => array(
482 482
         'title'			=> 'Ireland',
483 483
         'heading'		=> 'TheyWorkForYou for the Houses of the Oireachtas',
484 484
         'url'			=> 'http://www.kildarestreet.com/'
485 485
     ),
486
-    'mzalendo' => array (
486
+    'mzalendo' => array(
487 487
         'title'			=> 'Mzalendo',
488 488
         'heading'		=> 'Keeping an eye on the Kenyan Parliament',
489 489
         'url'			=> 'http://info.mzalendo.com/'
490 490
     ),
491
-    'lordsdebate'  => array (
491
+    'lordsdebate'  => array(
492 492
         'parent'		=> 'lordsdebatesfront',
493 493
         'url'			=> 'lords/',
494
-        'session_vars'	=> array ('id'),
494
+        'session_vars'	=> array('id'),
495 495
     ),
496
-    'lordsdebates'  => array (
496
+    'lordsdebates'  => array(
497 497
         'parent'		=> 'lordsdebatesfront',
498 498
         'url'			=> 'lords/',
499
-        'session_vars'	=> array ('id'),
499
+        'session_vars'	=> array('id'),
500 500
     ),
501
-    'lordsdebatesday' => array (
501
+    'lordsdebatesday' => array(
502 502
         'parent'		=> 'lordsdebatesfront',
503
-        'session_vars'	=> array ('d'),
503
+        'session_vars'	=> array('d'),
504 504
         'url'			=> 'lords/',
505 505
     ),
506
-    'lordsdebatesfront' => array (
507
-        'menu'			=> array (
506
+    'lordsdebatesfront' => array(
507
+        'menu'			=> array(
508 508
             'text'			=> 'Lords debates',
509 509
             'title'			=> "House of Lords debates"
510 510
         ),
@@ -513,24 +513,24 @@  discard block
 block discarded – undo
513 513
         'rss'			=> 'rss/lords.rss',
514 514
         'url'			=> 'lords/'
515 515
     ),
516
-    'lordsdebatesyear' => array (
516
+    'lordsdebatesyear' => array(
517 517
         'parent'		=> 'lordsdebatesfront',
518 518
         'url'			=> 'lords/'
519 519
     ),
520 520
 
521 521
         // Parliament landing page
522
-        'parliament_landing' => array (
522
+        'parliament_landing' => array(
523 523
                 'title'                 => 'Parliament',
524 524
                 'url'                   => 'parliament/',
525 525
         ),
526 526
 
527
-    'peer' => array (
527
+    'peer' => array(
528 528
         'parent'		=> 'peers',
529 529
         'title'			=> 'Peer',
530 530
         'url'			=> 'peer/'
531 531
     ),
532
-    'peers' => array (
533
-         'menu'			=> array (
532
+    'peers' => array(
533
+         'menu'			=> array(
534 534
             'text'			=> 'Lords',
535 535
             'title'			=> "List of all Lords"
536 536
         ),
@@ -538,8 +538,8 @@  discard block
 block discarded – undo
538 538
         'title'			=> '',
539 539
         'url'			=> 'peers/'
540 540
     ),
541
-'overview' => array (
542
-     'menu'			=> array (
541
+'overview' => array(
542
+     'menu'			=> array(
543 543
         'text'			=> 'Overview',
544 544
         'title'			=> "Overview of the UK Parliament"
545 545
     ),
@@ -548,50 +548,50 @@  discard block
 block discarded – undo
548 548
     'rss'			=> 'news/index.rdf',
549 549
     'url'			=> ''
550 550
 ),
551
-    'mla' => array (
551
+    'mla' => array(
552 552
         'parent'		=> 'mlas',
553 553
         'title'			=> 'Find your MLA',
554 554
         'url'			=> 'mla/'
555 555
     ),
556
-    'mlas' => array (
556
+    'mlas' => array(
557 557
         'parent'		=> 'ni_home',
558
-        'menu'			=> array (
558
+        'menu'			=> array(
559 559
             'text'			=> 'MLAs',
560 560
             'title'			=> "List of all Members of the Northern Ireland Assembly (MLAs)"
561 561
         ),
562 562
         'title'			=> '',
563 563
         'url'			=> 'mlas/'
564 564
     ),
565
-    'msps' => array (
565
+    'msps' => array(
566 566
         'parent'		=> 'sp_home',
567
-        'menu'			=> array (
567
+        'menu'			=> array(
568 568
             'text'			=> 'MSPs',
569 569
             'title'			=> "List of Members of the Scottish Parliament (MSPs)"
570 570
         ),
571 571
         'title'			=> '',
572 572
         'url'			=> 'msps/'
573 573
     ),
574
-    'msp' => array (
574
+    'msp' => array(
575 575
         'parent'		=> 'msps',
576 576
         'title'			=> 'Find your MSP',
577 577
         'url'			=> 'msp/'
578 578
     ),
579 579
     /* Not 'Your MP', whose name is 'yourmp'... */
580
-    'mp' => array (
580
+    'mp' => array(
581 581
         'parent'			=> 'mps',
582 582
         'title'			=> 'Find your MP',
583 583
         'url'			=> 'mp/'
584 584
     ),
585
-    'emailfriend' => array (
585
+    'emailfriend' => array(
586 586
         'title'			=> 'Send this page to a friend',
587 587
         'url'			=> 'email/'
588 588
     ),
589 589
     // The directory MPs' RSS feeds are stored in.
590
-    'mp_rss' => array (
590
+    'mp_rss' => array(
591 591
         'url'			=> 'rss/mp/'
592 592
     ),
593
-    'mps' => array (
594
-         'menu'			=> array (
593
+    'mps' => array(
594
+         'menu'			=> array(
595 595
             'text'			=> 'MPs',
596 596
             'title'			=> "List of all Members of Parliament (MPs)"
597 597
         ),
@@ -602,16 +602,16 @@  discard block
 block discarded – undo
602 602
 
603 603
     /* Northern Ireland Assembly */
604 604
     'ni_home' => array(
605
-        'menu'			=> array (
605
+        'menu'			=> array(
606 606
             'text'			=> 'Northern Ireland Assembly',
607 607
             'title'			=> 'Full authority over <em>transferred matters</em>, which include agriculture, education, employment, the environment and health'
608 608
         ),
609 609
         'title'			=> 'Northern Ireland Assembly',
610 610
         'url'			=> 'ni/'
611 611
     ),
612
-    'nioverview' => array (
612
+    'nioverview' => array(
613 613
         'parent'		=> 'ni_home',
614
-        'menu'			=> array (
614
+        'menu'			=> array(
615 615
             'text'			=> 'Debates',
616 616
             'title'			=> "Overview of the Northern Ireland Assembly debates"
617 617
         ),
@@ -619,23 +619,23 @@  discard block
 block discarded – undo
619 619
         'rss'			=> 'rss/ni.rss',
620 620
         'url'			=> 'ni/'
621 621
     ),
622
-    'nidebate'  => array (
622
+    'nidebate'  => array(
623 623
         'parent'		=> 'nidebatesfront',
624 624
         'url'			=> 'ni/',
625
-        'session_vars'	=> array ('id'),
625
+        'session_vars'	=> array('id'),
626 626
     ),
627
-    'nidebates'  => array (
627
+    'nidebates'  => array(
628 628
         'parent'		=> 'nidebatesfront',
629 629
         'url'			=> 'ni/',
630
-        'session_vars'	=> array ('id'),
630
+        'session_vars'	=> array('id'),
631 631
     ),
632
-    'nidebatesday' => array (
632
+    'nidebatesday' => array(
633 633
         'parent'		=> 'nidebatesfront',
634
-        'session_vars'	=> array ('d'),
634
+        'session_vars'	=> array('d'),
635 635
         'url'			=> 'ni/',
636 636
     ),
637
-    'nidebatesfront' => array (
638
-        'menu'			=> array (
637
+    'nidebatesfront' => array(
638
+        'menu'			=> array(
639 639
             'text'			=> 'Debates',
640 640
             'title'			=> "Northern Ireland Assembly debates"
641 641
         ),
@@ -644,24 +644,24 @@  discard block
 block discarded – undo
644 644
         'rss'			=> 'rss/ni.rss',
645 645
         'url'			=> 'ni/'
646 646
     ),
647
-    'nidebatesyear' => array (
647
+    'nidebatesyear' => array(
648 648
         'parent'		=> 'nidebatesfront',
649 649
         'url'			=> 'ni/'
650 650
     ),
651 651
 
652
-    'otheruseredit' => array (
652
+    'otheruseredit' => array(
653 653
         'pg'			=> 'editother',
654 654
         'title'			=> "Editing a user's data",
655 655
         'url'			=> 'user/'
656 656
     ),
657
-    'privacy' => array (
657
+    'privacy' => array(
658 658
         'title'			=> 'Privacy Policy',
659 659
         'url'			=> 'privacy/'
660 660
     ),
661 661
 
662 662
     /* Public bill committees */
663
-    'pbc_front' => array (
664
-        'menu'			=> array (
663
+    'pbc_front' => array(
664
+        'menu'			=> array(
665 665
             'text'			=> 'Bill Committees',
666 666
             'title'			=> "Public Bill Committees (formerly Standing Committees) debates"
667 667
         ),
@@ -679,17 +679,17 @@  discard block
 block discarded – undo
679 679
         'title' => '',
680 680
         'url' => 'pbc/',
681 681
         'parent' => 'pbc_front',
682
-        'session_vars'	=> array ('bill'),
682
+        'session_vars'	=> array('bill'),
683 683
     ),
684 684
     'pbc_clause' => array(
685 685
         'parent'		=> 'pbc_front',
686 686
         'url'			=> 'pbc/',
687
-        'session_vars'	=> array ('id'),
687
+        'session_vars'	=> array('id'),
688 688
     ),
689 689
     'pbc_speech' => array(
690 690
         'parent'		=> 'pbc_front',
691 691
         'url'			=> 'pbc/',
692
-        'session_vars'	=> array ('id'),
692
+        'session_vars'	=> array('id'),
693 693
     ),
694 694
 
695 695
     'people' => array(
@@ -701,62 +701,62 @@  discard block
 block discarded – undo
701 701
         'url'			=> '',
702 702
     ),
703 703
 
704
-    'raw' => array (
704
+    'raw' => array(
705 705
         'title'			=> 'Raw data',
706 706
         'url'			=> 'raw/'
707 707
     ),
708 708
 
709
-    'regmem' => array (
709
+    'regmem' => array(
710 710
         'title'			=> 'Changes to the Register of Members\' Interests',
711 711
         'url'			=> 'regmem/'
712 712
     ),
713 713
 
714
-    'regmem_date' => array (
714
+    'regmem_date' => array(
715 715
         'url'			=> 'regmem/',
716 716
         'parent'		=> 'regmem'
717 717
     ),
718 718
 
719
-    'regmem_mp' => array (
719
+    'regmem_mp' => array(
720 720
         'url'			=> 'regmem/',
721 721
         'parent'		=> 'regmem'
722 722
     ),
723 723
 
724
-    'regmem_diff' => array (
724
+    'regmem_diff' => array(
725 725
         'url'			=> 'regmem/',
726 726
         'parent'		=> 'regmem'
727 727
     ),
728 728
 
729
-    'royal' => array (
729
+    'royal' => array(
730 730
         'parent'        => 'hansard',
731 731
         'title'         => 'Royal',
732 732
         'url'           => 'royal/',
733 733
     ),
734 734
 
735
-    'topic' => array (
735
+    'topic' => array(
736 736
         'parent'        => 'topics',
737 737
         'url'           => 'topic/topic.php',
738 738
     ),
739 739
 
740
-    'topics' => array (
740
+    'topics' => array(
741 741
         'title'        => 'Topics',
742 742
         'url'          => 'topic/',
743 743
     ),
744 744
 
745
-    'search'		=> array (
745
+    'search'		=> array(
746 746
         'sidebar'		=> 'search',
747 747
         'url'			=> 'search/',
748 748
         'robots'		=> 'noindex, nofollow',
749 749
         'heading'		=> '',
750
-        'session_vars'	=> array ('q', 's', 'pid', 'o', 'pop')
750
+        'session_vars'	=> array('q', 's', 'pid', 'o', 'pop')
751 751
     ),
752
-    'search_help'		=> array (
752
+    'search_help'		=> array(
753 753
         'sidebar'		=> 'search',
754 754
         'title'			=> 'Help with searching',
755 755
         'url'			=> 'search/'
756 756
     ),
757 757
 
758
-    'sitenews'		=> array (
759
-        'menu'			=> array (
758
+    'sitenews'		=> array(
759
+        'menu'			=> array(
760 760
             'text'			=> 'TheyWorkForYou news',
761 761
             'title'			=> "News about changes to this website"
762 762
         ),
@@ -766,68 +766,68 @@  discard block
 block discarded – undo
766 766
         'title'			=> 'TheyWorkForYou news',
767 767
         'url'			=> 'news/'
768 768
     ),
769
-    'sitenews_archive'		=> array (
769
+    'sitenews_archive'		=> array(
770 770
         'parent'		=> 'sitenews',
771 771
         'rss'			=> 'news/index.rdf',
772 772
         'sidebar'		=> 'sitenews',
773 773
         'title'			=> 'Archive',
774 774
         'url'			=> 'news/archives/'
775 775
     ),
776
-    'sitenews_atom' 	=> array (
776
+    'sitenews_atom' 	=> array(
777 777
         'url'			=> 'news/atom.xml'
778 778
     ),
779
-    'sitenews_date'	=> array (
779
+    'sitenews_date'	=> array(
780 780
         'parent'		=> 'sitenews',
781 781
         'rss'			=> 'news/index.rdf',
782 782
         'sidebar'		=> 'sitenews'
783 783
     ),
784
-    'sitenews_individual'	=> array (
784
+    'sitenews_individual'	=> array(
785 785
         'parent'		=> 'sitenews',
786 786
         'rss'			=> 'news/index.rdf',
787 787
         'sidebar'		=> 'sitenews',
788 788
     ),
789
-    'sitenews_rss1' 	=> array (
789
+    'sitenews_rss1' 	=> array(
790 790
         'url'			=> 'news/index.rdf'
791 791
     ),
792
-    'sitenews_rss2' 	=> array (
792
+    'sitenews_rss2' 	=> array(
793 793
         'url'			=> 'news/index.xml'
794 794
     ),
795 795
 
796 796
     /* Scottish Parliament */
797 797
     'sp_home' => array(
798
-        'menu'			=> array (
798
+        'menu'			=> array(
799 799
             'text'			=> 'Scottish Parliament',
800 800
             'title'			=> 'Scottish education, health, agriculture, justice, prisons and other devolved areas. Some tax-varying powers'
801 801
         ),
802 802
         'title'			=> 'Scottish Parliament',
803 803
         'url'			=> 'scotland/'
804 804
     ),
805
-    'spoverview' => array (
805
+    'spoverview' => array(
806 806
         'parent'		=> 'sp_home',
807
-        'menu'			=> array (
807
+        'menu'			=> array(
808 808
             'text'			=> 'Overview',
809 809
             'title'			=> "Overview of the Scottish Parliament"
810 810
         ),
811 811
         'title'			=> '',
812 812
         'url'			=> 'scotland/'
813 813
     ),
814
-    'spdebate'  => array (
814
+    'spdebate'  => array(
815 815
         'parent'		=> 'spdebatesfront',
816 816
         'url'			=> 'sp/',
817
-        'session_vars'	=> array ('id'),
817
+        'session_vars'	=> array('id'),
818 818
     ),
819
-    'spdebates'  => array (
819
+    'spdebates'  => array(
820 820
         'parent'		=> 'spdebatesfront',
821 821
         'url'			=> 'sp/',
822
-        'session_vars'	=> array ('id'),
822
+        'session_vars'	=> array('id'),
823 823
     ),
824
-    'spdebatesday' => array (
824
+    'spdebatesday' => array(
825 825
         'parent'		=> 'spdebatesfront',
826
-        'session_vars'	=> array ('d'),
826
+        'session_vars'	=> array('d'),
827 827
         'url'			=> 'sp/',
828 828
     ),
829
-    'spdebatesfront' => array (
830
-        'menu'			=> array (
829
+    'spdebatesfront' => array(
830
+        'menu'			=> array(
831 831
             'text'			=> 'Debates',
832 832
             'title'			=> ''
833 833
         ),
@@ -836,21 +836,21 @@  discard block
 block discarded – undo
836 836
         'url'			=> 'sp/'
837 837
     ),
838 838
 
839
-    'spdebatesyear' => array (
839
+    'spdebatesyear' => array(
840 840
         'parent'		=> 'spdebatesfront',
841 841
         'url'			=> 'sp/'
842 842
     ),
843
-    'spwrans'  => array (
843
+    'spwrans'  => array(
844 844
         'parent'		=> 'spwransfront',
845 845
         'url'			=> 'spwrans/',
846 846
         #'session_vars'	=> array ('id'),
847 847
     ),
848
-    'spwransday'  => array (
848
+    'spwransday'  => array(
849 849
         'parent'		=> 'spwransfront',
850 850
         'url'			=> 'spwrans/'
851 851
     ),
852
-    'spwransfront'  => array (
853
-        'menu'			=> array (
852
+    'spwransfront'  => array(
853
+        'menu'			=> array(
854 854
             'text'			=> 'Written Answers',
855 855
             'title'			=> ''
856 856
         ),
@@ -863,31 +863,31 @@  discard block
 block discarded – undo
863 863
         'title'			=> 'For questions asked by ',
864 864
         'url'			=> 'spwrans/'
865 865
     ),
866
-    'spwransyear' => array (
866
+    'spwransyear' => array(
867 867
         'parent'		=> 'spwransfront',
868 868
         'url'			=> 'spwrans/'
869 869
     ),
870 870
 
871 871
     // Topic pages
872 872
 
873
-    'topic' => array (
873
+    'topic' => array(
874 874
         'url'           => 'topic/',
875 875
         'title'         => 'Topics'
876 876
     ),
877 877
 
878
-    'topicbenefits' => array (
878
+    'topicbenefits' => array(
879 879
         'url'           => 'topic/benefits',
880 880
         'parent'        => 'topic',
881 881
         'title'         => 'Benefits'
882 882
     ),
883 883
 
884
-    'topiccrimestats' => array (
884
+    'topiccrimestats' => array(
885 885
         'url'           => 'topic/crime-stats',
886 886
         'parent'        => 'topic',
887 887
         'title'         => 'Crime Statistics'
888 888
     ),
889 889
 
890
-    'topicnhs' => array (
890
+    'topicnhs' => array(
891 891
         'url'           => 'topic/nhs',
892 892
         'parent'        => 'topic',
893 893
         'title'         => 'NHS'
@@ -902,29 +902,29 @@  discard block
 block discarded – undo
902 902
         'url'			=> 'user/alerts/',
903 903
         'parent'		=> 'userviewself'
904 904
     ),
905
-    'userchangepc' => array (
905
+    'userchangepc' => array(
906 906
         'title'			=> 'Change your postcode',
907 907
         'url'			=> 'user/changepc/'
908 908
     ),
909
-    'userconfirm' => array (
909
+    'userconfirm' => array(
910 910
         'url'			=> 'user/confirm/'
911 911
     ),
912
-    'userconfirmed' => array (
912
+    'userconfirmed' => array(
913 913
         'sidebar'		=> 'userconfirmed',
914 914
         'title'			=> 'Welcome to TheyWorkForYou!',
915 915
         'url'			=> 'user/confirm/'
916 916
     ),
917
-    'userconfirmfailed' => array (
917
+    'userconfirmfailed' => array(
918 918
         'title'			=> 'Oops!',
919 919
         'url'			=> 'user/confirm/'
920 920
     ),
921
-    'useredit' => array (
921
+    'useredit' => array(
922 922
         'pg'			=> 'edit',
923 923
         'title'			=> 'Edit your details',
924 924
         'url'			=> 'user/'
925 925
     ),
926
-    'userjoin' => array (
927
-                'menu'                  => array (
926
+    'userjoin' => array(
927
+                'menu'                  => array(
928 928
                         'text'                  => 'Join',
929 929
                         'title'                 => "Joining is free and allows you to annotate speeches"
930 930
                 ),
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
933 933
                 'title'                 => 'Join TheyWorkForYou',
934 934
                 'url'                   => 'user/'
935 935
         ),
936
-    'getinvolved' => array (
937
-        'menu'			=> array (
936
+    'getinvolved' => array(
937
+        'menu'			=> array(
938 938
             'text'			=> 'Get involved',
939 939
             'title'			=> "Contribute to TheyWorkForYou"
940 940
         ),
@@ -943,8 +943,8 @@  discard block
 block discarded – undo
943 943
         'title'			=> 'Contribute to TheyWorkForYou',
944 944
         'url'			=> 'getinvolved/'
945 945
     ),
946
-    'userlogin' => array (
947
-        'menu'			=> array (
946
+    'userlogin' => array(
947
+        'menu'			=> array(
948 948
             'text'			=> 'Sign in',
949 949
             'title'			=> "If you've already joined , sign in to add annotations"
950 950
         ),
@@ -953,33 +953,33 @@  discard block
 block discarded – undo
953 953
         'url'			=> 'user/login/'
954 954
     ),
955 955
 
956
-    'userlogout' => array (
957
-        'menu'			=> array (
956
+    'userlogout' => array(
957
+        'menu'			=> array(
958 958
             'text'			=> 'Sign out',
959 959
             'title'			=> "Sign out"
960 960
         ),
961 961
         'url'			=> 'user/logout/'
962 962
     ),
963
-    'userpassword' => array (
963
+    'userpassword' => array(
964 964
         'title'			=> 'Change password',
965 965
         'url'			=> 'user/password/'
966 966
     ),
967
-    'userprompt' => array (
967
+    'userprompt' => array(
968 968
         'title'			=> 'Please sign in',
969 969
         'url'			=> 'user/prompt/'
970 970
     ),
971
-    'userview' => array (
971
+    'userview' => array(
972 972
         'session_vars'	=> array('u'),
973 973
         'url'			=> 'user/'
974 974
     ),
975
-    'userviewself' => array (
976
-        'menu'			=> array (
975
+    'userviewself' => array(
976
+        'menu'			=> array(
977 977
             'text'			=> 'Your details',
978 978
             'title'			=> "View and edit your details"
979 979
         ),
980 980
         'url'			=> 'user/'
981 981
     ),
982
-    'userwelcome' => array (
982
+    'userwelcome' => array(
983 983
         'title'			=> 'Welcome!',
984 984
         'url'			=> 'user/'
985 985
     ),
@@ -1007,23 +1007,23 @@  discard block
 block discarded – undo
1007 1007
     ),
1008 1008
 
1009 1009
     /* Westminster Hall */
1010
-    'whall'  => array (
1010
+    'whall'  => array(
1011 1011
         'parent'		=> 'whallfront',
1012 1012
         'url'			=> 'whall/',
1013
-        'session_vars'	=> array ('id'),
1013
+        'session_vars'	=> array('id'),
1014 1014
     ),
1015
-    'whalls'  => array (
1015
+    'whalls'  => array(
1016 1016
         'parent'		=> 'whallfront',
1017 1017
         'url'			=> 'whall/',
1018
-        'session_vars'	=> array ('id'),
1018
+        'session_vars'	=> array('id'),
1019 1019
     ),
1020
-    'whallday' => array (
1020
+    'whallday' => array(
1021 1021
         'parent'		=> 'whallfront',
1022
-        'session_vars'	=> array ('d'),
1022
+        'session_vars'	=> array('d'),
1023 1023
         'url'			=> 'whall/',
1024 1024
     ),
1025
-    'whallfront' => array (
1026
-        'menu'			=> array (
1025
+    'whallfront' => array(
1026
+        'menu'			=> array(
1027 1027
             'text'			=> 'Westminster Hall',
1028 1028
             'title'			=> "Westminster Hall debates"
1029 1029
         ),
@@ -1032,23 +1032,23 @@  discard block
 block discarded – undo
1032 1032
         'rss'			=> 'rss/whall.rss',
1033 1033
         'url'			=> 'whall/'
1034 1034
     ),
1035
-    'whallyear' => array (
1035
+    'whallyear' => array(
1036 1036
         'parent'		=> 'whallfront',
1037 1037
         'url'			=> 'whall/'
1038 1038
     ),
1039 1039
 
1040
-    'wms' => array (
1040
+    'wms' => array(
1041 1041
         'parent'		=> 'wranswmsfront',
1042 1042
         'url'			=> 'wms/',
1043 1043
         'session_vars'	=> array('id')
1044 1044
     ),
1045
-    'wmsday' => array (
1045
+    'wmsday' => array(
1046 1046
         'parent'		=> 'wmsfront',
1047 1047
         'session_vars'	=> array('d'),
1048 1048
         'url'			=> 'wms/'
1049 1049
     ),
1050
-    'wmsfront' => array (
1051
-        'menu'			=> array (
1050
+    'wmsfront' => array(
1051
+        'menu'			=> array(
1052 1052
             'text'			=> 'Written Ministerial Statements',
1053 1053
             'title'			=> ''
1054 1054
         ),
@@ -1057,22 +1057,22 @@  discard block
 block discarded – undo
1057 1057
         'rss'			=> 'rss/wms.rss',
1058 1058
         'url'			=> 'wms/'
1059 1059
     ),
1060
-    'wmsyear' => array (
1060
+    'wmsyear' => array(
1061 1061
         'parent'		=> 'wmsfront',
1062 1062
         'url'			=> 'wms/'
1063 1063
     ),
1064 1064
 
1065
-    'wrans'  => array (
1065
+    'wrans'  => array(
1066 1066
         'parent'		=> 'wranswmsfront',
1067 1067
         'url'			=> 'wrans/',
1068
-        'session_vars'	=> array ('id')
1068
+        'session_vars'	=> array('id')
1069 1069
     ),
1070
-    'wransday'  => array (
1070
+    'wransday'  => array(
1071 1071
         'parent'		=> 'wransfront',
1072 1072
         'url'			=> 'wrans/'
1073 1073
     ),
1074
-    'wransfront'  => array (
1075
-        'menu'			=> array (
1074
+    'wransfront'  => array(
1075
+        'menu'			=> array(
1076 1076
             'text'			=> 'Written Answers',
1077 1077
             'title'			=> "Written Answers"
1078 1078
         ),
@@ -1085,13 +1085,13 @@  discard block
 block discarded – undo
1085 1085
         'title'			=> 'For questions asked by ',
1086 1086
         'url'			=> 'wrans/'
1087 1087
     ),
1088
-    'wransyear' => array (
1088
+    'wransyear' => array(
1089 1089
         'parent'		=> 'wransfront',
1090 1090
         'url'			=> 'wrans/'
1091 1091
     ),
1092 1092
 
1093
-    'wranswmsfront'  => array (
1094
-        'menu'			=> array (
1093
+    'wranswmsfront'  => array(
1094
+        'menu'			=> array(
1095 1095
             'text'			=> 'Written Answers',
1096 1096
             'title'			=> 'Written Answers and Statements',
1097 1097
         ),
@@ -1108,8 +1108,8 @@  discard block
 block discarded – undo
1108 1108
         'title' => 'Your representative',
1109 1109
         'url' => 'your/',
1110 1110
     ),
1111
-    'yourmp' => array (
1112
-        'menu'			=> array (
1111
+    'yourmp' => array(
1112
+        'menu'			=> array(
1113 1113
             'text'			=> 'Your MP',
1114 1114
             'title'			=> "Find out about your Member of Parliament"
1115 1115
         ),
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
         'url'			=> 'mp/',
1119 1119
         'parent'			=> 'mps',
1120 1120
     ),
1121
-    'yourmp_recent' => array (
1122
-        'menu'			=> array (
1121
+    'yourmp_recent' => array(
1122
+        'menu'			=> array(
1123 1123
             'text'			=> 'Recent appearances',
1124 1124
             'title'			=> "Recent speeches and written answers by this MP"
1125 1125
         ),
@@ -1127,8 +1127,8 @@  discard block
 block discarded – undo
1127 1127
         'title'			=> "Your MP's recent appearances in parliament",
1128 1128
         'url'			=> 'mp/?recent=1'
1129 1129
     ),
1130
-    'yourmsp' => array (
1131
-        'menu'			=> array (
1130
+    'yourmsp' => array(
1131
+        'menu'			=> array(
1132 1132
             'text'			=> 'Your MSPs',
1133 1133
             'title'			=> "Find out about your Members of the Scottish Parliament"
1134 1134
         ),
@@ -1137,8 +1137,8 @@  discard block
 block discarded – undo
1137 1137
         'title'			=> 'Your MSPs',
1138 1138
         'url'			=> 'msp/'
1139 1139
     ),
1140
-    'yourmla' => array (
1141
-        'menu'			=> array (
1140
+    'yourmla' => array(
1141
+        'menu'			=> array(
1142 1142
             'text'			=> 'Your MLAs',
1143 1143
             'title'			=> "Find out about your Members of the Legislative Assembly"
1144 1144
         ),
@@ -1154,38 +1154,38 @@  discard block
 block discarded – undo
1154 1154
 // The text displayed on the page itself will also be this,
1155 1155
 // UNLESS the section has a 'heading', in which case that's used instead.
1156 1156
 
1157
-$this->section = array (
1157
+$this->section = array(
1158 1158
 
1159 1159
 
1160
-    'about' => array (
1160
+    'about' => array(
1161 1161
         'title' 	=> 'About Us'
1162 1162
     ),
1163
-    'admin' => array (
1163
+    'admin' => array(
1164 1164
         'title'		=> 'Admin'
1165 1165
     ),
1166
-    'debates' => array (
1166
+    'debates' => array(
1167 1167
         'title' 	=> 'Debates',
1168 1168
         'heading'	=> 'House of Commons Debates'
1169 1169
     ),
1170
-    'help_us_out' => array (
1170
+    'help_us_out' => array(
1171 1171
         'title' 	=> 'Help Us Out'
1172 1172
     ),
1173
-    'hansard' => array (
1173
+    'hansard' => array(
1174 1174
         'title' 	=> 'Hansard'
1175 1175
     ),
1176
-    'home' => array (
1176
+    'home' => array(
1177 1177
         'title' 	=> 'Home'
1178 1178
     ),
1179
-    'mp' => array (
1179
+    'mp' => array(
1180 1180
         'title' 	=> 'Your MP'
1181 1181
     ),
1182
-    'search' => array (
1182
+    'search' => array(
1183 1183
         'title' 	=> 'Search'
1184 1184
     ),
1185
-    'sitenews' => array (
1185
+    'sitenews' => array(
1186 1186
         'title' 	=> 'TheyWorkForYou news'
1187 1187
     ),
1188
-    'wrans' => array (
1188
+    'wrans' => array(
1189 1189
         'title' 	=> 'Written Answers'
1190 1190
     )
1191 1191
 
Please login to merge, or discard this patch.
www/includes/easyparliament/commentlist.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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.
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -542,11 +542,11 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
 
194 194
         if ($q->rows() > 0) {
195 195
 
196
-            for ($n=0; $n<$q->rows(); $n++) {
196
+            for ($n = 0; $n < $q->rows(); $n++) {
197 197
 
198 198
                 // All the basic stuff...
199
-                $comments[$n] = array (
199
+                $comments[$n] = array(
200 200
                     'comment_id'		=> $q->field($n, 'comment_id'),
201 201
                     'posted'			=> $q->field($n, 'posted'),
202 202
                     'total_comments'	=> $q->field($n, 'total_comments'),
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 );
209 209
 
210 210
                 // Add the URL...
211
-                $urldata = array (
211
+                $urldata = array(
212 212
                     'major' 		=> $q->field($n, 'major'),
213 213
                     'gid'			=> $q->field($n, 'gid'),
214 214
                     'comment_id'	=> $q->field($n, 'comment_id'),
@@ -234,14 +234,14 @@  discard block
 block discarded – undo
234 234
 
235 235
                 $commentbodies = array();
236 236
 
237
-                for ($n=0; $n<$r->rows(); $n++) {
238
-                    $commentbodies[ $r->field($n, 'comment_id') ] = $r->field($n, 'body');
237
+                for ($n = 0; $n < $r->rows(); $n++) {
238
+                    $commentbodies[$r->field($n, 'comment_id')] = $r->field($n, 'body');
239 239
                 }
240 240
 
241 241
                 // This does rely on both this and the previous query returning
242 242
                 // stuff in the same order...
243 243
                 foreach ($comments as $n => $commentdata) {
244
-                    $comments[$n]['body'] = $commentbodies[ $comments[$n]['comment_id'] ];
244
+                    $comments[$n]['body'] = $commentbodies[$comments[$n]['comment_id']];
245 245
                 }
246 246
             }
247 247
         }
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         // $args should contain 'num', indicating how many to get.
262 262
         // and perhaps pid too, for a particular person
263 263
 
264
-        twfy_debug (get_class($this), "getting data by recent");
264
+        twfy_debug(get_class($this), "getting data by recent");
265 265
 
266 266
         // What we return.
267 267
         $data = array();
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             $page = 1;
279 279
         }
280 280
 
281
-        $limit = $num*($page-1) . ',' . $num;
281
+        $limit = $num * ($page - 1) . ',' . $num;
282 282
 
283 283
         $where = array(
284 284
             'visible=' => '1'
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
         if (isset($args['pid']) && is_numeric($args['pid'])) {
287 287
             $where['person_id='] = $args['pid'];
288 288
         }
289
-        $input = array (
290
-            'amount' => array (
289
+        $input = array(
290
+            'amount' => array(
291 291
                 'user' => true
292 292
             ),
293 293
             'where'  => $where,
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             $data['pid'] = $args['pid'];
306 306
             $q = 'SELECT title, given_name, family_name, lordofname, house FROM member m, person_names p WHERE m.person_id=p.person_id AND p.type="name" AND left_house="9999-12-31" AND m.person_id = :pid';
307 307
             $q = $this->db->query($q, array(':pid' => $args['pid']));
308
-            $data['full_name'] = member_full_name($q->field(0, 'house'), $q->field(0, 'title'), $q->field(0, 'given_name'), $q->field(0, 'family_name'), $q->field(0,'lordofname'));
308
+            $data['full_name'] = member_full_name($q->field(0, 'house'), $q->field(0, 'title'), $q->field(0, 'given_name'), $q->field(0, 'family_name'), $q->field(0, 'lordofname'));
309 309
             $q = 'SELECT COUNT(*) AS count FROM comments,hansard WHERE visible=1 AND comments.epobject_id = hansard.epobject_id and hansard.person_id = :pid';
310 310
             $params[':pid'] = $args['pid'];
311 311
         } else {
@@ -319,15 +319,15 @@  discard block
 block discarded – undo
319 319
   public function _get_data_by_dates($args) {
320 320
     // $args should contain start_date and end_date
321 321
 
322
-        twfy_debug (get_class($this), "getting data by recent");
322
+        twfy_debug(get_class($this), "getting data by recent");
323 323
         $data = array();
324 324
         $where = array(
325 325
             'visible=' => '1',
326 326
             'date(posted)>=' => $args['start_date'],
327 327
             'date(posted)<=' => $args['end_date']
328 328
         );
329
-        $input = array (
330
-            'amount' => array (
329
+        $input = array(
330
+            'amount' => array(
331 331
                 'user' => true
332 332
             ),
333 333
             'where'  => $where,
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     public function _get_data_by_search($args) {
342 342
         // $args should contain 'num', indicating how many to get.
343 343
 
344
-        twfy_debug (get_class($this), "getting data by search");
344
+        twfy_debug(get_class($this), "getting data by search");
345 345
 
346 346
         // What we return.
347 347
         $data = array();
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
             $page = 1;
359 359
         }
360 360
 
361
-        $limit = $num*($page-1) . ',' . $num;
361
+        $limit = $num * ($page - 1) . ',' . $num;
362 362
 
363
-        $input = array (
364
-            'amount' => array (
363
+        $input = array(
364
+            'amount' => array(
365 365
                 'user'=> true
366 366
             ),
367
-            'where'  => array (
367
+            'where'  => array(
368 368
                 'comments.body LIKE' => "%$args[s]%"
369 369
             ),
370 370
             'order' => 'posted DESC',
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
         // It returns the URL for the comment.
392 392
 
393 393
         $major 		= $urldata['major'];
394
-        $gid 		= $urldata['gid'];
394
+        $gid = $urldata['gid'];
395 395
         $comment_id = $urldata['comment_id'];
396 396
         $user_id = isset($urldata['user_id']) ? $urldata['user_id'] : false;
397 397
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
         $URL = new \MySociety\TheyWorkForYou\Url($page);
406 406
 
407 407
         $gid = fix_gid_from_db($gid); // In includes/utility.php
408
-        $URL->insert(array('id' => $gid ));
408
+        $URL->insert(array('id' => $gid));
409 409
         if ($user_id) {
410 410
             $URL->insert(array('u' => $user_id));
411 411
         }
@@ -483,9 +483,9 @@  discard block
 block discarded – undo
483 483
         $limit = isset($input['limit']) ? $input['limit'] : '';
484 484
 
485 485
         // The fields to fetch from db. 'table' => array ('field1', 'field2').
486
-        $fieldsarr = array (
487
-            'comments' => array ('comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'),
488
-            'hansard' => array ('major', 'gid')
486
+        $fieldsarr = array(
487
+            'comments' => array('comment_id', 'user_id', 'epobject_id', 'body', 'posted', 'modflagged', 'visible'),
488
+            'hansard' => array('major', 'gid')
489 489
         );
490 490
 
491 491
         // Yes, we need the gid of a comment's associated hansard object
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 
497 497
         // Add on the stuff for getting a user's details.
498 498
         if (isset($amount['user']) && $amount['user'] == true) {
499
-            $fieldsarr['users'] = array ('firstname', 'lastname', 'user_id');
499
+            $fieldsarr['users'] = array('firstname', 'lastname', 'user_id');
500 500
             // Like doing "FROM comments, users" but it's easier to add
501 501
             // an "INNER JOIN..." automatically to the query.
502 502
             $join .= ' INNER JOIN users ON comments.user_id = users.user_id ';
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
             $fieldsarr['epobject'] = array('body');
508 508
         }
509 509
 
510
-        $fieldsarr2 = array ();
510
+        $fieldsarr2 = array();
511 511
         // Construct the $fields clause.
512 512
         foreach ($fieldsarr as $table => $tablesfields) {
513 513
             foreach ($tablesfields as $n => $field) {
@@ -518,13 +518,13 @@  discard block
 block discarded – undo
518 518
                 if ($table == 'epobject' && $field == 'body') {
519 519
                     $field .= ' AS hbody';
520 520
                 }
521
-                $fieldsarr2[] = $table.'.'.$field;
521
+                $fieldsarr2[] = $table . '.' . $field;
522 522
             }
523 523
         }
524 524
         $fields = implode(', ', $fieldsarr2);
525 525
 
526 526
 
527
-        $wherearr2 = array ();
527
+        $wherearr2 = array();
528 528
         $params = array();
529 529
         $i = 0;
530 530
         // Construct the $where clause.
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
             $params[":where$i"] = $val;
534 534
             $i++;
535 535
         }
536
-        $where = implode (" AND ", $wherearr2);
536
+        $where = implode(" AND ", $wherearr2);
537 537
 
538 538
         if ($order != '') {
539 539
             $order = "ORDER BY $order";
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
         }
545 545
 
546 546
         // Finally, do the query!
547
-        $q = $this->db->query ("SELECT $fields
547
+        $q = $this->db->query("SELECT $fields
548 548
                         FROM 	comments
549 549
                         $join
550 550
                         WHERE $where
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
                         ", $params);
554 554
 
555 555
         // Format the data into an array for returning.
556
-        $data = array ();
556
+        $data = array();
557 557
 
558 558
         if ($q->rows() > 0) {
559 559
 
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
             // We'll generate permalinks for each comment.
564 564
             // Assuming every comment is from the same major...
565 565
 
566
-            for ($n=0; $n<$q->rows(); $n++) {
566
+            for ($n = 0; $n < $q->rows(); $n++) {
567 567
 
568 568
                 // Put each row returned into its own array in $data.
569 569
                 foreach ($fieldsarr as $table => $tablesfields) {
Please login to merge, or discard this patch.
www/includes/easyparliament/searchengine.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
                 }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
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 {
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
         for ($n=0; $n<$merged->rows(); $n++) {
264 264
             $from_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_from'));
265 265
             $to_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_to'));
266
-            $qd = str_replace("(S$from_id OR S$to_id)", "S$to_id", $qd);
267
-            $qd = str_replace("S$from_id OR S$to_id", "S$to_id", $qd);
266
+            $qd = str_replace("(S$from_id OR S$to_id)", "s$to_id", $qd);
267
+            $qd = str_replace("s$from_id OR S$to_id", "s$to_id", $qd);
268 268
         }
269 269
 
270 270
         preg_match_all('#S(\d+)#', $qd, $m);
271 271
         foreach ($m[1] as $mm) {
272 272
             $member = new MEMBER(array('person_id' => $mm));
273 273
             $name = $member->full_name();
274
-            $qd = str_replace("S$mm", "speaker:$name", $qd);
274
+            $qd = str_replace("s$mm", "speaker:$name", $qd);
275 275
         }
276 276
 
277 277
         # Simplify display of excluded words
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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";
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
         # Merged people
182 182
         $db = new ParlDB;
183 183
         $merged = $db->query('SELECT * FROM gidredirect WHERE gid_from LIKE :gid_from', array(':gid_from' => "uk.org.publicwhip/person/%"));
184
-        for ($n=0; $n<$merged->rows(); $n++) {
184
+        for ($n = 0; $n < $merged->rows(); $n++) {
185 185
             $from_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_from'));
186 186
             $to_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_to'));
187 187
             $this->query = preg_replace("#speaker:($from_id|$to_id)#i", "(speaker:$from_id OR speaker:$to_id)", $this->query);
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
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;
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         foreach ($m[1] as $phrase) {
219 219
             $phrase_new = preg_replace('# PHRASE \d+#', '', $phrase);
220 220
             #$this->phrases[] = preg_split('#\s+#', $phrase_new);
221
-            $qd = str_replace("($phrase)", '"'.$phrase_new.'"', $qd);
221
+            $qd = str_replace("($phrase)", '"' . $phrase_new . '"', $qd);
222 222
         }
223 223
         preg_match_all('#\(([^(]*? NEAR [^(]*?)\)#', $qd, $m);
224 224
         foreach ($m[1] as $mm) {
@@ -262,7 +262,7 @@  discard block
 block discarded – undo
262 262
         }
263 263
 
264 264
         # Speakers
265
-        for ($n=0; $n<$merged->rows(); $n++) {
265
+        for ($n = 0; $n < $merged->rows(); $n++) {
266 266
             $from_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_from'));
267 267
             $to_id = str_replace('uk.org.publicwhip/person/', '', $merged->field($n, 'gid_to'));
268 268
             $qd = str_replace("(S$from_id OR S$to_id)", "S$to_id", $qd);
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     }
342 342
 
343 343
     // Perform partial query to get a count of number of matches
344
-    public function run_count($first_result, $results_per_page, $sort_order='relevance') {
344
+    public function run_count($first_result, $results_per_page, $sort_order = 'relevance') {
345 345
         if (!defined('XAPIANDB') || !XAPIANDB)
346 346
             return null;
347 347
 
@@ -414,13 +414,13 @@  discard block
 block discarded – undo
414 414
         #}
415 415
 
416 416
         $duration = getmicrotime() - $start;
417
-        twfy_debug ("SEARCH", "Search count took $duration seconds.");
417
+        twfy_debug("SEARCH", "Search count took $duration seconds.");
418 418
 
419 419
         return $count;
420 420
     }
421 421
 
422 422
     // Perform the full search...
423
-    public function run_search($first_result, $results_per_page, $sort_order='relevance') {
423
+    public function run_search($first_result, $results_per_page, $sort_order = 'relevance') {
424 424
         $start = getmicrotime();
425 425
 
426 426
         #$matches = $this->enquire->get_mset($first_result, $results_per_page);
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
                 array_push($this->created, join('', unpack('N', $doc->get_value(2)))); # XXX Needs fixing
442 442
             }
443 443
             twfy_debug("SEARCH", "gid: $gid relevancy: $relevancy% weight: $weight");
444
-            array_push($this->gids, "uk.org.publicwhip/".$gid);
444
+            array_push($this->gids, "uk.org.publicwhip/" . $gid);
445 445
             array_push($this->collapsed, $collapsed);
446 446
             array_push($this->relevances, $relevancy);
447 447
             $iter->next();
448 448
         }
449 449
         $duration = getmicrotime() - $start;
450
-        twfy_debug ("SEARCH", "Run search took $duration seconds.");
450
+        twfy_debug("SEARCH", "Run search took $duration seconds.");
451 451
     }
452 452
     // ... use these to get the results
453 453
     public function get_gids() {
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
         $body = str_replace($this->specialchars, $this->specialchars_upper, $body);
489 489
         $body = mb_convert_encoding($body, "UTF-8", "HTML-ENTITIES");
490 490
         $body = str_replace($this->specialchars_upper, $this->specialchars, $body);
491
-        $splitextract = preg_split('/(<[^>]*>|[0-9,.]+|['.$this->wordcharsnodigit.']+)/', $body, -1, PREG_SPLIT_DELIM_CAPTURE);
491
+        $splitextract = preg_split('/(<[^>]*>|[0-9,.]+|[' . $this->wordcharsnodigit . ']+)/', $body, -1, PREG_SPLIT_DELIM_CAPTURE);
492 492
         $hlextract = "";
493 493
         foreach ($splitextract as $extractword) {
494 494
             if (preg_match('/^<[^>]*>$/', $extractword)) {
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
         */
537 537
 
538 538
         foreach ($this->phrases as $phrase) {
539
-            $phrasematch = join($phrase, '[^'.$this->wordchars.']+');
539
+            $phrasematch = join($phrase, '[^' . $this->wordchars . ']+');
540 540
             array_push($findwords, "/\b($phrasematch)\b(?!(?>[^<>]*>))/i");
541 541
             $replacewords[] = "<span class=\"hi\">\\1</span>";
542 542
         }
@@ -554,12 +554,12 @@  discard block
 block discarded – undo
554 554
 
555 555
         // look for phrases
556 556
         foreach ($this->phrases as $phrase) {
557
-            $phrasematch = join($phrase, '[^'.$this->wordchars.']+');
558
-            if (preg_match('/([^'.$this->wordchars.']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches))
557
+            $phrasematch = join($phrase, '[^' . $this->wordchars . ']+');
558
+            if (preg_match('/([^' . $this->wordchars . ']' . $phrasematch . '[^A-Za-z0-9])/', $lcbody, $matches))
559 559
             {
560
-                $wordpos = strpos( $lcbody, $matches[0] );
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
                 }
@@ -567,7 +567,7 @@  discard block
 block discarded – undo
567 567
         }
568 568
         if ($pos != -1) return $pos;
569 569
 
570
-        $splitextract = preg_split('/([0-9,.]+|['.$this->wordcharsnodigit.']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE);
570
+        $splitextract = preg_split('/([0-9,.]+|[' . $this->wordcharsnodigit . ']+)/', $lcbody, -1, PREG_SPLIT_DELIM_CAPTURE);
571 571
         $stemmed_words = array_map(array($this, 'stem'), $this->words);
572 572
         foreach ($splitextract as $extractword) {
573 573
             $extractword = preg_replace('/&$/', '', $extractword);
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
             foreach ($stemmed_words as $word) {
578 578
                 if ($word == '') continue;
579 579
                 $matchword = $this->stem($extractword);
580
-                if ($matchword == $word && ($wordpos < $pos || $pos==-1)) {
580
+                if ($matchword == $word && ($wordpos < $pos || $pos == -1)) {
581 581
                     $pos = $wordpos;
582 582
                 }
583 583
             }
@@ -586,11 +586,11 @@  discard block
 block discarded – undo
586 586
         if ($pos != -1) return $pos;
587 587
 
588 588
         foreach ($this->words as $word) {
589
-            if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')';
590
-            if (preg_match('/([^'.$this->wordchars.']' . $word . '[^'.$this->wordchars. '])/', $lcbody, $matches)) {
591
-                $wordpos = strpos( $lcbody, $matches[0] );
589
+            if (ctype_digit($word)) $word = '(?:' . $word . '|' . number_format($word) . ')';
590
+            if (preg_match('/([^' . $this->wordchars . ']' . $word . '[^' . $this->wordchars . '])/', $lcbody, $matches)) {
591
+                $wordpos = strpos($lcbody, $matches[0]);
592 592
                 if ($wordpos) {
593
-                    if ( ($wordpos < $pos) || ($pos==-1) ) {
593
+                    if (($wordpos < $pos) || ($pos == -1)) {
594 594
                         $pos = $wordpos;
595 595
                     }
596 596
                 }
@@ -600,11 +600,11 @@  discard block
 block discarded – undo
600 600
         if ($pos != -1) return $pos;
601 601
 
602 602
         foreach ($this->words as $word) {
603
-            if (ctype_digit($word)) $word = '(?:'.$word.'|'.number_format($word).')';
603
+            if (ctype_digit($word)) $word = '(?:' . $word . '|' . number_format($word) . ')';
604 604
             if (preg_match('/(' . $word . ')/', $lcbody, $matches)) {
605
-                $wordpos = strpos( $lcbody, $matches[0] );
605
+                $wordpos = strpos($lcbody, $matches[0]);
606 606
                 if ($wordpos) {
607
-                    if ( ($wordpos < $pos) || ($pos==-1) ) {
607
+                    if (($wordpos < $pos) || ($pos == -1)) {
608 608
                         $pos = $wordpos;
609 609
                     }
610 610
                 }
Please login to merge, or discard this patch.
Braces   +100 added lines, -48 removed lines patch added patch discarded remove patch
@@ -38,8 +38,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
491 524
     private $specialchars_upper = array('&LT;', '&GT;', '&QUOT;', '&AMP;');
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
www/includes/easyparliament/glossary.php 2 patches
Braces   +14 added lines, -15 removed lines patch added patch discarded remove patch
@@ -107,19 +107,19 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -21,20 +21,20 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
             WHERE g.glossary_id=eq.glossary_id AND u.user_id=eq.user_id AND g.visible=1 AND eq.approved=1
92 92
             ORDER by g.title");
93 93
         if ($q->success() && $q->rows()) {
94
-            for ($i=0; $i < $q->rows(); $i++) {
95
-                $this->terms[ $q->field($i,"glossary_id") ] = $q->row($i);
94
+            for ($i = 0; $i < $q->rows(); $i++) {
95
+                $this->terms[$q->field($i, "glossary_id")] = $q->row($i);
96 96
                 // Now add the epobject to the alphabet navigation.
97
-                $first_letter = strtoupper(substr($q->field($i,"title"),0,1));
98
-                $this->alphabet[$first_letter][] = $q->field($i,"glossary_id");
97
+                $first_letter = strtoupper(substr($q->field($i, "title"), 0, 1));
98
+                $this->alphabet[$first_letter][] = $q->field($i, "glossary_id");
99 99
             }
100 100
 
101 101
             $this->num_terms = $q->rows();
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
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
 
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
             ORDER by g.title";
154 154
         $q = $this->db->query($query);
155 155
         if ($q->success() && $q->rows()) {
156
-            for ($i=0; $i < $q->rows(); $i++) {
157
-                $this->search_matches[ $q->field($i,"glossary_id") ] = $q->row($i);
156
+            for ($i = 0; $i < $q->rows(); $i++) {
157
+                $this->search_matches[$q->field($i, "glossary_id")] = $q->row($i);
158 158
             }
159 159
             $this->num_search_matches = $q->rows();
160 160
         }
@@ -190,12 +190,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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');
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/error.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
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">
Please login to merge, or discard this patch.
www/includes/easyparliament/templates/html/mp/votes.php 4 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
81 81
 
82 82
                                 include '_vote_description.php';
83 83
 
84
-                              } ?>
84
+                                } ?>
85 85
                             </ul>
86 86
 
87 87
                             <div class="share-vote-descriptions">
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -110,13 +110,16 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
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(
Please login to merge, or discard this patch.