@@ -12,11 +12,11 @@ |
||
12 | 12 | |
13 | 13 | class UtilityTest extends UnitTestCase{ |
14 | 14 | |
15 | - public function testVerpEnvelopeSenderCanCreateStandardSender() { |
|
15 | + public function testVerpEnvelopeSenderCanCreateStandardSender() { |
|
16 | 16 | $sender = twfy_verp_envelope_sender('[email protected]'); |
17 | 17 | $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; |
18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); |
19 | - } |
|
19 | + } |
|
20 | 20 | |
21 | 21 | } |
22 | 22 |
@@ -1,5 +1,5 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | 'url' => 'peer/' |
531 | 531 | ), |
532 | 532 | 'peers' => array ( |
533 | - 'menu' => array ( |
|
533 | + 'menu' => array ( |
|
534 | 534 | 'text' => 'Lords', |
535 | 535 | 'title' => "List of all Lords" |
536 | 536 | ), |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | 'url' => 'peers/' |
540 | 540 | ), |
541 | 541 | 'overview' => array ( |
542 | - 'menu' => array ( |
|
542 | + 'menu' => array ( |
|
543 | 543 | 'text' => 'Overview', |
544 | 544 | 'title' => "Overview of the UK Parliament" |
545 | 545 | ), |
@@ -591,7 +591,7 @@ discard block |
||
591 | 591 | 'url' => 'rss/mp/' |
592 | 592 | ), |
593 | 593 | 'mps' => array ( |
594 | - 'menu' => array ( |
|
594 | + 'menu' => array ( |
|
595 | 595 | 'text' => 'MPs', |
596 | 596 | 'title' => "List of all Members of Parliament (MPs)" |
597 | 597 | ), |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | return $data; |
319 | 319 | } |
320 | 320 | |
321 | - public function _get_data_by_dates($args) { |
|
321 | + public function _get_data_by_dates($args) { |
|
322 | 322 | // $args should contain start_date and end_date |
323 | 323 | |
324 | 324 | twfy_debug (get_class($this), "getting data by recent"); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | $commentsdata = $this->_get_comment_data($input); |
339 | 339 | $data['comments'] = $commentsdata; |
340 | 340 | return $data; |
341 | - } |
|
341 | + } |
|
342 | 342 | |
343 | 343 | public function _get_data_by_search($args) { |
344 | 344 | // $args should contain 'num', indicating how many to get. |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | } |
334 | 334 | |
335 | 335 | public function get_spelling_correction() { |
336 | - if (!defined('XAPIANDB') || !XAPIANDB) |
|
336 | + if (!defined('XAPIANDB') || !XAPIANDB) |
|
337 | 337 | return null; |
338 | 338 | |
339 | 339 | $qd = $this->queryparser->get_corrected_query_string(); |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | { |
560 | 560 | $wordpos = strpos( $lcbody, $matches[0] ); |
561 | 561 | if ($wordpos) { |
562 | - if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
562 | + if ( ($wordpos < $pos) || ($pos==-1) ) { |
|
563 | 563 | $pos = $wordpos; |
564 | 564 | } |
565 | 565 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | <?php foreach ($segment['votes']->positions as $key_vote) { |
61 | 61 | |
62 | 62 | if (isset($policy_last_update[$key_vote['policy_id']]) && $policy_last_update[$key_vote['policy_id']] > $most_recent) { |
63 | - $most_recent = $policy_last_update[$key_vote['policy_id']]; |
|
63 | + $most_recent = $policy_last_update[$key_vote['policy_id']]; |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | if ( $key_vote['has_strong'] || $key_vote['position'] == 'has never voted on' ) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | |
82 | 82 | include '_vote_description.php'; |
83 | 83 | |
84 | - } ?> |
|
84 | + } ?> |
|
85 | 85 | </ul> |
86 | 86 | |
87 | 87 | <div class="share-vote-descriptions"> |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | if ( isset($divisions) && $divisions ) { |
39 | 39 | if ($has_voting_record) { |
40 | 40 | foreach ($divisions as $division) { |
41 | - $displayed_votes = TRUE; |
|
41 | + $displayed_votes = TRUE; |
|
42 | 42 | |
43 | - if ($current_date != $division['date']) { |
|
43 | + if ($current_date != $division['date']) { |
|
44 | 44 | if ($current_date != '' ) { |
45 | - print('</ul></div>'); |
|
45 | + print('</ul></div>'); |
|
46 | 46 | } |
47 | 47 | $current_date = $division['date']; |
48 | 48 | $sidebar_links[] = $division['date']; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | <h2><?= strftime('%e %b %Y', strtotime($division['date'])) ?></h2> |
52 | 52 | <ul class="vote-descriptions policy-votes"> |
53 | 53 | <?php } |
54 | - include('_division_description.php'); |
|
54 | + include('_division_description.php'); |
|
55 | 55 | } |
56 | 56 | echo('</div>'); |
57 | 57 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | include '_vote_description.php'; |
81 | 81 | |
82 | - } ?> |
|
82 | + } ?> |
|
83 | 83 | </ul> |
84 | 84 | |
85 | 85 | <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>’s voting record on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>’s full vote analysis page</a> for more.</p> |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | include '_vote_description.php'; |
121 | 121 | |
122 | - } ?> |
|
122 | + } ?> |
|
123 | 123 | </ul> |
124 | 124 | |
125 | 125 | <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>’s voting record on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>’s full vote analysis page</a> for more.</p> |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | include '_vote_description.php'; |
150 | 150 | |
151 | - } ?> |
|
151 | + } ?> |
|
152 | 152 | </ul> |
153 | 153 | |
154 | 154 | <p>We have <b>lots more</b> plain English analysis of <?= $full_name ?>’s voting record on issues like health, welfare, taxation and more. Visit <a href="<?= $member_url ?>/votes"><?= $full_name ?>’s full vote analysis page</a> for more.</p> |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | echo '<?xml version="1.0" encoding="iso-8859-1"?>'; |
30 | 30 | |
31 | - ?> |
|
31 | + ?> |
|
32 | 32 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> |
33 | 33 | <svg width="1000" height="500" viewBox="0 0 1000 500" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" font-family="Droid Sans, Trebuchet"> |
34 | 34 |