當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WC_Geolocation::get_local_database_path方法代碼示例

本文整理匯總了PHP中WC_Geolocation::get_local_database_path方法的典型用法代碼示例。如果您正苦於以下問題:PHP WC_Geolocation::get_local_database_path方法的具體用法?PHP WC_Geolocation::get_local_database_path怎麽用?PHP WC_Geolocation::get_local_database_path使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WC_Geolocation的用法示例。


在下文中一共展示了WC_Geolocation::get_local_database_path方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _e

if (in_array(get_option('woocommerce_default_customer_address'), array('geolocation_ajax', 'geolocation'))) {
    ?>
				<tr>
					<td data-export-label="MaxMind GeoIP Database"><?php 
    _e('MaxMind GeoIP Database', 'woocommerce');
    ?>
:</td>
					<td class="help"><?php 
    echo wc_help_tip(__('The GeoIP database from MaxMind is used to geolocate customers.', 'woocommerce'));
    ?>
</td>
					<td><?php 
    if (file_exists(WC_Geolocation::get_local_database_path())) {
        echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html(WC_Geolocation::get_local_database_path()) . '</code></mark> ';
    } else {
        printf('<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf(__('The MaxMind GeoIP Database does not exist - Geolocation will not function. You can download and install it manually from %1$s to the path: %2$s. Scroll down to \\"Downloads\\" and download the \\"Binary / gzip\\" file next to \\"GeoLite Country\\"', 'woocommerce'), make_clickable('http://dev.maxmind.com/geoip/legacy/geolite/'), '<code class="private">' . WC_Geolocation::get_local_database_path() . '</code>') . '</mark>', WC_LOG_DIR);
    }
    ?>
</td>
				</tr>
				<?php 
}
?>
		</tr>
	</tbody>
</table>
<table class="wc_status_table widefat" cellspacing="0">
	<thead>
		<tr>
			<th colspan="3" data-export-label="Active Plugins (<?php 
echo count((array) get_option('active_plugins'));
開發者ID:Biont,項目名稱:woocommerce,代碼行數:31,代碼來源:html-admin-page-status-report.php

示例2: get_database_info

 /**
  * Get array of database information. Version, prefix, and table existence.
  *
  * @return array
  */
 public function get_database_info()
 {
     global $wpdb;
     // WC Core tables to check existence of
     $tables = apply_filters('woocommerce_database_tables', array('woocommerce_sessions', 'woocommerce_api_keys', 'woocommerce_attribute_taxonomies', 'woocommerce_downloadable_product_permissions', 'woocommerce_order_items', 'woocommerce_order_itemmeta', 'woocommerce_tax_rates', 'woocommerce_tax_rate_locations', 'woocommerce_shipping_zones', 'woocommerce_shipping_zone_locations', 'woocommerce_shipping_zone_methods', 'woocommerce_payment_tokens', 'woocommerce_payment_tokenmeta'));
     if (get_option('db_version') < 34370) {
         $tables[] = 'woocommerce_termmeta';
     }
     $table_exists = array();
     foreach ($tables as $table) {
         $table_exists[$table] = $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s;", $wpdb->prefix . $table)) === $wpdb->prefix . $table;
     }
     // Return all database info. Described by JSON Schema.
     return array('wc_database_version' => get_option('woocommerce_db_version'), 'database_prefix' => $wpdb->prefix, 'maxmind_geoip_database' => WC_Geolocation::get_local_database_path(), 'database_tables' => $table_exists);
 }
開發者ID:Korkey128k,項目名稱:woocommerce,代碼行數:20,代碼來源:class-wc-rest-system-status-controller.php

示例3: test_get_system_status_info_database

 /**
  * Test to make sure database response is correct.
  *
  * @since 2.7.0
  */
 public function test_get_system_status_info_database()
 {
     global $wpdb;
     wp_set_current_user($this->user);
     $response = $this->server->dispatch(new WP_REST_Request('GET', '/wc/v1/system_status'));
     $data = $response->get_data();
     $database = $data['database'];
     $this->assertEquals(get_option('woocommerce_db_version'), $database['wc_database_version']);
     $this->assertEquals($wpdb->prefix, $database['database_prefix']);
     $this->assertEquals(WC_Geolocation::get_local_database_path(), $database['maxmind_geoip_database']);
     $this->assertArrayHasKey('woocommerce_payment_tokens', $database['database_tables']);
 }
開發者ID:Korkey128k,項目名稱:woocommerce,代碼行數:17,代碼來源:system-status.php


注:本文中的WC_Geolocation::get_local_database_path方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。