PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.8.7
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.8.7
2.9.1 2.9.0 2.8.9 2.8.8 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7
mystickymenu / mystickymenu.php
mystickymenu Last commit date
admin 7 months ago css 7 months ago fonts 4 years ago images 1 year ago js 7 months ago languages 3 months ago class-email-signup.php 7 months ago class-help.php 7 months ago class-review-box.php 7 months ago class-upgrade-box.php 9 months ago index.php 8 years ago mystickymenu-admin-widgetanalytics.php 7 months ago mystickymenu-contact-leads.php 1 year ago mystickymenu-deactivate-form.php 1 year ago mystickymenu-fonts.php 2 years ago mystickymenu-popup.php 1 year ago mystickymenu-review-popup.php 9 months ago mystickymenu.php 3 months ago mystickymeny-new-welcomebar.php 7 months ago readme.txt 2 months ago recommended-plugins.php 7 months ago stickymenu-dashboard.php 9 months ago uninstall.php 2 years ago upgrade-to-pro.php 1 year ago welcome-bar.php 7 months ago
mystickymenu.php
2581 lines
1 <?php
2 /*
3 Plugin Name: My Sticky Bar
4 Plugin URI: https://premio.io/
5 Description: Create a notification bar for your website with My Sticky Bar. You can customize the design, collect leads, and enjoy other advanced features. You can also make your menu sticky using My Sticky Bar.
6 Version: 2.8.7
7 Author: Premio
8 Author URI: https://premio.io/downloads/mystickymenu/
9 Text Domain: mystickymenu
10 Domain Path: /languages
11 License: GPLv3
12 */
13
14 defined('ABSPATH') or die("Cannot access pages directly.");
15 define('MYSTICKY_VERSION', '2.8.7');
16 define('MYSTICKYMENU_URL', plugins_url('/', __FILE__)); // Define Plugin URL
17 define('MYSTICKYMENU_PATH', plugin_dir_path(__FILE__)); // Define Plugin Directory Path
18 define('MYSTICKYMENU_BASE', plugin_basename(__FILE__));
19
20 if ( ! defined( 'MSM_DEV_MODE' ) ) {
21 define( 'MSM_DEV_MODE', false );
22 }
23
24
25 require_once("mystickymenu-fonts.php");
26 require_once("welcome-bar.php");
27
28 if( is_admin() ) {
29 //include_once 'class-review-box.php';
30 include_once 'class-upgrade-box.php';
31 include_once 'class-email-signup.php';
32 include_once 'class-help.php';
33
34 }
35
36 class MyStickyMenuBackend
37 {
38 private $options;
39
40 public function __construct()
41 {
42 add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
43 add_action( 'admin_init', array( $this, 'mysticky_load_transl') );
44 add_action( 'admin_init', array( $this, 'mysticky_default_options' ) );
45 add_action( 'admin_head', array( $this, 'mystickymenu_admin_head' ) );
46 add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_admin_script' ) );
47 add_filter( 'plugin_action_links_'.MYSTICKYMENU_BASE, array( $this, 'mystickymenu_settings_link' ) );
48 add_action( 'activated_plugin', array( $this, 'mystickymenu_activation_redirect' ) );
49 add_action( "wp_ajax_mystickymenu_update_popup_status", array($this, 'mystickymenu_popup_status'));
50 add_action( 'admin_footer', array( $this, 'mystickymenu_deactivate' ) );
51 add_action( 'wp_ajax_mystickymenu_plugin_deactivate', array( $this, 'mystickymenu_plugin_deactivate' ) );
52 add_action( 'wp_ajax_stickymenu_widget_delete', array( $this, 'stickymenu_widget_delete' ) );
53 add_action( 'wp_ajax_mystickymenu_widget_status', array( $this, 'mystickymenu_widget_status' ) );
54 add_action( 'wp_ajax_stickymenu_status_update', array( $this, 'stickymenu_status_update' ) );
55 add_action( 'wp_ajax_mystickymenu_delete_contact_lead', array( $this, 'mystickymenu_delete_contact_lead' ) );
56 add_action( 'wp_ajax_my_sticky_menu_bulks', array( $this, 'my_sticky_menu_bulks' ) );
57
58 add_action( 'wp_ajax_mystickymenu_admin_send_message_to_owner', array( $this, 'mystickymenu_admin_send_message_to_owner' ) );
59
60 add_action( 'wp_ajax_mystickymenu_review_box', [$this, "mystickymenu_review_box"]);
61 add_action( 'wp_ajax_mystickymenu_review_box_message', [$this, "mystickymenu_review_box_message"]);
62 add_action( 'admin_init' , [$this, 'check_for_redirection']);
63
64 }
65
66
67
68
69 public function stickymenu_status_update(){
70 if (!current_user_can('manage_options')) {
71 wp_die(0);
72 }
73 check_ajax_referer( 'mystickymenu', 'wpnonce' );
74 $mysticky_options = get_option( 'mysticky_option_name' );
75 if( isset($_POST['stickymenu_status']) && $_POST['stickymenu_status'] != '' ){
76
77 $stickymenu_status = $_POST['stickymenu_status'];
78 $mysticky_options['stickymenu_enable'] = $stickymenu_status;
79 update_option('mysticky_option_name',$mysticky_options);
80 }
81 wp_die();
82 }
83
84 public function mystickymenu_popup_status() {
85 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mystickymenu_update_popup_status')) {
86 update_option("mystickymenu_intro_box", "hide");
87 }
88 echo esc_attr("1");
89 die;
90 }
91
92 public function mystickymenu_widget_status() {
93 if (!current_user_can('manage_options')) {
94 wp_die(0);
95 }
96 check_ajax_referer( 'mystickymenu', 'wpnonce' );
97
98 if ( isset($_POST['widget_id']) && $_POST['widget_id'] != '' && isset($_POST['widget_status']) && $_POST['widget_status'] != '' ) {
99 $welcomebars_widgets = get_option( 'mystickymenu-welcomebars' );
100 $widget_id = $_POST['widget_id'];
101 $welcomebars_widget_no = '-' . $widget_id ;
102
103 if( $widget_id == 0 || $welcomebars_widgets[$widget_id] == 'default' ){
104 $stickymenu_widget = get_option('mysticky_option_welcomebar');
105 $welcomebars_widget_no = '';
106 }
107 $widget_status = $_POST['widget_status'];
108 $stickymenu_widget['mysticky_welcomebar_enable'] = $widget_status;
109
110 update_option( 'mysticky_option_welcomebar',$stickymenu_widget);
111 }
112 wp_die();
113 }
114
115 public function stickymenu_widget_delete(){
116 if (!current_user_can('manage_options')) {
117 wp_die(0);
118 }
119 check_ajax_referer( 'mystickymenu', 'wpnonce' );
120 if ( isset($_POST['widget_id']) && $_POST['widget_id'] != '' && isset($_POST['widget_delete']) && $_POST['widget_delete'] == 1 ) {
121 $welcomebars_widgets = get_option( 'mystickymenu-welcomebars' );
122 $widget_id = $_POST['widget_id'];
123 foreach( $welcomebars_widgets as $key => $widget_value ){
124 $element_widget_no = '';
125 if ( $key != 0 ) {
126 $element_widget_no = '-' . $key;
127 }
128 delete_option( 'mysticky_option_welcomebar' . $element_widget_no );
129 }
130
131 delete_option( 'mystickymenu-welcomebars' );
132 }
133 wp_die();
134 }
135
136
137
138
139 public function mystickymenu_delete_contact_lead(){
140 global $wpdb;
141 if ( ! current_user_can( 'manage_options' ) ) {
142 wp_die(0);
143 }
144 check_ajax_referer( 'mystickymenu', 'wpnonce' );
145
146 if ( isset($_POST['ID']) && $_POST['ID'] != '' ) {
147 $ID = sanitize_text_field($_POST['ID']);
148 $table = $wpdb->prefix . 'mystickymenu_contact_lists';
149 $delete_sql = $wpdb->prepare("DELETE FROM {$table} WHERE id = %d",$ID);
150 $delete = $wpdb->query($delete_sql);
151 }
152
153 if ( isset($_POST['all_leads']) && $_POST['all_leads'] == 1 ) {
154 $table = $wpdb->prefix . 'mystickymenu_contact_lists';
155 $delete = $wpdb->query("TRUNCATE TABLE $table");
156 }
157 wp_die();
158
159 }
160
161
162 public function my_sticky_menu_bulks(){
163 global $wpdb;
164 if (!current_user_can('manage_options')) {
165 wp_die(0);
166 }
167 check_ajax_referer( 'mystickymenu', 'wpnonce' );
168 if( isset($_POST['wpnonce']) ){
169 $bulks = isset($_POST['bulks']) ? $_POST['bulks'] : array();
170 foreach( $bulks as $key => $bulk ){
171 $ID = sanitize_text_field($bulk);
172 $table = $wpdb->prefix . 'mystickymenu_contact_lists';
173 $delete_sql = $wpdb->prepare("DELETE FROM {$table} WHERE id = %d",$ID);
174 $delete = $wpdb->query($delete_sql);
175 }
176 }
177 wp_die();
178 }
179
180 public function mystickymenu_admin_send_message_to_owner() {
181 if (!current_user_can('manage_options')) {
182 wp_die(0);
183 }
184 $response = array();
185 $response['status'] = 0;
186 $response['error'] = 0;
187 $response['errors'] = array();
188 $response['message'] = "";
189 $errorArray = [];
190 $errorMessage = __("%1\$s is required", "mystickymenu");
191 $postData = $_POST;
192 if(!isset($postData['textarea_text']) || trim($postData['textarea_text']) == "") {
193 $error = array(
194 "key" => "textarea_text",
195 "message" => __("Please enter your message","mystickymenu")
196 );
197 $errorArray[] = $error;
198 }
199 if(!isset($postData['user_email']) || trim($postData['user_email']) == "") {
200 $error = array(
201 "key" => "user_email",
202 "message" => sprintf($errorMessage,__("Email","mystickymenu"))
203 );
204 $errorArray[] = $error;
205 } else if(!filter_var($postData['user_email'], FILTER_VALIDATE_EMAIL)) {
206 $error = array(
207 'key' => "user_email",
208 "message" => "Email is not valid"
209 );
210 $errorArray[] = $error;
211 }
212 if(empty($errorArray)) {
213 if(!isset($_REQUEST['nonce']) || empty($_REQUEST['nonce'])) {
214 $error = array(
215 'key' => "nonce",
216 "message" => "Your request is not valid"
217 );
218 $errorArray[] = $error;
219 } else if(!wp_verify_nonce($_REQUEST['nonce'], "mystickymenu_send_message_to_owner")) {
220 $error = array(
221 'key' => "nonce",
222 "message" => "Your request is not valid"
223 );
224 $errorArray[] = $error;
225 }
226 }
227 if(empty($errorArray)) {
228 global $current_user;
229 $text_message = $postData['textarea_text'];
230 $email = $postData['user_email'];
231 $domain = site_url();
232 $user_name = $current_user->first_name." ".$current_user->last_name;
233
234 $response['status'] = 1;
235
236 /* sending message to Crisp */
237 $post_message = array();
238
239 $message_data = array();
240 $message_data['key'] = "Plugin";
241 $message_data['value'] = "My Sticky Bar";
242 $post_message[] = $message_data;
243
244 $message_data = array();
245 $message_data['key'] = "Domain";
246 $message_data['value'] = $domain;
247 $post_message[] = $message_data;
248
249 $message_data = array();
250 $message_data['key'] = "Email";
251 $message_data['value'] = $email;
252 $post_message[] = $message_data;
253
254 $message_data = array();
255 $message_data['key'] = "Message";
256 $message_data['value'] = $text_message;
257 $post_message[] = $message_data;
258
259 $api_params = array(
260 'domain' => $domain,
261 'email' => $email,
262 'url' => site_url(),
263 'name' => $user_name,
264 'message' => $post_message,
265 'plugin' => "My Sticky Bar",
266 'type' => "Need Help",
267 );
268
269 /* Sending message to Crisp API */
270
271 $crisp_response = wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => true));
272
273 if (is_wp_error($crisp_response)) {
274 wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
275 }
276 } else {
277 $response['error'] = 1;
278 $response['errors'] = $errorArray;
279 }
280 wp_send_json($response);
281 wp_die();
282 }
283
284
285 public function mystickymenu_settings_link($links){
286 $settings_link = '<a href="admin.php?page=my-stickymenu-welcomebar">Settings</a>';
287
288 $links['need_help'] = '<a href="https://wordpress.org/support/plugin/mystickymenu/" target="_blank">'.__( 'Need help?', 'mystickymenu' ).'</a>';
289
290 $links['go_pro'] = '<a href="'. admin_url("admin.php?page=my-stickymenu-upgrade&type=upgrade").'" style="color: #FF5983; font-weight: bold; display: inline-block; border: solid 1px #FF5983; border-radius: 4px; padding: 0 5px;">'.__( 'Upgrade', 'mystickymenu' ).'</a>';
291 array_unshift($links, $settings_link);
292 return $links;
293 }
294
295 public function mystickymenu_activation_redirect( $plugin) {
296 if( $plugin == plugin_basename( __FILE__ ) ) {
297
298 $option = get_option("mystickymenu_intro_box");
299 if($option === false) {
300 add_option("mystickymenu_intro_box", "show");
301 }
302 if(!defined( 'DOING_AJAX' )) {
303 add_option("msm_redirection", 1);
304 }
305 }
306 }
307
308 public function check_for_redirection()
309 {
310 if(!defined( 'DOING_AJAX' )) {
311 $status = get_option("msm_redirection");
312 if($status) {
313 delete_option("msm_redirection");
314 $welcomebar_widgets = get_option("mysticky_option_welcomebar");
315 if ($welcomebar_widgets) {
316 wp_redirect(admin_url('admin.php?page=my-stickymenu-welcomebar'));
317 } else {
318 wp_redirect(admin_url('admin.php?page=my-stickymenu-welcomebar&widget=0'));
319 }
320 exit;
321 }
322 $page = isset($_GET['page']) ? sanitize_text_field($_GET['page']) : '';
323 if($page == 'my-sticky-menu-leads'){
324 $total_leads = $this->total_my_sticky_bar_contact_list(); // Total number of my sticky bar contact form leads
325 $contact_form_channel_active = $this->is_welcomebar_contact_form_enabled(); // True if contact form is enabled, false otherwise
326 if($total_leads == 0 && !$contact_form_channel_active){
327 wp_redirect(admin_url('admin.php?page=my-stickymenu-welcomebar'));
328 exit;
329 }
330 }
331
332 }
333 }
334
335 public function mysticky_admin_script($hook) {
336
337 if ( !isset($_GET['page']) || ( isset($_GET['page']) && $_GET['page'] != 'my-stickymenu-settings' && $_GET['page'] != 'my-stickymenu-welcomebar' && $_GET['page'] != 'my-stickymenu-new-welcomebar' && $_GET['page'] != 'my-sticky-menu-analytics' && $_GET['page'] != 'my-stickymenu-upgrade' && $_GET['page'] != 'msm-recommended-plugins' && $_GET['page'] != 'my-sticky-menu-leads' )) {
338 return;
339 }
340
341 $suffix = MSM_DEV_MODE ? '' : '.min';
342 $rtl_suffix = is_rtl() ? '-rtl' : '';
343
344 wp_enqueue_style(
345 'mystickymenuAdminStyle',
346 plugins_url("/css/mystickymenu-admin{$rtl_suffix}{$suffix}.css", __FILE__),
347 array(),
348 MYSTICKY_VERSION
349 );
350 wp_enqueue_style(
351 'mystickybar-style',
352 plugins_url("/css/mystickybar-admin{$rtl_suffix}{$suffix}.css", __FILE__),
353 array(),
354 MYSTICKY_VERSION
355 );
356
357 wp_enqueue_style(
358 'mystickymenuHelpStyle',
359 plugins_url("/css/mystickymenu-help{$rtl_suffix}{$suffix}.css", __FILE__),
360 array(),
361 MYSTICKY_VERSION
362 );
363 wp_enqueue_style( 'wp-color-picker' );
364 wp_enqueue_style( 'wp-jquery-ui-dialog' );
365 wp_enqueue_style('jquery-ui');
366
367 wp_enqueue_script('jquery-ui');
368 wp_enqueue_script('jquery-ui-slider');
369 wp_enqueue_script( 'jquery-ui-dialog' );
370
371 if ( isset($_GET['page']) && $_GET['page'] == 'my-stickymenu-upgrade' ) {
372 wp_enqueue_script( 'my-select2', plugins_url('js/select2.min.js', __FILE__ ), array( 'wp-color-picker' ), MYSTICKY_VERSION, ['strategy' => 'defer', 'in_footer'=> true ] );
373 wp_enqueue_style('my-css-select2', plugins_url('css/select2.min.css', __FILE__), array(), MYSTICKY_VERSION );
374
375 wp_enqueue_style('stickymenu-pricing-table', plugins_url("/css/pricing-table{$suffix}.css", __FILE__), [], MYSTICKY_VERSION);
376 $queryArgs = [
377 'family' => 'Poppins:wght@400;500;600;700&display=swap',
378 'subset' => 'latin,latin-ext',
379 ];
380 wp_enqueue_style('google-poppins-fonts', add_query_arg($queryArgs, "//fonts.googleapis.com/css2"), [], MYSTICKY_VERSION);
381
382 wp_enqueue_script('stickymenu-slick', plugins_url('/js/slick.min.js', __FILE__), ['jquery'], MYSTICKY_VERSION, ['strategy' => 'defer', 'in_footer'=> true ]);
383 }
384
385 wp_enqueue_style("mystickyelements-star-rating-svg-css", plugins_url("/css/star-rating-svg{$suffix}.css", __FILE__), [], MYSTICKY_VERSION );
386 wp_enqueue_script("mystickyelements-star-rating-svg-js", plugins_url('js/jquery.star-rating-svg.min.js', __FILE__), ['jquery'], MYSTICKY_VERSION, ['strategy' => 'defer', 'in_footer'=> true ]);
387
388 wp_enqueue_script(
389 'morphext-js',
390 plugins_url("/js/morphext/morphext{$suffix}.js", __FILE__),
391 array('jquery'),
392 MYSTICKY_VERSION,
393 ['strategy' => 'defer', 'in_footer'=> true ]
394 );
395
396 wp_enqueue_script( 'mailcheck-js', plugins_url("/js/mailcheck{$suffix}.js", __FILE__), ['jquery'], MYSTICKY_VERSION, true);
397 wp_enqueue_script('autocomplete-email-js', plugins_url("/js/jquery.email-autocomplete{$suffix}.js", __FILE__), ['jquery'], MYSTICKY_VERSION, true);
398 wp_enqueue_script('mystickymenuAdminScript', plugins_url("/js/mystickymenu-admin{$suffix}.js", __FILE__), array( 'jquery', 'jquery-ui-slider', 'wp-color-picker' ), MYSTICKY_VERSION,['strategy' => 'defer', 'in_footer'=> true ]);
399
400 $locale_settings = array(
401 'ajaxurl' => admin_url('admin-ajax.php'),
402 'mystickymenu_url' => MYSTICKYMENU_URL,
403 'ajax_nonce' => wp_create_nonce('mystickymenu'),
404 );
405
406 wp_localize_script('mystickymenuAdminScript', 'mystickymenu', $locale_settings);
407
408 }
409
410 public function mysticky_load_transl(){
411 load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
412 }
413
414 function sanitize_options($value) {
415 $value = stripslashes($value);
416 $value = filter_var($value, FILTER_SANITIZE_STRING);
417 return $value;
418 }
419
420
421 public function add_plugin_page(){
422 if ( isset($_GET['hide_msmrecommended_plugin']) && $_GET['hide_msmrecommended_plugin'] == 1) {
423 update_option('hide_msmrecommended_plugin',true);
424 }
425
426 $mysticky_option_welcomebar = get_option('mysticky_option_welcomebar');
427
428
429 $total_leads = $this->total_my_sticky_bar_contact_list(); // Total number of my sticky bar contact form leads
430 $contact_form_channel_active = $this->is_welcomebar_contact_form_enabled(); // True if contact form is enabled, false otherwise
431 $hide_msmrecommended_plugin = get_option('hide_msmrecommended_plugin');
432 // echo "<pre>";
433 // // print_r($total_leads);
434 // print_r($contact_form_channel_active);
435 // echo "</pre>";
436 // exit;
437 // This page will be under "Settings"
438 add_menu_page(
439 'Settings Admin',
440 'My Sticky Bar',
441 'manage_options',
442 'my-stickymenu-welcomebar',
443 array( $this, 'mystickystickymenu_admin_welcomebar_page' )
444 );
445 if(!empty($mysticky_option_welcomebar)) {
446 add_submenu_page(
447 'my-stickymenu-welcomebar',
448 'Settings Admin',
449 'Dashboard',
450 'manage_options',
451 'my-stickymenu-welcomebar',
452 array( $this, 'mystickystickymenu_admin_welcomebar_page' )
453 );
454 }
455 add_submenu_page(
456 'my-stickymenu-welcomebar',
457 'Settings Admin',
458 '+ Create New Bar',
459 'manage_options',
460 'my-stickymenu-new-welcomebar',
461 array( $this, 'mystickystickymenu_admin_new_welcomebar_page' )
462 );
463
464
465 if( class_exists( 'POPTIN_Plugin_Base' ) ) {
466 add_submenu_page(
467 'my-stickymenu-welcomebar',
468 'Settings Admin',
469 'Poptin Popups',
470 'manage_options',
471 'manage-poptin-plugin',
472 array( $this, 'mystickymenu_manage_poptin_plugin' )
473 );
474 } else {
475 add_submenu_page(
476 'my-stickymenu-welcomebar',
477 'Settings Admin',
478 'Poptin Popups',
479 'manage_options',
480 'install-poptin-plugin',
481 array( $this, 'mystickymenu_install_poptin_plugin' )
482 );
483 }
484
485 add_submenu_page(
486 'my-stickymenu-welcomebar',
487 'Settings Admin',
488 'Widget Analytics',
489 'manage_options',
490 'my-sticky-menu-analytics',
491 array( $this, 'mystickymenu_admin_widget_analytics_page' )
492 );
493
494 add_submenu_page(
495 'my-stickymenu-welcomebar',
496 'Settings Admin',
497 'Contact Form Leads',
498 'manage_options',
499 'my-sticky-menu-leads',
500 array( $this, 'mystickymenu_admin_leads_page' )
501 );
502
503 add_submenu_page(
504 'my-stickymenu-welcomebar',
505 'Settings Admin',
506 'Sticky Menu Settings',
507 'manage_options',
508 'my-stickymenu-settings',
509 array( $this, 'create_admin_page' )
510 );
511
512
513 if ( !$hide_msmrecommended_plugin){
514 add_submenu_page(
515 'my-stickymenu-welcomebar',
516 'msm-recommended-plugins',
517 'Recommended Plugins',
518 'manage_options',
519 'msm-recommended-plugins',
520 array( $this, 'mystickymenu_recommended_plugins' )
521 );
522 }
523 add_submenu_page(
524 'my-stickymenu-welcomebar',
525 'Upgrade to Pro ⭐️',
526 'Upgrade to Pro ⭐️',
527 'manage_options',
528 'my-stickymenu-upgrade',
529 array( $this, 'mystickymenu_admin_upgrade_to_pro' )
530 );
531 }
532
533
534
535
536 public function mystickymenu_admin_head(){
537 global $submenu;
538 $parent_slug = 'my-stickymenu-welcomebar';
539 $welcomebar_widgets = get_option( 'mysticky_option_welcomebar' );
540 $total_leads = $this->total_my_sticky_bar_contact_list(); // Total number of my sticky bar contact form leads
541 $contact_form_channel_active = $this->is_welcomebar_contact_form_enabled(); // True if contact form is enabled, false otherwise
542 // echo "<pre>";
543 // print_r($submenu[$parent_slug]);
544 // print_r($total_leads);
545 // echo "</pre>";
546 // exit;
547
548 if (isset($submenu[$parent_slug])) {
549 foreach ($submenu[$parent_slug] as &$item) {
550 if (isset($item[2]) && $item[2] === 'my-sticky-menu-leads') {
551
552 $item[4] = 'msb-admin-menu-leads'; // add your class here
553 }
554 if (isset($item[2]) && $item[2] === 'my-sticky-menu-leads') {
555
556 $item[4] = 'msb-admin-menu-leads'; // add your class here
557 }
558 if (isset($item[2]) && $item[2] === 'my-stickymenu-new-welcomebar' && !empty($welcomebar_widgets)) {
559 $item[4] = 'msb-admin-menu-upgrade'; // add your class here
560 }
561 }
562 }
563
564 ?>
565 <style>
566 .mse-admin-menu-upgrade {
567 display: none !important;
568 }
569 <?php
570 if( empty($welcomebar_widgets) ){
571 echo '#toplevel_page_my-stickymenu-welcomebar ul.wp-submenu .wp-first-item {
572 display: none !important;
573 }';
574 }
575 if( !empty($welcomebar_widgets) ){
576 echo '#toplevel_page_my-stickymenu-welcomebar ul.wp-submenu .msb-admin-menu-upgrade {
577 display: none !important;
578 }';
579 }
580 if( $total_leads == 0 && !$contact_form_channel_active) {
581
582 echo '#toplevel_page_my-stickymenu-welcomebar ul.wp-submenu .msb-admin-menu-leads {
583 display: none !important;
584 }';
585 }
586 ?>
587 </style>
588 <?php
589 }
590
591 /**
592 * Total number of my sticky bar contact form leads
593 *
594 * @return int Total number of contact form leads
595 */
596 public function total_my_sticky_bar_contact_list() {
597 global $wpdb;
598 $tableName = $wpdb->prefix . 'mystickymenu_contact_lists';
599 $total_leads = 0;
600 // Check if table exists using prepared statement for security
601 $table_check = $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $tableName));
602 if ($table_check === $tableName) {
603 // Use prepared statement with identifier placeholder for table name
604 $total_leads = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM %i", $tableName));
605 $total_leads = absint($total_leads);
606 }
607 return $total_leads;
608 }
609
610 public function is_welcomebar_contact_form_enabled() {
611 $welcomebar = get_option('mysticky_option_welcomebar', []);
612
613 return !empty($welcomebar['mysticky_welcomebar_enable_lead'])
614 && intval($welcomebar['mysticky_welcomebar_enable_lead']) === 1;
615 }
616
617 public function create_admin_page(){
618
619
620 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
621 if($is_shown) {
622 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
623 return;
624 }
625
626 $upgarde_url = admin_url("admin.php?page=my-stickymenu-upgrade");
627 // Set class property
628 if (isset($_POST['mysticky_option_name']) && !empty($_POST['mysticky_option_name']) && isset($_POST['nonce'])) {
629 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_update')) {
630 $post = $_POST['mysticky_option_name'];
631 foreach($post as $key=>$value) {
632 $post[$key] = self::sanitize_options($value);
633 }
634
635 $post['device_desktop'] = 'on';
636 $post['device_mobile'] = 'on';
637 update_option( 'mysticky_option_name', $post);
638 $this->mysticky_clear_all_caches();
639
640
641 if(isset($_POST['submit']) && $_POST['submit'] == 'SAVE & VIEW DASHBOARD'){
642 ?>
643 <script>
644 window.location.href = '<?php echo esc_url(admin_url("admin.php?page=my-stickymenu-welcomebar"));?>';
645 </script>
646 <?php
647 }
648 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
649 } else {
650 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
651 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
652 }
653 }
654
655 $mysticky_options = get_option( 'mysticky_option_name');
656 $is_old = get_option("has_sticky_header_old_version");
657 $is_old = ($is_old == "yes")?true:false;
658 $nonce = wp_create_nonce('mysticky_option_backend_update');
659 $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
660
661 $mysticky_options['stickymenu_enable'] = isset($mysticky_options['stickymenu_enable']) ? $mysticky_options['stickymenu_enable'] : '';
662 $mysticky_options['myfixed_disable_scroll_down'] = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : '';
663 $mysticky_options['disable_css'] = isset($mysticky_options['disable_css']) ? $mysticky_options['disable_css'] : '';
664 $mysticky_options['mysticky_disable_at_front_home'] = isset($mysticky_options['mysticky_disable_at_front_home']) ? $mysticky_options['mysticky_disable_at_front_home'] : '';
665 $mysticky_options['mysticky_disable_at_blog'] = isset($mysticky_options['mysticky_disable_at_blog']) ? $mysticky_options['mysticky_disable_at_blog'] : '';
666 $mysticky_options['mysticky_disable_at_page'] = isset($mysticky_options['mysticky_disable_at_page']) ? $mysticky_options['mysticky_disable_at_page'] : '';
667 $mysticky_options['mysticky_disable_at_tag'] = isset($mysticky_options['mysticky_disable_at_tag']) ? $mysticky_options['mysticky_disable_at_tag'] : '';
668 $mysticky_options['mysticky_disable_at_category'] = isset($mysticky_options['mysticky_disable_at_category']) ? $mysticky_options['mysticky_disable_at_category'] : '';
669 $mysticky_options['mysticky_disable_at_single'] = isset($mysticky_options['mysticky_disable_at_single']) ? $mysticky_options['mysticky_disable_at_single'] : '';
670 $mysticky_options['mysticky_disable_at_archive'] = isset($mysticky_options['mysticky_disable_at_archive']) ? $mysticky_options['mysticky_disable_at_archive'] : '';
671 $mysticky_options['mysticky_disable_at_search'] = isset($mysticky_options['mysticky_disable_at_search']) ? $mysticky_options['mysticky_disable_at_search'] : '';
672 $mysticky_options['mysticky_disable_at_404'] = isset($mysticky_options['mysticky_disable_at_404']) ? $mysticky_options['mysticky_disable_at_404'] : '';
673
674 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
675 if($is_shown) {
676 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
677 return;
678 } else {
679
680 $option = get_option("mystickymenu_intro_box");
681 if($option == "show") {
682 include_once dirname(__FILE__) . "/mystickymenu-popup.php";
683 }
684 ?>
685 <style>
686 div#wpcontent {
687 background: rgba(101,114,219,1);
688 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
689 background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(101,114,219,1)), color-stop(67%, rgba(238,134,198,1)), color-stop(100%, rgba(238,134,198,1)));
690 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
691 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
692 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
693 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
694 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
695 }
696 </style>
697 <div id="mystickymenu" class="wrap mystickymenu">
698
699 <div id="sticky-header-settings" class="sticky-header-content">
700
701 <form class="mysticky-form" id="mystickymenuform" method="post" action="#">
702 <div class="mystickymenu-heading">
703 <div class="mysticky-stickymenu-header-title mystickymenu-content-section">
704 <h3><?php esc_html_e('Sticky menu', 'mystickymenu'); ?></h3>
705 <label for="mysticky-stickymenu-form-enabled" class="mysticky-welcomebar-switch stickymenu-switch">
706 <input type="checkbox" id="mysticky-stickymenu-form-enabled" name="mysticky_option_name[stickymenu_enable]" value="1" <?php checked( @$mysticky_options['stickymenu_enable'], '1' );?> />
707 <span class="slider"></span>
708 </label>
709 <div class="mysticky-stickymenu-backword-page">
710 <a href="<?php echo esc_url(admin_url("admin.php?page=my-stickymenu-welcomebar"));?>"><span class="dashicons dashicons-arrow-left-alt2 back-dashboard" style="color: unset;font-size: 17px;"></span> <?php esc_html_e('Back to Dashboard', 'mystickymenu'); ?></a>
711 </div>
712 </div>
713 <div class="myStickymenu-header-title">
714 <h3><?php esc_html_e('How To Make a Sticky Header', 'mystickymenu'); ?></h3>
715 </div>
716 <p><?php esc_html_e("Add sticky menu / header to any theme. <br />Simply change 'Sticky Class' to HTML element class desired to be sticky (div id can be used as well).", 'mystickymenu'); ?></p>
717 </div>
718 <div class="mystickymenu-content-section sticky-class-sec">
719 <table>
720 <tr>
721 <td>
722 <label class="mysticky_title"><?php esc_html_e("Sticky Class", 'mystickymenu')?></label>
723 <br /><br />
724 <?php $nav_menus = wp_get_nav_menus();
725 $menu_locations = get_nav_menu_locations();
726 $locations = get_registered_nav_menus();
727 ?>
728 <select name="mysticky_option_name[mysticky_class_id_selector]" id="mystickymenu-select">
729 <option value=""><?php esc_html_e( 'Select Sticky Menu', 'mystickymenu' ); ?></option>
730
731 <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?>
732 <option value="<?php echo esc_attr( $_nav_menu->slug ); ?>" <?php selected( $_nav_menu->slug, $mysticky_options['mysticky_class_id_selector'] ); ?>>
733 <?php
734 echo esc_html( $_nav_menu->name );
735
736 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
737 $locations_assigned_to_this_menu = array();
738 foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
739 if ( isset( $locations[ $menu_location_key ] ) ) {
740 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
741 }
742 }
743
744 /**
745 * Filters the number of locations listed per menu in the drop-down select.
746 *
747 * @since 3.6.0
748 *
749 * @param int $locations Number of menu locations to list. Default 3.
750 */
751 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
752
753 // Adds ellipses following the number of locations defined in $assigned_locations.
754 if ( ! empty( $assigned_locations ) ) {
755 printf(
756 ' (%1$s%2$s)',
757 implode( ', ', $assigned_locations ),
758 count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
759 );
760 }
761 }
762 ?>
763 </option>
764 <?php endforeach; ?>
765 <option value="custom" <?php selected( 'custom', $mysticky_options['mysticky_class_id_selector'] ); ?>><?php esc_html_e( 'Other Class Or ID', 'mystickymenu' );?></option>
766 </select>
767
768 <input type="text" size="18" id="mysticky_class_selector" class="mystickyinput" name="mysticky_option_name[mysticky_class_selector]" value="<?php echo esc_attr($mysticky_options['mysticky_class_selector']);?>" />
769
770 <p class="description mystuckymenu-class-id">
771 <span class="dashicons dashicons-info"></span>&nbsp;
772 <span>
773 <?php echo sprintf(__('Need help finding your ID/Class? Install <a href="%1$s" target="_blank">CSS Peeper</a> to quickly get your navigation menu ID/Class. Here\'s a quick <a href="%2$s" target="_blank">video <span class="dashicons dashicons-controls-play"></span></a> of how you can do it.', 'mystickymenu'), 'https://chrome.google.com/webstore/detail/css-peeper/mbnbehikldjhnfehhnaidhjhoofhpehk?hl=en', 'https://www.youtube.com/watch?v=uuNqSkBPnLU');?>
774 </span>
775 </p>
776 </td>
777 <td>
778 <div class="mysticky_device_upgrade">
779 <label class="mysticky_title"><?php esc_html_e("Devices", 'mystickymenu')?></label>
780 <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php esc_html_e( 'Upgrade Now', 'mystickymenu' );?></a></span>
781
782 <ul class="mystickymenu-input-multicheckbox">
783 <li>
784 <label>
785 <input id="disable_css" name="mysticky_option_name[device_desktop]" type="checkbox" checked disabled />
786 <?php esc_html_e( 'Desktop', 'mystickymenu' );?>
787 </label>
788 </li>
789 <li>
790 <label>
791 <input id="disable_css" name="mysticky_option_name[device_mobile]" type="checkbox" checked disabled />
792 <?php esc_html_e( 'Mobile', 'mystickymenu' );?>
793 </label>
794 </li>
795 </ul>
796 </div>
797 </td>
798 </tr>
799 </table>
800 </div>
801 <div class="mystickymenu-content-section">
802 <h3><?php esc_html_e( 'Settings', 'mystickymenu' );?></h3>
803 <table class="form-table">
804 <tr>
805 <td>
806 <label for="myfixed_zindex" class="mysticky_title"><?php esc_html_e("Sticky z-index", 'mystickymenu')?></label>
807 </td>
808 <td>
809 <input type="number" min="0" max="2147483647" step="1" class="mysticky-number" id="myfixed_zindex" name="mysticky_option_name[myfixed_zindex]" value="<?php echo esc_attr($mysticky_options['myfixed_zindex']);?>" />
810 </td>
811 <td>
812 <label class="mysticky_title myssticky-remove-hand"><?php esc_html_e("Fade or slide effect", 'mystickymenu')?></label>
813 </td>
814 <td>
815 <label>
816 <input name="mysticky_option_name[myfixed_fade]" value= "slide" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'slide' );?> />
817 <?php esc_html_e("Slide", 'mystickymenu'); ?>
818 </label>
819 <label>
820 <input name="mysticky_option_name[myfixed_fade]" value="fade" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'fade' );?> />
821 <?php esc_html_e("Fade", 'mystickymenu'); ?>
822 </label>
823 </td>
824 </tr>
825 <tr>
826 <td>
827 <label for="myfixed_disable_small_screen" class="mysticky_title"><?php esc_html_e("Disable at Small Screen Sizes", 'mystickymenu')?></label>
828 <p class="description"><?php esc_attr_e('Less than chosen screen width, set 0 to disable','mystickymenu');?></p>
829 </td>
830 <td>
831 <div class="px-wrap">
832 <input type="number" class="" min="0" step="1" id="myfixed_disable_small_screen" name="mysticky_option_name[myfixed_disable_small_screen]" value="<?php echo esc_attr($mysticky_options['myfixed_disable_small_screen']);?>" />
833 <span class="input-px">PX</span>
834 </div>
835 </td>
836 <td>
837 <label for="mysticky_active_on_height" class="mysticky_title"><?php esc_html_e("Make visible on Scroll", 'mystickymenu')?></label>
838 <p class="description"><?php esc_attr_e('If set to 0 auto calculate will be used.','mystickymenu');?></p>
839 </td>
840 <td>
841 <div class="px-wrap">
842 <input type="number" class="small-text" min="0" step="1" id="mysticky_active_on_height" name="mysticky_option_name[mysticky_active_on_height]" value="<?php echo esc_attr($mysticky_options['mysticky_active_on_height']);?>" />
843 <span class="input-px">PX</span>
844 </div>
845 </td>
846 </tr>
847 <tr>
848 <td>
849 <label for="mysticky_active_on_height_home" class="mysticky_title"><?php esc_html_e("Make visible on Scroll at homepage", 'mystickymenu')?></label>
850 <p class="description"><?php esc_html_e( 'If set to 0 it will use initial Make visible on Scroll value.', 'mystickymenu' );?></p>
851 </td>
852 <td>
853 <div class="px-wrap">
854 <input type="number" class="small-text" min="0" step="1" id="mysticky_active_on_height_home" name="mysticky_option_name[mysticky_active_on_height_home]" value="<?php echo esc_attr($mysticky_options['mysticky_active_on_height_home']);;?>" />
855 <span class="input-px">PX</span>
856 </div>
857 </td>
858 <td>
859 <label for="myfixed_bgcolor" class="mysticky_title myssticky-remove-hand"><?php esc_html_e("Sticky Background Color", 'mystickymenu')?></label>
860 </td>
861 <td>
862 <input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" class="my-color-field" data-alpha="true" value="<?php echo esc_attr($mysticky_options['myfixed_bgcolor']);;?>" />
863
864 </td>
865 </tr>
866 <tr>
867 <td>
868 <label for="myfixed_transition_time" class="mysticky_title"><?php esc_html_e("Sticky Transition Time", 'mystickymenu')?></label>
869 </td>
870 <td>
871 <input type="number" class="small-text" min="0" step="0.1" id="myfixed_transition_time" name="mysticky_option_name[myfixed_transition_time]" value="<?php echo esc_attr($mysticky_options['myfixed_transition_time']);?>" />
872 </td>
873 <td>
874 <label for="myfixed_textcolor" class="mysticky_title myssticky-remove-hand"><?php esc_html_e("Sticky Text Color", 'mystickymenu')?></label>
875 </td>
876 <td>
877 <input type="text" id="myfixed_textcolor" name="mysticky_option_name[myfixed_textcolor]" class="my-color-field" data-alpha="true" value="<?php echo (isset($mysticky_options['myfixed_textcolor'])) ? esc_attr($mysticky_options['myfixed_textcolor']) : '';?>" />
878
879 </td>
880 </tr>
881 <tr>
882 <td>
883 <label for="myfixed_opacity" class="mysticky_title myssticky-remove-hand"><?php esc_html_e("Sticky Opacity", 'mystickymenu')?></label>
884 <p class="description"><?php esc_html_e( 'numbers 1-100.', 'mystickymenu');?></p>
885 </td>
886 <td>
887 <input type="hidden" class="small-text mysticky-slider" min="0" step="1" max="100" id="myfixed_opacity" name="mysticky_option_name[myfixed_opacity]" value="<?php echo esc_attr($mysticky_options['myfixed_opacity']);;?>" />
888 <div id="slider">
889 <div id="custom-handle" class="ui-slider-handle"><?php //echo esc_attr($mysticky_options['myfixed_opacity']);?></div>
890 </div>
891
892 </td>
893 </tr>
894 </table>
895 </div>
896
897 <div class="mystickymenu-content-section <?php echo !$is_old?"mystickymenu-content-upgrade":""?>" >
898
899 <div class="mystickymenu-content-option">
900 <label class="mysticky_title css-style-title"><?php esc_html_e("Hide on Scroll Down", 'mystickymenu'); ?></label>
901 <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php esc_html_e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?>
902 <p>
903 <label class="mysticky_text">
904 <input id="myfixed_disable_scroll_down" name="mysticky_option_name[myfixed_disable_scroll_down]" type="checkbox" <?php checked( @$mysticky_options['myfixed_disable_scroll_down'], 'on' );?> <?php echo !$is_old?"disabled":"" ?> />
905 <?php esc_html_e("Disable sticky menu at scroll down", 'mystickymenu'); ?>
906 </label>
907 </p>
908 </div>
909 <div class="mysticky-page-target-setting mystickymenu-content-option">
910 <label class="mysticky_title"><?php esc_attr_e('Page targeting', 'mystickymenu'); ?></label>
911 <div class="mystickymenu-input-section mystickymenu-page-target-wrap">
912 <div class="mysticky-welcomebar-setting-content-right">
913 <div class="mysticky-page-options" id="mysticky-welcomebar-page-options">
914 <?php $page_option = (isset($mysticky_options['mysticky_page_settings'])) ? $mysticky_options['mysticky_page_settings'] : array();
915 $url_options = array(
916 'page_contains' => 'pages that contain',
917 'page_has_url' => 'a specific page',
918 'page_start_with' => 'pages starting with',
919 'page_end_with' => 'pages ending with',
920 );
921
922 if(!empty($page_option) && is_array($page_option)) {
923 $count = 0;
924 foreach($page_option as $k=>$option) {
925 $count++;
926 ?>
927 <div class="mysticky-page-option <?php echo ( $k==count($page_option) ) ? "last":""; ?>">
928 <div class="url-content">
929 <div class="mysticky-welcomebar-url-select">
930 <select name="mysticky_option_name[mysticky_page_settings][<?php echo esc_attr($count); ?>][shown_on]" id="url_shown_on_<?php echo esc_attr($count); ?>_option">
931 <option value="show_on" <?php echo ($option['shown_on']=="show_on" ) ? "selected":"" ?> ><?php esc_html_e( 'Show on', 'mystickymenu' )?></option>
932 <option value="not_show_on" <?php echo ($option['shown_on']=="not_show_on" )? "selected":""; ?>><?php esc_html_e( "Don't show on", "mystickymenu" );?></option>
933 </select>
934 </div>
935 <div class="mysticky-welcomebar-url-option">
936 <select class="mysticky-url-options" name="mysticky_option_name[mysticky_page_settings][<?php echo esc_attr($count);; ?>][option]" id="url_rules_<?php echo esc_attr($count); ?>_option">
937 <option disabled value=""><?php esc_html_e( "Select Rule", "mystickymenu" );?></option>
938 <?php foreach($url_options as $key=>$value) {
939 $selected = ( isset($option['option']) && $option['option']==$key )?" selected='selected' ":"";
940 echo '<option ' . esc_attr($selected) . ' value="' . esc_attr($key) . '">' . esc_html($value) . '</option>';
941 } ?>
942 </select>
943 </div>
944 <div class="mysticky-welcomebar-url-box">
945 <span class='mysticky-welcomebar-url'><?php echo esc_url(site_url("/")); ?></span>
946 </div>
947 <div class="mysticky-welcomebar-url-values">
948 <input type="text" value="<?php echo esc_attr($option['value']) ?>" name="mysticky_option_name[mysticky_page_settings][<?php echo esc_attr($count); ?>][value]" id="url_rules_<?php echo esc_attr($count);; ?>_value" />
949 </div>
950 <div class="mysticky-welcomebar-url-buttons">
951 <a class="mysticky-remove-rule" href="#">x</a>
952 </div>
953 <div class="clear"></div>
954 </div>
955 </div>
956 <?php
957 }
958 }
959 ?>
960 </div>
961 <a href="#" class="create-rule" id="mysticky_create-rule"><?php esc_html_e( "Add Rule", "mystickymenu" );?></a>
962 </div>
963 <input type="hidden" id="mysticky_welcomebar_site_url" value="<?php echo esc_url(site_url("/")) ?>" />
964 <div class="mysticky-page-options-html" style="display: none;">
965 <div class="mysticky-page-option">
966 <div class="url-content">
967 <div class="mysticky-welcomebar-url-select">
968 <select name="" id="url_shown_on___count___option">
969 <option value="show_on"><?php esc_html_e("Show on", "mystickymenu" );?></option>
970 <option value="not_show_on"><?php esc_html_e("Don't show on", "mystickymenu" );?></option>
971 </select>
972 </div>
973 <div class="mysticky-welcomebar-url-option">
974 <select class="mysticky-url-options" name="" id="url_rules___count___option">
975 <option selected="selected" disabled value=""><?php esc_html_e("Select Rule", "mystickymenu" );?></option>
976 <?php foreach($url_options as $key=>$value) {
977 echo '<option value="'. esc_attr($key) . '">' . esc_html($value) . '</option>';
978 } ?>
979 </select>
980 </div>
981 <div class="mysticky-welcomebar-url-box">
982 <span class='mysticky-welcomebar-url'><?php echo esc_url(site_url("/")); ?></span>
983 </div>
984 <div class="mysticky-welcomebar-url-values">
985 <input type="text" value="" name="mysticky_option_name[mysticky_page_settings][__count__][value]" id="url_rules___count___value" disabled />
986 </div>
987 <div class="clear"></div>
988 </div>
989 <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php esc_html_e( 'Upgrade Now', 'mystickymenu' );?></a></span>
990 </div>
991 </div>
992 </div>
993 </div>
994 <div class="mystickymenu-content-option">
995 <label class="mysticky_title css-style-title"><?php esc_html_e("CSS style", 'mystickymenu'); ?></label>
996 <span class="mysticky_text"><?php esc_html_e( 'Add/edit CSS style. Leave it blank for default style.', 'mystickymenu');?></span>
997 <div class="mystickymenu-input-section">
998 <textarea type="text" rows="4" cols="60" id="myfixed_cssstyle" name="mysticky_option_name[myfixed_cssstyle]" <?php echo !$is_old?"disabled":"" ?> ><?php echo ( isset($mysticky_options['myfixed_cssstyle']) ) ? $mysticky_options['myfixed_cssstyle']: '';?></textarea>
999 </div>
1000 <p><?php esc_html_e( "CSS ID's and Classes to use:", "mystickymenu" );?></p>
1001 <p>
1002 #mysticky-wrap { }<br/>
1003 #mysticky-nav.wrapfixed { }<br/>
1004 #mysticky-nav.wrapfixed.up { }<br/>
1005 #mysticky-nav.wrapfixed.down { }<br/>
1006 #mysticky-nav .navbar { }<br/>
1007 #mysticky-nav .navbar.myfixed { }<br/>
1008 </p>
1009 </div>
1010
1011 <div class="mystickymenu-content-option">
1012 <label class="mysticky_title" for="disable_css"><?php esc_html_e("Disable CSS style", 'mystickymenu'); ?></label>
1013 <div class="mystickymenu-input-section">
1014 <label>
1015 <input id="disable_css" name="mysticky_option_name[disable_css]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['disable_css'], 'on' );?> />
1016 <?php esc_html_e( 'Use this option if you plan to include CSS Style manually', 'mystickymenu' );?>
1017 </label>
1018 </div>
1019 <p></p>
1020 </div>
1021
1022 <div class="mystickymenu-content-option">
1023 <label class="mysticky_title"><?php esc_html_e("Disable at", 'mystickymenu'); ?></label>
1024 <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php esc_html_e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?>
1025 <div class="mystickymenu-input-section">
1026 <ul class="mystickymenu-input-multicheckbox">
1027 <li>
1028 <label>
1029 <input id="mysticky_disable_at_front_home" name="mysticky_option_name[mysticky_disable_at_front_home]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_front_home'], 'on' );?>/>
1030 <span><?php esc_attr_e('front page', 'mystickymenu' );?></span>
1031 </label>
1032 </li>
1033 <li>
1034 <label>
1035 <input id="mysticky_disable_at_blog" name="mysticky_option_name[mysticky_disable_at_blog]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_blog'], 'on' );?>/>
1036 <span><?php esc_attr_e('blog page', 'mystickymenu' );?></span>
1037 </label>
1038 </li>
1039 <li>
1040 <label>
1041 <input id="mysticky_disable_at_page" name="mysticky_option_name[mysticky_disable_at_page]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_page'], 'on' );?> />
1042 <span><?php esc_attr_e('pages', 'mystickymenu' );?> </span>
1043 </label>
1044 </li>
1045 <li>
1046 <label>
1047 <input id="mysticky_disable_at_tag" name="mysticky_option_name[mysticky_disable_at_tag]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_tag'], 'on' );?> />
1048 <span><?php esc_attr_e('tags', 'mystickymenu' );?> </span>
1049 </label>
1050 </li>
1051 <li>
1052 <label>
1053 <input id="mysticky_disable_at_category" name="mysticky_option_name[mysticky_disable_at_category]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_category'], 'on' );?>/>
1054 <span><?php esc_attr_e('categories', 'mystickymenu' );?></span>
1055 </label>
1056 </li>
1057 <li>
1058 <label>
1059 <input id="mysticky_disable_at_single" name="mysticky_option_name[mysticky_disable_at_single]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_single'], 'on' );?> />
1060 <span><?php esc_attr_e('posts', 'mystickymenu' );?> </span>
1061 </label>
1062 </li>
1063 <li>
1064 <label>
1065 <input id="mysticky_disable_at_archive" name="mysticky_option_name[mysticky_disable_at_archive]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_archive'], 'on' );?> />
1066 <span><?php esc_attr_e('archives', 'mystickymenu' );?> </span>
1067 </label>
1068 </li>
1069 <li>
1070 <label>
1071 <input id="mysticky_disable_at_search" name="mysticky_option_name[mysticky_disable_at_search]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_search'], 'on' );?> />
1072 <span><?php esc_attr_e('search', 'mystickymenu' );?> </span>
1073 </label>
1074 </li>
1075 <li>
1076 <label>
1077 <input id="mysticky_disable_at_404" name="mysticky_option_name[mysticky_disable_at_404]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['mysticky_disable_at_404'], 'on' );?>/>
1078 <span><?php esc_attr_e('404', 'mystickymenu' );?> </span>
1079 </label>
1080 </li>
1081 </ul>
1082
1083 <?php
1084 if (isset ( $mysticky_options['mysticky_disable_at_page'] ) == true ) {
1085 echo '<div class="mystickymenu-input-section">';
1086 _e('<span class="description"><strong>Except for this pages:</strong> </span>', 'mystickymenu');
1087
1088 printf(
1089 '<input disabled type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ',
1090 isset( $mysticky_options['mysticky_enable_at_pages'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_pages']) : ''
1091 );
1092
1093 _e('<span class="description">Comma separated list of pages to enable. It should be page name, id or slug. Example: about-us, 1134, Contact Us. Leave blank if you realy want to disable sticky menu for all pages.</span>', 'mystickymenu');
1094 echo '</div>';
1095 }
1096
1097 if (isset ( $mysticky_options['mysticky_disable_at_single'] ) == true ) {
1098
1099 echo '<div class="mystickymenu-input-section">';
1100 _e('<span class="description"><strong>Except for this posts:</strong> </span>', 'mystickymenu');
1101
1102 printf(
1103 '<input disabled type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ',
1104 isset( $mysticky_options['mysticky_enable_at_posts'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_posts']) : ''
1105 );
1106
1107 _e('<span class="description">Comma separated list of posts to enable. It should be post name, id or slug. Example: about-us, 1134, Contact Us. Leave blank if you realy want to disable sticky menu for all posts.</span>', 'mystickymenu');
1108 echo '</div>';
1109
1110 }
1111 ?>
1112 <p></p>
1113 </div>
1114 </div>
1115 </div>
1116
1117 <!-- Mysticky Menu: Save & Save Dashbaord Submission Validation Popup -->
1118
1119 <div class="mystickymenu-action-popup new-center" id="mysticky-sticky-save-confirm" style="display:none;">
1120 <div class="mystickymenu-action-popup-header">
1121 <h3><?php esc_html_e("Turn on Sticky Menu","mystickymenu"); ?></h3>
1122 <span class="dashicons dashicons-no-alt close-button" data-from = "stickymenu-confirm"></span>
1123 </div>
1124 <div class="mystickymenu-action-popup-body">
1125 <p><?php esc_html_e("Sticky Menu is not turned on. Turn on Sticky Menu to activate sticky menu on your website.","mystickymenu"); ?></p>
1126 </div>
1127 <div class="mystickymenu-action-popup-footer">
1128 <button type="button" class="btn-enable btn-nevermind-status" id="stickymenu_status_dolater" ><?php esc_html_e("Just save & keep it off","mystickymenu"); ?></button>
1129 <button type="button" class="btn-disable-cancel" id="stickymenu_status_ok" ><?php esc_html_e("Save & Turn on Sticky Menu","mystickymenu"); ?></button>
1130 </div>
1131 </div>
1132 <div class="mystickymenupopup-overlay" id="stickymenu-option-overlay-popup"></div>
1133
1134 <!-- End Save & Save Dashbaord Submission Validation Popup -->
1135
1136 <p class="submit">
1137 <input type="submit" name="submit" id="submit" class="button button-primary btn-save-stickymenu" value="<?php esc_attr_e('Save', 'mystickymenu');?>">
1138
1139 <input type="submit" name="submit" id="submit" class="button button-primary save_view_dashboard" style="width: auto;" value="<?php esc_html_e('SAVE & VIEW DASHBOARD', 'mystickymenu');?>">
1140 </p>
1141 <input type="hidden" name="nonce" value="<?php echo esc_attr($nonce); ?>">
1142 <input type="hidden" id="save_stickymenu" value=""/>
1143 </form>
1144 <form class="mysticky-hideformreset" method="post" action="">
1145 <input name="reset_mysticky_options" class="button button-secondary confirm" type="submit" value="<?php esc_attr_e('Reset', 'mystickymenu');?>" >
1146 <input type="hidden" name="action" value="reset" />
1147 <?php $nonce = wp_create_nonce('mysticky_option_backend_reset_nonce'); ?>
1148 <input type="hidden" name="nonce" value="<?php echo esc_attr($nonce); ?>">
1149 </form>
1150 <p class="myStickymenu-review"><a href="https://wordpress.org/support/plugin/mystickymenu/reviews/" target="_blank"><?php esc_attr_e('Leave a review','mystickymenu'); ?></a></p>
1151 </div>
1152 </div>
1153 <?php }
1154 }
1155
1156
1157 public function mystickystickymenu_admin_welcomebar_page() {
1158
1159 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
1160 if($is_shown) {
1161 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
1162 return;
1163 }
1164
1165
1166 /*
1167 DATE : 2022-08-04
1168 Welcome bar save data function
1169 */
1170 if (isset($_POST['mysticky_option_welcomebar']) && !empty($_POST['mysticky_option_welcomebar']) && isset($_POST['nonce'])) {
1171 if(!empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'mysticky_option_welcomebar_update')) {
1172
1173
1174 $widgets = get_option( 'mysticky_option_welcomebar' );
1175
1176 $is_first_widget = 0;
1177 if( isset($widgets) && $widgets == '' ){
1178 $is_first_widget = 1;
1179 }
1180
1181
1182
1183 $welcomebars_widgets[0] = 'Bar #0';
1184 update_option( 'mystickymenu-welcomebars', $welcomebars_widgets );
1185
1186 $mysticky_option_welcomebar = mysticky_bar_sanitize_options( $_POST['mysticky_option_welcomebar'] );
1187
1188 $mysticky_option_welcomebar['mysticky_welcomebar_bar_text'] = wp_kses(stripslashes($_POST['mysticky_option_welcomebar']['mysticky_welcomebar_bar_text']) , [
1189 'a' => array(
1190 'href' => array(),
1191 'title' => array(),
1192 'rel' => array(),
1193 'target' => array()
1194 ),
1195 'p' => array(
1196 'style' => array(),
1197 ),
1198 'br' => array(),
1199 'em' => array(),
1200 'u' => array(),
1201 'strong' => array(),
1202 ]);
1203 $mysticky_option_welcomebar['mysticky_welcomebar_thankyou_screen_text'] = wp_kses(stripslashes($_POST['mysticky_option_welcomebar']['mysticky_welcomebar_thankyou_screen_text']) , [
1204 'a' => array(
1205 'href' => array(),
1206 'title' => array(),
1207 'rel' => array(),
1208 'target' => array()
1209 ),
1210 'p' => array(
1211 'style' => array(),
1212 ),
1213 'br' => array(),
1214 'em' => array(),
1215 'u' => array(),
1216 'strong' => array(),
1217 ]);
1218 $mysticky_option_welcomebar['mysticky_welcomebar_height'] = 60;
1219 $mysticky_option_welcomebar['mysticky_welcomebar_device_desktop'] = 'desktop';
1220 $mysticky_option_welcomebar['mysticky_welcomebar_device_mobile'] = 'mobile';
1221 $mysticky_option_welcomebar['mysticky_welcomebar_trigger'] = 'after_a_few_seconds';
1222 $mysticky_option_welcomebar['mysticky_welcomebar_triggersec'] = '0';
1223 $mysticky_option_welcomebar['mysticky_welcomebar_expirydate'] = '';
1224 $mysticky_option_welcomebar['mysticky_welcomebar_page_settings'] = '';
1225 $mysticky_option_welcomebar['mysticky_welcomebar_text_type'] = 'static_text';
1226
1227 update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar);
1228
1229 $this->mysticky_clear_all_caches();
1230
1231 if(isset($_POST['submit']) && ( $_POST['submit'] == 'SAVE & VIEW DASHBOARD' || $_POST['submit']== '' ) ){
1232 if ( isset($is_first_widget) && $is_first_widget == 1 ) { ?>
1233 <script>
1234 window.location.href = '<?php echo admin_url("admin.php?page=my-stickymenu-welcomebar&first_widget=".$is_first_widget);?>';
1235 </script>
1236 <?php } else { ?>
1237 <script>
1238 window.location.href = '<?php echo admin_url("admin.php?page=my-stickymenu-welcomebar");?>';
1239 </script>
1240 <?php
1241 }
1242 } else {
1243
1244 if ( isset($is_first_widget) && $is_first_widget == 1 ) { ?>
1245 <script>
1246 window.location.href = '<?php echo admin_url("admin.php?page=my-stickymenu-welcomebar&widget=0&isedit=1&first_widget=".$is_first_widget);?>';
1247 </script>
1248 <?php } else { ?>
1249 <script>
1250 window.location.href = '<?php echo admin_url("admin.php?page=my-stickymenu-welcomebar&widget=0&isedit=1");?>';
1251 </script>
1252 <?php
1253 }
1254 }
1255 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
1256 } else {
1257 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
1258 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
1259 }
1260 }
1261
1262
1263
1264 if (isset($_POST['mysticky_welcomebar_reset']) && !empty($_POST['mysticky_welcomebar_reset']) && isset($_POST['nonce_reset'])) {
1265 if(!empty($_POST['nonce_reset']) && wp_verify_nonce($_POST['nonce_reset'], 'mysticky_option_welcomebar_reset')) {
1266 $mysticky_option_welcomebar_reset = mysticky_welcomebar_pro_widget_default_fields();
1267 update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar_reset);
1268 $this->mysticky_clear_all_caches();
1269 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Reset Settings saved.','mystickymenu'). '</p></strong></div>';
1270 } else {
1271 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
1272 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
1273 }
1274 }
1275
1276
1277
1278 $mysticky_options = get_option( 'mysticky_option_name');
1279 $is_old = get_option("has_sticky_header_old_version");
1280 $is_old = ($is_old == "yes") ? true : false;
1281 $nonce = wp_create_nonce('mysticky_option_backend_update');
1282 $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
1283
1284 ?>
1285 <style>
1286 div#wpcontent {
1287 background: rgba(101,114,219,1);
1288 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1289 background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(101,114,219,1)), color-stop(67%, rgba(238,134,198,1)), color-stop(100%, rgba(238,134,198,1)));
1290 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1291 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1292 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1293 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1294 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
1295 }
1296 </style>
1297 <div id="mystickymenu" class="wrap mystickymenu">
1298
1299 <div id="sticky-header-welcome-bar" class="sticky-header-content">
1300 <?php
1301
1302 $welcomebars_widgets = get_option( 'mysticky_option_welcomebar' );
1303 if ( !isset($_GET['widget']) && isset( $_GET['page'] ) && $_GET['page'] == 'my-stickymenu-welcomebar' ) {
1304 include_once( 'admin/stickymenu-dashboard.php');
1305 }elseif ( !isset($_GET['isedit']) && !isset($_GET['save']) && isset($welcomebars_widgets) && !empty($welcomebars_widgets) ) {
1306 ?>
1307 <div id="mystickymenu" class="wrap mystickymenu mystickymenu-new-widget-wrap">
1308 <?php include_once dirname(__FILE__) . '/mystickymeny-new-welcomebar.php';?>
1309 </div>
1310 <?php
1311 }else{
1312 include_once( 'admin/bar-settings.php');
1313 //mysticky_welcome_bar_backend();
1314 }
1315
1316 if( isset($_GET['first_widget']) && $_GET['first_widget'] == 1 ) : ?>
1317
1318 <div class="main-popup-mystickymenu-bg first-widget-popup">
1319 <div class="main-popup-mystickymenu-bg mystickymenu_container_popupbox">
1320 <div class="firstwidget-popup-contain">
1321 <img src="<?php echo esc_url( MYSTICKYMENU_URL .'/images/firstwidget_congratulations.svg');?>">
1322 <h4>Congratulations! 🎉</h4>
1323 <p> Your first widget is now up and running on your website!</p>
1324 <div class="first-widget-popup-contant">
1325 <h4><?php esc_html_e('Upgrade to pro today','mystickymenu'); ?></h4>
1326 <p> <?php esc_html_e('🎨 Display coupon codes and add sliding text to the widget.','mystickymenu') ?> </p>
1327 <p> <?php esc_html_e('📱 Create multiple widgets for different devices, pages and languages.','mystickymenu') ?> </p>
1328 <p> <?php esc_html_e('🎯 Targeting by country, page, and device','mystickymenu') ?> </p>
1329 <p> <?php esc_html_e('⏱️ Add a countdown timer to increase the conversion rate','mystickymenu') ?> </p>
1330 </div>
1331 <a href="<?php echo esc_url(admin_url("admin.php?page=my-stickymenu-upgrade"));?>" class="mystickymenu btn-black btn-back-dashboard"><?php esc_html_e('Upgrade to Pro','mystickymenu');?></a><br>
1332 <a href="#" class="mystickymenu btn-black btn-dashboard btn-close-dashboard"><?php esc_html_e('Close','mystickymenu');?></a>
1333
1334 </div>
1335 <div class="popup-modul-close-btn firstwidget-model">
1336 <a href="#" class="close-chaty-maxvisitor-popup" id="close-first-popup">
1337 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 5L5 15" stroke="#4A4A4A" stroke-width="2.08" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 5L15 15" stroke="#4A4A4A" stroke-width="2.08" stroke-linecap="round" stroke-linejoin="round"/></svg>
1338 </a>
1339 </div>
1340 </div>
1341 </div>
1342 <div class="mystickymenupopup-overlay" id="first_widget_overlay" style="display:block;"></div>
1343
1344 <?php endif; ?>
1345 </div>
1346 </div>
1347 <?php
1348 require_once MYSTICKYMENU_PATH . 'mystickymenu-review-popup.php';
1349 }
1350
1351 public function mystickystickymenu_admin_new_welcomebar_page() {
1352
1353 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
1354 if($is_shown) {
1355 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
1356 return;
1357 }
1358
1359 $welcomebars_widgets = get_option( 'mysticky_option_welcomebar' );
1360 if( isset($welcomebars_widgets) && !empty($welcomebars_widgets)){
1361 ?>
1362 <div id="mystickymenu" class="wrap mystickymenu mystickymenu-new-widget-wrap">
1363 <?php include_once dirname(__FILE__) . '/mystickymeny-new-welcomebar.php';?>
1364 </div>
1365 <?php
1366 }else{ ?>
1367 <div id="mystickymenu" class="wrap mystickymenu">
1368 <div id="sticky-header-welcome-bar" class="sticky-header-content">
1369 <?php
1370 include_once( 'admin/bar-settings.php');
1371 //mysticky_welcome_bar_backend(); ?>
1372 </div>
1373 </div>
1374 <?php
1375 }
1376
1377 }
1378 public function mystickymenu_manage_poptin_plugin() {
1379 ?>
1380 <script>
1381 window.location.href= '<?php echo admin_url( "admin.php?page=poptin" )?>'
1382 </script>
1383 <?php
1384 exit;
1385 }
1386 public function mystickymenu_install_poptin_plugin() {
1387 include_once 'admin/poptin-plugin.php';
1388 }
1389 public function mystickymenu_admin_widget_analytics_page(){
1390
1391 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
1392 if($is_shown) {
1393 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
1394 return;
1395 } else {
1396 include('mystickymenu-admin-widgetanalytics.php');
1397 }
1398 }
1399
1400 public function mystickymenu_recommended_plugins() {
1401 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
1402 if($is_shown) {
1403 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
1404 return;
1405 } else {
1406 include_once 'recommended-plugins.php';
1407 }
1408 }
1409
1410 public function mystickymenu_admin_upgrade_to_pro() {
1411 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
1412 if($is_shown) {
1413 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
1414 return;
1415 } else {
1416
1417 $pro_url = "https://go.premio.io/checkount/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
1418 ?>
1419 <style>
1420 div#wpcontent {
1421 background: rgba(101,114,219,1);
1422 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1423 background: -webkit-gradient(left top, right bottom, color-stop(0%, rgba(101,114,219,1)), color-stop(67%, rgba(238,134,198,1)), color-stop(100%, rgba(238,134,198,1)));
1424 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1425 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1426 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1427 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
1428 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
1429 }
1430 </style>
1431 <div id="mystickymenu" class="wrap mystickymenu">
1432 <?php include_once "upgrade-to-pro.php"; ?>
1433 </div>
1434 <?php
1435 }
1436
1437 }
1438
1439 public function mysticky_default_options() {
1440
1441 global $options;
1442 $menu_locations = get_nav_menu_locations();
1443 $menu_object = isset($menu_locations['menu-1']) ? wp_get_nav_menu_object( $menu_locations['menu-1'] ) : array();
1444
1445 if ( is_object($menu_object) && $menu_object->slug != '' ) {
1446 $mysticky_class_id_selector = $menu_object->slug;
1447 } else {
1448 $mysticky_class_id_selector = 'custom';
1449 }
1450
1451 $mystickyClass = '.navbar';
1452 $template_name = get_template();
1453 switch( $template_name ){
1454 case 'ashe':
1455 $mysticky_class_id_selector = 'custom';
1456 $mystickyClass = '#main-nav';
1457 break;
1458 case 'astra':
1459 case 'hello-elementor':
1460 case 'sydney':
1461 case 'twentysixteen':
1462 $mysticky_class_id_selector = 'custom';
1463 $mystickyClass = 'header.site-header';
1464 break;
1465 case 'generatepress':
1466 $mysticky_class_id_selector = 'custom';
1467 $mystickyClass = 'nav.main-navigation';
1468 break;
1469 case 'transportex':
1470 $mysticky_class_id_selector = 'custom';
1471 $mystickyClass = '.transportex-menu-full';
1472 break;
1473 case 'hestia':
1474 case 'neve':
1475 $mysticky_class_id_selector = 'custom';
1476 $mystickyClass = 'header.header';
1477 break;
1478 case 'mesmerize':
1479 $mysticky_class_id_selector = 'custom';
1480 $mystickyClass = '.navigation-bar';
1481 break;
1482 case 'oceanwp':
1483 $mysticky_class_id_selector = 'custom';
1484 $mystickyClass = 'header#site-header';
1485 break;
1486 case 'shapely':
1487 $mysticky_class_id_selector = 'custom';
1488 $mystickyClass = '#site-navigation';
1489 break;
1490 case 'storefront':
1491 $mysticky_class_id_selector = 'custom';
1492 $mystickyClass = '.storefront-primary-navigation';
1493 break;
1494 case 'twentynineteen':
1495 $mysticky_class_id_selector = 'custom';
1496 $mystickyClass = '#site-navigation';
1497 break;
1498 case 'twentyseventeen':
1499 $mysticky_class_id_selector = 'custom';
1500 $mystickyClass = '.navigation-top';
1501 break;
1502 default:
1503 break;
1504 }
1505
1506 $default = array(
1507 'mysticky_class_id_selector' => $mysticky_class_id_selector,
1508 'mysticky_class_selector' => $mystickyClass,
1509 'device_desktop' => 'on',
1510 'device_mobile' => 'on',
1511 'myfixed_zindex' => '99990',
1512 'myfixed_bgcolor' => '#f7f5e7',
1513 'myfixed_opacity' => '90',
1514 'myfixed_transition_time' => '0.3',
1515 'myfixed_disable_small_screen' => '0',
1516 'myfixed_disable_large_screen' => '0',
1517 'mysticky_active_on_height' => '0',
1518 'mysticky_active_on_height_home'=> '0',
1519 'myfixed_fade' => 'slide',
1520 'myfixed_cssstyle' => '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }'
1521 );
1522
1523 if ( get_option('mysticky_option_name') == false && current_user_can( 'manage_options' ) ) {
1524 $status = get_option("sticky_header_status");
1525 if($status == false) {
1526 update_option("sticky_header_status", "done");
1527 update_option("has_sticky_header_old_version", "no");
1528 }
1529 update_option( 'mysticky_option_name', $default );
1530 } else {
1531 $status = get_option("sticky_header_status");
1532 if($status == false) {
1533 update_option("sticky_header_status", "done");
1534 update_option("has_sticky_header_old_version", "yes");
1535 }
1536 }
1537
1538 if(isset($_POST['reset_mysticky_options']) && current_user_can( 'manage_options' )) {
1539 if(isset($_REQUEST['nonce']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_reset_nonce')) {
1540 update_option('mysticky_option_name', $default);
1541 } else {
1542
1543 }
1544 }
1545
1546 if ( !get_option( 'update_mysticky_version_2_6') && current_user_can( 'manage_options' )) {
1547 $mysticky_option_name = get_option( 'mysticky_option_name' );
1548 $mysticky_option_name['mysticky_class_id_selector'] = 'custom';
1549 if ($mysticky_option_name['myfixed_fade'] == 'on'){
1550 $mysticky_option_name['myfixed_fade'] = 'slide';
1551 }else{
1552 $mysticky_option_name['myfixed_fade'] = 'fade';
1553 }
1554 update_option( 'mysticky_option_name', $mysticky_option_name );
1555 update_option( 'update_mysticky_version_2_6', true );
1556 }
1557
1558 if ( !get_option( 'update_mysticky_version_2_5_7') && current_user_can( 'manage_options' )) {
1559 $mysticky_option_name = get_option( 'mysticky_option_name' );
1560 $mysticky_option_name['stickymenu_enable'] = 1;
1561 update_option( 'mysticky_option_name', $mysticky_option_name );
1562 update_option( 'update_mysticky_version_2_5_7', true );
1563 }
1564 }
1565
1566 /*
1567 * clear cache when any option is updated
1568 *
1569 */
1570 public function mysticky_clear_all_caches(){
1571
1572 try {
1573 global $wp_fastest_cache;
1574
1575 // if W3 Total Cache is being used, clear the cache
1576 if (function_exists('w3tc_flush_all')) {
1577 w3tc_flush_all();
1578 }
1579 /* if WP Super Cache is being used, clear the cache */
1580 if (function_exists('wp_cache_clean_cache')) {
1581 global $file_prefix, $supercachedir;
1582 if (empty($supercachedir) && function_exists('get_supercache_dir')) {
1583 $supercachedir = get_supercache_dir();
1584 }
1585 wp_cache_clean_cache($file_prefix);
1586 }
1587
1588 if (class_exists('WpeCommon')) {
1589 //be extra careful, just in case 3rd party changes things on us
1590 if (method_exists('WpeCommon', 'purge_memcached')) {
1591 //WpeCommon::purge_memcached();
1592 }
1593 if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
1594 //WpeCommon::clear_maxcdn_cache();
1595 }
1596 if (method_exists('WpeCommon', 'purge_varnish_cache')) {
1597 //WpeCommon::purge_varnish_cache();
1598 }
1599 }
1600
1601 if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
1602 $wp_fastest_cache->deleteCache();
1603 }
1604 if (function_exists('rocket_clean_domain')) {
1605 rocket_clean_domain();
1606 // Preload cache.
1607 if (function_exists('run_rocket_sitemap_preload')) {
1608 run_rocket_sitemap_preload();
1609 }
1610 }
1611
1612 if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) {
1613 autoptimizeCache::clearall();
1614 }
1615
1616 if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) {
1617 LiteSpeed_Cache_API::purge_all();
1618 }
1619
1620 if ( class_exists( '\Hummingbird\Core\Utils' ) ) {
1621
1622 $modules = \Hummingbird\Core\Utils::get_active_cache_modules();
1623 foreach ( $modules as $module => $name ) {
1624 $mod = \Hummingbird\Core\Utils::get_module( $module );
1625
1626 if ( $mod->is_active() ) {
1627 if ( 'minify' === $module ) {
1628 $mod->clear_files();
1629 } else {
1630 $mod->clear_cache();
1631 }
1632 }
1633 }
1634 }
1635
1636 } catch (Exception $e) {
1637 return 1;
1638 }
1639 }
1640
1641 public function mystickymenu_deactivate() {
1642 global $pagenow;
1643
1644 if ( 'plugins.php' !== $pagenow ) {
1645 return;
1646 }
1647 include dirname(__FILE__) . "/mystickymenu-deactivate-form.php";
1648 }
1649 public function mystickymenu_plugin_deactivate() {
1650 global $current_user;
1651 if ( ! current_user_can( 'manage_options' ) ) {
1652 wp_die(0);
1653 }
1654 check_ajax_referer( 'mystickymenu_deactivate_nonce', 'nonce' );
1655
1656 $postData = $_POST;
1657 $errorCounter = 0;
1658 $response = array();
1659 $response['status'] = 0;
1660 $response['message'] = "";
1661 $response['valid'] = 1;
1662 if(!isset($postData['reason']) || empty($postData['reason'])) {
1663 $errorCounter++;
1664 $response['message'] = "Please provide reason";
1665 } else if(!isset($postData['reason']) || empty($postData['reason'])) {
1666 $errorCounter++;
1667 $response['message'] = "Please provide reason";
1668 } else {
1669 $nonce = $postData['nonce'];
1670 if(!wp_verify_nonce($nonce, 'mystickymenu_deactivate_nonce')) {
1671 $response['message'] = __("Your request is not valid", "mystickymenu");
1672 $errorCounter++;
1673 $response['valid'] = 0;
1674 }
1675 }
1676 if($errorCounter == 0) {
1677 global $current_user;
1678 $plugin_info = get_plugin_data( dirname(__FILE__) . "/mystickymenu.php" );
1679 $postData = $_POST;
1680 $email = "none@none.none";
1681
1682 if (isset($postData['email_id']) && !empty($postData['email_id']) && filter_var($postData['email_id'], FILTER_VALIDATE_EMAIL)) {
1683 $email = $postData['email_id'];
1684 }
1685 $domain = site_url();
1686 $user_name = $current_user->first_name . " " . $current_user->last_name;
1687
1688 $response['status'] = 1;
1689
1690 /* sending message to Crisp */
1691 $post_message = array();
1692
1693 $message_data = array();
1694 $message_data['key'] = "Plugin";
1695 $message_data['value'] = "My Sticky Bar";
1696 $post_message[] = $message_data;
1697
1698 $message_data = array();
1699 $message_data['key'] = "Plugin Version";
1700 $message_data['value'] = $plugin_info['Version'];
1701 $post_message[] = $message_data;
1702
1703 $message_data = array();
1704 $message_data['key'] = "Domain";
1705 $message_data['value'] = $domain;
1706 $post_message[] = $message_data;
1707
1708 $message_data = array();
1709 $message_data['key'] = "Email";
1710 $message_data['value'] = $email;
1711 $post_message[] = $message_data;
1712
1713 $message_data = array();
1714 $message_data['key'] = "WordPress Version";
1715 $message_data['value'] = esc_attr(get_bloginfo('version'));
1716 $post_message[] = $message_data;
1717
1718 $message_data = array();
1719 $message_data['key'] = "PHP Version";
1720 $message_data['value'] = PHP_VERSION;
1721 $post_message[] = $message_data;
1722
1723 $message_data = array();
1724 $message_data['key'] = "Message";
1725 $message_data['value'] = $postData['reason'];
1726 $post_message[] = $message_data;
1727
1728 $api_params = array(
1729 'domain' => $domain,
1730 'email' => $email,
1731 'url' => site_url(),
1732 'name' => $user_name,
1733 'message' => $post_message,
1734 'plugin' => "My Sticky Bar",
1735 'type' => "Uninstall",
1736 );
1737
1738 /* Sending message to Crisp API */
1739 $crisp_response = wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => true));
1740
1741 if (is_wp_error($crisp_response)) {
1742 wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
1743 }
1744 }
1745 echo json_encode($response);
1746 wp_die();
1747 }
1748
1749 /* *
1750 * Mysticky Menu : Contact Lead function for show all the lead which send by user.
1751 * DATE : 2022-08-04
1752 * */
1753
1754 public function mystickymenu_admin_leads_page(){
1755 global $wpdb;
1756 $is_shown = myStickyMenu_SIGNUP_CLASS::check_modal_status();
1757 if($is_shown) {
1758 include_once MYSTICKYMENU_PATH . 'admin/email-signup.php';
1759 return;
1760 }
1761 $where_search = '';
1762 $table_name = $wpdb->prefix . "mystickymenu_contact_lists";
1763 $elements_widgets = get_option( 'mystickymenu-welcomebars' );
1764
1765 $custom_fields = array();
1766 if ( !empty($elements_widgets)) {
1767 foreach( $elements_widgets as $key=>$value) {
1768 $widget_no = '-'.$key;
1769 if ( $key == 0 ) {
1770 $widget_no = '';
1771 }
1772 }
1773 }
1774
1775 $download_file_url = plugins_url('mystickymenu-contact-leads.php?download_file=mystickybar_contact_leads.csv',__FILE__);
1776 ?>
1777 <!-- /**/ */ -->
1778 <div class="wrap mystickymenu-contact-wrap">
1779 <h2><?php esc_html_e( 'Contact Form Leads', 'mystickymenu' ); ?></h2>
1780 <p class="description">
1781 <strong><?php esc_html_e("Contact's data is saved locally do make backup or export before uninstalling plugin", 'mystickymenu');?></strong>
1782 </p>
1783 <div>
1784 <div class="mystickymenu-btnmbox">
1785 <div class="mystickymenu-btnbx">
1786 <strong><?php esc_html_e('Download & Export All Subscriber to CSV file:','mystickymenu' );?> </strong>
1787 <a href="<?php echo esc_url(wp_nonce_url($download_file_url,'MSB_file_download', 'mystickymenu_nonce')); ?>" class="wpappp_buton" id="wpappp_export_to_csv" value="Export to CSV" href="#"><?php esc_html_e('Download & Export to CSV', 'mystickymenu' );?></a>
1788 </div>
1789 <div class="mystickymenu-btnbx">
1790 <strong><?php esc_html_e('Delete All Subscibers from Database:','mystickymenu');?> </strong>
1791
1792 <input type="button" class="wpappp_buton" id="mystickymenu_delete_all_leads" value="<?php esc_attr_e('Delete All Data', 'mystickymenu' );?>" />
1793 </div>
1794 </div>
1795 <input type="hidden" id="delete_nonce" name="delete_nonce" value="<?php echo esc_attr(wp_create_nonce("mysticky_menu_delete_nonce")) ?>" />
1796 </div>
1797
1798 <?php
1799 if ( isset($_REQUEST['search-contact']) && $_REQUEST['search-contact'] != '' ) {
1800 $where_search = "WHERE contact_name like '%" . $_REQUEST['search-contact'] . "%' OR contact_email like '%".$_REQUEST['search-contact']."%' OR contact_phone like '%".$_REQUEST['search-contact']."%' OR widget_name like '%".$_REQUEST['search-contact']."%' ";
1801 }
1802 ?>
1803 <div>
1804 <div class="tablenav top">
1805 <form action="<?php echo esc_url(admin_url("admin.php?page=my-sticky-menu-leads"));?>" method="post">
1806 <div class="alignleft actions bulkactions">
1807 <select name="action" id="bulk-action-selector-top">
1808 <option value="">Bulk Actions</option>
1809 <option value="delete_message">Delete</option>
1810 </select>
1811 <input type="submit" id="doaction" class="button action" value="Apply">
1812 <?php wp_nonce_field( 'stickyelement-contatc-submit', 'stickyelement-contatc-submit' ); ?>
1813 </div>
1814 </form>
1815 <form action="<?php echo esc_url(admin_url("admin.php?page=my-sticky-menu-leads"));?>" method='get'>
1816 <input type="hidden" name="page" value='my-sticky-menu-leads'/>
1817 <p class="search-box">
1818 <label class="screen-reader-text" for="post-search-input"><?php esc_html_e( 'Search', 'mystickymenu');?></label>
1819 <input type="search" id="post-search-input" name="search-contact" value="<?php echo (isset($_GET['search-contact']) && $_GET['search-contact'] != '') ? esc_attr($_GET['search-contact']) : ''; ?>" placeholder="Search by name, email, phone, widget name">
1820 <input type="submit" id="search-submit" class="button" value="<?php esc_html_e( 'Search', 'mystickymenu');?>">
1821 </p>
1822 </form>
1823 </div>
1824
1825 <table border="1" class="responstable">
1826 <tr>
1827 <th style="width:1%"><?php esc_html_e( 'Bulk', 'mystickymenu' );?></th>
1828 <th><?php esc_html_e( 'ID', 'mystickymenu');?></th>
1829 <th><?php esc_html_e( 'Widget Name', 'mystickymenu');?></th>
1830 <th><?php esc_html_e( 'Name', 'mystickymenu');?></th>
1831 <th><?php esc_html_e( 'Email', 'mystickymenu');?></th>
1832 <th><?php esc_html_e( 'Phone', 'mystickymenu');?></th>
1833 <th><?php esc_html_e( 'Date', 'mystickymenu');?></th>
1834 <th><?php esc_html_e( 'URL', 'mystickymenu');?></th>
1835 <th style="width:11%"><?php esc_html_e( 'Delete', 'mystickymenu');?></th>
1836 </tr>
1837 <?php
1838 $customPagHTML = "";
1839 $total_query = "SELECT count(*) FROM ".$table_name ." {$where_search} ORDER BY ID DESC";
1840 $total = $wpdb->get_var( $total_query );
1841 $items_per_page = 20;
1842 $page = ( isset( $_GET['cpage'] ) ) ? abs( (int) $_GET['cpage'] ) : 1;
1843 $offset = ( $page * $items_per_page ) - $items_per_page;
1844 $query = "SELECT * FROM " . $table_name ." {$where_search} ORDER BY ID DESC LIMIT {$offset}, {$items_per_page}";
1845 $result = $wpdb->get_results( $query );
1846 $total_page = ceil($total / $items_per_page);
1847
1848 if($result){
1849
1850 foreach ( $result as $res ) { ?>
1851
1852 <tr>
1853 <td><input id="cb-select-80" class="cb-select-blk" type="checkbox" name="delete_message[]" value="<?php echo esc_attr($res->ID);?>"></td>
1854 <td><?php echo esc_html($res->ID);?></td>
1855
1856 <td>
1857 <?php if($res->widget_id !== NULL): ?>
1858 <a target="_blank" href="<?php echo admin_url( 'admin.php?page=my-stickymenu-welcomebar&widget=' . $res->widget_id . '&isedit=1' );?>"><?php echo esc_html($res->widget_name);?></a>
1859 <?php else: ?>
1860 <?php echo esc_html($res->widget_name);?>
1861 <?php endif; ?>
1862 </td>
1863
1864 <td><?php echo esc_html($res->contact_name);?></td>
1865 <td><?php echo esc_html($res->contact_email);?></td>
1866 <td><?php echo esc_html($res->contact_phone);?></td>
1867 <td><?php echo ( isset($res->message_date) ) ? esc_html($res->message_date) : '-' ;?></td>
1868 <td>
1869 <?php if ( $res->page_link) :?>
1870 <a class="external-link" href="<?php echo esc_url($res->page_link);?>" target="_blank"><span class="dashicons dashicons-external"></span></a>
1871 <?php endif;?>
1872 </td>
1873
1874 <td>
1875 <input type="button" data-delete="<?php echo esc_attr($res->ID);?>" class="mystickymenu-delete-entry" value="<?php esc_attr_e('Delete', 'mystickymenu');?>" />
1876 </td>
1877 </tr>
1878 <?php }
1879 } else { ?>
1880 <tr>
1881 <td colspan="9" align="center">
1882 <p class="mystickymenu-no-contact"> <?php esc_html_e('No Contact Form Leads Found!','mystickymenu');?>
1883 </p>
1884 </td>
1885 </tr>
1886 <?php } ?>
1887
1888 </table>
1889
1890 <?php if($total_page > 1){ ?>
1891 <div class="contactleads-pagination">
1892 <?php
1893 $big = 999999999; // need an unlikely integer
1894 echo paginate_links( array(
1895 'base' => add_query_arg( 'cpage', '%#%' ),
1896 'format' => '',
1897 'current' => $page,
1898 'total' => $total_page
1899 ) );?>
1900 </div>
1901 <?php }?>
1902 </form>
1903 </div>
1904 </div>
1905
1906 <!-- -->
1907 <?php
1908 }
1909
1910 public function mystickymenu_review_box() {
1911
1912 if (current_user_can('manage_options')) {
1913 $nonce = filter_input(INPUT_POST, 'nonce');
1914 $days = filter_input(INPUT_POST, 'days');
1915 if (!empty($nonce) && wp_verify_nonce($nonce, 'mystickymenu')) {
1916 if ($days == -1) {
1917 add_option("my-sticky-menu_hide_review_box", "1");
1918 update_option("get_mystickybar_page_views", -1);
1919 } else {
1920 $date = date("Y-m-d", strtotime("+".$days." days"));
1921 update_option("my-sticky-menu_show_review_box_after", $date);
1922 update_option("get_mystickybar_page_views", 4);
1923 }
1924 }
1925 }
1926 wp_die();
1927 }
1928
1929 public function mystickymenu_review_box_message (){
1930 if (current_user_can('manage_options')) {
1931 $nonce = filter_input(INPUT_POST, 'nonce');
1932 if (!empty($nonce) && wp_verify_nonce($nonce, 'mystickymenu')) {
1933 add_option("my-sticky-menu_hide_review_box", "1");
1934 update_option("get_mystickybar_page_views", -1);
1935 $rating = filter_input(INPUT_POST, 'rating');
1936 $message = filter_input(INPUT_POST, 'message');
1937
1938 if ( $message != '' ) {
1939 global $current_user;
1940 $postMessage = [];
1941
1942 $domain = site_url();
1943 $user_name = $current_user->first_name." ".$current_user->last_name;
1944 $email = $current_user->user_email;
1945
1946 $messageData = [];
1947 $messageData['key'] = "email";
1948 $messageData['value'] = $email;
1949 $postMessage[] = $messageData;
1950
1951 $messageData = [];
1952 $messageData['key'] = "website";
1953 $messageData['value'] = $domain;
1954 $postMessage[] = $messageData;
1955
1956 $messageData = [];
1957 $messageData['key'] = "message";
1958 $messageData['value'] = $message;
1959 $postMessage[] = $messageData;
1960
1961 $messageData = [];
1962 $messageData['key'] = "rating";
1963 $messageData['value'] = $rating;
1964 $postMessage[] = $messageData;
1965
1966 $apiParams = [
1967 'title' => 'Review for My Sticky Bar WordPress',
1968 'domain' => $domain,
1969 'email' => "contact@premio.io",
1970 'url' => site_url(),
1971 'name' => $user_name,
1972 'message' => $postMessage,
1973 'plugin' => 'My Sticky Bar',
1974 'type' => "Review",
1975 ];
1976
1977 // Sending message to Crisp API
1978 $apiResponse = wp_safe_remote_post("https://premioapps.com/premio/send-feedback-api.php", ['body' => $apiParams, 'timeout' => 15, 'sslverify' => true]);
1979
1980 if (is_wp_error($apiResponse)) {
1981 wp_safe_remote_post("https://premioapps.com/premio/send-feedback-api.php", ['body' => $apiParams, 'timeout' => 15, 'sslverify' => false]);
1982 }
1983 }
1984 }
1985 wp_die();
1986 }
1987 }
1988 }
1989
1990
1991
1992 class MyStickyMenuFrontend
1993 {
1994
1995 public function __construct()
1996 {
1997 add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
1998 add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) );
1999
2000 add_action('wp_ajax_stickymenu_contact_lead_form', array($this, 'stickymenu_contact_lead_form'));
2001 add_action('wp_ajax_nopriv_stickymenu_contact_lead_form', array($this, 'stickymenu_contact_lead_form'));
2002 }
2003
2004 public function mysticky_build_stylesheet_content() {
2005
2006 $mysticky_options = get_option( 'mysticky_option_name' );
2007
2008 if (isset($mysticky_options['disable_css'])) {
2009 //do nothing
2010 } else {
2011 $mysticky_options['disable_css'] = false;
2012 }
2013
2014 if ($mysticky_options ['disable_css'] == false ) {
2015
2016 echo '<style id="mystickymenu" type="text/css">';
2017 echo '#mysticky-nav { width:100%; position: static; height: auto !important; }';
2018 echo '#mysticky-nav.wrapfixed { position:fixed; left: 0px; margin-top:0px; z-index: '. esc_attr($mysticky_options ['myfixed_zindex']) .'; -webkit-transition: ' . esc_attr($mysticky_options ['myfixed_transition_time']) . 's; -moz-transition: ' . esc_attr($mysticky_options ['myfixed_transition_time']) . 's; -o-transition: ' . esc_attr($mysticky_options ['myfixed_transition_time']) . 's; transition: ' . esc_attr($mysticky_options ['myfixed_transition_time']) . 's; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=' . esc_attr($mysticky_options ['myfixed_opacity']) . ')"; filter: alpha(opacity=' . esc_attr($mysticky_options ['myfixed_opacity']) . '); opacity:' . esc_attr($mysticky_options ['myfixed_opacity']) / 100 . '; background-color: ' . esc_attr($mysticky_options ['myfixed_bgcolor']) . ';}';
2019
2020 echo '#mysticky-nav.wrapfixed .myfixed{ background-color: ' . esc_attr($mysticky_options ['myfixed_bgcolor']) . '; position: relative;top: auto;left: auto;right: auto;}';
2021
2022 if ( isset($mysticky_options ['myfixed_textcolor']) && $mysticky_options ['myfixed_textcolor'] != '' ) {
2023 echo '#mysticky-nav.wrapfixed ul li.menu-item a { color: ' . esc_attr($mysticky_options ['myfixed_textcolor']) . ';}';
2024 }
2025
2026
2027 if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
2028 //echo '@media (max-width: '.$mysticky_options['myfixed_disable_small_screen'].'px) {#mysticky-nav.wrapfixed {position: static;} }';
2029 };
2030 if ( !isset( $mysticky_options['myfixed_cssstyle'] ) ) {
2031 echo '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }';
2032 }
2033 if ( isset( $mysticky_options['myfixed_cssstyle'] ) && $mysticky_options['myfixed_cssstyle'] != '' ) {
2034 echo esc_attr($mysticky_options ['myfixed_cssstyle']);
2035 }
2036 echo '</style>';
2037 $template_name = get_template();
2038 ?>
2039 <style type="text/css">
2040 <?php if( $template_name == 'hestia' ) { ?>
2041 #mysticky-nav.wrapfixed {box-shadow: 0 1px 10px -6px #0000006b,0 1px 10px 0 #0000001f,0 4px 5px -2px #0000001a;}
2042 #mysticky-nav.wrapfixed .navbar {position: relative;background-color: transparent;box-shadow: none;}
2043 <?php } ?>
2044 <?php if( $template_name == 'shapely' ) { ?>
2045 #mysticky-nav.wrapfixed #site-navigation {position: relative;}
2046 <?php } ?>
2047 <?php if( $template_name == 'storefront' ) { ?>
2048 #mysticky-nav.wrapfixed > .site-header {margin-bottom: 0;}
2049 #mysticky-nav.wrapfixed > .storefront-primary-navigation {padding: 10px 0;}
2050 <?php } ?>
2051 <?php if( $template_name == 'transportex' ) { ?>
2052 #mysticky-nav.wrapfixed > .transportex-menu-full {margin: 0 auto;}
2053 .transportex-headwidget #mysticky-nav.wrapfixed .navbar-wp {top: 0;}
2054 <?php } ?>
2055 <?php if( $template_name == 'twentynineteen' ) { ?>
2056 #mysticky-nav.wrapfixed {padding: 10px;}
2057 <?php } ?>
2058 <?php if( $template_name == 'twentysixteen' ) { ?>
2059 #mysticky-nav.wrapfixed > .site-header {padding-top: 0;padding-bottom: 0;}
2060 <?php } ?>
2061 <?php if( $template_name == 'twentytwenty' ) { ?>
2062 #site-header {background: transparent;}
2063 <?php } ?>
2064 </style>
2065 <?php
2066 }
2067 }
2068
2069 public function mystickymenu_google_fonts_url() {
2070 $welcomebar = get_option( 'mysticky_option_welcomebar' );
2071
2072 $default_fonts = array('System Stack','Arial', 'Tahoma', 'Verdana', 'Helvetica', 'Times New Roman', 'Trebuchet MS', 'Georgia' );
2073 $fonts_url = '';
2074 $fonts = array();
2075 $font_args = array();
2076 $base_url = "https://fonts.googleapis.com/css";
2077 $fonts['family']['Lato'] = 'Lato:400,500,600,700';
2078 if ( isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] !='' && !in_array( $welcomebar['mysticky_welcomebar_font'], $default_fonts) ) {
2079 $fonts['family'][$welcomebar['mysticky_welcomebar_font']] = $welcomebar['mysticky_welcomebar_font'] . ':400,500,600,700';
2080 }
2081 if ( isset($welcomebar['mysticky_welcomebar_btnfont']) && $welcomebar['mysticky_welcomebar_btnfont'] !='' && !in_array( $welcomebar['mysticky_welcomebar_btnfont'], $default_fonts) ) {
2082 $fonts['family'][$welcomebar['mysticky_welcomebar_btnfont']] = $welcomebar['mysticky_welcomebar_btnfont'] . ':400,500,600,700';
2083 }
2084
2085 /* Prepapre URL if font family defined. */
2086 if( !empty( $fonts['family'] ) ) {
2087
2088 /* format family to string */
2089 if( is_array($fonts['family']) ){
2090 $fonts['family'] = implode( '|', $fonts['family'] );
2091 }
2092
2093 $font_args['family'] = urlencode( trim( $fonts['family'] ) );
2094
2095 if( !empty( $fonts['subsets'] ) ){
2096
2097 /* format subsets to string */
2098 if( is_array( $fonts['subsets'] ) ){
2099 $fonts['subsets'] = implode( ',', $fonts['subsets'] );
2100 }
2101
2102 $font_args['subsets'] = urlencode( trim( $fonts['subsets'] ) );
2103 }
2104
2105 $fonts_url = add_query_arg( $font_args, $base_url );
2106 }
2107
2108 return esc_url_raw( $fonts_url );
2109 }
2110
2111 public function mystickymenu_script() {
2112
2113 wp_enqueue_script( 'jquery' );
2114
2115 $suffix = MSM_DEV_MODE ? '' : '.min';
2116
2117 $mysticky_options = get_option( 'mysticky_option_name' );
2118
2119 if ( is_admin_bar_showing() ) {
2120 $top = "true";
2121 } else {
2122 $top = "false";
2123 }
2124
2125 $welcomebar = get_option( 'mysticky_option_welcomebar' );
2126 if ( isset($welcomebar['mysticky_welcomebar_enable']) && $welcomebar['mysticky_welcomebar_enable'] == 1 ) {
2127 wp_enqueue_style('google-fonts', $this->mystickymenu_google_fonts_url(),array(), MYSTICKY_VERSION );
2128 }
2129
2130 wp_enqueue_script(
2131 'morphext-js',
2132 plugins_url("/js/morphext/morphext{$suffix}.js", __FILE__),
2133 array('jquery'),
2134 MYSTICKY_VERSION,
2135 ['strategy' => 'defer', 'in_footer'=> true ]
2136 );
2137 wp_register_script('welcomebar-frontjs', plugins_url("/js/welcomebar-front{$suffix}.js", __FILE__), array( 'jquery', 'morphext-js' ), MYSTICKY_VERSION, ['strategy' => 'defer', 'in_footer'=> true ]);
2138 wp_enqueue_script('welcomebar-frontjs');
2139
2140 wp_localize_script( 'welcomebar-frontjs', 'welcomebar_frontjs',
2141 array(
2142 'ajaxurl' => admin_url( 'admin-ajax.php' ) ,
2143 'days' => __( 'Days', 'mystickymenu' ),
2144 'hours' => __( 'Hours', 'mystickymenu' ),
2145 'minutes' => __( 'Minutes', 'mystickymenu' ),
2146 'seconds' => __( 'Seconds', 'mystickymenu' ),
2147 'ajax_nonce' => wp_create_nonce('mystickymenu'),
2148 )
2149 );
2150
2151 if( !isset($mysticky_options['stickymenu_enable']) || isset($mysticky_options['stickymenu_enable']) && $mysticky_options['stickymenu_enable'] == 0){
2152 return;
2153 }
2154 // needed for update 1.7 => 1.8 ... will be removed in the future ()
2155 if (isset($mysticky_options['mysticky_active_on_height_home'])) {
2156 //do nothing
2157 } else {
2158 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
2159 }
2160
2161
2162 if ($mysticky_options['mysticky_active_on_height_home'] == 0 ) {
2163 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
2164 }
2165
2166
2167 if ( is_front_page() && is_home() ) {
2168
2169 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
2170
2171 } elseif ( is_front_page()){
2172
2173 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
2174
2175 }
2176 wp_register_script('detectmobilebrowser', plugins_url( "js/detectmobilebrowser{$suffix}.js", __FILE__ ), array('jquery'), MYSTICKY_VERSION, ['strategy' => 'defer', 'in_footer'=> true ]);
2177 wp_enqueue_script( 'detectmobilebrowser' );
2178
2179 wp_register_script(
2180 'mystickymenu',
2181 plugins_url("js/mystickymenu{$suffix}.js", __FILE__),
2182 array('jquery'),
2183 MYSTICKY_VERSION,
2184 ['strategy' => 'defer', 'in_footer'=> true ]
2185 );
2186 wp_enqueue_script( 'mystickymenu' );
2187
2188
2189
2190 $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? esc_attr($mysticky_options['myfixed_disable_scroll_down']) : 'false';
2191 $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? esc_attr($mysticky_options['myfixed_fade']) : 'fade';
2192 $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? esc_attr($mysticky_options['myfixed_disable_large_screen']) : '0';
2193
2194 $mystickyClass = ( $mysticky_options['mysticky_class_id_selector'] != 'custom') ? '.menu-' . $mysticky_options['mysticky_class_id_selector'] .'-container' : $mysticky_options['mysticky_class_selector'];
2195
2196 if ( $mysticky_options['mysticky_class_id_selector'] != 'custom' ) {
2197 $template_name = get_template();
2198 switch( $template_name ){
2199 case 'ashe':
2200 $mystickyClass = '#main-nav';
2201 break;
2202 case 'astra':
2203 case 'hello-elementor':
2204 case 'sydney':
2205 case 'twentysixteen':
2206 $mystickyClass = 'header.site-header';
2207 break;
2208 case 'generatepress':
2209 $mystickyClass = 'nav.main-navigation';
2210 break;
2211 case 'transportex':
2212 $mystickyClass = '.transportex-menu-full';
2213 break;
2214 case 'hestia':
2215 case 'neve':
2216 $mystickyClass = 'header.header';
2217 break;
2218 case 'mesmerize':
2219 $mystickyClass = '.navigation-bar';
2220 break;
2221 case 'oceanwp':
2222 $mystickyClass = 'header#site-header';
2223 break;
2224 case 'shapely':
2225 $mystickyClass = '#site-navigation';
2226 break;
2227 case 'storefront':
2228 $mystickyClass = '.storefront-primary-navigation';
2229 break;
2230 case 'twentynineteen':
2231 $mystickyClass = '#site-navigation';
2232 break;
2233 case 'twentyseventeen':
2234 $mystickyClass = '.navigation-top';
2235 break;
2236 default:
2237 break;
2238 }
2239 }
2240
2241
2242 $mysticky_translation_array = array(
2243 'mystickyClass' => $mystickyClass,
2244 'activationHeight' => $mysticky_options['mysticky_active_on_height'],
2245 'disableWidth' => $mysticky_options['myfixed_disable_small_screen'],
2246 'disableLargeWidth' => $mystickyDisableLarge,
2247 'adminBar' => $top,
2248 'device_desktop' => true,
2249 'device_mobile' => true,
2250 'mystickyTransition' => $mystickyTransition,
2251 'mysticky_disable_down' => $myfixed_disable_scroll_down,
2252
2253
2254 );
2255 wp_localize_script( 'mystickymenu', 'option', $mysticky_translation_array );
2256 }
2257
2258 public function mysticky_disable_at() {
2259
2260
2261 $mysticky_options = get_option( 'mysticky_option_name' );
2262
2263 $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']);
2264 $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']);
2265 $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']);
2266 $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']);
2267 $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']);
2268 $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']);
2269 $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']);
2270 $mysticky_disable_at_search = isset($mysticky_options['mysticky_disable_at_search']);
2271 $mysticky_disable_at_404 = isset($mysticky_options['mysticky_disable_at_404']);
2272 $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? esc_attr($mysticky_options['mysticky_enable_at_pages']) : '';
2273 $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? esc_attr($mysticky_options['mysticky_enable_at_posts']) : '';
2274
2275 // Trim input to ignore empty spaces
2276 $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages));
2277 $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts));
2278
2279
2280
2281
2282 if ( is_front_page() && is_home() ) { /* Default homepage */
2283
2284 if ( $mysticky_disable_at_front_home == false ) {
2285 $this->mystickymenu_script();
2286 }
2287 } elseif ( is_front_page()){ /* Static homepage */
2288
2289 if ( $mysticky_disable_at_front_home == false ) {
2290 $this->mystickymenu_script();
2291 }
2292
2293 } elseif ( is_home()){ /* Blog page */
2294
2295 if ( $mysticky_disable_at_blog == false ) {
2296 $this->mystickymenu_script();
2297 }
2298
2299 } elseif ( is_page() ){ /* Single page*/
2300
2301 if ( $mysticky_disable_at_page == false ) {
2302 $this->mystickymenu_script();
2303 }
2304 if ( is_page( $mysticky_enable_at_pages_exp ) ){
2305 $this->mystickymenu_script();
2306 }
2307
2308 } elseif ( is_tag()){ /* Tag page */
2309
2310 if ( $mysticky_disable_at_tag == false ) {
2311 $this->mystickymenu_script();
2312 }
2313
2314 } elseif ( is_category()){ /* Category page */
2315
2316 if ( $mysticky_disable_at_category == false ) {
2317 $this->mystickymenu_script();
2318 }
2319
2320 } elseif ( is_single()){ /* Single post */
2321
2322 if ( $mysticky_disable_at_single == false ) {
2323 $this->mystickymenu_script();
2324 }
2325
2326 if ( is_single( $mysticky_enable_at_posts_exp ) ){
2327 $this->mystickymenu_script();
2328 }
2329
2330 } elseif ( is_archive()){ /* Archive */
2331
2332 if ( $mysticky_disable_at_archive == false ) {
2333 $this->mystickymenu_script();
2334 }
2335
2336 } elseif ( is_search()){ /* Search */
2337
2338 if ( $mysticky_disable_at_search == false ) {
2339 $this->mystickymenu_script();
2340 }
2341
2342 } elseif ( is_404()){ /* 404 */
2343
2344 if ( $mysticky_disable_at_404 == false ) {
2345 $this->mystickymenu_script();
2346 }
2347 }
2348
2349 }
2350
2351 /**
2352 * Mysticky Menu: Contact Form Lead Submission Function
2353 * DATE : 2022-08-04
2354 * */
2355
2356 public function stickymenu_contact_lead_form(){
2357 global $wpdb;
2358 global $wp;
2359 $stickymenus_widgets = get_option( 'mystickymenu-welcomebars' );
2360 $errors = array();
2361 $element_widget_no = $_POST['widget_id'];
2362
2363 $element_widget_name = (isset($stickymenus_widgets[$element_widget_no]) && $stickymenus_widgets[$element_widget_no] != '' ) ? esc_html($stickymenus_widgets[$element_widget_no]) : '';
2364
2365 $flag = true;
2366 if( isset($element_widget_name) && $element_widget_name != ''){
2367 if( !isset($_POST['contact_name']) || $_POST['contact_name'] == ''){
2368 $error = array(
2369 'key' => "contact-form-name",
2370 'message' => __( "This field is required", "mystickymenu" )
2371 );
2372 $errors[] = $error;
2373 $flag = false;
2374 }else{
2375 $contact_lists_table = $wpdb->prefix . 'mystickymenu_contact_lists';
2376 $postArr = $_POST;
2377
2378 if( $element_widget_no == 0 ){
2379 $element_widget_no = '';
2380 }
2381
2382 $allowed_keys = ['contact_name', 'contact_email', 'contact_phone', 'page_link'];
2383 $params = [];
2384 foreach ($allowed_keys as $key) {
2385 if (isset($_POST[$key]) && $_POST[$key] !== '') {
2386 $params[$key] = sanitize_text_field($_POST[$key]);
2387 }
2388 }
2389
2390 if(!empty($params)) {
2391 $params["widget_id"] = esc_sql(sanitize_text_field($element_widget_no));
2392 $params["widget_name"] = esc_sql(sanitize_text_field($element_widget_name));
2393 $params["message_date"] = date('Y-m-d H:i:s');
2394 $params["contact_email"] = (isset($params["contact_email"]) && $params["contact_email"] != '') ? sanitize_email($params["contact_email"]) : '';
2395
2396 $wpdb->insert($contact_lists_table, $params);
2397 die;
2398 }
2399 }
2400 }
2401
2402 if( $flag != true ){
2403 echo json_encode(array("status" => 0, "error" => 1, "errors" => $errors, "message" => $errors['message']));
2404 }
2405 die;
2406 }
2407
2408 }
2409
2410 new MyStickyMenuBackend();
2411 new MyStickyMenuFrontend();
2412
2413 register_activation_hook( __FILE__, 'mystickymenu_activate' );
2414
2415 function mystickymenu_activate() {
2416 update_option( 'update_mysticky_version_2_5_7', true );
2417
2418 global $wpdb;
2419 require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
2420 $charset_collate = $wpdb->get_charset_collate();
2421
2422 $contact_lists_table = $wpdb->prefix . 'mystickymenu_contact_lists';
2423
2424 if ($wpdb->get_var("show tables like '$contact_lists_table'") != $contact_lists_table) {
2425
2426 $contact_lists_table_sql = "CREATE TABLE $contact_lists_table (
2427 ID int(11) NOT NULL AUTO_INCREMENT,
2428 widget_id INT(11) NULL,
2429 contact_name varchar(255) NULL,
2430 contact_phone varchar(255) NULL,
2431 contact_email varchar(255) NULL,
2432 widget_name varchar(255) NULL,
2433 page_link varchar(522) NULL,
2434 message_date DATETIME NOT NULL default '0000-00-00 00:00:00',
2435 PRIMARY KEY (ID)
2436 ) $charset_collate;";
2437 dbDelta($contact_lists_table_sql);
2438 }
2439 }
2440
2441
2442 add_action( 'admin_init' , 'mystickymenu_admin_init' );
2443
2444 function mystickymenu_admin_init(){
2445
2446 global $wpdb;
2447 require_once( ABSPATH . 'wp-admin/includes/upgrade.php');
2448 $charset_collate = $wpdb->get_charset_collate();
2449
2450 $contact_lists_table = $wpdb->prefix . 'mystickymenu_contact_lists';
2451
2452 if ($wpdb->get_var("show tables like '$contact_lists_table'") != $contact_lists_table) {
2453
2454 $contact_lists_table_sql = "CREATE TABLE $contact_lists_table (
2455 ID int(11) NOT NULL AUTO_INCREMENT,
2456 widget_id INT(11) NULL,
2457 contact_name varchar(255) NULL,
2458 contact_phone varchar(255) NULL,
2459 contact_email varchar(255) NULL,
2460 widget_name varchar(255) NULL,
2461 page_link varchar(522) NULL,
2462 message_date DATETIME NOT NULL default '0000-00-00 00:00:00',
2463 PRIMARY KEY (ID)
2464 ) $charset_collate;";
2465 dbDelta($contact_lists_table_sql);
2466 }
2467
2468 if(get_option('msb_cl_widget_id_exists', false) == false){
2469 // Check if the column already exists
2470
2471 $column_exists = $wpdb->get_results(
2472 $wpdb->prepare(
2473 "SHOW COLUMNS FROM $contact_lists_table LIKE %s",
2474 'widget_id'
2475 )
2476 );
2477
2478 if (empty($column_exists)) {
2479 update_option('msb_cl_widget_id_exists', true);
2480 $wpdb->query(
2481 "ALTER TABLE $contact_lists_table ADD COLUMN widget_id INT(11) NULL AFTER ID"
2482 );
2483 }
2484 }
2485
2486 }
2487
2488 function mystickymenu_change_menu_text() {
2489 global $submenu;
2490 if(isset($submenu['my-stickymenu-welcomebar'])) {
2491 $totalItems = count($submenu['my-stickymenu-welcomebar'])-1;
2492 if(isset($submenu['my-stickymenu-welcomebar'][$totalItems][0])) {
2493 $submenu['my-stickymenu-welcomebar'][$totalItems][0] = '<span><svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
2494 <path d="M13.0518 4.01946C12.9266 3.91499 12.7747 3.84781 12.6132 3.82557C12.4517 3.80333 12.2872 3.82693 12.1385 3.89367L9.3713 5.12414L7.76349 2.22571C7.68664 2.09039 7.5753 1.97785 7.44081 1.89956C7.30632 1.82127 7.15348 1.78003 6.99786 1.78003C6.84224 1.78003 6.6894 1.82127 6.55491 1.89956C6.42042 1.97785 6.30908 2.09039 6.23224 2.22571L4.62442 5.12414L1.85724 3.89367C1.70822 3.82703 1.54352 3.8034 1.38178 3.82545C1.22003 3.84751 1.06768 3.91437 0.941941 4.01849C0.816207 4.1226 0.722106 4.25982 0.670275 4.41461C0.618444 4.56941 0.610951 4.73562 0.648642 4.89446L2.0377 10.8171C2.06427 10.9318 2.11383 11.0399 2.18339 11.1348C2.25295 11.2297 2.34107 11.3096 2.44239 11.3695C2.57957 11.4516 2.73642 11.495 2.8963 11.4952C2.97402 11.4951 3.05133 11.484 3.12599 11.4624C5.65792 10.7624 8.33233 10.7624 10.8643 11.4624C11.0955 11.5232 11.3413 11.4898 11.5479 11.3695C11.6498 11.3103 11.7384 11.2307 11.8081 11.1357C11.8777 11.0406 11.9269 10.9321 11.9525 10.8171L13.3471 4.89446C13.3843 4.73558 13.3764 4.56945 13.3243 4.41482C13.2721 4.2602 13.1777 4.12326 13.0518 4.01946V4.01946Z" fill="white"/>
2495 </svg></span> '.esc_html__( 'Upgrade to Pro' , 'mystickymenu');
2496 }
2497 }
2498 }
2499 add_action('admin_init', 'mystickymenu_change_menu_text');
2500
2501 add_action('admin_footer', 'mystickymenu_admin_footer_style');
2502 function mystickymenu_admin_footer_style() {
2503 ?>
2504 <style>
2505 #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child {
2506 padding: 5px 10px;
2507 }
2508 #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child a {
2509 display: flex;
2510 background-color: #B78DEB;
2511 border-radius: 6px;
2512 font-size: 12px;
2513 gap: 4px;
2514 padding: 4px 8px;
2515 color: #ffffff;
2516 align-items: center;
2517 transition: all 0.2s linear;
2518 font-weight: normal;
2519 box-shadow: 0px 6px 8px 0px #B78DEB3D;
2520 justify-content: center;
2521 }
2522 #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child a:hover, #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child a.current {
2523 box-shadow: 0px 6px 8px 0px #B78DEB3D;
2524 color: #ffffff;
2525 background-color: #9565d0;
2526 font-weight: normal;
2527 }
2528 #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child a span {
2529 flex: 0 0 16px;
2530 height: 16px;
2531 background-color: #c5a4ef;
2532 border-radius: 4px;
2533 padding: 2px;
2534 display: inline-flex;
2535 transition: all 0.2s linear;
2536 }
2537 #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child a:hover span {
2538 background-color: #B78DEB;
2539 }
2540 #adminmenu .toplevel_page_my-stickymenu-welcomebar > ul > li:last-child a span svg {
2541 width: 100%;
2542 height: 100%;
2543 }
2544 </style>
2545 <?php
2546 }
2547
2548
2549 /*
2550 * Sanitize Sticky Bar option fields
2551 * Return $sanitized_array Sanitize array
2552 *
2553 * @since 2.7.3
2554 */
2555 function mysticky_bar_sanitize_options( $welcomebar_options ) {
2556 $sanitized_array = [];
2557 foreach ($welcomebar_options as $key => $value) {
2558
2559 if (is_array($value)) {
2560 $sanitized_array[$key] = mysticky_bar_sanitize_options( $value ); // Recursive call for nested arrays
2561 } else {
2562
2563 switch ($key) {
2564 case 'sender_email':
2565 $sanitized_array[$key] = sanitize_email($value);
2566 break;
2567 case 'mysticky_welcomebar_redirect':
2568 $sanitized_array[$key] = sanitize_url($value);
2569 break;
2570 case 'mysticky_welcomebar_bar_text':
2571 case 'mysticky_welcomebar_thankyou_screen_text':
2572 $sanitized_array[$key] = sanitize_textarea_field($value);
2573 break;
2574 default:
2575 $sanitized_array[$key] = sanitize_text_field($value);
2576 }
2577
2578 }
2579 }
2580 return $sanitized_array;
2581 }