-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathdeprecated.php
51 lines (40 loc) · 1.5 KB
/
deprecated.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* @deprecated If you really need to do that manually, use the AutoDataSource-Class instead.
*/
function geoip_detect_update() {
_doing_it_wrong('Geolocation IP Detection: geoip_detect_update', ' If you really need to do that manually, use the AutoDataSource-Class instead.', '2.4.0');
$s = new \YellowTree\GeoipDetect\DataSources\Auto\AutoDataSource();
return $s->maxmindUpdate();
}
/**
* @deprecated since 2.4.0
* @return string
*/
function geoip_detect_get_abs_db_filename()
{
_doing_it_wrong('Geolocation IP Detection: geoip_detect_get_abs_db_filename', 'geoip_detect_get_abs_db_filename should not be called directly', '2.4.0');
$source = \YellowTree\GeoipDetect\DataSources\DataSourceRegistry::getInstance()->getCurrentSource();
if (is_object($reader) && method_exists($source, 'maxmindGetFilename'))
return $source->maxmindGetFilename();
return '';
}
/**
* @deprecated shortcode
*/
function geoip_detect_shortcode($attr)
{
$userInfo = geoip_detect_get_info_from_current_ip();
$defaultValue = isset($attr['default']) ? $attr['default'] : '';
if (!is_object($userInfo))
return $defaultValue . '<!-- Geolocation IP Detection: No info found for this IP. -->';
$propertyName = $attr['property'];
if (property_exists($userInfo, $propertyName)) {
if ($userInfo->$propertyName)
return $userInfo->$propertyName;
else
return $defaultValue;
}
return $defaultValue . '<!-- Geolocation IP Detection: Invalid property name. -->';
}
add_shortcode('geoip_detect', 'geoip_detect_shortcode');