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