本文整理汇总了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'));
示例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);
}
示例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']);
}