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