当前位置: 首页>>代码示例>>PHP>>正文


PHP em_get_countries函数代码示例

本文整理汇总了PHP中em_get_countries函数的典型用法代码示例。如果您正苦于以下问题:PHP em_get_countries函数的具体用法?PHP em_get_countries怎么用?PHP em_get_countries使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了em_get_countries函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpfc_em_calendar_search

/**
 * Adds extra non-taxonomy fields to the calendar search
 * @param array $args
 */
function wpfc_em_calendar_search($args)
{
    if (defined('EM_VERSION') && $args['type'] == 'event') {
        $country = !empty($args['country']) ? $args['country'] : '';
        ?>
		<?php 
        if (empty($country)) {
            ?>
		<!-- START Country Search -->
		<select name="country" class="em-events-search-country wpfc-taxonomy">
			<option value=''><?php 
            echo get_option('dbem_search_form_countries_label');
            ?>
</option>
			<?php 
            //get the counties from locations table
            global $wpdb;
            $countries = em_get_countries();
            $em_countries = $wpdb->get_results("SELECT DISTINCT location_country FROM " . EM_LOCATIONS_TABLE . " WHERE location_country IS NOT NULL AND location_country != '' ORDER BY location_country ASC", ARRAY_N);
            foreach ($em_countries as $em_country) {
                ?>
			 <option value="<?php 
                echo $em_country[0];
                ?>
" <?php 
                echo !empty($country) && $country == $em_country[0] ? 'selected="selected"' : '';
                ?>
><?php 
                echo $countries[$em_country[0]];
                ?>
</option>
			<?php 
            }
            ?>
		</select>
		<!-- END Country Search -->
		<?php 
        }
        ?>

		<?php 
        if (!empty($country)) {
            ?>
		<!-- START Region Search -->
		<select name="region" class="em-events-search-region wpfc-taxonomy">
			<option value=''><?php 
            echo get_option('dbem_search_form_regions_label');
            ?>
</option>
			<?php 
            if (!empty($country)) {
                //get the counties from locations table
                global $wpdb;
                $em_states = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_region FROM " . EM_LOCATIONS_TABLE . " WHERE location_region IS NOT NULL AND location_region != '' AND location_country=%s ORDER BY location_region", $country), ARRAY_N);
                foreach ($em_states as $state) {
                    ?>
					 <option <?php 
                    echo !empty($_REQUEST['region']) && $_REQUEST['region'] == $state[0] ? 'selected="selected"' : '';
                    ?>
><?php 
                    echo $state[0];
                    ?>
</option>
					<?php 
                }
            }
            ?>
		</select>
		<!-- END Region Search -->

		<!-- START State/County Search -->
		<select name="state" class="em-events-search-state wpfc-taxonomy">
			<option value=''><?php 
            echo get_option('dbem_search_form_states_label');
            ?>
</option>
			<?php 
            if (!empty($country)) {
                //get the counties from locations table
                global $wpdb;
                $cond = !empty($_REQUEST['region']) ? $wpdb->prepare(" AND location_region=%s ", $_REQUEST['region']) : '';
                $em_states = $wpdb->get_results($wpdb->prepare("SELECT DISTINCT location_state FROM " . EM_LOCATIONS_TABLE . " WHERE location_state IS NOT NULL AND location_state != '' AND location_country=%s {$cond} ORDER BY location_state", $country), ARRAY_N);
                foreach ($em_states as $state) {
                    ?>
					 <option <?php 
                    echo !empty($_REQUEST['state']) && $_REQUEST['state'] == $state[0] ? 'selected="selected"' : '';
                    ?>
><?php 
                    echo $state[0];
                    ?>
</option>
					<?php 
                }
            }
            ?>
		</select>
//.........这里部分代码省略.........
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:101,代码来源:em-wpfc.php

示例2: build_wpquery_conditions


//.........这里部分代码省略.........
         //Location ID takes precedence
         $query[] = array('key' => '_location_id', 'value' => $location, 'compare' => '=');
     } elseif (self::array_is_numeric($location)) {
         $query[] = array('key' => '_location_id', 'value' => $location, 'compare' => 'IN');
     } elseif (is_object($location) && get_class($location) == 'EM_Location') {
         //Now we deal with objects
         $query[] = array('key' => '_location_id', 'value' => $location->location_id, 'compare' => '=');
     } elseif (is_array($location) && @get_class(current($location) == 'EM_Location')) {
         //we can accept array of ids or EM_Location objects
         foreach ($location as $EM_Location) {
             $location_ids[] = $EM_Location->location_id;
         }
         $query[] = array('key' => '_location_id', 'value' => $location_ids, 'compare' => 'IN');
     }
     //Filter by Event - can be object, array, or id
     if (is_numeric($event) && $event > 0) {
         //event ID takes precedence
         $query[] = array('key' => '_event_id', 'value' => $event, 'compare' => '=');
     } elseif (self::array_is_numeric($event)) {
         //array of ids
         $query[] = array('key' => '_event_id', 'value' => $event, 'compare' => 'IN');
     } elseif (is_object($event) && get_class($event) == 'EM_Event') {
         //Now we deal with objects
         $query[] = array('key' => '_event_id', 'value' => $event->event_id, 'compare' => '=');
     } elseif (is_array($event) && @get_class(current($event) == 'EM_Event')) {
         //we can accept array of ids or EM_event objects
         foreach ($event as $EM_Event) {
             $event_ids[] = $EM_Event->event_id;
         }
         $query[] = array('key' => '_event_id', 'value' => $event_ids, 'compare' => 'IN');
     }
     //country lookup
     if (!empty($args['country'])) {
         $countries = em_get_countries();
         //we can accept country codes or names
         if (in_array($args['country'], $countries)) {
             //we have a country name,
             $country = $countries[$args['country']] . "'";
         } elseif (array_key_exists($args['country'], $countries)) {
             //we have a country code
             $country = $args['country'];
         }
         if (!empty($country)) {
             //get loc ids
             $ids = $wpdb->get_col("SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key='_location_country' AND meta_value='{$country}'");
             $query[] = array('key' => '_location_id', 'value' => $ids, 'compare' => 'IN');
         }
     }
     //state lookup
     if (!empty($args['state'])) {
         $ids = $wpdb->get_col($wpdb->prepare("SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key='_location_country' AND meta_value='%s'", $args['state']));
         if (is_array($wp_query->query_vars['post__in'])) {
             //remove values not in this array.
             $wp_query->query_vars['post__in'] = array_intersect($wp_query->query_vars['post__in'], $ids);
         } else {
             $wp_query->query_vars['post__in'] = $ids;
         }
     }
     //state lookup
     if (!empty($args['town'])) {
         $ids = $wpdb->get_col($wpdb->prepare("SELECT post_id FROM " . $wpdb->postmeta . " WHERE meta_key='_location_town' AND meta_value='%s'", $args['town']));
         if (is_array($wp_query->query_vars['post__in'])) {
             //remove values not in this array.
             $wp_query->query_vars['post__in'] = array_intersect($wp_query->query_vars['post__in'], $ids);
         } else {
             $wp_query->query_vars['post__in'] = $ids;
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:67,代码来源:em-object.php

示例3: em_options_input_text

}
if (get_option('dbem_locations_enabled')) {
    /*default location*/
    if (defined('EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS') && EM_OPTIMIZE_SETTINGS_PAGE_LOCATIONS) {
        em_options_input_text(__('Default Location', 'dbem'), 'dbem_default_location', __('Please enter your Location ID, or leave blank for no location.', 'dbem') . ' ' . __('This option allows you to select the default location when adding an event.', 'dbem') . " " . __('(not applicable with event ownership on presently, coming soon!)', 'dbem'));
    } else {
        $location_options = array();
        $location_options[0] = __('no default location', 'dbem');
        $EM_Locations = EM_Locations::get();
        foreach ($EM_Locations as $EM_Location) {
            $location_options[$EM_Location->location_id] = $EM_Location->location_name;
        }
        em_options_select(__('Default Location', 'dbem'), 'dbem_default_location', $location_options, __('Please enter your Location ID.', 'dbem') . ' ' . __('This option allows you to select the default location when adding an event.', 'dbem') . " " . __('(not applicable with event ownership on presently, coming soon!)', 'dbem'));
    }
    /*default location country*/
    em_options_select(__('Default Location Country', 'dbem'), 'dbem_location_default_country', em_get_countries(__('no default country', 'dbem')), __('If you select a default country, that will be pre-selected when creating a new location.', 'dbem'));
}
?>

			<tr class="em-header">
				<td colspan="2">
					<h4><?php 
echo sprintf(__('%s Settings', 'dbem'), __('Location', 'dbem'));
?>
</h4>
				</td>
			</tr>
			<?php 
em_options_radio_binary(__('Enable locations?', 'dbem'), 'dbem_locations_enabled', __('If you disable locations, bear in mind that you should remove your location page, shortcodes and related placeholders from your <a href="#formats" class="nav-tab-link" rel="#em-menu-formats">formats</a>.', 'dbem'));
if (get_option('dbem_locations_enabled')) {
    em_options_radio_binary(__('Require locations for events?', 'dbem'), 'dbem_require_location', __('Setting this to no will allow you to submit events without locations. You can use the <code>{no_location}...{/no_location}</code> or <code>{has_location}..{/has_location}</code> conditional placeholder to selectively display location information.', 'dbem'));
开发者ID:pcco,项目名称:portal-redesign,代码行数:31,代码来源:general.php

示例4: em_event_taxonomy_field

/**
 * Display event taxonomy field.
 * 
 * @param 	string $key
 * @param 	array $field
 * @return 	mixed
 */
function em_event_taxonomy_field($key, $field)
{
    $html = '';
    // check if field / key is empty
    if (empty($key) || empty($field)) {
        return $html;
    }
    // field filter hook
    $field = apply_filters('em_event_taxonomy_field_args', $field, $key);
    if (!empty($field['value']) && !in_array($field['type'], array('google_map', 'image'))) {
        switch ($field['type']) {
            case 'image':
                $attr = apply_filters('em_event_taxonomy_field_image_attr', array('class' => 'attachment-thumbnail photo', 'alt' => apply_filters('em_event_taxonomy_field_image_title', trim(strip_tags(single_term_title('', false))))));
                $size = apply_filters('em_event_taxonomy_field_image_size', 'post-thumbnail');
                $content = apply_filters('em_event_taxonomy_field_image_html', '<br />' . wp_get_attachment_image((int) $field['value'], $size, false, $attr));
                break;
            case 'select':
                $content = $key === 'country' && in_array($field['value'], array_keys(em_get_countries())) ? em_get_country_name($field['value']) : esc_html($field['value']);
                break;
            default:
                $content = wp_kses_post($field['value']);
        }
        $html = '<div class="taxonomy-' . $key . '">';
        $html .= '<strong>' . $field['label'] . ':</strong> ';
        $html .= $content;
        $html .= '</div>';
    }
    return apply_filters('em_event_taxonomy_field', $html, $field, $key);
}
开发者ID:patlegris,项目名称:On-Off,代码行数:36,代码来源:core-functions.php

示例5: _e

		<tr class="em-location-data-country">
			<th><?php 
    _e('Country:', 'events-manager');
    ?>
&nbsp;</th>
			<td>
				<select id="location-country" name="location_country">
					<option value="0" <?php 
    echo $EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country') == '' ? 'selected="selected"' : '';
    ?>
><?php 
    _e('none selected', 'events-manager');
    ?>
</option>
					<?php 
    foreach (em_get_countries() as $country_key => $country_name) {
        ?>
					<option value="<?php 
        echo $country_key;
        ?>
" <?php 
        echo $EM_Location->location_country == $country_key || $EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country') == $country_key ? 'selected="selected"' : '';
        ?>
><?php 
        echo $country_name;
        ?>
</option>
					<?php 
    }
    ?>
				</select><?php 
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:31,代码来源:location.php

示例6: getCountryName

	/**
	* attempt to map country code to name
	* @param string $countryCode
	* @return string
	*/
	protected static function getCountryName($countryCode) {
		$name = '';

		// check for country code as non-empty string
		// NB: Events Manager Pro up to at least v2.3.6 returns array when Country field doesn't exist
		if ($countryCode && is_string($countryCode)) {
			$countries = em_get_countries();
			if (isset($countries[$countryCode])) {
				$name = $countries[$countryCode];
			}
		}

		return $name;
	}
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:19,代码来源:class.EwayPaymentsEventsManager.php

示例7: getEventCountries

 /**
  * get a list of countries, keyed by lowercase name => code
  * @return array
  */
 public static function getEventCountries()
 {
     $countries = em_get_countries();
     $map = array();
     foreach ($countries as $code => $name) {
         $map[strtolower($name)] = $code;
     }
     return $map;
 }
开发者ID:webaware,项目名称:events-manager-import-export,代码行数:13,代码来源:class.EM_ImpExpImport.php

示例8: esc_html_e

			<tr class="em-subheader"><td colspan="2"><h5><?php 
esc_html_e('Geolocation Search', 'events-manager');
?>
</h5></td></tr>
			<?php 
em_options_radio_binary(__('Show distance options?', 'events-manager'), 'dbem_search_form_geo_units', '', '', '#dbem_search_form_geo_units_label_row, #dbem_search_form_geo_distance_options_row');
em_options_input_text(__('Label', 'events-manager'), 'dbem_search_form_geo_units_label', __('Appears as the label for this search option.', 'events-manager'));
em_options_input_text(__('Distance Values', 'events-manager'), 'dbem_search_form_geo_distance_options', __('The numerical units shown to those searching by distance. Use comma-separated numbers, such as "25,50,100".', 'events-manager'));
?>
			<tr class="em-subheader"><td colspan="2"><h5><?php 
esc_html_e('Country', 'events-manager');
?>
</h5></td></tr>
			<?php 
em_options_radio_binary(__('Show countries?', 'events-manager'), 'dbem_search_form_countries', '', '', '#dbem_search_form_country_label_row, #dbem_search_form_countries_label_row');
em_options_select(__('Default Country', 'events-manager'), 'dbem_search_form_default_country', em_get_countries(__('no default country', 'events-manager')), __('Search form will be pre-selected with this country, if searching by country is disabled above, only search results from this country will be returned.', 'events-manager'));
em_options_input_text(__('Label', 'events-manager'), 'dbem_search_form_country_label', __('Appears as the label for this search option.', 'events-manager'));
em_options_input_text(__('All countries text', 'events-manager'), 'dbem_search_form_countries_label', __('Appears as the first default search option.', 'events-manager'));
?>
			<tr class="em-subheader"><td colspan="2"><h5><?php 
esc_html_e('Region', 'events-manager');
?>
</h5></td></tr>
			<?php 
em_options_radio_binary(__('Show regions?', 'events-manager'), 'dbem_search_form_regions', '', '', '#dbem_search_form_region_label_row, #dbem_search_form_regions_label_row');
em_options_input_text(__('Label', 'events-manager'), 'dbem_search_form_region_label', __('Appears as the label for this search option.', 'events-manager'));
em_options_input_text(__('All regions text', 'events-manager'), 'dbem_search_form_regions_label', __('Appears as the first default search option.', 'events-manager'));
?>
			<tr class="em-subheader"><td colspan="2"><h5><?php 
esc_html_e('State/County', 'events-manager');
?>
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:31,代码来源:formats.php

示例9: export_page


//.........这里部分代码省略.........
        ?>
&nbsp;</th>
									<td>
										<input type="text" name="ess_owner_city" value="<?php 
        echo ESS_Database::get_option('ess_owner_city');
        ?>
" style="width:44%;" />
										<input type="text" name="ess_owner_state" value="<?php 
        echo ESS_Database::get_option('ess_owner_state');
        ?>
" style="width:43%;" />
										<input type="text" name="ess_owner_zip" value="<?php 
        echo ESS_Database::get_option('ess_owner_zip');
        ?>
" style="width:10%;" />
									</td>
								</tr>
								<tr>
									<td width="20">&nbsp;</td>
									<th><?php 
        _e('Country:', 'dbem');
        ?>
&nbsp;</th>
									<td>
										<select name="ess_owner_country">
											<option value="0" <?php 
        echo get_option('ess_owner_country') == '' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('none selected', 'dbem');
        ?>
</option>
											<?php 
        foreach (em_get_countries() as $country_key => $country_name) {
            ?>
											<option value="<?php 
            echo $country_key;
            ?>
" <?php 
            echo get_option('ess_owner_country') == $country_key ? 'selected="selected"' : '';
            ?>
><?php 
            echo $country_name;
            ?>
</option>
											<?php 
        }
        ?>
										</select>
									</td>
								</tr>
								<?php 
        self::get_input_table_row(array('id' => 'ess_owner_website', 'title' => 'Website:'));
        ?>
								<?php 
        self::get_input_table_row(array('id' => 'ess_owner_phone', 'title' => 'Phone:'));
        ?>
							</tbody>
						</table>
						<p class="submit">
							<input type="submit" class="button-primary" name="save_export" value="<?php 
        _e('Save Changes (All)', 'dbem');
        ?>
" />
						</p>
					</div>
开发者ID:vnatale,项目名称:wordpress-events-manager-ess,代码行数:67,代码来源:ESS_Admin.php

示例10: em_admin_event_page


//.........这里部分代码省略.........
													</td>
												</tr>
												<tr>
													<th><?php 
        _e('Region:');
        ?>
&nbsp;</th>
													<td>
														<input id="location-region" type="text" name="location_region" value="<?php 
        echo htmlspecialchars($EM_Event->location->region, ENT_QUOTES);
        ?>
" />
														<input id="location-region-wpnonce" type="hidden" value="<?php 
        echo wp_create_nonce('search_regions');
        ?>
" />
													</td>
												</tr>
												<tr>
													<th><?php 
        _e('Country:');
        ?>
&nbsp;</th>
													<td>
														<select id="location-country" name="location_country">
															<option value="0" <?php 
        echo $EM_Event->location->country == '' && $EM_Event->location->id == '' && get_option('dbem_location_default_country') == '' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('none selected', 'dbem');
        ?>
</option>
															<?php 
        foreach (em_get_countries() as $country_key => $country_name) {
            ?>
															<option value="<?php 
            echo $country_key;
            ?>
" <?php 
            echo $EM_Event->location->country == $country_key || $EM_Event->location->country == '' && $EM_Event->location->id == '' && get_option('dbem_location_default_country') == $country_key ? 'selected="selected"' : '';
            ?>
><?php 
            echo $country_name;
            ?>
</option>
															<?php 
        }
        ?>
														</select><?php 
        echo $required;
        ?>
														<!-- <p><em><?php 
        _e('Filling this in first will allow you to quickly find previously filled states and regions for the country.', 'dbem');
        ?>
</em></p> -->
													</td>
												</tr>
												<?php 
    }
    ?>
											</table>
										</td>
										<?php 
    if (get_option('dbem_gmap_is_active')) {
        ?>
										<td width="400">
开发者ID:hypenotic,项目名称:slowfood,代码行数:67,代码来源:em-event.php

示例11: em_admin_location


//.........这里部分代码省略.........
    ?>
&nbsp;</th>
											<td>
												<input id="location-postcode" type="text" name="location_postcode" value="<?php 
    echo htmlspecialchars($EM_Location->postcode, ENT_QUOTES);
    ?>
" />
											</td>
										</tr>
										<tr>
											<th><?php 
    _e('Region:', 'dbem');
    ?>
&nbsp;</th>
											<td>
												<input id="location-region" type="text" name="location_region" value="<?php 
    echo htmlspecialchars($EM_Location->region, ENT_QUOTES);
    ?>
" />
												<input id="location-region-wpnonce" type="hidden" value="<?php 
    echo wp_create_nonce('search_regions');
    ?>
" />
											</td>
										</tr>
										<tr>
											<th><?php 
    _e('Country:', 'dbem');
    ?>
&nbsp;</th>
											<td>
												<select id="location-country" name="location_country">
													<?php 
    foreach (em_get_countries(__('none selected', 'dbem')) as $country_key => $country_name) {
        ?>
													<option value="<?php 
        echo $country_key;
        ?>
" <?php 
        echo $EM_Location->country === $country_key || $EM_Location->country == '' && $EM_Location->id == '' && get_option('dbem_location_default_country') == $country_key ? 'selected="selected"' : '';
        ?>
><?php 
        echo $country_name;
        ?>
</option>
													<?php 
    }
    ?>
												</select> <?php 
    echo $required;
    ?>
											</td>
										</tr>
									</table>
									<?php 
    if (get_option('dbem_gmap_is_active')) {
        ?>
									<div style="width: 400px; height: 300px; float:left;">
										<div id='em-map-404' style='width: 400px; height:300px; vertical-align:middle; text-align: center;'>
											<p><em><?php 
        _e('Location not found', 'dbem');
        ?>
</em></p>
										</div>
										<div id='em-map' style='width: 400px; height: 300px; display: none;'></div>
									</div>
开发者ID:hypenotic,项目名称:slowfood,代码行数:67,代码来源:em-locations.php

示例12: wp_create_nonce

" />
				<input id="location-region-wpnonce" type="hidden" value="<?php 
echo wp_create_nonce('search_regions');
?>
" />
			</td>
		</tr>
		<tr class="em-location-data-country">
			<th><?php 
_e('Country:', 'events-manager');
?>
&nbsp;</th>
			<td>
				<select id="location-country" name="location_country">
					<?php 
foreach (em_get_countries(__('none selected', 'events-manager')) as $country_key => $country_name) {
    ?>
					<option value="<?php 
    echo $country_key;
    ?>
" <?php 
    echo $EM_Location->location_country === $country_key || $EM_Location->location_country == '' && $EM_Location->location_id == '' && get_option('dbem_location_default_country') == $country_key ? 'selected="selected"' : '';
    ?>
><?php 
    echo $country_name;
    ?>
</option>
					<?php 
}
?>
				</select> <?php 
开发者ID:mjrobison,项目名称:FirstCareCPR,代码行数:31,代码来源:where.php

示例13: build_sql_conditions


//.........这里部分代码省略.........
             $end_month = date('Y-m-t', $start_month_timestamp);
             $conditions['scope'] = " (event_start_date BETWEEN CAST('{$start_month}' AS DATE) AND CAST('{$end_month}' AS DATE))";
             if (!get_option('dbem_events_current_are_past')) {
                 $conditions['scope'] .= " OR (event_start_date < CAST('{$start_month}' AS DATE) AND event_end_date >= CAST('{$start_month}' AS DATE))";
             }
         } elseif (preg_match('/(\\d\\d?)\\-months/', $scope, $matches)) {
             // next x months means this month (what's left of it), plus the following x months until the end of that month.
             $months_to_add = $matches[1];
             $start_month = date('Y-m-d', current_time('timestamp'));
             $end_month = date('Y-m-t', strtotime("+{$months_to_add} month", current_time('timestamp')));
             $conditions['scope'] = " (event_start_date BETWEEN CAST('{$start_month}' AS DATE) AND CAST('{$end_month}' AS DATE))";
             if (!get_option('dbem_events_current_are_past')) {
                 $conditions['scope'] .= " OR (event_start_date < CAST('{$start_month}' AS DATE) AND event_end_date >= CAST('{$start_month}' AS DATE))";
             }
         } elseif ($scope == "future") {
             $conditions['scope'] = " event_start_date >= CAST('{$today}' AS DATE)";
             if (!get_option('dbem_events_current_are_past')) {
                 $conditions['scope'] .= " OR (event_end_date >= CAST('{$today}' AS DATE) AND event_end_date != '0000-00-00' AND event_end_date IS NOT NULL)";
             }
         }
         if (!empty($conditions['scope'])) {
             $conditions['scope'] = '(' . $conditions['scope'] . ')';
         }
     }
     //Filter by Location - can be object, array, or id
     if (is_numeric($location) && $location > 0) {
         //Location ID takes precedence
         $conditions['location'] = " {$locations_table}.location_id = {$location}";
     } elseif (self::array_is_numeric($location)) {
         $conditions['location'] = "( {$locations_table}.location_id = " . implode(" OR {$locations_table}.location_id = ", $location) . ' )';
     } elseif (is_object($location) && get_class($location) == 'EM_Location') {
         //Now we deal with objects
         $conditions['location'] = " {$locations_table}.location_id = {$location->id}";
     } elseif (is_array($location) && @get_class(current($location) == 'EM_Location')) {
         //we can accept array of ids or EM_Location objects
         foreach ($location as $EM_Location) {
             $location_ids[] = $EM_Location->id;
         }
         $conditions['location'] = "( {$locations_table}.location_id=" . implode(" {$locations_table}.location_id=", $location_ids) . " )";
     }
     //Filter by Event - can be object, array, or id
     if (is_numeric($event) && $event > 0) {
         //event ID takes precedence
         $conditions['event'] = " {$events_table}.event_id = {$event}";
     } elseif (self::array_is_numeric($event)) {
         //array of ids
         $conditions['event'] = "( {$events_table}.event_id = " . implode(" OR {$events_table}.event_id = ", $event) . ' )';
     } elseif (is_object($event) && get_class($event) == 'EM_Event') {
         //Now we deal with objects
         $conditions['event'] = " {$events_table}.event_id = {$event->id}";
     } elseif (is_array($event) && @get_class(current($event) == 'EM_Event')) {
         //we can accept array of ids or EM_event objects
         foreach ($event as $EM_Event) {
             $event_ids[] = $EM_Event->id;
         }
         $conditions['event'] = "( {$events_table}.event_id=" . implode(" {$events_table}.event_id=", $event_ids) . " )";
     }
     //Location specific filters
     //country lookup
     if (!empty($args['country'])) {
         $countries = em_get_countries();
         //we can accept country codes or names
         if (in_array($args['country'], $countries)) {
             //we have a country name,
             $conditions['country'] = "location_country='" . array_search($args['country']) . "'";
         } elseif (array_key_exists($args['country'], $countries)) {
             //we have a country code
             $conditions['country'] = "location_country='" . $args['country'] . "'";
         }
     }
     //state lookup
     if (!empty($args['state'])) {
         $conditions['state'] = "location_state='" . $args['state'] . "'";
     }
     //state lookup
     if (!empty($args['town'])) {
         $conditions['town'] = "location_town='" . $args['town'] . "'";
     }
     //region lookup
     if (!empty($args['region'])) {
         $conditions['region'] = "location_region='" . $args['region'] . "'";
     }
     //Add conditions for category selection
     //Filter by category, can be id or comma seperated ids
     //TODO create an exclude category option
     if (is_numeric($category) && $category > 0) {
         $conditions['category'] = " event_id IN ( SELECT object_id FROM " . EM_META_TABLE . " WHERE meta_key='event-category' AND meta_value='{$category}' ) ";
     } elseif (self::array_is_numeric($category)) {
         $conditions['category'] = " event_id IN ( SELECT object_id FROM " . EM_META_TABLE . " WHERE meta_key='event-category' AND meta_value IN (" . implode(',', $category) . ") ) ";
     }
     //If we want rsvped items, we usually check the event
     if ($rsvp == 1) {
         $conditions['rsvp'] = 'event_rsvp=1';
     }
     //Default ownership belongs to an event, child objects can just overwrite this if needed.
     if (is_numeric($owner)) {
         $conditions['owner'] = 'event_owner=' . $owner;
     }
     return apply_filters('em_object_build_sql_conditions', $conditions);
 }
开发者ID:hypenotic,项目名称:slowfood,代码行数:101,代码来源:em-object.php

示例14: mysettings


//.........这里部分代码省略.........
				  <br />
			  </td>
		  </tr>
		  <tr valign="top">
			  <th scope="row"><?php 
        _e('Paypal Currency', 'em-pro');
        ?>
</th>
			  <td><?php 
        echo esc_html(get_option('dbem_bookings_currency', 'USD'));
        ?>
<br /><i><?php 
        echo sprintf(__('Set your currency in the <a href="%s">settings</a> page.', 'em-pro'), EM_ADMIN_URL . '&amp;page=events-manager-options#bookings');
        ?>
</i></td>
		  </tr>
		  
		  <?php 
        em_options_radio_binary(__('Include Taxes In Itemized Prices', 'em-pro'), 'em_' . $this->gateway . '_inc_tax', __('If set to yes, taxes are not included in individual item prices and total tax is shown at the bottom. If set to no, taxes are included within the individual prices.', 'em-pro') . ' ' . __('We strongly recommend setting this to No.', 'em-pro') . ' <a href="http://wp-events-plugin.com/documentation/events-with-paypal/paypal-displaying-taxes/">' . __('Click here for more information.', 'em-pro')) . '</a>';
        ?>
		  
		  <tr valign="top">
			  <th scope="row"><?php 
        _e('PayPal Language', 'em-pro');
        ?>
</th>
			  <td>
			  	<select name="paypal_lc">
			  		<option value=""><?php 
        _e('Default', 'em-pro');
        ?>
</option>
				  <?php 
        $ccodes = em_get_countries();
        $paypal_lc = get_option('em_' . $this->gateway . '_lc', 'US');
        foreach ($ccodes as $key => $value) {
            if ($paypal_lc == $key) {
                echo '<option value="' . $key . '" selected="selected">' . $value . '</option>';
            } else {
                echo '<option value="' . $key . '">' . $value . '</option>';
            }
        }
        ?>
				  
				  </select>
				  <br />
				  <i><?php 
        _e('PayPal allows you to select a default language users will see. This is also determined by PayPal which detects the locale of the users browser. The default would be US.', 'em-pro');
        ?>
</i>
			  </td>
		  </tr>
		  <tr valign="top">
			  <th scope="row"><?php 
        _e('PayPal Mode', 'em-pro');
        ?>
</th>
			  <td>
				  <select name="paypal_status">
					  <option value="live" <?php 
        if (get_option('em_' . $this->gateway . "_status") == 'live') {
            echo 'selected="selected"';
        }
        ?>
><?php 
        _e('Live Site', 'em-pro');
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:67,代码来源:gateway.paypal.php

示例15: authorize_and_capture

 /**
  * Retreive the authorize_aim vars needed to send to the gateway to proceed with payment
  * @param EM_Booking $EM_Booking
  */
 function authorize_and_capture($EM_Booking)
 {
     global $EM_Notices;
     $sale = $this->get_api();
     //Get transaction ID for authorization/capture
     $sale->amount = $amount = $EM_Booking->get_price(false, false, true);
     $sale->exp_date = $_REQUEST['x_exp_date_month'] . '/' . $_REQUEST['x_exp_date_year'];
     $sale->card_num = $_REQUEST['x_card_num'];
     $sale->card_code = $_REQUEST['x_card_code'];
     //Email Info
     $sale->email_customer = get_option('em_' . $this->gateway . '_email_customer', 0) ? '1' : '0';
     //for later
     $sale->header_email_receipt = get_option('em_' . $this->gateway . '_header_email_receipt');
     $sale->footer_email_receipt = get_option('em_' . $this->gateway . '_footer_email_receipt');
     //Order Info
     $sale->invoice_num = $EM_Booking->booking_id;
     $sale->description = preg_replace('/[^a-zA-Z0-9\\s]/i', "", $EM_Booking->get_event()->event_name);
     //clean event name
     //Customer Info
     $sale->email = $EM_Booking->get_person()->user_email;
     $sale->customer_ip = $_SERVER['REMOTE_ADDR'];
     $sale->cust_id = get_option('dbem_bookings_registration_disable') ? 'booking-' . $EM_Booking->booking_id : 'user-' . $EM_Booking->get_person()->ID;
     //Address Info
     $names = explode(' ', $EM_Booking->get_person()->get_name());
     if (!empty($names[0])) {
         $sale->first_name = array_shift($names);
     }
     if (implode(' ', $names) != '') {
         $sale->last_name = implode(' ', $names);
     }
     //address slightly special address field
     $address = '';
     if (EM_Gateways::get_customer_field('address', $EM_Booking) != '') {
         $address = EM_Gateways::get_customer_field('address', $EM_Booking);
     }
     if (EM_Gateways::get_customer_field('address_2', $EM_Booking) != '') {
         $address .= ', ' . EM_Gateways::get_customer_field('address_2', $EM_Booking);
     }
     if (!empty($address)) {
         $sale->address = substr($address, 0, 60);
     }
     //cut off at 60 characters
     if (EM_Gateways::get_customer_field('city', $EM_Booking) != '') {
         $sale->city = EM_Gateways::get_customer_field('city', $EM_Booking);
     }
     if (EM_Gateways::get_customer_field('state', $EM_Booking) != '') {
         $sale->state = EM_Gateways::get_customer_field('state', $EM_Booking);
     }
     if (EM_Gateways::get_customer_field('zip', $EM_Booking) != '') {
         $sale->zip = EM_Gateways::get_customer_field('zip', $EM_Booking);
     }
     if (EM_Gateways::get_customer_field('country', $EM_Booking) != '') {
         $countries = em_get_countries();
         $sale->country = $countries[EM_Gateways::get_customer_field('country', $EM_Booking)];
     }
     if (EM_Gateways::get_customer_field('phone', $EM_Booking) != '') {
         $sale->phone = EM_Gateways::get_customer_field('phone', $EM_Booking);
     }
     if (EM_Gateways::get_customer_field('fax', $EM_Booking) != '') {
         $sale->fax = EM_Gateways::get_customer_field('fax', $EM_Booking);
     }
     if (EM_Gateways::get_customer_field('company', $EM_Booking) != '') {
         $sale->company = EM_Gateways::get_customer_field('company', $EM_Booking);
     }
     //Itemized Billing
     $tax_enabled = get_option('dbem_bookings_tax') > 0 ? 'Y' : 'N';
     foreach ($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking) {
         $price = round($EM_Ticket_Booking->get_price() / $EM_Ticket_Booking->get_spaces(), 2);
         if ($price > 0) {
             $ticket_name = substr($EM_Ticket_Booking->get_ticket()->ticket_name, 0, 31);
             $sale->addLineItem($EM_Ticket_Booking->get_ticket()->ticket_id, $ticket_name, $EM_Ticket_Booking->get_ticket()->ticket_description, $EM_Ticket_Booking->get_spaces(), $price, $tax_enabled);
         }
     }
     if ($tax_enabled == 'Y') {
         $sale->tax = number_format($EM_Booking->get_price_taxes(), 2);
     }
     //Add discounts to itemized billing
     $discount = $EM_Booking->get_price_discounts_amount('pre') + $EM_Booking->get_price_discounts_amount('post');
     if ($discount > 0) {
         $sale->addLineItem(0, __('Discount', 'em-pro'), '', 1, $discount, 'N');
     }
     //Get Payment
     $sale = apply_filters('em_gateawy_authorize_aim_sale_var', $sale, $EM_Booking, $this);
     $response = $sale->authorizeAndCapture();
     //Handle result
     $result = $response->approved == true;
     if ($result) {
         $EM_Booking->booking_meta[$this->gateway] = array('txn_id' => $response->transaction_id, 'amount' => $amount);
         $this->record_transaction($EM_Booking, $amount, 'USD', date('Y-m-d H:i:s', current_time('timestamp')), $response->transaction_id, 'Completed', '');
     } else {
         $EM_Booking->add_error($response->response_reason_text);
     }
     //Return transaction_id or false
     return apply_filters('em_gateway_authorize_aim_authorize', $result, $EM_Booking, $this);
 }
开发者ID:shieldsdesignstudio,项目名称:trilogic,代码行数:99,代码来源:gateway.authorize.aim.php


注:本文中的em_get_countries函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。