PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.1
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.1
2.9.1 2.9.0 2.8.9 2.8.8 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7
mystickymenu / mystickymenu.php
mystickymenu Last commit date
css 7 years ago images 7 years ago js 7 years ago languages 8 years ago index.php 8 years ago mystickymenu.php 7 years ago readme.txt 7 years ago uninstall.php 7 years ago
mystickymenu.php
752 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. After install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6 Version: 2.1
7 Author: Premio
8 Author URI: https://premio.io/
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.1' );
16
17 class MyStickyMenuBackend
18 {
19 private $options;
20
21 public function __construct()
22 {
23 add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
24 add_action( 'admin_init', array( $this, 'mysticky_load_transl') );
25
26 add_action( 'admin_init', array( $this, 'mysticky_default_options' ) );
27 //add_action( 'admin_head', array( $this, 'mysticky_admin_script' ) );
28 add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_admin_script' ) );
29
30 add_filter( 'plugin_action_links_mystickymenu/mystickymenu.php', array( $this, 'mystickymenu_settings_link' ) );
31
32 add_action( 'activated_plugin', array( $this, 'mystickymenu_activation_redirect' ) );
33 }
34
35 public function mystickymenu_settings_link($links){
36 $settings_link = '<a href="options-general.php?page=my-stickymenu-settings">Settings</a>';
37 array_unshift($links, $settings_link);
38 return $links;
39 }
40
41 public function mystickymenu_activation_redirect( $plugin) {
42 if( $plugin == plugin_basename( __FILE__ ) ) {
43 wp_redirect( admin_url( 'options-general.php?page=my-stickymenu-settings' ) ) ;
44 exit;
45 }
46 }
47
48 public function mysticky_admin_script($hook) {
49 if ($hook != 'settings_page_my-stickymenu-settings') {
50 return;
51 }
52
53 wp_enqueue_script('jquery-ui-slider');
54 wp_enqueue_script('jquery-ui-js' ,'https://code.jquery.com/ui/1.12.1/jquery-ui.js',array( 'jquery' ), MYSTICKY_VERSION);
55 wp_register_script('mystickymenuAdminScript', plugins_url('/js/mystickymenu-admin.js', __FILE__), array( 'jquery' ), MYSTICKY_VERSION);
56 wp_enqueue_script('mystickymenuAdminScript');
57
58
59 wp_enqueue_style('google-fonts', 'https://fonts.googleapis.com/css?family=Poppins:400,600,700' );
60 wp_enqueue_style('jquery-ui-css', 'https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css' );
61 //wp_enqueue_style('jquery-mobile-css', plugins_url('/css/jquery.mobile.min.css', __FILE__) );
62 wp_register_style('mystickymenuAdminStyle', plugins_url('/css/mystickymenu-admin.css', __FILE__), array(), MYSTICKY_VERSION );
63 wp_enqueue_style('mystickymenuAdminStyle');
64
65 wp_enqueue_style( 'wp-color-picker' );
66 wp_enqueue_script( 'my-script-handle', plugins_url('js/iris-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
67 }
68
69 public function mysticky_load_transl(){
70 load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
71 }
72
73 public function add_plugin_page(){
74 // This page will be under "Settings"
75 add_options_page(
76 'Settings Admin',
77 'myStickymenu',
78 'manage_options',
79 'my-stickymenu-settings',
80 array( $this, 'create_admin_page' )
81 );
82 }
83
84 public function create_admin_page(){
85 // Set class property
86 if ( isset($_POST['mysticky_option_name']) && !empty($_POST['mysticky_option_name']) ) {
87 update_option( 'mysticky_option_name', $_POST['mysticky_option_name']);
88
89 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
90 }
91
92 $mysticky_options = get_option( 'mysticky_option_name');
93 $is_old = get_option("has_sticky_header_old_version");
94 $is_old = ($is_old == "no")?false:true;
95 ?>
96 <div id="mystickymenu" class="wrap mystickymenu">
97 <div class="sticky-header-menu">
98 <ul>
99 <li><a href="#sticky-header-settings" class="active"><?php _e('Settings', 'mystickymenu'); ?></a></li>
100 <li><a href="#sticky-header-upgrade"><?php _e('Upgrade to Pro', 'mystickymenu'); ?></a></li>
101 </ul>
102 </div>
103 <div style="display: block" id="sticky-header-settings" class="sticky-header-content">
104 <div class="mystickymenu-heading">
105 <div class="myStickymenu-header-title">
106 <h3><?php _e('How To Make a Sticky Header', 'mystickymenu'); ?></h3>
107 </div>
108 <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>
109 </div>
110
111 <form class="mysticky-form" method="post" action="#">
112 <div class="mystickymenu-content-section sticky-class-sec">
113 <table>
114 <tr>
115 <td>
116 <label class="mysticky_title"><?php _e("Sticky Class", 'mystickymenu')?></label>
117 <br /><br />
118 <?php $nav_menus = wp_get_nav_menus();
119 $menu_locations = get_nav_menu_locations();
120 $locations = get_registered_nav_menus();
121 ?>
122 <select name="mysticky_option_name[mysticky_class_id_selector]" id="mystickymenu-select">
123 <option value=""><?php _e( 'Select Sticky Menu', 'mystickymenu' ); ?></option>
124
125 <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?>
126 <option value="<?php echo esc_attr( $_nav_menu->slug ); ?>" <?php selected( $_nav_menu->slug, $mysticky_options['mysticky_class_id_selector'] ); ?>>
127 <?php
128 echo esc_html( $_nav_menu->name );
129
130 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
131 $locations_assigned_to_this_menu = array();
132 foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
133 if ( isset( $locations[ $menu_location_key ] ) ) {
134 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
135 }
136 }
137
138 /**
139 * Filters the number of locations listed per menu in the drop-down select.
140 *
141 * @since 3.6.0
142 *
143 * @param int $locations Number of menu locations to list. Default 3.
144 */
145 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
146
147 // Adds ellipses following the number of locations defined in $assigned_locations.
148 if ( ! empty( $assigned_locations ) ) {
149 printf(
150 ' (%1$s%2$s)',
151 implode( ', ', $assigned_locations ),
152 count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
153 );
154 }
155 }
156 ?>
157 </option>
158 <?php endforeach; ?>
159 <option value="custom" <?php selected( 'custom', $mysticky_options['mysticky_class_id_selector'] ); ?>><?php esc_html_e( 'Other Class Or ID', 'mystickymenu' );?></option>
160 </select>
161
162 <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'];?>" />
163
164 <p class="description"><?php _e("menu or header element class or id.", 'mystickymenu')?></p>
165 </td>
166 <td>
167 <div class="mysticky_device_upgrade">
168 <label class="mysticky_title"><?php _e("Devices", 'mystickymenu')?></label>
169 <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="#" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span>
170 <ul class="mystickymenu-input-multicheckbox">
171 <li>
172 <label>
173 <input id="disable_css" name="mysticky_option_name[device_desktop]" type="checkbox" checked disabled />
174 <?php _e( 'Desktop', 'mystickymenu' );?>
175 <label>
176 </li>
177 <li>
178 <label>
179 <input id="disable_css" name="mysticky_option_name[device_mobile]" type="checkbox" checked disabled />
180 <?php _e( 'Mobile', 'mystickymenu' );?>
181 <label>
182 </li>
183 </ul>
184 </div>
185 </td>
186 </tr>
187 </table>
188 </div>
189
190
191 <div class="mystickymenu-content-section">
192 <h3><?php esc_html_e( 'Settings', 'mystickymenu' );?></h3>
193 <table class="form-table">
194 <tr>
195 <td>
196 <label for="myfixed_zindex" class="mysticky_title"><?php _e("Sticky z-index", 'mystickymenu')?></label>
197 </td>
198 <td>
199 <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'];?>" />
200 </td>
201 <td>
202 <label class="mysticky_title myssticky-remove-hand"><?php _e("Fade or slide effect", 'mystickymenu')?></label>
203 </td>
204 <td>
205 <label>
206 <input name="mysticky_option_name[myfixed_fade]" value= "slide" type="radio" <?php checked( $mysticky_options['myfixed_fade'], 'slide' );?> />
207 <?php _e("Slide", 'mystickymenu'); ?>
208 </label>
209 <label>
210 <input name="mysticky_option_name[myfixed_fade]" value="fade" type="radio" <?php checked( $mysticky_options['myfixed_fade'], 'fade' );?> />
211 <?php _e("Fade", 'mystickymenu'); ?>
212 </label>
213 </td>
214 </tr>
215 <tr>
216 <td>
217 <label for="myfixed_disable_small_screen" class="mysticky_title"><?php _e("Disable at Small Screen Sizes", 'mystickymenu')?></label>
218 <p class="description"><?php _e('Less than chosen screen width, set 0 to disable','mystickymenu');?></p>
219 </td>
220 <td>
221 <div class="px-wrap">
222 <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'];?>" />
223 <span class="input-px">PX</span>
224 </div>
225 </td>
226 <td>
227 <label for="mysticky_active_on_height" class="mysticky_title"><?php _e("Make visible on Scroll", 'mystickymenu')?></label>
228 <p class="description"><?php _e('If set to 0 auto calculate will be used.','mystickymenu');?></p>
229 </td>
230 <td>
231 <div class="px-wrap">
232 <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'];?>" />
233 <span class="input-px">PX</span>
234 </div>
235 </td>
236 </tr>
237 <tr>
238 <td>
239 <label for="mysticky_active_on_height_home" class="mysticky_title"><?php _e("Make visible on Scroll at homepage", 'mystickymenu')?></label>
240 <p class="description"><?php _e( 'If set to 0 it will use initial Make visible on Scroll value.', 'mystickymenu' );?></p>
241 </td>
242 <td>
243 <div class="px-wrap">
244 <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'];?>" />
245 <span class="input-px">PX</span>
246 </div>
247 </td>
248 <td>
249 <label for="myfixed_bgcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Background Color", 'mystickymenu')?></label>
250 </td>
251 <td>
252 <input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" class="my-color-field" value="<?php echo $mysticky_options['myfixed_bgcolor'];?>" />
253
254 </td>
255 </tr>
256 <tr>
257 <td>
258 <label for="myfixed_transition_time" class="mysticky_title"><?php _e("Sticky Transition Time", 'mystickymenu')?></label>
259 </td>
260 <td>
261 <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'];?>" />
262 </td>
263 <td>
264 <label for="myfixed_opacity" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Opacity", 'mystickymenu')?></label>
265 <p class="description"><?php _e( 'numbers 1-100.', 'mystickymenu');?></p>
266 </td>
267 <td>
268 <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'];?>" />
269 <div id="slider">
270 <div id="custom-handle" class="ui-slider-handle"><?php //echo $mysticky_options['myfixed_opacity'];?></div>
271 </div>
272
273 </td>
274 </tr>
275 </table>
276 </div>
277
278 <div class="mystickymenu-content-section <?php echo !$is_old?"mystickymenu-content-upgrade":""?>" >
279
280 <div class="mystickymenu-content-option">
281 <label class="mysticky_title css-style-title"><?php _e("Hide on Scroll Down", 'mystickymenu'); ?></label>
282 <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="#" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?>
283 <p>
284 <label class="mysticky_text">
285 <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":"" ?> />
286 <?php _e("Disable sticky menu at scroll down", 'mystickymenu'); ?>
287 </label>
288 </p>
289 </div>
290 <div class="mystickymenu-content-option">
291 <label class="mysticky_title css-style-title"><?php _e("CSS style", 'mystickymenu'); ?></label>
292 <span class="mysticky_text"><?php _e( 'Add/edit CSS style. Leave it blank for default style.', 'mystickymenu');?></span>
293 <div class="mystickymenu-input-section">
294 <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>
295 </div>
296 <p><?php esc_html_e( "CSS ID's and Classes to use:", "mystickymenu" );?></p>
297 <p>
298 #mysticky-wrap { }<br/>
299 #mysticky-nav.wrapfixed { }<br/>
300 #mysticky-nav.wrapfixed.up { }<br/>
301 #mysticky-nav.wrapfixed.down { }<br/>
302 #mysticky-nav .navbar { }<br/>
303 #mysticky-nav .navbar.myfixed { }<br/>
304 </p>
305 </div>
306
307 <div class="mystickymenu-content-option">
308 <label class="mysticky_title" for="disable_css"><?php _e("Disable CSS style", 'mystickymenu'); ?></label>
309 <div class="mystickymenu-input-section">
310 <label>
311 <input id="disable_css" name="mysticky_option_name[disable_css]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( $mysticky_options['disable_css'], 'on' );?> />
312 <?php _e( 'Use this option if you plan to include CSS Style manually', 'mystickymenu' );?>
313 <label>
314 </div>
315 <p></p>
316 </div>
317
318 <div class="mystickymenu-content-option">
319 <label class="mysticky_title"><?php _e("Disable at", 'mystickymenu'); ?></label>
320 <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="#" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?>
321 <div class="mystickymenu-input-section">
322 <ul class="mystickymenu-input-multicheckbox">
323 <li>
324 <label>
325 <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' );?>/>
326 <span><?php _e('front page', 'mystickymenu' );?></span>
327 </label>
328 </li>
329 <li>
330 <label>
331 <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' );?>/>
332 <span><?php _e('blog page', 'mystickymenu' );?></span>
333 </label>
334 </li>
335 <li>
336 <label>
337 <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' );?> />
338 <span><?php _e('pages', 'mystickymenu' );?> </span>
339 </label>
340 </li>
341 <li>
342 <label>
343 <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' );?> />
344 <span><?php _e('tags', 'mystickymenu' );?> </span>
345 </label>
346 </li>
347 <li>
348 <label>
349 <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' );?>/>
350 <span><?php _e('categories', 'mystickymenu' );?></span>
351 </label>
352 </li>
353 <li>
354 <label>
355 <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' );?> />
356 <span><?php _e('posts', 'mystickymenu' );?> </span>
357 </label>
358 </li>
359 <li>
360 <label>
361 <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' );?> />
362 <span><?php _e('archives', 'mystickymenu' );?> </span>
363 </label>
364 </li>
365 <li>
366 <label>
367 <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' );?> />
368 <span><?php _e('search', 'mystickymenu' );?> </span>
369 </label>
370 </li>
371 <li>
372 <label>
373 <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' );?>/>
374 <span><?php _e('404', 'mystickymenu' );?> </span>
375 </label>
376 </li>
377 </ul>
378
379 <?php
380 if (isset ( $mysticky_options['mysticky_disable_at_page'] ) == true ) {
381 echo '<div class="mystickymenu-input-section">';
382 _e('<span class="description"><strong>Except for this pages:</strong> </span>', 'mystickymenu');
383
384 printf(
385 '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ',
386 isset( $mysticky_options['mysticky_enable_at_pages'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_pages']) : ''
387 );
388
389 _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');
390 echo '</div>';
391 }
392
393 if (isset ( $mysticky_options['mysticky_disable_at_single'] ) == true ) {
394
395 echo '<div class="mystickymenu-input-section">';
396 _e('<span class="description"><strong>Except for this posts:</strong> </span>', 'mystickymenu');
397
398 printf(
399 '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ',
400 isset( $mysticky_options['mysticky_enable_at_posts'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_posts']) : ''
401 );
402
403 _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');
404 echo '</div>';
405
406 }
407 ?>
408 <p></p>
409 </div>
410 </div>
411 </div>
412 <p class="submit">
413 <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save', 'mystickymenu');?>">
414 </p>
415
416 </form>
417 <form class="mysticky-hideformreset" method="post" action="">
418 <input name="reset" class="button button-secondary confirm" type="submit" value="<?php _e('Reset', 'mystickymenu');?>" >
419 <input type="hidden" name="action" value="reset" />
420 </form>
421 <p class="myStickymenu-review"><a href="https://wordpress.org/support/plugin/mystickymenu/reviews/" target="_blank"><?php _e('Leave a review','mystickymenu'); ?></a></p>
422 </div>
423 <div id="sticky-header-upgrade" class="sticky-header-content">
424 <div id="rpt_pricr" class="rpt_plans rpt_3_plans rpt_style_basic">
425 <div class="">
426 <div class="rpt_plan rpt_plan_0 ">
427 <div style="text-align:left;" class="rpt_title rpt_title_0">Basic</div>
428 <div class="rpt_head rpt_head_0">
429 <div class="rpt_recurrence rpt_recurrence_0">For small website owners</div>
430 <div class="rpt_price rpt_price_0">$9</div>
431 <div class="rpt_description rpt_description_0">Per year. Renewals for 50% off</div>
432 <div style="clear:both;"></div>
433 </div>
434 <div class="rpt_features rpt_features_0">
435 <div class="rpt_feature rpt_feature_0-0"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Use myStickymenu on 1 domain</span>1 website<span class="rpt_tooltip_plus" > +</span></a></div>
436 <div class="rpt_feature rpt_feature_0-1"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>You can show the menu when scrolling up, down or both</span>Show on scroll up/down<span class="rpt_tooltip_plus" > +</span></a></div>
437 <div class="rpt_feature rpt_feature_0-2"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>You can disable the sticky effect on desktop or mobile</span>Devices<span class="rpt_tooltip_plus" > +</span></a></div>
438 <div class="rpt_feature rpt_feature_0-3"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Add CSS of your own to the sticky menu</span>CSS style<span class="rpt_tooltip_plus" > +</span></a></div>
439 <div class="rpt_feature rpt_feature_0-4"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Exclude pages you don't want to have sticky menu</span>Page targeting<span class="rpt_tooltip_plus" > +</span></a></div>
440 <div class="rpt_feature rpt_feature_0-5"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Fade/Slide, opacity, background color, transition time and more</span>Effects and more<span class="rpt_tooltip_plus" > +</span></a></div>
441 <div class="rpt_feature rpt_feature_0-6">Updates and support for 1 year</div>
442 </div>
443 <div style="clear:both;"></div>
444 <a target="_blank" href="https://go.premio.io/?edd_action=add_to_cart&amp;download_id=2199&amp;edd_options[price_id]=1" class="rpt_foot rpt_foot_0">Buy now</a>
445 </div>
446 <div class="rpt_plan rpt_plan_1 rpt_recommended_plan ">
447 <div style="text-align:left;" class="rpt_title rpt_title_1">Pro<img class="rpt_recommended" src="<?php echo plugins_url("") ?>/mystickymenu/images/rpt_recommended.png" style="top: 27px;"></div>
448 <div class="rpt_head rpt_head_1">
449 <div class="rpt_recurrence rpt_recurrence_1">For businesses with multiple websites</div>
450 <div class="rpt_price rpt_price_1">$25</div>
451 <div class="rpt_description rpt_description_1">Per year. Renewals for 50% off</div>
452 <div style="clear:both;"></div>
453 </div>
454 <div class="rpt_features rpt_features_1">
455 <div class="rpt_feature rpt_feature_1-0"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Use myStickymenu on 5 domains</span>5 websites<span class="rpt_tooltip_plus" > +</span></a></div>
456 <div class="rpt_feature rpt_feature_1-1"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>You can show the menu when scrolling up, down or both</span>Show on scroll up/down<span class="rpt_tooltip_plus" > +</span></a></div>
457 <div class="rpt_feature rpt_feature_1-2"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>You can disable the sticky effect on desktop or mobile</span>Devices<span class="rpt_tooltip_plus" > +</span></a></div>
458 <div class="rpt_feature rpt_feature_1-3"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Add CSS of your own to the sticky menu</span>CSS style<span class="rpt_tooltip_plus" > +</span></a></div>
459 <div class="rpt_feature rpt_feature_1-4"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Exclude pages you don't want to have sticky menu</span>Page targeting<span class="rpt_tooltip_plus" > +</span></a></div>
460 <div class="rpt_feature rpt_feature_1-5"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Fade/Slide, opacity, background color, transition time and more</span>Effects and more<span class="rpt_tooltip_plus" > +</span></a></div>
461 <div class="rpt_feature rpt_feature_1-6">Updates and support for 1 year</div>
462 </div>
463 <div style="clear:both;"></div>
464 <a target="_blank" href="https://go.premio.io/?edd_action=add_to_cart&amp;download_id=2199&amp;edd_options[price_id]=2" class="rpt_foot rpt_foot_1">Buy now</a>
465 </div>
466 <div class="rpt_plan rpt_plan_2 ">
467 <div style="text-align:left;" class="rpt_title rpt_title_2">Agency</div>
468 <div class="rpt_head rpt_head_2">
469 <div class="rpt_recurrence rpt_recurrence_2">For agencies who manage clients</div>
470 <div class="rpt_price rpt_price_2">$49</div>
471 <div class="rpt_description rpt_description_2">Per year. Renewals for 50% off</div>
472 <div style="clear:both;"></div>
473 </div>
474 <div class="rpt_features rpt_features_2">
475 <div class="rpt_feature rpt_feature_2-0"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Use myStickymenu on 20 domains</span>20 websites<span class="rpt_tooltip_plus" > +</span></a></div>
476 <div class="rpt_feature rpt_feature_2-1"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>You can show the menu when scrolling up, down or both</span>Show on scroll up/down<span class="rpt_tooltip_plus" > +</span></a></div>
477 <div class="rpt_feature rpt_feature_2-2"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>You can disable the sticky effect on desktop or mobile</span>Devices<span class="rpt_tooltip_plus" > +</span></a></div>
478 <div class="rpt_feature rpt_feature_2-3"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Add CSS of your own to the sticky menu</span>CSS style<span class="rpt_tooltip_plus" > +</span></a></div>
479 <div class="rpt_feature rpt_feature_2-4"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Exclude pages you don't want to have sticky menu</span>Page targeting<span class="rpt_tooltip_plus" > +</span></a></div>
480 <div class="rpt_feature rpt_feature_2-5"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Fade/Slide, opacity, background color, transition time and more</span>Effects and more<span class="rpt_tooltip_plus" > +</span></a></div>
481 <div class="rpt_feature rpt_feature_2-6">Updates and support for 1 year</div>
482 </div>
483 <div style="clear:both;"></div>
484 <a target="_blank" href="https://go.premio.io/?edd_action=add_to_cart&amp;download_id=2199&amp;edd_options[price_id]=3" class="rpt_foot rpt_foot_2">Buy now</a>
485 </div>
486 </div>
487 </div>
488 </div>
489 </div>
490 <?php
491 }
492 public function mysticky_default_options() {
493
494 global $options;
495 $menu_locations = get_nav_menu_locations();
496 $menu_object = wp_get_nav_menu_object( $menu_locations['menu-1'] );
497
498 if ( is_object($menu_object) && $menu_object->slug != '' ) {
499 $mysticky_class_id_selector = $menu_object->slug;
500 } else {
501 $mysticky_class_id_selector = 'custom';
502 }
503 $default = array(
504 'mysticky_class_id_selector' => $mysticky_class_id_selector,
505 'mysticky_class_selector' => '.navbar',
506 'device_desktop' => 'on',
507 'device_mobile' => 'on',
508 'myfixed_zindex' => '99990',
509 'myfixed_bgcolor' => '#f7f5e7',
510 'myfixed_opacity' => '90',
511 'myfixed_transition_time' => '0.3',
512 'myfixed_disable_small_screen' => '0',
513 'myfixed_disable_large_screen' => '0',
514 'mysticky_active_on_height' => '0',
515 'mysticky_active_on_height_home'=> '0',
516 'myfixed_fade' => 'slide',
517 'myfixed_cssstyle' => '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }'
518 );
519
520 if ( get_option('mysticky_option_name') == false ) {
521 $status = get_option("sticky_header_status");
522 if($status == false) {
523 update_option("sticky_header_status", "done");
524 update_option("has_sticky_header_old_version", "no");
525 }
526 update_option( 'mysticky_option_name', $default );
527 } else {
528 $status = get_option("sticky_header_status");
529 if($status == false) {
530 update_option("sticky_header_status", "done");
531 update_option("has_sticky_header_old_version", "yes");
532 }
533 }
534
535 if(isset($_POST['reset'])) {
536 update_option( 'mysticky_option_name', $default );
537 }
538
539 if ( !get_option( 'update_mysticky_version_2_6') ) {
540 $mysticky_option_name = get_option( 'mysticky_option_name' );
541 $mysticky_option_name['mysticky_class_id_selector'] = 'custom';
542 if ($mysticky_option_name['myfixed_fade'] == 'on'){
543 $mysticky_option_name['myfixed_fade'] = 'slide';
544 }else{
545 $mysticky_option_name['myfixed_fade'] = 'fade';
546 }
547 update_option( 'mysticky_option_name', $mysticky_option_name );
548 update_option( 'update_mysticky_version_2_6', true );
549 }
550 }
551 }
552
553
554
555 class MyStickyMenuFrontend
556 {
557
558 public function __construct()
559 {
560 add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
561 add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) );
562 }
563
564 public function mysticky_build_stylesheet_content() {
565
566 $mysticky_options = get_option( 'mysticky_option_name' );
567
568 if (isset($mysticky_options['disable_css'])) {
569 //do nothing
570 } else {
571 $mysticky_options['disable_css'] = false;
572 }
573
574 if ($mysticky_options ['disable_css'] == false ) {
575
576 echo '<style id="mystickymenu" type="text/css">';
577 echo '#mysticky-nav { width:100%; position: static; }';
578 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'] . ';}';
579
580
581 if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
582 //echo '@media (max-width: '.$mysticky_options['myfixed_disable_small_screen'].'px) {#mysticky-nav.wrapfixed {position: static;} }';
583 };
584 if ( $mysticky_options['myfixed_cssstyle'] == "" ) {
585 echo '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }';
586 }
587 echo $mysticky_options ['myfixed_cssstyle'];
588 echo '</style>';
589 }
590 }
591
592 public function mystickymenu_script() {
593
594 $mysticky_options = get_option( 'mysticky_option_name' );
595
596 if ( is_admin_bar_showing() ) {
597 $top = "true";
598 } else {
599 $top = "false";
600 }
601
602
603 // needed for update 1.7 => 1.8 ... will be removed in the future ()
604 if (isset($mysticky_options['mysticky_active_on_height_home'])) {
605 //do nothing
606 } else {
607 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
608 }
609
610
611 if ($mysticky_options['mysticky_active_on_height_home'] == 0 ) {
612 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
613 }
614
615
616 if ( is_front_page() && is_home() ) {
617
618 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
619
620 } elseif ( is_front_page()){
621
622 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
623
624 }
625 wp_register_script('detectmobilebrowser', plugins_url( 'js/detectmobilebrowser.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true);
626 wp_enqueue_script( 'detectmobilebrowser' );
627
628 wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true);
629 wp_enqueue_script( 'mystickymenu' );
630
631 $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false';
632 $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade';
633 $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? $mysticky_options['myfixed_disable_large_screen'] : '0';
634
635 $mystickyClass = ( $mysticky_options['mysticky_class_id_selector'] != 'custom') ? '.menu-' . $mysticky_options['mysticky_class_id_selector'] .'-container' : $mysticky_options['mysticky_class_selector'];
636
637 $mysticky_translation_array = array(
638 'mystickyClass' => $mystickyClass,
639 'activationHeight' => $mysticky_options['mysticky_active_on_height'],
640 'disableWidth' => $mysticky_options['myfixed_disable_small_screen'],
641 'disableLargeWidth' => $mystickyDisableLarge,
642 'adminBar' => $top,
643 'device_desktop' => true,
644 'device_mobile' => true,
645 'mystickyTransition' => $mystickyTransition,
646 'mysticky_disable_down' => $myfixed_disable_scroll_down,
647
648
649 );
650 wp_localize_script( 'mystickymenu', 'option', $mysticky_translation_array );
651 }
652
653 public function mysticky_disable_at() {
654
655
656 $mysticky_options = get_option( 'mysticky_option_name' );
657
658 $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']);
659 $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']);
660 $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']);
661 $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']);
662 $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']);
663 $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']);
664 $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']);
665 $mysticky_disable_at_search = isset($mysticky_options['mysticky_disable_at_search']);
666 $mysticky_disable_at_404 = isset($mysticky_options['mysticky_disable_at_404']);
667 $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? $mysticky_options['mysticky_enable_at_pages'] : '';
668 $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? $mysticky_options['mysticky_enable_at_posts'] : '';
669
670 // Trim input to ignore empty spaces
671 $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages));
672 $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts));
673
674
675
676
677 if ( is_front_page() && is_home() ) { /* Default homepage */
678
679 if ( $mysticky_disable_at_front_home == false ) {
680 $this->mystickymenu_script();
681 }
682 } elseif ( is_front_page()){ /* Static homepage */
683
684 if ( $mysticky_disable_at_front_home == false ) {
685 $this->mystickymenu_script();
686 }
687
688 } elseif ( is_home()){ /* Blog page */
689
690 if ( $mysticky_disable_at_blog == false ) {
691 $this->mystickymenu_script();
692 }
693
694 } elseif ( is_page() ){ /* Single page*/
695
696 if ( $mysticky_disable_at_page == false ) {
697 $this->mystickymenu_script();
698 }
699 if ( is_page( $mysticky_enable_at_pages_exp ) ){
700 $this->mystickymenu_script();
701 }
702
703 } elseif ( is_tag()){ /* Tag page */
704
705 if ( $mysticky_disable_at_tag == false ) {
706 $this->mystickymenu_script();
707 }
708
709 } elseif ( is_category()){ /* Category page */
710
711 if ( $mysticky_disable_at_category == false ) {
712 $this->mystickymenu_script();
713 }
714
715 } elseif ( is_single()){ /* Single post */
716
717 if ( $mysticky_disable_at_single == false ) {
718 $this->mystickymenu_script();
719 }
720
721 if ( is_single( $mysticky_enable_at_posts_exp ) ){
722 $this->mystickymenu_script();
723 }
724
725 } elseif ( is_archive()){ /* Archive */
726
727 if ( $mysticky_disable_at_archive == false ) {
728 $this->mystickymenu_script();
729 }
730
731 } elseif ( is_search()){ /* Search */
732
733 if ( $mysticky_disable_at_search == false ) {
734 $this->mystickymenu_script();
735 }
736
737 } elseif ( is_404()){ /* 404 */
738
739 if ( $mysticky_disable_at_404 == false ) {
740 $this->mystickymenu_script();
741 }
742 }
743
744 }
745
746 }
747
748 if( is_admin() ) {
749 new MyStickyMenuBackend();
750 } else {
751 new MyStickyMenuFrontend();
752 }