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