mystickymenu
Last commit date
css
3 years ago
fonts
4 years ago
images
3 years ago
js
3 years ago
languages
3 years ago
class-review-box.php
3 years ago
class-upgrade-box.php
3 years ago
help.php
3 years ago
index.php
8 years ago
mystickymenu-affiliate.php
3 years ago
mystickymenu-contact-leads.php
3 years ago
mystickymenu-deactivate-form.php
3 years ago
mystickymenu-fonts.php
3 years ago
mystickymenu-popup.php
3 years ago
mystickymenu.php
3 years ago
mystickymeny-new-welcomebar.php
3 years ago
readme.txt
2 years ago
recommended-plugins.php
3 years ago
stickymenu-dashboard.php
3 years ago
uninstall.php
3 years ago
update.php
3 years ago
upgrade-to-pro.php
3 years ago
welcome-bar.php
3 years ago
mystickymenu.php
2039 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.6.4 |
| 7 | Author: Premio |
| 8 | Author URI: https://premio.io/downloads/mystickymenu/ |
| 9 | Text Domain: mystickymenu |
| 10 | Domain Path: /languages |
| 11 | License: GPLv2 or later |
| 12 | */ |
| 13 | |
| 14 | defined('ABSPATH') or die("Cannot access pages directly."); |
| 15 | define( 'MYSTICKY_VERSION', '2.6.4' ); |
| 16 | define('MYSTICKYMENU_URL', plugins_url('/', __FILE__)); // Define Plugin URL |
| 17 | define('MYSTICKYMENU_PATH', plugin_dir_path(__FILE__)); // Define Plugin Directory Path |
| 18 | |
| 19 | require_once("mystickymenu-fonts.php"); |
| 20 | require_once("welcome-bar.php"); |
| 21 | |
| 22 | if( is_admin() ) { |
| 23 | include_once 'class-review-box.php'; |
| 24 | include_once 'class-upgrade-box.php'; |
| 25 | } |
| 26 | |
| 27 | class MyStickyMenuBackend |
| 28 | { |
| 29 | private $options; |
| 30 | |
| 31 | public function __construct() |
| 32 | { |
| 33 | add_action( 'admin_menu', array( $this, 'add_plugin_page' ) ); |
| 34 | add_action( 'admin_init', array( $this, 'mysticky_load_transl') ); |
| 35 | add_action( 'admin_init', array( $this, 'mysticky_default_options' ) ); |
| 36 | add_action( 'admin_enqueue_scripts', array( $this, 'mysticky_admin_script' ) ); |
| 37 | add_filter( 'plugin_action_links_mystickymenu/mystickymenu.php', array( $this, 'mystickymenu_settings_link' ) ); |
| 38 | add_action( 'activated_plugin', array( $this, 'mystickymenu_activation_redirect' ) ); |
| 39 | add_action( "wp_ajax_sticky_menu_update_status", array($this, 'sticky_menu_update_status')); |
| 40 | add_action( "wp_ajax_mystickymenu_update_popup_status", array($this, 'mystickymenu_popup_status')); |
| 41 | add_action( 'admin_footer', array( $this, 'mystickymenu_deactivate' ) ); |
| 42 | add_action( 'wp_ajax_mystickymenu_plugin_deactivate', array( $this, 'mystickymenu_plugin_deactivate' ) ); |
| 43 | add_action( 'wp_ajax_stickymenu_widget_delete', array( $this, 'stickymenu_widget_delete' ) ); |
| 44 | add_action( 'wp_ajax_mystickymenu_widget_status', array( $this, 'mystickymenu_widget_status' ) ); |
| 45 | add_action( 'wp_ajax_stickymenu_status_update', array( $this, 'stickymenu_status_update' ) ); |
| 46 | add_action( 'wp_ajax_mystickymenu_delete_contact_lead', array( $this, 'mystickymenu_delete_contact_lead' ) ); |
| 47 | add_action( 'wp_ajax_my_sticky_menu_bulks', array( $this, 'my_sticky_menu_bulks' ) ); |
| 48 | |
| 49 | add_action( 'wp_ajax_mystickymenu_admin_send_message_to_owner', array( $this, 'mystickymenu_admin_send_message_to_owner' ) ); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | public function stickymenu_status_update(){ |
| 56 | check_ajax_referer( 'mystickymenu', 'wpnonce' ); |
| 57 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 58 | if( isset($_POST['stickymenu_status']) && $_POST['stickymenu_status'] != '' ){ |
| 59 | |
| 60 | $stickymenu_status = $_POST['stickymenu_status']; |
| 61 | $mysticky_options['stickymenu_enable'] = $stickymenu_status; |
| 62 | update_option('mysticky_option_name',$mysticky_options); |
| 63 | } |
| 64 | wp_die(); |
| 65 | } |
| 66 | |
| 67 | public function mystickymenu_popup_status() { |
| 68 | if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mystickymenu_update_popup_status')) { |
| 69 | update_option("mystickymenu_intro_box", "hide"); |
| 70 | } |
| 71 | echo esc_attr("1"); |
| 72 | die; |
| 73 | } |
| 74 | |
| 75 | public function mystickymenu_widget_status() { |
| 76 | |
| 77 | check_ajax_referer( 'mystickymenu', 'wpnonce' ); |
| 78 | |
| 79 | if ( isset($_POST['widget_id']) && $_POST['widget_id'] != '' && isset($_POST['widget_status']) && $_POST['widget_status'] != '' ) { |
| 80 | $welcomebars_widgets = get_option( 'mystickymenu-welcomebars' ); |
| 81 | $widget_id = $_POST['widget_id']; |
| 82 | $welcomebars_widget_no = '-' . $widget_id ; |
| 83 | |
| 84 | if( $widget_id == 0 || $welcomebars_widgets[$widget_id] == 'default' ){ |
| 85 | $stickymenu_widget = get_option('mysticky_option_welcomebar'); |
| 86 | $welcomebars_widget_no = ''; |
| 87 | } |
| 88 | $widget_status = $_POST['widget_status']; |
| 89 | $stickymenu_widget['mysticky_welcomebar_enable'] = $widget_status; |
| 90 | |
| 91 | update_option( 'mysticky_option_welcomebar',$stickymenu_widget); |
| 92 | } |
| 93 | wp_die(); |
| 94 | } |
| 95 | |
| 96 | public function stickymenu_widget_delete(){ |
| 97 | |
| 98 | check_ajax_referer( 'mystickymenu', 'wpnonce' ); |
| 99 | if ( isset($_POST['widget_id']) && $_POST['widget_id'] != '' && isset($_POST['widget_delete']) && $_POST['widget_delete'] == 1 ) { |
| 100 | $welcomebars_widgets = get_option( 'mystickymenu-welcomebars' ); |
| 101 | $widget_id = $_POST['widget_id']; |
| 102 | foreach( $welcomebars_widgets as $key => $widget_value ){ |
| 103 | $element_widget_no = ''; |
| 104 | if ( $key != 0 ) { |
| 105 | $element_widget_no = '-' . $key; |
| 106 | } |
| 107 | delete_option( 'mysticky_option_welcomebar' . $element_widget_no ); |
| 108 | } |
| 109 | |
| 110 | delete_option( 'mystickymenu-welcomebars' ); |
| 111 | } |
| 112 | wp_die(); |
| 113 | } |
| 114 | |
| 115 | public function sticky_menu_update_status() { |
| 116 | if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'myStickymenu_update_nonce')) { |
| 117 | $status = self::sanitize_options($_REQUEST['status']); |
| 118 | $email = self::sanitize_options($_REQUEST['email']); |
| 119 | |
| 120 | update_option("mystickymenu_update_message", 2); |
| 121 | |
| 122 | if($status == 1) { |
| 123 | $url = 'https://premioapps.com/premio/signup/email.php'; |
| 124 | $apiParams = [ |
| 125 | 'plugin' => 'myStickymenu', |
| 126 | 'email' => $email, |
| 127 | ]; |
| 128 | |
| 129 | // Signup Email for Chaty |
| 130 | $apiResponse = wp_safe_remote_post($url, ['body' => $apiParams, 'timeout' => 15, 'sslverify' => true]); |
| 131 | |
| 132 | if (is_wp_error($apiResponse)) { |
| 133 | wp_safe_remote_post($url, ['body' => $apiParams, 'timeout' => 15, 'sslverify' => false]); |
| 134 | } |
| 135 | |
| 136 | $response['status'] = 1; |
| 137 | } |
| 138 | } |
| 139 | die; |
| 140 | } |
| 141 | |
| 142 | |
| 143 | public function mystickymenu_delete_contact_lead(){ |
| 144 | global $wpdb; |
| 145 | if ( ! current_user_can( 'manage_options' ) ) { |
| 146 | wp_die(0); |
| 147 | } |
| 148 | check_ajax_referer( 'mystickymenu', 'wpnonce' ); |
| 149 | |
| 150 | if ( isset($_POST['ID']) && $_POST['ID'] != '' ) { |
| 151 | $ID = sanitize_text_field($_POST['ID']); |
| 152 | $table = $wpdb->prefix . 'mystickymenu_contact_lists'; |
| 153 | $delete_sql = $wpdb->prepare("DELETE FROM {$table} WHERE id = %d",$ID); |
| 154 | $delete = $wpdb->query($delete_sql); |
| 155 | } |
| 156 | |
| 157 | if ( isset($_POST['all_leads']) && $_POST['all_leads'] == 1 ) { |
| 158 | $table = $wpdb->prefix . 'mystickymenu_contact_lists'; |
| 159 | $delete = $wpdb->query("TRUNCATE TABLE $table"); |
| 160 | } |
| 161 | wp_die(); |
| 162 | |
| 163 | } |
| 164 | |
| 165 | |
| 166 | public function my_sticky_menu_bulks(){ |
| 167 | global $wpdb; |
| 168 | check_ajax_referer( 'mystickymenu', 'wpnonce' ); |
| 169 | if( isset($_POST['wpnonce']) ){ |
| 170 | $bulks = isset($_POST['bulks']) ? $_POST['bulks'] : array(); |
| 171 | foreach( $bulks as $key => $bulk ){ |
| 172 | $ID = sanitize_text_field($bulk); |
| 173 | $table = $wpdb->prefix . 'mystickymenu_contact_lists'; |
| 174 | $delete_sql = $wpdb->prepare("DELETE FROM {$table} WHERE id = %d",$ID); |
| 175 | $delete = $wpdb->query($delete_sql); |
| 176 | } |
| 177 | } |
| 178 | wp_die(); |
| 179 | } |
| 180 | |
| 181 | public function mystickymenu_admin_send_message_to_owner() { |
| 182 | $response = array(); |
| 183 | $response['status'] = 0; |
| 184 | $response['error'] = 0; |
| 185 | $response['errors'] = array(); |
| 186 | $response['message'] = ""; |
| 187 | $errorArray = []; |
| 188 | $errorMessage = __("%s is required", "mystickymenu"); |
| 189 | $postData = $_POST; |
| 190 | if(!isset($postData['textarea_text']) || trim($postData['textarea_text']) == "") { |
| 191 | $error = array( |
| 192 | "key" => "textarea_text", |
| 193 | "message" => __("Please enter your message","wcp") |
| 194 | ); |
| 195 | $errorArray[] = $error; |
| 196 | } |
| 197 | if(!isset($postData['user_email']) || trim($postData['user_email']) == "") { |
| 198 | $error = array( |
| 199 | "key" => "user_email", |
| 200 | "message" => sprintf($errorMessage,__("Email","wcp")) |
| 201 | ); |
| 202 | $errorArray[] = $error; |
| 203 | } else if(!filter_var($postData['user_email'], FILTER_VALIDATE_EMAIL)) { |
| 204 | $error = array( |
| 205 | 'key' => "user_email", |
| 206 | "message" => "Email is not valid" |
| 207 | ); |
| 208 | $errorArray[] = $error; |
| 209 | } |
| 210 | if(empty($errorArray)) { |
| 211 | if(!isset($_REQUEST['nonce']) || empty($_REQUEST['nonce'])) { |
| 212 | $error = array( |
| 213 | 'key' => "nonce", |
| 214 | "message" => "Your request is not valid" |
| 215 | ); |
| 216 | $errorArray[] = $error; |
| 217 | } else if(!wp_verify_nonce($_REQUEST['nonce'], "mystickymenu_send_message_to_owner")) { |
| 218 | $error = array( |
| 219 | 'key' => "nonce", |
| 220 | "message" => "Your request is not valid" |
| 221 | ); |
| 222 | $errorArray[] = $error; |
| 223 | } |
| 224 | } |
| 225 | if(empty($errorArray)) { |
| 226 | global $current_user; |
| 227 | $text_message = $postData['textarea_text']; |
| 228 | $email = $postData['user_email']; |
| 229 | $domain = site_url(); |
| 230 | $user_name = $current_user->first_name." ".$current_user->last_name; |
| 231 | |
| 232 | $response['status'] = 1; |
| 233 | |
| 234 | /* sending message to Crisp */ |
| 235 | $post_message = array(); |
| 236 | |
| 237 | $message_data = array(); |
| 238 | $message_data['key'] = "Plugin"; |
| 239 | $message_data['value'] = "My Sticky Menu"; |
| 240 | $post_message[] = $message_data; |
| 241 | |
| 242 | $message_data = array(); |
| 243 | $message_data['key'] = "Domain"; |
| 244 | $message_data['value'] = $domain; |
| 245 | $post_message[] = $message_data; |
| 246 | |
| 247 | $message_data = array(); |
| 248 | $message_data['key'] = "Email"; |
| 249 | $message_data['value'] = $email; |
| 250 | $post_message[] = $message_data; |
| 251 | |
| 252 | $message_data = array(); |
| 253 | $message_data['key'] = "Message"; |
| 254 | $message_data['value'] = $text_message; |
| 255 | $post_message[] = $message_data; |
| 256 | |
| 257 | $api_params = array( |
| 258 | 'domain' => $domain, |
| 259 | 'email' => $email, |
| 260 | 'url' => site_url(), |
| 261 | 'name' => $user_name, |
| 262 | 'message' => $post_message, |
| 263 | 'plugin' => "MSE", |
| 264 | 'type' => "Need Help", |
| 265 | ); |
| 266 | |
| 267 | /* Sending message to Crisp API */ |
| 268 | |
| 269 | $crisp_response = wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => true)); |
| 270 | |
| 271 | if (is_wp_error($crisp_response)) { |
| 272 | wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => false)); |
| 273 | } |
| 274 | } else { |
| 275 | $response['error'] = 1; |
| 276 | $response['errors'] = $errorArray; |
| 277 | } |
| 278 | echo json_encode($response); |
| 279 | wp_die(); |
| 280 | } |
| 281 | |
| 282 | |
| 283 | public function mystickymenu_settings_link($links){ |
| 284 | $settings_link = '<a href="admin.php?page=my-stickymenu-welcomebar">Settings</a>'; |
| 285 | $links['go_pro'] = '<a href="'.admin_url("admin.php?page=my-stickymenu-upgrade&type=upgrade").'" style="color: #FF5983; font-weight: bold; display: inline-block; border: solid 1px #FF5983; border-radius: 4px; padding: 0 5px;">'.__( 'Upgrade', 'stars-testimonials' ).'</a>'; |
| 286 | array_unshift($links, $settings_link); |
| 287 | return $links; |
| 288 | } |
| 289 | |
| 290 | public function mystickymenu_activation_redirect( $plugin) { |
| 291 | if( $plugin == plugin_basename( __FILE__ ) ) { |
| 292 | $is_shown = get_option("mystickymenu_update_message"); |
| 293 | if($is_shown === false) { |
| 294 | add_option("mystickymenu_update_message", 1); |
| 295 | } |
| 296 | $option = get_option("mystickymenu_intro_box"); |
| 297 | if($option === false) { |
| 298 | add_option("mystickymenu_intro_box", "show"); |
| 299 | } |
| 300 | |
| 301 | $welcomebar_widgets = get_option("mysticky_option_welcomebar"); |
| 302 | if ( $welcomebar_widgets ) { |
| 303 | wp_redirect( admin_url( 'admin.php?page=my-stickymenu-welcomebar' ) ) ; |
| 304 | } else { |
| 305 | wp_redirect( admin_url( 'admin.php?page=my-stickymenu-welcomebar&widget=0' ) ) ; |
| 306 | } |
| 307 | |
| 308 | exit; |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | public function mysticky_admin_script($hook) { |
| 313 | |
| 314 | if ( !isset($_GET['page']) || ( isset($_GET['page']) && $_GET['page'] != 'my-stickymenu-settings' && $_GET['page'] != 'my-stickymenu-welcomebar' && $_GET['page'] != 'my-stickymenu-new-welcomebar' && $_GET['page'] != 'my-stickymenu-upgrade' && $_GET['page'] != 'msm-recommended-plugins' && $_GET['page'] != 'my-sticky-menu-leads' )) { |
| 315 | return; |
| 316 | } |
| 317 | |
| 318 | wp_enqueue_style('mystickymenuAdminStyle', plugins_url('/css/mystickymenu-admin.css', __FILE__), array(), MYSTICKY_VERSION ); |
| 319 | wp_style_add_data( 'mystickymenuAdminStyle', 'rtl', 'replace' ); |
| 320 | wp_enqueue_style( 'wp-color-picker' ); |
| 321 | wp_enqueue_style( 'wp-jquery-ui-dialog' ); |
| 322 | wp_enqueue_style('jquery-ui'); |
| 323 | |
| 324 | wp_enqueue_script('jquery-ui'); |
| 325 | wp_enqueue_script('jquery-ui-slider'); |
| 326 | wp_enqueue_script( 'jquery-ui-dialog' ); |
| 327 | |
| 328 | if ( isset($_GET['page']) && $_GET['page'] == 'my-stickymenu-upgrade' ) { |
| 329 | wp_enqueue_script( 'my-select2', plugins_url('js/select2.min.js', __FILE__ ), array( 'wp-color-picker' ), false, true ); |
| 330 | wp_enqueue_style('my-css-select2', plugins_url('css/select2.min.css', __FILE__), array(), MYSTICKY_VERSION ); |
| 331 | |
| 332 | wp_enqueue_style('stickymenu-pricing-table', plugins_url('/css/pricing-table.css', __FILE__), [], MYSTICKY_VERSION); |
| 333 | $queryArgs = [ |
| 334 | 'family' => 'Poppins:wght@400;500;600;700&display=swap', |
| 335 | 'subset' => 'latin,latin-ext', |
| 336 | ]; |
| 337 | wp_enqueue_style('google-poppins-fonts', add_query_arg($queryArgs, "//fonts.googleapis.com/css2"), [], null); |
| 338 | |
| 339 | wp_enqueue_script('stickymenu-slick', plugins_url('/js/slick.min.js', __FILE__), ['jquery'], MYSTICKY_VERSION); |
| 340 | } |
| 341 | |
| 342 | wp_enqueue_script( 'morphext-js', plugins_url('/js/morphext/morphext.min.js', __FILE__) , array('jquery'), MYSTICKY_VERSION, true ); |
| 343 | wp_enqueue_script('mystickymenuAdminScript', plugins_url('/js/mystickymenu-admin.js', __FILE__), array( 'jquery', 'jquery-ui-slider', 'wp-color-picker' ), MYSTICKY_VERSION); |
| 344 | |
| 345 | $locale_settings = array( |
| 346 | 'ajaxurl' => admin_url('admin-ajax.php'), |
| 347 | 'mystickymenu_url' => MYSTICKYMENU_URL, |
| 348 | 'ajax_nonce' => wp_create_nonce('mystickymenu'), |
| 349 | ); |
| 350 | |
| 351 | wp_localize_script('mystickymenuAdminScript', 'mystickymenu', $locale_settings); |
| 352 | |
| 353 | } |
| 354 | |
| 355 | public function mysticky_load_transl(){ |
| 356 | load_plugin_textdomain('mystickymenu', FALSE, dirname(plugin_basename(__FILE__)).'/languages/'); |
| 357 | } |
| 358 | |
| 359 | function sanitize_options($value) { |
| 360 | $value = stripslashes($value); |
| 361 | $value = filter_var($value, FILTER_SANITIZE_STRING); |
| 362 | return $value; |
| 363 | } |
| 364 | |
| 365 | public function add_plugin_page(){ |
| 366 | if ( isset($_GET['hide_msmrecommended_plugin']) && $_GET['hide_msmrecommended_plugin'] == 1) { |
| 367 | update_option('hide_msmrecommended_plugin',true); |
| 368 | } |
| 369 | $hide_msmrecommended_plugin = get_option('hide_msmrecommended_plugin'); |
| 370 | // This page will be under "Settings" |
| 371 | add_menu_page( |
| 372 | 'Settings Admin', |
| 373 | 'myStickymenu', |
| 374 | 'manage_options', |
| 375 | 'my-stickymenu-welcomebar', |
| 376 | array( $this, 'mystickystickymenu_admin_welcomebar_page' ) |
| 377 | ); |
| 378 | add_submenu_page( |
| 379 | 'my-stickymenu-welcomebar', |
| 380 | 'Settings Admin', |
| 381 | 'Dashboard', |
| 382 | 'manage_options', |
| 383 | 'my-stickymenu-welcomebar', |
| 384 | array( $this, 'mystickystickymenu_admin_welcomebar_page' ) |
| 385 | ); |
| 386 | |
| 387 | add_submenu_page( |
| 388 | 'my-stickymenu-welcomebar', |
| 389 | 'Settings Admin', |
| 390 | '+ Create New Welcome Bar', |
| 391 | 'manage_options', |
| 392 | 'my-stickymenu-new-welcomebar', |
| 393 | array( $this, 'mystickystickymenu_admin_new_welcomebar_page' ) |
| 394 | ); |
| 395 | |
| 396 | add_submenu_page( |
| 397 | 'my-stickymenu-welcomebar', |
| 398 | 'Settings Admin', |
| 399 | 'Contact Form Leads', |
| 400 | 'manage_options', |
| 401 | 'my-sticky-menu-leads', |
| 402 | array( $this, 'mystickymenu_admin_leads_page' ) |
| 403 | ); |
| 404 | |
| 405 | add_submenu_page( |
| 406 | 'my-stickymenu-welcomebar', |
| 407 | 'Settings Admin', |
| 408 | 'Sticky menu settings', |
| 409 | 'manage_options', |
| 410 | 'my-stickymenu-settings', |
| 411 | array( $this, 'create_admin_page' ) |
| 412 | ); |
| 413 | |
| 414 | |
| 415 | if ( !$hide_msmrecommended_plugin){ |
| 416 | add_submenu_page( |
| 417 | 'my-stickymenu-welcomebar', |
| 418 | 'msm-recommended-plugins', |
| 419 | 'Recommended Plugins', |
| 420 | 'manage_options', |
| 421 | 'msm-recommended-plugins', |
| 422 | array( $this, 'mystickymenu_recommended_plugins' ) |
| 423 | ); |
| 424 | } |
| 425 | add_submenu_page( |
| 426 | 'my-stickymenu-welcomebar', |
| 427 | 'Upgrade to Pro', |
| 428 | 'Upgrade to Pro', |
| 429 | 'manage_options', |
| 430 | 'my-stickymenu-upgrade', |
| 431 | array( $this, 'mystickymenu_admin_upgrade_to_pro' ) |
| 432 | ); |
| 433 | } |
| 434 | |
| 435 | public function create_admin_page(){ |
| 436 | |
| 437 | $upgarde_url = admin_url("admin.php?page=my-stickymenu-upgrade"); |
| 438 | // Set class property |
| 439 | if (isset($_POST['mysticky_option_name']) && !empty($_POST['mysticky_option_name']) && isset($_POST['nonce'])) { |
| 440 | if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_update')) { |
| 441 | $post = $_POST['mysticky_option_name']; |
| 442 | foreach($post as $key=>$value) { |
| 443 | $post[$key] = self::sanitize_options($value); |
| 444 | } |
| 445 | |
| 446 | $post['device_desktop'] = 'on'; |
| 447 | $post['device_mobile'] = 'on'; |
| 448 | update_option( 'mysticky_option_name', $post); |
| 449 | $this->mysticky_clear_all_caches(); |
| 450 | |
| 451 | |
| 452 | if(isset($_POST['submit']) && $_POST['submit'] == 'SAVE & VIEW DASHBOARD'){ |
| 453 | ?> |
| 454 | <script> |
| 455 | window.location.href = <?php echo "'".admin_url("admin.php?page=my-stickymenu-welcomebar")."'";?>; |
| 456 | </script> |
| 457 | <?php |
| 458 | } |
| 459 | echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>'; |
| 460 | } else { |
| 461 | wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete'); |
| 462 | echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>'; |
| 463 | } |
| 464 | } |
| 465 | |
| 466 | $mysticky_options = get_option( 'mysticky_option_name'); |
| 467 | $is_old = get_option("has_sticky_header_old_version"); |
| 468 | $is_old = ($is_old == "yes")?true:false; |
| 469 | $nonce = wp_create_nonce('mysticky_option_backend_update'); |
| 470 | $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]="; |
| 471 | |
| 472 | $is_shown = get_option("mystickymenu_update_message"); |
| 473 | if($is_shown == 1) { |
| 474 | |
| 475 | include_once MYSTICKYMENU_PATH . '/update.php'; |
| 476 | } else { |
| 477 | |
| 478 | $option = get_option("mystickymenu_intro_box"); |
| 479 | if($option == "show") { |
| 480 | include_once dirname(__FILE__) . "/mystickymenu-popup.php"; |
| 481 | } |
| 482 | ?> |
| 483 | <style> |
| 484 | div#wpcontent { |
| 485 | background: rgba(101,114,219,1); |
| 486 | background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 487 | 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))); |
| 488 | background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 489 | background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 490 | background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 491 | background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 492 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 ); |
| 493 | } |
| 494 | </style> |
| 495 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 496 | |
| 497 | <div id="sticky-header-settings" class="sticky-header-content"> |
| 498 | |
| 499 | <form class="mysticky-form" id="mystickymenuform" method="post" action="#"> |
| 500 | <div class="mystickymenu-heading"> |
| 501 | <div class="mysticky-stickymenu-header-title mystickymenu-content-section"> |
| 502 | <h3><?php _e('Sticky menu', 'myStickymenu'); ?></h3> |
| 503 | <label for="mysticky-stickymenu-form-enabled" class="mysticky-welcomebar-switch stickymenu-switch"> |
| 504 | <input type="checkbox" id="mysticky-stickymenu-form-enabled" name="mysticky_option_name[stickymenu_enable]" value="1" <?php checked( @$mysticky_options['stickymenu_enable'], '1' );?> /> |
| 505 | <span class="slider"></span> |
| 506 | </label> |
| 507 | <div class="mysticky-stickymenu-backword-page"> |
| 508 | <a href="<?php echo admin_url("admin.php?page=my-stickymenu-welcomebar");?>"><span class="dashicons dashicons-arrow-left-alt2 back-dashboard" style="color: unset;font-size: 17px;"></span> <?php _e('Back to Dashboard', 'myStickymenu'); ?></a> |
| 509 | </div> |
| 510 | </div> |
| 511 | <div class="myStickymenu-header-title"> |
| 512 | <h3><?php esc_attr_e('How To Make a Sticky Header', 'mystickymenu'); ?></h3> |
| 513 | </div> |
| 514 | <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> |
| 515 | </div> |
| 516 | <div class="mystickymenu-content-section sticky-class-sec"> |
| 517 | <table> |
| 518 | <tr> |
| 519 | <td> |
| 520 | <label class="mysticky_title"><?php _e("Sticky Class", 'mystickymenu')?></label> |
| 521 | <br /><br /> |
| 522 | <?php $nav_menus = wp_get_nav_menus(); |
| 523 | $menu_locations = get_nav_menu_locations(); |
| 524 | $locations = get_registered_nav_menus(); |
| 525 | ?> |
| 526 | <select name="mysticky_option_name[mysticky_class_id_selector]" id="mystickymenu-select"> |
| 527 | <option value=""><?php _e( 'Select Sticky Menu', 'mystickymenu' ); ?></option> |
| 528 | |
| 529 | <?php foreach ( (array) $nav_menus as $_nav_menu ) : ?> |
| 530 | <option value="<?php echo esc_attr( $_nav_menu->slug ); ?>" <?php selected( $_nav_menu->slug, $mysticky_options['mysticky_class_id_selector'] ); ?>> |
| 531 | <?php |
| 532 | echo esc_html( $_nav_menu->name ); |
| 533 | |
| 534 | if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) { |
| 535 | $locations_assigned_to_this_menu = array(); |
| 536 | foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) { |
| 537 | if ( isset( $locations[ $menu_location_key ] ) ) { |
| 538 | $locations_assigned_to_this_menu[] = $locations[ $menu_location_key ]; |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | /** |
| 543 | * Filters the number of locations listed per menu in the drop-down select. |
| 544 | * |
| 545 | * @since 3.6.0 |
| 546 | * |
| 547 | * @param int $locations Number of menu locations to list. Default 3. |
| 548 | */ |
| 549 | $assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) ); |
| 550 | |
| 551 | // Adds ellipses following the number of locations defined in $assigned_locations. |
| 552 | if ( ! empty( $assigned_locations ) ) { |
| 553 | printf( |
| 554 | ' (%1$s%2$s)', |
| 555 | implode( ', ', $assigned_locations ), |
| 556 | count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' …' : '' |
| 557 | ); |
| 558 | } |
| 559 | } |
| 560 | ?> |
| 561 | </option> |
| 562 | <?php endforeach; ?> |
| 563 | <option value="custom" <?php selected( 'custom', $mysticky_options['mysticky_class_id_selector'] ); ?>><?php esc_html_e( 'Other Class Or ID', 'mystickymenu' );?></option> |
| 564 | </select> |
| 565 | |
| 566 | <input type="text" size="18" id="mysticky_class_selector" class="mystickyinput" name="mysticky_option_name[mysticky_class_selector]" value="<?php echo esc_attr($mysticky_options['mysticky_class_selector']);?>" /> |
| 567 | |
| 568 | <p class="description mystuckymenu-class-id"> |
| 569 | <span class="dashicons dashicons-info"></span> |
| 570 | <span> |
| 571 | <?php echo sprintf(__('Need help finding your ID/Class? Install <a href="%s" target="_blank">CSS Peeper</a> to quickly get your navigation menu ID/Class. Here\'s a quick <a href="%s" target="_blank">video <span class="dashicons dashicons-controls-play"></span></a> of how you can do it.', 'mystickymenu'), 'https://chrome.google.com/webstore/detail/css-peeper/mbnbehikldjhnfehhnaidhjhoofhpehk?hl=en', 'https://www.youtube.com/watch?v=uuNqSkBPnLU');?> |
| 572 | </span> |
| 573 | </p> |
| 574 | </td> |
| 575 | <td> |
| 576 | <div class="mysticky_device_upgrade"> |
| 577 | <label class="mysticky_title"><?php _e("Devices", 'mystickymenu')?></label> |
| 578 | <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span> |
| 579 | |
| 580 | <ul class="mystickymenu-input-multicheckbox"> |
| 581 | <li> |
| 582 | <label> |
| 583 | <input id="disable_css" name="mysticky_option_name[device_desktop]" type="checkbox" checked disabled /> |
| 584 | <?php _e( 'Desktop', 'mystickymenu' );?> |
| 585 | </label> |
| 586 | </li> |
| 587 | <li> |
| 588 | <label> |
| 589 | <input id="disable_css" name="mysticky_option_name[device_mobile]" type="checkbox" checked disabled /> |
| 590 | <?php _e( 'Mobile', 'mystickymenu' );?> |
| 591 | </label> |
| 592 | </li> |
| 593 | </ul> |
| 594 | </div> |
| 595 | </td> |
| 596 | </tr> |
| 597 | </table> |
| 598 | </div> |
| 599 | <div class="mystickymenu-content-section"> |
| 600 | <h3><?php esc_html_e( 'Settings', 'mystickymenu' );?></h3> |
| 601 | <table class="form-table"> |
| 602 | <tr> |
| 603 | <td> |
| 604 | <label for="myfixed_zindex" class="mysticky_title"><?php _e("Sticky z-index", 'mystickymenu')?></label> |
| 605 | </td> |
| 606 | <td> |
| 607 | <input type="number" min="0" max="2147483647" step="1" class="mysticky-number" id="myfixed_zindex" name="mysticky_option_name[myfixed_zindex]" value="<?php echo esc_attr($mysticky_options['myfixed_zindex']);?>" /> |
| 608 | </td> |
| 609 | <td> |
| 610 | <label class="mysticky_title myssticky-remove-hand"><?php _e("Fade or slide effect", 'mystickymenu')?></label> |
| 611 | </td> |
| 612 | <td> |
| 613 | <label> |
| 614 | <input name="mysticky_option_name[myfixed_fade]" value= "slide" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'slide' );?> /> |
| 615 | <?php _e("Slide", 'mystickymenu'); ?> |
| 616 | </label> |
| 617 | <label> |
| 618 | <input name="mysticky_option_name[myfixed_fade]" value="fade" type="radio" <?php checked( @$mysticky_options['myfixed_fade'], 'fade' );?> /> |
| 619 | <?php _e("Fade", 'mystickymenu'); ?> |
| 620 | </label> |
| 621 | </td> |
| 622 | </tr> |
| 623 | <tr> |
| 624 | <td> |
| 625 | <label for="myfixed_disable_small_screen" class="mysticky_title"><?php _e("Disable at Small Screen Sizes", 'mystickymenu')?></label> |
| 626 | <p class="description"><?php esc_attr_e('Less than chosen screen width, set 0 to disable','mystickymenu');?></p> |
| 627 | </td> |
| 628 | <td> |
| 629 | <div class="px-wrap"> |
| 630 | <input type="number" class="" min="0" step="1" id="myfixed_disable_small_screen" name="mysticky_option_name[myfixed_disable_small_screen]" value="<?php echo esc_attr($mysticky_options['myfixed_disable_small_screen']);?>" /> |
| 631 | <span class="input-px">PX</span> |
| 632 | </div> |
| 633 | </td> |
| 634 | <td> |
| 635 | <label for="mysticky_active_on_height" class="mysticky_title"><?php _e("Make visible on Scroll", 'mystickymenu')?></label> |
| 636 | <p class="description"><?php esc_attr_e('If set to 0 auto calculate will be used.','mystickymenu');?></p> |
| 637 | </td> |
| 638 | <td> |
| 639 | <div class="px-wrap"> |
| 640 | <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 esc_attr($mysticky_options['mysticky_active_on_height']);?>" /> |
| 641 | <span class="input-px">PX</span> |
| 642 | </div> |
| 643 | </td> |
| 644 | </tr> |
| 645 | <tr> |
| 646 | <td> |
| 647 | <label for="mysticky_active_on_height_home" class="mysticky_title"><?php _e("Make visible on Scroll at homepage", 'mystickymenu')?></label> |
| 648 | <p class="description"><?php _e( 'If set to 0 it will use initial Make visible on Scroll value.', 'mystickymenu' );?></p> |
| 649 | </td> |
| 650 | <td> |
| 651 | <div class="px-wrap"> |
| 652 | <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 esc_attr($mysticky_options['mysticky_active_on_height_home']);;?>" /> |
| 653 | <span class="input-px">PX</span> |
| 654 | </div> |
| 655 | </td> |
| 656 | <td> |
| 657 | <label for="myfixed_bgcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Background Color", 'mystickymenu')?></label> |
| 658 | </td> |
| 659 | <td> |
| 660 | <input type="text" id="myfixed_bgcolor" name="mysticky_option_name[myfixed_bgcolor]" class="my-color-field" data-alpha="true" value="<?php echo esc_attr($mysticky_options['myfixed_bgcolor']);;?>" /> |
| 661 | |
| 662 | </td> |
| 663 | </tr> |
| 664 | <tr> |
| 665 | <td> |
| 666 | <label for="myfixed_transition_time" class="mysticky_title"><?php _e("Sticky Transition Time", 'mystickymenu')?></label> |
| 667 | </td> |
| 668 | <td> |
| 669 | <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 esc_attr($mysticky_options['myfixed_transition_time']);?>" /> |
| 670 | </td> |
| 671 | <td> |
| 672 | <label for="myfixed_textcolor" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Text Color", 'mystickymenu')?></label> |
| 673 | </td> |
| 674 | <td> |
| 675 | <input type="text" id="myfixed_textcolor" name="mysticky_option_name[myfixed_textcolor]" class="my-color-field" data-alpha="true" value="<?php echo (isset($mysticky_options['myfixed_textcolor'])) ? $mysticky_options['myfixed_textcolor'] : '';?>" /> |
| 676 | |
| 677 | </td> |
| 678 | </tr> |
| 679 | <tr> |
| 680 | <td> |
| 681 | <label for="myfixed_opacity" class="mysticky_title myssticky-remove-hand"><?php _e("Sticky Opacity", 'mystickymenu')?></label> |
| 682 | <p class="description"><?php _e( 'numbers 1-100.', 'mystickymenu');?></p> |
| 683 | </td> |
| 684 | <td> |
| 685 | <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 esc_attr($mysticky_options['myfixed_opacity']);;?>" /> |
| 686 | <div id="slider"> |
| 687 | <div id="custom-handle" class="ui-slider-handle"><?php //echo esc_attr($mysticky_options['myfixed_opacity']);?></div> |
| 688 | </div> |
| 689 | |
| 690 | </td> |
| 691 | </tr> |
| 692 | </table> |
| 693 | </div> |
| 694 | |
| 695 | <div class="mystickymenu-content-section <?php echo !$is_old?"mystickymenu-content-upgrade":""?>" > |
| 696 | |
| 697 | <div class="mystickymenu-content-option"> |
| 698 | <label class="mysticky_title css-style-title"><?php _e("Hide on Scroll Down", 'mystickymenu'); ?></label> |
| 699 | <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?> |
| 700 | <p> |
| 701 | <label class="mysticky_text"> |
| 702 | <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":"" ?> /> |
| 703 | <?php _e("Disable sticky menu at scroll down", 'mystickymenu'); ?> |
| 704 | </label> |
| 705 | </p> |
| 706 | </div> |
| 707 | <div class="mysticky-page-target-setting mystickymenu-content-option"> |
| 708 | <label class="mysticky_title"><?php esc_attr_e('Page targeting', 'myStickymenu'); ?></label> |
| 709 | <div class="mystickymenu-input-section mystickymenu-page-target-wrap"> |
| 710 | <div class="mysticky-welcomebar-setting-content-right"> |
| 711 | <div class="mysticky-page-options" id="mysticky-welcomebar-page-options"> |
| 712 | <?php $page_option = (isset($mysticky_options['mysticky_page_settings'])) ? $mysticky_options['mysticky_page_settings'] : array(); |
| 713 | $url_options = array( |
| 714 | 'page_contains' => 'pages that contain', |
| 715 | 'page_has_url' => 'a specific page', |
| 716 | 'page_start_with' => 'pages starting with', |
| 717 | 'page_end_with' => 'pages ending with', |
| 718 | ); |
| 719 | |
| 720 | if(!empty($page_option) && is_array($page_option)) { |
| 721 | $count = 0; |
| 722 | foreach($page_option as $k=>$option) { |
| 723 | $count++; |
| 724 | ?> |
| 725 | <div class="mysticky-page-option <?php echo ( $k==count($page_option) ) ? "last":""; ?>"> |
| 726 | <div class="url-content"> |
| 727 | <div class="mysticky-welcomebar-url-select"> |
| 728 | <select name="mysticky_option_name[mysticky_page_settings][<?php echo esc_attr($count); ?>][shown_on]" id="url_shown_on_<?php echo esc_attr($count); ?>_option"> |
| 729 | <option value="show_on" <?php echo ($option['shown_on']=="show_on" ) ? "selected":"" ?> ><?php esc_html_e( 'Show on', 'mysticky' )?></option> |
| 730 | <option value="not_show_on" <?php echo ($option['shown_on']=="not_show_on" )? "selected":""; ?>><?php esc_html_e( "Don't show on", "mysticky" );?></option> |
| 731 | </select> |
| 732 | </div> |
| 733 | <div class="mysticky-welcomebar-url-option"> |
| 734 | <select class="mysticky-url-options" name="mysticky_option_name[mysticky_page_settings][<?php echo esc_attr($count);; ?>][option]" id="url_rules_<?php echo esc_attr($count); ?>_option"> |
| 735 | <option disabled value=""><?php esc_html_e( "Select Rule", "mysticky" );?></option> |
| 736 | <?php foreach($url_options as $key=>$value) { |
| 737 | $selected = ( isset($option['option']) && $option['option']==$key )?" selected='selected' ":""; |
| 738 | echo '<option '.$selected.' value="'.$key.'">'.$value.'</option>'; |
| 739 | } ?> |
| 740 | </select> |
| 741 | </div> |
| 742 | <div class="mysticky-welcomebar-url-box"> |
| 743 | <span class='mysticky-welcomebar-url'><?php echo site_url("/"); ?></span> |
| 744 | </div> |
| 745 | <div class="mysticky-welcomebar-url-values"> |
| 746 | <input type="text" value="<?php echo esc_attr($option['value']) ?>" name="mysticky_option_name[mysticky_page_settings][<?php echo esc_attr($count); ?>][value]" id="url_rules_<?php echo esc_attr($count);; ?>_value" /> |
| 747 | </div> |
| 748 | <div class="mysticky-welcomebar-url-buttons"> |
| 749 | <a class="mysticky-remove-rule" href="javascript:;">x</a> |
| 750 | </div> |
| 751 | <div class="clear"></div> |
| 752 | </div> |
| 753 | </div> |
| 754 | <?php |
| 755 | } |
| 756 | } |
| 757 | ?> |
| 758 | </div> |
| 759 | <a href="javascript:void(0);" class="create-rule" id="mysticky_create-rule"><?php esc_html_e( "Add Rule", "mystickymenu" );?></a> |
| 760 | </div> |
| 761 | <input type="hidden" id="mysticky_welcomebar_site_url" value="<?php echo site_url("/") ?>" /> |
| 762 | <div class="mysticky-page-options-html" style="display: none;"> |
| 763 | <div class="mysticky-page-option"> |
| 764 | <div class="url-content"> |
| 765 | <div class="mysticky-welcomebar-url-select"> |
| 766 | <select name="" id="url_shown_on___count___option"> |
| 767 | <option value="show_on"><?php esc_html_e("Show on", "mysticky" );?></option> |
| 768 | <option value="not_show_on"><?php esc_html_e("Don't show on", "mysticky" );?></option> |
| 769 | </select> |
| 770 | </div> |
| 771 | <div class="mysticky-welcomebar-url-option"> |
| 772 | <select class="mysticky-url-options" name="" id="url_rules___count___option"> |
| 773 | <option selected="selected" disabled value=""><?php esc_html_e("Select Rule", "mysticky" );?></option> |
| 774 | <?php foreach($url_options as $key=>$value) { |
| 775 | echo '<option value="'.$key.'">'.$value.'</option>'; |
| 776 | } ?> |
| 777 | </select> |
| 778 | </div> |
| 779 | <div class="mysticky-welcomebar-url-box"> |
| 780 | <span class='mysticky-welcomebar-url'><?php echo site_url("/"); ?></span> |
| 781 | </div> |
| 782 | <div class="mysticky-welcomebar-url-values"> |
| 783 | <input type="text" value="" name="mysticky_option_name[mysticky_page_settings][__count__][value]" id="url_rules___count___value" disabled /> |
| 784 | </div> |
| 785 | <div class="clear"></div> |
| 786 | </div> |
| 787 | <span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span> |
| 788 | </div> |
| 789 | </div> |
| 790 | </div> |
| 791 | </div> |
| 792 | <div class="mystickymenu-content-option"> |
| 793 | <label class="mysticky_title css-style-title"><?php _e("CSS style", 'mystickymenu'); ?></label> |
| 794 | <span class="mysticky_text"><?php _e( 'Add/edit CSS style. Leave it blank for default style.', 'mystickymenu');?></span> |
| 795 | <div class="mystickymenu-input-section"> |
| 796 | <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> |
| 797 | </div> |
| 798 | <p><?php esc_html_e( "CSS ID's and Classes to use:", "mystickymenu" );?></p> |
| 799 | <p> |
| 800 | #mysticky-wrap { }<br/> |
| 801 | #mysticky-nav.wrapfixed { }<br/> |
| 802 | #mysticky-nav.wrapfixed.up { }<br/> |
| 803 | #mysticky-nav.wrapfixed.down { }<br/> |
| 804 | #mysticky-nav .navbar { }<br/> |
| 805 | #mysticky-nav .navbar.myfixed { }<br/> |
| 806 | </p> |
| 807 | </div> |
| 808 | |
| 809 | <div class="mystickymenu-content-option"> |
| 810 | <label class="mysticky_title" for="disable_css"><?php _e("Disable CSS style", 'mystickymenu'); ?></label> |
| 811 | <div class="mystickymenu-input-section"> |
| 812 | <label> |
| 813 | <input id="disable_css" name="mysticky_option_name[disable_css]" type="checkbox" <?php echo !$is_old?"disabled":"" ?> <?php checked( @$mysticky_options['disable_css'], 'on' );?> /> |
| 814 | <?php _e( 'Use this option if you plan to include CSS Style manually', 'mystickymenu' );?> |
| 815 | </label> |
| 816 | </div> |
| 817 | <p></p> |
| 818 | </div> |
| 819 | |
| 820 | <div class="mystickymenu-content-option"> |
| 821 | <label class="mysticky_title"><?php _e("Disable at", 'mystickymenu'); ?></label> |
| 822 | <?php if(!$is_old) { ?><span class="myStickymenu-upgrade"><a class="sticky-header-upgrade" href="<?php echo esc_url($upgarde_url); ?>" target="_blank"><?php _e( 'Upgrade Now', 'mystickymenu' );?></a></span><?php } ?> |
| 823 | <div class="mystickymenu-input-section"> |
| 824 | <ul class="mystickymenu-input-multicheckbox"> |
| 825 | <li> |
| 826 | <label> |
| 827 | <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' );?>/> |
| 828 | <span><?php esc_attr_e('front page', 'mystickymenu' );?></span> |
| 829 | </label> |
| 830 | </li> |
| 831 | <li> |
| 832 | <label> |
| 833 | <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' );?>/> |
| 834 | <span><?php esc_attr_e('blog page', 'mystickymenu' );?></span> |
| 835 | </label> |
| 836 | </li> |
| 837 | <li> |
| 838 | <label> |
| 839 | <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' );?> /> |
| 840 | <span><?php esc_attr_e('pages', 'mystickymenu' );?> </span> |
| 841 | </label> |
| 842 | </li> |
| 843 | <li> |
| 844 | <label> |
| 845 | <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' );?> /> |
| 846 | <span><?php esc_attr_e('tags', 'mystickymenu' );?> </span> |
| 847 | </label> |
| 848 | </li> |
| 849 | <li> |
| 850 | <label> |
| 851 | <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' );?>/> |
| 852 | <span><?php esc_attr_e('categories', 'mystickymenu' );?></span> |
| 853 | </label> |
| 854 | </li> |
| 855 | <li> |
| 856 | <label> |
| 857 | <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' );?> /> |
| 858 | <span><?php esc_attr_e('posts', 'mystickymenu' );?> </span> |
| 859 | </label> |
| 860 | </li> |
| 861 | <li> |
| 862 | <label> |
| 863 | <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' );?> /> |
| 864 | <span><?php esc_attr_e('archives', 'mystickymenu' );?> </span> |
| 865 | </label> |
| 866 | </li> |
| 867 | <li> |
| 868 | <label> |
| 869 | <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' );?> /> |
| 870 | <span><?php esc_attr_e('search', 'mystickymenu' );?> </span> |
| 871 | </label> |
| 872 | </li> |
| 873 | <li> |
| 874 | <label> |
| 875 | <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' );?>/> |
| 876 | <span><?php esc_attr_e('404', 'mystickymenu' );?> </span> |
| 877 | </label> |
| 878 | </li> |
| 879 | </ul> |
| 880 | |
| 881 | <?php |
| 882 | if (isset ( $mysticky_options['mysticky_disable_at_page'] ) == true ) { |
| 883 | echo '<div class="mystickymenu-input-section">'; |
| 884 | _e('<span class="description"><strong>Except for this pages:</strong> </span>', 'mystickymenu'); |
| 885 | |
| 886 | printf( |
| 887 | '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_pages" name="mysticky_option_name[mysticky_enable_at_pages]" value="%s" /> ', |
| 888 | isset( $mysticky_options['mysticky_enable_at_pages'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_pages']) : '' |
| 889 | ); |
| 890 | |
| 891 | _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'); |
| 892 | echo '</div>'; |
| 893 | } |
| 894 | |
| 895 | if (isset ( $mysticky_options['mysticky_disable_at_single'] ) == true ) { |
| 896 | |
| 897 | echo '<div class="mystickymenu-input-section">'; |
| 898 | _e('<span class="description"><strong>Except for this posts:</strong> </span>', 'mystickymenu'); |
| 899 | |
| 900 | printf( |
| 901 | '<input type="text" size="26" class="mystickymenu_normal_text" id="mysticky_enable_at_posts" name="mysticky_option_name[mysticky_enable_at_posts]" value="%s" /> ', |
| 902 | isset( $mysticky_options['mysticky_enable_at_posts'] ) ? esc_attr( $mysticky_options['mysticky_enable_at_posts']) : '' |
| 903 | ); |
| 904 | |
| 905 | _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'); |
| 906 | echo '</div>'; |
| 907 | |
| 908 | } |
| 909 | ?> |
| 910 | <p></p> |
| 911 | </div> |
| 912 | </div> |
| 913 | </div> |
| 914 | |
| 915 | <!-- Mysticky Menu: Save & Save Dashbaord Submission Validation Popup --> |
| 916 | |
| 917 | <div class="mystickymenu-action-popup new-center" id="mysticky-sticky-save-confirm" style="display:none;"> |
| 918 | <div class="mystickymenu-action-popup-header"> |
| 919 | <h3><?php esc_html_e("Turn on Sticky Menu","mystickymenu"); ?></h3> |
| 920 | <span class="dashicons dashicons-no-alt close-button" data-from = "stickymenu-confirm"></span> |
| 921 | </div> |
| 922 | <div class="mystickymenu-action-popup-body"> |
| 923 | <p><?php esc_html_e("Sticky Menu is not turned on. Turn on Sticky Menu to activate sticky menu on your website.","mystickymenu"); ?></p> |
| 924 | </div> |
| 925 | <div class="mystickymenu-action-popup-footer"> |
| 926 | <button type="button" class="btn-enable btn-nevermind-status" id="stickymenu_status_dolater" ><?php esc_html_e("Just save & keep it off","mystickymenu"); ?></button> |
| 927 | <button type="button" class="btn-disable-cancel" id="stickymenu_status_ok" ><?php esc_html_e("Save & Turn on Sticky Menu","mystickymenu"); ?></button> |
| 928 | </div> |
| 929 | </div> |
| 930 | <div class="mystickymenupopup-overlay" id="stickymenu-option-overlay-popup"></div> |
| 931 | |
| 932 | <!-- End Save & Save Dashbaord Submission Validation Popup --> |
| 933 | |
| 934 | <p class="submit"> |
| 935 | <input type="submit" name="submit" id="submit" class="button button-primary btn-save-stickymenu" value="<?php esc_attr_e('Save', 'mystickymenu');?>"> |
| 936 | |
| 937 | <input type="submit" name="submit" id="submit" class="button button-primary save_view_dashboard" style="width: auto;" value="<?php _e('SAVE & VIEW DASHBOARD', 'mystickymenu');?>"> |
| 938 | </p> |
| 939 | <input type="hidden" name="nonce" value="<?php echo esc_attr($nonce); ?>"> |
| 940 | <input type="hidden" id="save_stickymenu" value=""/> |
| 941 | </form> |
| 942 | <form class="mysticky-hideformreset" method="post" action=""> |
| 943 | <input name="reset_mysticky_options" class="button button-secondary confirm" type="submit" value="<?php esc_attr_e('Reset', 'mystickymenu');?>" > |
| 944 | <input type="hidden" name="action" value="reset" /> |
| 945 | <?php $nonce = wp_create_nonce('mysticky_option_backend_reset_nonce'); ?> |
| 946 | <input type="hidden" name="nonce" value="<?php echo esc_attr($nonce); ?>"> |
| 947 | </form> |
| 948 | <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> |
| 949 | </div> |
| 950 | </div> |
| 951 | <?php } |
| 952 | } |
| 953 | |
| 954 | |
| 955 | public function mystickystickymenu_admin_welcomebar_page() { |
| 956 | //require_once MYSTICKYMENU_PATH . 'help.php'; |
| 957 | |
| 958 | $is_shown = get_option("mystickymenu_update_message"); |
| 959 | if($is_shown == 1) { |
| 960 | include_once MYSTICKYMENU_PATH . '/update.php'; |
| 961 | return; |
| 962 | } |
| 963 | |
| 964 | /* |
| 965 | DATE : 2022-08-04 |
| 966 | Welcome bar save data function |
| 967 | */ |
| 968 | |
| 969 | if (isset($_POST['mysticky_option_welcomebar']) && !empty($_POST['mysticky_option_welcomebar']) && isset($_POST['nonce'])) { |
| 970 | if(!empty($_POST['nonce']) && wp_verify_nonce($_POST['nonce'], 'mysticky_option_welcomebar_update')) { |
| 971 | |
| 972 | |
| 973 | $widgets = get_option( 'mysticky_option_welcomebar' ); |
| 974 | |
| 975 | $is_first_widget = 0; |
| 976 | if( isset($widgets) && $widgets == '' ){ |
| 977 | $is_first_widget = 1; |
| 978 | } |
| 979 | |
| 980 | $welcomebars_widgets[0] = 'Welcome Bar #0'; |
| 981 | update_option( 'mystickymenu-welcomebars', $welcomebars_widgets ); |
| 982 | |
| 983 | $mysticky_option_welcomebar = filter_var_array( $_POST['mysticky_option_welcomebar'], FILTER_SANITIZE_STRING ); |
| 984 | $mysticky_option_welcomebar['mysticky_welcomebar_bar_text'] = wp_kses_post($_POST['mysticky_option_welcomebar']['mysticky_welcomebar_bar_text']); |
| 985 | $mysticky_option_welcomebar['mysticky_welcomebar_height'] = 60; |
| 986 | $mysticky_option_welcomebar['mysticky_welcomebar_device_desktop'] = 'desktop'; |
| 987 | $mysticky_option_welcomebar['mysticky_welcomebar_device_mobile'] = 'mobile'; |
| 988 | $mysticky_option_welcomebar['mysticky_welcomebar_trigger'] = 'after_a_few_seconds'; |
| 989 | $mysticky_option_welcomebar['mysticky_welcomebar_triggersec'] = '0'; |
| 990 | $mysticky_option_welcomebar['mysticky_welcomebar_expirydate'] = ''; |
| 991 | $mysticky_option_welcomebar['mysticky_welcomebar_page_settings'] = ''; |
| 992 | $mysticky_option_welcomebar['mysticky_welcomebar_text_type'] = 'static_text'; |
| 993 | |
| 994 | update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar); |
| 995 | |
| 996 | $this->mysticky_clear_all_caches(); |
| 997 | |
| 998 | if($is_first_widget == 1){ |
| 999 | echo '<div class="main-popup-mystickymenu-bg first-widget-popup"><div class="main-popup-mystickymenu-bg mystickymenu_container_popupbox"><div class="firstwidget-popup-contain"><img src="'. MYSTICKYMENU_URL .'/images/firstwidget_header.svg"><h4>Your first welcome bar is up! 🎉</h4> <p> Yay - we’re happy you chose MyStickyMenu for your website. If you run into anything, the <a href=" https://premio.io/help/mystickymenu/?utm_source=firstbar" target="_blank" style="text-decoration: underline !important;"><strong>help center</strong></a> is always here for you.</p><a href="'.admin_url("admin.php?page=my-stickymenu-welcomebar").'" class="mystickymenu btn-black btn-back-dashboard">Back to Dashboard</a></div><div class="popup-modul-close-btn firstwidget-model"><a href="javascript:void(0)" class="close-chaty-maxvisitor-popup" id="close-first-popup"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 5L5 15" stroke="#4A4A4A" stroke-width="2.08" stroke-linecap="round" stroke-linejoin="round"/><path d="M5 5L15 15" stroke="#4A4A4A" stroke-width="2.08" stroke-linecap="round" stroke-linejoin="round"/></svg></a></div></div></div><div class="mystickymenupopup-overlay" id="first_widget_overlay" style="display:block;"></div>'; |
| 1000 | } |
| 1001 | |
| 1002 | echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Settings saved.','mystickymenu'). '</p></strong></div>'; |
| 1003 | } else { |
| 1004 | wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete'); |
| 1005 | echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>'; |
| 1006 | } |
| 1007 | } |
| 1008 | |
| 1009 | |
| 1010 | |
| 1011 | if (isset($_POST['mysticky_welcomebar_reset']) && !empty($_POST['mysticky_welcomebar_reset']) && isset($_POST['nonce_reset'])) { |
| 1012 | if(!empty($_POST['nonce_reset']) && wp_verify_nonce($_POST['nonce_reset'], 'mysticky_option_welcomebar_reset')) { |
| 1013 | $mysticky_option_welcomebar_reset = mysticky_welcomebar_pro_widget_default_fields(); |
| 1014 | update_option( 'mysticky_option_welcomebar', $mysticky_option_welcomebar_reset); |
| 1015 | $this->mysticky_clear_all_caches(); |
| 1016 | echo '<div class="updated settings-error notice is-dismissible "><p><strong>' . esc_html__('Reset Settings saved.','mystickymenu'). '</p></strong></div>'; |
| 1017 | } else { |
| 1018 | wp_verify_nonce($_GET['nonce'], 'wporg_frontend_delete'); |
| 1019 | echo '<div class="error settings-error notice is-dismissible "><p><strong>' . esc_html__('Unable to complete your request','mystickymenu'). '</p></strong></div>'; |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | if(isset($is_first_widget) && $is_first_widget == 0 && isset($_POST['submit']) && $_POST['submit'] == 'SAVE & VIEW DASHBOARD'){ |
| 1024 | ?> |
| 1025 | <script> |
| 1026 | window.location.href = <?php echo "'".admin_url("admin.php?page=my-stickymenu-welcomebar")."'";?>; |
| 1027 | </script> |
| 1028 | <?php |
| 1029 | } |
| 1030 | |
| 1031 | $mysticky_options = get_option( 'mysticky_option_name'); |
| 1032 | $is_old = get_option("has_sticky_header_old_version"); |
| 1033 | $is_old = ($is_old == "yes") ? true : false; |
| 1034 | $nonce = wp_create_nonce('mysticky_option_backend_update'); |
| 1035 | $pro_url = "https://go.premio.io/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]="; |
| 1036 | |
| 1037 | ?> |
| 1038 | <style> |
| 1039 | div#wpcontent { |
| 1040 | background: rgba(101,114,219,1); |
| 1041 | background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1042 | 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))); |
| 1043 | background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1044 | background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1045 | background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1046 | background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1047 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 ); |
| 1048 | } |
| 1049 | </style> |
| 1050 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 1051 | |
| 1052 | <div id="sticky-header-welcome-bar" class="sticky-header-content"> |
| 1053 | <?php |
| 1054 | |
| 1055 | $welcomebars_widgets = get_option( 'mysticky_option_welcomebar' ); |
| 1056 | if ( !isset($_GET['widget']) && isset( $_GET['page'] ) && $_GET['page'] == 'my-stickymenu-welcomebar' ) { |
| 1057 | include_once( 'stickymenu-dashboard.php'); |
| 1058 | }elseif ( !isset($_GET['isedit']) && !isset($_GET['save']) && isset($welcomebars_widgets) && !empty($welcomebars_widgets) ) { |
| 1059 | ?> |
| 1060 | <div id="mystickymenu" class="wrap mystickymenu mystickymenu-new-widget-wrap"> |
| 1061 | <?php include_once dirname(__FILE__) . '/mystickymeny-new-welcomebar.php';?> |
| 1062 | </div> |
| 1063 | <?php |
| 1064 | }else{ |
| 1065 | mysticky_welcome_bar_backend(); |
| 1066 | } |
| 1067 | ?> |
| 1068 | </div> |
| 1069 | </div> |
| 1070 | <?php |
| 1071 | } |
| 1072 | |
| 1073 | public function mystickystickymenu_admin_new_welcomebar_page() { |
| 1074 | $welcomebars_widgets = get_option( 'mysticky_option_welcomebar' ); |
| 1075 | if( isset($welcomebars_widgets) && !empty($welcomebars_widgets)){ |
| 1076 | ?> |
| 1077 | <div id="mystickymenu" class="wrap mystickymenu mystickymenu-new-widget-wrap"> |
| 1078 | <?php include_once dirname(__FILE__) . '/mystickymeny-new-welcomebar.php';?> |
| 1079 | </div> |
| 1080 | <?php |
| 1081 | }else{ ?> |
| 1082 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 1083 | <div id="sticky-header-welcome-bar" class="sticky-header-content"> |
| 1084 | <?php mysticky_welcome_bar_backend(); ?> |
| 1085 | </div> |
| 1086 | </div> |
| 1087 | <?php |
| 1088 | } |
| 1089 | |
| 1090 | } |
| 1091 | |
| 1092 | public function mystickymenu_recommended_plugins() { |
| 1093 | include_once 'recommended-plugins.php'; |
| 1094 | } |
| 1095 | |
| 1096 | public function mystickymenu_admin_upgrade_to_pro() { |
| 1097 | $pro_url = "https://go.premio.io/checkount/?edd_action=add_to_cart&download_id=2199&edd_options[price_id]="; |
| 1098 | ?> |
| 1099 | <style> |
| 1100 | div#wpcontent { |
| 1101 | background: rgba(101,114,219,1); |
| 1102 | background: -moz-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1103 | 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))); |
| 1104 | background: -webkit-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1105 | background: -o-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1106 | background: -ms-linear-gradient(-45deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1107 | background: linear-gradient(135deg, rgba(101,114,219,1) 0%, rgba(238,134,198,1) 67%, rgba(238,134,198,1) 100%); |
| 1108 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6572db', endColorstr='#ee86c6', GradientType=1 ); |
| 1109 | } |
| 1110 | </style> |
| 1111 | <div id="mystickymenu" class="wrap mystickymenu"> |
| 1112 | <?php include_once "upgrade-to-pro.php"; ?> |
| 1113 | </div> |
| 1114 | <?php |
| 1115 | } |
| 1116 | |
| 1117 | public function mysticky_default_options() { |
| 1118 | |
| 1119 | global $options; |
| 1120 | $menu_locations = get_nav_menu_locations(); |
| 1121 | $menu_object = isset($menu_locations['menu-1']) ? wp_get_nav_menu_object( $menu_locations['menu-1'] ) : array(); |
| 1122 | |
| 1123 | if ( is_object($menu_object) && $menu_object->slug != '' ) { |
| 1124 | $mysticky_class_id_selector = $menu_object->slug; |
| 1125 | } else { |
| 1126 | $mysticky_class_id_selector = 'custom'; |
| 1127 | } |
| 1128 | |
| 1129 | $mystickyClass = '.navbar'; |
| 1130 | $template_name = get_template(); |
| 1131 | switch( $template_name ){ |
| 1132 | case 'ashe': |
| 1133 | $mysticky_class_id_selector = 'custom'; |
| 1134 | $mystickyClass = '#main-nav'; |
| 1135 | break; |
| 1136 | case 'astra': |
| 1137 | case 'hello-elementor': |
| 1138 | case 'sydney': |
| 1139 | case 'twentysixteen': |
| 1140 | $mysticky_class_id_selector = 'custom'; |
| 1141 | $mystickyClass = 'header.site-header'; |
| 1142 | break; |
| 1143 | case 'generatepress': |
| 1144 | $mysticky_class_id_selector = 'custom'; |
| 1145 | $mystickyClass = 'nav.main-navigation'; |
| 1146 | break; |
| 1147 | case 'transportex': |
| 1148 | $mysticky_class_id_selector = 'custom'; |
| 1149 | $mystickyClass = '.transportex-menu-full'; |
| 1150 | break; |
| 1151 | case 'hestia': |
| 1152 | case 'neve': |
| 1153 | $mysticky_class_id_selector = 'custom'; |
| 1154 | $mystickyClass = 'header.header'; |
| 1155 | break; |
| 1156 | case 'mesmerize': |
| 1157 | $mysticky_class_id_selector = 'custom'; |
| 1158 | $mystickyClass = '.navigation-bar'; |
| 1159 | break; |
| 1160 | case 'oceanwp': |
| 1161 | $mysticky_class_id_selector = 'custom'; |
| 1162 | $mystickyClass = 'header#site-header'; |
| 1163 | break; |
| 1164 | case 'shapely': |
| 1165 | $mysticky_class_id_selector = 'custom'; |
| 1166 | $mystickyClass = '#site-navigation'; |
| 1167 | break; |
| 1168 | case 'storefront': |
| 1169 | $mysticky_class_id_selector = 'custom'; |
| 1170 | $mystickyClass = '.storefront-primary-navigation'; |
| 1171 | break; |
| 1172 | case 'twentynineteen': |
| 1173 | $mysticky_class_id_selector = 'custom'; |
| 1174 | $mystickyClass = '#site-navigation'; |
| 1175 | break; |
| 1176 | case 'twentyseventeen': |
| 1177 | $mysticky_class_id_selector = 'custom'; |
| 1178 | $mystickyClass = '.navigation-top'; |
| 1179 | break; |
| 1180 | default: |
| 1181 | break; |
| 1182 | } |
| 1183 | |
| 1184 | $default = array( |
| 1185 | 'mysticky_class_id_selector' => $mysticky_class_id_selector, |
| 1186 | 'mysticky_class_selector' => $mystickyClass, |
| 1187 | 'device_desktop' => 'on', |
| 1188 | 'device_mobile' => 'on', |
| 1189 | 'myfixed_zindex' => '99990', |
| 1190 | 'myfixed_bgcolor' => '#f7f5e7', |
| 1191 | 'myfixed_opacity' => '90', |
| 1192 | 'myfixed_transition_time' => '0.3', |
| 1193 | 'myfixed_disable_small_screen' => '0', |
| 1194 | 'myfixed_disable_large_screen' => '0', |
| 1195 | 'mysticky_active_on_height' => '0', |
| 1196 | 'mysticky_active_on_height_home'=> '0', |
| 1197 | 'myfixed_fade' => 'slide', |
| 1198 | 'myfixed_cssstyle' => '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }' |
| 1199 | ); |
| 1200 | |
| 1201 | if ( get_option('mysticky_option_name') == false && current_user_can( 'manage_options' ) ) { |
| 1202 | $status = get_option("sticky_header_status"); |
| 1203 | if($status == false) { |
| 1204 | update_option("sticky_header_status", "done"); |
| 1205 | update_option("has_sticky_header_old_version", "no"); |
| 1206 | } |
| 1207 | update_option( 'mysticky_option_name', $default ); |
| 1208 | } else { |
| 1209 | $status = get_option("sticky_header_status"); |
| 1210 | if($status == false) { |
| 1211 | update_option("sticky_header_status", "done"); |
| 1212 | update_option("has_sticky_header_old_version", "yes"); |
| 1213 | } |
| 1214 | } |
| 1215 | |
| 1216 | if(isset($_POST['reset_mysticky_options']) && current_user_can( 'manage_options' )) { |
| 1217 | if(isset($_REQUEST['nonce']) && !empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'mysticky_option_backend_reset_nonce')) { |
| 1218 | update_option('mysticky_option_name', $default); |
| 1219 | } else { |
| 1220 | |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | if ( !get_option( 'update_mysticky_version_2_6') && current_user_can( 'manage_options' )) { |
| 1225 | $mysticky_option_name = get_option( 'mysticky_option_name' ); |
| 1226 | $mysticky_option_name['mysticky_class_id_selector'] = 'custom'; |
| 1227 | if ($mysticky_option_name['myfixed_fade'] == 'on'){ |
| 1228 | $mysticky_option_name['myfixed_fade'] = 'slide'; |
| 1229 | }else{ |
| 1230 | $mysticky_option_name['myfixed_fade'] = 'fade'; |
| 1231 | } |
| 1232 | update_option( 'mysticky_option_name', $mysticky_option_name ); |
| 1233 | update_option( 'update_mysticky_version_2_6', true ); |
| 1234 | } |
| 1235 | |
| 1236 | if ( !get_option( 'update_mysticky_version_2_5_7') && current_user_can( 'manage_options' )) { |
| 1237 | $mysticky_option_name = get_option( 'mysticky_option_name' ); |
| 1238 | $mysticky_option_name['stickymenu_enable'] = 1; |
| 1239 | update_option( 'mysticky_option_name', $mysticky_option_name ); |
| 1240 | update_option( 'update_mysticky_version_2_5_7', true ); |
| 1241 | } |
| 1242 | } |
| 1243 | |
| 1244 | /* |
| 1245 | * clear cache when any option is updated |
| 1246 | * |
| 1247 | */ |
| 1248 | public function mysticky_clear_all_caches(){ |
| 1249 | |
| 1250 | try { |
| 1251 | global $wp_fastest_cache; |
| 1252 | |
| 1253 | // if W3 Total Cache is being used, clear the cache |
| 1254 | if (function_exists('w3tc_flush_all')) { |
| 1255 | w3tc_flush_all(); |
| 1256 | } |
| 1257 | /* if WP Super Cache is being used, clear the cache */ |
| 1258 | if (function_exists('wp_cache_clean_cache')) { |
| 1259 | global $file_prefix, $supercachedir; |
| 1260 | if (empty($supercachedir) && function_exists('get_supercache_dir')) { |
| 1261 | $supercachedir = get_supercache_dir(); |
| 1262 | } |
| 1263 | wp_cache_clean_cache($file_prefix); |
| 1264 | } |
| 1265 | |
| 1266 | if (class_exists('WpeCommon')) { |
| 1267 | //be extra careful, just in case 3rd party changes things on us |
| 1268 | if (method_exists('WpeCommon', 'purge_memcached')) { |
| 1269 | //WpeCommon::purge_memcached(); |
| 1270 | } |
| 1271 | if (method_exists('WpeCommon', 'clear_maxcdn_cache')) { |
| 1272 | //WpeCommon::clear_maxcdn_cache(); |
| 1273 | } |
| 1274 | if (method_exists('WpeCommon', 'purge_varnish_cache')) { |
| 1275 | //WpeCommon::purge_varnish_cache(); |
| 1276 | } |
| 1277 | } |
| 1278 | |
| 1279 | if (method_exists('WpFastestCache', 'deleteCache') && !empty($wp_fastest_cache)) { |
| 1280 | $wp_fastest_cache->deleteCache(); |
| 1281 | } |
| 1282 | if (function_exists('rocket_clean_domain')) { |
| 1283 | rocket_clean_domain(); |
| 1284 | // Preload cache. |
| 1285 | if (function_exists('run_rocket_sitemap_preload')) { |
| 1286 | run_rocket_sitemap_preload(); |
| 1287 | } |
| 1288 | } |
| 1289 | |
| 1290 | if (class_exists("autoptimizeCache") && method_exists("autoptimizeCache", "clearall")) { |
| 1291 | autoptimizeCache::clearall(); |
| 1292 | } |
| 1293 | |
| 1294 | if (class_exists("LiteSpeed_Cache_API") && method_exists("autoptimizeCache", "purge_all")) { |
| 1295 | LiteSpeed_Cache_API::purge_all(); |
| 1296 | } |
| 1297 | |
| 1298 | if ( class_exists( '\Hummingbird\Core\Utils' ) ) { |
| 1299 | |
| 1300 | $modules = \Hummingbird\Core\Utils::get_active_cache_modules(); |
| 1301 | foreach ( $modules as $module => $name ) { |
| 1302 | $mod = \Hummingbird\Core\Utils::get_module( $module ); |
| 1303 | |
| 1304 | if ( $mod->is_active() ) { |
| 1305 | if ( 'minify' === $module ) { |
| 1306 | $mod->clear_files(); |
| 1307 | } else { |
| 1308 | $mod->clear_cache(); |
| 1309 | } |
| 1310 | } |
| 1311 | } |
| 1312 | } |
| 1313 | |
| 1314 | } catch (Exception $e) { |
| 1315 | return 1; |
| 1316 | } |
| 1317 | } |
| 1318 | |
| 1319 | public function mystickymenu_deactivate() { |
| 1320 | global $pagenow; |
| 1321 | |
| 1322 | if ( 'plugins.php' !== $pagenow ) { |
| 1323 | return; |
| 1324 | } |
| 1325 | include dirname(__FILE__) . "/mystickymenu-deactivate-form.php"; |
| 1326 | } |
| 1327 | public function mystickymenu_plugin_deactivate() { |
| 1328 | global $current_user; |
| 1329 | if ( ! current_user_can( 'manage_options' ) ) { |
| 1330 | wp_die(0); |
| 1331 | } |
| 1332 | check_ajax_referer( 'mystickymenu_deactivate_nonce', 'nonce' ); |
| 1333 | |
| 1334 | $postData = $_POST; |
| 1335 | $errorCounter = 0; |
| 1336 | $response = array(); |
| 1337 | $response['status'] = 0; |
| 1338 | $response['message'] = ""; |
| 1339 | $response['valid'] = 1; |
| 1340 | if(!isset($postData['reason']) || empty($postData['reason'])) { |
| 1341 | $errorCounter++; |
| 1342 | $response['message'] = "Please provide reason"; |
| 1343 | } else if(!isset($postData['reason']) || empty($postData['reason'])) { |
| 1344 | $errorCounter++; |
| 1345 | $response['message'] = "Please provide reason"; |
| 1346 | } else { |
| 1347 | $nonce = $postData['nonce']; |
| 1348 | if(!wp_verify_nonce($nonce, 'mystickymenu_deactivate_nonce')) { |
| 1349 | $response['message'] = __("Your request is not valid", "mystickymenu"); |
| 1350 | $errorCounter++; |
| 1351 | $response['valid'] = 0; |
| 1352 | } |
| 1353 | } |
| 1354 | if($errorCounter == 0) { |
| 1355 | global $current_user; |
| 1356 | $plugin_info = get_plugin_data( dirname(__FILE__) . "/mystickymenu.php" ); |
| 1357 | $postData = $_POST; |
| 1358 | $email = "none@none.none"; |
| 1359 | |
| 1360 | if (isset($postData['email_id']) && !empty($postData['email_id']) && filter_var($postData['email_id'], FILTER_VALIDATE_EMAIL)) { |
| 1361 | $email = $postData['email_id']; |
| 1362 | } |
| 1363 | $domain = site_url(); |
| 1364 | $user_name = $current_user->first_name . " " . $current_user->last_name; |
| 1365 | |
| 1366 | $response['status'] = 1; |
| 1367 | |
| 1368 | /* sending message to Crisp */ |
| 1369 | $post_message = array(); |
| 1370 | |
| 1371 | $message_data = array(); |
| 1372 | $message_data['key'] = "Plugin"; |
| 1373 | $message_data['value'] = "My Sticky Menu"; |
| 1374 | $post_message[] = $message_data; |
| 1375 | |
| 1376 | $message_data = array(); |
| 1377 | $message_data['key'] = "Plugin Version"; |
| 1378 | $message_data['value'] = $plugin_info['Version']; |
| 1379 | $post_message[] = $message_data; |
| 1380 | |
| 1381 | $message_data = array(); |
| 1382 | $message_data['key'] = "Domain"; |
| 1383 | $message_data['value'] = $domain; |
| 1384 | $post_message[] = $message_data; |
| 1385 | |
| 1386 | $message_data = array(); |
| 1387 | $message_data['key'] = "Email"; |
| 1388 | $message_data['value'] = $email; |
| 1389 | $post_message[] = $message_data; |
| 1390 | |
| 1391 | $message_data = array(); |
| 1392 | $message_data['key'] = "WordPress Version"; |
| 1393 | $message_data['value'] = esc_attr(get_bloginfo('version')); |
| 1394 | $post_message[] = $message_data; |
| 1395 | |
| 1396 | $message_data = array(); |
| 1397 | $message_data['key'] = "PHP Version"; |
| 1398 | $message_data['value'] = PHP_VERSION; |
| 1399 | $post_message[] = $message_data; |
| 1400 | |
| 1401 | $message_data = array(); |
| 1402 | $message_data['key'] = "Message"; |
| 1403 | $message_data['value'] = $postData['reason']; |
| 1404 | $post_message[] = $message_data; |
| 1405 | |
| 1406 | $api_params = array( |
| 1407 | 'domain' => $domain, |
| 1408 | 'email' => $email, |
| 1409 | 'url' => site_url(), |
| 1410 | 'name' => $user_name, |
| 1411 | 'message' => $post_message, |
| 1412 | 'plugin' => "My Sticky Menu", |
| 1413 | 'type' => "Uninstall", |
| 1414 | ); |
| 1415 | |
| 1416 | /* Sending message to Crisp API */ |
| 1417 | $crisp_response = wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => true)); |
| 1418 | |
| 1419 | if (is_wp_error($crisp_response)) { |
| 1420 | wp_safe_remote_post("https://premioapps.com/premio/send-message-api.php", array('body' => $api_params, 'timeout' => 15, 'sslverify' => false)); |
| 1421 | } |
| 1422 | } |
| 1423 | echo json_encode($response); |
| 1424 | wp_die(); |
| 1425 | } |
| 1426 | |
| 1427 | /* * |
| 1428 | * Mysticky Menu : Contact Lead function for show all the lead which send by user. |
| 1429 | * DATE : 2022-08-04 |
| 1430 | * */ |
| 1431 | |
| 1432 | public function mystickymenu_admin_leads_page(){ |
| 1433 | global $wpdb; |
| 1434 | $where_search = ''; |
| 1435 | $table_name = $wpdb->prefix . "mystickymenu_contact_lists"; |
| 1436 | $elements_widgets = get_option( 'mystickymenu-welcomebars' ); |
| 1437 | |
| 1438 | $custom_fields = array(); |
| 1439 | if ( !empty($elements_widgets)) { |
| 1440 | foreach( $elements_widgets as $key=>$value) { |
| 1441 | $widget_no = '-'.$key; |
| 1442 | if ( $key == 0 ) { |
| 1443 | $widget_no = ''; |
| 1444 | } |
| 1445 | } |
| 1446 | } |
| 1447 | ?> |
| 1448 | <!-- /**/ */ --> |
| 1449 | <div class="wrap mystickymenu-contact-wrap"> |
| 1450 | <h2><?php _e( 'Contact Form Leads', 'mystickymenu' ); ?></h2> |
| 1451 | <p class="description"> |
| 1452 | <strong><?php esc_html_e("Contact's data is saved locally do make backup or export before uninstalling plugin", 'mystickymenu');?></strong> |
| 1453 | </p> |
| 1454 | <div> |
| 1455 | <div class="mystickymenu-btnmbox"> |
| 1456 | <div class="mystickymenu-btnbx"> |
| 1457 | <strong><?php esc_html_e('Download & Export All Subscriber to CSV file:','mystickymenu' );?> </strong> |
| 1458 | <a href="<?php echo plugins_url('mystickymenu-contact-leads.php?download_file=mystickymenu_contact_leads.csv',__FILE__); ?>" class="wpappp_buton" id="wpappp_export_to_csv" value="Export to CSV" href="#"><?php esc_html_e('Download & Export to CSV', 'mystickymenu' );?></a> |
| 1459 | </div> |
| 1460 | <div class="mystickymenu-btnbx"> |
| 1461 | <strong><?php esc_html_e('Delete All Subscibers from Database:','mystickymenu');?> </strong> |
| 1462 | |
| 1463 | <input type="button" class="wpappp_buton" id="mystickymenu_delete_all_leads" value="<?php esc_attr_e('Delete All Data', 'mystickymenu' );?>" /> |
| 1464 | </div> |
| 1465 | </div> |
| 1466 | <input type="hidden" id="delete_nonce" name="delete_nonce" value="<?php echo wp_create_nonce("mysticky_menu_delete_nonce") ?>" /> |
| 1467 | </div> |
| 1468 | |
| 1469 | <?php |
| 1470 | if ( isset($_REQUEST['search-contact']) && $_REQUEST['search-contact'] != '' ) { |
| 1471 | $where_search = "WHERE contact_name like '%" . $_REQUEST['search-contact'] . "%' OR contact_email like '%".$_REQUEST['search-contact']."%' OR contact_phone like '%".$_REQUEST['search-contact']."%'"; |
| 1472 | } |
| 1473 | ?> |
| 1474 | <div> |
| 1475 | <div class="tablenav top"> |
| 1476 | <form action="<?php echo admin_url("admin.php?page=my-sticky-menu-leads");?>" method="post"> |
| 1477 | <div class="alignleft actions bulkactions"> |
| 1478 | <select name="action" id="bulk-action-selector-top"> |
| 1479 | <option value="">Bulk Actions</option> |
| 1480 | <option value="delete_message">Delete</option> |
| 1481 | </select> |
| 1482 | <input type="submit" id="doaction" class="button action" value="Apply"> |
| 1483 | <?php wp_nonce_field( 'stickyelement-contatc-submit', 'stickyelement-contatc-submit' ); ?> |
| 1484 | </div> |
| 1485 | </form> |
| 1486 | <form action="<?php echo admin_url("admin.php?page=my-sticky-menu-leads");?>" method='get'> |
| 1487 | <input type="hidden" name="page" value='my-sticky-menu-leads'/> |
| 1488 | <p class="search-box"> |
| 1489 | <label class="screen-reader-text" for="post-search-input"><?php esc_html_e( 'Search', 'mystickymenu');?></label> |
| 1490 | <input type="search" id="post-search-input" name="search-contact" value="<?php echo (isset($_GET['search-contact']) && $_GET['search-contact'] != '') ? esc_attr($_GET['search-contact']) : ''; ?>"> |
| 1491 | <input type="submit" id="search-submit" class="button" value="<?php esc_html_e( 'Search', 'mystickymenu');?>"> |
| 1492 | </p> |
| 1493 | </form> |
| 1494 | </div> |
| 1495 | |
| 1496 | <table border="1" class="responstable"> |
| 1497 | <tr> |
| 1498 | <th style="width:1%"><?php esc_html_e( 'Bulk', 'mystickymenu' );?></th> |
| 1499 | <th><?php esc_html_e( 'ID', 'mystickymenu');?></th> |
| 1500 | <th><?php esc_html_e( 'Widget Name', 'mystickymenu');?></th> |
| 1501 | <th><?php esc_html_e( 'Name', 'mystickymenu');?></th> |
| 1502 | <th><?php esc_html_e( 'Email', 'mystickymenu');?></th> |
| 1503 | <th><?php esc_html_e( 'Phone', 'mystickymenu');?></th> |
| 1504 | <th><?php esc_html_e( 'Date', 'mystickymenu');?></th> |
| 1505 | <th><?php esc_html_e( 'URL', 'mystickymenu');?></th> |
| 1506 | <th style="width:11%"><?php esc_html_e( 'Delete', 'mystickymenu');?></th> |
| 1507 | </tr> |
| 1508 | <?php |
| 1509 | $customPagHTML = ""; |
| 1510 | $total_query = "SELECT count(*) FROM ".$table_name ." {$where_search} ORDER BY ID DESC"; |
| 1511 | $total = $wpdb->get_var( $total_query ); |
| 1512 | $items_per_page = 20; |
| 1513 | $page = ( isset( $_GET['cpage'] ) ) ? abs( (int) $_GET['cpage'] ) : 1; |
| 1514 | $offset = ( $page * $items_per_page ) - $items_per_page; |
| 1515 | $query = "SELECT * FROM " . $table_name ." {$where_search} ORDER BY ID DESC LIMIT {$offset}, {$items_per_page}"; |
| 1516 | $result = $wpdb->get_results( $query ); |
| 1517 | $total_page = ceil($total / $items_per_page); |
| 1518 | if($result){ |
| 1519 | |
| 1520 | foreach ( $result as $res ) { ?> |
| 1521 | <tr> |
| 1522 | <td><input id="cb-select-80" class="cb-select-blk" type="checkbox" name="delete_message[]" value="<?php echo esc_attr($res->ID);?>"></td> |
| 1523 | <td><a href="<?php echo esc_url(admin_url( 'admin.php?page=my-sticky-menu-leads&id=' . $res->ID ));?>"><?php echo $res->ID;?></a></td> |
| 1524 | <td><a href="<?php echo esc_url(admin_url( 'admin.php?page=my-sticky-menu-leads&id=' . $res->ID ));?>"><?php echo $res->widget_name;?></a></td> |
| 1525 | <td><?php echo $res->contact_name;?></td> |
| 1526 | <td><?php echo $res->contact_email;?></td> |
| 1527 | <td><?php echo $res->contact_phone;?></td> |
| 1528 | <td><?php echo ( isset($res->message_date) ) ? $res->message_date : '-' ;?></td> |
| 1529 | <td> |
| 1530 | <?php if ( $res->page_link) :?> |
| 1531 | <a class="external-link" href="<?php echo esc_url($res->page_link);?>" target="_blank"><span class="dashicons dashicons-external"></span></a> |
| 1532 | <?php endif;?> |
| 1533 | </td> |
| 1534 | |
| 1535 | <td> |
| 1536 | <input type="button" data-delete="<?php echo $res->ID;?>" class="mystickymenu-delete-entry" value="<?php esc_attr_e('Delete', 'mystickymenu');?>" /> |
| 1537 | </td> |
| 1538 | </tr> |
| 1539 | <?php } |
| 1540 | } else { ?> |
| 1541 | <tr> |
| 1542 | <td colspan="8" align="center"> |
| 1543 | <p class="mystickymenu-no-contact"> <?php esc_html_e('No Contact Form Leads Found!','mystickymenu');?> |
| 1544 | </p> |
| 1545 | </td> |
| 1546 | </tr> |
| 1547 | <?php } ?> |
| 1548 | |
| 1549 | </table> |
| 1550 | |
| 1551 | <?php if($total_page > 1){ ?> |
| 1552 | <div class="contactleads-pagination"> |
| 1553 | <?php |
| 1554 | $big = 999999999; // need an unlikely integer |
| 1555 | echo paginate_links( array( |
| 1556 | 'base' => add_query_arg( 'cpage', '%#%' ), |
| 1557 | 'format' => '', |
| 1558 | 'current' => $page, |
| 1559 | 'total' => $total_page |
| 1560 | ) );?> |
| 1561 | </div> |
| 1562 | <?php }?> |
| 1563 | </form> |
| 1564 | </div> |
| 1565 | </div> |
| 1566 | |
| 1567 | <!-- --> |
| 1568 | <?php |
| 1569 | } |
| 1570 | } |
| 1571 | |
| 1572 | |
| 1573 | |
| 1574 | class MyStickyMenuFrontend |
| 1575 | { |
| 1576 | |
| 1577 | public function __construct() |
| 1578 | { |
| 1579 | add_action( 'wp_head', array( $this, 'mysticky_build_stylesheet_content' ) ); |
| 1580 | add_action( 'wp_enqueue_scripts', array( $this, 'mysticky_disable_at' ) ); |
| 1581 | |
| 1582 | add_action('wp_ajax_stickymenu_contact_lead_form', array($this, 'stickymenu_contact_lead_form')); |
| 1583 | add_action('wp_ajax_nopriv_stickymenu_contact_lead_form', array($this, 'stickymenu_contact_lead_form')); |
| 1584 | } |
| 1585 | |
| 1586 | public function mysticky_build_stylesheet_content() { |
| 1587 | |
| 1588 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 1589 | |
| 1590 | if (isset($mysticky_options['disable_css'])) { |
| 1591 | //do nothing |
| 1592 | } else { |
| 1593 | $mysticky_options['disable_css'] = false; |
| 1594 | } |
| 1595 | |
| 1596 | if ($mysticky_options ['disable_css'] == false ) { |
| 1597 | |
| 1598 | echo '<style id="mystickymenu" type="text/css">'; |
| 1599 | echo '#mysticky-nav { width:100%; position: static; }'; |
| 1600 | 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'] . ';}'; |
| 1601 | |
| 1602 | echo '#mysticky-nav.wrapfixed .myfixed{ background-color: ' . $mysticky_options ['myfixed_bgcolor'] . '; position: relative;top: auto;left: auto;right: auto;}'; |
| 1603 | |
| 1604 | if ( isset($mysticky_options ['myfixed_textcolor']) && $mysticky_options ['myfixed_textcolor'] != '' ) { |
| 1605 | echo '#mysticky-nav.wrapfixed ul li.menu-item a { color: ' . $mysticky_options ['myfixed_textcolor'] . ';}'; |
| 1606 | } |
| 1607 | |
| 1608 | |
| 1609 | if ($mysticky_options ['myfixed_disable_small_screen'] > 0 ){ |
| 1610 | //echo '@media (max-width: '.$mysticky_options['myfixed_disable_small_screen'].'px) {#mysticky-nav.wrapfixed {position: static;} }'; |
| 1611 | }; |
| 1612 | if ( !isset( $mysticky_options['myfixed_cssstyle'] ) ) { |
| 1613 | echo '#mysticky-nav .myfixed { margin:0 auto; float:none; border:0px; background:none; max-width:100%; }'; |
| 1614 | } |
| 1615 | if ( isset( $mysticky_options['myfixed_cssstyle'] ) && $mysticky_options['myfixed_cssstyle'] != '' ) { |
| 1616 | echo $mysticky_options ['myfixed_cssstyle']; |
| 1617 | } |
| 1618 | echo '</style>'; |
| 1619 | $template_name = get_template(); |
| 1620 | ?> |
| 1621 | <style type="text/css"> |
| 1622 | <?php if( $template_name == 'hestia' ) { ?> |
| 1623 | #mysticky-nav.wrapfixed {box-shadow: 0 1px 10px -6px #0000006b,0 1px 10px 0 #0000001f,0 4px 5px -2px #0000001a;} |
| 1624 | #mysticky-nav.wrapfixed .navbar {position: relative;background-color: transparent;box-shadow: none;} |
| 1625 | <?php } ?> |
| 1626 | <?php if( $template_name == 'shapely' ) { ?> |
| 1627 | #mysticky-nav.wrapfixed #site-navigation {position: relative;} |
| 1628 | <?php } ?> |
| 1629 | <?php if( $template_name == 'storefront' ) { ?> |
| 1630 | #mysticky-nav.wrapfixed > .site-header {margin-bottom: 0;} |
| 1631 | #mysticky-nav.wrapfixed > .storefront-primary-navigation {padding: 10px 0;} |
| 1632 | <?php } ?> |
| 1633 | <?php if( $template_name == 'transportex' ) { ?> |
| 1634 | #mysticky-nav.wrapfixed > .transportex-menu-full {margin: 0 auto;} |
| 1635 | .transportex-headwidget #mysticky-nav.wrapfixed .navbar-wp {top: 0;} |
| 1636 | <?php } ?> |
| 1637 | <?php if( $template_name == 'twentynineteen' ) { ?> |
| 1638 | #mysticky-nav.wrapfixed {padding: 10px;} |
| 1639 | <?php } ?> |
| 1640 | <?php if( $template_name == 'twentysixteen' ) { ?> |
| 1641 | #mysticky-nav.wrapfixed > .site-header {padding-top: 0;padding-bottom: 0;} |
| 1642 | <?php } ?> |
| 1643 | <?php if( $template_name == 'twentytwenty' ) { ?> |
| 1644 | #site-header {background: transparent;} |
| 1645 | <?php } ?> |
| 1646 | </style> |
| 1647 | <?php |
| 1648 | } |
| 1649 | } |
| 1650 | |
| 1651 | public function mystickymenu_google_fonts_url() { |
| 1652 | $welcomebar = get_option( 'mysticky_option_welcomebar' ); |
| 1653 | |
| 1654 | $default_fonts = array('System Stack','Arial', 'Tahoma', 'Verdana', 'Helvetica', 'Times New Roman', 'Trebuchet MS', 'Georgia' ); |
| 1655 | $fonts_url = ''; |
| 1656 | $fonts = array(); |
| 1657 | $font_args = array(); |
| 1658 | $base_url = "https://fonts.googleapis.com/css"; |
| 1659 | $fonts['family']['Lato'] = 'Lato:400,500,600,700'; |
| 1660 | if ( isset($welcomebar['mysticky_welcomebar_font']) && $welcomebar['mysticky_welcomebar_font'] !='' && !in_array( $welcomebar['mysticky_welcomebar_font'], $default_fonts) ) { |
| 1661 | $fonts['family'][$welcomebar['mysticky_welcomebar_font']] = $welcomebar['mysticky_welcomebar_font'] . ':400,500,600,700'; |
| 1662 | } |
| 1663 | if ( isset($welcomebar['mysticky_welcomebar_btnfont']) && $welcomebar['mysticky_welcomebar_btnfont'] !='' && !in_array( $welcomebar['mysticky_welcomebar_btnfont'], $default_fonts) ) { |
| 1664 | $fonts['family'][$welcomebar['mysticky_welcomebar_btnfont']] = $welcomebar['mysticky_welcomebar_btnfont'] . ':400,500,600,700'; |
| 1665 | } |
| 1666 | |
| 1667 | /* Prepapre URL if font family defined. */ |
| 1668 | if( !empty( $fonts['family'] ) ) { |
| 1669 | |
| 1670 | /* format family to string */ |
| 1671 | if( is_array($fonts['family']) ){ |
| 1672 | $fonts['family'] = implode( '|', $fonts['family'] ); |
| 1673 | } |
| 1674 | |
| 1675 | $font_args['family'] = urlencode( trim( $fonts['family'] ) ); |
| 1676 | |
| 1677 | if( !empty( $fonts['subsets'] ) ){ |
| 1678 | |
| 1679 | /* format subsets to string */ |
| 1680 | if( is_array( $fonts['subsets'] ) ){ |
| 1681 | $fonts['subsets'] = implode( ',', $fonts['subsets'] ); |
| 1682 | } |
| 1683 | |
| 1684 | $font_args['subsets'] = urlencode( trim( $fonts['subsets'] ) ); |
| 1685 | } |
| 1686 | |
| 1687 | $fonts_url = add_query_arg( $font_args, $base_url ); |
| 1688 | } |
| 1689 | |
| 1690 | return esc_url_raw( $fonts_url ); |
| 1691 | } |
| 1692 | |
| 1693 | public function mystickymenu_script() { |
| 1694 | |
| 1695 | wp_enqueue_script( 'jquery' ); |
| 1696 | |
| 1697 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 1698 | |
| 1699 | if ( is_admin_bar_showing() ) { |
| 1700 | $top = "true"; |
| 1701 | } else { |
| 1702 | $top = "false"; |
| 1703 | } |
| 1704 | |
| 1705 | $welcomebar = get_option( 'mysticky_option_welcomebar' ); |
| 1706 | if ( isset($welcomebar['mysticky_welcomebar_enable']) && $welcomebar['mysticky_welcomebar_enable'] == 1 ) { |
| 1707 | wp_enqueue_style('google-fonts', $this->mystickymenu_google_fonts_url(),array(), MYSTICKY_VERSION ); |
| 1708 | } |
| 1709 | |
| 1710 | wp_enqueue_script( 'morphext-js', plugins_url('/js/morphext/morphext.min.js', __FILE__) , array('jquery'), MYSTICKY_VERSION, true ); |
| 1711 | wp_register_script('welcomebar-frontjs', plugins_url('/js/welcomebar-front.js', __FILE__), array( 'jquery', 'morphext-js' ), MYSTICKY_VERSION, true); |
| 1712 | wp_enqueue_script('welcomebar-frontjs'); |
| 1713 | |
| 1714 | wp_localize_script( 'welcomebar-frontjs', 'welcomebar_frontjs', |
| 1715 | array( |
| 1716 | 'ajaxurl' => admin_url( 'admin-ajax.php' ) , |
| 1717 | 'days' => __( 'Days', 'mystickymenu' ), |
| 1718 | 'hours' => __( 'Hours', 'mystickymenu' ), |
| 1719 | 'minutes' => __( 'Minutes', 'mystickymenu' ), |
| 1720 | 'seconds' => __( 'Seconds', 'mystickymenu' ), |
| 1721 | 'ajax_nonce' => wp_create_nonce('mystickymenu'), |
| 1722 | ) |
| 1723 | ); |
| 1724 | |
| 1725 | if( !isset($mysticky_options['stickymenu_enable']) || isset($mysticky_options['stickymenu_enable']) && $mysticky_options['stickymenu_enable'] == 0){ |
| 1726 | return; |
| 1727 | } |
| 1728 | // needed for update 1.7 => 1.8 ... will be removed in the future () |
| 1729 | if (isset($mysticky_options['mysticky_active_on_height_home'])) { |
| 1730 | //do nothing |
| 1731 | } else { |
| 1732 | $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height']; |
| 1733 | } |
| 1734 | |
| 1735 | |
| 1736 | if ($mysticky_options['mysticky_active_on_height_home'] == 0 ) { |
| 1737 | $mysticky_options['mysticky_active_on_height_home'] = $mysticky_options['mysticky_active_on_height']; |
| 1738 | } |
| 1739 | |
| 1740 | |
| 1741 | if ( is_front_page() && is_home() ) { |
| 1742 | |
| 1743 | $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home']; |
| 1744 | |
| 1745 | } elseif ( is_front_page()){ |
| 1746 | |
| 1747 | $mysticky_options['mysticky_active_on_height'] = $mysticky_options['mysticky_active_on_height_home']; |
| 1748 | |
| 1749 | } |
| 1750 | wp_register_script('detectmobilebrowser', plugins_url( 'js/detectmobilebrowser.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true); |
| 1751 | wp_enqueue_script( 'detectmobilebrowser' ); |
| 1752 | |
| 1753 | wp_register_script('mystickymenu', plugins_url( 'js/mystickymenu.min.js', __FILE__ ), array('jquery'), MYSTICKY_VERSION, true); |
| 1754 | wp_enqueue_script( 'mystickymenu' ); |
| 1755 | |
| 1756 | |
| 1757 | |
| 1758 | $myfixed_disable_scroll_down = isset($mysticky_options['myfixed_disable_scroll_down']) ? $mysticky_options['myfixed_disable_scroll_down'] : 'false'; |
| 1759 | $mystickyTransition = isset($mysticky_options['myfixed_fade']) ? $mysticky_options['myfixed_fade'] : 'fade'; |
| 1760 | $mystickyDisableLarge = isset($mysticky_options['myfixed_disable_large_screen']) ? $mysticky_options['myfixed_disable_large_screen'] : '0'; |
| 1761 | |
| 1762 | $mystickyClass = ( $mysticky_options['mysticky_class_id_selector'] != 'custom') ? '.menu-' . $mysticky_options['mysticky_class_id_selector'] .'-container' : $mysticky_options['mysticky_class_selector']; |
| 1763 | |
| 1764 | if ( $mysticky_options['mysticky_class_id_selector'] != 'custom' ) { |
| 1765 | $template_name = get_template(); |
| 1766 | switch( $template_name ){ |
| 1767 | case 'ashe': |
| 1768 | $mystickyClass = '#main-nav'; |
| 1769 | break; |
| 1770 | case 'astra': |
| 1771 | case 'hello-elementor': |
| 1772 | case 'sydney': |
| 1773 | case 'twentysixteen': |
| 1774 | $mystickyClass = 'header.site-header'; |
| 1775 | break; |
| 1776 | case 'generatepress': |
| 1777 | $mystickyClass = 'nav.main-navigation'; |
| 1778 | break; |
| 1779 | case 'transportex': |
| 1780 | $mystickyClass = '.transportex-menu-full'; |
| 1781 | break; |
| 1782 | case 'hestia': |
| 1783 | case 'neve': |
| 1784 | $mystickyClass = 'header.header'; |
| 1785 | break; |
| 1786 | case 'mesmerize': |
| 1787 | $mystickyClass = '.navigation-bar'; |
| 1788 | break; |
| 1789 | case 'oceanwp': |
| 1790 | $mystickyClass = 'header#site-header'; |
| 1791 | break; |
| 1792 | case 'shapely': |
| 1793 | $mystickyClass = '#site-navigation'; |
| 1794 | break; |
| 1795 | case 'storefront': |
| 1796 | $mystickyClass = '.storefront-primary-navigation'; |
| 1797 | break; |
| 1798 | case 'twentynineteen': |
| 1799 | $mystickyClass = '#site-navigation'; |
| 1800 | break; |
| 1801 | case 'twentyseventeen': |
| 1802 | $mystickyClass = '.navigation-top'; |
| 1803 | break; |
| 1804 | default: |
| 1805 | break; |
| 1806 | } |
| 1807 | } |
| 1808 | |
| 1809 | |
| 1810 | $mysticky_translation_array = array( |
| 1811 | 'mystickyClass' => $mystickyClass, |
| 1812 | 'activationHeight' => $mysticky_options['mysticky_active_on_height'], |
| 1813 | 'disableWidth' => $mysticky_options['myfixed_disable_small_screen'], |
| 1814 | 'disableLargeWidth' => $mystickyDisableLarge, |
| 1815 | 'adminBar' => $top, |
| 1816 | 'device_desktop' => true, |
| 1817 | 'device_mobile' => true, |
| 1818 | 'mystickyTransition' => $mystickyTransition, |
| 1819 | 'mysticky_disable_down' => $myfixed_disable_scroll_down, |
| 1820 | |
| 1821 | |
| 1822 | ); |
| 1823 | wp_localize_script( 'mystickymenu', 'option', $mysticky_translation_array ); |
| 1824 | } |
| 1825 | |
| 1826 | public function mysticky_disable_at() { |
| 1827 | |
| 1828 | |
| 1829 | $mysticky_options = get_option( 'mysticky_option_name' ); |
| 1830 | |
| 1831 | $mysticky_disable_at_front_home = isset($mysticky_options['mysticky_disable_at_front_home']); |
| 1832 | $mysticky_disable_at_blog = isset($mysticky_options['mysticky_disable_at_blog']); |
| 1833 | $mysticky_disable_at_page = isset($mysticky_options['mysticky_disable_at_page']); |
| 1834 | $mysticky_disable_at_tag = isset($mysticky_options['mysticky_disable_at_tag']); |
| 1835 | $mysticky_disable_at_category = isset($mysticky_options['mysticky_disable_at_category']); |
| 1836 | $mysticky_disable_at_single = isset($mysticky_options['mysticky_disable_at_single']); |
| 1837 | $mysticky_disable_at_archive = isset($mysticky_options['mysticky_disable_at_archive']); |
| 1838 | $mysticky_disable_at_search = isset($mysticky_options['mysticky_disable_at_search']); |
| 1839 | $mysticky_disable_at_404 = isset($mysticky_options['mysticky_disable_at_404']); |
| 1840 | $mysticky_enable_at_pages = isset($mysticky_options['mysticky_enable_at_pages']) ? $mysticky_options['mysticky_enable_at_pages'] : ''; |
| 1841 | $mysticky_enable_at_posts = isset($mysticky_options['mysticky_enable_at_posts']) ? $mysticky_options['mysticky_enable_at_posts'] : ''; |
| 1842 | |
| 1843 | // Trim input to ignore empty spaces |
| 1844 | $mysticky_enable_at_pages_exp = array_map('trim', explode(',', $mysticky_enable_at_pages)); |
| 1845 | $mysticky_enable_at_posts_exp = array_map('trim', explode(',', $mysticky_enable_at_posts)); |
| 1846 | |
| 1847 | |
| 1848 | |
| 1849 | |
| 1850 | if ( is_front_page() && is_home() ) { /* Default homepage */ |
| 1851 | |
| 1852 | if ( $mysticky_disable_at_front_home == false ) { |
| 1853 | $this->mystickymenu_script(); |
| 1854 | } |
| 1855 | } elseif ( is_front_page()){ /* Static homepage */ |
| 1856 | |
| 1857 | if ( $mysticky_disable_at_front_home == false ) { |
| 1858 | $this->mystickymenu_script(); |
| 1859 | } |
| 1860 | |
| 1861 | } elseif ( is_home()){ /* Blog page */ |
| 1862 | |
| 1863 | if ( $mysticky_disable_at_blog == false ) { |
| 1864 | $this->mystickymenu_script(); |
| 1865 | } |
| 1866 | |
| 1867 | } elseif ( is_page() ){ /* Single page*/ |
| 1868 | |
| 1869 | if ( $mysticky_disable_at_page == false ) { |
| 1870 | $this->mystickymenu_script(); |
| 1871 | } |
| 1872 | if ( is_page( $mysticky_enable_at_pages_exp ) ){ |
| 1873 | $this->mystickymenu_script(); |
| 1874 | } |
| 1875 | |
| 1876 | } elseif ( is_tag()){ /* Tag page */ |
| 1877 | |
| 1878 | if ( $mysticky_disable_at_tag == false ) { |
| 1879 | $this->mystickymenu_script(); |
| 1880 | } |
| 1881 | |
| 1882 | } elseif ( is_category()){ /* Category page */ |
| 1883 | |
| 1884 | if ( $mysticky_disable_at_category == false ) { |
| 1885 | $this->mystickymenu_script(); |
| 1886 | } |
| 1887 | |
| 1888 | } elseif ( is_single()){ /* Single post */ |
| 1889 | |
| 1890 | if ( $mysticky_disable_at_single == false ) { |
| 1891 | $this->mystickymenu_script(); |
| 1892 | } |
| 1893 | |
| 1894 | if ( is_single( $mysticky_enable_at_posts_exp ) ){ |
| 1895 | $this->mystickymenu_script(); |
| 1896 | } |
| 1897 | |
| 1898 | } elseif ( is_archive()){ /* Archive */ |
| 1899 | |
| 1900 | if ( $mysticky_disable_at_archive == false ) { |
| 1901 | $this->mystickymenu_script(); |
| 1902 | } |
| 1903 | |
| 1904 | } elseif ( is_search()){ /* Search */ |
| 1905 | |
| 1906 | if ( $mysticky_disable_at_search == false ) { |
| 1907 | $this->mystickymenu_script(); |
| 1908 | } |
| 1909 | |
| 1910 | } elseif ( is_404()){ /* 404 */ |
| 1911 | |
| 1912 | if ( $mysticky_disable_at_404 == false ) { |
| 1913 | $this->mystickymenu_script(); |
| 1914 | } |
| 1915 | } |
| 1916 | |
| 1917 | } |
| 1918 | |
| 1919 | /** |
| 1920 | * Mysticky Menu: Contact Form Lead Submission Function |
| 1921 | * DATE : 2022-08-04 |
| 1922 | * */ |
| 1923 | |
| 1924 | public function stickymenu_contact_lead_form(){ |
| 1925 | global $wpdb; |
| 1926 | global $wp; |
| 1927 | $stickymenus_widgets = get_option( 'mystickymenu-welcomebars' ); |
| 1928 | $errors = array(); |
| 1929 | $element_widget_no = $_POST['widget_id']; |
| 1930 | |
| 1931 | $element_widget_name = (isset($stickymenus_widgets[$element_widget_no]) && $stickymenus_widgets[$element_widget_no] != '' ) ? $stickymenus_widgets[$element_widget_no] : ''; |
| 1932 | |
| 1933 | $flag = true; |
| 1934 | if( isset($element_widget_name) && $element_widget_name != ''){ |
| 1935 | if( !isset($_POST['contact_name']) || $_POST['contact_name'] == ''){ |
| 1936 | $error = array( |
| 1937 | 'key' => "contact-form-name", |
| 1938 | 'message' => __( "This field is required", "mystickymenu" ) |
| 1939 | ); |
| 1940 | $errors[] = $error; |
| 1941 | $flag = false; |
| 1942 | }else{ |
| 1943 | $contact_lists_table = $wpdb->prefix . 'mystickymenu_contact_lists'; |
| 1944 | $postArr = $_POST; |
| 1945 | |
| 1946 | if( $element_widget_no == 0 ){ |
| 1947 | $element_widget_no = ''; |
| 1948 | } |
| 1949 | |
| 1950 | $welcomebar = get_option( 'mysticky_option_welcomebar' . $element_widget_no ); |
| 1951 | |
| 1952 | foreach( $postArr as $key => $val ){ |
| 1953 | if( $key != 'action' && $key != 'widget_id' && $key != 'save_form_lead' && $key != 'wpnonce'){ |
| 1954 | $params[$key] = (isset($val) && $val != '') ? esc_sql( sanitize_text_field($val) ) : ''; |
| 1955 | } |
| 1956 | } |
| 1957 | |
| 1958 | $params["widget_name"] = esc_sql( sanitize_text_field($element_widget_name)); |
| 1959 | $params["message_date"] = date('Y-m-d H:i:s'); |
| 1960 | $params["contact_email"] = (isset($params["contact_email"]) && $params["contact_email"] != '' ) ? $params["contact_email"] : ''; |
| 1961 | |
| 1962 | if( isset($params) && !empty($params) ){ |
| 1963 | $wpdb->insert($contact_lists_table, $params); |
| 1964 | die; |
| 1965 | } |
| 1966 | |
| 1967 | |
| 1968 | } |
| 1969 | } |
| 1970 | |
| 1971 | if( $flag != true ){ |
| 1972 | echo json_encode(array("status" => 0, "error" => 1, "errors" => $errors, "message" => $errors['message'])); |
| 1973 | } |
| 1974 | die; |
| 1975 | } |
| 1976 | |
| 1977 | } |
| 1978 | |
| 1979 | if( is_admin() ) { |
| 1980 | require_once 'mystickymenu-affiliate.php'; |
| 1981 | } |
| 1982 | |
| 1983 | new MyStickyMenuBackend(); |
| 1984 | new MyStickyMenuFrontend(); |
| 1985 | |
| 1986 | register_activation_hook( __FILE__, 'mystickymenu_activate' ); |
| 1987 | |
| 1988 | function mystickymenu_activate() { |
| 1989 | update_option( 'update_mysticky_version_2_5_7', true ); |
| 1990 | |
| 1991 | global $wpdb; |
| 1992 | require_once( ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 1993 | $charset_collate = $wpdb->get_charset_collate(); |
| 1994 | |
| 1995 | $contact_lists_table = $wpdb->prefix . 'mystickymenu_contact_lists'; |
| 1996 | |
| 1997 | if ($wpdb->get_var("show tables like '$contact_lists_table'") != $contact_lists_table) { |
| 1998 | |
| 1999 | $contact_lists_table_sql = "CREATE TABLE $contact_lists_table ( |
| 2000 | ID int(11) NOT NULL AUTO_INCREMENT, |
| 2001 | contact_name varchar(255) NULL, |
| 2002 | contact_phone varchar(255) NULL, |
| 2003 | contact_email varchar(255) NULL, |
| 2004 | widget_name varchar(255) NULL, |
| 2005 | page_link varchar(522) NULL, |
| 2006 | message_date DATETIME NOT NULL default '0000-00-00 00:00:00', |
| 2007 | PRIMARY KEY (ID) |
| 2008 | ) $charset_collate;"; |
| 2009 | dbDelta($contact_lists_table_sql); |
| 2010 | } |
| 2011 | } |
| 2012 | |
| 2013 | |
| 2014 | add_action( 'admin_init' , 'mystickymenu_admin_init' ); |
| 2015 | |
| 2016 | function mystickymenu_admin_init(){ |
| 2017 | |
| 2018 | global $wpdb; |
| 2019 | require_once( ABSPATH . 'wp-admin/includes/upgrade.php'); |
| 2020 | $charset_collate = $wpdb->get_charset_collate(); |
| 2021 | |
| 2022 | $contact_lists_table = $wpdb->prefix . 'mystickymenu_contact_lists'; |
| 2023 | |
| 2024 | if ($wpdb->get_var("show tables like '$contact_lists_table'") != $contact_lists_table) { |
| 2025 | |
| 2026 | $contact_lists_table_sql = "CREATE TABLE $contact_lists_table ( |
| 2027 | ID int(11) NOT NULL AUTO_INCREMENT, |
| 2028 | contact_name varchar(255) NULL, |
| 2029 | contact_phone varchar(255) NULL, |
| 2030 | contact_email varchar(255) NULL, |
| 2031 | widget_name varchar(255) NULL, |
| 2032 | page_link varchar(522) NULL, |
| 2033 | message_date DATETIME NOT NULL default '0000-00-00 00:00:00', |
| 2034 | PRIMARY KEY (ID) |
| 2035 | ) $charset_collate;"; |
| 2036 | dbDelta($contact_lists_table_sql); |
| 2037 | } |
| 2038 | } |
| 2039 |