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