@@ -159,6 +159,9 @@ |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | + /** |
|
163 | + * @param string $type |
|
164 | + */ |
|
162 | 165 | private function getMetadata($args="", $type) { |
163 | 166 | // $type is either 'page' or 'section' |
164 | 167 | global $this_page, $this_section; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | public function __construct() { |
56 | 56 | |
57 | - include_once METADATAPATH; // defined in config.php |
|
57 | + include_once METADATAPATH; // defined in config.php |
|
58 | 58 | |
59 | 59 | } |
60 | 60 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | */ |
115 | 115 | |
116 | 116 | public function set_page_metadata($page, $key, $value) { |
117 | - $this->setMetadata(array("page"=>$page,"key"=>$key,"value"=>$value)); |
|
117 | + $this->setMetadata(array("page"=>$page, "key"=>$key, "value"=>$value)); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | /** |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | |
128 | 128 | public function set_section_metadata($section, $key, $value) { |
129 | - $this->setMetadata(array("section"=>$section,"key"=>$key,"value"=>$value)); |
|
129 | + $this->setMetadata(array("section"=>$section, "key"=>$key, "value"=>$value)); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | */ |
151 | 151 | |
152 | 152 | public function test_for_metadata($type, $item, $key) { |
153 | - $dataarray =& $this->$type; |
|
153 | + $dataarray = & $this->$type; |
|
154 | 154 | |
155 | 155 | if (isset($dataarray[$item][$key])) { |
156 | 156 | return true; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - private function getMetadata($args="", $type) { |
|
162 | + private function getMetadata($args = "", $type) { |
|
163 | 163 | // $type is either 'page' or 'section' |
164 | 164 | global $this_page, $this_section; |
165 | 165 | |
@@ -167,21 +167,21 @@ discard block |
||
167 | 167 | $item = $args[$type]; |
168 | 168 | $key = $args['key']; |
169 | 169 | } else { |
170 | - $var = "this_".$type; |
|
170 | + $var = "this_" . $type; |
|
171 | 171 | $item = $$var; // $this_page or $this_section. |
172 | 172 | $key = $args; |
173 | 173 | } |
174 | 174 | |
175 | 175 | twfy_debug("DATA", "$type: $item, $key"); |
176 | - $dataarray =& $this->$type; |
|
176 | + $dataarray = & $this->$type; |
|
177 | 177 | |
178 | 178 | if ($this->test_for_metadata($type, $item, $key)) { |
179 | 179 | $return = $dataarray[$item][$key]; |
180 | - $debugtext = "Key: ".$type."[".$item."][".$key."]"; |
|
180 | + $debugtext = "Key: " . $type . "[" . $item . "][" . $key . "]"; |
|
181 | 181 | |
182 | 182 | } elseif ($this->test_for_metadata($type, "default", $key)) { |
183 | 183 | $return = $dataarray["default"][$key]; |
184 | - $debugtext = "Key: ".$type."['default'][".$key."]"; |
|
184 | + $debugtext = "Key: " . $type . "['default'][" . $key . "]"; |
|
185 | 185 | |
186 | 186 | } else { |
187 | 187 | $return = false; |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | $key = $args["key"]; |
207 | 207 | $value = $args["value"]; |
208 | 208 | |
209 | - twfy_debug("DATA", "Setting: ".$type."[".$item."][".$key."] = '" . print_r($value, 1) . "'"); |
|
209 | + twfy_debug("DATA", "Setting: " . $type . "[" . $item . "][" . $key . "] = '" . print_r($value, 1) . "'"); |
|
210 | 210 | |
211 | - $dataarray =& $this->$type; |
|
211 | + $dataarray = & $this->$type; |
|
212 | 212 | $dataarray[$item][$key] = $value; |
213 | 213 | } |
214 | 214 |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | include_once (INCLUDESPATH."mysql.php"); |
83 | 83 | |
84 | -Class ParlDB extends MySQL { |
|
84 | +class ParlDB extends MySQL { |
|
85 | 85 | public function __construct() { |
86 | 86 | $this->init (OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
87 | 87 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | include_once (INCLUDESPATH."easyparliament/user.php"); |
95 | 95 | |
96 | 96 | // Test to see if this is a new-style template using the renderer class. |
97 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
97 | +if (! isset($new_style_template) or $new_style_template !== true) { |
|
98 | 98 | |
99 | 99 | // This is an old-style page. Use the old page classes. |
100 | 100 | include_once (INCLUDESPATH."easyparliament/page.php"); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | First some things to help make our PHP nicer and betterer |
5 | 5 | ********************************************************************************/ |
6 | 6 | |
7 | -error_reporting (E_ALL); |
|
7 | +error_reporting(E_ALL); |
|
8 | 8 | |
9 | 9 | /******************************************************************************** |
10 | 10 | Now some constants that are the same for live and dev versions |
@@ -12,22 +12,22 @@ discard block |
||
12 | 12 | ********************************************************************************/ |
13 | 13 | |
14 | 14 | // In case we need to switch these off globally at some point... |
15 | -define ("ALLOWCOMMENTS", true); |
|
16 | -define ("ALLOWTRACKBACKS", true); |
|
15 | +define("ALLOWCOMMENTS", true); |
|
16 | +define("ALLOWTRACKBACKS", true); |
|
17 | 17 | |
18 | 18 | // These variables are so we can keep date/time formats consistent across the site |
19 | 19 | // and change them easily. |
20 | 20 | // Formats here: http://www.php.net/manual/en/function.date.php |
21 | -define ("LONGERDATEFORMAT", "l, j F Y");// Monday, 31 December 2003 |
|
22 | -define ("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
23 | -define ("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
24 | -define ("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
21 | +define("LONGERDATEFORMAT", "l, j F Y"); // Monday, 31 December 2003 |
|
22 | +define("LONGDATEFORMAT", "j F Y"); // 31 December 2003 |
|
23 | +define("SHORTDATEFORMAT", "j M Y"); // 31 Dec 2003 |
|
24 | +define("TIMEFORMAT", "g:i a"); // 11:59 pm |
|
25 | 25 | |
26 | -define ("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
27 | -define ("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
26 | +define("SHORTDATEFORMAT_SQL", "%e %b %Y"); // 31 Dec 2003 |
|
27 | +define("TIMEFORMAT_SQL", "%l:%i %p"); // 11:59 PM |
|
28 | 28 | |
29 | 29 | // Where we store the postcode of users if they search for an MP by postcode. |
30 | -define ('POSTCODE_COOKIE', 'eppc'); |
|
30 | +define('POSTCODE_COOKIE', 'eppc'); |
|
31 | 31 | |
32 | 32 | /******************************************************************************** |
33 | 33 | And now all the files we'll include on every page. |
@@ -41,7 +41,7 @@ discard block |
||
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')) date_default_timezone_set(TIMEZONE); |
|
45 | 45 | |
46 | 46 | // Only do clever things with errors if we're not testing, otherwise show as default |
47 | 47 | |
@@ -70,44 +70,44 @@ discard block |
||
70 | 70 | |
71 | 71 | // The time the page starts, so we can display the total at the end. |
72 | 72 | // getmicrotime() is in utiltity.php. |
73 | -define ("STARTTIME", getmicrotime()); |
|
73 | +define("STARTTIME", getmicrotime()); |
|
74 | 74 | if (!isset($_SERVER['WINDIR'])) { |
75 | 75 | $rusage = getrusage(); |
76 | - define ('STARTTIMES', $rusage['ru_stime.tv_sec']*1000000 + $rusage['ru_stime.tv_usec']); |
|
77 | - define ('STARTTIMEU', $rusage['ru_utime.tv_sec']*1000000 + $rusage['ru_utime.tv_usec']); |
|
76 | + define('STARTTIMES', $rusage['ru_stime.tv_sec'] * 1000000 + $rusage['ru_stime.tv_usec']); |
|
77 | + define('STARTTIMEU', $rusage['ru_utime.tv_sec'] * 1000000 + $rusage['ru_utime.tv_usec']); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | $DATA = new \MySociety\TheyWorkForYou\Data; |
81 | 81 | |
82 | -include_once (INCLUDESPATH."mysql.php"); |
|
82 | +include_once (INCLUDESPATH . "mysql.php"); |
|
83 | 83 | |
84 | 84 | Class ParlDB extends MySQL { |
85 | 85 | public function __construct() { |
86 | - $this->init (OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
86 | + $this->init(OPTION_TWFY_DB_HOST, OPTION_TWFY_DB_USER, OPTION_TWFY_DB_PASS, OPTION_TWFY_DB_NAME); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -include_once (INCLUDESPATH."url.php"); |
|
90 | +include_once (INCLUDESPATH . "url.php"); |
|
91 | 91 | |
92 | 92 | $filter = new \MySociety\TheyWorkForYou\Utility\LibFilter; |
93 | 93 | |
94 | -include_once (INCLUDESPATH."easyparliament/user.php"); |
|
94 | +include_once (INCLUDESPATH . "easyparliament/user.php"); |
|
95 | 95 | |
96 | 96 | // Test to see if this is a new-style template using the renderer class. |
97 | -if (! isset($new_style_template) OR $new_style_template !== TRUE) { |
|
97 | +if (!isset($new_style_template) OR $new_style_template !== TRUE) { |
|
98 | 98 | |
99 | 99 | // This is an old-style page. Use the old page classes. |
100 | - include_once (INCLUDESPATH."easyparliament/page.php"); |
|
100 | + include_once (INCLUDESPATH . "easyparliament/page.php"); |
|
101 | 101 | |
102 | 102 | } |
103 | 103 | |
104 | -include_once (INCLUDESPATH."easyparliament/hansardlist.php"); |
|
105 | -include_once (INCLUDESPATH."dbtypes.php"); |
|
106 | -include_once (INCLUDESPATH."easyparliament/commentlist.php"); |
|
107 | -include_once (INCLUDESPATH."easyparliament/comment.php"); |
|
108 | -include_once (INCLUDESPATH."easyparliament/trackback.php"); |
|
104 | +include_once (INCLUDESPATH . "easyparliament/hansardlist.php"); |
|
105 | +include_once (INCLUDESPATH . "dbtypes.php"); |
|
106 | +include_once (INCLUDESPATH . "easyparliament/commentlist.php"); |
|
107 | +include_once (INCLUDESPATH . "easyparliament/comment.php"); |
|
108 | +include_once (INCLUDESPATH . "easyparliament/trackback.php"); |
|
109 | 109 | |
110 | 110 | // Added in as new module by Richard Allan MP |
111 | -include_once (INCLUDESPATH."easyparliament/alert.php"); |
|
111 | +include_once (INCLUDESPATH . "easyparliament/alert.php"); |
|
112 | 112 | |
113 | 113 | twfy_debug_timestamp("at end of init.php"); |