| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | * @wordpress-plugin |
| 16 | 16 | * Plugin Name: WP Directory Kit |
| 17 | 17 | * Plugin URI: https://wpdirectorykit.com/plugins/wpdirectorykit.html |
| 18 | 18 | * Description: Build your Directory portal, demos for Real Estate Agencies and Car Dealership included |
| 19 | - * Version: 1.5.8 | |
| 19 | + * Version: 1.4.8 | |
| 20 | 20 | * Requires PHP: 7.0 |
| 21 | 21 | * Author: wpdirectorykit.com |
| 22 | 22 | * Author URI: https://wpdirectorykit.com |
| 23 | 23 | * License: GPL-2.0+ |
| @@ -24,10 +24,10 @@ | ||
| 24 | 24 | * License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 25 | 25 | * Text Domain: wpdirectorykit |
| 26 | 26 | * Domain Path: /languages |
| 27 | 27 | * |
| 28 | - * Elementor tested up to: 4.2.1 | |
| 29 | - * Elementor Pro tested up to: 4.3.1 | |
| 28 | + * Elementor tested up to: 3.33.1 | |
| 29 | + * Elementor Pro tested up to: 3.23.2 | |
| 30 | 30 | * |
| 31 | 31 | * Copyright (C) SWIT Sandi Winter IT. |
| 32 | 32 | * |
| 33 | 33 | */ |
| @@ -41,9 +41,9 @@ | ||
| 41 | 41 | * Currently plugin version. |
| 42 | 42 | * Start at version 1.0.0 and use SemVer - https://semver.org |
| 43 | 43 | * Rename this for your plugin and update it as you release new versions. |
| 44 | 44 | */ |
| 45 | -define('WPDIRECTORYKIT_VERSION', '1.5.8'); | |
| 45 | +define('WPDIRECTORYKIT_VERSION', '1.4.8'); | |
| 46 | 46 | define('WPDIRECTORYKIT_NAME', 'wdk'); |
| 47 | 47 | define('WPDIRECTORYKIT_PATH', plugin_dir_path(__FILE__)); |
| 48 | 48 | define('WPDIRECTORYKIT_URL', plugin_dir_url(__FILE__)); |
| 49 | 49 | |
| @@ -109,56 +109,33 @@ | ||
| 109 | 109 | */ |
| 110 | 110 | function wdk_notify_admin($key = '', $text = 'Custom Text of message', $callback_filter = '', $class = 'notice notice-error') |
| 111 | 111 | { |
| 112 | 112 | $key = 'wdk_notify_' . $key; |
| 113 | - $key_dismiss = $key . '_dismiss'; | |
| 113 | + $key_diss = $key . '_dissmiss'; | |
| 114 | 114 | |
| 115 | - add_action('admin_notices', function () use ($key_dismiss, $text, $class, $callback_filter) { | |
| 116 | - | |
| 115 | + $wdk_notinstalled_admin_notice__error = function () use ($key_diss, $text, $class, $callback_filter) { | |
| 116 | + global $wpdb; | |
| 117 | 117 | $user_id = get_current_user_id(); |
| 118 | + if (!get_user_meta($user_id, $key_diss)) { | |
| 119 | + if (!empty($callback_filter)) if ($callback_filter()) return false; | |
| 118 | 120 | |
| 119 | - // Already dismissed | |
| 120 | - if (get_user_meta($user_id, $key_dismiss, true)) { | |
| 121 | - return; | |
| 121 | + $message = ''; | |
| 122 | + $message .= $text; | |
| 123 | + printf('<div class="%1$s" style="position:relative;"><p>%2$s</p><a href="?' . $key_diss . '"><button type="button" class="notice-dismiss"></button></a></div>', esc_html($class), ($message)); // WPCS: XSS ok, sanitization ok. | |
| 122 | 124 | } |
| 125 | + }; | |
| 123 | 126 | |
| 124 | - // Optional filter | |
| 125 | - if (!empty($callback_filter) && $callback_filter()) { | |
| 126 | - return; | |
| 127 | - } | |
| 128 | - | |
| 129 | - // Nonce URL | |
| 130 | - $url = wp_nonce_url( | |
| 131 | - add_query_arg($key_dismiss, '1'), | |
| 132 | - $key_dismiss . '_nonce' | |
| 133 | - ); | |
| 134 | - | |
| 135 | -?> | |
| 136 | - <div class="<?php echo esc_attr($class); ?> is-dismissible"> | |
| 137 | - <p><?php echo esc_html($text); // safe if you control it | |
| 138 | - ?></p> | |
| 139 | - <a href="<?php echo esc_url($url); ?>"><button type="button" class="notice-dismiss"></button></a> | |
| 140 | - </div> | |
| 141 | -<?php | |
| 127 | + add_action('admin_notices', function () use ($wdk_notinstalled_admin_notice__error) { | |
| 128 | + $wdk_notinstalled_admin_notice__error(); | |
| 142 | 129 | }); |
| 143 | 130 | |
| 144 | - // Handle dismiss | |
| 145 | - add_action('admin_init', function () use ($key_dismiss) { | |
| 146 | - | |
| 147 | - if (!isset($_GET[$key_dismiss])) { | |
| 148 | - return; | |
| 149 | - } | |
| 150 | - | |
| 151 | - if (!isset($_GET['_wpnonce']) || !wp_verify_nonce($_GET['_wpnonce'], $key_dismiss . '_nonce')) { | |
| 152 | - return; | |
| 153 | - } | |
| 154 | - | |
| 131 | + $wdk_notinstalled_admin_notice__error_dismissed = function () use ($key_diss) { | |
| 155 | 132 | $user_id = get_current_user_id(); |
| 156 | - | |
| 157 | - update_user_meta($user_id, $key_dismiss, 1); | |
| 158 | - | |
| 159 | - wp_redirect(remove_query_arg([$key_dismiss, '_wpnonce'])); | |
| 160 | - exit; | |
| 133 | + if (isset($_GET[$key_diss])) | |
| 134 | + add_user_meta($user_id, $key_diss, 'true', true); | |
| 135 | + }; | |
| 136 | + add_action('admin_init', function () use ($wdk_notinstalled_admin_notice__error_dismissed) { | |
| 137 | + $wdk_notinstalled_admin_notice__error_dismissed(); | |
| 161 | 138 | }); |
| 162 | 139 | |
| 163 | 140 | return true; |
| 164 | 141 | } |