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