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