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