Repository navigation
Expand file tree
/
Copy pathwpvdb-search.php
More file actions
65 lines (56 loc) · 1.64 KB
/
Copy pathwpvdb-search.php
File metadata and controls
65 lines (56 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* Plugin Name: WPVDB Search
* Plugin URI: https://github.com/Automattic/wpvdb-search
* Description: Shared dense, sparse, and hybrid search primitives for wpvdb.
* Version: 0.9.0
* Author: Automattic, Ramon Corrales
* Author URI: https://automattic.com/
* Requires at least: 6.9
* Requires PHP: 8.3
* Requires Plugins: wpvdb
* License: GPL-2.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: wpvdb-search
* Domain Path: /languages
*
* @package WPVDB_Search
*/
declare(strict_types=1);
namespace WPVDB_Search;
defined( 'ABSPATH' ) || exit;
define( 'WPVDB_SEARCH_VERSION', '0.9.0' );
define( 'WPVDB_SEARCH_FILE', __FILE__ );
define( 'WPVDB_SEARCH_DIR', __DIR__ );
require_once __DIR__ . '/includes/class-schema.php';
require_once __DIR__ . '/includes/class-search.php';
require_once __DIR__ . '/includes/class-abilities.php';
/**
* Show an admin notice when wpvdb is missing.
*/
function dependency_notice(): void {
if ( ! current_user_can( 'activate_plugins' ) ) {
return;
}
?>
<div class="notice notice-error">
<p><?php esc_html_e( 'WPVDB Search requires the wpvdb plugin to be active.', 'wpvdb-search' ); ?></p>
</div>
<?php
}
add_action(
'plugins_loaded',
static function (): void {
load_plugin_textdomain(
'wpvdb-search',
false,
dirname( plugin_basename( __FILE__ ) ) . '/languages'
);
if ( ! class_exists( '\WPVDB\Core' ) || ! class_exists( '\WPVDB\Settings' ) ) {
add_action( 'admin_notices', __NAMESPACE__ . '\\dependency_notice' );
return;
}
Schema::init();
Abilities::init();
}
);