eventsmanager

custom search location-countries

Aug 6th, 2013
305
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!-- START Country Search -->
  2. <div class="em-search-country em-search-field">
  3. <label><?php echo esc_html(get_option('dbem_search_form_country_label')); ?></label>
  4. <select name="country" class="em-search-country em-events-search-country">
  5. <option value=''><?php echo esc_html(get_option('dbem_search_form_countries_label')); ?></option>
  6. <?php
  7. //get the counties from locations table
  8. global $wpdb;
  9. $countries = em_get_countries();
  10. $em_countries = $wpdb->get_results("SELECT DISTINCT location_country FROM ".EM_LOCATIONS_TABLE." WHERE location_country IS NOT NULL AND location_country != '' AND location_status=1 ORDER BY location_country ASC", ARRAY_N);
  11. $ddm_countries = array();
  12. foreach($em_countries as $em_country){
  13. $ddm_countries[$em_country[0]] = $countries[$em_country[0]];
  14. }
  15. asort($ddm_countries);
  16. $allowed_countries = array("US","CN");
  17. foreach( $ddm_countries as $country_code => $country_name ):
  18. //we're not using esc_ functions here because values are hard-coded within em_get_countries()
  19. if ( in_array($country_code,$allowed_countries) ){
  20. ?>
  21. <option value="<?php echo $country_code; ?>" <?php echo (!empty($_REQUEST['country']) && $_REQUEST['country'] == $country_code) ? 'selected="selected"':''; ?>><?php echo $country_name; ?></option>
  22. <?php } ?>
  23. <?php endforeach; ?>
  24. </select>
  25. </div>
  26. <!-- END Country Search -->
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×