| @@ -12,11 +12,11 @@ | ||
| 12 | 12 | |
| 13 | 13 |  class UtilityTest extends UnitTestCase{ | 
| 14 | 14 | |
| 15 | -  public function testVerpEnvelopeSenderCanCreateStandardSender() { | |
| 15 | +    public function testVerpEnvelopeSenderCanCreateStandardSender() { | |
| 16 | 16 |      $sender = twfy_verp_envelope_sender('[email protected]'); | 
| 17 | 17 | $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; | 
| 18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); | 
| 19 | - } | |
| 19 | + } | |
| 20 | 20 | |
| 21 | 21 | } | 
| 22 | 22 | |
| @@ -3,18 +3,18 @@ | ||
| 3 | 3 | * SimpleTest tests for the functions in utility.php | 
| 4 | 4 | * $Id: utility_test.php,v 1.3 2009-06-25 12:23:58 louise Exp $ | 
| 5 | 5 | */ | 
| 6 | -error_reporting (E_ALL); | |
| 6 | +error_reporting(E_ALL); | |
| 7 | 7 |  ini_set("display_errors", 1); | 
| 8 | 8 | include_once dirname(__FILE__) . '/../../../conf/general'; | 
| 9 | 9 | include_once '../utility.php'; | 
| 10 | 10 | include_once 'simpletest/unit_tester.php'; | 
| 11 | 11 | include_once 'simpletest/reporter.php'; | 
| 12 | 12 | |
| 13 | -class UtilityTest extends UnitTestCase{ | |
| 13 | +class UtilityTest extends UnitTestCase { | |
| 14 | 14 | |
| 15 | 15 |    public function testVerpEnvelopeSenderCanCreateStandardSender() { | 
| 16 | 16 |      $sender = twfy_verp_envelope_sender('[email protected]'); | 
| 17 | - $expected_sender = 'twfy+aperson=a.nother.dom@' + EMAILDOMAIN; | |
| 17 | + $expected_sender = 'twfy+aperson=a.nother.dom@' +EMAILDOMAIN; | |
| 18 | 18 | $this->assertEqual($sender, $expected_sender, 'verp_envelope_sender can create a sender for a standard address'); | 
| 19 | 19 | } | 
| 20 | 20 | |
| @@ -32,8 +32,8 @@ | ||
| 32 | 32 | </div> | 
| 33 | 33 | </div> | 
| 34 | 34 |    <?php } else { | 
| 35 | - $section = false; include '_section_content.php'; | |
| 36 | - } ?> | |
| 35 | + $section = false; include '_section_content.php'; | |
| 36 | + } ?> | |
| 37 | 37 | |
| 38 | 38 | </div> | 
| 39 | 39 | |
| @@ -19,11 +19,11 @@ | ||
| 19 | 19 | </div> | 
| 20 | 20 | <div class="full-page"> | 
| 21 | 21 | |
| 22 | -  <?php if ( count($data['rows']) == 0 ) { ?> | |
| 22 | +  <?php if (count($data['rows']) == 0) { ?> | |
| 23 | 23 | <div class="debate-speech"> | 
| 24 | 24 | <div class="full-page__row"> | 
| 25 | 25 | <div class="full-page__unit"> | 
| 26 | -                <?php if ( $current_assembly != 'uk-commons' && $current_assembly != 'uk-lords' ) { ?> | |
| 26 | +                <?php if ($current_assembly != 'uk-commons' && $current_assembly != 'uk-lords') { ?> | |
| 27 | 27 | We only have information about columns for debates in the House of Commons and the House of Lords. | 
| 28 | 28 |                  <?php } else { ?> | 
| 29 | 29 | We can't find anything in column <?= $column ?> on <?= $debate_day_human ?>. | 
| @@ -49,7 +49,7 @@ | ||
| 49 | 49 | <?php } ?> | 
| 50 | 50 | </a> | 
| 51 | 51 | <?php } | 
| 52 | -                  if ( isset($row['excerpt']) ) { ?> | |
| 52 | +                    if ( isset($row['excerpt']) ) { ?> | |
| 53 | 53 | <p class="business-list__excerpt"> | 
| 54 | 54 | <?= trim_characters($row['excerpt'], 0, 200 ) ?> | 
| 55 | 55 | </p> | 
| @@ -6,32 +6,32 @@ discard block | ||
| 6 | 6 | <?= $parent_title ?> | 
| 7 | 7 | </h1> | 
| 8 | 8 | <p class="business-section__header__date"> | 
| 9 | - <?= format_date( $info['date'], LONGERDATEFORMAT ) ?> | |
| 9 | + <?= format_date($info['date'], LONGERDATEFORMAT) ?> | |
| 10 | 10 | </p> | 
| 11 | 11 | </div> | 
| 12 | -      <?php if ( isset($rows) ) { ?> | |
| 12 | +      <?php if (isset($rows)) { ?> | |
| 13 | 13 | <div class="business-section__primary"> | 
| 14 | 14 | <ul class="business-list"> | 
| 15 | 15 | <?php | 
| 16 | 16 | $prevlevel = ''; | 
| 17 | -                foreach ( $rows as $row ) { ?> | |
| 18 | -                <?php if ( $row['htype'] == 10 ) { | |
| 19 | -                    if ( $prevlevel == 'sub' ) { ?> | |
| 17 | +                foreach ($rows as $row) { ?> | |
| 18 | +                <?php if ($row['htype'] == 10) { | |
| 19 | +                    if ($prevlevel == 'sub') { ?> | |
| 20 | 20 | </ul> | 
| 21 | 21 | </li> | 
| 22 | -                    <?php } elseif ( $prevlevel == 'top' ) { ?> | |
| 22 | +                    <?php } elseif ($prevlevel == 'top') { ?> | |
| 23 | 23 | </li> | 
| 24 | 24 | <?php } ?> | 
| 25 | 25 | <li> | 
| 26 | 26 |                  <?php } else { | 
| 27 | -                    if ( $prevlevel == '' ) { ?> | |
| 27 | +                    if ($prevlevel == '') { ?> | |
| 28 | 28 | <li> | 
| 29 | -                    <?php } elseif ( $prevlevel == 'top' ) { ?> | |
| 29 | +                    <?php } elseif ($prevlevel == 'top') { ?> | |
| 30 | 30 | <ul> | 
| 31 | 31 | <li> | 
| 32 | 32 | <?php } ?> | 
| 33 | 33 | <?php } ?> | 
| 34 | -                  <?php if ( isset($row['excerpt']) && strstr($row['excerpt'], "was asked—") ) { ?> | |
| 34 | +                  <?php if (isset($row['excerpt']) && strstr($row['excerpt'], "was asked—")) { ?> | |
| 35 | 35 | <div class="business-list__title"> | 
| 36 | 36 | <h3> | 
| 37 | 37 | <?= $row['body'] ?> | 
| @@ -42,26 +42,26 @@ discard block | ||
| 42 | 42 | <h3> | 
| 43 | 43 | <?= $row['body'] ?> | 
| 44 | 44 | </h3> | 
| 45 | -                      <?php if ( isset($row['contentcount']) && $row['contentcount'] > 0 ) { ?> | |
| 45 | +                      <?php if (isset($row['contentcount']) && $row['contentcount'] > 0) { ?> | |
| 46 | 46 | <span class="business-list__meta"> | 
| 47 | 47 |                              <?= sprintf(ngettext('%s speech', '%s speeches', $row['contentcount']), $row['contentcount']) ?> | 
| 48 | 48 | </span> | 
| 49 | 49 | <?php } ?> | 
| 50 | 50 | </a> | 
| 51 | 51 | <?php } | 
| 52 | -                  if ( isset($row['excerpt']) ) { ?> | |
| 52 | +                  if (isset($row['excerpt'])) { ?> | |
| 53 | 53 | <p class="business-list__excerpt"> | 
| 54 | - <?= trim_characters($row['excerpt'], 0, 200 ) ?> | |
| 54 | + <?= trim_characters($row['excerpt'], 0, 200) ?> | |
| 55 | 55 | </p> | 
| 56 | 56 | <?php } ?> | 
| 57 | -                <?php if ( $row['htype'] == 10 ) { | |
| 57 | +                <?php if ($row['htype'] == 10) { | |
| 58 | 58 | $prevlevel = 'top'; | 
| 59 | 59 |                  } else { | 
| 60 | 60 | $prevlevel = 'sub'; ?> | 
| 61 | 61 | </li> | 
| 62 | 62 | <?php } ?> | 
| 63 | 63 | <?php } ?> | 
| 64 | -                <?php if ( $prevlevel == 'sub' ) { ?> | |
| 64 | +                <?php if ($prevlevel == 'sub') { ?> | |
| 65 | 65 | </ul> | 
| 66 | 66 | </li> | 
| 67 | 67 | <?php } ?> | 
| @@ -58,10 +58,12 @@ | ||
| 58 | 58 | to <a href="<?= $member_url ?>/votes">see all their votes</a>. | 
| 59 | 59 | </p> | 
| 60 | 60 | |
| 61 | - <?php else: ?> | |
| 61 | +              <?php else { | |
| 62 | + : ?> | |
| 62 | 63 | <ul class="vote-descriptions"> | 
| 63 | 64 | <?php | 
| 64 | 65 | $policy_ids = array(); | 
| 66 | +} | |
| 65 | 67 | |
| 66 | 68 |                    foreach ($positions as $position) { | 
| 67 | 69 |                        if (!in_array($position['policy_id'], $policy_ids)) { | 
| @@ -61,23 +61,23 @@ | ||
| 61 | 61 | <?php else: ?> | 
| 62 | 62 | <ul class="vote-descriptions"> | 
| 63 | 63 | <?php | 
| 64 | - $policy_ids = array(); | |
| 65 | - | |
| 66 | -                  foreach ($positions as $position) { | |
| 67 | -                      if (!in_array($position['policy_id'], $policy_ids)) { | |
| 68 | - $description = ucfirst($position['desc']); | |
| 69 | - $link = sprintf( | |
| 70 | - '%s/divisions?policy=%s', | |
| 71 | - $member_url, | |
| 72 | - $position['policy_id'] | |
| 73 | - ); | |
| 74 | - $link_text = $position['position'] != 'has never voted on' ? 'Show votes' : 'Details'; | |
| 75 | - $key_vote = $position; | |
| 76 | - include(dirname(__DIR__) . '/mp/_vote_description.php'); | |
| 77 | - | |
| 78 | - $policy_ids[] = $position['policy_id']; | |
| 79 | - } | |
| 80 | - } ?> | |
| 64 | + $policy_ids = array(); | |
| 65 | + | |
| 66 | +                    foreach ($positions as $position) { | |
| 67 | +                        if (!in_array($position['policy_id'], $policy_ids)) { | |
| 68 | + $description = ucfirst($position['desc']); | |
| 69 | + $link = sprintf( | |
| 70 | + '%s/divisions?policy=%s', | |
| 71 | + $member_url, | |
| 72 | + $position['policy_id'] | |
| 73 | + ); | |
| 74 | + $link_text = $position['position'] != 'has never voted on' ? 'Show votes' : 'Details'; | |
| 75 | + $key_vote = $position; | |
| 76 | + include(dirname(__DIR__) . '/mp/_vote_description.php'); | |
| 77 | + | |
| 78 | + $policy_ids[] = $position['policy_id']; | |
| 79 | + } | |
| 80 | + } ?> | |
| 81 | 81 | </ul> | 
| 82 | 82 | |
| 83 | 83 | <?php endif; ?> | 
| @@ -67,4 +67,4 @@ | ||
| 67 | 67 | api_output($out); | 
| 68 | 68 |  } else { | 
| 69 | 69 |      api_error('Nothing'); | 
| 70 | - } | |
| 70 | + } | |
| @@ -12,7 +12,7 @@ | ||
| 12 | 12 | |
| 13 | 13 | $out = array(); | 
| 14 | 14 |  if (isset ($data['rows'])) { | 
| 15 | -    for ($i=0; $i<count($data['rows']); $i++) { | |
| 15 | +    for ($i = 0; $i < count($data['rows']); $i++) { | |
| 16 | 16 | $row = $data['rows'][$i]; | 
| 17 | 17 |          if (count($row) == 0) { | 
| 18 | 18 | continue; | 
| @@ -11,7 +11,7 @@ discard block | ||
| 11 | 11 | |
| 12 | 12 |  if (isset ($data['rows'])) { | 
| 13 | 13 | $out = array(); | 
| 14 | -    for ($i=0; $i<count($data['rows']); $i++) { | |
| 14 | +    for ($i = 0; $i < count($data['rows']); $i++) { | |
| 15 | 15 | $row = $data['rows'][$i]; | 
| 16 | 16 | |
| 17 | 17 |          if ($row['htype'] == '10' && isset($row['excerpt']) && strstr($row['excerpt'], "was asked—")) { | 
| @@ -40,7 +40,7 @@ discard block | ||
| 40 | 40 |          if ($row['htype'] == '10') { | 
| 41 | 41 |              $out[] = array('entry' => $entry, 'subs' => array()); | 
| 42 | 42 |          } else { | 
| 43 | - $out[sizeof($out)-1]['subs'][] = $entry; | |
| 43 | + $out[sizeof($out) - 1]['subs'][] = $entry; | |
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | 46 | } | 
| @@ -16,8 +16,9 @@ discard block | ||
| 16 | 16 |  $email = get_http_var('email'); | 
| 17 | 17 |  $sign = get_http_var('sign'); | 
| 18 | 18 |  $pid = get_http_var('pid'); | 
| 19 | -if (!$pid || !ctype_digit($pid)) print 'not valid'; | |
| 20 | -else { | |
| 19 | +if (!$pid || !ctype_digit($pid)) { | |
| 20 | + print 'not valid'; | |
| 21 | +} else { | |
| 21 | 22 | $authed = auth_verify_with_shared_secret($email, OPTION_AUTH_SHARED_SECRET, $sign); | 
| 22 | 23 |      if ($authed) { | 
| 23 | 24 | $db = new ParlDB; | 
| @@ -26,10 +27,11 @@ discard block | ||
| 26 | 27 | ':criteria' => 'speaker:' . $pid | 
| 27 | 28 | )); | 
| 28 | 29 | $already_signed = $q->rows(); | 
| 29 | - if ($already_signed) | |
| 30 | - print "already signed"; | |
| 31 | - else | |
| 32 | - print "not signed"; | |
| 30 | +        if ($already_signed) { | |
| 31 | + print "already signed"; | |
| 32 | +        } else { | |
| 33 | + print "not signed"; | |
| 34 | + } | |
| 33 | 35 |      } else { | 
| 34 | 36 | print "not authed"; | 
| 35 | 37 | } | 
| @@ -38,10 +38,10 @@ | ||
| 38 | 38 | <p>There are <b><?=number_format($debate_speeches)?></b> debate speeches (<?=number_format($debate_items)?> items including headers). | 
| 39 | 39 | <br>There are <b><?=number_format($wrans_questions)?></b> written questions (<?=number_format($wrans_items)?> items including headers and answers). | 
| 40 | 40 | |
| 41 | -<!-- Debate items / in-session day: <?=round($debate_items/$uniquedates,0)?> | |
| 42 | -Wrans items / in-session day: <?=round($wrans_items/$uniquedates,0)?> --> | |
| 41 | +<!-- Debate items / in-session day: <?=round($debate_items / $uniquedates, 0)?> | |
| 42 | +Wrans items / in-session day: <?=round($wrans_items / $uniquedates, 0)?> --> | |
| 43 | 43 | |
| 44 | -<p>Per sitting day, MPs are producing <b><?=round($debate_speeches/$uniquedates,0)?></b> speeches, and <b><?=round($wrans_questions/$uniquedates,0)?></b> written answers. | |
| 44 | +<p>Per sitting day, MPs are producing <b><?=round($debate_speeches / $uniquedates, 0)?></b> speeches, and <b><?=round($wrans_questions / $uniquedates, 0)?></b> written answers. | |
| 45 | 45 | </p> | 
| 46 | 46 | |
| 47 | 47 | <?php | 
| @@ -6,7 +6,7 @@ | ||
| 6 | 6 | |
| 7 | 7 | $DATA->set_page_metadata($this_page, 'title', 'Hansard'); | 
| 8 | 8 | $DATA->set_page_metadata($this_page, 'meta_description', | 
| 9 | - 'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.'); | |
| 9 | + 'Find the complete Hansard on TheyWorkForYou.com - transcripts from all UK parliamentary debates in easily-searchable form.'); | |
| 10 | 10 | $DATA->set_page_metadata($this_page, 'meta_keywords', "hansard, search hansard, hansard transcriptions, hansard record, parliamentary transcripts, parliament transcripts, parliament records, uk hansard, hansard uk, house of commons transcript, house of commons debates, house of commons records"); | 
| 11 | 11 | |
| 12 | 12 | $PAGE->supress_heading = true; |