Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Tenzing
/
Tz Tools
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
09fa4bed
authored
2015-03-18 10:01:58 -0400
by
Marty Penner
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Ensure countries and provinces/states are translated
1 parent
243e6882
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
23 deletions
com/HTML/HTML.php
com/HTML/HTML.php
View file @
09fa4be
...
...
@@ -37,21 +37,34 @@ function selectOpts(array $options, $selected = null, $echo = true)
*/
function
selectOptsProvinces
(
$selected
=
null
)
{
$return
=
'<option>'
.
__
(
'Select a State/Province'
,
CBV_DOMAIN
)
.
'</option>'
;
$provinces
=
Vars
::
$provinces
;
array_walk
(
$provinces
,
function
(
&
$provincesOrStates
)
{
array_walk
(
$provincesOrStates
,
function
(
&
$provinceOrState
)
{
$provinceOrState
=
tz_
(
$provinceOrState
);
}
);
}
);
$return
.=
'<optgroup label="Canada">'
;
$return
.=
selectOpts
(
Vars
::
$provinces
[
'CA'
],
$selected
,
false
);
$return
.=
'</optgroup>'
;
$output
=
'<option>'
.
__
(
'Select a State/Province'
,
CBV_DOMAIN
)
.
'</option>'
;
$
return
.=
'<optgroup label="United States
">'
;
$
return
.=
selectOpts
(
Vars
::
$provinces
[
'US
'
],
$selected
,
false
);
$
return
.=
'</optgroup>'
;
$
output
.=
'<optgroup label="Canada
">'
;
$
output
.=
selectOpts
(
$provinces
[
'CA
'
],
$selected
,
false
);
$
output
.=
'</optgroup>'
;
$
return
.=
'<optgroup label="Other
">'
;
$
return
.=
'<option value="other">'
.
__
(
'Outside Canada/USA'
,
CBV_DOMAIN
)
.
'</option>'
;
$
return
.=
'</optgroup>'
;
$
output
.=
'<optgroup label="United States
">'
;
$
output
.=
selectOpts
(
$provinces
[
'US'
],
$selected
,
false
)
;
$
output
.=
'</optgroup>'
;
return
$return
;
$output
.=
'<optgroup label="Other">'
;
$output
.=
'<option value="other">'
.
__
(
'Outside Canada/USA'
,
CBV_DOMAIN
)
.
'</option>'
;
$output
.=
'</optgroup>'
;
return
$output
;
}
/**
...
...
@@ -78,17 +91,6 @@ function selectOptsCards($selected = null, $echo = true)
*
* @return string
*/
function
selectOptsStates
(
$selected
=
null
,
$echo
=
true
)
{
return
selectOpts
(
Vars
::
$states
,
$selected
,
$echo
);
}
/**
* @param null $selected
* @param bool $echo
*
* @return string
*/
function
selectOptsPrefixes
(
$selected
=
null
,
$echo
=
true
)
{
$prefixes
=
array_map
(
...
...
@@ -134,7 +136,15 @@ function selectOptsPrefixesNoBlank($selected = null)
*/
function
selectOptsCountries
(
$selected
=
null
,
$echo
=
true
)
{
return
selectOpts
(
Vars
::
$countries
,
$selected
,
$echo
);
$countries
=
Vars
::
$countries
;
array_walk
(
$countries
,
function
(
&
$country
)
{
$country
=
tz_
(
$country
);
}
);
return
selectOpts
(
$countries
,
$selected
,
$echo
);
}
/**
...
...
Please
register
or
sign in
to post a comment