mystickymenu
Last commit date
css
6 years ago
fonts
7 years ago
images
6 years ago
js
6 years ago
languages
7 years ago
class-review-box.php
6 years ago
index.php
8 years ago
mystickymenu-affiliate.php
6 years ago
mystickymenu-fonts.php
6 years ago
mystickymenu.php
6 years ago
readme.txt
6 years ago
uninstall.php
7 years ago
welcome-bar.php
6 years ago
mystickymenu.php
1276 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.7 |
| 7 | Author: Premio |
| 8 | Author URI: https://premio.io/downloads/mystickymenu/ |
| 9 | Text Domain: mystickymenu |
| 10 | Domain Path: /languages |
| 11 | License: GPLv2 or later |
| 12 | */ |
| 13 | |
| 14 | defined('ABSPATH') or die("Cannot access pages directly."); |
| 15 | define( 'MYSTICKY_VERSION', '2.2.7' ); |
| 16 | require_once("mystickymenu-fonts.php"); |
| 17 | require_once("welcome-bar.php"); |
| 18 | |
| 19 | if(is_admin()) { |
| 20 | include_once 'class-review-box.php'; |
| 21 | } |
| 22 | |
| 23 | class MyStickyMenuBackend |
| 24 | { |
| 25 | private $options; |
| 26 | |
| 27 | public function __construct() |
| 28 | { |
| 29 | add_action( 'admin_menu', array( $this, 'add_plugin_page' ) ); |
| 30 | add_action( 'admin_init', array( $this, 'mysticky_load_transl') ); |
| 31 | |
| 32 | add_action( 'admin_init', array( $this, 'mysticky_default_options' ) ); |
| 33 | add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_admin_script' ) ); |
| 34 | |
| 35 | add_filter( 'plugin_action_links_mystickymenu/mystickymenu.php', array( $this, 'mystickymenu_settings_link' ) ); |
| 36 | |
| 37 | add_action( 'activated_plugin', array( $this, 'mystickymenu_activation_redirect' ) ); |
| 38 | |
| 39 | add_action("wp_ajax_sticky_menu_update_status", array($this, 'sticky_menu_update_status')); |
| 40 | } |
| 41 | |
| 42 | public function sticky_menu_update_status() { |
| 43 | if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'myStickymenu_update_nonce')) { |
| 44 | $status = self::sanitize_options($_REQUEST['status']); |
| 45 | $email = self::sanitize_options($_REQUEST['email']); |
| 46 | update_option("mystickymenu_update_message", 2); |
| 47 | if($status == 1) { |
| 48 | $url = 'https://go.premio.io/api/update.php?email='.$email.'&plugin=myStickymenu'; |
| 49 | $handle = curl_init(); |
| 50 | curl_setopt($handle, CURLOPT_URL, $url); |
| 51 | curl_setopt($handle, CURLOPT_RETURNTRANSFER, true); |
| 52 | $response = curl_exec($handle); |
| 53 | curl_close($handle); |
| 54 | } |
| 55 | } |
| 56 | echo "1"; |
| 57 | die; |
| 58 | } |
| 59 | |
| 60 | public function mystickymenu_settings_link($links){ |
| 61 | $settings_link = '<a href="admin.php?page=my-stickymenu-settings">Settings</a>'; |
| 62 | $links['go_pro'] = '<a href="'.admin_url("admin.php?page=my-stickymenu-settings&type=upgrade").'" style="color: #FF5983;font-weight: bold;">'.__( 'Upgrade', 'stars-testimonials' ).'</a>'; |
| 63 | array_unshift($links, $settings_link); |
| 64 | return $links; |
| 65 | } |
| 66 | |
| 67 | public function mystickymenu_activation_redirect( $plugin) { |
| 68 | if( $plugin == plugin_basename( __FILE__ ) ) { |
| 69 | $is_shown = get_option("mystickymenu_update_message"); |
| 70 | if($is_shown === false) { |
| 71 | add_option("mystickymenu_update_message", 1); |
| 72 | } |
| 73 | wp_redirect( admin_url( 'admin.php?page=my-stickymenu-settings' ) ) ; |
| 74 | exit; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | public function mysticky_admin_script($hook) { |
| 79 | |
| 80 | /*if ($hook != 'settings_page_my-stickymenu-settings') { |
| 81 | return; |
| 82 | }*/ |
| 83 | wp_enqueue_style('mystickymenuAdminStyle', plugins_url('/css/mystickymenu-admin.css', __FILE__), array(), MYSTICKY_VERSION ); |
| 84 | wp_enqueue_style( 'wp-color-picker' ); |
| 85 | wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
| 86 | wp_enqueue_style('jquery-ui'); |
| 87 | |
| 88 | wp_enqueue_script('jquery-ui'); |
| 89 | wp_enqueue_script('jquery-ui-slider'); |
| 90 | //wp_enqueue_script('jquery-ui-datepicker'); |
| 91 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 92 | wp_enqueue_script( 'my-script-handle', plugins_url('js/iris-script.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); |
| 93 | wp_enqueue_script('mystickymenuAdminScript', plugins_url('/js/mystickymenu-admin.js', __FILE__), array( 'jquery', 'jquery-ui-slider' ), MYSTICKY_VERSION); |
| 94 | } |
| 95 | |
| 96 | public function mysticky_load_transl(){ |
| 97 | load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/'); |
| 98 | } |
| 99 | |
| 100 | function sanitize_options($value) { |
| 101 | $value = stripslashes($value); |
| 102 | $value = filter_var($value, FILTER_SANITIZE_STRING); |
| 103 | return $value; |
| 104 | } |
| 105 | |
| 106 | public function add_plugin_page(){ |
| 107 | // This page will be under "Settings" |
| 108 | add_menu_page( |
| 109 | 'Settings Admin', |
| 110 | 'myStickymenu', |
| 111 | 'manage_options', |
| 112 | 'my-stickymenu-settings', |
| 113 | array( $this, 'create_admin_page' ) |
| 114 | ); |
| 115 | add_submenu_page( |
| 116 | 'my-stickymenu-settings', |
| 117 | 'Settings Admin', |
| 118 | 'Settings', |
| 119 | 'manage_options', |
| 120 | 'my-stickymenu-settings', |
| 121 | array( $this, 'create_admin_page' ) |
| 122 | ); |
| 123 | add_submenu_page( |
| 124 | 'my-stickymenu-settings', |
| 125 | 'Settings Admin', |
| 126 | 'Welcome Bar', |
| 127 | 'manage_options', |
| 128 | 'my-stickymenu-welcomebar', |
| 129 | array( $this, 'mystickystickymenu_admin_welcomebar_page' ) |
| 130 | ); |
| 131 | add_submenu_page( |
| 132 | 'my-stickymenu-settings', |
| 133 | 'Upgrade to Pro', |
| 134 | 'Upgrade to Pro', |
| 135 | 'manage_options', |
| 136 | 'my-stickymenu-upgrade', |
| 137 | array( $this, 'mystickymenu_admin_upgrade_to_pro' ) |
| 138 | ); |
| 139 | } |
| 140 | |
| 141 | public function create_admin_page(){ |
| 142 | $upgarde_url = admin_url("admin.php?page=my-stickymenu-upgrade"); |
| 143 | // Set class property |
| 144 | if (isset($_POST['mysticky_option_name']) && !empty($_POST['mysticky_option_name']) && isset($_POST['nonce'])) { |
| 145 | if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_update')) { |
| 146 | $post = $_POST['mysticky_option_name']; |
| 147 | foreach($post as $key=>$value) { |
| 148 | $post[$key] = self::sanitize_options($value); |
| 149 | } |
| 150 | |
| 151 | $post['device_desktop'] = 'on'; |
| 152 | $post['device_mobile'] = 'on'; |
| 153 | update_option( 'mysticky_option_name', $post); |
| 154 | echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>'; |
| 155 | } else { |
| 156 | wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete'); |
| 157 | echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>'; |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | $mysticky_options = get_option( 'mysticky_option_name'); |
| 162 | $is_old = get_option("has_sticky_header_old_version"); |
| 163 | $is_old = ($is_old == "yes")?true:false; |
| 164 | $nonce = wp_create_nonce('mysticky_option_backend_update'); |
| 165 | $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]="; |
| 166 | |
| 167 | $is_shown = get_option("mystickymenu_update_message"); |
| 168 | if($is_shown == 1) {?> |
| 169 | <div class="updates-form-form" > |
| 170 | <div class="popup-form-content"> |
| 171 | <div id="add-update-folder-title" class="add-update-folder-title"> |
| 172 | Would you like to get feature updates for myStickymenu in real-time? |
| 173 | </div> |
| 174 | <div class="folder-form-input"> |
| 175 | <input id="myStickymenu_update_email" autocomplete="off" value="<?php echo get_option( 'admin_email' ) ?>" placeholder="Email address"> |
| 176 | </div> |
| 177 | <div class="updates-content-buttons"> |
| 178 | <button href="javascript:;" class="button button-primary form-submit-btn yes">Yes, I want</button> |
| 179 | <button href="javascript:;" class="button button-secondary form-cancel-btn no">Skip</button> |
| 180 | <div style="clear: both"></div> |
| 181 | </div> |
| 182 | <input type="hidden" id="myStickymenu_update_nonce" value="<?php echo wp_create_nonce("myStickymenu_update_nonce") ?>"> |
| 183 | </div> |
| 184 | </div> |
| 185 | <?php } else { ?> |
| 186 | <style> |
| 187 | div#wpcontent { |
| 188 | background: rgba(101,114,219,1); |
| 189 | background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 190 | 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))); |
| 191 | background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 192 | background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 193 | background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 194 | background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 195 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 ); |
| 196 | } |
| 197 | </style> |
| 198 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 199 | <div class="sticky-header-menu"> |
| 200 | <ul> |
| 201 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-settings' ) ?>" class="active" ><?php _e('Sticky Menu', 'mystickymenu'); ?></a></li> |
| 202 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-welcomebar' ) ?>" ><?php _e('Welcome Bar', 'mystickymenu'); ?></a></li> |
| 203 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-upgrade' ) ?>"><?php _e('Upgrade to Pro', 'mystickymenu'); ?></a></li> |
| 204 | </ul> |
| 205 | </div> |
| 206 | <div style="<?php echo $welcomebar_inactive_block; ?>" id="sticky-header-settings" class="sticky-header-content"> |
| 207 | <div class="mystickymenu-heading"> |
| 208 | <div class="myStickymenu-header-title"> |
| 209 | <h3><?php esc_attr_e('How To Make a Sticky Header', 'mystickymenu'); ?></h3> |
| 210 | </div> |
| 211 | <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> |
| 212 | </div> |
| 213 | |
| 214 | <form class="mysticky-form" method="post" action="#"> |
| 215 | <div class="mystickymenu-content-section sticky-class-sec"> |
| 216 | <table> |
| 217 | <tr> |
| 218 | <td> |
| 219 | <label class="mysticky_title"><?php _e("Sticky Class", 'mystickymenu')?></label> |
| 220 | <br /><br /> |
| 221 | <?php $nav_menus = wp_get_nav_menus(); |
| 222 | $menu_locations = get_nav_menu_locations(); |
| 223 | $locations = get_registered_nav_menus(); |
| 224 | ?> |
| 225 | <select name="mysticky_option_name[mysticky_class_id_selector]" id="mystickymenu-select"> |
| 226 | <option value=""><?php _e( 'Select Sticky Menu', 'mystickymenu' ); ?></option> |
| 227 | |
| 228 | <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?> |
| 229 | <option value="<?php echo esc_attr( $_nav_menu->slug ); ?>" <?php selected( $_nav_menu->slug, $mysticky_options['mysticky_class_id_selector'] ); ?>> |
| 230 | <?php |
| 231 | echo esc_html( $_nav_menu->name ); |
| 232 | |
| 233 | if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) { |
| 234 | $locations_assigned_to_this_menu = array(); |
| 235 | foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) { |
| 236 | if ( isset( $locations[ $menu_location_key ] ) ) { |
| 237 | $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ]; |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Filters the number of locations listed per menu in the drop-down select. |
| 243 | * |
| 244 | * @since 3.6.0 |
| 245 | * |
| 246 | * @param int $locations Number of menu locations to list. Default 3. |
| 247 | */ |
| 248 | $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) ); |
| 249 | |
| 250 | // Adds ellipses following the number of locations defined in $assigned_locations. |
| 251 | if ( ! empty( $assigned_locations ) ) { |
| 252 | printf( |
| 253 | ' (%1$s%2$s)', |
| 254 | implode( ', ', $assigned_locations ), |
| 255 | count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : '' |
| 256 | ); |
| 257 | } |
| 258 | } |
| 259 | ?> |
| 260 | </option> |
| 261 | <?php endforeach; ?> |
| 262 | <option value="custom" <?php selected( 'custom', $mysticky_options['mysticky_class_id_selector'] ); ?>><?php esc_html_e( 'Other Class Or ID', 'mystickymenu' );?></option> |
| 263 | </select> |
| 264 | |
| 265 | <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'];?>" /> |
| 266 | |
| 267 | <p class="description"><?php _e("menu or header element class or id.", 'mystickymenu')?></p> |
| 268 | </td> |
| 269 | <td> |
| 270 | <div class="mysticky_device_upgrade"> |
| 271 | <label class="mysticky_title"><?php _e("Devices", 'mystickymenu')?></label> |
| 272 | <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span> |
| 273 | |
| 274 | <ul class="mystickymenu-input-multicheckbox"> |
| 275 | <li> |
| 276 | <label> |
| 277 | <input id="disable_css" name="mysticky_option_name[device_desktop]" type="checkbox" checked disabled /> |
| 278 | <?php _e( 'Desktop', 'mystickymenu' );?> |
| 279 | </label> |
| 280 | </li> |
| 281 | <li> |
| 282 | <label> |
| 283 | <input id="disable_css" name="mysticky_option_name[device_mobile]" type="checkbox" checked disabled /> |
| 284 | <?php _e( 'Mobile', 'mystickymenu' );?> |
| 285 | </label> |
| 286 | </li> |
| 287 | </ul> |
| 288 | </div> |
| 289 | </td> |
| 290 | </tr> |
| 291 | </table> |
| 292 | </div> |
| 293 | |
| 294 | |
| 295 | <div class="mystickymenu-content-section"> |
| 296 | <h3><?php esc_html_e( 'Settings', 'mystickymenu' );?></h3> |
| 297 | <table class="form-table"> |
| 298 | <tr> |
| 299 | <td> |
| 300 | <label for="myfixed_zindex" class="mysticky_title"><?php _e("Sticky z-index", 'mystickymenu')?></label> |
| 301 | </td> |
| 302 | <td> |
| 303 | <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'];?>" /> |
| 304 | </td> |
| 305 | <td> |
| 306 | <label class="mysticky_title myssticky-remove-hand"><?php _e("Fade or slide effect", 'mystickymenu')?></label> |
| 307 | </td> |
| 308 | <td> |
| 309 | <label> |
| 310 | <input name="mysticky_option_name[myfixed_fade]" value= "slide" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'slide' );?> /> |
| 311 | <?php _e("Slide", 'mystickymenu'); ?> |
| 312 | </label> |
| 313 | <label> |
| 314 | <input name="mysticky_option_name[myfixed_fade]" value="fade" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'fade' );?> /> |
| 315 | <?php _e("Fade", 'mystickymenu'); ?> |
| 316 | </label> |
| 317 | </td> |
| 318 | </tr> |
| 319 | <tr> |
| 320 | <td> |
| 321 | <label for="myfixed_disable_small_screen" class="mysticky_title"><?php _e("Disable at Small Screen Sizes", 'mystickymenu')?></label> |
| 322 | <p class="description"><?php esc_attr_e('Less than chosen screen width, set 0 to disable','mystickymenu');?></p> |
| 323 | </td> |
| 324 | <td> |
| 325 | <div class="px-wrap"> |
| 326 | <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'];?>" /> |
| 327 | <span class="input-px">PX</span> |
| 328 | </div> |
| 329 | </td> |
| 330 | <td> |
| 331 | <label for="mysticky_active_on_height" class="mysticky_title"><?php _e("Make visible on Scroll", 'mystickymenu')?></label> |
| 332 | <p class="description"><?php esc_attr_e('If set to 0 auto calculate will be used.','mystickymenu');?></p> |
| 333 | </td> |
| 334 | <td> |
| 335 | <div class="px-wrap"> |
| 336 | <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'];?>" /> |
| 337 | <span class="input-px">PX</span> |
| 338 | </div> |
| 339 | </td> |
| 340 | </tr> |
| 341 | <tr> |
| 342 | <td> |
| 343 | <label for="mysticky_active_on_height_home" class="mysticky_title"><?php _e("Make visible on Scroll at homepage", 'mystickymenu')?></label> |
| 344 | <p class="description"><?php _e( 'If set to 0 it will use initial Make visible on Scroll value.', 'mystickymenu' );?></p> |
| 345 | </td> |
| 346 | <td> |
| 347 | <div class="px-wrap"> |
| 348 | <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'];?>" /> |
| 349 | <span class="input-px">PX</span> |
| 350 | </div> |
| 351 | </td> |
| 352 | <td> |
| 353 | <label for="myfixed_bgcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Background Color", 'mystickymenu')?></label> |
| 354 | </td> |
| 355 | <td> |
| 356 | <input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" class="my-color-field" value="<?php echo $mysticky_options['myfixed_bgcolor'];?>" /> |
| 357 | |
| 358 | </td> |
| 359 | </tr> |
| 360 | <tr> |
| 361 | <td> |
| 362 | <label for="myfixed_transition_time" class="mysticky_title"><?php _e("Sticky Transition Time", 'mystickymenu')?></label> |
| 363 | </td> |
| 364 | <td> |
| 365 | <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'];?>" /> |
| 366 | </td> |
| 367 | <td> |
| 368 | <label for="myfixed_opacity" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Opacity", 'mystickymenu')?></label> |
| 369 | <p class="description"><?php _e( 'numbers 1-100.', 'mystickymenu');?></p> |
| 370 | </td> |
| 371 | <td> |
| 372 | <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'];?>" /> |
| 373 | <div id="slider"> |
| 374 | <div id="custom-handle" class="ui-slider-handle"><?php //echo $mysticky_options['myfixed_opacity'];?></div> |
| 375 | </div> |
| 376 | |
| 377 | </td> |
| 378 | </tr> |
| 379 | </table> |
| 380 | </div> |
| 381 | |
| 382 | <div class="mystickymenu-content-section <?php echo !$is_old?"mystickymenu-content-upgrade":""?>" > |
| 383 | |
| 384 | <div class="mystickymenu-content-option"> |
| 385 | <label class="mysticky_title css-style-title"><?php _e("Hide on Scroll Down", 'mystickymenu'); ?></label> |
| 386 | <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?> |
| 387 | <p> |
| 388 | <label class="mysticky_text"> |
| 389 | <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":"" ?> /> |
| 390 | <?php _e("Disable sticky menu at scroll down", 'mystickymenu'); ?> |
| 391 | </label> |
| 392 | </p> |
| 393 | </div> |
| 394 | <div class="mysticky-page-target-setting mystickymenu-content-option"> |
| 395 | <label class="mysticky_title"><?php esc_attr_e('Page targeting', 'myStickymenu'); ?></label> |
| 396 | <div class="mystickymenu-input-section mystickymenu-page-target-wrap"> |
| 397 | <div class="mysticky-welcomebar-setting-content-right"> |
| 398 | <div class="mysticky-page-options" id="mysticky-welcomebar-page-options"> |
| 399 | <?php $page_option = (isset($mysticky_options['mysticky_page_settings'])) ? $mysticky_options['mysticky_page_settings'] : array(); |
| 400 | $url_options = array( |
| 401 | 'page_contains' => 'pages that contain', |
| 402 | 'page_has_url' => 'a specific page', |
| 403 | 'page_start_with' => 'pages starting with', |
| 404 | 'page_end_with' => 'pages ending with', |
| 405 | ); |
| 406 | |
| 407 | if(!empty($page_option) && is_array($page_option)) { |
| 408 | $count = 0; |
| 409 | foreach($page_option as $k=>$option) { |
| 410 | $count++; |
| 411 | ?> |
| 412 | <div class="mysticky-page-option <?php echo $k==count($page_option)?"last":""; ?>"> |
| 413 | <div class="url-content"> |
| 414 | <div class="mysticky-welcomebar-url-select"> |
| 415 | <select name="mysticky_option_name[mysticky_page_settings][<?php echo $count; ?>][shown_on]" id="url_shown_on_<?php echo $count ?>_option"> |
| 416 | <option value="show_on" <?php echo $option['shown_on']=="show_on"?"selected":"" ?> ><?php esc_html_e( 'Show on', 'mysticky' )?></option> |
| 417 | <option value="not_show_on" <?php echo $option['shown_on']=="not_show_on"?"selected":"" ?>><?php esc_html_e( "Don't show on", "mysticky" );?></option> |
| 418 | </select> |
| 419 | </div> |
| 420 | <div class="mysticky-welcomebar-url-option"> |
| 421 | <select class="mysticky-url-options" name="mysticky_option_name[mysticky_page_settings][<?php echo $count; ?>][option]" id="url_rules_<?php echo $count ?>_option"> |
| 422 | <option disabled value=""><?php esc_html_e( "Select Rule", "mysticky" );?></option> |
| 423 | <?php foreach($url_options as $key=>$value) { |
| 424 | $selected = ( isset($option['option']) && $option['option']==$key )?" selected='selected' ":""; |
| 425 | echo '<option '.$selected.' value="'.$key.'">'.$value.'</option>'; |
| 426 | } ?> |
| 427 | </select> |
| 428 | </div> |
| 429 | <div class="mysticky-welcomebar-url-box"> |
| 430 | <span class='mysticky-welcomebar-url'><?php echo site_url("/"); ?></span> |
| 431 | </div> |
| 432 | <div class="mysticky-welcomebar-url-values"> |
| 433 | <input type="text" value="<?php echo $option['value'] ?>" name="mysticky_option_name[mysticky_page_settings][<?php echo $count; ?>][value]" id="url_rules_<?php echo $count; ?>_value" /> |
| 434 | </div> |
| 435 | <div class="mysticky-welcomebar-url-buttons"> |
| 436 | <a class="mysticky-remove-rule" href="javascript:;">x</a> |
| 437 | </div> |
| 438 | <div class="clear"></div> |
| 439 | </div> |
| 440 | </div> |
| 441 | <?php |
| 442 | } |
| 443 | } |
| 444 | ?> |
| 445 | </div> |
| 446 | <a href="javascript:void(0);" class="create-rule" id="mysticky_create-rule"><?php esc_html_e( "Add Rule", "mystickyelements" );?></a> |
| 447 | </div> |
| 448 | <input type="hidden" id="mysticky_welcomebar_site_url" value="<?php echo site_url("/") ?>" /> |
| 449 | <div class="mysticky-page-options-html" style="display: none;"> |
| 450 | <div class="mysticky-page-option"> |
| 451 | <div class="url-content"> |
| 452 | <div class="mysticky-welcomebar-url-select"> |
| 453 | <select name="mysticky_option_name[mysticky_page_settings][__count__][shown_on]" id="url_shown_on___count___option" <?php echo !$is_pro_active?"disabled":"" ?>> |
| 454 | <option value="show_on"><?php esc_html_e("Show on", "mysticky" );?></option> |
| 455 | <option value="not_show_on"><?php esc_html_e("Don't show on", "mysticky" );?></option> |
| 456 | </select> |
| 457 | </div> |
| 458 | <div class="mysticky-welcomebar-url-option"> |
| 459 | <select class="mysticky-url-options" name="mysticky_option_name[mysticky_page_settings][__count__][option]" id="url_rules___count___option" <?php echo !$is_pro_active?"disabled":"" ?>> |
| 460 | <option selected="selected" disabled value=""><?php esc_html_e("Select Rule", "mysticky" );?></option> |
| 461 | <?php foreach($url_options as $key=>$value) { |
| 462 | echo '<option value="'.$key.'">'.$value.'</option>'; |
| 463 | } ?> |
| 464 | </select> |
| 465 | </div> |
| 466 | <div class="mysticky-welcomebar-url-box"> |
| 467 | <span class='mysticky-welcomebar-url'><?php echo site_url("/"); ?></span> |
| 468 | </div> |
| 469 | <div class="mysticky-welcomebar-url-values"> |
| 470 | <input type="text" value="" name="mysticky_option_name[mysticky_page_settings][__count__][value]" id="url_rules___count___value" <?php echo !$is_pro_active?"disabled":"" ?> /> |
| 471 | </div> |
| 472 | <div class="mysticky-welcomebar-url-buttons"> |
| 473 | <a class="mysticky-remove-rule" href="javascript:void(0);">x</a> |
| 474 | </div> |
| 475 | <div class="clear"></div> |
| 476 | </div> |
| 477 | <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?> |
| 478 | </div> |
| 479 | </div> |
| 480 | </div> |
| 481 | </div> |
| 482 | <div class="mystickymenu-content-option"> |
| 483 | <label class="mysticky_title css-style-title"><?php _e("CSS style", 'mystickymenu'); ?></label> |
| 484 | <span class="mysticky_text"><?php _e( 'Add/edit CSS style. Leave it blank for default style.', 'mystickymenu');?></span> |
| 485 | <div class="mystickymenu-input-section"> |
| 486 | <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> |
| 487 | </div> |
| 488 | <p><?php esc_html_e( "CSS ID's and Classes to use:", "mystickymenu" );?></p> |
| 489 | <p> |
| 490 | #mysticky-wrap { }<br/> |
| 491 | #mysticky-nav.wrapfixed { }<br/> |
| 492 | #mysticky-nav.wrapfixed.up { }<br/> |
| 493 | #mysticky-nav.wrapfixed.down { }<br/> |
| 494 | #mysticky-nav .navbar { }<br/> |
| 495 | #mysticky-nav .navbar.myfixed { }<br/> |
| 496 | </p> |
| 497 | </div> |
| 498 | |
| 499 | <div class="mystickymenu-content-option"> |
| 500 | <label class="mysticky_title" for="disable_css"><?php _e("Disable CSS style", 'mystickymenu'); ?></label> |
| 501 | <div class="mystickymenu-input-section"> |
| 502 | <label> |
| 503 | <input id="disable_css" name="mysticky_option_name[disable_css]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['disable_css'], 'on' );?> /> |
| 504 | <?php _e( 'Use this option if you plan to include CSS Style manually', 'mystickymenu' );?> |
| 505 | </label> |
| 506 | </div> |
| 507 | <p></p> |
| 508 | </div> |
| 509 | |
| 510 | <div class="mystickymenu-content-option"> |
| 511 | <label class="mysticky_title"><?php _e("Disable at", 'mystickymenu'); ?></label> |
| 512 | <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade-now" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?> |
| 513 | <div class="mystickymenu-input-section"> |
| 514 | <ul class="mystickymenu-input-multicheckbox"> |
| 515 | <li> |
| 516 | <label> |
| 517 | <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' );?>/> |
| 518 | <span><?php esc_attr_e('front page', 'mystickymenu' );?></span> |
| 519 | </label> |
| 520 | </li> |
| 521 | <li> |
| 522 | <label> |
| 523 | <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' );?>/> |
| 524 | <span><?php esc_attr_e('blog page', 'mystickymenu' );?></span> |
| 525 | </label> |
| 526 | </li> |
| 527 | <li> |
| 528 | <label> |
| 529 | <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' );?> /> |
| 530 | <span><?php esc_attr_e('pages', 'mystickymenu' );?> </span> |
| 531 | </label> |
| 532 | </li> |
| 533 | <li> |
| 534 | <label> |
| 535 | <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' );?> /> |
| 536 | <span><?php esc_attr_e('tags', 'mystickymenu' );?> </span> |
| 537 | </label> |
| 538 | </li> |
| 539 | <li> |
| 540 | <label> |
| 541 | <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' );?>/> |
| 542 | <span><?php esc_attr_e('categories', 'mystickymenu' );?></span> |
| 543 | </label> |
| 544 | </li> |
| 545 | <li> |
| 546 | <label> |
| 547 | <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' );?> /> |
| 548 | <span><?php esc_attr_e('posts', 'mystickymenu' );?> </span> |
| 549 | </label> |
| 550 | </li> |
| 551 | <li> |
| 552 | <label> |
| 553 | <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' );?> /> |
| 554 | <span><?php esc_attr_e('archives', 'mystickymenu' );?> </span> |
| 555 | </label> |
| 556 | </li> |
| 557 | <li> |
| 558 | <label> |
| 559 | <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' );?> /> |
| 560 | <span><?php esc_attr_e('search', 'mystickymenu' );?> </span> |
| 561 | </label> |
| 562 | </li> |
| 563 | <li> |
| 564 | <label> |
| 565 | <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' );?>/> |
| 566 | <span><?php esc_attr_e('404', 'mystickymenu' );?> </span> |
| 567 | </label> |
| 568 | </li> |
| 569 | </ul> |
| 570 | |
| 571 | <?php |
| 572 | if (isset ( $mysticky_options['mysticky_disable_at_page'] ) == true ) { |
| 573 | echo '<div class="mystickymenu-input-section">'; |
| 574 | _e('<span class="description"><strong>Except for this pages:</strong> </span>', 'mystickymenu'); |
| 575 | |
| 576 | printf( |
| 577 | '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ', |
| 578 | isset( $mysticky_options['mysticky_enable_at_pages'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_pages']) : '' |
| 579 | ); |
| 580 | |
| 581 | _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'); |
| 582 | echo '</div>'; |
| 583 | } |
| 584 | |
| 585 | if (isset ( $mysticky_options['mysticky_disable_at_single'] ) == true ) { |
| 586 | |
| 587 | echo '<div class="mystickymenu-input-section">'; |
| 588 | _e('<span class="description"><strong>Except for this posts:</strong> </span>', 'mystickymenu'); |
| 589 | |
| 590 | printf( |
| 591 | '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ', |
| 592 | isset( $mysticky_options['mysticky_enable_at_posts'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_posts']) : '' |
| 593 | ); |
| 594 | |
| 595 | _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'); |
| 596 | echo '</div>'; |
| 597 | |
| 598 | } |
| 599 | ?> |
| 600 | <p></p> |
| 601 | </div> |
| 602 | </div> |
| 603 | |
| 604 | </div> |
| 605 | <p class="submit"> |
| 606 | <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php esc_attr_e('Save', 'mystickymenu');?>"> |
| 607 | </p> |
| 608 | <input type="hidden" name="nonce" value="<?php echo $nonce ?>"> |
| 609 | </form> |
| 610 | <form class="mysticky-hideformreset" method="post" action=""> |
| 611 | <input name="reset_mysticky_options" class="button button-secondary confirm" type="submit" value="<?php esc_attr_e('Reset', 'mystickymenu');?>" > |
| 612 | <input type="hidden" name="action" value="reset" /> |
| 613 | <?php $nonce = wp_create_nonce('mysticky_option_backend_reset_nonce'); ?> |
| 614 | <input type="hidden" name="nonce" value="<?php echo $nonce ?>"> |
| 615 | </form> |
| 616 | <p class="myStickymenu-review"><a href="https://wordpress.org/support/plugin/mystickymenu/reviews/" target="_blank"><?php esc_attr_e('Leave a review','mystickymenu'); ?></a></p> |
| 617 | </div> |
| 618 | </div> |
| 619 | <?php } |
| 620 | } |
| 621 | public function mystickystickymenu_admin_welcomebar_page() { |
| 622 | /* welcome bar save data */ |
| 623 | if (isset($_POST['mysticky_option_welcomebar']) && !empty($_POST['mysticky_option_welcomebar']) && isset($_POST['nonce'])) { |
| 624 | if(!empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'mysticky_option_welcomebar_update')) { |
| 625 | $mysticky_option_welcomebar = filter_var_array( $_POST['mysticky_option_welcomebar'], FILTER_SANITIZE_STRING ); |
| 626 | $mysticky_option_welcomebar['mysticky_welcomebar_height'] = 60; |
| 627 | $mysticky_option_welcomebar['mysticky_welcomebar_device_desktop'] = 'desktop'; |
| 628 | $mysticky_option_welcomebar['mysticky_welcomebar_device_mobile'] = 'mobile'; |
| 629 | $mysticky_option_welcomebar['mysticky_welcomebar_trigger'] = 'after_a_few_seconds'; |
| 630 | $mysticky_option_welcomebar['mysticky_welcomebar_triggersec'] = '0'; |
| 631 | $mysticky_option_welcomebar['mysticky_welcomebar_expirydate'] = ''; |
| 632 | $mysticky_option_welcomebar['mysticky_welcomebar_page_settings'] = ''; |
| 633 | update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar); |
| 634 | echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>'; |
| 635 | } else { |
| 636 | wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete'); |
| 637 | echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>'; |
| 638 | } |
| 639 | } |
| 640 | if (isset($_POST['mysticky_welcomebar_reset']) && !empty($_POST['mysticky_welcomebar_reset']) && isset($_POST['nonce_reset'])) { |
| 641 | if(!empty($_POST['nonce_reset']) && wp_verify_nonce($_POST['nonce_reset'], 'mysticky_option_welcomebar_reset')) { |
| 642 | $mysticky_option_welcomebar_reset = mysticky_welcomebar_pro_widget_default_fields(); |
| 643 | update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar_reset); |
| 644 | echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Reset Settings saved.','mystickymenu'). '</p></strong></div>'; |
| 645 | } else { |
| 646 | wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete'); |
| 647 | echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>'; |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | $mysticky_options = get_option( 'mysticky_option_name'); |
| 652 | $is_old = get_option("has_sticky_header_old_version"); |
| 653 | $is_old = ($is_old == "yes")?true:false; |
| 654 | $nonce = wp_create_nonce('mysticky_option_backend_update'); |
| 655 | $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]="; |
| 656 | |
| 657 | ?> |
| 658 | <style> |
| 659 | div#wpcontent { |
| 660 | background: rgba(101,114,219,1); |
| 661 | background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 662 | 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))); |
| 663 | background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 664 | background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 665 | background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 666 | background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 667 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 ); |
| 668 | } |
| 669 | </style> |
| 670 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 671 | <div class="sticky-header-menu"> |
| 672 | <ul> |
| 673 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-settings' ) ?>"><?php _e('Sticky Menu', 'mystickymenu'); ?></a></li> |
| 674 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-welcomebar' ) ?>" class="active" ><?php _e('Welcome Bar', 'mystickymenu'); ?></a></li> |
| 675 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-upgrade' ) ?>"><?php _e('Upgrade to Pro', 'mystickymenu'); ?></a></li> |
| 676 | </ul> |
| 677 | </div> |
| 678 | <div id="sticky-header-welcome-bar" class="sticky-header-content"> |
| 679 | <?php mysticky_welcome_bar_backend(); ?> |
| 680 | </div> |
| 681 | </div> |
| 682 | <?php |
| 683 | } |
| 684 | public function mystickymenu_admin_upgrade_to_pro() { |
| 685 | $pro_url = "https://go.premio.io/checkount/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]="; |
| 686 | ?> |
| 687 | <style> |
| 688 | div#wpcontent { |
| 689 | background: rgba(101,114,219,1); |
| 690 | background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 691 | 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))); |
| 692 | background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 693 | background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 694 | background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 695 | background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 696 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 ); |
| 697 | } |
| 698 | </style> |
| 699 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 700 | <div class="sticky-header-menu"> |
| 701 | <ul> |
| 702 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-settings' ) ?>"><?php _e('Sticky Menu', 'mystickymenu'); ?></a></li> |
| 703 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-welcomebar' ) ?>" ><?php _e('Welcome Bar', 'mystickymenu'); ?></a></li> |
| 704 | <li><a href="<?php echo admin_url( 'admin.php?page=my-stickymenu-upgrade' ) ?>" class="active" ><?php _e('Upgrade to Pro', 'mystickymenu'); ?></a></li> |
| 705 | </ul> |
| 706 | </div> |
| 707 | <div id="sticky-header-upgrade" class="sticky-header-content"> |
| 708 | <div id="rpt_pricr" class="rpt_plans rpt_3_plans rpt_style_basic"> |
| 709 | <p class="udner-title"> |
| 710 | <strong class="text-primary">Unlock All Features</strong> |
| 711 | </p> |
| 712 | <div class=""> |
| 713 | <div class="rpt_plan rpt_plan_0 "> |
| 714 | <div style="text-align:left;" class="rpt_title rpt_title_0">Basic</div> |
| 715 | <div class="rpt_head rpt_head_0"> |
| 716 | <div class="rpt_recurrence rpt_recurrence_0">For small website owners</div> |
| 717 | <div class="rpt_price rpt_price_0">$19</div> |
| 718 | <div class="rpt_description rpt_description_0 rpt_desc">Per year. Renewals for 25% off</div> |
| 719 | <div style="clear:both;"></div> |
| 720 | </div> |
| 721 | <div class="rpt_features rpt_features_0"> |
| 722 | <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> |
| 723 | <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> |
| 724 | <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> |
| 725 | <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> |
| 726 | <div class="rpt_feature rpt_feature_0-4"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Show/hide the sticky menu on specific pages</span>Page targeting<span class="rpt_tooltip_plus" > +</span></a></div> |
| 727 | <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> |
| 728 | <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> |
| 729 | <div class="rpt_feature rpt_feature_0-9"> |
| 730 | <select data-key="0" class="multiple-options"> |
| 731 | <option data-header="Renewals for 25% off" data-price="19" value="<?php echo esc_url($pro_url."1") ?>"> |
| 732 | <?php esc_html_e("Updates & support for 1 year") ?> |
| 733 | </option> |
| 734 | <option data-header="For 3 years" data-price="35" value="<?php echo esc_url($pro_url."4") ?>"> |
| 735 | <?php esc_html_e("Updates & support for 3 years") ?> |
| 736 | </option> |
| 737 | <option data-header="For lifetime" data-price="59" value="<?php echo esc_url($pro_url."5") ?>"> |
| 738 | <?php esc_html_e("Updates & support for lifetime") ?> |
| 739 | </option> |
| 740 | </select> |
| 741 | </div> |
| 742 | </div> |
| 743 | <div style="clear:both;"></div> |
| 744 | <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> |
| 745 | </div> |
| 746 | <div class="rpt_plan rpt_plan_1 rpt_recommended_plan "> |
| 747 | <div style="text-align:left;" class="rpt_title rpt_title_1">Plus<img class="rpt_recommended" src="<?php echo plugins_url("") ?>/mystickymenu/images/rpt_recommended.png" style="top: 27px;"></div> |
| 748 | <div class="rpt_head rpt_head_1"> |
| 749 | <div class="rpt_recurrence rpt_recurrence_1">For businesses with multiple websites</div> |
| 750 | <div class="rpt_price rpt_price_1">$39</div> |
| 751 | <div class="rpt_description rpt_description_1 rpt_desc">Per year. Renewals for 25% off</div> |
| 752 | <div style="clear:both;"></div> |
| 753 | </div> |
| 754 | <div class="rpt_features rpt_features_1"> |
| 755 | <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> |
| 756 | <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> |
| 757 | <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> |
| 758 | <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> |
| 759 | <div class="rpt_feature rpt_feature_1-4"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Show/hide the sticky menu on specific pages</span>Page targeting<span class="rpt_tooltip_plus" > +</span></a></div> |
| 760 | <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> |
| 761 | <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> |
| 762 | <div class="rpt_feature rpt_feature_0-9"> |
| 763 | <select data-key="0" class="multiple-options"> |
| 764 | <option data-header="Renewals for 25% off" data-price="39" value="<?php echo esc_url($pro_url."2") ?>"> |
| 765 | <?php esc_html_e("Updates & support for 1 year") ?> |
| 766 | </option> |
| 767 | <option data-header="For 3 years" data-price="65" value="<?php echo esc_url($pro_url."6") ?>"> |
| 768 | <?php esc_html_e("Updates & support for 3 years") ?> |
| 769 | </option> |
| 770 | <option data-header="For lifetime" data-price="99" value="<?php echo esc_url($pro_url."7") ?>"> |
| 771 | <?php esc_html_e("Updates & support for lifetime") ?> |
| 772 | </option> |
| 773 | </select> |
| 774 | </div> |
| 775 | </div> |
| 776 | <div style="clear:both;"></div> |
| 777 | <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> |
| 778 | </div> |
| 779 | <div class="rpt_plan rpt_plan_2 "> |
| 780 | <div style="text-align:left;" class="rpt_title rpt_title_2">Agency</div> |
| 781 | <div class="rpt_head rpt_head_2"> |
| 782 | <div class="rpt_recurrence rpt_recurrence_2">For agencies who manage clients</div> |
| 783 | <div class="rpt_price rpt_price_2">$79</div> |
| 784 | <div class="rpt_description rpt_description_2 rpt_desc">Per year. Renewals for 25% off</div> |
| 785 | <div style="clear:both;"></div> |
| 786 | </div> |
| 787 | <div class="rpt_features rpt_features_2"> |
| 788 | <div class="rpt_feature rpt_feature_2-0"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Use myStickymenu on 50 domains</span>50 websites<span class="rpt_tooltip_plus" > +</span></a></div> |
| 789 | <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> |
| 790 | <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> |
| 791 | <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> |
| 792 | <div class="rpt_feature rpt_feature_2-4"><a href="javascript:;" class="rpt_tooltip"><span class="intool"><b></b>Show/hide the sticky menu on specific pages</span>Page targeting<span class="rpt_tooltip_plus" > +</span></a></div> |
| 793 | <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> |
| 794 | <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> |
| 795 | <div class="rpt_feature rpt_feature_0-9"> |
| 796 | <select data-key="0" class="multiple-options"> |
| 797 | <option data-header="Renewals for 25% off" data-price="79" value="<?php echo esc_url($pro_url."3") ?>"> |
| 798 | <?php esc_html_e("Updates & support for 1 year") ?> |
| 799 | </option> |
| 800 | <option data-header="For 3 years" data-price="139" value="<?php echo esc_url($pro_url."8") ?>"> |
| 801 | <?php esc_html_e("Updates & support for 3 years") ?> |
| 802 | </option> |
| 803 | <option data-header="For lifetime" data-price="199" value="<?php echo esc_url($pro_url."9") ?>"> |
| 804 | <?php esc_html_e("Updates & support for lifetime") ?> |
| 805 | </option> |
| 806 | </select> |
| 807 | </div> |
| 808 | </div> |
| 809 | <div style="clear:both;"></div> |
| 810 | <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> |
| 811 | </div> |
| 812 | </div> |
| 813 | <div style="clear:both;"></div> |
| 814 | <div class="client-testimonial"> |
| 815 | <p class="text-center"><span class="dashicons dashicons-yes"></span> 30 days money back guaranteed</p> |
| 816 | <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> |
| 817 | <div class="payment"> |
| 818 | <img src="<?php echo plugins_url("") ?>/mystickymenu/images/payment.png" alt="Payment" class="payment-img" /> |
| 819 | </div> |
| 820 | <div class="testimonial-box"> |
| 821 | <div class="testimonial-image"> |
| 822 | <img src="<?php echo plugins_url("") ?>/mystickymenu/images/testimonial.png" style="top: 27px;"> |
| 823 | </div> |
| 824 | <div class="testimonial-content"> |
| 825 | 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! |
| 826 | <div class="author">Clayton Chase</div> |
| 827 | </div> |
| 828 | <div style="clear:both;"></div> |
| 829 | </div> |
| 830 | </div> |
| 831 | </div> |
| 832 | </div> |
| 833 | </div> |
| 834 | <?php |
| 835 | } |
| 836 | |
| 837 | public function mysticky_default_options() { |
| 838 | |
| 839 | global $options; |
| 840 | $menu_locations = get_nav_menu_locations(); |
| 841 | $menu_object = isset($menu_locations['menu-1']) ? wp_get_nav_menu_object( $menu_locations['menu-1'] ) : array(); |
| 842 | |
| 843 | if ( is_object($menu_object) && $menu_object->slug != '' ) { |
| 844 | $mysticky_class_id_selector = $menu_object->slug; |
| 845 | } else { |
| 846 | $mysticky_class_id_selector = 'custom'; |
| 847 | } |
| 848 | |
| 849 | $mystickyClass = '.navbar'; |
| 850 | $template_name = get_template(); |
| 851 | switch( $template_name ){ |
| 852 | case 'ashe': |
| 853 | $mysticky_class_id_selector = 'custom'; |
| 854 | $mystickyClass = '#main-nav'; |
| 855 | break; |
| 856 | case 'astra': |
| 857 | case 'hello-elementor': |
| 858 | case 'sydney': |
| 859 | case 'twentysixteen': |
| 860 | $mysticky_class_id_selector = 'custom'; |
| 861 | $mystickyClass = 'header.site-header'; |
| 862 | break; |
| 863 | case 'generatepress': |
| 864 | $mysticky_class_id_selector = 'custom'; |
| 865 | $mystickyClass = 'nav.main-navigation'; |
| 866 | break; |
| 867 | case 'transportex': |
| 868 | $mysticky_class_id_selector = 'custom'; |
| 869 | $mystickyClass = '.transportex-menu-full'; |
| 870 | break; |
| 871 | case 'hestia': |
| 872 | case 'neve': |
| 873 | $mysticky_class_id_selector = 'custom'; |
| 874 | $mystickyClass = 'header.header'; |
| 875 | break; |
| 876 | case 'mesmerize': |
| 877 | $mysticky_class_id_selector = 'custom'; |
| 878 | $mystickyClass = '.navigation-bar'; |
| 879 | break; |
| 880 | case 'oceanwp': |
| 881 | $mysticky_class_id_selector = 'custom'; |
| 882 | $mystickyClass = 'header#site-header'; |
| 883 | break; |
| 884 | case 'shapely': |
| 885 | $mysticky_class_id_selector = 'custom'; |
| 886 | $mystickyClass = '#site-navigation'; |
| 887 | break; |
| 888 | case 'storefront': |
| 889 | $mysticky_class_id_selector = 'custom'; |
| 890 | $mystickyClass = '.storefront-primary-navigation'; |
| 891 | break; |
| 892 | case 'twentynineteen': |
| 893 | $mysticky_class_id_selector = 'custom'; |
| 894 | $mystickyClass = '#site-navigation'; |
| 895 | break; |
| 896 | case 'twentyseventeen': |
| 897 | $mysticky_class_id_selector = 'custom'; |
| 898 | $mystickyClass = '.navigation-top'; |
| 899 | break; |
| 900 | default: |
| 901 | break; |
| 902 | } |
| 903 | |
| 904 | |
| 905 | $default = array( |
| 906 | 'mysticky_class_id_selector' => $mysticky_class_id_selector, |
| 907 | 'mysticky_class_selector' => $mystickyClass, |
| 908 | 'device_desktop' => 'on', |
| 909 | 'device_mobile' => 'on', |
| 910 | 'myfixed_zindex' => '99990', |
| 911 | 'myfixed_bgcolor' => '#f7f5e7', |
| 912 | 'myfixed_opacity' => '90', |
| 913 | 'myfixed_transition_time' => '0.3', |
| 914 | 'myfixed_disable_small_screen' => '0', |
| 915 | 'myfixed_disable_large_screen' => '0', |
| 916 | 'mysticky_active_on_height' => '0', |
| 917 | 'mysticky_active_on_height_home'=> '0', |
| 918 | 'myfixed_fade' => 'slide', |
| 919 | 'myfixed_cssstyle' => '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }' |
| 920 | ); |
| 921 | |
| 922 | if ( get_option('mysticky_option_name') == false ) { |
| 923 | $status = get_option("sticky_header_status"); |
| 924 | if($status == false) { |
| 925 | update_option("sticky_header_status", "done"); |
| 926 | update_option("has_sticky_header_old_version", "no"); |
| 927 | } |
| 928 | update_option( 'mysticky_option_name', $default ); |
| 929 | } else { |
| 930 | $status = get_option("sticky_header_status"); |
| 931 | if($status == false) { |
| 932 | update_option("sticky_header_status", "done"); |
| 933 | update_option("has_sticky_header_old_version", "yes"); |
| 934 | } |
| 935 | } |
| 936 | |
| 937 | if(isset($_POST['reset_mysticky_options'])) { |
| 938 | if(isset($_REQUEST['nonce']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_reset_nonce')) { |
| 939 | update_option('mysticky_option_name', $default); |
| 940 | } else { |
| 941 | |
| 942 | } |
| 943 | } |
| 944 | |
| 945 | if ( !get_option( 'update_mysticky_version_2_6') ) { |
| 946 | $mysticky_option_name = get_option( 'mysticky_option_name' ); |
| 947 | $mysticky_option_name['mysticky_class_id_selector'] = 'custom'; |
| 948 | if ($mysticky_option_name['myfixed_fade'] == 'on'){ |
| 949 | $mysticky_option_name['myfixed_fade'] = 'slide'; |
| 950 | }else{ |
| 951 | $mysticky_option_name['myfixed_fade'] = 'fade'; |
| 952 | } |
| 953 | update_option( 'mysticky_option_name', $mysticky_option_name ); |
| 954 | update_option( 'update_mysticky_version_2_6', true ); |
| 955 | } |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | |
| 960 | |
| 961 | class MyStickyMenuFrontend |
| 962 | { |
| 963 | |
| 964 | public function __construct() |
| 965 | { |
| 966 | add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) ); |
| 967 | add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) ); |
| 968 | } |
| 969 | |
| 970 | public function mysticky_build_stylesheet_content() { |
| 971 | |
| 972 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 973 | |
| 974 | if (isset($mysticky_options['disable_css'])) { |
| 975 | //do nothing |
| 976 | } else { |
| 977 | $mysticky_options['disable_css'] = false; |
| 978 | } |
| 979 | |
| 980 | if ($mysticky_options ['disable_css'] == false ) { |
| 981 | |
| 982 | echo '<style id="mystickymenu" type="text/css">'; |
| 983 | echo '#mysticky-nav { width:100%; position: static; }'; |
| 984 | 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'] . ';}'; |
| 985 | |
| 986 | |
| 987 | if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){ |
| 988 | //echo '@media (max-width: '.$mysticky_options['myfixed_disable_small_screen'].'px) {#mysticky-nav.wrapfixed {position: static;} }'; |
| 989 | }; |
| 990 | if ( !isset( $mysticky_options['myfixed_cssstyle'] ) ) { |
| 991 | echo '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }'; |
| 992 | } |
| 993 | if ( isset( $mysticky_options['myfixed_cssstyle'] ) && $mysticky_options['myfixed_cssstyle'] != '' ) { |
| 994 | echo $mysticky_options ['myfixed_cssstyle']; |
| 995 | } |
| 996 | echo '</style>'; |
| 997 | $template_name = get_template(); |
| 998 | ?> |
| 999 | <style type="text/css"> |
| 1000 | <?php if( $template_name == 'hestia' ) { ?> |
| 1001 | #mysticky-nav.wrapfixed {box-shadow: 0 1px 10px -6px #0000006b,0 1px 10px 0 #0000001f,0 4px 5px -2px #0000001a;} |
| 1002 | #mysticky-nav.wrapfixed .navbar {position: relative;background-color: transparent;box-shadow: none;} |
| 1003 | <?php } ?> |
| 1004 | <?php if( $template_name == 'shapely' ) { ?> |
| 1005 | #mysticky-nav.wrapfixed #site-navigation {position: relative;} |
| 1006 | <?php } ?> |
| 1007 | <?php if( $template_name == 'storefront' ) { ?> |
| 1008 | #mysticky-nav.wrapfixed > .site-header {margin-bottom: 0;} |
| 1009 | #mysticky-nav.wrapfixed > .storefront-primary-navigation {padding: 10px 0;} |
| 1010 | <?php } ?> |
| 1011 | <?php if( $template_name == 'transportex' ) { ?> |
| 1012 | #mysticky-nav.wrapfixed > .transportex-menu-full {margin: 0 auto;} |
| 1013 | .transportex-headwidget #mysticky-nav.wrapfixed .navbar-wp {top: 0;} |
| 1014 | <?php } ?> |
| 1015 | <?php if( $template_name == 'twentynineteen' ) { ?> |
| 1016 | #mysticky-nav.wrapfixed {padding: 10px;} |
| 1017 | <?php } ?> |
| 1018 | <?php if( $template_name == 'twentysixteen' ) { ?> |
| 1019 | #mysticky-nav.wrapfixed > .site-header {padding-top: 0;padding-bottom: 0;} |
| 1020 | <?php } ?> |
| 1021 | </style> |
| 1022 | <?php |
| 1023 | } |
| 1024 | } |
| 1025 | |
| 1026 | public function mystickymenu_google_fonts_url() { |
| 1027 | $welcomebar = get_option( 'mysticky_option_welcomebar' ); |
| 1028 | |
| 1029 | $default_fonts = array('Arial', 'Tahoma', 'Verdana', 'Helvetica', 'Times New Roman', 'Trebuchet MS', 'Georgia' ); |
| 1030 | $fonts_url = ''; |
| 1031 | $fonts = array(); |
| 1032 | $font_args = array(); |
| 1033 | $base_url = "https://fonts.googleapis.com/css"; |
| 1034 | $fonts['family']['Lato'] = 'Lato:400,500,600,700'; |
| 1035 | if ( isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] !='' && !in_array( $general_settings['font_family'], $default_fonts) ) { |
| 1036 | $fonts['family'][$welcomebar['mysticky_welcomebar_font']] = $welcomebar['mysticky_welcomebar_font'] . ':400,500,600,700'; |
| 1037 | } |
| 1038 | if ( isset($welcomebar['mysticky_welcomebar_btnfont']) && $welcomebar['mysticky_welcomebar_btnfont'] !='' && !in_array( $general_settings['font_family'], $default_fonts) ) { |
| 1039 | $fonts['family'][$welcomebar['mysticky_welcomebar_btnfont']] = $welcomebar['mysticky_welcomebar_btnfont'] . ':400,500,600,700'; |
| 1040 | } |
| 1041 | |
| 1042 | /* Prepapre URL if font family defined. */ |
| 1043 | if( !empty( $fonts['family'] ) ) { |
| 1044 | |
| 1045 | /* format family to string */ |
| 1046 | if( is_array($fonts['family']) ){ |
| 1047 | $fonts['family'] = implode( '|', $fonts['family'] ); |
| 1048 | } |
| 1049 | |
| 1050 | $font_args['family'] = urlencode( trim( $fonts['family'] ) ); |
| 1051 | |
| 1052 | if( !empty( $fonts['subsets'] ) ){ |
| 1053 | |
| 1054 | /* format subsets to string */ |
| 1055 | if( is_array( $fonts['subsets'] ) ){ |
| 1056 | $fonts['subsets'] = implode( ',', $fonts['subsets'] ); |
| 1057 | } |
| 1058 | |
| 1059 | $font_args['subsets'] = urlencode( trim( $fonts['subsets'] ) ); |
| 1060 | } |
| 1061 | |
| 1062 | $fonts_url = add_query_arg( $font_args, $base_url ); |
| 1063 | } |
| 1064 | |
| 1065 | return esc_url_raw( $fonts_url ); |
| 1066 | } |
| 1067 | |
| 1068 | public function mystickymenu_script() { |
| 1069 | |
| 1070 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 1071 | |
| 1072 | if ( is_admin_bar_showing() ) { |
| 1073 | $top = "true"; |
| 1074 | } else { |
| 1075 | $top = "false"; |
| 1076 | } |
| 1077 | wp_enqueue_style('google-fonts', $this->mystickymenu_google_fonts_url(),array(), MYSTICKY_VERSION ); |
| 1078 | |
| 1079 | // needed for update 1.7 => 1.8 ... will be removed in the future () |
| 1080 | if (isset($mysticky_options['mysticky_active_on_height_home'])) { |
| 1081 | //do nothing |
| 1082 | } else { |
| 1083 | $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height']; |
| 1084 | } |
| 1085 | |
| 1086 | |
| 1087 | if ($mysticky_options['mysticky_active_on_height_home'] == 0 ) { |
| 1088 | $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height']; |
| 1089 | } |
| 1090 | |
| 1091 | |
| 1092 | if ( is_front_page() && is_home() ) { |
| 1093 | |
| 1094 | $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home']; |
| 1095 | |
| 1096 | } elseif ( is_front_page()){ |
| 1097 | |
| 1098 | $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home']; |
| 1099 | |
| 1100 | } |
| 1101 | wp_register_script('detectmobilebrowser', plugins_url( 'js/detectmobilebrowser.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true); |
| 1102 | wp_enqueue_script( 'detectmobilebrowser' ); |
| 1103 | |
| 1104 | wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true); |
| 1105 | wp_enqueue_script( 'mystickymenu' ); |
| 1106 | |
| 1107 | $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false'; |
| 1108 | $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade'; |
| 1109 | $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? $mysticky_options['myfixed_disable_large_screen'] : '0'; |
| 1110 | |
| 1111 | $mystickyClass = ( $mysticky_options['mysticky_class_id_selector'] != 'custom') ? '.menu-' . $mysticky_options['mysticky_class_id_selector'] .'-container' : $mysticky_options['mysticky_class_selector']; |
| 1112 | |
| 1113 | if ( $mysticky_options['mysticky_class_id_selector'] != 'custom' ) { |
| 1114 | $template_name = get_template(); |
| 1115 | switch( $template_name ){ |
| 1116 | case 'ashe': |
| 1117 | $mystickyClass = '#main-nav'; |
| 1118 | break; |
| 1119 | case 'astra': |
| 1120 | case 'hello-elementor': |
| 1121 | case 'sydney': |
| 1122 | case 'twentysixteen': |
| 1123 | $mystickyClass = 'header.site-header'; |
| 1124 | break; |
| 1125 | case 'generatepress': |
| 1126 | $mystickyClass = 'nav.main-navigation'; |
| 1127 | break; |
| 1128 | case 'transportex': |
| 1129 | $mystickyClass = '.transportex-menu-full'; |
| 1130 | break; |
| 1131 | case 'hestia': |
| 1132 | case 'neve': |
| 1133 | $mystickyClass = 'header.header'; |
| 1134 | break; |
| 1135 | case 'mesmerize': |
| 1136 | $mystickyClass = '.navigation-bar'; |
| 1137 | break; |
| 1138 | case 'oceanwp': |
| 1139 | $mystickyClass = 'header#site-header'; |
| 1140 | break; |
| 1141 | case 'shapely': |
| 1142 | $mystickyClass = '#site-navigation'; |
| 1143 | break; |
| 1144 | case 'storefront': |
| 1145 | $mystickyClass = '.storefront-primary-navigation'; |
| 1146 | break; |
| 1147 | case 'twentynineteen': |
| 1148 | $mystickyClass = '#site-navigation'; |
| 1149 | break; |
| 1150 | case 'twentyseventeen': |
| 1151 | $mystickyClass = '.navigation-top'; |
| 1152 | break; |
| 1153 | default: |
| 1154 | break; |
| 1155 | } |
| 1156 | } |
| 1157 | |
| 1158 | |
| 1159 | $mysticky_translation_array = array( |
| 1160 | 'mystickyClass' => $mystickyClass, |
| 1161 | 'activationHeight' => $mysticky_options['mysticky_active_on_height'], |
| 1162 | 'disableWidth' => $mysticky_options['myfixed_disable_small_screen'], |
| 1163 | 'disableLargeWidth' => $mystickyDisableLarge, |
| 1164 | 'adminBar' => $top, |
| 1165 | 'device_desktop' => true, |
| 1166 | 'device_mobile' => true, |
| 1167 | 'mystickyTransition' => $mystickyTransition, |
| 1168 | 'mysticky_disable_down' => $myfixed_disable_scroll_down, |
| 1169 | |
| 1170 | |
| 1171 | ); |
| 1172 | wp_localize_script( 'mystickymenu', 'option', $mysticky_translation_array ); |
| 1173 | } |
| 1174 | |
| 1175 | public function mysticky_disable_at() { |
| 1176 | |
| 1177 | |
| 1178 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 1179 | |
| 1180 | $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']); |
| 1181 | $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']); |
| 1182 | $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']); |
| 1183 | $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']); |
| 1184 | $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']); |
| 1185 | $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']); |
| 1186 | $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']); |
| 1187 | $mysticky_disable_at_search = isset($mysticky_options['mysticky_disable_at_search']); |
| 1188 | $mysticky_disable_at_404 = isset($mysticky_options['mysticky_disable_at_404']); |
| 1189 | $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? $mysticky_options['mysticky_enable_at_pages'] : ''; |
| 1190 | $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? $mysticky_options['mysticky_enable_at_posts'] : ''; |
| 1191 | |
| 1192 | // Trim input to ignore empty spaces |
| 1193 | $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages)); |
| 1194 | $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts)); |
| 1195 | |
| 1196 | |
| 1197 | |
| 1198 | |
| 1199 | if ( is_front_page() && is_home() ) { /* Default homepage */ |
| 1200 | |
| 1201 | if ( $mysticky_disable_at_front_home == false ) { |
| 1202 | $this->mystickymenu_script(); |
| 1203 | } |
| 1204 | } elseif ( is_front_page()){ /* Static homepage */ |
| 1205 | |
| 1206 | if ( $mysticky_disable_at_front_home == false ) { |
| 1207 | $this->mystickymenu_script(); |
| 1208 | } |
| 1209 | |
| 1210 | } elseif ( is_home()){ /* Blog page */ |
| 1211 | |
| 1212 | if ( $mysticky_disable_at_blog == false ) { |
| 1213 | $this->mystickymenu_script(); |
| 1214 | } |
| 1215 | |
| 1216 | } elseif ( is_page() ){ /* Single page*/ |
| 1217 | |
| 1218 | if ( $mysticky_disable_at_page == false ) { |
| 1219 | $this->mystickymenu_script(); |
| 1220 | } |
| 1221 | if ( is_page( $mysticky_enable_at_pages_exp ) ){ |
| 1222 | $this->mystickymenu_script(); |
| 1223 | } |
| 1224 | |
| 1225 | } elseif ( is_tag()){ /* Tag page */ |
| 1226 | |
| 1227 | if ( $mysticky_disable_at_tag == false ) { |
| 1228 | $this->mystickymenu_script(); |
| 1229 | } |
| 1230 | |
| 1231 | } elseif ( is_category()){ /* Category page */ |
| 1232 | |
| 1233 | if ( $mysticky_disable_at_category == false ) { |
| 1234 | $this->mystickymenu_script(); |
| 1235 | } |
| 1236 | |
| 1237 | } elseif ( is_single()){ /* Single post */ |
| 1238 | |
| 1239 | if ( $mysticky_disable_at_single == false ) { |
| 1240 | $this->mystickymenu_script(); |
| 1241 | } |
| 1242 | |
| 1243 | if ( is_single( $mysticky_enable_at_posts_exp ) ){ |
| 1244 | $this->mystickymenu_script(); |
| 1245 | } |
| 1246 | |
| 1247 | } elseif ( is_archive()){ /* Archive */ |
| 1248 | |
| 1249 | if ( $mysticky_disable_at_archive == false ) { |
| 1250 | $this->mystickymenu_script(); |
| 1251 | } |
| 1252 | |
| 1253 | } elseif ( is_search()){ /* Search */ |
| 1254 | |
| 1255 | if ( $mysticky_disable_at_search == false ) { |
| 1256 | $this->mystickymenu_script(); |
| 1257 | } |
| 1258 | |
| 1259 | } elseif ( is_404()){ /* 404 */ |
| 1260 | |
| 1261 | if ( $mysticky_disable_at_404 == false ) { |
| 1262 | $this->mystickymenu_script(); |
| 1263 | } |
| 1264 | } |
| 1265 | |
| 1266 | } |
| 1267 | |
| 1268 | } |
| 1269 | |
| 1270 | if( is_admin() ) { |
| 1271 | new MyStickyMenuBackend(); |
| 1272 | require_once 'mystickymenu-affiliate.php'; |
| 1273 | |
| 1274 | } else { |
| 1275 | new MyStickyMenuFrontend(); |
| 1276 | } |