Ticket #2711: 2711.meta.4.diff
File 2711.meta.4.diff, 8.1 KB (added by , 7 years ago) |
---|
-
wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-info.php
diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-info.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/views/sponsors/metabox-sponsor-info.php index 9bbd174a..e6934331 100644
141 141 </ul> 142 142 143 143 <ul class="wcpt-form"> 144 <li> 145 <label for="_wcpt_sponsor_country"> 146 <?php _e( 'Country:', 'wordcamporg' ) ?> 147 </label> 148 149 <?php // todo add selected attribute to select and change first option value to empty string ?> 150 <select id="_wcpt_sponsor_country" name="_wcpt_sponsor_country"> 151 <option value="null" <?php selected( $country, 'null' ); ?>> 152 <?php _e( '-- Select a Country --', 'wordcamporg' ); ?> 153 </option> 154 155 <?php foreach ( $available_countries as $available_country ) : ?> 156 <option value="<?php echo esc_attr( $available_country ); ?>" <?php selected( $available_country, $country ); ?>> 157 <?php echo esc_html( $available_country ); ?> 158 </option> 159 <?php endforeach; ?> 160 </select> 161 162 <?php $this->render_form_field_required_indicator(); ?> 163 </li> 164 144 165 <li class="wcpt-form-header"> 145 166 <?php _e( 'Address', 'wordcamporg' ); ?> 146 167 </li> … … 204 225 id="_wcpt_sponsor_state" 205 226 name="_wcpt_sponsor_state" 206 227 value="<?php echo esc_attr( $state ); ?>" 207 required208 228 /> 209 229 210 <?php $this->render_form_field_required_indicator(); ?> 230 <span class="description"> 231 <?php esc_html_e( 'Only necessary if you want this to be shown on your invoice', 'wordcamporg' ); ?> 232 </span> 211 233 </li> 212 234 213 235 <li> … … 227 249 228 250 <?php $this->render_form_field_required_indicator(); ?> 229 251 </li> 230 231 <li>232 <label for="_wcpt_sponsor_country">233 <?php _e( 'Country:', 'wordcamporg' ) ?>234 </label>235 236 <?php // todo add selected attribute to select and change first option value to empty string ?>237 <select id="_wcpt_sponsor_country" name="_wcpt_sponsor_country">238 <option value="null" <?php selected( $country, 'null' ); ?>>239 <?php _e( '-- Select a Country --', 'wordcamporg' ); ?>240 </option>241 242 <?php foreach ( $available_countries as $available_country ) : ?>243 <option value="<?php echo esc_attr( $available_country ); ?>" <?php selected( $available_country, $country ); ?>>244 <?php echo esc_html( $available_country ); ?>245 </option>246 <?php endforeach; ?>247 </select>248 249 <?php $this->render_form_field_required_indicator(); ?>250 </li>251 252 </ul> 252 253 253 254 <span class="wcpt-form-required"> -
wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
diff --git wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php index 43f3413e..e8134464 100644
class WordCamp_Post_Types_Plugin { 1630 1630 $zip_code = get_post_meta( $sponsor->ID, '_wcpt_sponsor_zip_code', true ); 1631 1631 $country = get_post_meta( $sponsor->ID, '_wcpt_sponsor_country', true ); 1632 1632 1633 if ( $state === $this->get_sponsor_info_state_default_value() ) { 1634 $state = ''; 1635 } 1636 1633 1637 $available_countries = array( 'Abkhazia', 'Afghanistan', 'Aland', 'Albania', 'Algeria', 'American Samoa', 'Andorra', 'Angola', 'Anguilla', 'Antigua and Barbuda', 'Argentina', 'Armenia', 'Aruba', 'Ascension', 'Ashmore and Cartier Islands', 'Australia', 'Australian Antarctic Territory', 'Austria', 'Azerbaijan', 'Bahamas, The', 'Bahrain', 'Baker Island', 'Bangladesh', 'Barbados', 'Belarus', 'Belgium', 'Belize', 'Benin', 'Bermuda', 'Bhutan', 'Bolivia', 'Bosnia and Herzegovina', 'Botswana', 'Bouvet Island', 'Brazil', 'British Antarctic Territory', 'British Indian Ocean Territory', 'British Sovereign Base Areas', 'British Virgin Islands', 'Brunei', 'Bulgaria', 'Burkina Faso', 'Burundi', 'Cambodia', 'Cameroon', 'Canada', 'Cape Verde', 'Cayman Islands', 'Central African Republic', 'Chad', 'Chile', "China, People's Republic of", 'China, Republic of (Taiwan)', 'Christmas Island', 'Clipperton Island', 'Cocos (Keeling) Islands', 'Colombia', 'Comoros', 'Congo, (Congo Brazzaville)', 'Congo, (Congo Kinshasa)', 'Cook Islands', 'Coral Sea Islands', 'Costa Rica', "Cote d'Ivoire (Ivory Coast)", 'Croatia', 'Cuba', 'Cyprus', 'Czech Republic', 'Denmark', 'Djibouti', 'Dominica', 'Dominican Republic', 'Ecuador', 'Egypt', 'El Salvador', 'Equatorial Guinea', 'Eritrea', 'Estonia', 'Ethiopia', 'Falkland Islands (Islas Malvinas)', 'Faroe Islands', 'Fiji', 'Finland', 'France', 'French Guiana', 'French Polynesia', 'French Southern and Antarctic Lands', 'Gabon', 'Gambia, The', 'Georgia', 'Germany', 'Ghana', 'Gibraltar', 'Greece', 'Greenland', 'Grenada', 'Guadeloupe', 'Guam', 'Guatemala', 'Guernsey', 'Guinea', 'Guinea-Bissau', 'Guyana', 'Haiti', 'Heard Island and McDonald Islands', 'Honduras', 'Hong Kong', 'Howland Island', 'Hungary', 'Iceland', 'India', 'Indonesia', 'Iran', 'Iraq', 'Ireland', 'Isle of Man', 'Israel', 'Italy', 'Jamaica', 'Japan', 'Jarvis Island', 'Jersey', 'Johnston Atoll', 'Jordan', 'Kazakhstan', 'Kenya', 'Kingman Reef', 'Kiribati', 'Korea, North', 'Korea, South', 'Kuwait', 'Kyrgyzstan', 'Laos', 'Latvia', 'Lebanon', 'Lesotho', 'Liberia', 'Libya', 'Liechtenstein', 'Lithuania', 'Luxembourg', 'Macau', 'Macedonia', 'Madagascar', 'Malawi', 'Malaysia', 'Maldives', 'Mali', 'Malta', 'Marshall Islands', 'Martinique', 'Mauritania', 'Mauritius', 'Mayotte', 'Mexico', 'Micronesia', 'Midway Islands', 'Moldova', 'Monaco', 'Mongolia', 'Montenegro', 'Montserrat', 'Morocco', 'Mozambique', 'Myanmar (Burma)', 'Nagorno-Karabakh', 'Namibia', 'Nauru', 'Navassa Island', 'Nepal', 'Netherlands', 'Netherlands Antilles', 'New Caledonia', 'New Zealand', 'Nicaragua', 'Niger', 'Nigeria', 'Niue', 'Norfolk Island', 'Northern Cyprus', 'Northern Mariana Islands', 'Norway', 'Oman', 'Pakistan', 'Palau', 'Palmyra Atoll', 'Panama', 'Papua New Guinea', 'Paraguay', 'Peru', 'Peter I Island', 'Philippines', 'Pitcairn Islands', 'Poland', 'Portugal', 'Pridnestrovie (Transnistria)', 'Puerto Rico', 'Qatar', 'Queen Maud Land', 'Reunion', 'Romania', 'Ross Dependency', 'Russia', 'Rwanda', 'Saint Barthelemy', 'Saint Helena', 'Saint Kitts and Nevis', 'Saint Lucia', 'Saint Martin', 'Saint Pierre and Miquelon', 'Saint Vincent and the Grenadines', 'Samoa', 'San Marino', 'Sao Tome and Principe', 'Saudi Arabia', 'Senegal', 'Serbia', 'Seychelles', 'Sierra Leone', 'Singapore', 'Slovakia', 'Slovenia', 'Solomon Islands', 'Somalia', 'Somaliland', 'South Africa', 'South Georgia & South Sandwich Islands', 'South Ossetia', 'Spain', 'Sri Lanka', 'Sudan', 'Suriname', 'Svalbard', 'Swaziland', 'Sweden', 'Switzerland', 'Syria', 'Tajikistan', 'Tanzania', 'Thailand', 'Timor-Leste (East Timor)', 'Togo', 'Tokelau', 'Tonga', 'Trinidad and Tobago', 'Tristan da Cunha', 'Tunisia', 'Turkey', 'Turkmenistan', 'Turks and Caicos Islands', 'Tuvalu', 'U.S. Virgin Islands', 'Uganda', 'Ukraine', 'United Arab Emirates', 'United Kingdom', 'United States', 'Uruguay', 'Uzbekistan', 'Vanuatu', 'Vatican City', 'Venezuela', 'Vietnam', 'Wake Island', 'Wallis and Futuna', 'Yemen', 'Zambia', 'Zimbabwe' ); 1634 1638 // todo use WordCamp_Budgets::get_valid_countries_iso3166() instead. need to switch multi-event sponsors at same time. 1635 1639 … … class WordCamp_Post_Types_Plugin { 1639 1643 } 1640 1644 1641 1645 /** 1646 * Returns the default value for the state input when it's empty 1647 * 1648 * @return string 1649 */ 1650 protected function get_sponsor_info_state_default_value() { 1651 return 'Not Applicable'; 1652 } 1653 1654 /** 1642 1655 * Render the Invoice Sponsor metabox view 1643 1656 * 1644 1657 * @param WP_Post $sponsor … … class WordCamp_Post_Types_Plugin { 1832 1845 $values[ $id ] = sanitize_text_field( $_POST["_wcpt_sponsor_$id"] ); 1833 1846 } 1834 1847 1848 if ( empty( $values['state'] ) ) { 1849 $values['state'] = $this->get_sponsor_info_state_default_value(); 1850 } 1851 1835 1852 $values['website'] = esc_url_raw( $_POST['_wcpt_sponsor_website'] ); 1836 1853 // TODO: maybe only allows links to home page, depending on outcome of http://make.wordpress.org/community/2013/12/31/irs-rules-for-corporate-sponsorship-of-wordcamp/ 1837 1854