PluginProbe
WP Directory Kit / 1.5.0
WP Directory Kit v1.5.0
1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 1.4.0 1.4.1 All 35 releases
wpdirectorykit / wpdirectorykit.php

wpdirectorykit.php in WP Directory Kit 1.5.0, at wpdirectorykit.php

142 lines 4.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The plugin bootstrap file
5 *
6 * This file is read by WordPress to generate the plugin information in the plugin
7 * admin area. This file also includes all of the dependencies used by the plugin,
8 * registers the activation and deactivation functions, and defines a function
9 * that starts the plugin.
10 *
11 * @link wpdirectorykit.com
12 * @since 1.0.0
13 * @package Wpdirectorykit
14 *
15 * @wordpress-plugin
16 * Plugin Name: WP Directory Kit
17 * Plugin URI: https://wpdirectorykit.com/plugins/wpdirectorykit.html
18 * Description: Build your Directory portal, demos for Real Estate Agencies and Car Dealership included
19 * Version: 1.5.0
20 * Requires PHP: 7.0
21 * Author: wpdirectorykit.com
22 * Author URI: https://wpdirectorykit.com
23 * License: GPL-2.0+
24 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
25 * Text Domain: wpdirectorykit
26 * Domain Path: /languages
27 *
28 * Elementor tested up to: 3.33.1
29 * Elementor Pro tested up to: 3.23.2
30 *
31 * Copyright (C) SWIT Sandi Winter IT.
32 *
33 */
34
35 // If this file is called directly, abort.
36 if (! defined('WPINC')) {
37 die;
38 }
39
40 /**
41 * Currently plugin version.
42 * Start at version 1.0.0 and use SemVer - https://semver.org
43 * Rename this for your plugin and update it as you release new versions.
44 */
45 define('WPDIRECTORYKIT_VERSION', '1.5.0');
46 define('WPDIRECTORYKIT_NAME', 'wdk');
47 define('WPDIRECTORYKIT_PATH', plugin_dir_path(__FILE__));
48 define('WPDIRECTORYKIT_URL', plugin_dir_url(__FILE__));
49
50 /**
51 * The code that runs during plugin activation.
52 * This action is documented in includes/class-wpdirectorykit-activator.php
53 */
54 function activate_wpdirectorykit()
55 {
56 require_once plugin_dir_path(__FILE__) . 'includes/class-wpdirectorykit-activator.php';
57 Wpdirectorykit_Activator::activate();
58 }
59
60 /**
61 * The code that runs during plugin deactivation.
62 * This action is documented in includes/class-wpdirectorykit-deactivator.php
63 */
64 function deactivate_wpdirectorykit()
65 {
66 require_once plugin_dir_path(__FILE__) . 'includes/class-wpdirectorykit-deactivator.php';
67 Wpdirectorykit_Deactivator::deactivate();
68 }
69
70 register_activation_hook(__FILE__, 'activate_wpdirectorykit');
71 register_deactivation_hook(__FILE__, 'deactivate_wpdirectorykit');
72
73 /**
74 * The core plugin class that is used to define internationalization,
75 * admin-specific hooks, and public-facing site hooks.
76 */
77 require plugin_dir_path(__FILE__) . 'includes/class-wpdirectorykit.php';
78
79
80 if (file_exists(WPDIRECTORYKIT_PATH . 'premium_functions.php') && !defined('WDK_FS_DISABLE')) {
81 require_once WPDIRECTORYKIT_PATH . 'premium_functions.php';
82 }
83
84 /**
85 * Begins execution of the plugin.
86 *
87 * Since everything within the plugin is registered via hooks,
88 * then kicking off the plugin from this point in the file does
89 * not affect the page life cycle.
90 *
91 * @since 1.0.0
92 */
93 function run_wpdirectorykit()
94 {
95
96 $plugin = new Wpdirectorykit();
97 $plugin->run();
98 }
99 run_wpdirectorykit();
100
101
102 /*
103 * Add admin notify
104 * @param (string) $key unique key of notify, prefix included related plugin
105 * @param (string) $text test of message
106 * @param (function) $callback_filter custom function should be return true if not need show
107 * @param (string) $class notify alert class, by default 'notice notice-error'
108 * @return boolen true
109 */
110 function wdk_notify_admin($key = '', $text = 'Custom Text of message', $callback_filter = '', $class = 'notice notice-error')
111 {
112 $key = 'wdk_notify_' . $key;
113 $key_diss = $key . '_dissmiss';
114
115 $wdk_notinstalled_admin_notice__error = function () use ($key_diss, $text, $class, $callback_filter) {
116 global $wpdb;
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;
120
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.
124 }
125 };
126
127 add_action('admin_notices', function () use ($wdk_notinstalled_admin_notice__error) {
128 $wdk_notinstalled_admin_notice__error();
129 });
130
131 $wdk_notinstalled_admin_notice__error_dismissed = function () use ($key_diss) {
132 $user_id = get_current_user_id();
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();
138 });
139
140 return true;
141 }
142