SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/Helpers/Locales/LocaleInfoAUS.php

  1. <?php
  2. /*
  3.  * Copyright (C) 2017 Karmabunny Pty Ltd.
  4.  *
  5.  * This file is a part of SproutCMS.
  6.  *
  7.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  8.  * of the GNU General Public License as published by the Free Software Foundation, either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * For more information, visit <http://getsproutcms.com>.
  12.  */
  13.  
  14. namespace Sprout\Helpers\Locales;
  15.  
  16. use Sprout\Helpers\Validator;
  17.  
  18.  
  19. /**
  20.  * Locale info for Australia; see {@see LocaleInfo}
  21.  */
  22. class LocaleInfoAUS extends LocaleInfo
  23. {
  24. protected $state_name = 'State';
  25. protected $state_list = array(
  26. 'ACT' => 'Australian Capital Territory',
  27. 'NSW' => 'New South Wales',
  28. 'NT' => 'Northern Territory',
  29. 'QLD' => 'Queensland',
  30. 'SA' => 'South Australia',
  31. 'TAS' => 'Tasmania',
  32. 'VIC' => 'Victoria',
  33. 'WA' => 'Western Australia',
  34. );
  35.  
  36. protected $town_name = 'Suburb/Town';
  37.  
  38. protected $postcode_name = 'Postcode';
  39.  
  40.  
  41. /**
  42.   * Validate address fields
  43.   *
  44.   * @param Validator $valid The validation object to add rules to
  45.   * @param bool $required Are the address fields required?
  46.   */
  47. public function validateAddress(Validator $valid, $required = false)
  48. {
  49. parent::validateAddress($valid, $required);
  50.  
  51. $valid->check('postcode', 'Validity::positiveInt');
  52. $valid->check('postcode', 'Validity::length', 4, 4);
  53. }
  54.  
  55. }
  56.  
  57.  
  58.