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