| @@ -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.7.0 | |
| 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,24 +23,50 @@ | ||
| 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 | 32 | |
| 32 | -// Require Composer autoloader if it exists. | |
| 33 | -if ( file_exists( __DIR__ . '/vendor/autoload.php' ) ) { | |
| 34 | - require_once __DIR__ . '/vendor/autoload.php'; | |
| 35 | -} | |
| 36 | - | |
| 37 | 33 | define( 'EP_URL', plugin_dir_url( __FILE__ ) ); |
| 38 | 34 | define( 'EP_PATH', plugin_dir_path( __FILE__ ) ); |
| 39 | 35 | define( 'EP_FILE', plugin_basename( __FILE__ ) ); |
| 40 | -define( 'EP_VERSION', '4.7.0' ); | |
| 36 | +define( 'EP_VERSION', '5.3.5' ); | |
| 41 | 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 | + | |
| 42 | 69 | /** |
| 43 | 70 | * PSR-4-ish autoloading |
| 44 | 71 | * |
| 45 | 72 | * @since 2.6 |
| @@ -44,9 +71,9 @@ | ||
| 44 | 71 | * |
| 45 | 72 | * @since 2.6 |
| 46 | 73 | */ |
| 47 | 74 | spl_autoload_register( |
| 48 | - function( $class ) { | |
| 75 | + function ( $class_name ) { | |
| 49 | 76 | // project-specific namespace prefix. |
| 50 | 77 | $prefix = 'ElasticPress\\'; |
| 51 | 78 | |
| 52 | 79 | // base directory for the namespace prefix. |
| @@ -54,13 +81,13 @@ | ||
| 54 | 81 | |
| 55 | 82 | // does the class use the namespace prefix? |
| 56 | 83 | $len = strlen( $prefix ); |
| 57 | 84 | |
| 58 | - if ( strncmp( $prefix, $class, $len ) !== 0 ) { | |
| 85 | + if ( strncmp( $prefix, $class_name, $len ) !== 0 ) { | |
| 59 | 86 | return; |
| 60 | 87 | } |
| 61 | 88 | |
| 62 | - $relative_class = substr( $class, $len ); | |
| 89 | + $relative_class = substr( $class_name, $len ); | |
| 63 | 90 | |
| 64 | 91 | $file = $base_dir . str_replace( '\\', '/', $relative_class ) . '.php'; |
| 65 | 92 | |
| 66 | 93 | // if the file exists, require it. |
| @@ -78,9 +105,9 @@ | ||
| 78 | 105 | * We don't check minor releases so if your ES version if 7.10.1, we consider that 7.10 in our comparison. |
| 79 | 106 | * |
| 80 | 107 | * @since 2.2 |
| 81 | 108 | */ |
| 82 | -define( 'EP_ES_VERSION_MAX', '7.10' ); | |
| 109 | +define( 'EP_ES_VERSION_MAX', '9.999' ); | |
| 83 | 110 | define( 'EP_ES_VERSION_MIN', '5.2' ); |
| 84 | 111 | |
| 85 | 112 | require_once __DIR__ . '/includes/compat.php'; |
| 86 | 113 | require_once __DIR__ . '/includes/utils.php'; |
| @@ -163,29 +190,15 @@ | ||
| 163 | 190 | new Feature\Documents\Documents() |
| 164 | 191 | ); |
| 165 | 192 | |
| 166 | 193 | Features::factory()->register_feature( |
| 194 | + new Feature\AcfRepeater\AcfRepeater() | |
| 195 | + ); | |
| 196 | + | |
| 197 | + Features::factory()->register_feature( | |
| 167 | 198 | new Feature\Comments\Comments() |
| 168 | 199 | ); |
| 169 | 200 | |
| 170 | - /** | |
| 171 | - * Filter whether the Users feature should be registered or not. | |
| 172 | - * | |
| 173 | - * The Users feature is going to be migrated to ElasticPress Labs. If EP Labs is enabled | |
| 174 | - * and in a more recent version, it will change this to false and load its own version | |
| 175 | - * of the Users feature. | |
| 176 | - * | |
| 177 | - * @hook ep_user_register_feature | |
| 178 | - * @since 4.5.0 | |
| 179 | - * @param {bool} $version Version | |
| 180 | - * @return {bool} New version | |
| 181 | - */ | |
| 182 | - if ( apply_filters( 'ep_user_register_feature', true ) ) { | |
| 183 | - Features::factory()->register_feature( | |
| 184 | - new Feature\Users\Users() | |
| 185 | - ); | |
| 186 | - } | |
| 187 | - | |
| 188 | 201 | Features::factory()->register_feature( |
| 189 | 202 | new Feature\Terms\Terms() |
| 190 | 203 | ); |
| 191 | 204 | |
| @@ -206,9 +219,12 @@ | ||
| 206 | 219 | */ |
| 207 | 220 | $query_logger = apply_filters( 'ep_query_logger', new \ElasticPress\QueryLogger() ); |
| 208 | 221 | get_container()->set( '\ElasticPress\QueryLogger', $query_logger, true ); |
| 209 | 222 | |
| 223 | + get_container()->set( '\ElasticPress\AdminBar', new \ElasticPress\AdminBar(), true ); | |
| 210 | 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 ); | |
| 211 | 227 | } |
| 212 | 228 | add_action( 'plugins_loaded', __NAMESPACE__ . '\register_indexable_posts' ); |
| 213 | 229 | |
| 214 | 230 | /** |
| @@ -266,10 +282,8 @@ | ||
| 266 | 282 | * |
| 267 | 283 | * @since 2.2 |
| 268 | 284 | */ |
| 269 | 285 | function setup_misc() { |
| 270 | - load_plugin_textdomain( 'elasticpress', false, basename( __DIR__ ) . '/lang' ); // Load any available translations first. | |
| 271 | - | |
| 272 | 286 | if ( is_user_logged_in() && ! defined( 'WP_EP_DEBUG' ) ) { |
| 273 | 287 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 274 | 288 | define( 'WP_EP_DEBUG', is_plugin_active( 'debug-bar-elasticpress/debug-bar-elasticpress.php' ) ); |
| 275 | 289 | } |
| @@ -274,8 +288,18 @@ | ||
| 274 | 288 | define( 'WP_EP_DEBUG', is_plugin_active( 'debug-bar-elasticpress/debug-bar-elasticpress.php' ) ); |
| 275 | 289 | } |
| 276 | 290 | } |
| 277 | 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' ); | |
| 278 | 302 | |
| 279 | 303 | /** |
| 280 | 304 | * Set up role(s) with EP capability |
| 281 | 305 | */ |