forked from julienbechade/acf-location-field
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathacf-location-field.php
89 lines (73 loc) · 1.69 KB
/
acf-location-field.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/*
* Plugin Name: Advanced Custom Fields - Location Field add-on
* Plugin URI: https://github.com/julienbechade/acf-location-field
* Description: This plugin is an add-on for Advanced Custom Fields. It allows you to find coordinates and/or address of a location with Google Maps.
* Author: Julien Bechade
* Author URI: http://julienbechade.com/
* Version: 1.0
* Text Domain: acf-location-field
* Domain Path: /lang/
*/
class acf_location_plugin
{
var $settings;
/*
* WordPress Localization Text Domain
*
* Used in wordpress localization and translation methods.
* @var string
*
*/
const L10N_DOMAIN = 'acf-location-field';
/*
* Language directory path
*
* Used to build the path for WordPress localization files.
* @var string
*
*/
private $lang_dir;
/*
* Constructor
*
* @description:
* @since 1.0.0
* @created: 23/06/12
*/
function __construct()
{
// vars
$settings = array(
'version' => '1.0.0',
'basename' => plugin_basename(__FILE__),
);
$this->lang_dir = rtrim( dirname( realpath( __FILE__ ) ), '/' ) . '/lang';
// actions
add_action( 'init', array( &$this, 'load_textdomain' ), 2, 0 );
add_action('acf/register_fields', array($this, 'register_fields'));
}
/*
* register_fields
*
* @description:
* @since: 3.6
* @created: 31/01/13
*/
function register_fields()
{
include_once('location-field.php');
}
/*
* Loads the textdomain for the current locale if it exists
*
*/
public function load_textdomain()
{
$locale = get_locale();
$mofile = $this->lang_dir . '/' . self::L10N_DOMAIN . '-' . $locale . '.mo';
load_textdomain( self::L10N_DOMAIN, $mofile );
}
}
new acf_location_plugin();
?>