PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | elasticpress.php +81 -34 4.5.25.3.5 View file →
@@ -2,16 +2,17 @@
2 2 /**
3 3 * Plugin Name: ElasticPress
4 4 * Plugin URI: https://github.com/10up/ElasticPress
5 5 * Description: A fast and flexible search and query engine for WordPress.
6 - * Version: 4.5.2
7 - * Requires at least: 5.6
8 - * Requires PHP: 7.0
6 + * Version: 5.3.5
7 + * Requires at least: 6.2
8 + * Requires PHP: 7.4
9 9 * Author: 10up
10 10 * Author URI: https://10up.com
11 11 * License: GPL v2 or later
12 12 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 13 * Text Domain: elasticpress
14 + * Domain Path: /lang
14 15 *
15 16 * This program derives work from Alley Interactive's SearchPress
16 17 * and Automattic's VIP search plugin:
17 18 *
@@ -22,9 +23,9 @@
22 23 */
23 24
24 25 namespace ElasticPress;
25 26
26 -use \WP_CLI as WP_CLI;
27 +use WP_CLI;
27 28
28 29 if ( ! defined( 'ABSPATH' ) ) {
29 30 exit; // Exit if accessed directly.
30 31 }
@@ -31,10 +32,41 @@
31 32
32 33 define( 'EP_URL', plugin_dir_url( __FILE__ ) );
33 34 define( 'EP_PATH', plugin_dir_path( __FILE__ ) );
34 35 define( 'EP_FILE', plugin_basename( __FILE__ ) );
35 -define( 'EP_VERSION', '4.5.2' );
36 +define( 'EP_VERSION', '5.3.5' );
36 37
38 +define( 'EP_PHP_VERSION_MIN', '7.4' );
39 +
40 +if ( ! version_compare( phpversion(), EP_PHP_VERSION_MIN, '>=' ) ) {
41 + add_action(
42 + 'admin_notices',
43 + function () {
44 + ?>
45 + <div class="notice notice-error">
46 + <p>
47 + <?php
48 + echo wp_kses_post(
49 + sprintf(
50 + /* translators: %s: Minimum required PHP version */
51 + __( 'ElasticPress requires PHP version %s or later. Please upgrade PHP or disable the plugin.', 'elasticpress' ),
52 + EP_PHP_VERSION_MIN
53 + )
54 + );
55 + ?>
56 + </p>
57 + </div>
58 + <?php
59 + }
60 + );
61 + return;
62 +}
63 +
64 +// Require Composer autoloader if it exists.
65 +if ( file_exists( __DIR__ . '/vendor-prefixed/autoload.php' ) ) {
66 + require_once __DIR__ . '/vendor-prefixed/autoload.php';
67 +}
68 +
37 69 /**
38 70 * PSR-4-ish autoloading
39 71 *
40 72 * @since 2.6
@@ -39,9 +71,9 @@
39 71 *
40 72 * @since 2.6
41 73 */
42 74 spl_autoload_register(
43 - function( $class ) {
75 + function ( $class_name ) {
44 76 // project-specific namespace prefix.
45 77 $prefix = 'ElasticPress\\';
46 78
47 79 // base directory for the namespace prefix.
@@ -49,13 +81,13 @@
49 81
50 82 // does the class use the namespace prefix?
51 83 $len = strlen( $prefix );
52 84
53 - if ( strncmp( $prefix, $class, $len ) !== 0 ) {
85 + if ( strncmp( $prefix, $class_name, $len ) !== 0 ) {
54 86 return;
55 87 }
56 88
57 - $relative_class = substr( $class, $len );
89 + $relative_class = substr( $class_name, $len );
58 90
59 91 $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php';
60 92
61 93 // if the file exists, require it.
@@ -73,9 +105,9 @@
73 105 * We don't check minor releases so if your ES version if 7.10.1, we consider that 7.10 in our comparison.
74 106 *
75 107 * @since 2.2
76 108 */
77 -define( 'EP_ES_VERSION_MAX', '7.10' );
109 +define( 'EP_ES_VERSION_MAX', '9.999' );
78 110 define( 'EP_ES_VERSION_MIN', '5.2' );
79 111
80 112 require_once __DIR__ . '/includes/compat.php';
81 113 require_once __DIR__ . '/includes/utils.php';
@@ -88,15 +120,29 @@
88 120 define( 'EP_IS_NETWORK', true );
89 121 }
90 122
91 123 /**
124 + * Return the ElasticPress container
125 + *
126 + * @since 4.7.0
127 + * @return Container
128 + */
129 +function get_container() {
130 + static $container = null;
131 +
132 + if ( ! $container ) {
133 + $container = new Container();
134 + }
135 +
136 + return $container;
137 +}
138 +
139 +/**
92 140 * Sets up the indexables and features.
93 141 *
94 142 * @return void
95 143 */
96 144 function register_indexable_posts() {
97 - global $wp_version;
98 -
99 145 /**
100 146 * Handle indexables
101 147 */
102 148 Indexables::factory()->register( new Indexable\Post\Post() );
@@ -116,8 +162,12 @@
116 162 new Feature\Autosuggest\Autosuggest()
117 163 );
118 164
119 165 Features::factory()->register_feature(
166 + new Feature\DidYouMean\DidYouMean()
167 + );
168 +
169 + Features::factory()->register_feature(
120 170 new Feature\WooCommerce\WooCommerce()
121 171 );
122 172
123 173 Features::factory()->register_feature(
@@ -140,29 +190,15 @@
140 190 new Feature\Documents\Documents()
141 191 );
142 192
143 193 Features::factory()->register_feature(
194 + new Feature\AcfRepeater\AcfRepeater()
195 + );
196 +
197 + Features::factory()->register_feature(
144 198 new Feature\Comments\Comments()
145 199 );
146 200
147 - /**
148 - * Filter whether the Users feature should be registered or not.
149 - *
150 - * The Users feature is going to be migrated to ElasticPress Labs. If EP Labs is enabled
151 - * and in a more recent version, it will change this to false and load its own version
152 - * of the Users feature.
153 - *
154 - * @hook ep_user_register_feature
155 - * @since 4.5.0
156 - * @param {bool} $version Version
157 - * @return {bool} New version
158 - */
159 - if ( apply_filters( 'ep_user_register_feature', true ) ) {
160 - Features::factory()->register_feature(
161 - new Feature\Users\Users()
162 - );
163 - }
164 -
165 201 Features::factory()->register_feature(
166 202 new Feature\Terms\Terms()
167 203 );
168 204
@@ -181,11 +217,14 @@
181 217 * @param {QueryLogger} $query_logger Default query logger
182 218 * @return {QueryLogger} New query logger
183 219 */
184 220 $query_logger = apply_filters( 'ep_query_logger', new \ElasticPress\QueryLogger() );
185 - if ( method_exists( $query_logger, 'setup' ) ) {
186 - $query_logger->setup();
187 - }
221 + get_container()->set( '\ElasticPress\QueryLogger', $query_logger, true );
222 +
223 + get_container()->set( '\ElasticPress\AdminBar', new \ElasticPress\AdminBar(), true );
224 + get_container()->set( '\ElasticPress\BlockTemplateUtils', new \ElasticPress\BlockTemplateUtils(), true );
225 + get_container()->set( '\ElasticPress\ElasticPressIo', new \ElasticPress\ElasticPressIo() );
226 + get_container()->set( '\ElasticPress\ElementorUtils', new \ElasticPress\ElementorUtils(), true );
188 227 }
189 228 add_action( 'plugins_loaded', __NAMESPACE__ . '\register_indexable_posts' );
190 229
191 230 /**
@@ -243,10 +282,8 @@
243 282 *
244 283 * @since 2.2
245 284 */
246 285 function setup_misc() {
247 - load_plugin_textdomain( 'elasticpress', false, basename( __DIR__ ) . '/lang' ); // Load any available translations first.
248 -
249 286 if ( is_user_logged_in() && ! defined( 'WP_EP_DEBUG' ) ) {
250 287 require_once ABSPATH . 'wp-admin/includes/plugin.php';
251 288 define( 'WP_EP_DEBUG', is_plugin_active( 'debug-bar-elasticpress/debug-bar-elasticpress.php' ) );
252 289 }
@@ -251,8 +288,18 @@
251 288 define( 'WP_EP_DEBUG', is_plugin_active( 'debug-bar-elasticpress/debug-bar-elasticpress.php' ) );
252 289 }
253 290 }
254 291 add_action( 'plugins_loaded', __NAMESPACE__ . '\setup_misc' );
292 +
293 +/**
294 + * Load text domain
295 + *
296 + * @since 5.1.4
297 + */
298 +function i18n() {
299 + load_plugin_textdomain( 'elasticpress', false, basename( __DIR__ ) . '/lang' );
300 +}
301 +add_action( 'init', __NAMESPACE__ . '\i18n' );
255 302
256 303 /**
257 304 * Set up role(s) with EP capability
258 305 */