PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.5.7
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.5.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 4 years ago fonts 4 years ago images 4 years ago js 4 years ago languages 5 years ago class-review-box.php 4 years ago class-upgrade-box.php 4 years ago index.php 8 years ago mystickymenu-affiliate.php 4 years ago mystickymenu-deactivate-form.php 5 years ago mystickymenu-fonts.php 4 years ago mystickymenu-popup.php 5 years ago mystickymenu.php 4 years ago mystickymeny-new-welcomebar.php 4 years ago readme.txt 4 years ago recommended-plugins.php 4 years ago stickymenu-dashboard.php 4 years ago uninstall.php 5 years ago update.php 4 years ago upgrade-to-pro.php 4 years ago welcome-bar.php 4 years ago
mystickymenu.php
1604 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.5.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.5.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
36 add_action( 'admin_init', array( $this, 'mysticky_default_options' ) );
37 add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_admin_script' ) );
38
39 add_filter( 'plugin_action_links_mystickymenu/mystickymenu.php', array( $this, 'mystickymenu_settings_link' ) );
40
41 add_action( 'activated_plugin', array( $this, 'mystickymenu_activation_redirect' ) );
42
43 add_action("wp_ajax_sticky_menu_update_status", array($this, 'sticky_menu_update_status'));
44
45 add_action("wp_ajax_mystickymenu_update_popup_status", array($this, 'mystickymenu_popup_status'));
46
47 add_action( 'admin_footer', array( $this, 'mystickymenu_deactivate' ) );
48 add_action( 'wp_ajax_mystickymenu_plugin_deactivate', array( $this, 'mystickymenu_plugin_deactivate' ) );
49 add_action('wp_ajax_stickymenu_widget_delete', array( $this, 'stickymenu_widget_delete' ) );
50 add_action('wp_ajax_mystickymenu_widget_status', array( $this, 'mystickymenu_widget_status' ) );
51 add_action('wp_ajax_stickymenu_status_update', array( $this, 'stickymenu_status_update' ) );
52
53
54
55 }
56
57
58
59 public function stickymenu_status_update(){
60 check_ajax_referer( 'mystickymenu', 'wpnonce' );
61 $mysticky_options = get_option( 'mysticky_option_name' );
62 if( isset($_POST['stickymenu_status']) && $_POST['stickymenu_status'] != '' ){
63
64 $stickymenu_status = $_POST['stickymenu_status'];
65 $mysticky_options['stickymenu_enable'] = $stickymenu_status;
66 update_option('mysticky_option_name',$mysticky_options);
67 }
68 wp_die();
69 }
70
71 public function mystickymenu_popup_status() {
72 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mystickymenu_update_popup_status')) {
73 update_option("mystickymenu_intro_box", "hide");
74 }
75 echo esc_attr("1");
76 die;
77 }
78
79 public function mystickymenu_widget_status() {
80
81 check_ajax_referer( 'mystickymenu', 'wpnonce' );
82
83 if ( isset($_POST['widget_id']) && $_POST['widget_id'] != '' && isset($_POST['widget_status']) && $_POST['widget_status'] != '' ) {
84 $welcomebars_widgets = get_option( 'mystickymenu-welcomebars' );
85 $widget_id = $_POST['widget_id'];
86 $welcomebars_widget_no = '-' . $widget_id ;
87
88 if( $widget_id == 0 || $welcomebars_widgets[$widget_id] == 'default' ){
89 $stickymenu_widget = get_option('mysticky_option_welcomebar');
90 $welcomebars_widget_no = '';
91 }
92 $widget_status = $_POST['widget_status'];
93 $stickymenu_widget['mysticky_welcomebar_enable'] = $widget_status;
94
95 update_option( 'mysticky_option_welcomebar',$stickymenu_widget);
96 }
97 wp_die();
98 }
99
100 public function stickymenu_widget_delete(){
101
102 check_ajax_referer( 'mystickymenu', 'wpnonce' );
103 if ( isset($_POST['widget_id']) && $_POST['widget_id'] != '' && isset($_POST['widget_delete']) && $_POST['widget_delete'] == 1 ) {
104 $welcomebars_widgets = get_option( 'mystickymenu-welcomebars' );
105 $widget_id = $_POST['widget_id'];
106 unset( $welcomebars_widgets[$widget_id] );
107 delete_option( 'mysticky_option_welcomebar');
108 update_option( 'mystickymenu-welcomebars', $welcomebars_widgets );
109 }
110 wp_die();
111 }
112
113 public function sticky_menu_update_status() {
114 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'myStickymenu_update_nonce')) {
115 $status = self::sanitize_options($_REQUEST['status']);
116 $email = self::sanitize_options($_REQUEST['email']);
117 update_option("mystickymenu_update_message", 2);
118 if($status == 1) {
119 $url = 'https://go.premio.io/api/update.php?email='.$email.'&plugin=myStickymenu';
120 $handle = curl_init();
121 curl_setopt($handle, CURLOPT_URL, $url);
122 curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
123 $response = curl_exec($handle);
124 curl_close($handle);
125 }
126 }
127 echo "1";
128 die;
129 }
130
131
132 public function mystickymenu_settings_link($links){
133 $settings_link = '<a href="admin.php?page=my-stickymenu-welcomebar">Settings</a>';
134 $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>';
135 array_unshift($links, $settings_link);
136 return $links;
137 }
138
139 public function mystickymenu_activation_redirect( $plugin) {
140 if( $plugin == plugin_basename( __FILE__ ) ) {
141 $is_shown = get_option("mystickymenu_update_message");
142 if($is_shown === false) {
143 add_option("mystickymenu_update_message", 1);
144 }
145 $option = get_option("mystickymenu_intro_box");
146 if($option === false) {
147 add_option("mystickymenu_intro_box", "show");
148 }
149
150 $welcomebar_widgets = get_option("mysticky_option_welcomebar");
151 if ( $welcomebar_widgets ) {
152 wp_redirect( admin_url( 'admin.php?page=my-stickymenu-welcomebar' ) ) ;
153 } else {
154 wp_redirect( admin_url( 'admin.php?page=my-stickymenu-welcomebar&widget=0' ) ) ;
155
156 }
157
158 exit;
159 }
160 }
161
162 public function mysticky_admin_script($hook) {
163
164 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' )) {
165 return;
166 }
167
168 wp_enqueue_style('mystickymenuAdminStyle', plugins_url('/css/mystickymenu-admin.css', __FILE__), array(), MYSTICKY_VERSION );
169 wp_style_add_data( 'mystickymenuAdminStyle', 'rtl', 'replace' );
170 wp_enqueue_style( 'wp-color-picker' );
171 //wp_enqueue_script( 'wp-color-picker-alpha', plugins_url('/js/wp-color-picker-alpha.min.js', __FILE__), array( 'wp-color-picker' ), MYSTICKY_VERSION );
172 wp_enqueue_style( 'wp-jquery-ui-dialog' );
173 wp_enqueue_style('jquery-ui');
174
175 wp_enqueue_script('jquery-ui');
176 wp_enqueue_script('jquery-ui-slider');
177 //wp_enqueue_script('jquery-ui-datepicker');
178 wp_enqueue_script( 'jquery-ui-dialog' );
179 wp_enqueue_script( 'my-script-handle', plugins_url('js/iris-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
180
181 if($hook == "mystickymenu_page_my-stickymenu-upgrade") {
182 wp_enqueue_script( 'my-select2', plugins_url('js/select2.min.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
183 wp_enqueue_style('my-css-select2', plugins_url('css/select2.min.css', __FILE__), array(), MYSTICKY_VERSION );
184 wp_enqueue_style('my-css-admin-settings', plugins_url('css/admin-setting.css', __FILE__), array(), MYSTICKY_VERSION );
185
186 wp_style_add_data( 'my-css-admin-settings', 'rtl', 'replace' );
187 }
188
189 wp_enqueue_script('mystickymenuAdminScript', plugins_url('/js/mystickymenu-admin.js', __FILE__), array( 'jquery', 'jquery-ui-slider' ), MYSTICKY_VERSION);
190
191 $locale_settings = array(
192 'ajaxurl' => admin_url('admin-ajax.php'),
193 'mystickymenu_url' => MYSTICKYMENU_URL,
194 'ajax_nonce' => wp_create_nonce('mystickymenu'),
195 );
196
197 wp_localize_script('mystickymenuAdminScript', 'mystickymenu', $locale_settings);
198
199 }
200
201 public function mysticky_load_transl(){
202 load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
203 }
204
205 function sanitize_options($value) {
206 $value = stripslashes($value);
207 $value = filter_var($value, FILTER_SANITIZE_STRING);
208 return $value;
209 }
210
211 public function add_plugin_page(){
212 if ( isset($_GET['hide_msmrecommended_plugin']) && $_GET['hide_msmrecommended_plugin'] == 1) {
213 update_option('hide_msmrecommended_plugin',true);
214 }
215 $hide_msmrecommended_plugin = get_option('hide_msmrecommended_plugin');
216 // This page will be under "Settings"
217 add_menu_page(
218 'Settings Admin',
219 'myStickymenu',
220 'manage_options',
221 'my-stickymenu-welcomebar',
222 array( $this, 'mystickystickymenu_admin_welcomebar_page' )
223 );
224 add_submenu_page(
225 'my-stickymenu-welcomebar',
226 'Settings Admin',
227 'Dashboard',
228 'manage_options',
229 'my-stickymenu-welcomebar',
230 array( $this, 'mystickystickymenu_admin_welcomebar_page' )
231 );
232
233 add_submenu_page(
234 'my-stickymenu-welcomebar',
235 'Settings Admin',
236 '+ Create New Welcome Bar',
237 'manage_options',
238 'my-stickymenu-new-welcomebar',
239 array( $this, 'mystickystickymenu_admin_new_welcomebar_page' )
240 );
241
242 add_submenu_page(
243 'my-stickymenu-welcomebar',
244 'Settings Admin',
245 'Sticky menu settings',
246 'manage_options',
247 'my-stickymenu-settings',
248 array( $this, 'create_admin_page' )
249 );
250
251
252 if ( !$hide_msmrecommended_plugin){
253 add_submenu_page(
254 'my-stickymenu-welcomebar',
255 'msm-recommended-plugins',
256 'Recommended Plugins',
257 'manage_options',
258 'msm-recommended-plugins',
259 array( $this, 'mystickymenu_recommended_plugins' )
260 );
261 }
262 add_submenu_page(
263 'my-stickymenu-welcomebar',
264 'Upgrade to Pro',
265 'Upgrade to Pro',
266 'manage_options',
267 'my-stickymenu-upgrade',
268 array( $this, 'mystickymenu_admin_upgrade_to_pro' )
269 );
270 }
271
272 public function create_admin_page(){
273
274 $upgarde_url = admin_url("admin.php?page=my-stickymenu-upgrade");
275 // Set class property
276 if (isset($_POST['mysticky_option_name']) && !empty($_POST['mysticky_option_name']) && isset($_POST['nonce'])) {
277 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_update')) {
278 $post = $_POST['mysticky_option_name'];
279 foreach($post as $key=>$value) {
280 $post[$key] = self::sanitize_options($value);
281 }
282
283 $post['device_desktop'] = 'on';
284 $post['device_mobile'] = 'on';
285 update_option( 'mysticky_option_name', $post);
286 $this->mysticky_clear_all_caches();
287
288
289 if(isset($_POST['submit']) && $_POST['submit'] == 'SAVE & VIEW DASHBOARD'){
290 ?>
291 <script>
292 window.location.href = <?php echo "'".admin_url("admin.php?page=my-stickymenu-welcomebar")."'";?>;
293 </script>
294 <?php
295
296 }
297
298 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
299 } else {
300 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
301 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
302 }
303 }
304
305 $mysticky_options = get_option( 'mysticky_option_name');
306 $is_old = get_option("has_sticky_header_old_version");
307 $is_old = ($is_old == "yes")?true:false;
308 $nonce = wp_create_nonce('mysticky_option_backend_update');
309 $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
310
311 $is_shown = get_option("mystickymenu_update_message");
312 if($is_shown == 1) {
313
314 include_once MYSTICKYMENU_PATH . '/update.php';
315 } else {
316
317 $option = get_option("mystickymenu_intro_box");
318 if($option == "show") {
319 include_once dirname(__FILE__) . "/mystickymenu-popup.php";
320 }
321 ?>
322 <style>
323 div#wpcontent {
324 background: rgba(101,114,219,1);
325 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
326 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)));
327 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
328 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
329 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
330 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
331 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
332 }
333 </style>
334 <div id="mystickymenu" class="wrap mystickymenu">
335
336 <div id="sticky-header-settings" class="sticky-header-content">
337
338 <form class="mysticky-form" id="mystickymenuform" method="post" action="#">
339 <div class="mystickymenu-heading">
340 <div class="mysticky-stickymenu-header-title mystickymenu-content-section">
341 <h3><?php _e('Sticky menu', 'myStickymenu'); ?></h3>
342 <label for="mysticky-stickymenu-form-enabled" class="mysticky-welcomebar-switch stickymenu-switch">
343 <input type="checkbox" id="mysticky-stickymenu-form-enabled" name="mysticky_option_name[stickymenu_enable]" value="1" <?php checked( @$mysticky_options['stickymenu_enable'], '1' );?> />
344 <span class="slider"></span>
345 </label>
346 <div class="mysticky-stickymenu-backword-page">
347 <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>
348 </div>
349 </div>
350 <div class="myStickymenu-header-title">
351 <h3><?php esc_attr_e('How To Make a Sticky Header', 'mystickymenu'); ?></h3>
352 </div>
353 <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>
354 </div>
355 <div class="mystickymenu-content-section sticky-class-sec">
356 <table>
357 <tr>
358 <td>
359 <label class="mysticky_title"><?php _e("Sticky Class", 'mystickymenu')?></label>
360 <br /><br />
361 <?php $nav_menus = wp_get_nav_menus();
362 $menu_locations = get_nav_menu_locations();
363 $locations = get_registered_nav_menus();
364 ?>
365 <select name="mysticky_option_name[mysticky_class_id_selector]" id="mystickymenu-select">
366 <option value=""><?php _e( 'Select Sticky Menu', 'mystickymenu' ); ?></option>
367
368 <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?>
369 <option value="<?php echo esc_attr( $_nav_menu->slug ); ?>" <?php selected( $_nav_menu->slug, $mysticky_options['mysticky_class_id_selector'] ); ?>>
370 <?php
371 echo esc_html( $_nav_menu->name );
372
373 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
374 $locations_assigned_to_this_menu = array();
375 foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
376 if ( isset( $locations[ $menu_location_key ] ) ) {
377 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
378 }
379 }
380
381 /**
382 * Filters the number of locations listed per menu in the drop-down select.
383 *
384 * @since 3.6.0
385 *
386 * @param int $locations Number of menu locations to list. Default 3.
387 */
388 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
389
390 // Adds ellipses following the number of locations defined in $assigned_locations.
391 if ( ! empty( $assigned_locations ) ) {
392 printf(
393 ' (%1$s%2$s)',
394 implode( ', ', $assigned_locations ),
395 count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
396 );
397 }
398 }
399 ?>
400 </option>
401 <?php endforeach; ?>
402 <option value="custom" <?php selected( 'custom', $mysticky_options['mysticky_class_id_selector'] ); ?>><?php esc_html_e( 'Other Class Or ID', 'mystickymenu' );?></option>
403 </select>
404
405 <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']);?>" />
406
407 <p class="description mystuckymenu-class-id">
408 <span class="dashicons dashicons-info"></span>&nbsp;
409 <span>
410 <?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');?>
411 </span>
412 </p>
413 </td>
414 <td>
415 <div class="mysticky_device_upgrade">
416 <label class="mysticky_title"><?php _e("Devices", 'mystickymenu')?></label>
417 <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>
418
419 <ul class="mystickymenu-input-multicheckbox">
420 <li>
421 <label>
422 <input id="disable_css" name="mysticky_option_name[device_desktop]" type="checkbox" checked disabled />
423 <?php _e( 'Desktop', 'mystickymenu' );?>
424 </label>
425 </li>
426 <li>
427 <label>
428 <input id="disable_css" name="mysticky_option_name[device_mobile]" type="checkbox" checked disabled />
429 <?php _e( 'Mobile', 'mystickymenu' );?>
430 </label>
431 </li>
432 </ul>
433 </div>
434 </td>
435 </tr>
436 </table>
437 </div>
438 <div class="mystickymenu-content-section">
439 <h3><?php esc_html_e( 'Settings', 'mystickymenu' );?></h3>
440 <table class="form-table">
441 <tr>
442 <td>
443 <label for="myfixed_zindex" class="mysticky_title"><?php _e("Sticky z-index", 'mystickymenu')?></label>
444 </td>
445 <td>
446 <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']);?>" />
447 </td>
448 <td>
449 <label class="mysticky_title myssticky-remove-hand"><?php _e("Fade or slide effect", 'mystickymenu')?></label>
450 </td>
451 <td>
452 <label>
453 <input name="mysticky_option_name[myfixed_fade]" value= "slide" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'slide' );?> />
454 <?php _e("Slide", 'mystickymenu'); ?>
455 </label>
456 <label>
457 <input name="mysticky_option_name[myfixed_fade]" value="fade" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'fade' );?> />
458 <?php _e("Fade", 'mystickymenu'); ?>
459 </label>
460 </td>
461 </tr>
462 <tr>
463 <td>
464 <label for="myfixed_disable_small_screen" class="mysticky_title"><?php _e("Disable at Small Screen Sizes", 'mystickymenu')?></label>
465 <p class="description"><?php esc_attr_e('Less than chosen screen width, set 0 to disable','mystickymenu');?></p>
466 </td>
467 <td>
468 <div class="px-wrap">
469 <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']);?>" />
470 <span class="input-px">PX</span>
471 </div>
472 </td>
473 <td>
474 <label for="mysticky_active_on_height" class="mysticky_title"><?php _e("Make visible on Scroll", 'mystickymenu')?></label>
475 <p class="description"><?php esc_attr_e('If set to 0 auto calculate will be used.','mystickymenu');?></p>
476 </td>
477 <td>
478 <div class="px-wrap">
479 <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']);?>" />
480 <span class="input-px">PX</span>
481 </div>
482 </td>
483 </tr>
484 <tr>
485 <td>
486 <label for="mysticky_active_on_height_home" class="mysticky_title"><?php _e("Make visible on Scroll at homepage", 'mystickymenu')?></label>
487 <p class="description"><?php _e( 'If set to 0 it will use initial Make visible on Scroll value.', 'mystickymenu' );?></p>
488 </td>
489 <td>
490 <div class="px-wrap">
491 <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']);;?>" />
492 <span class="input-px">PX</span>
493 </div>
494 </td>
495 <td>
496 <label for="myfixed_bgcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Background Color", 'mystickymenu')?></label>
497 </td>
498 <td>
499 <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']);;?>" />
500
501 </td>
502 </tr>
503 <tr>
504 <td>
505 <label for="myfixed_transition_time" class="mysticky_title"><?php _e("Sticky Transition Time", 'mystickymenu')?></label>
506 </td>
507 <td>
508 <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']);?>" />
509 </td>
510 <td>
511 <label for="myfixed_textcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Text Color", 'mystickymenu')?></label>
512 </td>
513 <td>
514 <input type="text" id="myfixed_textcolor" name="mysticky_option_name[myfixed_textcolor]" class="my-color-field" data-alpha="true" value="<?php echo (isset($mysticky_options['myfixed_textcolor'])) ? $mysticky_options['myfixed_textcolor'] : '';?>" />
515
516 </td>
517 </tr>
518 <tr>
519 <td>
520 <label for="myfixed_opacity" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Opacity", 'mystickymenu')?></label>
521 <p class="description"><?php _e( 'numbers 1-100.', 'mystickymenu');?></p>
522 </td>
523 <td>
524 <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']);;?>" />
525 <div id="slider">
526 <div id="custom-handle" class="ui-slider-handle"><?php //echo esc_attr($mysticky_options['myfixed_opacity']);?></div>
527 </div>
528
529 </td>
530 </tr>
531 </table>
532 </div>
533
534 <div class="mystickymenu-content-section <?php echo !$is_old?"mystickymenu-content-upgrade":""?>" >
535
536 <div class="mystickymenu-content-option">
537 <label class="mysticky_title css-style-title"><?php _e("Hide on Scroll Down", 'mystickymenu'); ?></label>
538 <?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 } ?>
539 <p>
540 <label class="mysticky_text">
541 <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":"" ?> />
542 <?php _e("Disable sticky menu at scroll down", 'mystickymenu'); ?>
543 </label>
544 </p>
545 </div>
546 <div class="mysticky-page-target-setting mystickymenu-content-option">
547 <label class="mysticky_title"><?php esc_attr_e('Page targeting', 'myStickymenu'); ?></label>
548 <div class="mystickymenu-input-section mystickymenu-page-target-wrap">
549 <div class="mysticky-welcomebar-setting-content-right">
550 <div class="mysticky-page-options" id="mysticky-welcomebar-page-options">
551 <?php $page_option = (isset($mysticky_options['mysticky_page_settings'])) ? $mysticky_options['mysticky_page_settings'] : array();
552 $url_options = array(
553 'page_contains' => 'pages that contain',
554 'page_has_url' => 'a specific page',
555 'page_start_with' => 'pages starting with',
556 'page_end_with' => 'pages ending with',
557 );
558
559 if(!empty($page_option) && is_array($page_option)) {
560 $count = 0;
561 foreach($page_option as $k=>$option) {
562 $count++;
563 ?>
564 <div class="mysticky-page-option <?php echo ( $k==count($page_option) ) ? "last":""; ?>">
565 <div class="url-content">
566 <div class="mysticky-welcomebar-url-select">
567 <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">
568 <option value="show_on" <?php echo ($option['shown_on']=="show_on" ) ? "selected":"" ?> ><?php esc_html_e( 'Show on', 'mysticky' )?></option>
569 <option value="not_show_on" <?php echo ($option['shown_on']=="not_show_on" )? "selected":""; ?>><?php esc_html_e( "Don't show on", "mysticky" );?></option>
570 </select>
571 </div>
572 <div class="mysticky-welcomebar-url-option">
573 <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">
574 <option disabled value=""><?php esc_html_e( "Select Rule", "mysticky" );?></option>
575 <?php foreach($url_options as $key=>$value) {
576 $selected = ( isset($option['option']) && $option['option']==$key )?" selected='selected' ":"";
577 echo '<option '.$selected.' value="'.$key.'">'.$value.'</option>';
578 } ?>
579 </select>
580 </div>
581 <div class="mysticky-welcomebar-url-box">
582 <span class='mysticky-welcomebar-url'><?php echo site_url("/"); ?></span>
583 </div>
584 <div class="mysticky-welcomebar-url-values">
585 <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" />
586 </div>
587 <div class="mysticky-welcomebar-url-buttons">
588 <a class="mysticky-remove-rule" href="javascript:;">x</a>
589 </div>
590 <div class="clear"></div>
591 </div>
592 </div>
593 <?php
594 }
595 }
596 ?>
597 </div>
598 <a href="javascript:void(0);" class="create-rule" id="mysticky_create-rule"><?php esc_html_e( "Add Rule", "mystickymenu" );?></a>
599 </div>
600 <input type="hidden" id="mysticky_welcomebar_site_url" value="<?php echo site_url("/") ?>" />
601 <div class="mysticky-page-options-html" style="display: none;">
602 <div class="mysticky-page-option">
603 <div class="url-content">
604 <div class="mysticky-welcomebar-url-select">
605 <select name="" id="url_shown_on___count___option">
606 <option value="show_on"><?php esc_html_e("Show on", "mysticky" );?></option>
607 <option value="not_show_on"><?php esc_html_e("Don't show on", "mysticky" );?></option>
608 </select>
609 </div>
610 <div class="mysticky-welcomebar-url-option">
611 <select class="mysticky-url-options" name="" id="url_rules___count___option">
612 <option selected="selected" disabled value=""><?php esc_html_e("Select Rule", "mysticky" );?></option>
613 <?php foreach($url_options as $key=>$value) {
614 echo '<option value="'.$key.'">'.$value.'</option>';
615 } ?>
616 </select>
617 </div>
618 <div class="mysticky-welcomebar-url-box">
619 <span class='mysticky-welcomebar-url'><?php echo site_url("/"); ?></span>
620 </div>
621 <div class="mysticky-welcomebar-url-values">
622 <input type="text" value="" name="mysticky_option_name[mysticky_page_settings][__count__][value]" id="url_rules___count___value" disabled />
623 </div>
624 <div class="clear"></div>
625 </div>
626 <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>
627 </div>
628 </div>
629 </div>
630 </div>
631 <div class="mystickymenu-content-option">
632 <label class="mysticky_title css-style-title"><?php _e("CSS style", 'mystickymenu'); ?></label>
633 <span class="mysticky_text"><?php _e( 'Add/edit CSS style. Leave it blank for default style.', 'mystickymenu');?></span>
634 <div class="mystickymenu-input-section">
635 <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>
636 </div>
637 <p><?php esc_html_e( "CSS ID's and Classes to use:", "mystickymenu" );?></p>
638 <p>
639 #mysticky-wrap { }<br/>
640 #mysticky-nav.wrapfixed { }<br/>
641 #mysticky-nav.wrapfixed.up { }<br/>
642 #mysticky-nav.wrapfixed.down { }<br/>
643 #mysticky-nav .navbar { }<br/>
644 #mysticky-nav .navbar.myfixed { }<br/>
645 </p>
646 </div>
647
648 <div class="mystickymenu-content-option">
649 <label class="mysticky_title" for="disable_css"><?php _e("Disable CSS style", 'mystickymenu'); ?></label>
650 <div class="mystickymenu-input-section">
651 <label>
652 <input id="disable_css" name="mysticky_option_name[disable_css]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['disable_css'], 'on' );?> />
653 <?php _e( 'Use this option if you plan to include CSS Style manually', 'mystickymenu' );?>
654 </label>
655 </div>
656 <p></p>
657 </div>
658
659 <div class="mystickymenu-content-option">
660 <label class="mysticky_title"><?php _e("Disable at", 'mystickymenu'); ?></label>
661 <?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 } ?>
662 <div class="mystickymenu-input-section">
663 <ul class="mystickymenu-input-multicheckbox">
664 <li>
665 <label>
666 <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' );?>/>
667 <span><?php esc_attr_e('front page', 'mystickymenu' );?></span>
668 </label>
669 </li>
670 <li>
671 <label>
672 <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' );?>/>
673 <span><?php esc_attr_e('blog page', 'mystickymenu' );?></span>
674 </label>
675 </li>
676 <li>
677 <label>
678 <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' );?> />
679 <span><?php esc_attr_e('pages', 'mystickymenu' );?> </span>
680 </label>
681 </li>
682 <li>
683 <label>
684 <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' );?> />
685 <span><?php esc_attr_e('tags', 'mystickymenu' );?> </span>
686 </label>
687 </li>
688 <li>
689 <label>
690 <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' );?>/>
691 <span><?php esc_attr_e('categories', 'mystickymenu' );?></span>
692 </label>
693 </li>
694 <li>
695 <label>
696 <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' );?> />
697 <span><?php esc_attr_e('posts', 'mystickymenu' );?> </span>
698 </label>
699 </li>
700 <li>
701 <label>
702 <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' );?> />
703 <span><?php esc_attr_e('archives', 'mystickymenu' );?> </span>
704 </label>
705 </li>
706 <li>
707 <label>
708 <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' );?> />
709 <span><?php esc_attr_e('search', 'mystickymenu' );?> </span>
710 </label>
711 </li>
712 <li>
713 <label>
714 <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' );?>/>
715 <span><?php esc_attr_e('404', 'mystickymenu' );?> </span>
716 </label>
717 </li>
718 </ul>
719
720 <?php
721 if (isset ( $mysticky_options['mysticky_disable_at_page'] ) == true ) {
722 echo '<div class="mystickymenu-input-section">';
723 _e('<span class="description"><strong>Except for this pages:</strong> </span>', 'mystickymenu');
724
725 printf(
726 '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ',
727 isset( $mysticky_options['mysticky_enable_at_pages'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_pages']) : ''
728 );
729
730 _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');
731 echo '</div>';
732 }
733
734 if (isset ( $mysticky_options['mysticky_disable_at_single'] ) == true ) {
735
736 echo '<div class="mystickymenu-input-section">';
737 _e('<span class="description"><strong>Except for this posts:</strong> </span>', 'mystickymenu');
738
739 printf(
740 '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ',
741 isset( $mysticky_options['mysticky_enable_at_posts'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_posts']) : ''
742 );
743
744 _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');
745 echo '</div>';
746
747 }
748 ?>
749 <p></p>
750 </div>
751 </div>
752 </div>
753
754 <div class="mystickymenu-action-popup new-center" id="mysticky-sticky-save-confirm" style="display:none;">
755 <div class="mystickymenu-action-popup-header">
756 <h3><?php esc_html_e("Turn on Sticky Menu","mystickymenu"); ?></h3>
757 <span class="dashicons dashicons-no-alt close-button" data-from = "stickymenu-confirm"></span>
758 </div>
759 <div class="mystickymenu-action-popup-body">
760 <p><?php esc_html_e("Sticky Menu is not turned on. Turn on Sticky Menu to activate sticky menu on your website.","mystickymenu"); ?></p>
761 </div>
762 <div class="mystickymenu-action-popup-footer">
763 <button type="button" class="btn-enable btn-nevermind-status" id="stickymenu_status_dolater" ><?php esc_html_e("Just save & keep it off","mystickymenu"); ?></button>
764 <button type="button" class="btn-disable-cancel" id="stickymenu_status_ok" ><?php esc_html_e("Save & Turn on Sticky Menu","mystickymenu"); ?></button>
765 </div>
766 </div>
767 <div class="mystickymenupopup-overlay" id="stickymenu-option-overlay-popup"></div>
768
769 <p class="submit">
770 <input type="submit" name="submit" id="submit" class="button button-primary btn-save-stickymenu" value="<?php esc_attr_e('Save', 'mystickymenu');?>">
771
772 <input type="submit" name="submit" id="submit" class="button button-primary save_view_dashboard" style="width: auto;" value="<?php _e('SAVE & VIEW DASHBOARD', 'mystickymenu');?>">
773 </p>
774 <input type="hidden" name="nonce" value="<?php echo esc_attr($nonce); ?>">
775 <input type="hidden" id="save_stickymenu" value=""/>
776 </form>
777 <form class="mysticky-hideformreset" method="post" action="">
778 <input name="reset_mysticky_options" class="button button-secondary confirm" type="submit" value="<?php esc_attr_e('Reset', 'mystickymenu');?>" >
779 <input type="hidden" name="action" value="reset" />
780 <?php $nonce = wp_create_nonce('mysticky_option_backend_reset_nonce'); ?>
781 <input type="hidden" name="nonce" value="<?php echo esc_attr($nonce); ?>">
782 </form>
783 <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>
784 </div>
785 </div>
786 <?php }
787 }
788
789
790 public function mystickystickymenu_admin_welcomebar_page() {
791
792 $is_shown = get_option("mystickymenu_update_message");
793 if($is_shown == 1) {
794 include_once MYSTICKYMENU_PATH . '/update.php';
795 return;
796 }
797
798 /* welcome bar save data */
799
800 if (isset($_POST['mysticky_option_welcomebar']) && !empty($_POST['mysticky_option_welcomebar']) && isset($_POST['nonce'])) {
801 if(!empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'mysticky_option_welcomebar_update')) {
802 $widgets = get_option( 'mysticky_option_welcomebar' );
803 $is_first_widget = 0;
804 if( isset($widgets) && $widgets == '' ){
805 $is_first_widget = 1;
806 }
807
808
809 //
810 $welcomebars_widgets[0] = 'Welcome Bar #0';
811 update_option( 'mystickymenu-welcomebars', $welcomebars_widgets );
812
813 $mysticky_option_welcomebar = filter_var_array( $_POST['mysticky_option_welcomebar'], FILTER_SANITIZE_STRING );
814 $mysticky_option_welcomebar['mysticky_welcomebar_bar_text'] = wp_kses_post($_POST['mysticky_option_welcomebar']['mysticky_welcomebar_bar_text']);
815 $mysticky_option_welcomebar['mysticky_welcomebar_height'] = 60;
816 $mysticky_option_welcomebar['mysticky_welcomebar_device_desktop'] = 'desktop';
817 $mysticky_option_welcomebar['mysticky_welcomebar_device_mobile'] = 'mobile';
818 $mysticky_option_welcomebar['mysticky_welcomebar_trigger'] = 'after_a_few_seconds';
819 $mysticky_option_welcomebar['mysticky_welcomebar_triggersec'] = '0';
820 $mysticky_option_welcomebar['mysticky_welcomebar_expirydate'] = '';
821 $mysticky_option_welcomebar['mysticky_welcomebar_page_settings'] = '';
822
823 update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar);
824
825 $this->mysticky_clear_all_caches();
826
827 if($is_first_widget == 1){
828 echo '<div class="main-popup-mystickymenu-bg first-widget-popup"><div class="main-popup-mystickymenu-bg mystickymenu_container_popupbox"><div class="firstwidget-popup-contain"><img src="'. MYSTICKYMENU_URL .'/images/firstwidget_header.svg"><h4>Your first welcome bar is up! 🎉</h4> <p> Yay - we’re happy you chose MyStickyMenu for your website. If you run into anything, the <a href=" https://premio.io/help/mystickymenu/?utm_source=firstbar" target="_blank" style="text-decoration: underline !important;"><strong>help center</strong></a> is always here for you.</p><a href="'.admin_url("admin.php?page=my-stickymenu-welcomebar").'" class="mystickymenu btn-black btn-back-dashboard">Back to Dashboard</a></div><div class="popup-modul-close-btn firstwidget-model"><a href="javascript:void(0)" class="close-chaty-maxvisitor-popup" id="close-first-popup"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 5L5 15" stroke="#4A4A4A" stroke-width="2.08" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 5L15 15" stroke="#4A4A4A" stroke-width="2.08" stroke-linecap="round" stroke-linejoin="round"/></svg></a></div></div></div><div class="mystickymenupopup-overlay" id="first_widget_overlay" style="display:block;"></div>';
829 }
830
831 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
832 } else {
833 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
834 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
835 }
836 }
837
838
839
840 if (isset($_POST['mysticky_welcomebar_reset']) && !empty($_POST['mysticky_welcomebar_reset']) && isset($_POST['nonce_reset'])) {
841 if(!empty($_POST['nonce_reset']) && wp_verify_nonce($_POST['nonce_reset'], 'mysticky_option_welcomebar_reset')) {
842 $mysticky_option_welcomebar_reset = mysticky_welcomebar_pro_widget_default_fields();
843 update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar_reset);
844 $this->mysticky_clear_all_caches();
845 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Reset Settings saved.','mystickymenu'). '</p></strong></div>';
846 } else {
847 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
848 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
849 }
850 }
851
852 if(isset($is_first_widget) && $is_first_widget == 0 && isset($_POST['submit']) && $_POST['submit'] == 'SAVE & VIEW DASHBOARD'){
853 ?>
854 <script>
855 window.location.href = <?php echo "'".admin_url("admin.php?page=my-stickymenu-welcomebar")."'";?>;
856 </script>
857 <?php
858 }
859
860 $mysticky_options = get_option( 'mysticky_option_name');
861 $is_old = get_option("has_sticky_header_old_version");
862 $is_old = ($is_old == "yes")?true:false;
863 $nonce = wp_create_nonce('mysticky_option_backend_update');
864 $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
865
866 ?>
867 <style>
868 div#wpcontent {
869 background: rgba(101,114,219,1);
870 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
871 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)));
872 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
873 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
874 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
875 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
876 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
877 }
878 </style>
879 <div id="mystickymenu" class="wrap mystickymenu">
880
881 <div id="sticky-header-welcome-bar" class="sticky-header-content">
882 <?php
883
884 $welcomebars_widgets = get_option( 'mysticky_option_welcomebar' );
885 if ( !isset($_GET['widget']) && isset( $_GET['page'] ) && $_GET['page'] == 'my-stickymenu-welcomebar' ) {
886 include_once( 'stickymenu-dashboard.php');
887 }elseif ( !isset($_GET['isedit']) && !isset($_GET['save']) && isset($welcomebars_widgets) && !empty($welcomebars_widgets) ) {
888 ?>
889 <div id="mystickymenu" class="wrap mystickymenu mystickymenu-new-widget-wrap">
890 <?php include_once dirname(__FILE__) . '/mystickymeny-new-welcomebar.php';?>
891 </div>
892 <?php
893 }else{
894
895
896 mysticky_welcome_bar_backend();
897 }
898 ?>
899 </div>
900 </div>
901 <?php
902 }
903
904 public function mystickystickymenu_admin_new_welcomebar_page() {
905 $welcomebars_widgets = get_option( 'mysticky_option_welcomebar' );
906 if( isset($welcomebars_widgets) && !empty($welcomebars_widgets)){
907 ?>
908 <div id="mystickymenu" class="wrap mystickymenu mystickymenu-new-widget-wrap">
909 <?php include_once dirname(__FILE__) . '/mystickymeny-new-welcomebar.php';?>
910 </div>
911 <?php
912 }else{ ?>
913 <div id="mystickymenu" class="wrap mystickymenu">
914 <div id="sticky-header-welcome-bar" class="sticky-header-content">
915 <?php mysticky_welcome_bar_backend(); ?>
916 </div>
917 </div>
918 <?php
919 }
920
921 }
922
923 public function mystickymenu_recommended_plugins() {
924 include_once 'recommended-plugins.php';
925 }
926
927
928
929 public function mystickymenu_admin_upgrade_to_pro() {
930 $pro_url = "https://go.premio.io/checkount/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
931 ?>
932 <style>
933 div#wpcontent {
934 background: rgba(101,114,219,1);
935 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
936 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)));
937 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
938 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
939 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
940 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
941 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
942 }
943 </style>
944 <div id="mystickymenu" class="wrap mystickymenu">
945 <?php include_once "upgrade-to-pro.php"; ?>
946 </div>
947 <?php
948 }
949
950 public function mysticky_default_options() {
951
952 global $options;
953 $menu_locations = get_nav_menu_locations();
954 $menu_object = isset($menu_locations['menu-1']) ? wp_get_nav_menu_object( $menu_locations['menu-1'] ) : array();
955
956 if ( is_object($menu_object) && $menu_object->slug != '' ) {
957 $mysticky_class_id_selector = $menu_object->slug;
958 } else {
959 $mysticky_class_id_selector = 'custom';
960 }
961
962 $mystickyClass = '.navbar';
963 $template_name = get_template();
964 switch( $template_name ){
965 case 'ashe':
966 $mysticky_class_id_selector = 'custom';
967 $mystickyClass = '#main-nav';
968 break;
969 case 'astra':
970 case 'hello-elementor':
971 case 'sydney':
972 case 'twentysixteen':
973 $mysticky_class_id_selector = 'custom';
974 $mystickyClass = 'header.site-header';
975 break;
976 case 'generatepress':
977 $mysticky_class_id_selector = 'custom';
978 $mystickyClass = 'nav.main-navigation';
979 break;
980 case 'transportex':
981 $mysticky_class_id_selector = 'custom';
982 $mystickyClass = '.transportex-menu-full';
983 break;
984 case 'hestia':
985 case 'neve':
986 $mysticky_class_id_selector = 'custom';
987 $mystickyClass = 'header.header';
988 break;
989 case 'mesmerize':
990 $mysticky_class_id_selector = 'custom';
991 $mystickyClass = '.navigation-bar';
992 break;
993 case 'oceanwp':
994 $mysticky_class_id_selector = 'custom';
995 $mystickyClass = 'header#site-header';
996 break;
997 case 'shapely':
998 $mysticky_class_id_selector = 'custom';
999 $mystickyClass = '#site-navigation';
1000 break;
1001 case 'storefront':
1002 $mysticky_class_id_selector = 'custom';
1003 $mystickyClass = '.storefront-primary-navigation';
1004 break;
1005 case 'twentynineteen':
1006 $mysticky_class_id_selector = 'custom';
1007 $mystickyClass = '#site-navigation';
1008 break;
1009 case 'twentyseventeen':
1010 $mysticky_class_id_selector = 'custom';
1011 $mystickyClass = '.navigation-top';
1012 break;
1013 default:
1014 break;
1015 }
1016
1017
1018 $default = array(
1019 'mysticky_class_id_selector' => $mysticky_class_id_selector,
1020 'mysticky_class_selector' => $mystickyClass,
1021 'device_desktop' => 'on',
1022 'device_mobile' => 'on',
1023 'myfixed_zindex' => '99990',
1024 'myfixed_bgcolor' => '#f7f5e7',
1025 'myfixed_opacity' => '90',
1026 'myfixed_transition_time' => '0.3',
1027 'myfixed_disable_small_screen' => '0',
1028 'myfixed_disable_large_screen' => '0',
1029 'mysticky_active_on_height' => '0',
1030 'mysticky_active_on_height_home'=> '0',
1031 'myfixed_fade' => 'slide',
1032 'myfixed_cssstyle' => '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }'
1033 );
1034
1035 if ( get_option('mysticky_option_name') == false && current_user_can( 'manage_options' ) ) {
1036 $status = get_option("sticky_header_status");
1037 if($status == false) {
1038 update_option("sticky_header_status", "done");
1039 update_option("has_sticky_header_old_version", "no");
1040 }
1041 update_option( 'mysticky_option_name', $default );
1042 } else {
1043 $status = get_option("sticky_header_status");
1044 if($status == false) {
1045 update_option("sticky_header_status", "done");
1046 update_option("has_sticky_header_old_version", "yes");
1047 }
1048 }
1049
1050 if(isset($_POST['reset_mysticky_options']) && current_user_can( 'manage_options' )) {
1051 if(isset($_REQUEST['nonce']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_reset_nonce')) {
1052 update_option('mysticky_option_name', $default);
1053 } else {
1054
1055 }
1056 }
1057
1058 if ( !get_option( 'update_mysticky_version_2_6') && current_user_can( 'manage_options' )) {
1059 $mysticky_option_name = get_option( 'mysticky_option_name' );
1060 $mysticky_option_name['mysticky_class_id_selector'] = 'custom';
1061 if ($mysticky_option_name['myfixed_fade'] == 'on'){
1062 $mysticky_option_name['myfixed_fade'] = 'slide';
1063 }else{
1064 $mysticky_option_name['myfixed_fade'] = 'fade';
1065 }
1066 update_option( 'mysticky_option_name', $mysticky_option_name );
1067 update_option( 'update_mysticky_version_2_6', true );
1068 }
1069
1070 if ( !get_option( 'update_mysticky_version_2_5_7') && current_user_can( 'manage_options' )) {
1071 $mysticky_option_name = get_option( 'mysticky_option_name' );
1072 $mysticky_option_name['stickymenu_enable'] = 1;
1073 update_option( 'mysticky_option_name', $mysticky_option_name );
1074 update_option( 'update_mysticky_version_2_5_7', true );
1075 }
1076 }
1077
1078 /*
1079 * clear cache when any option is updated
1080 *
1081 */
1082 public function mysticky_clear_all_caches(){
1083
1084 try {
1085 global $wp_fastest_cache;
1086
1087 // if W3 Total Cache is being used, clear the cache
1088 if (function_exists('w3tc_flush_all')) {
1089 w3tc_flush_all();
1090 }
1091 /* if WP Super Cache is being used, clear the cache */
1092 if (function_exists('wp_cache_clean_cache')) {
1093 global $file_prefix, $supercachedir;
1094 if (empty($supercachedir) && function_exists('get_supercache_dir')) {
1095 $supercachedir = get_supercache_dir();
1096 }
1097 wp_cache_clean_cache($file_prefix);
1098 }
1099
1100 if (class_exists('WpeCommon')) {
1101 //be extra careful, just in case 3rd party changes things on us
1102 if (method_exists('WpeCommon', 'purge_memcached')) {
1103 //WpeCommon::purge_memcached();
1104 }
1105 if (method_exists('WpeCommon', 'clear_maxcdn_cache')) {
1106 //WpeCommon::clear_maxcdn_cache();
1107 }
1108 if (method_exists('WpeCommon', 'purge_varnish_cache')) {
1109 //WpeCommon::purge_varnish_cache();
1110 }
1111 }
1112
1113 if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) {
1114 $wp_fastest_cache->deleteCache();
1115 }
1116 if (function_exists('rocket_clean_domain')) {
1117 rocket_clean_domain();
1118 // Preload cache.
1119 if (function_exists('run_rocket_sitemap_preload')) {
1120 run_rocket_sitemap_preload();
1121 }
1122 }
1123
1124 if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) {
1125 autoptimizeCache::clearall();
1126 }
1127
1128 if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) {
1129 LiteSpeed_Cache_API::purge_all();
1130 }
1131
1132 if ( class_exists( '\Hummingbird\Core\Utils' ) ) {
1133
1134 $modules = \Hummingbird\Core\Utils::get_active_cache_modules();
1135 foreach ( $modules as $module => $name ) {
1136 $mod = \Hummingbird\Core\Utils::get_module( $module );
1137
1138 if ( $mod->is_active() ) {
1139 if ( 'minify' === $module ) {
1140 $mod->clear_files();
1141 } else {
1142 $mod->clear_cache();
1143 }
1144 }
1145 }
1146 }
1147
1148 } catch (Exception $e) {
1149 return 1;
1150 }
1151 }
1152
1153 public function mystickymenu_deactivate() {
1154 global $pagenow;
1155
1156 if ( 'plugins.php' !== $pagenow ) {
1157 return;
1158 }
1159 include dirname(__FILE__) . "/mystickymenu-deactivate-form.php";
1160 }
1161 public function mystickymenu_plugin_deactivate() {
1162 global $current_user;
1163 if ( ! current_user_can( 'manage_options' ) ) {
1164 wp_die(0);
1165 }
1166 check_ajax_referer( 'mystickymenu_deactivate_nonce', 'nonce' );
1167
1168 $postData = $_POST;
1169 $errorCounter = 0;
1170 $response = array();
1171 $response['status'] = 0;
1172 $response['message'] = "";
1173 $response['valid'] = 1;
1174 if(!isset($postData['reason']) || empty($postData['reason'])) {
1175 $errorCounter++;
1176 $response['message'] = "Please provide reason";
1177 } else if(!isset($postData['reason']) || empty($postData['reason'])) {
1178 $errorCounter++;
1179 $response['message'] = "Please provide reason";
1180 } else {
1181 $nonce = $postData['nonce'];
1182 if(!wp_verify_nonce($nonce, 'mystickymenu_deactivate_nonce')) {
1183 $response['message'] = __("Your request is not valid", "mystickymenu");
1184 $errorCounter++;
1185 $response['valid'] = 0;
1186 }
1187 }
1188 if($errorCounter == 0) {
1189 global $current_user;
1190 $plugin_info = get_plugin_data( dirname(__FILE__) . "/mystickymenu.php" );
1191 $postData = $_POST;
1192 $email = "none@none.none";
1193
1194 if (isset($postData['email_id']) && !empty($postData['email_id']) && filter_var($postData['email_id'], FILTER_VALIDATE_EMAIL)) {
1195 $email = $postData['email_id'];
1196 }
1197 $domain = site_url();
1198 $user_name = $current_user->first_name . " " . $current_user->last_name;
1199
1200 $response['status'] = 1;
1201
1202 /* sending message to Crisp */
1203 $post_message = array();
1204
1205 $message_data = array();
1206 $message_data['key'] = "Plugin";
1207 $message_data['value'] = "My Sticky Menu";
1208 $post_message[] = $message_data;
1209
1210 $message_data = array();
1211 $message_data['key'] = "Plugin Version";
1212 $message_data['value'] = $plugin_info['Version'];
1213 $post_message[] = $message_data;
1214
1215 $message_data = array();
1216 $message_data['key'] = "Domain";
1217 $message_data['value'] = $domain;
1218 $post_message[] = $message_data;
1219
1220 $message_data = array();
1221 $message_data['key'] = "Email";
1222 $message_data['value'] = $email;
1223 $post_message[] = $message_data;
1224
1225 $message_data = array();
1226 $message_data['key'] = "WordPress Version";
1227 $message_data['value'] = esc_attr(get_bloginfo('version'));
1228 $post_message[] = $message_data;
1229
1230 $message_data = array();
1231 $message_data['key'] = "PHP Version";
1232 $message_data['value'] = PHP_VERSION;
1233 $post_message[] = $message_data;
1234
1235 $message_data = array();
1236 $message_data['key'] = "Message";
1237 $message_data['value'] = $postData['reason'];
1238 $post_message[] = $message_data;
1239
1240 $api_params = array(
1241 'domain' => $domain,
1242 'email' => $email,
1243 'url' => site_url(),
1244 'name' => $user_name,
1245 'message' => $post_message,
1246 'plugin' => "My Sticky Menu",
1247 'type' => "Uninstall",
1248 );
1249
1250 /* Sending message to Crisp API */
1251 $crisp_response = wp_safe_remote_post("https://go.premio.io/crisp/crisp-send-message.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => true));
1252
1253 if (is_wp_error($crisp_response)) {
1254 wp_safe_remote_post("https://go.premio.io/crisp/crisp-send-message.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => false));
1255 }
1256 }
1257 echo json_encode($response);
1258 wp_die();
1259 }
1260 }
1261
1262
1263
1264 class MyStickyMenuFrontend
1265 {
1266
1267 public function __construct()
1268 {
1269 add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
1270 add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) );
1271 }
1272
1273 public function mysticky_build_stylesheet_content() {
1274
1275 $mysticky_options = get_option( 'mysticky_option_name' );
1276
1277 if (isset($mysticky_options['disable_css'])) {
1278 //do nothing
1279 } else {
1280 $mysticky_options['disable_css'] = false;
1281 }
1282
1283 if ($mysticky_options ['disable_css'] == false ) {
1284
1285 echo '<style id="mystickymenu" type="text/css">';
1286 echo '#mysticky-nav { width:100%; position: static; }';
1287 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'] . ';}';
1288
1289 echo '#mysticky-nav.wrapfixed .myfixed{ background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '; position: relative;top: auto;left: auto;right: auto;}';
1290
1291 if ( isset($mysticky_options ['myfixed_textcolor']) && $mysticky_options ['myfixed_textcolor'] != '' ) {
1292 echo '#mysticky-nav.wrapfixed ul li.menu-item a { color: ' . $mysticky_options ['myfixed_textcolor'] . ';}';
1293 }
1294
1295
1296 if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
1297 //echo '@media (max-width: '.$mysticky_options['myfixed_disable_small_screen'].'px) {#mysticky-nav.wrapfixed {position: static;} }';
1298 };
1299 if ( !isset( $mysticky_options['myfixed_cssstyle'] ) ) {
1300 echo '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }';
1301 }
1302 if ( isset( $mysticky_options['myfixed_cssstyle'] ) && $mysticky_options['myfixed_cssstyle'] != '' ) {
1303 echo $mysticky_options ['myfixed_cssstyle'];
1304 }
1305 echo '</style>';
1306 $template_name = get_template();
1307 ?>
1308 <style type="text/css">
1309 <?php if( $template_name == 'hestia' ) { ?>
1310 #mysticky-nav.wrapfixed {box-shadow: 0 1px 10px -6px #0000006b,0 1px 10px 0 #0000001f,0 4px 5px -2px #0000001a;}
1311 #mysticky-nav.wrapfixed .navbar {position: relative;background-color: transparent;box-shadow: none;}
1312 <?php } ?>
1313 <?php if( $template_name == 'shapely' ) { ?>
1314 #mysticky-nav.wrapfixed #site-navigation {position: relative;}
1315 <?php } ?>
1316 <?php if( $template_name == 'storefront' ) { ?>
1317 #mysticky-nav.wrapfixed > .site-header {margin-bottom: 0;}
1318 #mysticky-nav.wrapfixed > .storefront-primary-navigation {padding: 10px 0;}
1319 <?php } ?>
1320 <?php if( $template_name == 'transportex' ) { ?>
1321 #mysticky-nav.wrapfixed > .transportex-menu-full {margin: 0 auto;}
1322 .transportex-headwidget #mysticky-nav.wrapfixed .navbar-wp {top: 0;}
1323 <?php } ?>
1324 <?php if( $template_name == 'twentynineteen' ) { ?>
1325 #mysticky-nav.wrapfixed {padding: 10px;}
1326 <?php } ?>
1327 <?php if( $template_name == 'twentysixteen' ) { ?>
1328 #mysticky-nav.wrapfixed > .site-header {padding-top: 0;padding-bottom: 0;}
1329 <?php } ?>
1330 <?php if( $template_name == 'twentytwenty' ) { ?>
1331 #site-header {background: transparent;}
1332 <?php } ?>
1333 </style>
1334 <?php
1335 }
1336 }
1337
1338 public function mystickymenu_google_fonts_url() {
1339 $welcomebar = get_option( 'mysticky_option_welcomebar' );
1340
1341 $default_fonts = array('System Stack','Arial', 'Tahoma', 'Verdana', 'Helvetica', 'Times New Roman', 'Trebuchet MS', 'Georgia' );
1342 $fonts_url = '';
1343 $fonts = array();
1344 $font_args = array();
1345 $base_url = "https://fonts.googleapis.com/css";
1346 $fonts['family']['Lato'] = 'Lato:400,500,600,700';
1347 if ( isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] !='' && !in_array( $welcomebar['mysticky_welcomebar_font'], $default_fonts) ) {
1348 $fonts['family'][$welcomebar['mysticky_welcomebar_font']] = $welcomebar['mysticky_welcomebar_font'] . ':400,500,600,700';
1349 }
1350 if ( isset($welcomebar['mysticky_welcomebar_btnfont']) && $welcomebar['mysticky_welcomebar_btnfont'] !='' && !in_array( $welcomebar['mysticky_welcomebar_btnfont'], $default_fonts) ) {
1351 $fonts['family'][$welcomebar['mysticky_welcomebar_btnfont']] = $welcomebar['mysticky_welcomebar_btnfont'] . ':400,500,600,700';
1352 }
1353
1354 /* Prepapre URL if font family defined. */
1355 if( !empty( $fonts['family'] ) ) {
1356
1357 /* format family to string */
1358 if( is_array($fonts['family']) ){
1359 $fonts['family'] = implode( '|', $fonts['family'] );
1360 }
1361
1362 $font_args['family'] = urlencode( trim( $fonts['family'] ) );
1363
1364 if( !empty( $fonts['subsets'] ) ){
1365
1366 /* format subsets to string */
1367 if( is_array( $fonts['subsets'] ) ){
1368 $fonts['subsets'] = implode( ',', $fonts['subsets'] );
1369 }
1370
1371 $font_args['subsets'] = urlencode( trim( $fonts['subsets'] ) );
1372 }
1373
1374 $fonts_url = add_query_arg( $font_args, $base_url );
1375 }
1376
1377 return esc_url_raw( $fonts_url );
1378 }
1379
1380 public function mystickymenu_script() {
1381
1382 wp_enqueue_script( 'jquery' );
1383
1384 $mysticky_options = get_option( 'mysticky_option_name' );
1385
1386 if ( is_admin_bar_showing() ) {
1387 $top = "true";
1388 } else {
1389 $top = "false";
1390 }
1391
1392 $welcomebar = get_option( 'mysticky_option_welcomebar' );
1393 if ( isset($welcomebar['mysticky_welcomebar_enable']) && $welcomebar['mysticky_welcomebar_enable'] == 1 ) {
1394 wp_enqueue_style('google-fonts', $this->mystickymenu_google_fonts_url(),array(), MYSTICKY_VERSION );
1395 }
1396
1397 if( !isset($mysticky_options['stickymenu_enable']) || isset($mysticky_options['stickymenu_enable']) && $mysticky_options['stickymenu_enable'] == 0){
1398 return;
1399 }
1400 // needed for update 1.7 => 1.8 ... will be removed in the future ()
1401 if (isset($mysticky_options['mysticky_active_on_height_home'])) {
1402 //do nothing
1403 } else {
1404 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
1405 }
1406
1407
1408 if ($mysticky_options['mysticky_active_on_height_home'] == 0 ) {
1409 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
1410 }
1411
1412
1413 if ( is_front_page() && is_home() ) {
1414
1415 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
1416
1417 } elseif ( is_front_page()){
1418
1419 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
1420
1421 }
1422 wp_register_script('detectmobilebrowser', plugins_url( 'js/detectmobilebrowser.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true);
1423 wp_enqueue_script( 'detectmobilebrowser' );
1424
1425 wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true);
1426 wp_enqueue_script( 'mystickymenu' );
1427
1428 $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false';
1429 $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade';
1430 $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? $mysticky_options['myfixed_disable_large_screen'] : '0';
1431
1432 $mystickyClass = ( $mysticky_options['mysticky_class_id_selector'] != 'custom') ? '.menu-' . $mysticky_options['mysticky_class_id_selector'] .'-container' : $mysticky_options['mysticky_class_selector'];
1433
1434 if ( $mysticky_options['mysticky_class_id_selector'] != 'custom' ) {
1435 $template_name = get_template();
1436 switch( $template_name ){
1437 case 'ashe':
1438 $mystickyClass = '#main-nav';
1439 break;
1440 case 'astra':
1441 case 'hello-elementor':
1442 case 'sydney':
1443 case 'twentysixteen':
1444 $mystickyClass = 'header.site-header';
1445 break;
1446 case 'generatepress':
1447 $mystickyClass = 'nav.main-navigation';
1448 break;
1449 case 'transportex':
1450 $mystickyClass = '.transportex-menu-full';
1451 break;
1452 case 'hestia':
1453 case 'neve':
1454 $mystickyClass = 'header.header';
1455 break;
1456 case 'mesmerize':
1457 $mystickyClass = '.navigation-bar';
1458 break;
1459 case 'oceanwp':
1460 $mystickyClass = 'header#site-header';
1461 break;
1462 case 'shapely':
1463 $mystickyClass = '#site-navigation';
1464 break;
1465 case 'storefront':
1466 $mystickyClass = '.storefront-primary-navigation';
1467 break;
1468 case 'twentynineteen':
1469 $mystickyClass = '#site-navigation';
1470 break;
1471 case 'twentyseventeen':
1472 $mystickyClass = '.navigation-top';
1473 break;
1474 default:
1475 break;
1476 }
1477 }
1478
1479
1480 $mysticky_translation_array = array(
1481 'mystickyClass' => $mystickyClass,
1482 'activationHeight' => $mysticky_options['mysticky_active_on_height'],
1483 'disableWidth' => $mysticky_options['myfixed_disable_small_screen'],
1484 'disableLargeWidth' => $mystickyDisableLarge,
1485 'adminBar' => $top,
1486 'device_desktop' => true,
1487 'device_mobile' => true,
1488 'mystickyTransition' => $mystickyTransition,
1489 'mysticky_disable_down' => $myfixed_disable_scroll_down,
1490
1491
1492 );
1493 wp_localize_script( 'mystickymenu', 'option', $mysticky_translation_array );
1494 }
1495
1496 public function mysticky_disable_at() {
1497
1498
1499 $mysticky_options = get_option( 'mysticky_option_name' );
1500
1501 $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']);
1502 $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']);
1503 $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']);
1504 $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']);
1505 $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']);
1506 $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']);
1507 $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']);
1508 $mysticky_disable_at_search = isset($mysticky_options['mysticky_disable_at_search']);
1509 $mysticky_disable_at_404 = isset($mysticky_options['mysticky_disable_at_404']);
1510 $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? $mysticky_options['mysticky_enable_at_pages'] : '';
1511 $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? $mysticky_options['mysticky_enable_at_posts'] : '';
1512
1513 // Trim input to ignore empty spaces
1514 $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages));
1515 $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts));
1516
1517
1518
1519
1520 if ( is_front_page() && is_home() ) { /* Default homepage */
1521
1522 if ( $mysticky_disable_at_front_home == false ) {
1523 $this->mystickymenu_script();
1524 }
1525 } elseif ( is_front_page()){ /* Static homepage */
1526
1527 if ( $mysticky_disable_at_front_home == false ) {
1528 $this->mystickymenu_script();
1529 }
1530
1531 } elseif ( is_home()){ /* Blog page */
1532
1533 if ( $mysticky_disable_at_blog == false ) {
1534 $this->mystickymenu_script();
1535 }
1536
1537 } elseif ( is_page() ){ /* Single page*/
1538
1539 if ( $mysticky_disable_at_page == false ) {
1540 $this->mystickymenu_script();
1541 }
1542 if ( is_page( $mysticky_enable_at_pages_exp ) ){
1543 $this->mystickymenu_script();
1544 }
1545
1546 } elseif ( is_tag()){ /* Tag page */
1547
1548 if ( $mysticky_disable_at_tag == false ) {
1549 $this->mystickymenu_script();
1550 }
1551
1552 } elseif ( is_category()){ /* Category page */
1553
1554 if ( $mysticky_disable_at_category == false ) {
1555 $this->mystickymenu_script();
1556 }
1557
1558 } elseif ( is_single()){ /* Single post */
1559
1560 if ( $mysticky_disable_at_single == false ) {
1561 $this->mystickymenu_script();
1562 }
1563
1564 if ( is_single( $mysticky_enable_at_posts_exp ) ){
1565 $this->mystickymenu_script();
1566 }
1567
1568 } elseif ( is_archive()){ /* Archive */
1569
1570 if ( $mysticky_disable_at_archive == false ) {
1571 $this->mystickymenu_script();
1572 }
1573
1574 } elseif ( is_search()){ /* Search */
1575
1576 if ( $mysticky_disable_at_search == false ) {
1577 $this->mystickymenu_script();
1578 }
1579
1580 } elseif ( is_404()){ /* 404 */
1581
1582 if ( $mysticky_disable_at_404 == false ) {
1583 $this->mystickymenu_script();
1584 }
1585 }
1586
1587 }
1588
1589 }
1590
1591 if( is_admin() ) {
1592 new MyStickyMenuBackend();
1593 require_once 'mystickymenu-affiliate.php';
1594
1595 } else {
1596 new MyStickyMenuFrontend();
1597 }
1598
1599
1600 register_activation_hook( __FILE__, 'mystickymenu_activate' );
1601
1602 function mystickymenu_activate() {
1603 update_option( 'update_mysticky_version_2_5_7', true );
1604 }