r106494 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106493‎ | r106494 | r106495 >
Date:01:23, 17 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
work on institution management
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCoursePager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPStudentPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditInstitution.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitutions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialInstitutions.php
@@ -60,7 +60,7 @@
6161 $this->displayAddNewControl();
6262 }
6363
64 - $pager = new EPOrgPager( );
 64+ $pager = new EPOrgPager( $this->getContext() );
6565
6666 if ( $pager->getNumRows() ) {
6767 $this->getOutput()->addHTML(
Index: trunk/extensions/EducationProgram/specials/SpecialEditInstitution.php
@@ -48,14 +48,27 @@
4949 },
5050 );
5151
 52+ $countries = efEpGetCountries();
 53+
5254 $fields['country'] = array (
5355 'type' => 'select',
5456 'label-message' => 'educationprogram-org-edit-country',
5557 'required' => true,
56 - 'options' => array( 'foo' => 'foo', 'bar' => 'bar' ), // TODO
 58+ 'options' => efEpGetCountryOptions(),
 59+ 'validation-callback' => array( $this, 'countryIsValid' ),
5760 );
5861
5962 return $this->processFormFields( $fields );
6063 }
 64+
 65+ public function countryIsValid( $value, array $alldata = null ) {
 66+ $countries = array_keys( efEpGetCountries() );
 67+
 68+ if ( $this->isNew() ) {
 69+ array_unshift( $countries, '' );
 70+ }
 71+
 72+ return in_array( $value, $countries ) ? true : wfMsg( 'educationprogram-org-invalid-country' );
 73+ }
6174
6275 }
Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php
@@ -87,7 +87,7 @@
8888 public function execute( $subPage ) {
8989 parent::execute( $subPage );
9090
91 - if ( $this->isNew() ) {
 91+ if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
9292 $this->showForm();
9393 }
9494 else {
@@ -96,6 +96,43 @@
9797 }
9898
9999 /**
 100+ * @since 0.1
 101+ */
 102+ protected function showContent() {
 103+ $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_>
 104+
 105+ if ( $this->isNew() ) {
 106+ $data = $this->getNewData();
 107+
 108+ $object = $c::selectRow( null, $data );
 109+
 110+ if ( $object === false ) {
 111+ $object = new $c( $data, true );
 112+ }
 113+ else {
 114+ $this->showWarning( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' );
 115+ }
 116+ }
 117+ else {
 118+ $object = $c::selectRow( null, array( 'name' => $this->subPage ) );
 119+ }
 120+
 121+ if ( $object === false ) {
 122+ $this->getOutput()->redirect( SpecialPage::getTitleFor( $this->listPage )->getLocalURL() );
 123+ }
 124+ else {
 125+// if ( !$this->isNew() ) {
 126+// $this->getOutput()->addHTML(
 127+// SpecialContestPage::getNavigation( $contest->getField( 'name' ), $this->getUser(), $this->getLanguage(), $this->getName() )
 128+// );
 129+// }
 130+
 131+ $this->item = $object;
 132+ $this->showForm();
 133+ }
 134+ }
 135+
 136+ /**
100137 * Returns if the page should work in insertion mode rather then modification mode.
101138 *
102139 * @since 0.1
@@ -143,47 +180,7 @@
144181 protected function getNewData() {
145182 return array( 'name' => $this->getRequest()->getVal( 'newname' ) );
146183 }
147 -
148 - /**
149 - * Attempt to get the contest to be edited or create the one to be added.
150 - * If this works, show the form, if not, redirect to special:contests.
151 - *
152 - * @since 0.1
153 - */
154 - protected function showContent() {
155 - $c = $this->itemClass;
156 -
157 - if ( $this->isNew() ) {
158 - $data = $this->getNewData();
159184
160 - $object = $c::selectRow( null, $data );
161 -
162 - if ( $object === false ) {
163 - $object = new Contest( $data, true );
164 - }
165 - else {
166 - $this->showWarning( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' );
167 - }
168 - }
169 - else {
170 - $object = $c::selectRow( null, array( 'name' => $this->subPage ) );
171 - }
172 -
173 - if ( $object === false ) {
174 - $this->getOutput()->redirect( SpecialPage::getTitleFor( $this->listPage )->getLocalURL() );
175 - }
176 - else {
177 -// if ( !$this->isNew() ) {
178 -// $this->getOutput()->addHTML(
179 -// SpecialContestPage::getNavigation( $contest->getField( 'name' ), $this->getUser(), $this->getLanguage(), $this->getName() )
180 -// );
181 -// }
182 -
183 - $this->item = $object;
184 - $this->showForm();
185 - }
186 - }
187 -
188185 /**
189186 * (non-PHPdoc)
190187 * @see FormSpecialPage::getForm()
@@ -240,8 +237,9 @@
241238 protected function processFormFields( array $fields ) {
242239 if ( $this->item !== false ) {
243240 foreach ( $fields as $name => &$data ) {
244 - $default = $this->item->getField( $name );
245 - $data['default'] = $default;
 241+ if ( !array_key_exists( 'default', $data ) ) {
 242+ $data['default'] = $this->item->getField( $name );
 243+ }
246244 }
247245 }
248246
@@ -252,6 +250,7 @@
253251 // HTML form is being a huge pain in running the validation on post,
254252 // so just remove it if when not appropriate.
255253 unset( $field['validation-callback'] );
 254+ unset( $field['required'] );
256255 }
257256
258257 $mappedFields['item-' . $name] = $field;
@@ -278,21 +277,25 @@
279278 *
280279 * @return Bool|Array
281280 */
282 - public function onSubmit( array $data ) {
 281+ public function handleSubmission( array $data ) {
283282 $fields = array();
284283
285284 foreach ( $data as $name => $value ) {
286285 $matches = array();
287286
288287 if ( preg_match( '/item-(.+)/', $name, $matches ) ) {
 288+ if ( $matches[1] === 'id' && $value === '' ) {
 289+ $value = null;
 290+ }
 291+
289292 $fields[$matches[1]] = $value;
290293 }
291294 }
292295
293 - $c = $this->itemClass;
294 - $item = new $c( $fields, is_null( $fields['id'] ) );
 296+ $c = $this->itemClass; // Yeah, this is needed in PHP 5.3 >_>
 297+ /* EPDBObject */ $item = new $c( $fields, is_null( $fields['id'] ) );
295298
296 - $success = $item->writeAllToDB();
 299+ $success = $item->writeToDB();
297300
298301 if ( $success ) {
299302 return true;
Index: trunk/extensions/EducationProgram/includes/EPStudentPager.php
@@ -16,13 +16,14 @@
1717 /**
1818 * Constructor.
1919 *
 20+ * @param IContextSource $context
2021 * @param array $conds
2122 */
22 - public function __construct( array $conds = array() ) {
 23+ public function __construct( IContextSource $context, array $conds = array() ) {
2324 $this->mDefaultDirection = true;
2425
2526 // when MW 1.19 becomes min, we want to pass an IContextSource $context here.
26 - parent::__construct( $conds, 'EPStudent' );
 27+ parent::__construct( $context, $conds, 'EPStudent' );
2728 }
2829
2930 /**
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php
@@ -16,13 +16,14 @@
1717 /**
1818 * Constructor.
1919 *
 20+ * @param IContextSource $context
2021 * @param array $conds
2122 */
22 - public function __construct( array $conds = array() ) {
 23+ public function __construct( IContextSource $context, array $conds = array() ) {
2324 $this->mDefaultDirection = true;
2425
2526 // when MW 1.19 becomes min, we want to pass an IContextSource $context here.
26 - parent::__construct( $conds, 'EPOrg' );
 27+ parent::__construct( $context, $conds, 'EPOrg' );
2728 }
2829
2930 /**
@@ -31,7 +32,9 @@
3233 */
3334 public function getFieldNames() {
3435 return parent::getFieldNameList( array(
35 - // TODO
 36+ 'name',
 37+ 'city',
 38+ 'country',
3639 ) );
3740 }
3841
@@ -65,8 +68,12 @@
6669 return $value;
6770 }
6871
 72+ /**
 73+ * (non-PHPdoc)
 74+ * @see TablePager::getDefaultSort()
 75+ */
6976 function getDefaultSort() {
70 - return ''; // TODO
 77+ return 'asc';
7178 }
7279
7380 /**
@@ -74,7 +81,25 @@
7582 * @see EPPager::getSortableFields()
7683 */
7784 protected function getSortableFields() {
78 - return array();
 85+ return array(
 86+ 'name',
 87+ 'city',
 88+ 'country',
 89+ );
7990 }
 91+
 92+ /**
 93+ * (non-PHPdoc)
 94+ * @see EPPager::getFilterOptions()
 95+ */
 96+ protected function getFilterOptions() {
 97+ return array(
 98+ 'country' => array(
 99+ 'type' => 'select',
 100+ 'options' => efEpGetCountryOptions(),
 101+ 'value' => ''
 102+ ),
 103+ );
 104+ }
80105
81106 }
Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -51,5 +51,13 @@
5252 'country' => 'str',
5353 );
5454 }
 55+
 56+ public static function getDefaults() {
 57+ return array(
 58+ 'name' => '',
 59+ 'city' => '',
 60+ 'country' => '',
 61+ );
 62+ }
5563
5664 }
Index: trunk/extensions/EducationProgram/includes/EPPager.php
@@ -36,16 +36,30 @@
3737 protected $currentObject;
3838
3939 /**
 40+ * Context in which this pager is being shown.
 41+ * @since 0.1
 42+ * @var IContextSource
 43+ */
 44+ protected $context;
 45+
 46+ /**
4047 * Constructor.
4148 *
 49+ * @param IContextSource $context
4250 * @param array $conds
 51+ * @param string $className
4352 */
44 - public function __construct( array $conds, $className ) {
 53+ public function __construct( IContextSource $context, array $conds, $className ) {
4554 $this->conds = $conds;
4655 $this->className = $className;
 56+ $this->context = $context;
4757
48 - // when MW 1.19 becomes min, we want to pass an IContextSource $context here.
49 - parent::__construct();
 58+ if ( version_compare( $GLOBALS['wgVersion'], '1.18c', '>' ) ) {
 59+ parent::__construct( $context );
 60+ }
 61+ else {
 62+ parent::__construct();
 63+ }
5064 }
5165
5266 /**
@@ -57,7 +71,7 @@
5872 * @return OutputPage
5973 */
6074 public function getOutput() {
61 - return version_compare( $GLOBALS['wgVersion'], '1.18', '>' ) ? parent::getOutput() : $GLOBALS['wgOut'];
 75+ return $this->context->getOutput();
6276 }
6377
6478 /**
@@ -69,7 +83,7 @@
7084 * @return Language
7185 */
7286 public function getLanguage() {
73 - return version_compare( $GLOBALS['wgVersion'], '1.18', '>' ) ? parent::getLanguage() : $GLOBALS['wgLang'];
 87+ return $this->context->getLanguage();
7488 }
7589
7690 /**
@@ -81,7 +95,7 @@
8296 * @return User
8397 */
8498 public function getUser() {
85 - return version_compare( $GLOBALS['wgUser'], '1.18', '>' ) ? parent::getUser() : $GLOBALS['wgUser'];
 99+ return $this->context->getUser();
86100 }
87101
88102 /**
@@ -100,19 +114,42 @@
101115 }
102116
103117 function getQueryInfo() {
104 - $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
 118+ $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
105119 return array(
106120 'tables' => array( $c::getDBTable() ),
107121 'fields' => $c::getPrefixedFields( $c::getFieldNames() ),
108 - 'conds' => $c::getPrefixedValues( $this->conds ),
 122+ 'conds' => $c::getPrefixedValues( $this->getConditions() ),
109123 );
110124 }
111125
 126+ /**
 127+ *
 128+ *
 129+ * @since 0.1
 130+ *
 131+ * @return array
 132+ */
 133+ protected function getConditions() {
 134+ $req = $this->getRequest();
 135+ $conds = array();
 136+
 137+ $filterOptions = $this->getFilterOptions();
 138+ $this->addFilterValues( $filterOptions );
 139+
 140+ foreach ( $filterOptions as $optionName => $optionData ) {
 141+ if ( array_key_exists( 'value', $optionData ) && $optionData['value'] !== '' ) {
 142+ $conds[$optionName] = $optionData['value'];
 143+ }
 144+ }
 145+
 146+ return array_merge( $conds, $this->conds );
 147+ }
 148+
112149 function isFieldSortable( $name ) {
113150 $c = $this->className; // Yeah, this is needed in PHP 5.3 >_>
114151 return in_array(
115152 $name,
116 - $c::getPrefixedFields( 'id' )
 153+ $c::getPrefixedFields( $this->getSortableFields() )
117154 );
118155 }
119156
@@ -136,7 +173,7 @@
137174 );
138175 }
139176
140 - return array_map( 'wfMsg', $headers );
 177+ return $headers;
141178 }
142179
143180 /**
@@ -168,7 +205,7 @@
169206 *
170207 * @return string
171208 */
172 - public function getFilterControl( $hideWhenNoResults ) {
 209+ public function getFilterControl( $hideWhenNoResults = true ) {
173210 $filterOptions = $this->getFilterOptions();
174211
175212 if ( count( $filterOptions ) < 1 ) {
@@ -201,7 +238,7 @@
202239 $controls[] = $control;
203240 }
204241
205 - $title = $this->getTitle( $this->subPage )->getFullText();
 242+ $title = $this->getTitle()->getFullText();
206243
207244 return
208245 '<fieldset>' .
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php
@@ -16,13 +16,14 @@
1717 /**
1818 * Constructor.
1919 *
 20+ * @param IContextSource $context
2021 * @param array $conds
2122 */
22 - public function __construct( array $conds = array() ) {
 23+ public function __construct( IContextSource $context, array $conds = array() ) {
2324 $this->mDefaultDirection = true;
2425
2526 // when MW 1.19 becomes min, we want to pass an IContextSource $context here.
26 - parent::__construct( $conds, 'EPCourse' );
 27+ parent::__construct( $context, $conds, 'EPCourse' );
2728 }
2829
2930 /**
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -64,11 +64,19 @@
6565 'ep-institutions-newname' => 'Institution name:',
6666 'ep-institutions-add' => 'Add institution',
6767
 68+ // Org pager
 69+ 'educationprogram-pager-eporg-name' => 'Name',
 70+ 'educationprogram-pager-eporg-city' => 'City',
 71+ 'educationprogram-pager-eporg-country' => 'Country',
 72+
6873 // Special:EditInstitution
6974 'editinstitution-text' => 'Enter the institution details below and click submit to save your changes.',
7075 'educationprogram-org-edit-name' => 'Institution name',
7176 'editinstitution-add-legend' => 'Add institution',
7277 'editinstitution-edit-legend' => 'Edit institution',
 78+ 'educationprogram-org-edit-city' => 'City',
 79+ 'educationprogram-org-edit-country' => 'Country',
 80+ 'educationprogram-org-submit' => 'Submit',
7381
7482 );
7583
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -147,3 +147,272 @@
148148
149149 # The default value for the user preferences.
150150 //$wgDefaultUserOptions[''] = false;
 151+
 152+/**
 153+ * Returns a list of ISO 3166-1-alpha-2 country codes (keys) and their corresponding country (values).
 154+ * TODO: move this to sane location, this is temporary, since the final solution has not been decided upon.
 155+ *
 156+ * @since 0.1
 157+ *
 158+ * @return array
 159+ */
 160+function efEpGetCountries() {
 161+ return array(
 162+ 'AF' => 'Afghanistan',
 163+ 'AL' => 'Albania',
 164+ 'DZ' => 'Algeria',
 165+ 'AS' => 'American Samoa',
 166+ 'AD' => 'Andorra',
 167+ 'AO' => 'Angola',
 168+ 'AI' => 'Anguilla',
 169+ 'AQ' => 'Antarctica',
 170+ 'AG' => 'Antigua and Barbuda',
 171+ 'AR' => 'Argentina',
 172+ 'AM' => 'Armenia',
 173+ 'AW' => 'Aruba',
 174+ 'AU' => 'Australia',
 175+ 'AT' => 'Austria',
 176+ 'AZ' => 'Azerbaijan',
 177+ 'BS' => 'Bahamas',
 178+ 'BH' => 'Bahrain',
 179+ 'BD' => 'Bangladesh',
 180+ 'BB' => 'Barbados',
 181+ 'BY' => 'Belarus',
 182+ 'BE' => 'Belgium',
 183+ 'BZ' => 'Belize',
 184+ 'BJ' => 'Benin',
 185+ 'BM' => 'Bermuda',
 186+ 'BT' => 'Bhutan',
 187+ 'BO' => 'Bolivia',
 188+ 'BA' => 'Bosnia and Herzegovina',
 189+ 'BW' => 'Botswana',
 190+ 'BV' => 'Bouvet Island',
 191+ 'BR' => 'Brazil',
 192+ 'IO' => 'British Indian Ocean Territory',
 193+ 'BN' => 'Brunei Darussalam',
 194+ 'BG' => 'Bulgaria',
 195+ 'BF' => 'Burkina Faso',
 196+ 'BI' => 'Burundi',
 197+ 'KH' => 'Cambodia',
 198+ 'CM' => 'Cameroon',
 199+ 'CA' => 'Canada',
 200+ 'CV' => 'Cape Verde',
 201+ 'KY' => 'Cayman Islands',
 202+ 'CF' => 'Central African Republic',
 203+ 'TD' => 'Chad',
 204+ 'CL' => 'Chile',
 205+ 'CN' => 'China',
 206+ 'CX' => 'Christmas Island',
 207+ 'CC' => 'Cocos (Keeling) Islands',
 208+ 'CO' => 'Colombia',
 209+ 'KM' => 'Comoros',
 210+ 'CG' => 'Congo',
 211+ 'CD' => 'Congo, the Democratic Republic of the',
 212+ 'CK' => 'Cook Islands',
 213+ 'CR' => 'Costa Rica',
 214+ 'CI' => "Cote D'Ivoire",
 215+ 'HR' => 'Croatia',
 216+ 'CU' => 'Cuba',
 217+ 'CY' => 'Cyprus',
 218+ 'CZ' => 'Czech Republic',
 219+ 'DK' => 'Denmark',
 220+ 'DJ' => 'Djibouti',
 221+ 'DM' => 'Dominica',
 222+ 'DO' => 'Dominican Republic',
 223+ 'EC' => 'Ecuador',
 224+ 'EG' => 'Egypt',
 225+ 'SV' => 'El Salvador',
 226+ 'GQ' => 'Equatorial Guinea',
 227+ 'ER' => 'Eritrea',
 228+ 'EE' => 'Estonia',
 229+ 'ET' => 'Ethiopia',
 230+ 'FK' => 'Falkland Islands (Malvinas)',
 231+ 'FO' => 'Faroe Islands',
 232+ 'FJ' => 'Fiji',
 233+ 'FI' => 'Finland',
 234+ 'FR' => 'France',
 235+ 'GF' => 'French Guiana',
 236+ 'PF' => 'French Polynesia',
 237+ 'TF' => 'French Southern Territories',
 238+ 'GA' => 'Gabon',
 239+ 'GM' => 'Gambia',
 240+ 'GE' => 'Georgia',
 241+ 'DE' => 'Germany',
 242+ 'GH' => 'Ghana',
 243+ 'GI' => 'Gibraltar',
 244+ 'GR' => 'Greece',
 245+ 'GL' => 'Greenland',
 246+ 'GD' => 'Grenada',
 247+ 'GP' => 'Guadeloupe',
 248+ 'GU' => 'Guam',
 249+ 'GT' => 'Guatemala',
 250+ 'GN' => 'Guinea',
 251+ 'GW' => 'Guinea-Bissau',
 252+ 'GY' => 'Guyana',
 253+ 'HT' => 'Haiti',
 254+ 'HM' => 'Heard Island and Mcdonald Islands',
 255+ 'VA' => 'Holy See (Vatican City State)',
 256+ 'HN' => 'Honduras',
 257+ 'HK' => 'Hong Kong',
 258+ 'HU' => 'Hungary',
 259+ 'IS' => 'Iceland',
 260+ 'IN' => 'India',
 261+ 'ID' => 'Indonesia',
 262+ 'IR' => 'Iran, Islamic Republic of',
 263+ 'IQ' => 'Iraq',
 264+ 'IE' => 'Ireland',
 265+ 'IL' => 'Israel',
 266+ 'IT' => 'Italy',
 267+ 'JM' => 'Jamaica',
 268+ 'JP' => 'Japan',
 269+ 'JO' => 'Jordan',
 270+ 'KZ' => 'Kazakhstan',
 271+ 'KE' => 'Kenya',
 272+ 'KI' => 'Kiribati',
 273+ 'KP' => "Korea, Democratic People's Republic of",
 274+ 'KR' => 'Korea, Republic of',
 275+ 'KW' => 'Kuwait',
 276+ 'KG' => 'Kyrgyzstan',
 277+ 'LA' => "Lao People's Democratic Republic",
 278+ 'LV' => 'Latvia',
 279+ 'LB' => 'Lebanon',
 280+ 'LS' => 'Lesotho',
 281+ 'LR' => 'Liberia',
 282+ 'LY' => 'Libyan Arab Jamahiriya',
 283+ 'LI' => 'Liechtenstein',
 284+ 'LT' => 'Lithuania',
 285+ 'LU' => 'Luxembourg',
 286+ 'MO' => 'Macao',
 287+ 'MK' => 'Macedonia, the Former Yugoslav Republic of',
 288+ 'MG' => 'Madagascar',
 289+ 'MW' => 'Malawi',
 290+ 'MY' => 'Malaysia',
 291+ 'MV' => 'Maldives',
 292+ 'ML' => 'Mali',
 293+ 'MT' => 'Malta',
 294+ 'MH' => 'Marshall Islands',
 295+ 'MQ' => 'Martinique',
 296+ 'MR' => 'Mauritania',
 297+ 'MU' => 'Mauritius',
 298+ 'YT' => 'Mayotte',
 299+ 'MX' => 'Mexico',
 300+ 'FM' => 'Micronesia, Federated States of',
 301+ 'MD' => 'Moldova, Republic of',
 302+ 'MC' => 'Monaco',
 303+ 'MN' => 'Mongolia',
 304+ 'MS' => 'Montserrat',
 305+ 'MA' => 'Morocco',
 306+ 'MZ' => 'Mozambique',
 307+ 'MM' => 'Myanmar',
 308+ 'NA' => 'Namibia',
 309+ 'NR' => 'Nauru',
 310+ 'NP' => 'Nepal',
 311+ 'NL' => 'Netherlands',
 312+ 'AN' => 'Netherlands Antilles',
 313+ 'NC' => 'New Caledonia',
 314+ 'NZ' => 'New Zealand',
 315+ 'NI' => 'Nicaragua',
 316+ 'NE' => 'Niger',
 317+ 'NG' => 'Nigeria',
 318+ 'NU' => 'Niue',
 319+ 'NF' => 'Norfolk Island',
 320+ 'MP' => 'Northern Mariana Islands',
 321+ 'NO' => 'Norway',
 322+ 'OM' => 'Oman',
 323+ 'PK' => 'Pakistan',
 324+ 'PW' => 'Palau',
 325+ 'PS' => 'Palestinian Territory, Occupied',
 326+ 'PA' => 'Panama',
 327+ 'PG' => 'Papua New Guinea',
 328+ 'PY' => 'Paraguay',
 329+ 'PE' => 'Peru',
 330+ 'PH' => 'Philippines',
 331+ 'PN' => 'Pitcairn',
 332+ 'PL' => 'Poland',
 333+ 'PT' => 'Portugal',
 334+ 'PR' => 'Puerto Rico',
 335+ 'QA' => 'Qatar',
 336+ 'RE' => 'Reunion',
 337+ 'RO' => 'Romania',
 338+ 'RU' => 'Russian Federation',
 339+ 'RW' => 'Rwanda',
 340+ 'SH' => 'Saint Helena',
 341+ 'KN' => 'Saint Kitts and Nevis',
 342+ 'LC' => 'Saint Lucia',
 343+ 'PM' => 'Saint Pierre and Miquelon',
 344+ 'VC' => 'Saint Vincent and the Grenadines',
 345+ 'WS' => 'Samoa',
 346+ 'SM' => 'San Marino',
 347+ 'ST' => 'Sao Tome and Principe',
 348+ 'SA' => 'Saudi Arabia',
 349+ 'SN' => 'Senegal',
 350+ 'CS' => 'Serbia and Montenegro',
 351+ 'SC' => 'Seychelles',
 352+ 'SL' => 'Sierra Leone',
 353+ 'SG' => 'Singapore',
 354+ 'SK' => 'Slovakia',
 355+ 'SI' => 'Slovenia',
 356+ 'SB' => 'Solomon Islands',
 357+ 'SO' => 'Somalia',
 358+ 'ZA' => 'South Africa',
 359+ //'GS' => 'South Georgia and the South Sandwich Islands',
 360+ 'ES' => 'Spain',
 361+ 'LK' => 'Sri Lanka',
 362+ 'SD' => 'Sudan',
 363+ 'SR' => 'Suriname',
 364+ 'SJ' => 'Svalbard and Jan Mayen',
 365+ 'SZ' => 'Swaziland',
 366+ 'SE' => 'Sweden',
 367+ 'CH' => 'Switzerland',
 368+ 'SY' => 'Syrian Arab Republic',
 369+ 'TW' => 'Taiwan, Province of China',
 370+ 'TJ' => 'Tajikistan',
 371+ 'TZ' => 'Tanzania, United Republic of',
 372+ 'TH' => 'Thailand',
 373+ 'TL' => 'Timor-Leste',
 374+ 'TG' => 'Togo',
 375+ 'TK' => 'Tokelau',
 376+ 'TO' => 'Tonga',
 377+ 'TT' => 'Trinidad and Tobago',
 378+ 'TN' => 'Tunisia',
 379+ 'TR' => 'Turkey',
 380+ 'TM' => 'Turkmenistan',
 381+ 'TC' => 'Turks and Caicos Islands',
 382+ 'TV' => 'Tuvalu',
 383+ 'UG' => 'Uganda',
 384+ 'UA' => 'Ukraine',
 385+ 'AE' => 'United Arab Emirates',
 386+ 'GB' => 'United Kingdom',
 387+ 'US' => 'United States',
 388+ 'UM' => 'United States Minor Outlying Islands',
 389+ 'UY' => 'Uruguay',
 390+ 'UZ' => 'Uzbekistan',
 391+ 'VU' => 'Vanuatu',
 392+ 'VE' => 'Venezuela',
 393+ 'VN' => 'Viet Nam',
 394+ 'VG' => 'Virgin Islands, British',
 395+ 'VI' => 'Virgin Islands, U.s.',
 396+ 'WF' => 'Wallis and Futuna',
 397+ 'EH' => 'Western Sahara',
 398+ 'YE' => 'Yemen',
 399+ 'ZM' => 'Zambia',
 400+ 'ZW' => 'Zimbabwe'
 401+ );
 402+}
 403+
 404+function efEpGetCountryOptions() {
 405+ $countries = efEpGetCountries();
 406+ return array_merge(
 407+ array( '' => '' ),
 408+ array_combine(
 409+ array_map(
 410+ function( $value, $key ) {
 411+ return $key . ' - ' . $value;
 412+ },
 413+ array_values( $countries ),
 414+ array_keys( $countries )
 415+ ),
 416+ array_keys( $countries )
 417+ )
 418+ );
 419+}
\ No newline at end of file

Status & tagging log