PluginProbe
WP GoToWebinar / 8.9
WP GoToWebinar v8.9
15.20 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 8.0 All 112 releases
wp-gotowebinar / wp-gotowebinar.php

wp-gotowebinar.php in WP GoToWebinar 8.9, at wp-gotowebinar.php

444 lines 27.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * Plugin Name: WP GoToWebinar
4 * Plugin URI: https://www.northernbeacheswebsites.com.au
5 * Description: Show upcoming GoToWebinars on any post or page or in a widget and register users on your website.
6 * Version: 8.9
7 * Author: Martin Gibson
8 * Author URI: https://www.northernbeacheswebsites.com.au
9 * Text Domain: wp-gotowebinar
10 * Support: https://www.northernbeacheswebsites.com.au/contact
11 * Licence: GPL2
12 */
13 // Assign global variables
14 global $gotowebinar_is_pro;
15 $gotowebinar_is_pro = "NO";
16
17
18 function wpgotowebinar_plugin_get_version() {
19 if ( ! function_exists( 'get_plugins' ) )
20 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
21 $plugin_folder = get_plugins( '/' . plugin_basename( dirname( __FILE__ ) ) );
22 $plugin_file = basename( ( __FILE__ ) );
23 return $plugin_folder[$plugin_file]['Version'];
24 }
25
26
27 $options = array();
28 $time_zone_list = array("Pacific/Tongatapu"=>13, "Pacific/Fiji"=>12, "Pacific/Auckland"=>12, "Asia/Magadan"=>11, "Asia/Vladivostok"=>10, "Australia/Hobart"=>10, "Pacific/Guam"=>10, "Australia/Sydney"=>10, "Australia/Brisbane"=>10, "Australia/Darwin"=>9.5, "Australia/Adelaide"=>9.5, "Asia/Yakutsk"=>9, "Asia/Seoul"=>9, "Asia/Tokyo"=>9, "Asia/Taipei"=>8, "Australia/Perth"=>8, "Asia/Singapore"=>8, "Asia/Irkutsk"=>8, "Asia/Shanghai"=>8, "Asia/Krasnoyarsk"=>7, "Asia/Bangkok"=>7, "Asia/Jakarta"=>7, "Asia/Rangoon"=>6.5, "Asia/Colombo"=>6, "Asia/Dhaka"=>6, "Asia/Novosibirsk"=>6, "Asia/Katmandu"=>5.75, "Asia/Calcutta"=>5.5, "Asia/Karachi"=>5, "Asia/Yekaterinburg"=>5, "Asia/Kabul"=>4.5, "Asia/Tbilisi"=>4, "Asia/Muscat"=>4, "Asia/Tehran"=>3.5, "Africa/Nairobi"=>3, "Europe/Moscow"=>3, "Asia/Kuwait"=>3, "Asia/Baghdad"=>3, "Asia/Jerusalem"=>2, "Europe/Helsinki"=>2, "Africa/Harare"=>2, "Africa/Cairo"=>2, "Europe/Bucharest"=>2, "Europe/Athens"=>2, "Africa/Malabo"=>1, "Europe/Warsaw"=>1, "Europe/Brussels"=>1, "Europe/Prague"=>1, "Europe/Amsterdam"=>1, "GMT"=>0, "Europe/London"=>0, "Africa/Casablanca"=>0, "Atlantic/Cape_Verde"=>-1, "Atlantic/Azores"=>-1, "America/Buenos_Aires"=>-3, "America/Sao_Paulo"=>-3, "America/St_Johns"=>-3, "America/Santiago"=>-4, "America/Caracas"=>-4, "America/Halifax"=>-4, "America/Indianapolis"=>-5, "America/New_York"=>-5, "America/Bogota"=>-5, "America/Mexico_City"=>-6, "America/Chicago"=>-6, "America/Denver"=>-7, "America/Phoenix"=>-7, "America/Los_Angeles"=>-8, "America/Anchorage"=>-9, "Pacific/Honolulu"=>-10, "MIT"=>-11);
29
30
31 //disable updates if pro version
32 if($gotowebinar_is_pro == "YES") {
33 function wp_gotowebinar_disable_updates( $value ) {
34 $value = new StdClass;
35 unset($value->response[ plugin_basename(__FILE__) ]);
36 return $value;
37 }
38 add_filter( 'site_transient_update_plugins', 'wp_gotowebinar_disable_updates' );
39 }
40
41 // Add a link to our plugin in the admin menu under Settings > GoToWebinar
42 function wp_gotowebinar_wp_menu() {
43 global $gotowebinar_wp_settings_page;
44 $gotowebinar_wp_settings_page = add_options_page(
45 'WP GoToWebinar Options',
46 'WP GoToWebinar',
47 'manage_options',
48 'wp-gotowebinar',
49 'wp_gotowebinar_options_page'
50 );
51 }
52 add_action('admin_menu','wp_gotowebinar_wp_menu');
53
54
55 //add a settings link on the plugin page
56 function plugin_add_settings_link( $links ) {
57 $settings_link = '<a href="options-general.php?page=wp-gotowebinar">' . __( 'Settings' ) . '</a>';
58 array_unshift( $links, $settings_link );
59 return $links;
60 }
61 $plugin = plugin_basename( __FILE__ );
62 add_filter( "plugin_action_links_$plugin", 'plugin_add_settings_link' );
63
64 //add custom links to plugin on plugins page
65 function wp_gotowebinar_custom_plugin_row_meta( $links, $file ) {
66 if ( strpos( $file, 'wp-gotowebinar.php' ) !== false ) {
67 $new_links = array(
68 '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VGVE97KF74FVN" target="_blank">' . __('Donate') . '</a>',
69 '<a href="https://northernbeacheswebsites.com.au/wp-gotowebinar-pro/" target="_blank">' . __('Pro Version') . '</a>',
70 '<a href="http://wordpress.org/support/plugin/wp-gotowebinar" target="_blank">' . __('Support Forum') . '</a>',
71 );
72 $links = array_merge( $links, $new_links );
73 }
74 return $links;
75 }
76 add_filter( 'plugin_row_meta', 'wp_gotowebinar_custom_plugin_row_meta', 10, 2 );
77
78 // Create our main options page
79 function wp_gotowebinar_options_page(){
80 if(!current_user_can('manage_options')) {
81 wp_die('You do not have sufficient permission to access this page.');
82 }
83
84
85 //check if form has been submitted
86 global $options;
87 if( isset( $_POST['gotowebinar_settings_form_submitted'])){
88 $hidden_field = esc_html($_POST['gotowebinar_settings_form_submitted']);
89 if( $hidden_field == 'Y') {
90 $gotowebinar_authorization = esc_html($_POST['gotowebinar_authorization']);
91 $options['gotowebinar_authorization'] = $gotowebinar_authorization;
92 $gotowebinar_organizer_key = esc_html($_POST['gotowebinar_organizer_key']);
93 $options['gotowebinar_organizer_key'] = $gotowebinar_organizer_key;
94 $gotowebinar_date_format = esc_html($_POST['gotowebinar_date_format']);
95 $options['gotowebinar_date_format'] = $gotowebinar_date_format;
96 $gotowebinar_time_format = esc_html($_POST['gotowebinar_time_format']);
97 $options['gotowebinar_time_format'] = $gotowebinar_time_format;
98 $gotowebinar_disable_tooltip = esc_html(isset($_POST['gotowebinar_disable_tooltip']));
99 $options['gotowebinar_disable_tooltip'] = $gotowebinar_disable_tooltip;
100 $gotowebinar_tooltip_text_color = esc_html($_POST['gotowebinar_tooltip_text_color']);
101 $options['gotowebinar_tooltip_text_color'] = $gotowebinar_tooltip_text_color;
102 $gotowebinar_tooltip_background_color = esc_html($_POST['gotowebinar_tooltip_background_color']);
103 $options['gotowebinar_tooltip_background_color'] = $gotowebinar_tooltip_background_color;
104 $gotowebinar_tooltip_border_color = esc_html($_POST['gotowebinar_tooltip_border_color']);
105 $options['gotowebinar_tooltip_border_color'] = $gotowebinar_tooltip_border_color;
106 $gotowebinar_icon_color = esc_html($_POST['gotowebinar_icon_color']);
107 $options['gotowebinar_icon_color'] = $gotowebinar_icon_color;
108 $gotowebinar_custom_registration_page = esc_html($_POST['gotowebinar_custom_registration_page']);
109 $options['gotowebinar_custom_registration_page'] = $gotowebinar_custom_registration_page;
110 $gotowebinar_custom_thankyou_page = esc_html($_POST['gotowebinar_custom_thankyou_page']);
111 $options['gotowebinar_custom_thankyou_page'] = $gotowebinar_custom_thankyou_page;
112 $gotowebinar_button_text_color = esc_html($_POST['gotowebinar_button_text_color']);
113 $options['gotowebinar_button_text_color'] = $gotowebinar_button_text_color;
114 $gotowebinar_button_background_color = esc_html($_POST['gotowebinar_button_background_color']);
115 $options['gotowebinar_button_background_color'] = $gotowebinar_button_background_color;
116 $gotowebinar_button_border_color = esc_html($_POST['gotowebinar_button_border_color']);
117 $options['gotowebinar_button_border_color'] = $gotowebinar_button_border_color;
118 //start cache option
119 $gotowebinar_disable_cache = esc_html(isset($_POST['gotowebinar_disable_cache']));
120 $options['gotowebinar_disable_cache'] = $gotowebinar_disable_cache;
121 //start enable timezone converstion option
122 $gotowebinar_enable_timezone_conversion = esc_html(isset($_POST['gotowebinar_enable_timezone_conversion']));
123 $options['gotowebinar_enable_timezone_conversion'] = $gotowebinar_enable_timezone_conversion;
124 $gotowebinar_timezone_error_message = esc_html(stripslashes($_POST['gotowebinar_timezone_error_message']));
125 $options['gotowebinar_timezone_error_message'] = $gotowebinar_timezone_error_message;
126 //start translate options
127 $gotowebinar_translate_firstName = esc_html(stripslashes($_POST['gotowebinar_translate_firstName']));
128 $options['gotowebinar_translate_firstName'] = $gotowebinar_translate_firstName;
129 $gotowebinar_translate_lastName = esc_html(stripslashes($_POST['gotowebinar_translate_lastName']));
130 $options['gotowebinar_translate_lastName'] = $gotowebinar_translate_lastName;
131 $gotowebinar_translate_email = esc_html(stripslashes($_POST['gotowebinar_translate_email']));
132 $options['gotowebinar_translate_email'] = $gotowebinar_translate_email;
133 $gotowebinar_translate_address = esc_html(stripslashes($_POST['gotowebinar_translate_address']));
134 $options['gotowebinar_translate_address'] = $gotowebinar_translate_address;
135 $gotowebinar_translate_city = esc_html(stripslashes($_POST['gotowebinar_translate_city']));
136 $options['gotowebinar_translate_city'] = $gotowebinar_translate_city;
137 $gotowebinar_translate_state = esc_html(stripslashes($_POST['gotowebinar_translate_state']));
138 $options['gotowebinar_translate_state'] = $gotowebinar_translate_state;
139 $gotowebinar_translate_zipCode = esc_html(stripslashes($_POST['gotowebinar_translate_zipCode']));
140 $options['gotowebinar_translate_zipCode'] = $gotowebinar_translate_zipCode;
141 $gotowebinar_translate_country = esc_html(stripslashes($_POST['gotowebinar_translate_country']));
142 $options['gotowebinar_translate_country'] = $gotowebinar_translate_country;
143 $gotowebinar_translate_phone = esc_html(stripslashes($_POST['gotowebinar_translate_phone']));
144 $options['gotowebinar_translate_phone'] = $gotowebinar_translate_phone;
145 $gotowebinar_translate_organization = esc_html(stripslashes($_POST['gotowebinar_translate_organization']));
146 $options['gotowebinar_translate_organization'] = $gotowebinar_translate_organization;
147 $gotowebinar_translate_jobTitle = esc_html(stripslashes($_POST['gotowebinar_translate_jobTitle']));
148 $options['gotowebinar_translate_jobTitle'] = $gotowebinar_translate_jobTitle;
149 $gotowebinar_translate_questionsAndComments = esc_html(stripslashes($_POST['gotowebinar_translate_questionsAndComments']));
150 $options['gotowebinar_translate_questionsAndComments'] = $gotowebinar_translate_questionsAndComments;
151 $gotowebinar_translate_industry = esc_html(stripslashes($_POST['gotowebinar_translate_industry']));
152 $options['gotowebinar_translate_industry'] = $gotowebinar_translate_industry;
153 $gotowebinar_translate_numberOfEmployees = esc_html(stripslashes($_POST['gotowebinar_translate_numberOfEmployees']));
154 $options['gotowebinar_translate_numberOfEmployees'] = $gotowebinar_translate_numberOfEmployees;
155 $gotowebinar_translate_purchasingTimeFrame = esc_html(stripslashes($_POST['gotowebinar_translate_purchasingTimeFrame']));
156 $options['gotowebinar_translate_purchasingTimeFrame'] = $gotowebinar_translate_purchasingTimeFrame;
157 $gotowebinar_translate_purchasingRole = esc_html(stripslashes($_POST['gotowebinar_translate_purchasingRole']));
158 $options['gotowebinar_translate_purchasingRole'] = $gotowebinar_translate_purchasingRole;
159 $gotowebinar_translate_submitButton = esc_html(stripslashes($_POST['gotowebinar_translate_submitButton']));
160 $options['gotowebinar_translate_submitButton'] = $gotowebinar_translate_submitButton;
161 $gotowebinar_translate_successMessage = esc_html(stripslashes($_POST['gotowebinar_translate_successMessage']));
162 $options['gotowebinar_translate_successMessage'] = $gotowebinar_translate_successMessage;
163 $gotowebinar_translate_alreadyRegisteredMessage = esc_html(stripslashes($_POST['gotowebinar_translate_alreadyRegisteredMessage']));
164 $options['gotowebinar_translate_alreadyRegisteredMessage'] = $gotowebinar_translate_alreadyRegisteredMessage;
165 $gotowebinar_translate_errorMessage = esc_html(stripslashes($_POST['gotowebinar_translate_errorMessage']));
166 $options['gotowebinar_translate_errorMessage'] = $gotowebinar_translate_errorMessage;
167 $gotowebinar_translate_attendeeLimit = esc_html(stripslashes($_POST['gotowebinar_translate_attendeeLimit']));
168 $options['gotowebinar_translate_attendeeLimit'] = $gotowebinar_translate_attendeeLimit;
169
170
171 //pro options
172 $gotowebinar_mailchimp_api = esc_html($_POST['gotowebinar_mailchimp_api']);
173 $options['gotowebinar_mailchimp_api'] = $gotowebinar_mailchimp_api;
174 $gotowebinar_mailchimp_default_list = esc_html($_POST['gotowebinar_mailchimp_default_list']);
175 $options['gotowebinar_mailchimp_default_list'] = $gotowebinar_mailchimp_default_list;
176 $gotowebinar_email_service = esc_html($_POST['gotowebinar_email_service']);
177 $options['gotowebinar_email_service'] = $gotowebinar_email_service;
178 $gotowebinar_emailservice_opt_in = esc_html(isset($_POST['gotowebinar_emailservice_opt_in']));
179 $options['gotowebinar_emailservice_opt_in'] = $gotowebinar_emailservice_opt_in;
180 $gotowebinar_constantcontact_token = esc_html($_POST['gotowebinar_constantcontact_token']);
181 $options['gotowebinar_constantcontact_token'] = $gotowebinar_constantcontact_token;
182 $gotowebinar_constantcontact_default_list = esc_html($_POST['gotowebinar_constantcontact_default_list']);
183 $options['gotowebinar_constantcontact_default_list'] = $gotowebinar_constantcontact_default_list;
184 $gotowebinar_mailchimp_subscribe_if = esc_html($_POST['gotowebinar_mailchimp_subscribe_if']);
185 $options['gotowebinar_mailchimp_subscribe_if'] = $gotowebinar_mailchimp_subscribe_if;
186
187
188 $gotowebinar_activecampaign_api = esc_html($_POST['gotowebinar_activecampaign_api']);
189 $options['gotowebinar_activecampaign_api'] = $gotowebinar_activecampaign_api;
190
191 $gotowebinar_activecampaign_account = esc_html($_POST['gotowebinar_activecampaign_account']);
192 $options['gotowebinar_activecampaign_account'] = $gotowebinar_activecampaign_account;
193
194
195 $gotowebinar_activecampaign_default_list = esc_html($_POST['gotowebinar_activecampaign_default_list']);
196 $options['gotowebinar_activecampaign_default_list'] = $gotowebinar_activecampaign_default_list;
197
198
199
200 //dismiss admin welcome note
201 $gotowebinar_welcome_message = esc_html(isset($_POST['gotowebinar_welcome_message']));
202 $options['gotowebinar_welcome_message'] = $gotowebinar_welcome_message;
203 $gotowebinar_recaptcha_site_key = esc_html($_POST['gotowebinar_recaptcha_site_key']);
204 $options['gotowebinar_recaptcha_site_key'] = $gotowebinar_recaptcha_site_key;
205 $gotowebinar_translate_cancelledWebinar = esc_html($_POST['gotowebinar_translate_cancelledWebinar']);
206 $options['gotowebinar_translate_cancelledWebinar'] = $gotowebinar_translate_cancelledWebinar;
207 $gotowebinar_disable_autodrafting = esc_html(isset($_POST['gotowebinar_disable_autodrafting']));
208 $options['gotowebinar_disable_autodrafting'] = $gotowebinar_disable_autodrafting;
209 update_option('gotowebinar_settings', $options);
210
211 }
212 }
213
214
215 $options = get_option('gotowebinar_settings');
216 if($options != ''){
217 $gotowebinar_authorization = $options['gotowebinar_authorization'];
218 $gotowebinar_organizer_key = $options['gotowebinar_organizer_key'];
219 $gotowebinar_date_format = $options['gotowebinar_date_format'];
220 $gotowebinar_time_format = $options['gotowebinar_time_format'];
221 $gotowebinar_disable_tooltip = $options['gotowebinar_disable_tooltip'];
222 $gotowebinar_tooltip_text_color = $options['gotowebinar_tooltip_text_color'];
223 $gotowebinar_tooltip_background_color = $options['gotowebinar_tooltip_background_color'];
224 $gotowebinar_tooltip_border_color = $options['gotowebinar_tooltip_border_color'];
225 $gotowebinar_icon_color = $options['gotowebinar_icon_color'];
226 $gotowebinar_custom_registration_page = $options['gotowebinar_custom_registration_page'];
227 $gotowebinar_custom_thankyou_page = $options['gotowebinar_custom_thankyou_page'];
228 $gotowebinar_button_text_color = $options['gotowebinar_button_text_color'];
229 $gotowebinar_button_background_color = $options['gotowebinar_button_background_color'];
230 $gotowebinar_button_border_color = $options['gotowebinar_button_border_color'];
231 $gotowebinar_disable_cache = $options['gotowebinar_disable_cache'];
232 $gotowebinar_enable_timezone_conversion = $options['gotowebinar_enable_timezone_conversion'];
233 $gotowebinar_timezone_error_message = $options['gotowebinar_timezone_error_message'];
234 $gotowebinar_translate_firstName = $options['gotowebinar_translate_firstName'];
235 $gotowebinar_translate_lastName = $options['gotowebinar_translate_lastName'];
236 $gotowebinar_translate_email = $options['gotowebinar_translate_email'];
237 $gotowebinar_translate_address = $options['gotowebinar_translate_address'];
238 $gotowebinar_translate_city = $options['gotowebinar_translate_city'];
239 $gotowebinar_translate_state = $options['gotowebinar_translate_state'];
240 $gotowebinar_translate_zipCode = $options['gotowebinar_translate_zipCode'];
241 $gotowebinar_translate_country = $options['gotowebinar_translate_country'];
242 $gotowebinar_translate_phone = $options['gotowebinar_translate_phone'];
243 $gotowebinar_translate_organization = $options['gotowebinar_translate_organization'];
244 $gotowebinar_translate_jobTitle = $options['gotowebinar_translate_jobTitle'];
245 $gotowebinar_translate_questionsAndComments = $options['gotowebinar_translate_questionsAndComments'];
246 $gotowebinar_translate_industry = $options['gotowebinar_translate_industry'];
247 $gotowebinar_translate_numberOfEmployees = $options['gotowebinar_translate_numberOfEmployees'];
248 $gotowebinar_translate_purchasingTimeFrame = $options['gotowebinar_translate_purchasingTimeFrame'];
249 $gotowebinar_translate_purchasingRole = $options['gotowebinar_translate_purchasingRole'];
250 $gotowebinar_translate_submitButton = $options['gotowebinar_translate_submitButton'];
251 $gotowebinar_translate_successMessage = $options['gotowebinar_translate_successMessage'];
252 $gotowebinar_translate_alreadyRegisteredMessage = $options['gotowebinar_translate_alreadyRegisteredMessage'];
253 $gotowebinar_translate_errorMessage = $options['gotowebinar_translate_errorMessage'];
254 $gotowebinar_mailchimp_api = $options['gotowebinar_mailchimp_api'];
255 $gotowebinar_mailchimp_default_list = $options['gotowebinar_mailchimp_default_list'];
256 $gotowebinar_email_service = $options['gotowebinar_email_service'];
257 $gotowebinar_emailservice_opt_in = $options['gotowebinar_emailservice_opt_in'];
258 $gotowebinar_constantcontact_token = $options['gotowebinar_constantcontact_token'];
259 $gotowebinar_constantcontact_default_list = $options['gotowebinar_constantcontact_default_list'];
260 $gotowebinar_mailchimp_subscribe_if = $options['gotowebinar_mailchimp_subscribe_if'];
261 $gotowebinar_welcome_message = $options['gotowebinar_welcome_message'];
262 $gotowebinar_translate_cancelledWebinar = $options['gotowebinar_translate_cancelledWebinar'];
263 $gotowebinar_recaptcha_site_key = $options['gotowebinar_recaptcha_site_key'];
264 $gotowebinar_disable_autodrafting = $options['gotowebinar_disable_autodrafting'];
265 $gotowebinar_translate_attendeeLimit = $options['gotowebinar_translate_attendeeLimit'];
266 $gotowebinar_activecampaign_api = $options['gotowebinar_activecampaign_api'];
267 $gotowebinar_activecampaign_default_list = $options['gotowebinar_activecampaign_default_list'];
268 $gotowebinar_activecampaign_account = $options['gotowebinar_activecampaign_account'];
269
270
271
272 }
273 require('inc/options-page-wrapper.php');
274 }
275
276
277 //get translations from plugin folder
278 add_action('plugins_loaded', 'wp_gotowebinar_translations');
279 function wp_gotowebinar_translations() {
280 load_plugin_textdomain( 'wp-gotowebinar', false, dirname( plugin_basename(__FILE__) ) . '/inc/lang/' );
281 }
282
283
284 //common function to get upcoming webinars
285 function wp_gotowebinar_upcoming_webinars($transientName, $transientDuration){
286 //get options
287 $options = get_option('gotowebinar_settings');
288 //get transient
289 $getTransient = get_transient($transientName);
290 //if transient doesn't exist or caching disabled do this
291 if ($getTransient != false && $options['gotowebinar_disable_cache'] == 0){
292 $jsondata = $getTransient;
293 $json_response = 200;
294 return array($jsondata,$json_response);
295 } //otherwise do this
296 else {
297 $json_feed = wp_remote_get( 'https://api.getgo.com/G2W/rest/organizers/'.$options['gotowebinar_organizer_key'].'/upcomingWebinars', array(
298 'headers' => array(
299 'Authorization' => $options['gotowebinar_authorization'],
300 ),));
301 //store the data and response in a variable
302 $jsondata = json_decode(preg_replace('/("\w+"):(\d+(\.\d+)?)/', '\\1:"\\2"', wp_remote_retrieve_body( $json_feed )), true);
303 $json_response = wp_remote_retrieve_response_code($json_feed);
304 //if response is successful set the transient
305 if($json_response == 200){
306 set_transient($transientName,$jsondata, 86400);
307 }
308 //return the data and response
309 return array($jsondata,$json_response);
310 } //end else
311 } //end function
312
313
314
315
316
317 // Add shortcode
318 if(file_exists(get_stylesheet_directory().'/wp-gotowebinar/shortcode.php')) {
319 require(get_stylesheet_directory().'/wp-gotowebinar/shortcode.php');
320 } else {
321 require('inc/shortcode.php');
322 }
323
324 // Add registration shortcode
325 if(file_exists(get_stylesheet_directory().'/wp-gotowebinar/shortcode-registration.php')) {
326 require(get_stylesheet_directory().'/wp-gotowebinar/shortcode-registration.php');
327 } else {
328 require('inc/shortcode-registration.php');
329 }
330
331 // Add widget
332 require('inc/widget.php');
333
334
335 // Load front end style and scripts
336 function wp_gotowebinar_register_frontend()
337 {
338 $options = get_option('gotowebinar_settings');
339 wp_register_style( 'font-awesome-icons', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' );
340 wp_register_style( 'custom-style', plugins_url( '/inc/style.css', __FILE__ ));
341 wp_register_script( 'moment', 'https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.15.1/moment.min.js', array( 'jquery' ));
342 wp_register_script( 'moment-timezone', 'https://cdnjs.cloudflare.com/ajax/libs/moment-timezone/0.5.5/moment-timezone-with-data.min.js', array( 'jquery' ));
343 wp_register_script( 'google-recaptcha', 'https://www.google.com/recaptcha/api.js');
344 wp_enqueue_script('jquery-ui', plugins_url('/inc/external/jquery-ui.min.js', __FILE__ ), array( 'jquery'), '1.12.1');
345 wp_register_script( 'custom-script', plugins_url( '/inc/script.js', __FILE__ ), array( 'jquery' ),1.0,true);
346 wp_localize_script( 'custom-script', 'mailchimp_subscribe', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
347 wp_localize_script( 'custom-script', 'constantcontact_subscribe', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
348 wp_localize_script( 'custom-script', 'activecampaign_subscribe', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
349 wp_localize_script( 'custom-script', 'registration_form_submit', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
350 wp_enqueue_script( array('moment','moment-timezone','custom-script','google-recaptcha'));
351 wp_enqueue_style( array('font-awesome-icons','custom-style') );
352 if($options['gotowebinar_button_background_color'] == "#ffffff"){
353 $spinnerColor = $options['gotowebinar_button_text_color'];
354 } else {
355 $spinnerColor = $options['gotowebinar_button_background_color'];
356 }
357 $colour_options = "
358 .tooltip {
359 background-color: {$options['gotowebinar_tooltip_background_color']};
360 color: {$options['gotowebinar_tooltip_text_color']};
361 border-color: {$options['gotowebinar_tooltip_border_color']};
362 }
363 .webinar-registration input[type=\"submit\"] {
364 background-color: {$options['gotowebinar_button_background_color']};
365 color: {$options['gotowebinar_button_text_color']};
366 border-color: {$options['gotowebinar_button_border_color']};
367 }
368 .webinar-registration .fa-spinner {
369 color: {$spinnerColor};
370 }
371 .upcoming-webinars fa, .upcoming-webinars a, .upcoming-webinars-widget fa, .upcoming-webinars-widget a, .webinar-registration a {
372 color: {$options['gotowebinar_icon_color']};
373 }
374 ";
375 wp_add_inline_style( 'custom-style', $colour_options );
376 }
377 add_action( 'wp_enqueue_scripts', 'wp_gotowebinar_register_frontend' );
378
379
380
381 // Load admin style and scripts
382 function wp_gotowebinar_register_admin($hook)
383 {
384 wp_enqueue_style( 'visual-composer-style', plugins_url( '/inc/vc-adminstyle.css', __FILE__ ));
385 global $gotowebinar_wp_settings_page;
386
387 global $post;
388 if ( $hook == 'post-new.php' || $hook == 'post.php' ) {
389 if ( 'product' === $post->post_type ) {
390 wp_enqueue_script( 'custom-admin-script-pro', plugins_url( '/inc/pro/adminscriptpro.js', __FILE__ ), array( 'jquery'));
391 }
392 }
393
394 if($hook != $gotowebinar_wp_settings_page)
395 return;
396
397 wp_enqueue_script('time-picker', 'https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js', array('jquery'));
398 wp_enqueue_style( 'wp-color-picker' );
399 wp_enqueue_script( 'custom-admin-script', plugins_url( '/inc/adminscript.js', __FILE__ ), array( 'jquery','wp-color-picker' ));
400 wp_enqueue_script('jquery-ui', plugins_url('/inc/external/jquery-ui.min.js', __FILE__ ), array( 'jquery'), '1.12.1');
401 wp_enqueue_script('jquery-effects-shake');
402 wp_enqueue_style( 'custom-admin-style', plugins_url( '/inc/adminstyle.css', __FILE__ ));
403 wp_register_style( 'font-awesome-icons', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' );
404 wp_register_style( 'time-picker-style', 'https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.css' );
405 wp_enqueue_style( array('font-awesome-icons','time-picker-style') );
406 }
407 add_action( 'admin_enqueue_scripts', 'wp_gotowebinar_register_admin' );
408
409
410 // Include pro functions
411 if ($gotowebinar_is_pro == "YES"){
412 include('inc/pro/pro.php');
413 }
414 //clear cache and deactivation tasks
415 require('inc/clear-cache.php');
416 // add visual composer functionality
417 require('inc/visual-composer.php');
418 // add registration function
419 require('inc/registration.php');
420
421
422
423
424
425
426
427
428
429
430 //function to save dismiss welcome notice
431
432 function wp_gotowebinar_disable_welcome_message_callback() {
433
434 $gotowebinar_options = get_option('gotowebinar_settings');
435 $gotowebinar_options['gotowebinar_welcome_message'] = 1;
436
437 update_option('gotowebinar_settings', $gotowebinar_options);
438 wp_die();
439
440 }
441 add_action( 'wp_ajax_disable_welcome_message', 'wp_gotowebinar_disable_welcome_message_callback' );
442
443
444 ?>