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