PluginProbe ʕ •ᴥ•ʔ
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) / 2.2.4
My Sticky Bar – Floating Notification Bar & Sticky Header (formerly myStickymenu) v2.2.4
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 6 years ago fonts 7 years ago images 6 years ago js 6 years ago languages 7 years ago index.php 8 years ago mystickymenu-affiliate.php 6 years ago mystickymenu-fonts.php 6 years ago mystickymenu.php 6 years ago readme.txt 6 years ago uninstall.php 7 years ago welcome-bar.php 6 years ago
mystickymenu.php
987 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 and Welcome bar for announcements and promotion. After install go to Settings / myStickymenu and change Sticky Class to .your_navbar_class or #your_navbar_id.
6 Version: 2.2.4
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.2.4' );
16 require_once("mystickymenu-fonts.php");
17 require_once("welcome-bar.php");
18
19 class MyStickyMenuBackend
20 {
21 private $options;
22
23 public function __construct()
24 {
25 add_action( 'admin_menu', array( $this, 'add_plugin_page' ) );
26 add_action( 'admin_init', array( $this, 'mysticky_load_transl') );
27
28 add_action( 'admin_init', array( $this, 'mysticky_default_options' ) );
29 add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_admin_script' ) );
30
31 add_filter( 'plugin_action_links_mystickymenu/mystickymenu.php', array( $this, 'mystickymenu_settings_link' ) );
32
33 add_action( 'activated_plugin', array( $this, 'mystickymenu_activation_redirect' ) );
34
35 add_action("wp_ajax_sticky_menu_update_status", array($this, 'sticky_menu_update_status'));
36 }
37
38 public function sticky_menu_update_status() {
39 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'myStickymenu_update_nonce')) {
40 $status = self::sanitize_options($_REQUEST['status']);
41 $email = self::sanitize_options($_REQUEST['email']);
42 update_option("mystickymenu_update_message", 2);
43 if($status == 1) {
44 $url = 'https://go.premio.io/api/update.php?email='.$email.'&plugin=myStickymenu';
45 $handle = curl_init();
46 curl_setopt($handle, CURLOPT_URL, $url);
47 curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
48 $response = curl_exec($handle);
49 curl_close($handle);
50 }
51 }
52 echo "1";
53 die;
54 }
55
56 public function mystickymenu_settings_link($links){
57 $settings_link = '<a href="options-general.php?page=my-stickymenu-settings">Settings</a>';
58 $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>';
59 array_unshift($links, $settings_link);
60 return $links;
61 }
62
63 public function mystickymenu_activation_redirect( $plugin) {
64 if( $plugin == plugin_basename( __FILE__ ) ) {
65 $is_shown = get_option("mystickymenu_update_message");
66 if($is_shown === false) {
67 add_option("mystickymenu_update_message", 1);
68 }
69 wp_redirect( admin_url( 'options-general.php?page=my-stickymenu-settings' ) ) ;
70 exit;
71 }
72 }
73
74 public function mysticky_admin_script($hook) {
75 if ($hook != 'settings_page_my-stickymenu-settings') {
76 return;
77 }
78 wp_enqueue_style('mystickymenuAdminStyle', plugins_url('/css/mystickymenu-admin.css', __FILE__), array(), MYSTICKY_VERSION );
79 wp_enqueue_style( 'wp-color-picker' );
80 wp_enqueue_style( 'wp-jquery-ui-dialog' );
81 wp_enqueue_style('jquery-ui');
82
83 wp_enqueue_script('jquery-ui');
84 wp_enqueue_script('jquery-ui-slider');
85 //wp_enqueue_script('jquery-ui-datepicker');
86 wp_enqueue_script( 'jquery-ui-dialog' );
87 wp_enqueue_script( 'my-script-handle', plugins_url('js/iris-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true );
88 wp_enqueue_script('mystickymenuAdminScript', plugins_url('/js/mystickymenu-admin.js', __FILE__), array( 'jquery', 'jquery-ui-slider' ), MYSTICKY_VERSION);
89 }
90
91 public function mysticky_load_transl(){
92 load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');
93 }
94
95 function sanitize_options($value) {
96 $value = stripslashes($value);
97 $value = filter_var($value, FILTER_SANITIZE_STRING);
98 return $value;
99 }
100
101 public function add_plugin_page(){
102 // This page will be under "Settings"
103 add_options_page(
104 'Settings Admin',
105 'myStickymenu',
106 'manage_options',
107 'my-stickymenu-settings',
108 array( $this, 'create_admin_page' )
109 );
110 }
111
112 public function create_admin_page(){
113 // Set class property
114 if (isset($_POST['mysticky_option_name']) && !empty($_POST['mysticky_option_name']) && isset($_POST['nonce'])) {
115 if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_update')) {
116 $post = $_POST['mysticky_option_name'];
117 foreach($post as $key=>$value) {
118 $post[$key] = self::sanitize_options($value);
119 }
120
121 $post['device_desktop'] = 'on';
122 $post['device_mobile'] = 'on';
123 update_option( 'mysticky_option_name', $post);
124 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
125 } else {
126 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
127 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
128 }
129 }
130
131 /* welcome bar save data */
132 if (isset($_POST['mysticky_option_welcomebar']) && !empty($_POST['mysticky_option_welcomebar']) && isset($_POST['nonce'])) {
133 if(!empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'mysticky_option_welcomebar_update')) {
134 $mysticky_option_welcomebar = filter_var_array( $_POST['mysticky_option_welcomebar'], FILTER_SANITIZE_STRING );
135 $mysticky_option_welcomebar['mysticky_welcomebar_height'] = 60;
136 $mysticky_option_welcomebar['mysticky_welcomebar_device_desktop'] = 'desktop';
137 $mysticky_option_welcomebar['mysticky_welcomebar_device_mobile'] = 'mobile';
138 $mysticky_option_welcomebar['mysticky_welcomebar_trigger'] = 'after_a_few_seconds';
139 $mysticky_option_welcomebar['mysticky_welcomebar_triggersec'] = '0';
140 $mysticky_option_welcomebar['mysticky_welcomebar_expirydate'] = '';
141 $mysticky_option_welcomebar['mysticky_welcomebar_page_settings'] = '';
142 update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar);
143 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>';
144 } else {
145 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
146 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
147 }
148 }
149 if (isset($_POST['mysticky_welcomebar_reset']) && !empty($_POST['mysticky_welcomebar_reset']) && isset($_POST['nonce_reset'])) {
150 if(!empty($_POST['nonce_reset']) && wp_verify_nonce($_POST['nonce_reset'], 'mysticky_option_welcomebar_reset')) {
151 $mysticky_option_welcomebar_reset = mysticky_welcomebar_pro_widget_default_fields();
152 update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar_reset);
153 echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Reset Settings saved.','mystickymenu'). '</p></strong></div>';
154 } else {
155 wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete');
156 echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>';
157 }
158 }
159
160 $mysticky_options = get_option( 'mysticky_option_name');
161 $is_old = get_option("has_sticky_header_old_version");
162 $is_old = ($is_old == "no")?false:true;
163 $nonce = wp_create_nonce('mysticky_option_backend_update');
164 $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]=";
165
166 $welcomebar_active_class = '';
167 $welcomebar_inactive_class = '';
168 $welcomebar_active_block = '';
169 $welcomebar_inactive_block = 'display: none';
170 if( isset($_POST['active_tab_element']) && $_POST['active_tab_element'] == 1 ) {
171 $welcomebar_active_class = 'active';
172 $welcomebar_inactive_class = '';
173 $welcomebar_active_block = 'display: block';
174 $welcomebar_inactive_block = 'display: none';
175 } else {
176 if ( !isset($_GET['type'])){
177 $welcomebar_active_class = '';
178 $welcomebar_inactive_class = 'active';
179 $welcomebar_active_block = '';
180 $welcomebar_inactive_block = 'display: block';
181 }
182 }
183 $is_shown = get_option("mystickymenu_update_message");
184 ?>
185 <?php if($is_shown == 1) {?>
186 <div class="updates-form-form" >
187 <div class="popup-form-content">
188 <div id="add-update-folder-title" class="add-update-folder-title">
189 Would you like to get feature updates for myStickymenu in real-time?
190 </div>
191 <div class="folder-form-input">
192 <input id="myStickymenu_update_email" autocomplete="off" value="<?php echo get_option( 'admin_email' ) ?>" placeholder="Email address">
193 </div>
194 <div class="updates-content-buttons">
195 <button href="javascript:;" class="button button-primary form-submit-btn yes">Yes, I want</button>
196 <button href="javascript:;" class="button button-secondary form-cancel-btn no">Skip</button>
197 <div style="clear: both"></div>
198 </div>
199 <input type="hidden" id="myStickymenu_update_nonce" value="<?php echo wp_create_nonce("myStickymenu_update_nonce") ?>">
200 </div>
201 </div>
202 <?php } else { ?>
203 <style>
204 div#wpcontent {
205 background: rgba(101,114,219,1);
206 background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
207 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)));
208 background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
209 background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
210 background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
211 background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%);
212 filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 );
213 }
214 </style>
215 <div id="mystickymenu" class="wrap mystickymenu">
216 <div class="sticky-header-menu">
217 <ul>
218 <li><a href="#sticky-header-settings" class="<?php echo $welcomebar_inactive_class; ?>"><?php _e('Sticky Menu', 'mystickymenu'); ?></a></li>
219 <li><a href="#sticky-header-welcome-bar" class="<?php echo $welcomebar_active_class; ?>"><?php _e('Welcome Bar', 'mystickymenu'); ?></a></li>
220 <li><a href="#sticky-header-upgrade" class="<?php echo (isset($_GET['type'])&&$_GET['type']=="upgrade")?"active":"" ?>"><?php _e('Upgrade to Pro', 'mystickymenu'); ?></a></li>
221 </ul>
222 </div>
223 <div style="<?php echo $welcomebar_inactive_block; ?>" id="sticky-header-settings" class="sticky-header-content">
224 <div class="mystickymenu-heading">
225 <div class="myStickymenu-header-title">
226 <h3><?php _e('How To Make a Sticky Header', 'mystickymenu'); ?></h3>
227 </div>
228 <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>
229 </div>
230
231 <form class="mysticky-form" method="post" action="#">
232 <div class="mystickymenu-content-section sticky-class-sec">
233 <table>
234 <tr>
235 <td>
236 <label class="mysticky_title"><?php _e("Sticky Class", 'mystickymenu')?></label>
237 <br /><br />
238 <?php $nav_menus = wp_get_nav_menus();
239 $menu_locations = get_nav_menu_locations();
240 $locations = get_registered_nav_menus();
241 ?>
242 <select name="mysticky_option_name[mysticky_class_id_selector]" id="mystickymenu-select">
243 <option value=""><?php _e( 'Select Sticky Menu', 'mystickymenu' ); ?></option>
244
245 <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?>
246 <option value="<?php echo esc_attr( $_nav_menu->slug ); ?>" <?php selected( $_nav_menu->slug, $mysticky_options['mysticky_class_id_selector'] ); ?>>
247 <?php
248 echo esc_html( $_nav_menu->name );
249
250 if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
251 $locations_assigned_to_this_menu = array();
252 foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
253 if ( isset( $locations[ $menu_location_key ] ) ) {
254 $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
255 }
256 }
257
258 /**
259 * Filters the number of locations listed per menu in the drop-down select.
260 *
261 * @since 3.6.0
262 *
263 * @param int $locations Number of menu locations to list. Default 3.
264 */
265 $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
266
267 // Adds ellipses following the number of locations defined in $assigned_locations.
268 if ( ! empty( $assigned_locations ) ) {
269 printf(
270 ' (%1$s%2$s)',
271 implode( ', ', $assigned_locations ),
272 count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
273 );
274 }
275 }
276 ?>
277 </option>
278 <?php endforeach; ?>
279 <option value="custom" <?php selected( 'custom', $mysticky_options['mysticky_class_id_selector'] ); ?>><?php esc_html_e( 'Other Class Or ID', 'mystickymenu' );?></option>
280 </select>
281
282 <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'];?>" />
283
284 <p class="description"><?php _e("menu or header element class or id.", 'mystickymenu')?></p>
285 </td>
286 <td>
287 <div class="mysticky_device_upgrade">
288 <label class="mysticky_title"><?php _e("Devices", 'mystickymenu')?></label>
289 <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="#" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span>
290 <ul class="mystickymenu-input-multicheckbox">
291 <li>
292 <label>
293 <input id="disable_css" name="mysticky_option_name[device_desktop]" type="checkbox" checked disabled />
294 <?php _e( 'Desktop', 'mystickymenu' );?>
295 </label>
296 </li>
297 <li>
298 <label>
299 <input id="disable_css" name="mysticky_option_name[device_mobile]" type="checkbox" checked disabled />
300 <?php _e( 'Mobile', 'mystickymenu' );?>
301 </label>
302 </li>
303 </ul>
304 </div>
305 </td>
306 </tr>
307 </table>
308 </div>
309
310
311 <div class="mystickymenu-content-section">
312 <h3><?php esc_html_e( 'Settings', 'mystickymenu' );?></h3>
313 <table class="form-table">
314 <tr>
315 <td>
316 <label for="myfixed_zindex" class="mysticky_title"><?php _e("Sticky z-index", 'mystickymenu')?></label>
317 </td>
318 <td>
319 <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'];?>" />
320 </td>
321 <td>
322 <label class="mysticky_title myssticky-remove-hand"><?php _e("Fade or slide effect", 'mystickymenu')?></label>
323 </td>
324 <td>
325 <label>
326 <input name="mysticky_option_name[myfixed_fade]" value= "slide" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'slide' );?> />
327 <?php _e("Slide", 'mystickymenu'); ?>
328 </label>
329 <label>
330 <input name="mysticky_option_name[myfixed_fade]" value="fade" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'fade' );?> />
331 <?php _e("Fade", 'mystickymenu'); ?>
332 </label>
333 </td>
334 </tr>
335 <tr>
336 <td>
337 <label for="myfixed_disable_small_screen" class="mysticky_title"><?php _e("Disable at Small Screen Sizes", 'mystickymenu')?></label>
338 <p class="description"><?php _e('Less than chosen screen width, set 0 to disable','mystickymenu');?></p>
339 </td>
340 <td>
341 <div class="px-wrap">
342 <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'];?>" />
343 <span class="input-px">PX</span>
344 </div>
345 </td>
346 <td>
347 <label for="mysticky_active_on_height" class="mysticky_title"><?php _e("Make visible on Scroll", 'mystickymenu')?></label>
348 <p class="description"><?php _e('If set to 0 auto calculate will be used.','mystickymenu');?></p>
349 </td>
350 <td>
351 <div class="px-wrap">
352 <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'];?>" />
353 <span class="input-px">PX</span>
354 </div>
355 </td>
356 </tr>
357 <tr>
358 <td>
359 <label for="mysticky_active_on_height_home" class="mysticky_title"><?php _e("Make visible on Scroll at homepage", 'mystickymenu')?></label>
360 <p class="description"><?php _e( 'If set to 0 it will use initial Make visible on Scroll value.', 'mystickymenu' );?></p>
361 </td>
362 <td>
363 <div class="px-wrap">
364 <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'];?>" />
365 <span class="input-px">PX</span>
366 </div>
367 </td>
368 <td>
369 <label for="myfixed_bgcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Background Color", 'mystickymenu')?></label>
370 </td>
371 <td>
372 <input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" class="my-color-field" value="<?php echo $mysticky_options['myfixed_bgcolor'];?>" />
373
374 </td>
375 </tr>
376 <tr>
377 <td>
378 <label for="myfixed_transition_time" class="mysticky_title"><?php _e("Sticky Transition Time", 'mystickymenu')?></label>
379 </td>
380 <td>
381 <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'];?>" />
382 </td>
383 <td>
384 <label for="myfixed_opacity" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Opacity", 'mystickymenu')?></label>
385 <p class="description"><?php _e( 'numbers 1-100.', 'mystickymenu');?></p>
386 </td>
387 <td>
388 <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'];?>" />
389 <div id="slider">
390 <div id="custom-handle" class="ui-slider-handle"><?php //echo $mysticky_options['myfixed_opacity'];?></div>
391 </div>
392
393 </td>
394 </tr>
395 </table>
396 </div>
397
398 <div class="mystickymenu-content-section <?php echo !$is_old?"mystickymenu-content-upgrade":""?>" >
399
400 <div class="mystickymenu-content-option">
401 <label class="mysticky_title css-style-title"><?php _e("Hide on Scroll Down", 'mystickymenu'); ?></label>
402 <?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 } ?>
403 <p>
404 <label class="mysticky_text">
405 <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":"" ?> />
406 <?php _e("Disable sticky menu at scroll down", 'mystickymenu'); ?>
407 </label>
408 </p>
409 </div>
410 <div class="mystickymenu-content-option">
411 <label class="mysticky_title css-style-title"><?php _e("CSS style", 'mystickymenu'); ?></label>
412 <span class="mysticky_text"><?php _e( 'Add/edit CSS style. Leave it blank for default style.', 'mystickymenu');?></span>
413 <div class="mystickymenu-input-section">
414 <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>
415 </div>
416 <p><?php esc_html_e( "CSS ID's and Classes to use:", "mystickymenu" );?></p>
417 <p>
418 #mysticky-wrap { }<br/>
419 #mysticky-nav.wrapfixed { }<br/>
420 #mysticky-nav.wrapfixed.up { }<br/>
421 #mysticky-nav.wrapfixed.down { }<br/>
422 #mysticky-nav .navbar { }<br/>
423 #mysticky-nav .navbar.myfixed { }<br/>
424 </p>
425 </div>
426
427 <div class="mystickymenu-content-option">
428 <label class="mysticky_title" for="disable_css"><?php _e("Disable CSS style", 'mystickymenu'); ?></label>
429 <div class="mystickymenu-input-section">
430 <label>
431 <input id="disable_css" name="mysticky_option_name[disable_css]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['disable_css'], 'on' );?> />
432 <?php _e( 'Use this option if you plan to include CSS Style manually', 'mystickymenu' );?>
433 </label>
434 </div>
435 <p></p>
436 </div>
437
438 <div class="mystickymenu-content-option">
439 <label class="mysticky_title"><?php _e("Disable at", 'mystickymenu'); ?></label>
440 <?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 } ?>
441 <div class="mystickymenu-input-section">
442 <ul class="mystickymenu-input-multicheckbox">
443 <li>
444 <label>
445 <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' );?>/>
446 <span><?php _e('front page', 'mystickymenu' );?></span>
447 </label>
448 </li>
449 <li>
450 <label>
451 <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' );?>/>
452 <span><?php _e('blog page', 'mystickymenu' );?></span>
453 </label>
454 </li>
455 <li>
456 <label>
457 <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' );?> />
458 <span><?php _e('pages', 'mystickymenu' );?> </span>
459 </label>
460 </li>
461 <li>
462 <label>
463 <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' );?> />
464 <span><?php _e('tags', 'mystickymenu' );?> </span>
465 </label>
466 </li>
467 <li>
468 <label>
469 <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' );?>/>
470 <span><?php _e('categories', 'mystickymenu' );?></span>
471 </label>
472 </li>
473 <li>
474 <label>
475 <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' );?> />
476 <span><?php _e('posts', 'mystickymenu' );?> </span>
477 </label>
478 </li>
479 <li>
480 <label>
481 <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' );?> />
482 <span><?php _e('archives', 'mystickymenu' );?> </span>
483 </label>
484 </li>
485 <li>
486 <label>
487 <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' );?> />
488 <span><?php _e('search', 'mystickymenu' );?> </span>
489 </label>
490 </li>
491 <li>
492 <label>
493 <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' );?>/>
494 <span><?php _e('404', 'mystickymenu' );?> </span>
495 </label>
496 </li>
497 </ul>
498
499 <?php
500 if (isset ( $mysticky_options['mysticky_disable_at_page'] ) == true ) {
501 echo '<div class="mystickymenu-input-section">';
502 _e('<span class="description"><strong>Except for this pages:</strong> </span>', 'mystickymenu');
503
504 printf(
505 '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ',
506 isset( $mysticky_options['mysticky_enable_at_pages'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_pages']) : ''
507 );
508
509 _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');
510 echo '</div>';
511 }
512
513 if (isset ( $mysticky_options['mysticky_disable_at_single'] ) == true ) {
514
515 echo '<div class="mystickymenu-input-section">';
516 _e('<span class="description"><strong>Except for this posts:</strong> </span>', 'mystickymenu');
517
518 printf(
519 '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ',
520 isset( $mysticky_options['mysticky_enable_at_posts'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_posts']) : ''
521 );
522
523 _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');
524 echo '</div>';
525
526 }
527 ?>
528 <p></p>
529 </div>
530 </div>
531 </div>
532 <p class="submit">
533 <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save', 'mystickymenu');?>">
534 </p>
535 <input type="hidden" name="nonce" value="<?php echo $nonce ?>">
536 </form>
537 <form class="mysticky-hideformreset" method="post" action="">
538 <input name="reset_mysticky_options" class="button button-secondary confirm" type="submit" value="<?php _e('Reset', 'mystickymenu');?>" >
539 <input type="hidden" name="action" value="reset" />
540 <?php $nonce = wp_create_nonce('mysticky_option_backend_reset_nonce'); ?>
541 <input type="hidden" name="nonce" value="<?php echo $nonce ?>">
542 </form>
543 <p class="myStickymenu-review"><a href="https://wordpress.org/support/plugin/mystickymenu/reviews/" target="_blank"><?php _e('Leave a review','mystickymenu'); ?></a></p>
544 </div>
545 <div style="<?php echo $welcomebar_active_block; ?>" id="sticky-header-welcome-bar" class="sticky-header-content">
546 <?php mysticky_welcome_bar_backend(); ?>
547 </div>
548 <div style="display: <?php echo (isset($_GET['type'])&&$_GET['type']=="upgrade")?"block":"none" ?>" id="sticky-header-upgrade" class="sticky-header-content">
549 <div id="rpt_pricr" class="rpt_plans rpt_3_plans rpt_style_basic">
550 <p class="udner-title">
551 <strong class="text-primary">Unlock All Features</strong>
552 </p>
553 <div class="">
554 <div class="rpt_plan rpt_plan_0 ">
555 <div style="text-align:left;" class="rpt_title rpt_title_0">Basic</div>
556 <div class="rpt_head rpt_head_0">
557 <div class="rpt_recurrence rpt_recurrence_0">For small website owners</div>
558 <div class="rpt_price rpt_price_0">$14</div>
559 <div class="rpt_description rpt_description_0 rpt_desc">Per year. Renewals for 25% off</div>
560 <div style="clear:both;"></div>
561 </div>
562 <div class="rpt_features rpt_features_0">
563 <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>
564 <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>
565 <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>
566 <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>
567 <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>
568 <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>
569 <div class="rpt_feature rpt_feature_0-6"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Including page targeting, delay and scroll triggers, devices, position, height, expiry date, open link in a new tab and remove credit</span>Welcome bar<span class="rpt_tooltip_plus"> +</span></a></div>
570 <div class="rpt_feature rpt_feature_0-9">
571 <select data-key="0" class="multiple-options">
572 <option data-header="Renewals for 25% off" data-price="14" value="<?php echo esc_url($pro_url."1") ?>">
573 <?php esc_html_e("Updates & support for 1 year") ?>
574 </option>
575 <option data-header="For 3 years" data-price="27" value="<?php echo esc_url($pro_url."4") ?>">
576 <?php esc_html_e("Updates & support for 3 years") ?>
577 </option>
578 <option data-header="For lifetime" data-price="45" value="<?php echo esc_url($pro_url."5") ?>">
579 <?php esc_html_e("Updates & support for lifetime") ?>
580 </option>
581 </select>
582 </div>
583 </div>
584 <div style="clear:both;"></div>
585 <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>
586 </div>
587 <div class="rpt_plan rpt_plan_1 rpt_recommended_plan ">
588 <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>
589 <div class="rpt_head rpt_head_1">
590 <div class="rpt_recurrence rpt_recurrence_1">For businesses with multiple websites</div>
591 <div class="rpt_price rpt_price_1">$39</div>
592 <div class="rpt_description rpt_description_1 rpt_desc">Per year. Renewals for 25% off</div>
593 <div style="clear:both;"></div>
594 </div>
595 <div class="rpt_features rpt_features_1">
596 <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>
597 <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>
598 <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>
599 <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>
600 <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>
601 <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>
602 <div class="rpt_feature rpt_feature_1-6"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Including page targeting, delay and scroll triggers, devices, position, height, expiry date, open link in a new tab and remove credit</span>Welcome bar<span class="rpt_tooltip_plus"> +</span></a></div>
603 <div class="rpt_feature rpt_feature_0-9">
604 <select data-key="0" class="multiple-options">
605 <option data-header="Renewals for 25% off" data-price="39" value="<?php echo esc_url($pro_url."2") ?>">
606 <?php esc_html_e("Updates & support for 1 year") ?>
607 </option>
608 <option data-header="For 3 years" data-price="64" value="<?php echo esc_url($pro_url."6") ?>">
609 <?php esc_html_e("Updates & support for 3 years") ?>
610 </option>
611 <option data-header="For lifetime" data-price="99" value="<?php echo esc_url($pro_url."7") ?>">
612 <?php esc_html_e("Updates & support for lifetime") ?>
613 </option>
614 </select>
615 </div>
616 </div>
617 <div style="clear:both;"></div>
618 <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>
619 </div>
620 <div class="rpt_plan rpt_plan_2 ">
621 <div style="text-align:left;" class="rpt_title rpt_title_2">Agency</div>
622 <div class="rpt_head rpt_head_2">
623 <div class="rpt_recurrence rpt_recurrence_2">For agencies who manage clients</div>
624 <div class="rpt_price rpt_price_2">$89</div>
625 <div class="rpt_description rpt_description_2 rpt_desc">Per year. Renewals for 25% off</div>
626 <div style="clear:both;"></div>
627 </div>
628 <div class="rpt_features rpt_features_2">
629 <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>
630 <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>
631 <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>
632 <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>
633 <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>
634 <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>
635 <div class="rpt_feature rpt_feature_2-6"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Including page targeting, delay and scroll triggers, devices, position, height, expiry date, open link in a new tab and remove credit</span>Welcome bar<span class="rpt_tooltip_plus"> +</span></a></div>
636 <div class="rpt_feature rpt_feature_0-9">
637 <select data-key="0" class="multiple-options">
638 <option data-header="Renewals for 25% off" data-price="89" value="<?php echo esc_url($pro_url."3") ?>">
639 <?php esc_html_e("Updates & support for 1 year") ?>
640 </option>
641 <option data-header="For 3 years" data-price="159" value="<?php echo esc_url($pro_url."8") ?>">
642 <?php esc_html_e("Updates & support for 3 years") ?>
643 </option>
644 <option data-header="For lifetime" data-price="219" value="<?php echo esc_url($pro_url."9") ?>">
645 <?php esc_html_e("Updates & support for lifetime") ?>
646 </option>
647 </select>
648 </div>
649 </div>
650 <div style="clear:both;"></div>
651 <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>
652 </div>
653 </div>
654 <div style="clear:both;"></div>
655 <div class="client-testimonial">
656 <p class="text-center"><span class="dashicons dashicons-yes"></span> 30 days money back guaranteed</p>
657 <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>
658 <div class="payment">
659 <img src="<?php echo plugins_url("") ?>/mystickymenu/images/payment.png" alt="Payment" class="payment-img" />
660 </div>
661 <div class="testimonial-box">
662 <div class="testimonial-image">
663 <img src="<?php echo plugins_url("") ?>/mystickymenu/images/testimonial.png" style="top: 27px;">
664 </div>
665 <div class="testimonial-content">
666 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!
667 <div class="author">Clayton Chase</div>
668 </div>
669 <div style="clear:both;"></div>
670 </div>
671 </div>
672 </div>
673 </div>
674 </div>
675 <?php }
676 }
677 public function mysticky_default_options() {
678
679 global $options;
680 $menu_locations = get_nav_menu_locations();
681 $menu_object = isset($menu_locations['menu-1']) ? wp_get_nav_menu_object( $menu_locations['menu-1'] ) : array();
682
683 if ( is_object($menu_object) && $menu_object->slug != '' ) {
684 $mysticky_class_id_selector = $menu_object->slug;
685 } else {
686 $mysticky_class_id_selector = 'custom';
687 }
688 $default = array(
689 'mysticky_class_id_selector' => $mysticky_class_id_selector,
690 'mysticky_class_selector' => '.navbar',
691 'device_desktop' => 'on',
692 'device_mobile' => 'on',
693 'myfixed_zindex' => '99990',
694 'myfixed_bgcolor' => '#f7f5e7',
695 'myfixed_opacity' => '90',
696 'myfixed_transition_time' => '0.3',
697 'myfixed_disable_small_screen' => '0',
698 'myfixed_disable_large_screen' => '0',
699 'mysticky_active_on_height' => '0',
700 'mysticky_active_on_height_home'=> '0',
701 'myfixed_fade' => 'slide',
702 'myfixed_cssstyle' => '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }'
703 );
704
705 if ( get_option('mysticky_option_name') == false ) {
706 $status = get_option("sticky_header_status");
707 if($status == false) {
708 update_option("sticky_header_status", "done");
709 update_option("has_sticky_header_old_version", "no");
710 }
711 update_option( 'mysticky_option_name', $default );
712 } else {
713 $status = get_option("sticky_header_status");
714 if($status == false) {
715 update_option("sticky_header_status", "done");
716 update_option("has_sticky_header_old_version", "yes");
717 }
718 }
719
720 if(isset($_POST['reset_mysticky_options'])) {
721 if(isset($_REQUEST['nonce']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_reset_nonce')) {
722 update_option('mysticky_option_name', $default);
723 } else {
724
725 }
726 }
727
728 if ( !get_option( 'update_mysticky_version_2_6') ) {
729 $mysticky_option_name = get_option( 'mysticky_option_name' );
730 $mysticky_option_name['mysticky_class_id_selector'] = 'custom';
731 if ($mysticky_option_name['myfixed_fade'] == 'on'){
732 $mysticky_option_name['myfixed_fade'] = 'slide';
733 }else{
734 $mysticky_option_name['myfixed_fade'] = 'fade';
735 }
736 update_option( 'mysticky_option_name', $mysticky_option_name );
737 update_option( 'update_mysticky_version_2_6', true );
738 }
739 }
740 }
741
742
743
744 class MyStickyMenuFrontend
745 {
746
747 public function __construct()
748 {
749 add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) );
750 add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) );
751 }
752
753 public function mysticky_build_stylesheet_content() {
754
755 $mysticky_options = get_option( 'mysticky_option_name' );
756
757 if (isset($mysticky_options['disable_css'])) {
758 //do nothing
759 } else {
760 $mysticky_options['disable_css'] = false;
761 }
762
763 if ($mysticky_options ['disable_css'] == false ) {
764
765 echo '<style id="mystickymenu" type="text/css">';
766 echo '#mysticky-nav { width:100%; position: static; }';
767 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'] . ';}';
768
769
770 if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){
771 //echo '@media (max-width: '.$mysticky_options['myfixed_disable_small_screen'].'px) {#mysticky-nav.wrapfixed {position: static;} }';
772 };
773 if ( !isset( $mysticky_options['myfixed_cssstyle'] ) ) {
774 echo '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }';
775 }
776 if ( isset( $mysticky_options['myfixed_cssstyle'] ) && $mysticky_options['myfixed_cssstyle'] != '' ) {
777 echo $mysticky_options ['myfixed_cssstyle'];
778 }
779 echo '</style>';
780 }
781 }
782
783 public function mystickymenu_google_fonts_url() {
784 $welcomebar = get_option( 'mysticky_option_welcomebar' );
785
786 $default_fonts = array('Arial', 'Tahoma', 'Verdana', 'Helvetica', 'Times New Roman', 'Trebuchet MS', 'Georgia' );
787 $fonts_url = '';
788 $fonts = array();
789 $font_args = array();
790 $base_url = "https://fonts.googleapis.com/css";
791 $fonts['family']['Lato'] = 'Lato:400,500,600,700';
792 if ( isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] !='' && !in_array( $general_settings['font_family'], $default_fonts) ) {
793 $fonts['family'][$welcomebar['mysticky_welcomebar_font']] = $welcomebar['mysticky_welcomebar_font'] . ':400,500,600,700';
794 }
795 if ( isset($welcomebar['mysticky_welcomebar_btnfont']) && $welcomebar['mysticky_welcomebar_btnfont'] !='' && !in_array( $general_settings['font_family'], $default_fonts) ) {
796 $fonts['family'][$welcomebar['mysticky_welcomebar_btnfont']] = $welcomebar['mysticky_welcomebar_btnfont'] . ':400,500,600,700';
797 }
798
799 /* Prepapre URL if font family defined. */
800 if( !empty( $fonts['family'] ) ) {
801
802 /* format family to string */
803 if( is_array($fonts['family']) ){
804 $fonts['family'] = implode( '|', $fonts['family'] );
805 }
806
807 $font_args['family'] = urlencode( trim( $fonts['family'] ) );
808
809 if( !empty( $fonts['subsets'] ) ){
810
811 /* format subsets to string */
812 if( is_array( $fonts['subsets'] ) ){
813 $fonts['subsets'] = implode( ',', $fonts['subsets'] );
814 }
815
816 $font_args['subsets'] = urlencode( trim( $fonts['subsets'] ) );
817 }
818
819 $fonts_url = add_query_arg( $font_args, $base_url );
820 }
821
822 return esc_url_raw( $fonts_url );
823 }
824
825 public function mystickymenu_script() {
826
827 $mysticky_options = get_option( 'mysticky_option_name' );
828
829 if ( is_admin_bar_showing() ) {
830 $top = "true";
831 } else {
832 $top = "false";
833 }
834 wp_enqueue_style('google-fonts', $this->mystickymenu_google_fonts_url(),array(), MYSTICKY_VERSION );
835
836 // needed for update 1.7 => 1.8 ... will be removed in the future ()
837 if (isset($mysticky_options['mysticky_active_on_height_home'])) {
838 //do nothing
839 } else {
840 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
841 }
842
843
844 if ($mysticky_options['mysticky_active_on_height_home'] == 0 ) {
845 $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height'];
846 }
847
848
849 if ( is_front_page() && is_home() ) {
850
851 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
852
853 } elseif ( is_front_page()){
854
855 $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home'];
856
857 }
858 wp_register_script('detectmobilebrowser', plugins_url( 'js/detectmobilebrowser.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true);
859 wp_enqueue_script( 'detectmobilebrowser' );
860
861 wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true);
862 wp_enqueue_script( 'mystickymenu' );
863
864 $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false';
865 $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade';
866 $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? $mysticky_options['myfixed_disable_large_screen'] : '0';
867
868 $mystickyClass = ( $mysticky_options['mysticky_class_id_selector'] != 'custom') ? '.menu-' . $mysticky_options['mysticky_class_id_selector'] .'-container' : $mysticky_options['mysticky_class_selector'];
869
870 $mysticky_translation_array = array(
871 'mystickyClass' => $mystickyClass,
872 'activationHeight' => $mysticky_options['mysticky_active_on_height'],
873 'disableWidth' => $mysticky_options['myfixed_disable_small_screen'],
874 'disableLargeWidth' => $mystickyDisableLarge,
875 'adminBar' => $top,
876 'device_desktop' => true,
877 'device_mobile' => true,
878 'mystickyTransition' => $mystickyTransition,
879 'mysticky_disable_down' => $myfixed_disable_scroll_down,
880
881
882 );
883 wp_localize_script( 'mystickymenu', 'option', $mysticky_translation_array );
884 }
885
886 public function mysticky_disable_at() {
887
888
889 $mysticky_options = get_option( 'mysticky_option_name' );
890
891 $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']);
892 $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']);
893 $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']);
894 $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']);
895 $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']);
896 $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']);
897 $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']);
898 $mysticky_disable_at_search = isset($mysticky_options['mysticky_disable_at_search']);
899 $mysticky_disable_at_404 = isset($mysticky_options['mysticky_disable_at_404']);
900 $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? $mysticky_options['mysticky_enable_at_pages'] : '';
901 $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? $mysticky_options['mysticky_enable_at_posts'] : '';
902
903 // Trim input to ignore empty spaces
904 $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages));
905 $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts));
906
907
908
909
910 if ( is_front_page() && is_home() ) { /* Default homepage */
911
912 if ( $mysticky_disable_at_front_home == false ) {
913 $this->mystickymenu_script();
914 }
915 } elseif ( is_front_page()){ /* Static homepage */
916
917 if ( $mysticky_disable_at_front_home == false ) {
918 $this->mystickymenu_script();
919 }
920
921 } elseif ( is_home()){ /* Blog page */
922
923 if ( $mysticky_disable_at_blog == false ) {
924 $this->mystickymenu_script();
925 }
926
927 } elseif ( is_page() ){ /* Single page*/
928
929 if ( $mysticky_disable_at_page == false ) {
930 $this->mystickymenu_script();
931 }
932 if ( is_page( $mysticky_enable_at_pages_exp ) ){
933 $this->mystickymenu_script();
934 }
935
936 } elseif ( is_tag()){ /* Tag page */
937
938 if ( $mysticky_disable_at_tag == false ) {
939 $this->mystickymenu_script();
940 }
941
942 } elseif ( is_category()){ /* Category page */
943
944 if ( $mysticky_disable_at_category == false ) {
945 $this->mystickymenu_script();
946 }
947
948 } elseif ( is_single()){ /* Single post */
949
950 if ( $mysticky_disable_at_single == false ) {
951 $this->mystickymenu_script();
952 }
953
954 if ( is_single( $mysticky_enable_at_posts_exp ) ){
955 $this->mystickymenu_script();
956 }
957
958 } elseif ( is_archive()){ /* Archive */
959
960 if ( $mysticky_disable_at_archive == false ) {
961 $this->mystickymenu_script();
962 }
963
964 } elseif ( is_search()){ /* Search */
965
966 if ( $mysticky_disable_at_search == false ) {
967 $this->mystickymenu_script();
968 }
969
970 } elseif ( is_404()){ /* 404 */
971
972 if ( $mysticky_disable_at_404 == false ) {
973 $this->mystickymenu_script();
974 }
975 }
976
977 }
978
979 }
980
981 if( is_admin() ) {
982 new MyStickyMenuBackend();
983 require_once 'mystickymenu-affiliate.php';
984
985 } else {
986 new MyStickyMenuFrontend();
987 }