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