PluginProbe
WP Directory Kit / 1.2.5
WP Directory Kit v1.2.5
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.2.5, at wpdirectorykit.php

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