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