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