本文整理汇总了PHP中get_country函数的典型用法代码示例。如果您正苦于以下问题:PHP get_country函数的具体用法?PHP get_country怎么用?PHP get_country使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_country函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_trim_words
?>
</p>
<p class="[ post__excerpt ]"><?php
echo wp_trim_words(get_the_excerpt(), 26, '...');
?>
</p>
<p class="[ post__info_sector ]">Sector: <br/><span><?php
echo get_sector($post->ID);
?>
</span></p>
<p class="[ post__info_sector ]">by: <br/><span><?php
the_author();
?>
</span></p>
<p class="[ post__info post__country ][ hidden ]"><?php
echo get_country($post->ID);
?>
</p>
<p class="[ post__info post__date ][ hidden ]" ><?php
echo get_the_time('U');
?>
</p>
</a>
</div>
<?php
}
}
?>
</aticle>
示例2: header
<?php
header('Content-Type:text/plain;charset=UTF-8');
$ip = $_SERVER['REMOTE_ADDR'];
get_country($ip);
function get_country($ip_address)
{
// This code demonstrates how to lookup the country, region, city,
// postal code, latitude, and longitude by IP Address.
// It is designed to work with GeoIP/GeoLite City
// Note that you must download the New Format of GeoIP City (GEO-133).
// The old format (GEO-132) will not work.
require_once "geoipcity.inc";
require_once "geoipregionvars.php";
// uncomment for Shared Memory support
// geoip_load_shared_mem("/usr/local/share/GeoIP/GeoIPCity.dat");
// $gi = geoip_open("/usr/local/share/GeoIP/GeoIPCity.dat",GEOIP_SHARED_MEMORY);
$gi = geoip_open("GeoLiteCity.dat", GEOIP_STANDARD);
$geo_data = array();
if (!($record = geoip_record_by_addr($gi, $ip_address))) {
$geo_data['geo_country'] = 'US';
$geo_data['geo_countryName'] = 'United States';
return false;
}
$geo_data['geo_country'] = $record->country_code;
$geo_data['geo_countryName'] = $record->country_name;
geoip_close($gi);
$key = strtolower($geo_data['geo_country']);
$keywordNum = 10;
$keywordLIst = [];
if ($key == 'cn') {
示例3: getName
/**
* Get Bg Image Name
*
* @return string
*/
function getName()
{
$fileName = get_country('code') . '.jpg';
return $fileName;
}
示例4: getCountrySetCoockie
private function getCountrySetCoockie()
{
$this->load->helper('geoip/geoip_helper');
$country = get_country();
setcookie('country', $country, time() + 3600 * 24);
return $country;
}
示例5: home
/**
* Home Page
*
* @param ImageService $image
* @return \Illuminate\View\View
*/
public function home(ImageService $image)
{
$image = $image->getHomePageImageUrl();
$summary = $this->api->summary();
$countries = count($summary->country_summary);
$resources = count($summary->resource_summary);
$contracts = $summary->contract_count;
$countryName = get_country('name');
return view('site.home', compact('countries', 'resources', 'contracts', 'image', 'countryName'));
}
示例6: create
/**
* Create new Page
*
* @param $input
* @return static
*/
public function create($input)
{
$input = ['title' => (object) $input['title'], 'content' => (object) $input['content'], 'slug' => str_slug($input['title']['en']), 'country' => get_country('code')];
$validate = $this->page->where('slug', $input['slug'])->country()->count();
if ($validate == 0) {
return $this->page->create($input);
} else {
return false;
}
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
$country = get_country('code');
$pages = [['title' => ['en' => 'About', 'fr' => 'Fr About'], 'slug' => 'about', 'content' => ['en' => 'About content for country ' . $country, 'fr' => 'Fr About Content'], 'country' => $country], ['title' => ['en' => 'Contact', 'fr' => 'Fr Contact'], 'slug' => 'contact', 'content' => ['en' => 'Contact content for country ' . $country, 'fr' => 'Fr Contact Content'], 'country' => $country], ['title' => ['en' => 'Resources', 'fr' => 'Fr Resources'], 'slug' => 'resources', 'content' => ['en' => 'Guide content for country ' . $country, 'fr' => 'Fr Guide Content'], 'country' => $country], ['title' => ['en' => 'FAQs', 'fr' => 'Fr Faqs'], 'slug' => 'faqs', 'content' => ['en' => 'FAQs content for country ' . $country, 'fr' => 'Fr FAQS Content'], 'country' => $country], ['title' => ['en' => 'Glossary', 'fr' => 'Fr Glossary'], 'slug' => 'glossary', 'content' => ['en' => 'Glossary content for country ' . $country, 'fr' => 'Fr Glossary Content'], 'country' => $country], ['title' => ['en' => 'Publish Contracts', 'fr' => 'Publish Contracts'], 'slug' => 'publish-contracts', 'content' => ['en' => 'Publish Contracts for country ' . $country, 'fr' => 'Fr Publish Contract Content'], 'country' => $country]];
foreach ($pages as $page) {
$validate = Page::where('slug', $page['slug'])->country()->count();
if ($validate == 0) {
Page::create($page);
}
}
}
示例8: get_country
echo '<td>';
echo $val['strRestoLandline'];
echo '</td>';
echo '<td style="width:20%">';
if ($val['strRestoAddress'] != '') {
$strRestoAddress = $val['strRestoAddress'] . ', ';
} else {
$strRestoAddress = '';
}
if ($val['strRestoCity'] != '') {
$strRestoCity = $val['strRestoCity'] . ', ';
} else {
$strRestoCity = '';
}
if ($val['strRestoCountry'] != '') {
$strRestoCountry = get_country($val['strRestoCountry']);
} else {
$strRestoCountry = '';
}
echo $strRestoAddress . $strRestoCity . $strRestoCountry;
echo '</td>';
echo '<td style="width:20%">';
echo $val['strFirstName'] . ' ' . $val['strMiddleName'] . ' ' . $val['strLastName'];
echo '</td>';
echo '<td style="width:11%">';
echo '<div class="btn-group controlHolder">';
echo '<a href="' . base_url() . 'dashboard/view_branches_account/' . $val['intRestoID'] . '" data-lng ="' . $latlang[1] . '" data-lat = "' . $latlang[0] . '"data-id="' . $val['intRestoID'] . '" data-title="' . $val['strRestoName'] . '" data-img="' . $val['strRestoThumb'] . '" data-assets="' . $val['strRestoAssets'] . '" data-date="' . $val['dateRestoCreated'] . '" data-location="' . $val['strRestoCity'] . '" data-description="' . strip_tags($val['strRestoDescr']) . '" class="btn btn-mini viewresto" ><i class="icon-eye-open"></i> <span>View</span></a>';
echo '</div>';
echo '</td>';
echo '</tr>';
}
示例9: downloadAPI
/**
* call API
*
* @param $resource
* @param array $query
* @param bool $array
* @return null
*/
protected function downloadAPI($resource, array $query = [], $array = false)
{
try {
$request = new Request('GET', $this->apiURL($resource));
$query['country_code'] = get_country('code');
$request->setQuery($query);
$response = $this->client->send($request);
$data = $response->getBody()->getContents();
$filename = "export" . date('Y-m-d');
header('Content-type: text/csv; charset=utf-8');
header('Content-Disposition: attachment; filename="' . $filename . '.csv"');
print $data;
die;
} catch (\Exception $e) {
Log::error($resource . ":" . $e->getMessage(), $query);
return null;
}
}
示例10: get_anonymous_user
/**
* Function used to get anonymous user
*/
function get_anonymous_user()
{
global $db;
$uid = config('anonymous_id');
if ($this->user_exists($uid)) {
return $uid;
} else {
$result = $db->select(tbl("users"), "userid", " level='6' AND status='unverified' ", "1");
if ($result[0]['userid']) {
return $result[0]['userid'];
} else {
$pass = RandomString(10);
if ($_SERVER['HTTP_HOST'] != 'localhost') {
$email = 'anonymous' . RandomString(5) . '@' . $_SERVER['HTTP_HOST'];
} else {
$email = 'anonymous' . RandomString(5) . '@' . $_SERVER['HTTP_HOST'] . '.tld';
}
//Create Anonymous user
$uid = $this->signup_user(array('username' => 'anonymous' . RandomString(5), 'email' => $email, 'password' => $pass, 'cpassword' => $pass, 'country' => get_country(config('default_country_iso2')), 'gender' => 'Male', 'dob' => '2000-10-10', 'category' => '1', 'level' => '6', 'active' => 'yes', 'agree' => 'yes'), false);
return $uid;
}
}
}
示例11: stats_title
// Developers by Nationality
case "nationality":
stats_title($t->translate("Developers listed by Nationality"));
$db->query("SELECT *,COUNT(*) AS nat_cnt FROM developers GROUP BY developers.nationality ORDER BY nat_cnt DESC");
while ($db->next_record()) {
stats_display(get_country($db->f("nationality")), $db->f("nat_cnt"), "", "", $total_number_dev);
}
stats_end();
break;
// Developers by Countries currently live in
// Developers by Countries currently live in
case "lives_in":
stats_title($t->translate("Developers listed by Countries currently live in"));
$db->query("SELECT *,COUNT(*) AS nat_cnt FROM developers GROUP BY developers.actual_country ORDER BY nat_cnt DESC");
while ($db->next_record()) {
stats_display(get_country($db->f("actual_country")), $db->f("nat_cnt"), "", "", $total_number_dev);
}
stats_end();
break;
// Developers by Mother Tonque
// Developers by Mother Tonque
case "mother_tonque":
stats_title($t->translate("Developers listed by Mother Tongue"));
$db->query("SELECT *,COUNT(*) AS nat_cnt FROM developers GROUP BY developers.mother_tongue ORDER BY nat_cnt DESC");
while ($db->next_record()) {
stats_display(get_lang($db->f("mother_tongue")), $db->f("nat_cnt"), "", "", $total_number_dev);
}
stats_end();
break;
}
}
示例12: db
<?php
include 'db.php';
$db = new db();
extract($_POST);
$sql = "SELECT count(*) total from registros where cedula = '{$cedula}' and id_promo = {$id_promo}";
$total = $db->SelectUnico($sql);
//$response = array();
if ($total == 0) {
$edad = age($anio . '-' . $mes . '-' . $dia);
$pais_ip = get_country(get_IP_address());
$sql = "INSERT INTO `registros` (`id_registro`, `id_promo`, `nombre`, `apellido`, `email`, `pais`, `ciudad`, `cedula`, `celular`,`sexo`, `edad`, `dia_nacimiento`, `mes_nacimiento`, `anio_nacimiento`, `ip`, `pais_ip`, `fecha`) VALUES (null, {$id_promo}, '{$nombre}', '{$apellido}', '{$email}', '{$pais}', '{$ciudad}', '{$cedula}', '{$celular}','{$sexo}', '" . $edad . "', '{$dia}', '{$mes}', '{$anio}', '" . get_IP_address() . "', '" . $pais_ip . "', NOW()); ";
$response['status'] = $db->Insert($sql);
$sql = "SELECT mailing,texto_mailing from promos where id_promo = {$id_promo}";
$a_data = $db->Select($sql);
$HTML = $a_data[0]['texto_mailing'] . '<br/><br/><img src="http://bonovirtualcolineal.com/admin/actions/uploads/' . $a_data[0]['mailing'] . '" />';
sendHTMLemail($HTML, $email, 'COLINEAL - Bono Virtual');
} else {
$response['status'] = 0;
}
header("Content-Type: application/json", true);
echo json_encode($response);
function get_IP_address()
{
foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
if (array_key_exists($key, $_SERVER) === true) {
foreach (explode(',', $_SERVER[$key]) as $IPaddress) {
$IPaddress = trim($IPaddress);
// Just to be safe
if (filter_var($IPaddress, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE) !== false) {
return $IPaddress;
示例13: transaction_results
//.........这里部分代码省略.........
$message .= " - " . $product_data[0]['name'] . $variation_list . " " . $message_price . " " . TXT_WPSC_CLICKTODOWNLOAD . ": {$link}\n";
$message_html .= " - " . $product_data[0]['name'] . $variation_list . " " . $message_price . " <a href='{$link}'>" . TXT_WPSC_DOWNLOAD . "</a>\n";
} else {
$plural = '';
if ($row['quantity'] > 1) {
$plural = "s";
}
$message .= " - " . $row['quantity'] . " " . $product_data[0]['name'] . $variation_list . " " . $message_price . "\n - " . TXT_WPSC_SHIPPING . ":" . $shipping_price . "\n\r";
$message_html .= " - " . $row['quantity'] . " " . $product_data[0]['name'] . $variation_list . " " . $message_price . "\n - " . TXT_WPSC_SHIPPING . ":" . $shipping_price . "\n\r";
}
$report .= " - " . $product_data[0]['name'] . $variation_list . " " . $message_price . "\n";
}
if ($purchase_log['discount_data'] != '') {
$coupon_data = $wpdb->get_row("SELECT * FROM `" . $wpdb->prefix . "wpsc_coupon_codes` WHERE coupon_code='" . $wpdb->escape($purchase_log['discount_data']) . "' LIMIT 1", ARRAY_A);
if ($coupon_data['use-once'] == 1) {
$wpdb->query("UPDATE `" . $wpdb->prefix . "wpsc_coupon_codes` SET `active`='0', `is-used`='1' WHERE `id`='" . $coupon_data['id'] . "' LIMIT 1");
}
}
//$wpdb->query("UPDATE `".$wpdb->prefix."download_status` SET `active`='1' WHERE `fileid`='".$product_data[0]['file']."' AND `purchid` = '".$purchase_log['id']."' LIMIT 1");
$total_shipping = nzshpcrt_determine_base_shipping($total_shipping, $shipping_country);
$total = $total + $total_shipping - $purchase_log['discount_value'];
// $message.= "\n\r";
$message .= "Your Purchase No.: " . $purchase_log['id'] . "\n\r";
if ($purchase_log['discount_value'] > 0) {
$message .= TXT_WPSC_DISCOUNT . ": " . nzshpcrt_currency_display($purchase_log['discount_value'], 1, true) . "\n\r";
}
$message .= TXT_WPSC_TOTALSHIPPING . ": " . nzshpcrt_currency_display($total_shipping, 1, true) . "\n\r";
$message .= TXT_WPSC_TOTAL . ": " . nzshpcrt_currency_display($total, 1, true) . "\n\r";
$message_html .= "Your Purchase No.: " . $purchase_log['id'] . "\n\n\r";
if ($purchase_log['discount_value'] > 0) {
$message_html .= TXT_WPSC_DISCOUNT . ": " . nzshpcrt_currency_display($purchase_log['discount_value'], 1, true) . "\n\r";
}
$message_html .= TXT_WPSC_TOTALSHIPPING . ": " . nzshpcrt_currency_display($total_shipping, 1, true) . "\n\r";
$message_html .= TXT_WPSC_TOTAL . ": " . nzshpcrt_currency_display($total, 1, true) . "\n\r";
if (isset($_GET['ti'])) {
$message .= "\n\r" . TXT_WPSC_YOURTRANSACTIONID . ": " . $_GET['ti'];
$message_html .= "\n\r" . TXT_WPSC_YOURTRANSACTIONID . ": " . $_GET['ti'];
$report .= "\n\r" . TXT_WPSC_TRANSACTIONID . ": " . $_GET['ti'];
} else {
$report_id = "Purchase No.: " . $purchase_log['id'] . "\n\r";
}
if ($email != '' && $purchase_log['email_sent'] != 1) {
if ($purchase_log['processed'] < 2) {
$payment_instructions = strip_tags(get_option('payment_instructions'));
$message = TXT_WPSC_ORDER_PENDING . "\n\r" . $payment_instructions . "\n\r" . $message;
mail($email, TXT_WPSC_ORDER_PENDING_PAYMENT_REQUIRED, $message, "From: " . get_option('return_email') . "");
} else {
mail($email, TXT_WPSC_PURCHASERECEIPT, $message, "From: " . get_option('return_email') . "");
}
}
$report_user = TXT_WPSC_CUSTOMERDETAILS . "\n\r";
$form_sql = "SELECT * FROM `" . $wpdb->prefix . "submited_form_data` WHERE `log_id` = '" . $purchase_log['id'] . "'";
$form_data = $wpdb->get_results($form_sql, ARRAY_A);
if ($form_data != null) {
foreach ($form_data as $form_field) {
$form_sql = "SELECT * FROM `" . $wpdb->prefix . "collect_data_forms` WHERE `id` = '" . $form_field['form_id'] . "' LIMIT 1";
$form_data = $wpdb->get_results($form_sql, ARRAY_A);
$form_data = $form_data[0];
if ($form_data['type'] == 'country') {
$report_user .= $form_data['name'] . ": " . get_country($form_field['value']) . "\n";
} else {
$report_user .= $form_data['name'] . ": " . $form_field['value'] . "\n";
}
}
}
$report_user .= "\n\r";
$report = $report_user . $report_id . $report;
if (get_option('purch_log_email') != null && $purchase_log['email_sent'] != 1) {
mail(get_option('purch_log_email'), TXT_WPSC_PURCHASEREPORT, $report, "From: " . get_option('return_email') . "");
}
if ($purchase_log['gateway'] == 'testmode' && $purchase_log['processed'] < 2) {
echo "<br />" . nl2br(str_replace("\$", '\\$', $message_html));
return;
}
$_SESSION['nzshpcrt_cart'] = '';
$_SESSION['nzshpcrt_cart'] = array();
if (true === $echo_to_screen) {
echo '<div class="wrap">';
if ($sessionid != null) {
echo TXT_WPSC_THETRANSACTIONWASSUCCESSFUL . "<br />";
echo "<br />" . nl2br(str_replace("\$", '\\$', $message_html));
}
echo '</div>';
}
} else {
if (true === $echo_to_screen) {
echo '<div class="wrap">';
echo TXT_WPSC_BUYPRODUCTS;
echo '</div>';
}
}
if ($purchase_log['email_sent'] != 1 and $sessionid != '') {
if (preg_match("/^[\\w\\s._,-]+\$/", $transaction_id)) {
$transact_id_sql = "`transactid` = '" . $transaction_id . "',";
}
$update_sql = "UPDATE `" . $wpdb->prefix . "purchase_logs` SET {$transact_id_sql} `date` = '" . time() . "',`email_sent` = '1', `processed` = '{$order_status}' WHERE `sessionid` = " . $sessionid . " LIMIT 1";
$wpdb->query($update_sql);
}
}
}
示例14: disabled_states
disabled_states($vars['states']);
break;
case 'load_countries':
load_countries();
break;
case 'load_countries_disabled':
load_countries_disabled();
break;
case 'load_states':
load_states($vars['country']);
break;
case 'load_states_disabled':
load_states_disabled($vars['country']);
break;
case 'get_country':
get_country($vars['country']);
break;
case 'get_state':
get_state($vars['state']);
break;
case 'save_country':
save_country($vars['country'], $vars['title'], $vars['tag'], $vars['act']);
break;
case 'save_state':
save_state($vars['country'], $vars['state'], $vars['title'], $vars['tag'], $vars['act']);
break;
case 'get_expire':
get_expire($vars['product_id'], $vars['begin_date']);
break;
case 'calculate_tax':
calculate_tax($vars['product_id'], $vars['member_id'], $vars['amount'], $vars['incl_tax']);
示例15: get_option
//pokazh($message,"message");
//exit;
if (isset($cart) && $cart != null && $cart_content != '' && $errorcode == 0) {
$headers = "From: " . get_option('return_email') . "\r\n" . 'X-Mailer: PHP/' . phpversion() . "\r\n" . "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=utf-8\r\n" . "Content-Transfer-Encoding: 8bit\r\n\r\n";
$purch_sql = "SELECT * FROM `wp_purchase_logs` WHERE `id`!='" . $check[0]['id'] . "'";
$purch_data = $wpdb->get_results($purch_sql, ARRAY_A);
$report_user = "О заказчике. ";
$form_sql = "SELECT * FROM `wp_submited_form_data` WHERE `log_id` = '" . $check[0]['id'] . "'";
$form_data = $wpdb->get_results($form_sql, ARRAY_A);
if ($form_data != null) {
foreach ($form_data as $form_field) {
$form_sql = "SELECT * FROM `wp_collect_data_forms` WHERE `id` = '" . $form_field['form_id'] . "' LIMIT 1";
$form_data = $wpdb->get_results($form_sql, ARRAY_A);
$form_data = $form_data[0];
if ($form_data['type'] == 'country') {
$report_user .= $form_data['name'] . ": " . get_country($form_field['value']) . "\n";
} else {
$report_user .= $form_data['name'] . ": " . $form_field['value'] . "\n";
}
}
}
$report_user .= "\n\r";
$report = $report_user . $report;
if ($email != '') {
$mess = $report . " <br /><br /> " . $message;
//mail($email, 'Подтверждение покупки изображения. Cartoonbank.ru .', $message, $headers);
//mail("igor.aleshin@gmail.com", 'Подтверждение покупки изображения. Копия.', $mess, $headers);
// Send licenses as attchment
send_email_multi_attachments($email, $result_no_license_text);
send_email_multi_attachments("igor.aleshin@gmail.com", $result_no_license_text);
send_email_multi_attachments("vfshilov@gmail.com", $result_no_license_text);