Browse Source

Commit inicial

master
Guilherme Capanema 6 years ago
commit
f25ad1892e
11 changed files with 1343 additions and 0 deletions
  1. +4
    -0
      languages/readme.txt
  2. +358
    -0
      license.txt
  3. +128
    -0
      listo.php
  4. +51
    -0
      modules/br-subdivisions.php
  5. +317
    -0
      modules/countries.php
  6. +177
    -0
      modules/currencies.php
  7. +63
    -0
      modules/in-subdivisions.php
  8. +59
    -0
      modules/time-zones.php
  9. +84
    -0
      modules/us-subdivisions.php
  10. +63
    -0
      readme.txt
  11. +39
    -0
      rest-api.php

+ 4
- 0
languages/readme.txt View File

@ -0,0 +1,4 @@
Translations have moved to
https://translate.wordpress.org/projects/wp-plugins/listo
Thank you for your contribution.

+ 358
- 0
license.txt View File

@ -0,0 +1,358 @@
Listo WordPress Plugin, 2014-2018 Takayuki Miyoshi
Listo is distributed under the terms of the GNU GPL
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

+ 128
- 0
listo.php View File

@ -0,0 +1,128 @@
<?php
/*
Plugin Name: Listo
Plugin URI: https://contactform7.com/listo/
Description: Listo is a simple plugin that supplies commonly used lists to other plugins and themes.
Author: Takayuki Miyoshi
Author URI: https://ideasilo.wordpress.com/
Text Domain: listo
Domain Path: /languages/
Version: 1.2.1
*/
define( 'LISTO_VERSION', '1.2.1' );
define( 'LISTO_PLUGIN_DIR', dirname( __FILE__ ) );
define( 'LISTO_MODULES_DIR', path_join( LISTO_PLUGIN_DIR, 'modules' ) );
define( 'LISTO_LANGUAGES_DIR', path_join( LISTO_PLUGIN_DIR, 'languages' ) );
require_once LISTO_PLUGIN_DIR . '/rest-api.php';
interface Listo {
public static function items();
public static function groups();
}
class Listo_Manager {
private static $lists = array();
private static function get_list_types() {
$list_types = array(
'br_subdivisions' => 'Listo_BR_Subdivisions',
'countries' => 'Listo_Countries',
'in_subdivisions' => 'Listo_IN_Subdivisions',
'us_subdivisions' => 'Listo_US_Subdivisions',
'currencies' => 'Listo_Currencies',
'time_zones' => 'Listo_Time_Zones',
);
return apply_filters( 'listo_list_types', $list_types );
}
public static function get_list_items( $type, $args = '' ) {
$args = wp_parse_args( $args, array(
'group' => '',
'locale' => 'en_US',
) );
$list_types = self::get_list_types();
if ( ! isset( $list_types[$type] ) ) {
return false;
}
$class = $list_types[$type];
if ( ! class_exists( $class ) ) {
$mod = sanitize_file_name( str_replace( '_', '-', $type ) . '.php' );
$mod = path_join( LISTO_MODULES_DIR, $mod );
if ( file_exists( $mod ) ) {
require_once $mod;
}
}
if ( ! is_callable( array( $class, 'items' ) ) ) {
return false;
}
$group = trim( $args['group'] );
$locale = trim( $args['locale'] );
$cloak_ticket = md5( $type . $group . $locale );
if ( isset( self::$lists[$cloak_ticket] ) ) {
return self::$lists[$cloak_ticket];
}
self::load_textdomain( $locale );
$items = call_user_func( array( $class, 'items' ) );
if ( $group && is_callable( array( $class, 'groups' ) ) ) {
$groups = call_user_func( array( $class, 'groups' ) );
if ( isset( $groups[$group] ) ) {
$items = array_intersect_key(
$items,
array_fill_keys( $groups[$group], '' ) );
}
}
self::$lists[$cloak_ticket] = $items;
return $items;
}
private static function load_textdomain( $locale = '' ) {
if ( ! did_action( 'init' ) ) {
return false;
}
static $last_locale = '';
$domain = 'listo';
if ( '' == $locale || 'en_US' == $locale ) {
unload_textdomain( $domain );
return false;
}
if ( $last_locale && $locale == $last_locale ) {
return false;
}
unload_textdomain( $domain );
$mofile = sprintf( '%s-%s.mo', $domain, $locale );
if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile )
|| load_textdomain( $domain, LISTO_LANGUAGES_DIR . '/' . $mofile ) ) {
$last_locale = $locale;
return true;
}
return false;
}
}
function listo( $type, $args = '' ) {
return Listo_Manager::get_list_items( $type, $args );
}

+ 51
- 0
modules/br-subdivisions.php View File

@ -0,0 +1,51 @@
<?php
/**
* The list of subdivisions of Brazil on ISO 3166-2:BR standard.
*
* Source: https://en.wikipedia.org/wiki/ISO_3166-2:BR ISO 3166-2:BR
*/
class Listo_BR_Subdivisions implements Listo {
private function __construct() {}
public static function items() {
return array(
'ac' => _x( "Acre", 'br_subdivisions', 'listo' ),
'al' => _x( "Alagoas", 'br_subdivisions', 'listo' ),
'ap' => _x( "Amapá", 'br_subdivisions', 'listo' ),
'am' => _x( "Amazonas", 'br_subdivisions', 'listo' ),
'ba' => _x( "Bahia", 'br_subdivisions', 'listo' ),
'ce' => _x( "Ceará", 'br_subdivisions', 'listo' ),
'df' => _x( "Distrito Federal", 'br_subdivisions', 'listo' ),
'es' => _x( "Espírito Santo", 'br_subdivisions', 'listo' ),
'go' => _x( "Goiás", 'br_subdivisions', 'listo' ),
'ma' => _x( "Maranhão", 'br_subdivisions', 'listo' ),
'mt' => _x( "Mato Grosso", 'br_subdivisions', 'listo' ),
'ms' => _x( "Mato Grosso do Sul", 'br_subdivisions', 'listo' ),
'mg' => _x( "Minas Gerais", 'br_subdivisions', 'listo' ),
'pa' => _x( "Pará", 'br_subdivisions', 'listo' ),
'pb' => _x( "Paraíba", 'br_subdivisions', 'listo' ),
'pr' => _x( "Paraná", 'br_subdivisions', 'listo' ),
'pe' => _x( "Pernambuco", 'br_subdivisions', 'listo' ),
'pi' => _x( "Piauí", 'br_subdivisions', 'listo' ),
'rj' => _x( "Rio de Janeiro", 'br_subdivisions', 'listo' ),
'rn' => _x( "Rio Grande do Norte", 'br_subdivisions', 'listo' ),
'rs' => _x( "Rio Grande do Sul", 'br_subdivisions', 'listo' ),
'ro' => _x( "Rondônia", 'br_subdivisions', 'listo' ),
'rr' => _x( "Roraima", 'br_subdivisions', 'listo' ),
'sc' => _x( "Santa Catarina", 'br_subdivisions', 'listo' ),
'sp' => _x( "São Paulo", 'br_subdivisions', 'listo' ),
'se' => _x( "Sergipe", 'br_subdivisions', 'listo' ),
'to' => _x( "Tocantins", 'br_subdivisions', 'listo' ),
);
}
public static function groups() {
return array(
'states' => array( 'ac', 'al', 'ap', 'am', 'ba', 'ce', 'df', 'es',
'go', 'ma', 'mt', 'ms', 'mg', 'pa', 'pb', 'pr', 'pe', 'pi', 'rj',
'rn', 'rs', 'ro', 'rr', 'sc', 'sp', 'se', 'to',
),
'districts' => array( 'df' ),
);
}
}

+ 317
- 0
modules/countries.php View File

@ -0,0 +1,317 @@
<?php
/**
* The list of countries and dependent territories based on ISO 3166 standard.
*
* Source: https://en.wikipedia.org/wiki/ISO_3166-1 ISO 3166-1
*/
class Listo_Countries implements Listo {
private function __construct() {}
public static function items() {
return array(
'abw' => _x( "Aruba", 'countries', 'listo' ),
'afg' => _x( "Afeganistão", 'countries', 'listo' ),
'ago' => _x( "Angola", 'countries', 'listo' ),
'aia' => _x( "Anguilla", 'countries', 'listo' ),
'ala' => _x( "Ilhas Aland", 'countries', 'listo' ),
'alb' => _x( "Albânia", 'countries', 'listo' ),
'and' => _x( "Andorra", 'countries', 'listo' ),
'are' => _x( "Emirados Árabes Unidos", 'countries', 'listo' ),
'arg' => _x( "Argentina", 'countries', 'listo' ),
'arm' => _x( "Armênia", 'countries', 'listo' ),
'asm' => _x( "Samoa Americana", 'countries', 'listo' ),
'ata' => _x( "Antártica", 'countries', 'listo' ),
'atf' => _x( "Territórios Franceses do Sul", 'countries', 'listo' ),
'atg' => _x( "Antígua e Barbuda", 'countries', 'listo' ),
'aus' => _x( "Austrália", 'countries', 'listo' ),
'aut' => _x( "Áustria", 'countries', 'listo' ),
'aze' => _x( "Azerbaijão", 'countries', 'listo' ),
'bdi' => _x( "Burundi", 'countries', 'listo' ),
'bel' => _x( "Bélgica", 'countries', 'listo' ),
'ben' => _x( "Benin", 'countries', 'listo' ),
'bes' => _x( "Bonaire, Santo Eustáquio e Saba", 'countries', 'listo' ),
'bfa' => _x( "Burkina Faso", 'countries', 'listo' ),
'bgd' => _x( "Bangladesh", 'countries', 'listo' ),
'bgr' => _x( "Bulgária", 'countries', 'listo' ),
'bhr' => _x( "Barém", 'countries', 'listo' ),
'bhs' => _x( "Bahamas", 'countries', 'listo' ),
'bih' => _x( "Bósnia e Herzegovina", 'countries', 'listo' ),
'blm' => _x( "São Bartolomeu", 'countries', 'listo' ),
'blr' => _x( "Bielorrússia", 'countries', 'listo' ),
'blz' => _x( "Belize", 'countries', 'listo' ),
'bmu' => _x( "Bermudas", 'countries', 'listo' ),
'bol' => _x( "Bolívia, Estado Plurinacional da", 'countries', 'listo' ),
'bra' => _x( "Brasil", 'countries', 'listo' ),
'brb' => _x( "Barbados", 'countries', 'listo' ),
'brn' => _x( "Brunei Darussalam", 'countries', 'listo' ),
'btn' => _x( "Butão", 'countries', 'listo' ),
'bvt' => _x( "Ilha Bouvet", 'countries', 'listo' ),
'bwa' => _x( "Botsuana", 'countries', 'listo' ),
'caf' => _x( "República Centro-Africana", 'countries', 'listo' ),
'can' => _x( "Canadá", 'countries', 'listo' ),
'cck' => _x( "Ilhas Cocos (Keeling)", 'countries', 'listo' ),
'che' => _x( "Suíça", 'countries', 'listo' ),
'chl' => _x( "Chile", 'countries', 'listo' ),
'chn' => _x( "China", 'countries', 'listo' ),
'civ' => _x( "Costa do Marfim", 'countries', 'listo' ),
'cmr' => _x( "Camarões", 'countries', 'listo' ),
'cod' => _x( "Congo, República Democrática do", 'countries', 'listo' ),
'cog' => _x( "Congo", 'countries', 'listo' ),
'cok' => _x( "Ilhas Cook", 'countries', 'listo' ),
'col' => _x( "Colômbia", 'countries', 'listo' ),
'com' => _x( "Comores", 'countries', 'listo' ),
'cpv' => _x( "cabo Verde", 'countries', 'listo' ),
'cri' => _x( "Costa Rica", 'countries', 'listo' ),
'cub' => _x( "Cuba", 'countries', 'listo' ),
'cuw' => _x( "Curaçao", 'countries', 'listo' ),
'cxr' => _x( "Ilha do Natal", 'countries', 'listo' ),
'cym' => _x( "Ilhas Cayman", 'countries', 'listo' ),
'cyp' => _x( "Chipre", 'countries', 'listo' ),
'cze' => _x( "República Checa", 'countries', 'listo' ),
'deu' => _x( "Alemanha", 'countries', 'listo' ),
'dji' => _x( "Djibuti", 'countries', 'listo' ),
'dma' => _x( "Dominica", 'countries', 'listo' ),
'dnk' => _x( "Dinamarca", 'countries', 'listo' ),
'dom' => _x( "República Dominicana", 'countries', 'listo' ),
'dza' => _x( "Argélia", 'countries', 'listo' ),
'ecu' => _x( "Equador", 'countries', 'listo' ),
'egy' => _x( "Egito", 'countries', 'listo' ),
'eri' => _x( "Eritreia", 'countries', 'listo' ),
'esh' => _x( "Saara Ocidental", 'countries', 'listo' ),
'esp' => _x( "Espanha", 'countries', 'listo' ),
'est' => _x( "Estônia", 'countries', 'listo' ),
'eth' => _x( "Etiópia", 'countries', 'listo' ),
'fin' => _x( "Finlândia", 'countries', 'listo' ),
'fji' => _x( "Fiji", 'countries', 'listo' ),
'flk' => _x( "Ilhas Falkland (Malvinas)", 'countries', 'listo' ),
'fra' => _x( "França", 'countries', 'listo' ),
'fro' => _x( "ilhas Faroe", 'countries', 'listo' ),
'fsm' => _x( "Micronésia, Estados Federados da", 'countries', 'listo' ),
'gab' => _x( "Gabão", 'countries', 'listo' ),
'gbr' => _x( "Reino Unido", 'countries', 'listo' ),
'geo' => _x( "Geórgia", 'countries', 'listo' ),
'ggy' => _x( "Guernsey", 'countries', 'listo' ),
'gha' => _x( "Gana", 'countries', 'listo' ),
'gib' => _x( "Gibraltar", 'countries', 'listo' ),
'gin' => _x( "Guiné", 'countries', 'listo' ),
'glp' => _x( "Guadalupe", 'countries', 'listo' ),
'gmb' => _x( "Gâmbia", 'countries', 'listo' ),
'gnb' => _x( "Guiné-Bissau", 'countries', 'listo' ),
'gnq' => _x( "Guiné Equatorial", 'countries', 'listo' ),
'grc' => _x( "Grécia", 'countries', 'listo' ),
'grd' => _x( "Granada", 'countries', 'listo' ),
'grl' => _x( "Gronelândia", 'countries', 'listo' ),
'gtm' => _x( "Guatemala", 'countries', 'listo' ),
'guf' => _x( "Guiana Francesa", 'countries', 'listo' ),
'gum' => _x( "Guam", 'countries', 'listo' ),
'guy' => _x( "Guiana", 'countries', 'listo' ),
'hkg' => _x( "Hong Kong", 'countries', 'listo' ),
'hmd' => _x( "Ilha Heard e Ilhas McDonald", 'countries', 'listo' ),
'hnd' => _x( "Honduras", 'countries', 'listo' ),
'hrv' => _x( "Croácia", 'countries', 'listo' ),
'hti' => _x( "Haiti", 'countries', 'listo' ),
'hun' => _x( "Hungria", 'countries', 'listo' ),
'idn' => _x( "Indonésia", 'countries', 'listo' ),
'imn' => _x( "Ilha de Man", 'countries', 'listo' ),
'ind' => _x( "Índia", 'countries', 'listo' ),
'iot' => _x( "Território Britânico do Oceano Índico", 'countries', 'listo' ),
'irl' => _x( "Irlanda", 'countries', 'listo' ),
'irn' => _x( "Irã (Republic Islâmica do Irã", 'countries', 'listo' ),
'irq' => _x( "Iraque", 'countries', 'listo' ),
'isl' => _x( "Islândia", 'countries', 'listo' ),
'isr' => _x( "Israel", 'countries', 'listo' ),
'ita' => _x( "Itália", 'countries', 'listo' ),
'jam' => _x( "Jamaica", 'countries', 'listo' ),
'jey' => _x( "Jersey", 'countries', 'listo' ),
'jor' => _x( "Jordânia", 'countries', 'listo' ),
'jpn' => _x( "Japão", 'countries', 'listo' ),
'kaz' => _x( "Cazaquistão", 'countries', 'listo' ),
'ken' => _x( "Quênia", 'countries', 'listo' ),
'kgz' => _x( "Quirguistão", 'countries', 'listo' ),
'khm' => _x( "Camboja", 'countries', 'listo' ),
'kir' => _x( "Kiribati", 'countries', 'listo' ),
'kna' => _x( "São Cristóvão e Nevis", 'countries', 'listo' ),
'kor' => _x( "Republica da Coréia", 'countries', 'listo' ),
'kwt' => _x( "Kuwait", 'countries', 'listo' ),
'lao' => _x( "República Democrática Popular do Laos", 'countries', 'listo' ),
'lbn' => _x( "Líbano", 'countries', 'listo' ),
'lbr' => _x( "Libéria", 'countries', 'listo' ),
'lby' => _x( "Líbia", 'countries', 'listo' ),
'lca' => _x( "Santa Lúcia", 'countries', 'listo' ),
'lie' => _x( "Liechtenstein", 'countries', 'listo' ),
'lka' => _x( "Sri Lanka", 'countries', 'listo' ),
'lso' => _x( "Lesoto", 'countries', 'listo' ),
'ltu' => _x( "Lituânia", 'countries', 'listo' ),
'lux' => _x( "Luxemburgo", 'countries', 'listo' ),
'lva' => _x( "Letônia", 'countries', 'listo' ),
'mac' => _x( "Macau", 'countries', 'listo' ),
'maf' => _x( "São Martinho (parte francesa)", 'countries', 'listo' ),
'mar' => _x( "Marrocos", 'countries', 'listo' ),
'mco' => _x( "Mônaco", 'countries', 'listo' ),
'mda' => _x( "Moldávia, República da", 'countries', 'listo' ),
'mdg' => _x( "Madagáscar", 'countries', 'listo' ),
'mdv' => _x( "Maldivas", 'countries', 'listo' ),
'mex' => _x( "México", 'countries', 'listo' ),
'mhl' => _x( "Ilhas Marshall", 'countries', 'listo' ),
'mkd' => _x( "Macedônia, antiga República jugoslava da", 'countries', 'listo' ),
'mli' => _x( "Mali", 'countries', 'listo' ),
'mlt' => _x( "Malta", 'countries', 'listo' ),
'mmr' => _x( "Myanmar", 'countries', 'listo' ),
'mne' => _x( "Montenegro", 'countries', 'listo' ),
'mng' => _x( "Mongólia", 'countries', 'listo' ),
'mnp' => _x( "Ilhas Marianas do Norte", 'countries', 'listo' ),
'moz' => _x( "Moçambique", 'countries', 'listo' ),
'mrt' => _x( "Mauritânia", 'countries', 'listo' ),
'msr' => _x( "Montserrat", 'countries', 'listo' ),
'mtq' => _x( "Martinica", 'countries', 'listo' ),
'mus' => _x( "Maurícia", 'countries', 'listo' ),
'mwi' => _x( "Malawi", 'countries', 'listo' ),
'mys' => _x( "Malásia", 'countries', 'listo' ),
'myt' => _x( "Mayotte", 'countries', 'listo' ),
'nam' => _x( "Namíbia", 'countries', 'listo' ),
'ncl' => _x( "Nova Caledônia", 'countries', 'listo' ),
'ner' => _x( "Níger", 'countries', 'listo' ),
'nfk' => _x( "Ilha Norfolk", 'countries', 'listo' ),
'nga' => _x( "Nigéria", 'countries', 'listo' ),
'nic' => _x( "Nicarágua", 'countries', 'listo' ),
'niu' => _x( "Niue", 'countries', 'listo' ),
'nld' => _x( "Países Baixos", 'countries', 'listo' ),
'nor' => _x( "Noruega", 'countries', 'listo' ),
'npl' => _x( "Nepal", 'countries', 'listo' ),
'nru' => _x( "Nauru", 'countries', 'listo' ),
'nzl' => _x( "Nova Zelândia", 'countries', 'listo' ),
'omn' => _x( "Omã", 'countries', 'listo' ),
'pak' => _x( "Paquistão", 'countries', 'listo' ),
'pan' => _x( "Panamá", 'countries', 'listo' ),
'pcn' => _x( "Pitcairn", 'countries', 'listo' ),
'per' => _x( "Peru", 'countries', 'listo' ),
'phl' => _x( "Filipinas", 'countries', 'listo' ),
'plw' => _x( "Palau", 'countries', 'listo' ),
'png' => _x( "Papua Nova Guiné", 'countries', 'listo' ),
'pol' => _x( "Polônia", 'countries', 'listo' ),
'pri' => _x( "Porto Rico", 'countries', 'listo' ),
'prk' => _x( "Coréia, República Popular Democrática da", 'countries', 'listo' ),
'prt' => _x( "Portugal", 'countries', 'listo' ),
'pry' => _x( "Paraguai", 'countries', 'listo' ),
'pse' => _x( "Palestina, Estado de", 'countries', 'listo' ),
'pyf' => _x( "Polinésia Francesa", 'countries', 'listo' ),
'qat' => _x( "Catar", 'countries', 'listo' ),
'reu' => _x( "Reunião", 'countries', 'listo' ),
'rou' => _x( "Romênia", 'countries', 'listo' ),
'rus' => _x( "Federação Russa", 'countries', 'listo' ),
'rwa' => _x( "Ruanda", 'countries', 'listo' ),
'sau' => _x( "Arábia Saudita", 'countries', 'listo' ),
'sdn' => _x( "Sudão", 'countries', 'listo' ),
'sen' => _x( "Senegal", 'countries', 'listo' ),
'sgp' => _x( "Cingapura", 'countries', 'listo' ),
'sgs' => _x( "Ilhas Geórgia do Sul e Sandwich do Sul", 'countries', 'listo' ),
'shn' => _x( "Santa Helena, Ascensão e Tristão da Cunha", 'countries', 'listo' ),
'sjm' => _x( "Svalbard e Jan Mayen", 'countries', 'listo' ),
'slb' => _x( "Ilhas Salomão", 'countries', 'listo' ),
'sle' => _x( "Serra Leoa", 'countries', 'listo' ),
'slv' => _x( "El Salvador", 'countries', 'listo' ),
'smr' => _x( "San Marino", 'countries', 'listo' ),
'som' => _x( "Somália", 'countries', 'listo' ),
'spm' => _x( "São Pedro e Miquelon", 'countries', 'listo' ),
'srb' => _x( "Sérvia", 'countries', 'listo' ),
'ssd' => _x( "Sudão do Sul", 'countries', 'listo' ),
'stp' => _x( "São Tomé e Príncipe", 'countries', 'listo' ),
'sur' => _x( "Suriname", 'countries', 'listo' ),
'svk' => _x( "Eslováquia", 'countries', 'listo' ),
'svn' => _x( "Eslovênia", 'countries', 'listo' ),
'swe' => _x( "Suécia", 'countries', 'listo' ),
'swz' => _x( "Suazilândia", 'countries', 'listo' ),
'sxm' => _x( "São Martinho (parte holandesa)", 'countries', 'listo' ),
'syc' => _x( "Seychelles", 'countries', 'listo' ),
'syr' => _x( "República Árabe da Síria", 'countries', 'listo' ),
'tca' => _x( "Ilhas Turcas e Caicos", 'countries', 'listo' ),
'tcd' => _x( "Chade", 'countries', 'listo' ),
'tgo' => _x( "Ir", 'countries', 'listo' ),
'tha' => _x( "Tailândia", 'countries', 'listo' ),
'tjk' => _x( "Tajiquistão", 'countries', 'listo' ),
'tkl' => _x( "Tokelau", 'countries', 'listo' ),
'tkm' => _x( "Turquemenistão", 'countries', 'listo' ),
'tls' => _x( "Timor-Leste", 'countries', 'listo' ),
'ton' => _x( "Tonga", 'countries', 'listo' ),
'tto' => _x( "Trindade e Tobago", 'countries', 'listo' ),
'tun' => _x( "Tunísia", 'countries', 'listo' ),
'tur' => _x( "Peru", 'countries', 'listo' ),
'tuv' => _x( "Tuvalu", 'countries', 'listo' ),
'twn' => _x( "Taiwan, província da China", 'countries', 'listo' ),
'tza' => _x( "Tanzânia, República Unida da", 'countries', 'listo' ),
'uga' => _x( "Uganda", 'countries', 'listo' ),
'ukr' => _x( "Ucrânia", 'countries', 'listo' ),
'umi' => _x( "Ilhas Menores Distantes dos Estados Unidos", 'countries', 'listo' ),
'ury' => _x( "Uruguai", 'countries', 'listo' ),
'usa' => _x( "Estados Unidos", 'countries', 'listo' ),
'uzb' => _x( "Usbequistão", 'countries', 'listo' ),
'vat' => _x( "Santa Sé (Estado da Cidade do Vaticano)", 'countries', 'listo' ),
'vct' => _x( "São Vicente e Granadinas", 'countries', 'listo' ),
'ven' => _x( "Venezuela, República Bolivariana da", 'countries', 'listo' ),
'vgb' => _x( "Ilhas Virgens Britânicas", 'countries', 'listo' ),
'vir' => _x( "Ilhas Virgens, EUA", 'countries', 'listo' ),
'vnm' => _x( "Vietnã", 'countries', 'listo' ),
'vut' => _x( "Vanuatu", 'countries', 'listo' ),
'wlf' => _x( "Wallis e Futuna", 'countries', 'listo' ),
'wsm' => _x( "Samoa", 'countries', 'listo' ),
'yem' => _x( "Iémen", 'countries', 'listo' ),
'zaf' => _x( "África do Sul", 'countries', 'listo' ),
'zmb' => _x( "Zâmbia", 'countries', 'listo' ),
'zwe' => _x( "Zimbábue", 'countries', 'listo' ),
);
}
public static function groups() {
return array(
'un' => array(
'afg', 'ago', 'alb', 'and', 'are', 'arg', 'arm',
'atg', 'aus', 'aut', 'aze', 'bdi', 'bel', 'ben', 'bfa', 'bgd',
'bgr', 'bhr', 'bhs', 'bih', 'blr', 'blz', 'bol', 'bra', 'brb',
'brn', 'btn', 'bwa', 'caf', 'can', 'che', 'chl', 'chn', 'civ',
'cmr', 'cod', 'cog', 'col', 'com', 'cpv', 'cri', 'cub', 'cyp',
'cze', 'deu', 'dji', 'dma', 'dnk', 'dom', 'dza', 'ecu', 'egy',
'eri', 'esp', 'est', 'eth', 'fin', 'fji', 'fra', 'fsm', 'gab',
'gbr', 'geo', 'gha', 'gin', 'gmb', 'gnb', 'gnq', 'grc', 'grd',
'gtm', 'guy', 'hnd', 'hrv', 'hti', 'hun', 'idn', 'ind', 'irl',
'irn', 'irq', 'isl', 'isr', 'ita', 'jam', 'jor', 'jpn', 'kaz',
'ken', 'kgz', 'khm', 'kir', 'kna', 'kor', 'kwt', 'lao', 'lbn',
'lbr', 'lby', 'lca', 'lie', 'lka', 'lso', 'ltu', 'lux', 'lva',
'mar', 'mco', 'mda', 'mdg', 'mdv', 'mex', 'mhl', 'mkd', 'mli',
'mlt', 'mmr', 'mne', 'mng', 'moz', 'mrt', 'mus', 'mwi', 'mys',
'nam', 'ner', 'nga', 'nic', 'nld', 'nor', 'npl', 'nru', 'nzl',
'omn', 'pak', 'pan', 'per', 'phl', 'plw', 'png', 'pol', 'prk',
'prt', 'pry', 'qat', 'rou', 'rus', 'rwa', 'sau', 'sdn', 'sen',
'sgp', 'slb', 'sle', 'slv', 'smr', 'som', 'srb', 'ssd', 'stp',
'sur', 'svk', 'svn', 'swe', 'swz', 'syc', 'syr', 'tcd', 'tgo',
'tha', 'tjk', 'tkm', 'tls', 'ton', 'tto', 'tun', 'tur', 'tuv',
'tza', 'uga', 'ukr', 'ury', 'usa', 'uzb', 'vct', 'ven', 'vnm',
'vut', 'wsm', 'yem', 'zaf', 'zmb', 'zwe',
),
'olympic' => array(
'abw', 'afg', 'ago', 'alb', 'and', 'are', 'arg',
'arm', 'asm', 'atg', 'aus', 'aut', 'aze', 'bdi', 'bel', 'ben',
'bfa', 'bgd', 'bgr', 'bhr', 'bhs', 'bih', 'blr', 'blz', 'bmu',
'bol', 'bra', 'brb', 'brn', 'btn', 'bwa', 'caf', 'can', 'che',
'chl', 'chn', 'civ', 'cmr', 'cod', 'cog', 'cok', 'col', 'com',
'cpv', 'cri', 'cub', 'cym', 'cyp', 'cze', 'deu', 'dji', 'dma',
'dnk', 'dom', 'dza', 'ecu', 'egy', 'eri', 'esp', 'est', 'eth',
'fin', 'fji', 'fra', 'fsm', 'gab', 'gbr', 'geo', 'gha', 'gin',
'gmb', 'gnb', 'gnq', 'grc', 'grd', 'gtm', 'gum', 'guy', 'hkg',
'hnd', 'hrv', 'hti', 'hun', 'idn', 'ind', 'irl', 'irn', 'irq',
'isl', 'isr', 'ita', 'jam', 'jor', 'jpn', 'kaz', 'ken', 'kgz',
'khm', 'kir', 'kna', 'kor', 'kwt', 'lao', 'lbn', 'lbr', 'lby',
'lca', 'lie', 'lka', 'lso', 'ltu', 'lux', 'lva', 'mar', 'mco',
'mda', 'mdg', 'mdv', 'mex', 'mhl', 'mkd', 'mli', 'mlt', 'mmr',
'mne', 'mng', 'moz', 'mrt', 'mus', 'mwi', 'mys', 'nam', 'ner',
'nga', 'nic', 'nld', 'nor', 'npl', 'nru', 'nzl', 'omn', 'pak',
'pan', 'per', 'phl', 'plw', 'png', 'pol', 'pri', 'prk', 'prt',
'pry', 'pse', 'qat', 'rou', 'rus', 'rwa', 'sau', 'sdn', 'sen',
'sgp', 'slb', 'sle', 'slv', 'smr', 'som', 'srb', 'ssd', 'stp',
'sur', 'svk', 'svn', 'swe', 'swz', 'syc', 'syr', 'tcd', 'tgo',
'tha', 'tjk', 'tkm', 'tls', 'ton', 'tto', 'tun', 'tur', 'tuv',
'twn', 'tza', 'uga', 'ukr', 'ury', 'usa', 'uzb', 'vct', 'ven',
'vgb', 'vir', 'vnm', 'vut', 'wsm', 'yem', 'zaf', 'zmb', 'zwe',
),
);
}
}

+ 177
- 0
modules/currencies.php View File

@ -0,0 +1,177 @@
<?php
/**
* The list of currencies based on ISO 4217 standard.
*
* Source: https://en.wikipedia.org/wiki/ISO_4217 ISO 4217
*
* Some special codes for funds, complementary currencies, precious metals
* and used in testing are excluded.
*/
class Listo_Currencies implements Listo {
private function __construct() {}
public static function items() {
return array(
'aed' => _x( "United Arab Emirates dirham", 'currencies', 'listo' ),
'afn' => _x( "Afghan afghani", 'currencies', 'listo' ),
'all' => _x( "Albanian lek", 'currencies', 'listo' ),
'amd' => _x( "Armenian dram", 'currencies', 'listo' ),
'ang' => _x( "Netherlands Antillean guilder", 'currencies', 'listo' ),
'aoa' => _x( "Angolan kwanza", 'currencies', 'listo' ),
'ars' => _x( "Argentine peso", 'currencies', 'listo' ),
'aud' => _x( "Australian dollar", 'currencies', 'listo' ),
'awg' => _x( "Aruban florin", 'currencies', 'listo' ),
'azn' => _x( "Azerbaijani manat", 'currencies', 'listo' ),
'bam' => _x( "Bosnia and Herzegovina convertible mark", 'currencies', 'listo' ),
'bbd' => _x( "Barbados dollar", 'currencies', 'listo' ),
'bdt' => _x( "Bangladeshi taka", 'currencies', 'listo' ),
'bgn' => _x( "Bulgarian lev", 'currencies', 'listo' ),
'bhd' => _x( "Bahraini dinar", 'currencies', 'listo' ),
'bif' => _x( "Burundian franc", 'currencies', 'listo' ),
'bmd' => _x( "Bermudian dollar", 'currencies', 'listo' ),
'bnd' => _x( "Brunei dollar", 'currencies', 'listo' ),
'bob' => _x( "Boliviano", 'currencies', 'listo' ),
'brl' => _x( "Brazilian real", 'currencies', 'listo' ),
'bsd' => _x( "Bahamian dollar", 'currencies', 'listo' ),
'btn' => _x( "Bhutanese ngultrum", 'currencies', 'listo' ),
'bwp' => _x( "Botswana pula", 'currencies', 'listo' ),
'byr' => _x( "Belarusian ruble", 'currencies', 'listo' ),
'bzd' => _x( "Belize dollar", 'currencies', 'listo' ),
'cad' => _x( "Canadian dollar", 'currencies', 'listo' ),
'cdf' => _x( "Congolese franc", 'currencies', 'listo' ),
'chf' => _x( "Swiss franc", 'currencies', 'listo' ),
'clp' => _x( "Chilean peso", 'currencies', 'listo' ),
'cny' => _x( "Chinese yuan", 'currencies', 'listo' ),
'cop' => _x( "Colombian peso", 'currencies', 'listo' ),
'crc' => _x( "Costa Rican colon", 'currencies', 'listo' ),
'cup' => _x( "Cuban peso", 'currencies', 'listo' ),
'cve' => _x( "Cape Verde escudo", 'currencies', 'listo' ),
'czk' => _x( "Czech koruna", 'currencies', 'listo' ),
'djf' => _x( "Djiboutian franc", 'currencies', 'listo' ),
'dkk' => _x( "Danish krone", 'currencies', 'listo' ),
'dop' => _x( "Dominican peso", 'currencies', 'listo' ),
'dzd' => _x( "Algerian dinar", 'currencies', 'listo' ),
'egp' => _x( "Egyptian pound", 'currencies', 'listo' ),
'ern' => _x( "Eritrean nakfa", 'currencies', 'listo' ),
'etb' => _x( "Ethiopian birr", 'currencies', 'listo' ),
'eur' => _x( "Euro", 'currencies', 'listo' ),
'fjd' => _x( "Fiji dollar", 'currencies', 'listo' ),
'fkp' => _x( "Falkland Islands pound", 'currencies', 'listo' ),
'gbp' => _x( "Pound sterling", 'currencies', 'listo' ),
'gel' => _x( "Georgian lari", 'currencies', 'listo' ),
'ghs' => _x( "Ghanaian cedi", 'currencies', 'listo' ),
'gip' => _x( "Gibraltar pound", 'currencies', 'listo' ),
'gmd' => _x( "Gambian dalasi", 'currencies', 'listo' ),
'gnf' => _x( "Guinean franc", 'currencies', 'listo' ),
'gtq' => _x( "Guatemalan quetzal", 'currencies', 'listo' ),
'gyd' => _x( "Guyanese dollar", 'currencies', 'listo' ),
'hkd' => _x( "Hong Kong dollar", 'currencies', 'listo' ),
'hnl' => _x( "Honduran lempira", 'currencies', 'listo' ),
'hrk' => _x( "Croatian kuna", 'currencies', 'listo' ),
'htg' => _x( "Haitian gourde", 'currencies', 'listo' ),
'huf' => _x( "Hungarian forint", 'currencies', 'listo' ),
'idr' => _x( "Indonesian rupiah", 'currencies', 'listo' ),
'ils' => _x( "Israeli new shekel", 'currencies', 'listo' ),
'inr' => _x( "Indian rupee", 'currencies', 'listo' ),
'iqd' => _x( "Iraqi dinar", 'currencies', 'listo' ),
'irr' => _x( "Iranian rial", 'currencies', 'listo' ),
'isk' => _x( "Icelandic króna", 'currencies', 'listo' ),
'jmd' => _x( "Jamaican dollar", 'currencies', 'listo' ),
'jod' => _x( "Jordanian dinar", 'currencies', 'listo' ),
'jpy' => _x( "Japanese yen", 'currencies', 'listo' ),
'kes' => _x( "Kenyan shilling", 'currencies', 'listo' ),
'kgs' => _x( "Kyrgyzstani som", 'currencies', 'listo' ),
'khr' => _x( "Cambodian riel", 'currencies', 'listo' ),
'kmf' => _x( "Comoro franc", 'currencies', 'listo' ),
'kpw' => _x( "North Korean won", 'currencies', 'listo' ),
'krw' => _x( "South Korean won", 'currencies', 'listo' ),
'kwd' => _x( "Kuwaiti dinar", 'currencies', 'listo' ),
'kyd' => _x( "Cayman Islands dollar", 'currencies', 'listo' ),
'kzt' => _x( "Kazakhstani tenge", 'currencies', 'listo' ),
'lak' => _x( "Lao kip", 'currencies', 'listo' ),
'lbp' => _x( "Lebanese pound", 'currencies', 'listo' ),
'lkr' => _x( "Sri Lankan rupee", 'currencies', 'listo' ),
'lrd' => _x( "Liberian dollar", 'currencies', 'listo' ),
'lsl' => _x( "Lesotho loti", 'currencies', 'listo' ),
'ltl' => _x( "Lithuanian litas", 'currencies', 'listo' ),
'lyd' => _x( "Libyan dinar", 'currencies', 'listo' ),
'mad' => _x( "Moroccan dirham", 'currencies', 'listo' ),
'mdl' => _x( "Moldovan leu", 'currencies', 'listo' ),
'mga' => _x( "Malagasy ariary", 'currencies', 'listo' ),
'mkd' => _x( "Macedonian denar", 'currencies', 'listo' ),
'mmk' => _x( "Myanma kyat", 'currencies', 'listo' ),
'mnt' => _x( "Mongolian tugrik", 'currencies', 'listo' ),
'mop' => _x( "Macanese pataca", 'currencies', 'listo' ),
'mro' => _x( "Mauritanian ouguiya", 'currencies', 'listo' ),
'mur' => _x( "Mauritian rupee", 'currencies', 'listo' ),
'mvr' => _x( "Maldivian rufiyaa", 'currencies', 'listo' ),
'mwk' => _x( "Malawian kwacha", 'currencies', 'listo' ),
'mxn' => _x( "Mexican peso", 'currencies', 'listo' ),
'myr' => _x( "Malaysian ringgit", 'currencies', 'listo' ),
'mzn' => _x( "Mozambican metical", 'currencies', 'listo' ),
'nad' => _x( "Namibian dollar", 'currencies', 'listo' ),
'ngn' => _x( "Nigerian naira", 'currencies', 'listo' ),
'nio' => _x( "Nicaraguan córdoba", 'currencies', 'listo' ),
'nok' => _x( "Norwegian krone", 'currencies', 'listo' ),
'npr' => _x( "Nepalese rupee", 'currencies', 'listo' ),
'nzd' => _x( "New Zealand dollar", 'currencies', 'listo' ),
'omr' => _x( "Omani rial", 'currencies', 'listo' ),
'pab' => _x( "Panamanian balboa", 'currencies', 'listo' ),
'pen' => _x( "Peruvian nuevo sol", 'currencies', 'listo' ),
'pgk' => _x( "Papua New Guinean kina", 'currencies', 'listo' ),
'php' => _x( "Philippine peso", 'currencies', 'listo' ),
'pkr' => _x( "Pakistani rupee", 'currencies', 'listo' ),
'pln' => _x( "Polish złoty", 'currencies', 'listo' ),
'pyg' => _x( "Paraguayan guaraní", 'currencies', 'listo' ),
'qar' => _x( "Qatari riyal", 'currencies', 'listo' ),
'ron' => _x( "Romanian new leu", 'currencies', 'listo' ),
'rsd' => _x( "Serbian dinar", 'currencies', 'listo' ),
'rub' => _x( "Russian ruble", 'currencies', 'listo' ),
'rwf' => _x( "Rwandan franc", 'currencies', 'listo' ),
'sar' => _x( "Saudi riyal", 'currencies', 'listo' ),
'sbd' => _x( "Solomon Islands dollar", 'currencies', 'listo' ),
'scr' => _x( "Seychelles rupee", 'currencies', 'listo' ),
'sdg' => _x( "Sudanese pound", 'currencies', 'listo' ),
'sek' => _x( "Swedish krona/kronor", 'currencies', 'listo' ),
'sgd' => _x( "Singapore dollar", 'currencies', 'listo' ),
'shp' => _x( "Saint Helena pound", 'currencies', 'listo' ),
'sll' => _x( "Sierra Leonean leone", 'currencies', 'listo' ),
'sos' => _x( "Somali shilling", 'currencies', 'listo' ),
'srd' => _x( "Surinamese dollar", 'currencies', 'listo' ),
'ssp' => _x( "South Sudanese pound", 'currencies', 'listo' ),
'std' => _x( "São Tomé and Príncipe dobra", 'currencies', 'listo' ),
'syp' => _x( "Syrian pound", 'currencies', 'listo' ),
'szl' => _x( "Swazi lilangeni", 'currencies', 'listo' ),
'thb' => _x( "Thai baht", 'currencies', 'listo' ),
'tjs' => _x( "Tajikistani somoni", 'currencies', 'listo' ),
'tmt' => _x( "Turkmenistani manat", 'currencies', 'listo' ),
'tnd' => _x( "Tunisian dinar", 'currencies', 'listo' ),
'top' => _x( "Tongan paʻanga", 'currencies', 'listo' ),
'try' => _x( "Turkish lira", 'currencies', 'listo' ),
'ttd' => _x( "Trinidad and Tobago dollar", 'currencies', 'listo' ),
'twd' => _x( "New Taiwan dollar", 'currencies', 'listo' ),
'tzs' => _x( "Tanzanian shilling", 'currencies', 'listo' ),
'uah' => _x( "Ukrainian hryvnia", 'currencies', 'listo' ),
'ugx' => _x( "Ugandan shilling", 'currencies', 'listo' ),
'usd' => _x( "United States dollar", 'currencies', 'listo' ),
'uyu' => _x( "Uruguayan peso", 'currencies', 'listo' ),
'uzs' => _x( "Uzbekistan som", 'currencies', 'listo' ),
'vef' => _x( "Venezuelan bolívar", 'currencies', 'listo' ),
'vnd' => _x( "Vietnamese dong", 'currencies', 'listo' ),
'vuv' => _x( "Vanuatu vatu", 'currencies', 'listo' ),
'wst' => _x( "Samoan tala", 'currencies', 'listo' ),
'xaf' => _x( "CFA franc BEAC", 'currencies', 'listo' ),
'xcd' => _x( "East Caribbean dollar", 'currencies', 'listo' ),
'xof' => _x( "CFA franc BCEAO", 'currencies', 'listo' ),
'xpf' => _x( "CFP franc (franc Pacifique)", 'currencies', 'listo' ),
'yer' => _x( "Yemeni rial", 'currencies', 'listo' ),
'zar' => _x( "South African rand", 'currencies', 'listo' ),
'zmw' => _x( "Zambian kwacha", 'currencies', 'listo' ),
'zwl' => _x( "Zimbabwe dollar", 'currencies', 'listo' ),
);
}
public static function groups() {
return array();
}
}

+ 63
- 0
modules/in-subdivisions.php View File

@ -0,0 +1,63 @@
<?php
/**
* The list of subdivisions of India based on ISO 3166-2:IN standard.
*
* Source: https://en.wikipedia.org/wiki/ISO_3166-2:IN ISO 3166-2:IN
*/
class Listo_IN_Subdivisions implements Listo {
private function __construct() {}
public static function items() {
return array(
'ap' => _x( "Andhra Pradesh", 'in_subdivisions', 'listo' ),
'ar' => _x( "Arunachal Pradesh", 'in_subdivisions', 'listo' ),
'as' => _x( "Assam", 'in_subdivisions', 'listo' ),
'br' => _x( "Bihar", 'in_subdivisions', 'listo' ),
'ct' => _x( "Chhattisgarh", 'in_subdivisions', 'listo' ),
'ga' => _x( "Goa", 'in_subdivisions', 'listo' ),
'gj' => _x( "Gujarat", 'in_subdivisions', 'listo' ),
'hr' => _x( "Haryana", 'in_subdivisions', 'listo' ),
'hp' => _x( "Himachal Pradesh", 'in_subdivisions', 'listo' ),
'jk' => _x( "Jammu and Kashmir", 'in_subdivisions', 'listo' ),
'jh' => _x( "Jharkhand", 'in_subdivisions', 'listo' ),
'ka' => _x( "Karnataka", 'in_subdivisions', 'listo' ),
'kl' => _x( "Kerala", 'in_subdivisions', 'listo' ),
'mp' => _x( "Madhya Pradesh", 'in_subdivisions', 'listo' ),
'mh' => _x( "Maharashtra", 'in_subdivisions', 'listo' ),
'mn' => _x( "Manipur", 'in_subdivisions', 'listo' ),
'ml' => _x( "Meghalaya", 'in_subdivisions', 'listo' ),
'mz' => _x( "Mizoram", 'in_subdivisions', 'listo' ),
'nl' => _x( "Nagaland", 'in_subdivisions', 'listo' ),
'or' => _x( "Odisha", 'in_subdivisions', 'listo' ),
'pb' => _x( "Punjab", 'in_subdivisions', 'listo' ),
'rj' => _x( "Rajasthan", 'in_subdivisions', 'listo' ),
'sk' => _x( "Sikkim", 'in_subdivisions', 'listo' ),
'tn' => _x( "Tamil Nadu", 'in_subdivisions', 'listo' ),
'tg' => _x( "Telangana", 'in_subdivisions', 'listo' ),
'tr' => _x( "Tripura", 'in_subdivisions', 'listo' ),
'ut' => _x( "Uttarakhand", 'in_subdivisions', 'listo' ),
'up' => _x( "Uttar Pradesh", 'in_subdivisions', 'listo' ),
'wb' => _x( "West Bengal", 'in_subdivisions', 'listo' ),
'an' => _x( "Andaman and Nicobar Islands", 'in_subdivisions', 'listo' ),
'ch' => _x( "Chandigarh", 'in_subdivisions', 'listo' ),
'dn' => _x( "Dadra and Nagar Haveli", 'in_subdivisions', 'listo' ),
'dd' => _x( "Daman and Diu", 'in_subdivisions', 'listo' ),
'dl' => _x( "Delhi", 'in_subdivisions', 'listo' ),
'ld' => _x( "Lakshadweep", 'in_subdivisions', 'listo' ),
'py' => _x( "Puducherry", 'in_subdivisions', 'listo' ),
);
}
public static function groups() {
return array(
'states' => array(
'ap', 'ar', 'as', 'br', 'ct', 'ga', 'gj', 'hr', 'hp', 'jk', 'jh',
'ka', 'kl', 'mp', 'mh', 'mn', 'ml', 'mz', 'nl', 'or', 'pb', 'rj',
'sk', 'tn', 'tg', 'tr', 'ut', 'up', 'wb',
),
'union_territories' => array(
'an', 'ch', 'dn', 'dd', 'dl', 'ld', 'py',
),
);
}
}

+ 59
- 0
modules/time-zones.php View File

@ -0,0 +1,59 @@
<?php
/**
* The list of time zones (UTC offsets).
*
* Source: https://en.wikipedia.org/wiki/Time_zone Time zone
*/
class Listo_Time_Zones implements Listo {
private function __construct() {}
public static function items() {
return array(
'utc-1200' => "UTC-12:00",
'utc-1100' => "UTC-11:00",
'utc-1000' => "UTC-10:00",
'utc-0930' => "UTC-09:30",
'utc-0900' => "UTC-09:00",
'utc-0800' => "UTC-08:00",
'utc-0700' => "UTC-07:00",
'utc-0600' => "UTC-06:00",
'utc-0500' => "UTC-05:00",
'utc-0430' => "UTC-04:30",
'utc-0400' => "UTC-04:00",
'utc-0330' => "UTC-03:30",
'utc-0300' => "UTC-03:00",
'utc-0200' => "UTC-02:00",
'utc-0100' => "UTC-01:00",
'utc+0000' => "UTC±00:00",
'utc+0100' => "UTC+01:00",
'utc+0200' => "UTC+02:00",
'utc+0300' => "UTC+03:00",
'utc+0330' => "UTC+03:30",
'utc+0400' => "UTC+04:00",
'utc+0430' => "UTC+04:30",
'utc+0500' => "UTC+05:00",
'utc+0530' => "UTC+05:30",
'utc+0545' => "UTC+05:45",
'utc+0600' => "UTC+06:00",
'utc+0630' => "UTC+06:30",
'utc+0700' => "UTC+07:00",
'utc+0800' => "UTC+08:00",
'utc+0830' => "UTC+08:30",
'utc+0845' => "UTC+08:45",
'utc+0900' => "UTC+09:00",
'utc+0930' => "UTC+09:30",
'utc+1000' => "UTC+10:00",
'utc+1030' => "UTC+10:30",
'utc+1100' => "UTC+11:00",
'utc+1130' => "UTC+11:30",
'utc+1200' => "UTC+12:00",
'utc+1245' => "UTC+12:45",
'utc+1300' => "UTC+13:00",
'utc+1400' => "UTC+14:00",
);
}
public static function groups() {
return array();
}
}

+ 84
- 0
modules/us-subdivisions.php View File

@ -0,0 +1,84 @@
<?php
/**
* The list of subdivisions of the United States based on ISO 3166-2:US standard.
*
* Source: https://en.wikipedia.org/wiki/ISO_3166-2:US ISO 3166-2:US
*/
class Listo_US_Subdivisions implements Listo {
private function __construct() {}
public static function items() {
return array(
'ak' => _x( "Alaska", 'us_subdivisions', 'listo' ),
'al' => _x( "Alabama", 'us_subdivisions', 'listo' ),
'ar' => _x( "Arkansas", 'us_subdivisions', 'listo' ),
'as' => _x( "American Samoa", 'us_subdivisions', 'listo' ),
'az' => _x( "Arizona", 'us_subdivisions', 'listo' ),
'ca' => _x( "California", 'us_subdivisions', 'listo' ),
'co' => _x( "Colorado", 'us_subdivisions', 'listo' ),
'ct' => _x( "Connecticut", 'us_subdivisions', 'listo' ),
'dc' => _x( "District of Columbia", 'us_subdivisions', 'listo' ),
'de' => _x( "Delaware", 'us_subdivisions', 'listo' ),
'fl' => _x( "Florida", 'us_subdivisions', 'listo' ),
'ga' => _x( "Georgia", 'us_subdivisions', 'listo' ),
'gu' => _x( "Guam", 'us_subdivisions', 'listo' ),
'hi' => _x( "Hawaii", 'us_subdivisions', 'listo' ),
'ia' => _x( "Iowa", 'us_subdivisions', 'listo' ),
'id' => _x( "Idaho", 'us_subdivisions', 'listo' ),
'il' => _x( "Illinois", 'us_subdivisions', 'listo' ),
'in' => _x( "Indiana", 'us_subdivisions', 'listo' ),
'ks' => _x( "Kansas", 'us_subdivisions', 'listo' ),
'ky' => _x( "Kentucky", 'us_subdivisions', 'listo' ),
'la' => _x( "Louisiana", 'us_subdivisions', 'listo' ),
'ma' => _x( "Massachusetts", 'us_subdivisions', 'listo' ),
'md' => _x( "Maryland", 'us_subdivisions', 'listo' ),
'me' => _x( "Maine", 'us_subdivisions', 'listo' ),
'mi' => _x( "Michigan", 'us_subdivisions', 'listo' ),
'mn' => _x( "Minnesota", 'us_subdivisions', 'listo' ),
'mo' => _x( "Missouri", 'us_subdivisions', 'listo' ),
'mp' => _x( "Northern Mariana Islands", 'us_subdivisions', 'listo' ),
'ms' => _x( "Mississippi", 'us_subdivisions', 'listo' ),
'mt' => _x( "Montana", 'us_subdivisions', 'listo' ),
'nc' => _x( "North Carolina", 'us_subdivisions', 'listo' ),
'nd' => _x( "North Dakota", 'us_subdivisions', 'listo' ),
'ne' => _x( "Nebraska", 'us_subdivisions', 'listo' ),
'nh' => _x( "New Hampshire", 'us_subdivisions', 'listo' ),
'nj' => _x( "New Jersey", 'us_subdivisions', 'listo' ),
'nm' => _x( "New Mexico", 'us_subdivisions', 'listo' ),
'nv' => _x( "Nevada", 'us_subdivisions', 'listo' ),
'ny' => _x( "New York", 'us_subdivisions', 'listo' ),
'oh' => _x( "Ohio", 'us_subdivisions', 'listo' ),
'ok' => _x( "Oklahoma", 'us_subdivisions', 'listo' ),
'or' => _x( "Oregon", 'us_subdivisions', 'listo' ),
'pa' => _x( "Pennsylvania", 'us_subdivisions', 'listo' ),
'pr' => _x( "Puerto Rico", 'us_subdivisions', 'listo' ),
'ri' => _x( "Rhode Island", 'us_subdivisions', 'listo' ),
'sc' => _x( "South Carolina", 'us_subdivisions', 'listo' ),
'sd' => _x( "South Dakota", 'us_subdivisions', 'listo' ),
'tn' => _x( "Tennessee", 'us_subdivisions', 'listo' ),
'tx' => _x( "Texas", 'us_subdivisions', 'listo' ),
'um' => _x( "United States Minor Outlying Islands", 'us_subdivisions', 'listo' ),
'ut' => _x( "Utah", 'us_subdivisions', 'listo' ),
'va' => _x( "Virginia", 'us_subdivisions', 'listo' ),
'vi' => _x( "Virgin Islands, U.S.", 'us_subdivisions', 'listo' ),
'vt' => _x( "Vermont", 'us_subdivisions', 'listo' ),
'wa' => _x( "Washington", 'us_subdivisions', 'listo' ),
'wi' => _x( "Wisconsin", 'us_subdivisions', 'listo' ),
'wv' => _x( "West Virginia", 'us_subdivisions', 'listo' ),
'wy' => _x( "Wyoming", 'us_subdivisions', 'listo' ),
);
}
public static function groups() {
return array(
'states' => array( 'ak', 'al', 'ar', 'az', 'ca', 'co', 'ct', 'de',
'fl', 'ga', 'hi', 'ia', 'id', 'il', 'in', 'ks', 'ky', 'la', 'ma',
'md', 'me', 'mi', 'mn', 'mo', 'ms', 'mt', 'nc', 'nd', 'ne', 'nh',
'nj', 'nm', 'nv', 'ny', 'oh', 'ok', 'or', 'pa', 'ri', 'sc', 'sd',
'tn', 'tx', 'ut', 'va', 'vt', 'wa', 'wi', 'wv', 'wy',
),
'districts' => array( 'dc' ),
'outlying_areas' => array( 'as', 'gu', 'mp', 'pr', 'um', 'vi' ),
);
}
}

+ 63
- 0
readme.txt View File

@ -0,0 +1,63 @@
=== Listo ===
Contributors: takayukister
Donate link: https://contactform7.com/donate/
Tags: list, countries, subdivisions, states, currencies
Requires at least: 4.6
Tested up to: 4.9
Stable tag: 1.2.1
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Listo is a simple plugin that supplies commonly used lists to other plugins and themes.
== Description ==
Listo is a simple plugin that supplies other plugins and themes with commonly used lists (such as lists of countries, subdivisions of countries, and currencies). Listo is also able to filter list items based on defined subgroups. For example, Countries provides a list of countries and dependent territories based on the ISO 3166 standard (249 items), and its subgroup 'un' only includes members of the United Nations (193 items).
Listo currently has the following lists and subgroups.
1. Countries (countries) &mdash; A list of countries and dependent territories based on the [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1) standard (249 items).
Subgroups:
* un &mdash; Members of the United Nations (193 items)
* olympic &mdash; Countries and dependent territories that have their National Olympic Committee (205 items)
2. U.S. Subdivisions (us_subdivisions) &mdash; The list of subdivisions of the United States based on the [ISO 3166-2:US](https://en.wikipedia.org/wiki/ISO_3166-2:US) standard (57 items).
Subgroups:
* states (50 items)
* districts (1 item; District of Columbia)
* outlying_areas (6 items)
3. Currencies (currencies) &mdash; A list of currencies based on the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) standard (156 items).
Subgroups: None
4. Time Zones (time_zones) &mdash; UTC offsets.
Subgroups: None
5. Subdivisions of India (in_subdivisions) &mdash; The list of subdivisions of India based on the [ISO 3166-2:IN](https://en.wikipedia.org/wiki/ISO_3166-2:IN) standard (36 items).
Subgroups:
* states (29 items)
* union_territories (7 items)
== Installation ==
1. Upload the entire `listo` folder to the `/wp-content/plugins/` directory.
1. Activate the plugin through the 'Plugins' menu in WordPress.
== Changelog ==
= 1.2.1 =
* Modified some code following the WordPress coding standard.
* Confirmed compatibility with the current WordPress.
* Language files have moved to translate.wordpress.org so removed them from the plugin package.
= 1.2 =
* Added a REST API endpoint.
* Added the in_subdivisions (Subdivisions of India) module.
* Updated the olympic group of the Countries list module based on the countries and dependent territories that have their National Olympic Committee.

+ 39
- 0
rest-api.php View File

@ -0,0 +1,39 @@
<?php
add_action( 'rest_api_init', 'listo_rest_api_init' );
function listo_rest_api_init() {
register_rest_route( 'listo/v1',
'/(?P<type>[a-z0-9_-]+)',
array(
'methods' => WP_REST_Server::READABLE,
'callback' => 'listo_rest',
)
);
}
function listo_rest( WP_REST_Request $request ) {
$type = $request->get_param( 'type' );
$type = str_replace( '-', '_', trim( $type ) );
$group = $request->get_param( 'group' );
$group = str_replace( '-', '_', trim( $group ) );
$locale = $request->get_param( 'locale' );
$locale = str_replace( '-', '_', trim( $locale ) );
$args = array(
'group' => $group,
'locale' => $locale,
);
$items = listo( $type, $args );
if ( ! $items ) {
return new WP_Error( 'listo_not_found',
__( "The requested list was not found.", 'listo' ),
array( 'status' => 404 ) );
}
return rest_ensure_response( $items );
}

Loading…
Cancel
Save