コード例 #1
0
ファイル: PostcodeTest.php プロジェクト: udp12/theyworkforyou
 /**
  * Test canonicalising a postcode
  */
 public function testCanonicalisePostcode()
 {
     $this->assertEquals('SW1A 1AA', canonicalise_postcode('SW1A 1AA'));
     $this->assertEquals('SW1A 1AA', canonicalise_postcode('SW1A1AA'));
     $this->assertEquals('SW1A 1AA', canonicalise_postcode('sw1a 1aa'));
     $this->assertEquals('SW1A 1AA', canonicalise_postcode(' SW1A 1AA '));
     $this->assertEquals('SW1A 1AA', canonicalise_postcode('SW1 A1AA'));
 }
コード例 #2
0
ファイル: write.php プロジェクト: nallachaitu/writetothem
 function validate($value, $options) {
     return validate_postcode(canonicalise_postcode($value));
 }
コード例 #3
0
function importparams_validate_postcode($pc)
{
    $pc = canonicalise_postcode($pc);
    if (validate_postcode($pc)) {
        return null;
    } else {
        return "Please enter a valid postcode, such as OX1 3DR";
    }
}
コード例 #4
0
ファイル: index.php プロジェクト: vijo/writetothem
    }
    if ($options['extra_space']) {
        $form .= ' ';
    }
    $form .= '<a href="/about-constituency" class="help-text">What postcode should I use?</a>';
    // End the form
    if ($options['inner_div']) {
        $form .= '</div>';
    }
    $form .= '</form>';
    return $form;
}
if ($cobrand) {
    $cocode = cobrand_force_default_cocode($cobrand, $cocode);
}
$pc = canonicalise_postcode(get_http_var('pc'));
fyr_rate_limit(array("postcode" => array($pc, "Postcode that's been typed in")));
if ($new_pc = validate_easily_mistyped_postcode($pc)) {
    header('Location: ' . url_new('', true, 'pc', $new_pc));
    exit;
}
// Redirect from parlparse person identifier
$person = get_http_var("person");
if ($person) {
    $ids = dadem_get_same_person($person);
    dadem_check_error($ids);
    // TODO: Fix up case when a person is a representative multiple times
    // (for now we just take the most recent made one, i.e. last in list)
    $id = $ids[count($ids) - 1];
    header('Location: ' . url_new('write', false, 'fyr_extref', fyr_external_referrer(), 'cocode', get_http_var('cocode'), 'who', $id));
    exit;
コード例 #5
0
ファイル: who.php プロジェクト: edent/writetothem
function get_postcode()
{
    $postcode = canonicalise_postcode(get_http_var('pc'));
    if (!$postcode) {
        header('Location: /');
        exit;
    }
    debug("FRONTEND", "postcode is {$postcode}");
    fyr_rate_limit(array('postcode' => array($postcode, "Postcode that's been typed in ")));
    return $postcode;
}