-
Notifications
You must be signed in to change notification settings - Fork 1
/
indexed-search.php
77 lines (62 loc) · 1.98 KB
/
indexed-search.php
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
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* Plugin Name: Indexed Search
* Plugin URI: https://github.com/wp-blocks/indexed-search
* Description: An advanced WordPress indexed search.
* Version: 0.1.0
* Requires at least: 6.2
* Requires PHP: 7.4
* Author: codekraft, bitmachina
* License: GPL v2 or later
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: indexed-search
* Domain Path: /languages
*/
if ( version_compare( phpversion(), '7.4.0', '<' ) ) {
/**
* @return void
*/
function indexed_search_minimum_php_version_notice() {
echo '<div class="notice notice-error"><p>' . esc_html__( 'Indexed Search requires PHP 7.4 or higher.', 'indexed-search' ) . '</p></div>';
}
add_action( 'admin_notices', 'indexed_search_minimum_php_version_notice' );
return;
}
if ( version_compare( $GLOBALS['wp_version'], '6.2', '<' ) ) {
/**
* @return void
*/
function indexed_search_minimum_wp_version_notice() {
echo '<div class="notice notice-error"><p>' . esc_html__( 'Indexed Search requires WordPress 6.2 or later.', 'indexed-search' ) . '</p></div>';
}
add_action( 'admin_notices', 'indexed_search_minimum_wp_version_notice' );
return;
}
if ( file_exists( __DIR__ . '/vendor-prod/autoload.php' ) ) {
require_once( __DIR__ . '/vendor-prod/autoload.php' );
}
// Defines the path to the main plugin file.
define( 'S_FILE', __FILE__ );
// Defines the path to be used for includes.
define( 'S_PATH', plugin_dir_path( S_FILE ) );
// Defines the URL to the plugin.
define( 'S_URL', plugin_dir_url( S_FILE ) );
/**
* The block variation
*/
include_once S_PATH . 'src/variation.php';
/**
* The modal window
*/
include_once S_PATH . 'src/modal.php';
add_action( 'wp_footer', 'live_search_modal_window' );
/**
* The rest api controller
*/
include_once S_PATH . 'src/rest.php';
add_action( 'rest_api_init', 'register_live_search_endpoint' );
/**
* The rest api that will handle the search request
*/
include_once S_PATH . 'src/enqueue.php';
add_action( 'rest_api_init', 'register_live_search_endpoint' );