PluginProbe
WP Directory Kit / 1.1.0
WP Directory Kit v1.1.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.1.0, at wpdirectorykit.php

137 lines 4.7 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 Agency and Car Dealership included
19 * Version: 1.1.0
20 * Author: wpdirectorykit.com
21 * Author URI: https://wpdirectorykit.com
22 * License: GPL-2.0+
23 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
24 * Text Domain: wpdirectorykit
25 * Domain Path: /languages
26 *
27 * Elementor tested up to: 3.6.6
28 * Elementor Pro tested up to: 3.7.6
29 *
30 */
31
32 // If this file is called directly, abort.
33 if ( ! defined( 'WPINC' ) ) {
34 die;
35 }
36
37 /**
38 * Currently plugin version.
39 * Start at version 1.0.0 and use SemVer - https://semver.org
40 * Rename this for your plugin and update it as you release new versions.
41 */
42 define( 'WPDIRECTORYKIT_VERSION', '1.1.0' );
43 define( 'WPDIRECTORYKIT_NAME', 'wdk' );
44 define( 'WPDIRECTORYKIT_PATH', plugin_dir_path( __FILE__ ) );
45 define( 'WPDIRECTORYKIT_URL', plugin_dir_url( __FILE__ ) );
46
47 /**
48 * The code that runs during plugin activation.
49 * This action is documented in includes/class-wpdirectorykit-activator.php
50 */
51 function activate_wpdirectorykit() {
52 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpdirectorykit-activator.php';
53 Wpdirectorykit_Activator::activate();
54 }
55
56 /**
57 * The code that runs during plugin deactivation.
58 * This action is documented in includes/class-wpdirectorykit-deactivator.php
59 */
60 function deactivate_wpdirectorykit() {
61 require_once plugin_dir_path( __FILE__ ) . 'includes/class-wpdirectorykit-deactivator.php';
62 Wpdirectorykit_Deactivator::deactivate();
63 }
64
65 register_activation_hook( __FILE__, 'activate_wpdirectorykit' );
66 register_deactivation_hook( __FILE__, 'deactivate_wpdirectorykit' );
67
68 /**
69 * The core plugin class that is used to define internationalization,
70 * admin-specific hooks, and public-facing site hooks.
71 */
72 require plugin_dir_path( __FILE__ ) . 'includes/class-wpdirectorykit.php';
73
74
75 if(file_exists(WPDIRECTORYKIT_PATH . 'premium_functions.php') && !defined('WDK_FS_DISABLE'))
76 {
77 require_once WPDIRECTORYKIT_PATH . 'premium_functions.php';
78 }
79
80 /**
81 * Begins execution of the plugin.
82 *
83 * Since everything within the plugin is registered via hooks,
84 * then kicking off the plugin from this point in the file does
85 * not affect the page life cycle.
86 *
87 * @since 1.0.0
88 */
89 function run_wpdirectorykit() {
90
91 $plugin = new Wpdirectorykit();
92 $plugin->run();
93
94 }
95 run_wpdirectorykit();
96
97
98 /*
99 * Add admin notify
100 * @param (string) $key unique key of notify, prefix included related plugin
101 * @param (string) $text test of message
102 * @param (function) $callback_filter custom function should be return true if not need show
103 * @param (string) $class notify alert class, by default 'notice notice-error'
104 * @return boolen true
105 */
106 function wdk_notify_admin ($key = '', $text = 'Custom Text of message', $callback_filter = '', $class = 'notice notice-error') {
107 $key = 'wdk_notify_'.$key;
108 $key_diss = $key.'_dissmiss';
109
110 $wdk_notinstalled_admin_notice__error = function () use ($key_diss, $text, $class, $callback_filter) {
111 global $wpdb;
112 $user_id = get_current_user_id();
113 if (!get_user_meta($user_id, $key_diss)) {
114 if(!empty($callback_filter)) if($callback_filter()) return false;
115
116 $message = '';
117 $message .= $text;
118 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.
119 }
120 };
121
122 add_action('admin_notices', function () use ($wdk_notinstalled_admin_notice__error) {
123 $wdk_notinstalled_admin_notice__error();
124 });
125
126 $wdk_notinstalled_admin_notice__error_dismissed = function () use ($key_diss) {
127 $user_id = get_current_user_id();
128 if (isset($_GET[$key_diss]))
129 add_user_meta($user_id, $key_diss, 'true', true);
130 };
131 add_action('admin_init', function () use ($wdk_notinstalled_admin_notice__error_dismissed) {
132 $wdk_notinstalled_admin_notice__error_dismissed();
133 });
134
135 return true;
136 }
137