@@ -9,8 +9,8 @@ |
||
| 9 | 9 | <div class="search-page__section search-page__section--results"> |
| 10 | 10 | <div class="search-page__section__primary"> |
| 11 | 11 | <?php |
| 12 | - # XXX Hack |
|
| 13 | - if (preg_match('#budget#', $searchstring)) { ?> |
|
| 12 | + # XXX Hack |
|
| 13 | + if (preg_match('#budget#', $searchstring)) { ?> |
|
| 14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
| 15 | 15 | <?php } ?> |
| 16 | 16 | |
@@ -1,11 +1,11 @@ discard block |
||
| 1 | 1 | <div class="full-page"> |
| 2 | - <div class="full-page__row search-page <?php if ( !$searchstring ) { ?>search-page--blank<?php } ?>"> |
|
| 2 | + <div class="full-page__row search-page <?php if (!$searchstring) { ?>search-page--blank<?php } ?>"> |
|
| 3 | 3 | |
| 4 | 4 | <form class="js-search-form-without-options"> |
| 5 | 5 | <?php include 'form_main.php'; ?> |
| 6 | 6 | </form> |
| 7 | 7 | |
| 8 | - <?php if ( $searchstring && !isset($warnings) ) { ?> |
|
| 8 | + <?php if ($searchstring && !isset($warnings)) { ?> |
|
| 9 | 9 | <div class="search-page__section search-page__section--results"> |
| 10 | 10 | <div class="search-page__section__primary"> |
| 11 | 11 | <?php |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | <h3 class="search-result__title"><a href="https://www.theyworkforyou.com/debates/?id=2017-11-22a.1045.3">Read the Budget speech and debate</a></h3> |
| 15 | 15 | <?php } ?> |
| 16 | 16 | |
| 17 | - <?php if ( $cons ) { ?> |
|
| 18 | - <?php if ( count($cons) > 1 ) { |
|
| 17 | + <?php if ($cons) { ?> |
|
| 18 | + <?php if (count($cons) > 1) { |
|
| 19 | 19 | $types = array(); |
| 20 | - if ( $mp_types['mp'] > 0 ) { |
|
| 20 | + if ($mp_types['mp'] > 0) { |
|
| 21 | 21 | $types[] = 'MPs'; |
| 22 | 22 | } |
| 23 | - if ( $mp_types['former'] > 0 ) { |
|
| 23 | + if ($mp_types['former'] > 0) { |
|
| 24 | 24 | $types[] = 'former MPs'; |
| 25 | 25 | } |
| 26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
@@ -29,14 +29,14 @@ discard block |
||
| 29 | 29 | <?php } else { // count($cons) <= 1 ?> |
| 30 | 30 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
| 31 | 31 | <?php } ?> |
| 32 | - <?php foreach ( $cons as $member ) { ?> |
|
| 32 | + <?php foreach ($cons as $member) { ?> |
|
| 33 | 33 | <?php include('person.php'); ?> |
| 34 | 34 | <?php } ?> |
| 35 | 35 | <?php } ?> |
| 36 | 36 | |
| 37 | - <?php if ( $members ) { ?> |
|
| 37 | + <?php if ($members) { ?> |
|
| 38 | 38 | <h2>People matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
| 39 | - <?php foreach ( $members as $member ) { ?> |
|
| 39 | + <?php foreach ($members as $member) { ?> |
|
| 40 | 40 | <?php include('person.php'); ?> |
| 41 | 41 | <?php } ?> |
| 42 | 42 | <hr> |
@@ -44,25 +44,25 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | <?php if ($glossary) { ?> |
| 46 | 46 | <h2>Glossary items matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
| 47 | - <?php foreach ( $glossary as $item ) { ?> |
|
| 47 | + <?php foreach ($glossary as $item) { ?> |
|
| 48 | 48 | <?php include('glossary.php'); ?> |
| 49 | 49 | <?php } ?> |
| 50 | 50 | <hr> |
| 51 | 51 | <?php } ?> |
| 52 | 52 | |
| 53 | - <?php if ( isset($pid) && $wtt == 2 ) { ?> |
|
| 53 | + <?php if (isset($pid) && $wtt == 2) { ?> |
|
| 54 | 54 | <p>I want to <a href="https://www.writetothem.com/lords/?pid=<?= $pid ?>">write to <?= $wtt_lord_name ?></a></p> |
| 55 | 55 | <?php } ?> |
| 56 | 56 | |
| 57 | - <?php if ( isset($error) ) { ?> |
|
| 57 | + <?php if (isset($error)) { ?> |
|
| 58 | 58 | There was an error – <?= $error ?> – searching for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em>. |
| 59 | 59 | <?php } else { ?> |
| 60 | 60 | <h2> |
| 61 | - <?php if ( $pagination_links ) { ?> |
|
| 61 | + <?php if ($pagination_links) { ?> |
|
| 62 | 62 | Results <?= $pagination_links['first_result'] ?>–<?= $pagination_links['last_result'] ?> of <?= $info['total_results'] ?> |
| 63 | - <?php } else if ( $info['total_results'] == 1 ) { ?> |
|
| 63 | + <?php } else if ($info['total_results'] == 1) { ?> |
|
| 64 | 64 | The only result |
| 65 | - <?php } else if ( $info['total_results'] == 0 ) { ?> |
|
| 65 | + <?php } else if ($info['total_results'] == 0) { ?> |
|
| 66 | 66 | There were no results |
| 67 | 67 | <?php } else { ?> |
| 68 | 68 | All <?= $info['total_results'] ?> results |
@@ -70,16 +70,16 @@ discard block |
||
| 70 | 70 | for <em class="current-search-term"><?= _htmlentities($searchdescription) ?></em> |
| 71 | 71 | </h2> |
| 72 | 72 | |
| 73 | - <?php if ( $info['spelling_correction'] ) { ?> |
|
| 74 | - <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities( $info['spelling_correction_display'] ) ?></a>?</p> |
|
| 73 | + <?php if ($info['spelling_correction']) { ?> |
|
| 74 | + <p>Did you mean <a href="/search/?q=<?= urlencode($info['spelling_correction']) ?>"><?= _htmlentities($info['spelling_correction_display']) ?></a>?</p> |
|
| 75 | 75 | <?php } ?> |
| 76 | 76 | |
| 77 | - <?php if ( $info['total_results'] ) { ?> |
|
| 77 | + <?php if ($info['total_results']) { ?> |
|
| 78 | 78 | <ul class="search-result-display-options"> |
| 79 | - <?php if ( $sort_order == 'relevance' ) { ?> |
|
| 79 | + <?php if ($sort_order == 'relevance') { ?> |
|
| 80 | 80 | <li>Sorted by relevance</li> |
| 81 | 81 | <li>Sort by date: <a href="<?= $urls['newest'] ?>">newest</a> / <a href="<?= $urls['oldest'] ?>">oldest</a></li> |
| 82 | - <?php } else if ( $sort_order == 'oldest' ) { ?> |
|
| 82 | + <?php } else if ($sort_order == 'oldest') { ?> |
|
| 83 | 83 | <li>Sort by <a href="<?= $urls['relevance'] ?>">relevance</a></li> |
| 84 | 84 | <li>Sorted by date: <a href="<?= $urls['newest'] ?>">newest</a> / oldest</li> |
| 85 | 85 | <?php } else { ?> |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | </ul> |
| 91 | 91 | <?php } ?> |
| 92 | 92 | |
| 93 | - <?php foreach ( $rows as $result ) { ?> |
|
| 93 | + <?php foreach ($rows as $result) { ?> |
|
| 94 | 94 | <div class="search-result search-result--generic"> |
| 95 | 95 | <h3 class="search-result__title"><a href="<?= $result['listurl'] ?>"><?= $result['parent']['body'] ?></a> (<?= format_date($result['hdate'], SHORTDATEFORMAT) ?>)</h3> |
| 96 | 96 | <p class="search-result__description"><?= isset($result['speaker']) ? $result['speaker']['name'] . ': ' : '' ?><?= $result['extract'] ?></p> |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | <hr> |
| 101 | 101 | |
| 102 | - <?php if ( $pagination_links ) { ?> |
|
| 102 | + <?php if ($pagination_links) { ?> |
|
| 103 | 103 | <div class="search-result-pagination"> |
| 104 | - <?php if ( isset($pagination_links['prev']) ) { ?> |
|
| 104 | + <?php if (isset($pagination_links['prev'])) { ?> |
|
| 105 | 105 | <a href="<?= $pagination_links['firstpage']['url'] ?>" title="First page"><<</a> |
| 106 | 106 | <a href="<?= $pagination_links['prev']['url'] ?>" title="Previous page"><</a> |
| 107 | 107 | <?php } ?> |
| 108 | - <?php foreach ( $pagination_links['nums'] as $link ) { ?> |
|
| 108 | + <?php foreach ($pagination_links['nums'] as $link) { ?> |
|
| 109 | 109 | <a href="<?= $link['url'] ?>"<?= $link['current'] ? ' class="search-result-pagination__current-page"' : '' ?>><?= $link['page'] ?></a> |
| 110 | 110 | <?php } ?> |
| 111 | - <?php if ( isset($pagination_links['next']) ) { ?> |
|
| 111 | + <?php if (isset($pagination_links['next'])) { ?> |
|
| 112 | 112 | <a href="<?= $pagination_links['next']['url'] ?>" title="Next page">></a> |
| 113 | 113 | <a href="<?= $pagination_links['lastpage']['url'] ?>" title="Final page">>></a> |
| 114 | 114 | <?php } ?> |
@@ -26,7 +26,8 @@ |
||
| 26 | 26 | $desc = ucfirst(implode(' and ', $types)); |
| 27 | 27 | ?> |
| 28 | 28 | <h2><?= $desc ?> in constituencies matching <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
| 29 | - <?php } else { // count($cons) <= 1 ?> |
|
| 29 | + <?php } else { |
|
| 30 | +// count($cons) <= 1 ?> |
|
| 30 | 31 | <h2><?= $mp_types['former'] ? 'Former ' : '' ?>MP for <em class="current-search-term"><?= _htmlentities($searchstring) ?></em></h2> |
| 31 | 32 | <?php } ?> |
| 32 | 33 | <?php foreach ( $cons as $member ) { ?> |
@@ -33,10 +33,10 @@ discard block |
||
| 33 | 33 | if ($hide_question) { |
| 34 | 34 | $always_ask = 0; |
| 35 | 35 | $show_survey_qn = $current_question; |
| 36 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
| 36 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
| 37 | 37 | } elseif ($has_answered_question == $current_question && !$always_ask) { |
| 38 | 38 | $show_survey_qn = $current_question; |
| 39 | - setcookie('survey', $current_question, time()+60*60*24*365, '/'); |
|
| 39 | + setcookie('survey', $current_question, time() + 60 * 60 * 24 * 365, '/'); |
|
| 40 | 40 | } elseif (isset($_COOKIE['survey'])) { |
| 41 | 41 | $show_survey_qn = $_COOKIE['survey']; |
| 42 | 42 | } |
@@ -49,16 +49,16 @@ discard block |
||
| 49 | 49 | if ($show_survey_qn < $current_question && !$has_answered_question) { |
| 50 | 50 | $page_url = ''; |
| 51 | 51 | $hide_url = ''; |
| 52 | - if ( in_array( $this_page, array('mp', 'peer', 'msp', 'mla', 'royal') ) ) { |
|
| 52 | + if (in_array($this_page, array('mp', 'peer', 'msp', 'mla', 'royal'))) { |
|
| 53 | 53 | global $MEMBER; |
| 54 | 54 | $page_url = $MEMBER->url(true) . "?answered_survey=$current_question"; |
| 55 | 55 | $hide_url = $MEMBER->url() . "?hide_survey=$current_question"; |
| 56 | 56 | } else { |
| 57 | 57 | $URL = new \MySociety\TheyWorkForYou\Url($this_page); |
| 58 | - $URL->insert(array('answered_survey' => $current_question )); |
|
| 58 | + $URL->insert(array('answered_survey' => $current_question)); |
|
| 59 | 59 | $page_url = 'https://' . DOMAIN . $URL->generate(); |
| 60 | 60 | $URL = new \MySociety\TheyWorkForYou\Url($this_page); |
| 61 | - $URL->insert(array('hide_survey' => $current_question )); |
|
| 61 | + $URL->insert(array('hide_survey' => $current_question)); |
|
| 62 | 62 | $hide_url = $URL->generate(); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | $anchor = '#addcomment'; |
| 21 | 21 | |
| 22 | 22 | $URL = new \MySociety\TheyWorkForYou\Url('userjoin'); |
| 23 | -$URL->insert(array('ret'=>$returl.$anchor)); |
|
| 23 | +$URL->insert(array('ret'=>$returl . $anchor)); |
|
| 24 | 24 | $joinurl = $URL->generate(); |
| 25 | 25 | |
| 26 | 26 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | $HANSARDURL = new \MySociety\TheyWorkForYou\Url('hansard'); |
| 73 | 73 | $MPURL = new \MySociety\TheyWorkForYou\Url('yourmp'); |
| 74 | 74 | |
| 75 | -$PAGE->block_start(array ('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:')); |
|
| 75 | +$PAGE->block_start(array('id'=>'intro', 'title'=>'Election special! Find out how they performed for YOU:')); |
|
| 76 | 76 | ?> |
| 77 | 77 | <ol> |
| 78 | 78 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } else { |
| 90 | 90 | $CHANGEURL = new \MySociety\TheyWorkForYou\Url('userchangepc'); |
| 91 | 91 | } |
| 92 | - $MEMBER = new MEMBER(array ('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
|
| 92 | + $MEMBER = new MEMBER(array('postcode'=>$THEUSER->postcode(), 'house'=>1)); |
|
| 93 | 93 | $mpname = $MEMBER->full_name(); |
| 94 | 94 | ?> |
| 95 | 95 | <p><a href="<?php echo $MPURL->generate(); ?>"><strong>Find out more about how <?php echo $mpname; ?>, your ex-MP, represented you over the last parliament</strong></a><br> |
@@ -185,11 +185,11 @@ discard block |
||
| 185 | 185 | //$PAGE->block_end(); |
| 186 | 186 | |
| 187 | 187 | $PAGE->stripe_end(array( |
| 188 | - array ( |
|
| 188 | + array( |
|
| 189 | 189 | 'type' => 'include', |
| 190 | 190 | 'content' => 'whatisthissite' |
| 191 | 191 | ), |
| 192 | - array ( |
|
| 192 | + array( |
|
| 193 | 193 | 'type' => 'include', |
| 194 | 194 | 'content' => 'sitenews_recent' |
| 195 | 195 | ) |
@@ -21,7 +21,8 @@ discard block |
||
| 21 | 21 | if ($pc) { |
| 22 | 22 | # current will have WMC key. If Scottish, has SPC and SPE too. If NI, has NIE. |
| 23 | 23 | $mapit = mapit_call('postcode', $pc); |
| 24 | - if (is_object($mapit)) { # RABX error returns an object |
|
| 24 | + if (is_object($mapit)) { |
|
| 25 | +# RABX error returns an object |
|
| 25 | 26 | print '<p class="error">Afraid we couldn’t find that postcode.</p>'; |
| 26 | 27 | $pc = ''; |
| 27 | 28 | } |
@@ -134,8 +135,11 @@ discard block |
||
| 134 | 135 | <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php |
| 135 | 136 | foreach ($mreg as $k => $n) { |
| 136 | 137 | print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>"; |
| 137 | - if ($k < count($mreg)-2) print ', '; |
|
| 138 | - elseif ($k == count($mreg)-2) print ' and '; |
|
| 138 | + if ($k < count($mreg)-2) { |
|
| 139 | + print ', '; |
|
| 140 | + } elseif ($k == count($mreg)-2) { |
|
| 141 | + print ' and '; |
|
| 142 | + } |
|
| 139 | 143 | } |
| 140 | 144 | echo '.</li>'; |
| 141 | 145 | } elseif ($country == 'N') { |
@@ -134,8 +134,8 @@ |
||
| 134 | 134 | <li>You were in the <strong><?=$current['SPC']?></strong> constituency, in the <strong><?=$current['SPE']?></strong> region; your constituency MSP was <a href='<?=$mp_url?>'><?=$name?></a>, and your regional MSPs were <?php |
| 135 | 135 | foreach ($mreg as $k => $n) { |
| 136 | 136 | print "<a href='/msp/" . make_member_url($n, '', 4) . "'>$n</a>"; |
| 137 | - if ($k < count($mreg)-2) print ', '; |
|
| 138 | - elseif ($k == count($mreg)-2) print ' and '; |
|
| 137 | + if ($k < count($mreg) - 2) print ', '; |
|
| 138 | + elseif ($k == count($mreg) - 2) print ' and '; |
|
| 139 | 139 | } |
| 140 | 140 | echo '.</li>'; |
| 141 | 141 | } elseif ($country == 'N') { |
@@ -148,10 +148,10 @@ |
||
| 148 | 148 | <p class="meta"><?php |
| 149 | 149 | $meta_items = array(); |
| 150 | 150 | $meta_items[] = $events[$i]['debate_type']; |
| 151 | - if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ){ |
|
| 151 | + if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ) { |
|
| 152 | 152 | $times = format_time($events[$i]['time_start'], 'g:i a'); |
| 153 | 153 | |
| 154 | - if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ){ |
|
| 154 | + if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ) { |
|
| 155 | 155 | $times = $times . ' - ' . format_time($events[$i]['time_end'], 'g:i a'); |
| 156 | 156 | } |
| 157 | 157 | $meta_items[] = $times; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | <div class="panel panel--flushtop clearfix"> |
| 46 | 46 | <div class="row nested-row"> |
| 47 | 47 | <div class="homepage-in-the-news homepage-content-section"> |
| 48 | - <?php if ( count($featured) > 0 ) { |
|
| 48 | + <?php if (count($featured) > 0) { |
|
| 49 | 49 | include 'homepage/featured.php'; |
| 50 | 50 | } else { ?> |
| 51 | 51 | No debates found. |
@@ -110,14 +110,14 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | <h2>Recently in Parliament</h2> |
| 112 | 112 | <ul class="recently__list"><?php |
| 113 | - foreach ( $debates['recent'] as $recent ) { |
|
| 113 | + foreach ($debates['recent'] as $recent) { |
|
| 114 | 114 | include 'homepage/recent-debates.php'; |
| 115 | 115 | } |
| 116 | 116 | ?></ul> |
| 117 | 117 | </div> |
| 118 | 118 | <div class="homepage-upcoming homepage-content-section"> |
| 119 | 119 | <h2>Upcoming</h2> |
| 120 | - <?php if ( count($calendar) ) { ?> |
|
| 120 | + <?php if (count($calendar)) { ?> |
|
| 121 | 121 | <div class="upcoming__controls"> |
| 122 | 122 | <!-- |
| 123 | 123 | These controls should make the upcoming section slide to the next day. |
@@ -136,24 +136,24 @@ discard block |
||
| 136 | 136 | </div> |
| 137 | 137 | </div> |
| 138 | 138 | <?php $first = true; $count = 0; |
| 139 | - foreach ( $calendar as $date => $places ) { |
|
| 139 | + foreach ($calendar as $date => $places) { |
|
| 140 | 140 | $count++; ?> |
| 141 | 141 | <div class="cal-wrapper <?= $first ? 'visible' : 'hidden' ?>" id="day-<?= $count ?>" data-count="<?= $count ?>" data-date="<?= format_date($date, SHORTDATEFORMAT); ?>"> |
| 142 | 142 | <?php foreach ($places as $place => $events) { ?> |
| 143 | 143 | <?php $first = false; ?> |
| 144 | 144 | <h3><?= $place ?></h3> |
| 145 | 145 | <ul class="upcoming__list"> |
| 146 | - <?php for ( $i = 0; $i < 3; $i++ ) { |
|
| 147 | - if ( isset( $events[$i] ) ) { ?> |
|
| 146 | + <?php for ($i = 0; $i < 3; $i++) { |
|
| 147 | + if (isset($events[$i])) { ?> |
|
| 148 | 148 | <li> |
| 149 | 149 | <h4 class="upcoming__title"><a href="<?= $events[$i]['link_external'] ?>"><?= $events[$i]['title'] ?></a></h4> |
| 150 | 150 | <p class="meta"><?php |
| 151 | 151 | $meta_items = array(); |
| 152 | 152 | $meta_items[] = $events[$i]['debate_type']; |
| 153 | - if( isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00' ){ |
|
| 153 | + if (isset($events[$i]['time_start']) && $events[$i]['time_start'] != '00:00:00') { |
|
| 154 | 154 | $times = format_time($events[$i]['time_start'], 'g:i a'); |
| 155 | 155 | |
| 156 | - if( isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00' ){ |
|
| 156 | + if (isset($events[$i]['time_end']) && $events[$i]['time_end'] != '00:00:00') { |
|
| 157 | 157 | $times = $times . ' - ' . format_time($events[$i]['time_end'], 'g:i a'); |
| 158 | 158 | } |
| 159 | 159 | $meta_items[] = $times; |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | <?php } ?> |
| 166 | 166 | <?php } ?> |
| 167 | 167 | </ul> |
| 168 | - <?php if ( count($events) - 3 > 0 ) { ?> |
|
| 168 | + <?php if (count($events) - 3 > 0) { ?> |
|
| 169 | 169 | <a href="/calendar/?d=<?= format_date($date, 'Y-m-d') ?>" class="upcoming__more">And <?= count($events) - 3 ?> more</a><!-- (just links to relevant upcoming page) --> |
| 170 | 170 | <?php } ?> |
| 171 | 171 | <?php } ?> |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | <?php } ?> |
| 174 | 174 | <?php } else { |
| 175 | 175 | list($recess, $from, $to) = recess_prettify(date('j'), date('n'), date('Y'), 1); |
| 176 | - if ( $recess ) { ?> |
|
| 176 | + if ($recess) { ?> |
|
| 177 | 177 | <p> |
| 178 | 178 | Parliament is on holiday until <?= format_date($to, LONGERDATEFORMAT) ?>. |
| 179 | 179 | Follow us on <a href="https://twitter.com/theyworkforyou">Twitter</a> and you'll |
@@ -99,8 +99,9 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | # See if already matched a string this one is contained within |
| 101 | 101 | foreach ($matched as $got) { |
| 102 | - if (strstr($got, $phrase)) |
|
| 103 | - continue 2; |
|
| 102 | + if (strstr($got, $phrase)) { |
|
| 103 | + continue 2; |
|
| 104 | + } |
|
| 104 | 105 | } |
| 105 | 106 | |
| 106 | 107 | twfy_debug("WIKIPEDIA", "Matched '$phrase'"); |
@@ -119,8 +120,9 @@ discard block |
||
| 119 | 120 | array_push($matched, $phrase); |
| 120 | 121 | } |
| 121 | 122 | |
| 122 | - if (!$was_array) |
|
| 123 | - $source = join('|||', $source); |
|
| 123 | + if (!$was_array) { |
|
| 124 | + $source = join('|||', $source); |
|
| 125 | + } |
|
| 124 | 126 | |
| 125 | 127 | return $source; |
| 126 | 128 | |
@@ -148,28 +150,26 @@ discard block |
||
| 148 | 150 | { |
| 149 | 151 | $nextopen = strpos( $content, '<', $walker ); |
| 150 | 152 | $nextclose = strpos( $content, '>', $walker ); |
| 151 | - if( $nextclose === false ) |
|
| 152 | - { // ERROR! Open waka without close waka! |
|
| 153 | + if( $nextclose === false ) { |
|
| 154 | +// ERROR! Open waka without close waka! |
|
| 153 | 155 | // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
| 154 | 156 | return $content; |
| 155 | 157 | } |
| 156 | - if( $nextopen === false || $nextopen > $nextclose ) |
|
| 157 | - { // No more opens, but there was a close; or, a close happens before the next open. |
|
| 158 | + if( $nextopen === false || $nextopen > $nextclose ) { |
|
| 159 | +// No more opens, but there was a close; or, a close happens before the next open. |
|
| 158 | 160 | // walker goes to the close+1, and open decrements |
| 159 | 161 | $open --; |
| 160 | 162 | $walker = $nextclose + 1; |
| 161 | - } |
|
| 162 | - elseif( $nextopen < $nextclose ) |
|
| 163 | - { // an open before the next close |
|
| 163 | + } elseif( $nextopen < $nextclose ) { |
|
| 164 | +// an open before the next close |
|
| 164 | 165 | $open ++; |
| 165 | 166 | $walker = $nextopen + 1; |
| 166 | 167 | } |
| 167 | 168 | } |
| 168 | 169 | $tagend = $walker; |
| 169 | - if( $tagend > strlen( $content ) ) |
|
| 170 | - $tagend = strlen( $content ); |
|
| 171 | - else |
|
| 172 | - { |
|
| 170 | + if( $tagend > strlen( $content ) ) { |
|
| 171 | + $tagend = strlen( $content ); |
|
| 172 | + } else { |
|
| 173 | 173 | $tagend --; |
| 174 | 174 | $tagstart ++; |
| 175 | 175 | } |
@@ -136,61 +136,61 @@ |
||
| 136 | 136 | |
| 137 | 137 | public static function antiTagInTag($content = '', $format = 'htmlhead') |
| 138 | 138 | { |
| 139 | - $tagend = -1; |
|
| 140 | - for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
| 139 | + $tagend = -1; |
|
| 140 | + for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
| 141 | 141 | { |
| 142 | - // got the start of a tag. Now find the proper end! |
|
| 143 | - $walker = $tagstart + 1; |
|
| 144 | - $open = 1; |
|
| 145 | - while( $open != 0 && $walker < strlen( $content ) ) |
|
| 142 | + // got the start of a tag. Now find the proper end! |
|
| 143 | + $walker = $tagstart + 1; |
|
| 144 | + $open = 1; |
|
| 145 | + while( $open != 0 && $walker < strlen( $content ) ) |
|
| 146 | 146 | { |
| 147 | - $nextopen = strpos( $content, '<', $walker ); |
|
| 148 | - $nextclose = strpos( $content, '>', $walker ); |
|
| 149 | - if( $nextclose === false ) |
|
| 147 | + $nextopen = strpos( $content, '<', $walker ); |
|
| 148 | + $nextclose = strpos( $content, '>', $walker ); |
|
| 149 | + if( $nextclose === false ) |
|
| 150 | 150 | { // ERROR! Open waka without close waka! |
| 151 | - // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
|
| 152 | - return $content; |
|
| 151 | + // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
|
| 152 | + return $content; |
|
| 153 | 153 | } |
| 154 | - if( $nextopen === false || $nextopen > $nextclose ) |
|
| 154 | + if( $nextopen === false || $nextopen > $nextclose ) |
|
| 155 | 155 | { // No more opens, but there was a close; or, a close happens before the next open. |
| 156 | - // walker goes to the close+1, and open decrements |
|
| 157 | - $open --; |
|
| 158 | - $walker = $nextclose + 1; |
|
| 156 | + // walker goes to the close+1, and open decrements |
|
| 157 | + $open --; |
|
| 158 | + $walker = $nextclose + 1; |
|
| 159 | 159 | } |
| 160 | - elseif( $nextopen < $nextclose ) |
|
| 160 | + elseif( $nextopen < $nextclose ) |
|
| 161 | 161 | { // an open before the next close |
| 162 | - $open ++; |
|
| 163 | - $walker = $nextopen + 1; |
|
| 162 | + $open ++; |
|
| 163 | + $walker = $nextopen + 1; |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | - $tagend = $walker; |
|
| 167 | - if( $tagend > strlen( $content ) ) |
|
| 166 | + $tagend = $walker; |
|
| 167 | + if( $tagend > strlen( $content ) ) |
|
| 168 | 168 | $tagend = strlen( $content ); |
| 169 | - else |
|
| 169 | + else |
|
| 170 | 170 | { |
| 171 | - $tagend --; |
|
| 172 | - $tagstart ++; |
|
| 171 | + $tagend --; |
|
| 172 | + $tagstart ++; |
|
| 173 | 173 | } |
| 174 | - $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
| 175 | - $tags[] = '<' . $tag . '>'; |
|
| 174 | + $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
| 175 | + $tags[] = '<' . $tag . '>'; |
|
| 176 | 176 | |
| 177 | - if (function_exists('format_to_output')) { |
|
| 177 | + if (function_exists('format_to_output')) { |
|
| 178 | 178 | $newtag = format_to_output($tag, $format); |
| 179 | - } else { |
|
| 179 | + } else { |
|
| 180 | 180 | $newtag = strip_tags($tag); |
| 181 | - } |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - $newtags[] = '<' . $newtag . '>'; |
|
| 183 | + $newtags[] = '<' . $newtag . '>'; |
|
| 184 | 184 | |
| 185 | - if (function_exists('format_to_output')) { |
|
| 185 | + if (function_exists('format_to_output')) { |
|
| 186 | 186 | $newtag = format_to_output($tag, $format); |
| 187 | - } else { |
|
| 187 | + } else { |
|
| 188 | 188 | $newtag = strip_tags($tag); |
| 189 | - } |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + if (isset($tags)&&isset($newtags)) { |
|
| 192 | + $content = str_replace($tags, $newtags, $content); |
|
| 190 | 193 | } |
| 191 | - if (isset($tags)&&isset($newtags)) { |
|
| 192 | - $content = str_replace($tags, $newtags, $content); |
|
| 193 | - } |
|
| 194 | 194 | |
| 195 | 195 | return $content; |
| 196 | 196 | |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | twfy_debug("WIKIPEDIA", "Matched '$phrase'"); |
| 107 | 107 | # 1 means only replace one match for phrase per paragraph |
| 108 | - $source = preg_replace ('{ |
|
| 108 | + $source = preg_replace('{ |
|
| 109 | 109 | \b(' . $phrase_re . ')\b # Match the phrase itself |
| 110 | 110 | (?! # Match as long as the following does *not* apply: |
| 111 | 111 | (?: # Match, possessively, as many strings of: |
@@ -137,41 +137,41 @@ discard block |
||
| 137 | 137 | public static function antiTagInTag($content = '', $format = 'htmlhead') |
| 138 | 138 | { |
| 139 | 139 | $tagend = -1; |
| 140 | - for( $tagstart = strpos( $content, '<', $tagend + 1 ) ; $tagstart !== false && $tagstart < strlen( $content ); $tagstart = strpos( $content, '<', $tagend ) ) |
|
| 140 | + for ($tagstart = strpos($content, '<', $tagend + 1); $tagstart !== false && $tagstart < strlen($content); $tagstart = strpos($content, '<', $tagend)) |
|
| 141 | 141 | { |
| 142 | 142 | // got the start of a tag. Now find the proper end! |
| 143 | 143 | $walker = $tagstart + 1; |
| 144 | 144 | $open = 1; |
| 145 | - while( $open != 0 && $walker < strlen( $content ) ) |
|
| 145 | + while ($open != 0 && $walker < strlen($content)) |
|
| 146 | 146 | { |
| 147 | - $nextopen = strpos( $content, '<', $walker ); |
|
| 148 | - $nextclose = strpos( $content, '>', $walker ); |
|
| 149 | - if( $nextclose === false ) |
|
| 147 | + $nextopen = strpos($content, '<', $walker); |
|
| 148 | + $nextclose = strpos($content, '>', $walker); |
|
| 149 | + if ($nextclose === false) |
|
| 150 | 150 | { // ERROR! Open waka without close waka! |
| 151 | 151 | // echo '<code>Error in antiTagInTag - malformed tag!</code> '; |
| 152 | 152 | return $content; |
| 153 | 153 | } |
| 154 | - if( $nextopen === false || $nextopen > $nextclose ) |
|
| 154 | + if ($nextopen === false || $nextopen > $nextclose) |
|
| 155 | 155 | { // No more opens, but there was a close; or, a close happens before the next open. |
| 156 | 156 | // walker goes to the close+1, and open decrements |
| 157 | - $open --; |
|
| 157 | + $open--; |
|
| 158 | 158 | $walker = $nextclose + 1; |
| 159 | 159 | } |
| 160 | - elseif( $nextopen < $nextclose ) |
|
| 160 | + elseif ($nextopen < $nextclose) |
|
| 161 | 161 | { // an open before the next close |
| 162 | - $open ++; |
|
| 162 | + $open++; |
|
| 163 | 163 | $walker = $nextopen + 1; |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | $tagend = $walker; |
| 167 | - if( $tagend > strlen( $content ) ) |
|
| 168 | - $tagend = strlen( $content ); |
|
| 167 | + if ($tagend > strlen($content)) |
|
| 168 | + $tagend = strlen($content); |
|
| 169 | 169 | else |
| 170 | 170 | { |
| 171 | - $tagend --; |
|
| 172 | - $tagstart ++; |
|
| 171 | + $tagend--; |
|
| 172 | + $tagstart++; |
|
| 173 | 173 | } |
| 174 | - $tag = substr( $content, $tagstart, $tagend - $tagstart ); |
|
| 174 | + $tag = substr($content, $tagstart, $tagend - $tagstart); |
|
| 175 | 175 | $tags[] = '<' . $tag . '>'; |
| 176 | 176 | |
| 177 | 177 | if (function_exists('format_to_output')) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $newtag = strip_tags($tag); |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | - if (isset($tags)&&isset($newtags)) { |
|
| 191 | + if (isset($tags) && isset($newtags)) { |
|
| 192 | 192 | $content = str_replace($tags, $newtags, $content); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -130,7 +130,9 @@ discard block |
||
| 130 | 130 | $this->error($this->conn->errorCode() . ': ' . $this->conn->errorInfo()[2]); |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - if (!$this->success) return; |
|
| 133 | + if (!$this->success) { |
|
| 134 | + return; |
|
| 135 | + } |
|
| 134 | 136 | |
| 135 | 137 | if ((!$pdoStatement) or (empty($pdoStatement))) { |
| 136 | 138 | // A failed query. |
@@ -180,8 +182,9 @@ discard block |
||
| 180 | 182 | * @param string $column_name |
| 181 | 183 | */ |
| 182 | 184 | public function field($row_index, $column_name) { |
| 183 | - if ($this->rows > 0) |
|
| 184 | - return $this->data[$row_index][$column_name]; |
|
| 185 | + if ($this->rows > 0) { |
|
| 186 | + return $this->data[$row_index][$column_name]; |
|
| 187 | + } |
|
| 185 | 188 | return ""; |
| 186 | 189 | } |
| 187 | 190 | |
@@ -196,8 +199,9 @@ discard block |
||
| 196 | 199 | * @param integer $row_index |
| 197 | 200 | */ |
| 198 | 201 | public function row($row_index) { |
| 199 | - if ($this->success && $this->rows > 0) |
|
| 200 | - return $this->data[$row_index]; |
|
| 202 | + if ($this->success && $this->rows > 0) { |
|
| 203 | + return $this->data[$row_index]; |
|
| 204 | + } |
|
| 201 | 205 | return array(); |
| 202 | 206 | } |
| 203 | 207 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | }(document, 'script', 'facebook-jssdk')); |
| 158 | 158 | </script> |
| 159 | 159 | |
| 160 | - <?php if ( $banner_text ) { ?> |
|
| 160 | + <?php if ($banner_text) { ?> |
|
| 161 | 161 | <div class="banner"> |
| 162 | 162 | <div class="full-page__row"> |
| 163 | 163 | <div class="banner__content"> |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | <div class="site-nav__user"> |
| 236 | 236 | <ul> |
| 237 | - <?php foreach ($user_nav_links as $nav_link){ ?> |
|
| 237 | + <?php foreach ($user_nav_links as $nav_link) { ?> |
|
| 238 | 238 | <li><a href="<?= $nav_link['href']; ?>" title="<?= $nav_link['title']; ?>" class="<?= $nav_link['classes']; ?>"> |
| 239 | 239 | <?= $nav_link['text'] ?> |
| 240 | 240 | </a></li> |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | <div class="full-page legacy-page static-page"> |
| 269 | 269 | <div class="full-page__row"> |
| 270 | 270 | <div class="panel"> |
| 271 | - <?php foreach ( $page_errors as $error ) { ?> |
|
| 271 | + <?php foreach ($page_errors as $error) { ?> |
|
| 272 | 272 | <p><?= $error['text'] ?></p> |
| 273 | 273 | <?php } ?> |
| 274 | 274 | </div> |