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