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