-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathclass-gf-phone-extension.php
214 lines (185 loc) · 4.45 KB
/
class-gf-phone-extension.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<?php
GFForms::include_addon_framework();
/**
* Create Gravity Forms Phone Extension
* plugin class
*
* @since 1.0.0
*/
class GF_Phone_Extension extends GFAddon {
/**
* Contains an instance of this class, if available.
*
* @since 1.0.0
* @access private
* @var object $_instance If available, contains an instance of this class.
*/
private static $_instance = null;
/**
* Defines the version of the Propstack Add-On.
*
* @since 1.0.0
* @access protected
* @var string $_version Contains the version, defined from gravityforms-propstack.php
*/
protected $_version = GF_PHONE_EXTENSION_VERSION;
/**
* Defines the minimum Gravity Forms version required.
*
* @since 1.0.0
* @access protected
* @var string $_min_gravityforms_version The minimum version required.
*/
protected $_min_gravityforms_version = '2.2';
/**
* Defines the plugin slug.
*
* @since 1.0.0
* @access protected
* @var string $_slug The slug used for this plugin.
*/
protected $_slug = 'gravityforms-phone-extension';
/**
* Defines the main plugin file.
*
* @since 1.0.0
* @access protected
* @var string $_path The path to the main plugin file, relative to the plugins folder.
*/
protected $_path = 'gravityforms-phone-extension/gravityforms-phone-extension.php';
/**
* Defines the full path to this class file.
*
* @since 1.0.0
* @access protected
* @var string $_full_path The full path.
*/
protected $_full_path = __FILE__;
/**
* Defines the URL where this Add-On can be found.
*
* @since 1.0.0
* @access protected
* @var string The URL of the Add-On.
*/
protected $_url = 'http://www.anex.at';
/**
* Defines the title of this Add-On.
*
* @since 1.0.0
* @access protected
* @var string $_title The title of the Add-On.
*/
protected $_title = 'Gravity Forms Phone Extension Add-On';
/**
* Defines the short title of the Add-On.
*
* @since 1.0.0
* @access protected
* @var string $_short_title The short title.
*/
protected $_short_title = 'Phone Extension';
/**
* Defines if Add-On should use Gravity Forms servers for update data.
*
* @since 1.0.0
* @access protected
* @var bool
*/
protected $_enable_rg_autoupgrade = false;
/**
* Get an instance of this class.
*
* @since 1.0.0
* @access public
*
* @return GF_Phone_Extension
*/
public static function get_instance() {
if ( null === self::$_instance ) {
self::$_instance = new self;
}
return self::$_instance;
}
/**
* Plugin starting point. Handles hooks, and loading of language files.
*
* @since 1.2.0
* @access public
*/
public function init() {
parent::init();
}
/**
* Register needed styles.
*
* @since 1.2.0
* @access public
*
* @return array
*/
public function styles() {
$styles = array(
array(
'handle' => 'intl-tel-input',
'src' => $this->get_base_url() . '/vendor/intl-tel-input/css/intlTelInput.min.css',
'version' => '14.0.7',
'enqueue' => array(
array( 'field_types' => array( 'phone' ) )
),
),
array(
'handle' => $this->_slug,
'src' => $this->get_base_url() . '/assets/css/style.css',
'version' => $this->_version,
'enqueue' => array(
array( 'field_types' => array( 'phone' ) )
),
),
);
return array_merge( parent::styles(), $styles );
}
/**
* Register needed scripts.
*
* @since 1.2.0
* @access public
*
* @return array
*/
public function scripts() {
$scripts = array(
array(
'handle' => 'intl-tel-input',
'src' => $this->get_base_url() . '/vendor/intl-tel-input/js/intlTelInput-jquery.min.js',
'deps' => array( 'jquery' ),
'version' => '14.0.7',
'in_footer' => true,
'enqueue' => array(
array( 'field_types' => array( 'phone' ) )
),
),
array(
'handle' => 'intl-tel-input-utils',
'src' => $this->get_base_url() . '/vendor/intl-tel-input/js/utils.js',
'deps' => array( 'jquery', 'intl-tel-input' ),
'version' => '14.0.7',
'in_footer' => true,
'enqueue' => array(
array( 'field_types' => array( 'phone' ) )
),
),
array(
'handle' => $this->_slug,
'src' => $this->get_base_url() . '/assets/js/init.js',
'deps' => array( 'jquery', 'intl-tel-input' ),
'version' => $this->_version,
'in_footer' => true,
'enqueue' => array(
array( 'field_types' => array( 'phone' ) )
),
),
);
return array_merge( parent::scripts(), $scripts );
}
}