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