1+ <?php
2+
3+ /**
4+ * Create Gravity Forms Phone Extension
5+ * plugin class
6+ *
7+ * @since 1.0.0
8+ */
9+
10+ class GF_Phone_Extension {
11+
12+ /**
13+ * Contains an instance of this class, if available.
14+ *
15+ * @since 1.0.0
16+ * @access private
17+ * @var object $_instance If available, contains an instance of this class.
18+ */
19+ private static $ _instance = null ;
20+
21+ /**
22+ * Defines the version of the Propstack Add-On.
23+ *
24+ * @since 1.0.0
25+ * @access protected
26+ * @var string $_version Contains the version, defined from gravityforms-propstack.php
27+ */
28+ protected $ _version = GF_PHONE_EXTENSION_VERSION ;
29+
30+ /**
31+ * Defines the minimum Gravity Forms version required.
32+ *
33+ * @since 1.0.0
34+ * @access protected
35+ * @var string $_min_gravityforms_version The minimum version required.
36+ */
37+ protected $ _min_gravityforms_version = '2.2 ' ;
38+
39+ /**
40+ * Defines the plugin slug.
41+ *
42+ * @since 1.0.0
43+ * @access protected
44+ * @var string $_slug The slug used for this plugin.
45+ */
46+ protected $ _slug = 'gravityforms-phone-extension ' ;
47+
48+ /**
49+ * Defines the main plugin file.
50+ *
51+ * @since 1.0.0
52+ * @access protected
53+ * @var string $_path The path to the main plugin file, relative to the plugins folder.
54+ */
55+ protected $ _path = 'gravityforms-phone-extension/gravityforms-phone-extension.php ' ;
56+
57+ /**
58+ * Defines the full path to this class file.
59+ *
60+ * @since 1.0.0
61+ * @access protected
62+ * @var string $_full_path The full path.
63+ */
64+ protected $ _full_path = __FILE__ ;
65+
66+ /**
67+ * Defines the URL where this Add-On can be found.
68+ *
69+ * @since 1.0.0
70+ * @access protected
71+ * @var string The URL of the Add-On.
72+ */
73+ protected $ _url = 'http://www.anex.at ' ;
74+
75+ /**
76+ * Defines the title of this Add-On.
77+ *
78+ * @since 1.0.0
79+ * @access protected
80+ * @var string $_title The title of the Add-On.
81+ */
82+ protected $ _title = 'Gravity Forms Phone Extension Add-On ' ;
83+
84+ /**
85+ * Defines the short title of the Add-On.
86+ *
87+ * @since 1.0.0
88+ * @access protected
89+ * @var string $_short_title The short title.
90+ */
91+ protected $ _short_title = 'Phone Extension ' ;
92+
93+ /**
94+ * Defines if Add-On should use Gravity Forms servers for update data.
95+ *
96+ * @since 1.0.0
97+ * @access protected
98+ * @var bool
99+ */
100+ protected $ _enable_rg_autoupgrade = false ;
101+
102+ /**
103+ * Get an instance of this class.
104+ *
105+ * @since 1.0.0
106+ * @access public
107+ *
108+ * @return GF_Phone_Extension
109+ */
110+ public static function get_instance () {
111+
112+ if ( null === self ::$ _instance ) {
113+ self ::$ _instance = new self ;
114+ }
115+
116+ return self ::$ _instance ;
117+
118+ }
119+
120+ /**
121+ * Initializes the plugin
122+ *
123+ * @since 1.0.0
124+ * @access public
125+ */
126+ public function __construct () {
127+
128+ // Register site styles
129+ add_action ( 'wp_enqueue_scripts ' , array ( $ this , 'assets ' ) );
130+
131+ }
132+
133+
134+ /**
135+ * Register and enqueue plugin-specific assets
136+ *
137+ * @since 1.0.0
138+ * @access public
139+ */
140+ public function assets () {
141+
142+ // register & enqueue styles
143+ wp_enqueue_style ( 'intl-tel-input ' , plugins_url ( 'vendor/intl-tel-input/css/intlTelInput.css ' , dirname ( __FILE__ ) ), array (), '11.0.11 ' );
144+ wp_enqueue_style ( 'gravityforms-phone-extension ' , plugins_url ( 'assets/css/style.css ' , dirname ( __FILE__ ) ), array (), $ this ->_version );
145+
146+ // register & enqueue scripts
147+ wp_enqueue_script ( 'intl-tel-input ' , plugins_url ( 'vendor/intl-tel-input/js/intlTelInput.min.js ' , dirname ( __FILE__ ) ), array ( 'jquery ' ), '11.0.11 ' , true );
148+ wp_enqueue_script ( 'intl-tel-input-utils ' , plugins_url ( 'vendor/intl-tel-input/js/utils.js ' , dirname ( __FILE__ ) ), array ( 'jquery ' , 'intl-tel-input ' ), '11.0.11 ' , true );
149+ wp_enqueue_script ( 'gravityforms-phone-extension ' , plugins_url ( 'assets/js/init.js ' , dirname ( __FILE__ ) ), array ( 'jquery ' , 'intl-tel-input ' ), $ this ->_version , true );
150+
151+ }
152+
153+ }
0 commit comments