Skip to content

Commit

Permalink
Merge pull request #125 from 10up/fix/124
Browse files Browse the repository at this point in the history
Fix: Function _load_textdomain_just_in_time was called incorrectly
  • Loading branch information
felipeelia authored Feb 4, 2025
2 parents f61c5d8 + fa4871d commit 159e9bd
Show file tree
Hide file tree
Showing 13 changed files with 129 additions and 18 deletions.
14 changes: 13 additions & 1 deletion includes/classes/Feature/BooleanSearchOperators.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class BooleanSearchOperators extends Feature {
public function __construct() {
$this->slug = 'boolean_search_operators';

$this->title = esc_html__( 'Boolean Search Operators', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = false;
$this->default_settings = [
Expand All @@ -46,6 +48,16 @@ public function __construct() {
parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'Boolean Search Operators', 'elasticpress-labs' );
}

/**
* Setup Feature Functionality
*/
Expand Down
14 changes: 13 additions & 1 deletion includes/classes/Feature/CoAuthorsPlus.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ class CoAuthorsPlus extends Feature {
public function __construct() {
$this->slug = 'co_authors_plus';

$this->title = esc_html__( 'Co-Authors Plus', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = true;

Expand All @@ -59,6 +61,16 @@ public function __construct() {
parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'Co-Authors Plus', 'elasticpress-labs' );
}

/**
* Setup all feature filters
*
Expand Down
14 changes: 13 additions & 1 deletion includes/classes/Feature/ElasticPressLabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,26 @@ class ElasticPressLabs extends \ElasticPress\Feature {
public function __construct() {
$this->slug = 'elasticpress_labs';

$this->title = esc_html__( 'ElasticPress Labs', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = false;
$this->default_settings = [];

parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'ElasticPress Labs', 'elasticpress-labs' );
}

/**
* Output feature box summary.
*/
Expand Down
16 changes: 14 additions & 2 deletions includes/classes/Feature/ExternalContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,26 @@ class ExternalContent extends Feature {
public function __construct() {
$this->slug = 'external_content';

if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'External Content', 'elasticpress-labs' );

$this->summary = __(
'List meta keys containing a path or a URL, and ElasticPress will index the content of those path or URL. For example, for a meta key called <code>meta_key</code> with <code>https://wordpress.org/news/wp-json/wp/v2/posts/16837</code> as its value, the JSON returned by that REST API endpoint will be indexed in a meta key called <code>ep_external_content_meta_key</code>.',
'elasticpress-labs'
);

parent::__construct();
}

/**
Expand Down
14 changes: 13 additions & 1 deletion includes/classes/Feature/MetaKeyPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class MetaKeyPattern extends \ElasticPress\Feature {
public function __construct() {
$this->slug = 'meta_key_pattern';

$this->title = esc_html__( 'Meta Key Pattern', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = false;
$this->default_settings = [
Expand All @@ -42,6 +44,16 @@ public function __construct() {
parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'Meta Key Pattern', 'elasticpress-labs' );
}

/**
* Output feature box summary.
*/
Expand Down
14 changes: 13 additions & 1 deletion includes/classes/Feature/SearchAlgorithm.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ class SearchAlgorithm extends \ElasticPress\Feature {
public function __construct() {
$this->slug = 'search_algorithm';

$this->title = esc_html__( 'Search Algorithm Version', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = false;
$this->default_settings = [
Expand All @@ -39,6 +41,16 @@ public function __construct() {
parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'Search Algorithm Version', 'elasticpress-labs' );
}

/**
* Output feature box summary.
*/
Expand Down
15 changes: 13 additions & 2 deletions includes/classes/Feature/SearchTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,19 @@ class SearchTemplates extends Feature {
public function __construct() {
$this->slug = 'search_templates';

if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'Search Templates', 'elasticpress-labs' );

$this->summary = '<p>' . sprintf(
Expand All @@ -48,8 +61,6 @@ public function __construct() {
) . '</p>' .
'<p>' . __( 'Please note that all the API fields are still available for custom search templates. Your templates do not to differ in post types, offset, pagination arguments, or even filters, as for those you can still use query parameters. The templates can be used for searching in different fields or applying different scores, for instance.', 'elasticpress-labs' ) . '</p>' .
'<p>' . __( 'Requires an <a href="https://www.elasticpress.io/" target="_blank">ElasticPress.io plan</a> to function.', 'elasticpress-labs' ) . '</p>';

parent::__construct();
}

/**
Expand Down
22 changes: 17 additions & 5 deletions includes/classes/Feature/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ class Users extends Feature {
public function __construct() {
$this->slug = 'users';

$this->title = esc_html__( 'Users', 'elasticpress-labs' );

$this->summary = __( 'Improve user search relevancy and query performance.', 'elasticpress-labs' );

$this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#users', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = true;

Expand All @@ -35,6 +33,20 @@ public function __construct() {
parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'Users', 'elasticpress-labs' );

$this->summary = __( 'Improve user search relevancy and query performance.', 'elasticpress-labs' );

$this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#users', 'elasticpress-labs' );
}

/**
* Hook search functionality
*/
Expand Down
14 changes: 13 additions & 1 deletion includes/classes/Feature/WooCommerceSubscriptionSearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,25 @@ class WooCommerceSubscriptionSearch extends \ElasticPress\Feature {
public function __construct() {
$this->slug = 'woocommerce_subscription_search';

$this->title = esc_html__( 'WooCommerce Admin Subscription Search', 'elasticpress-labs' );
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
$this->set_i18n_strings();
}

$this->requires_install_reindex = true;

parent::__construct();
}

/**
* Sets i18n strings.
*
* @return void
* @since 2.4.0
*/
public function set_i18n_strings(): void {
$this->title = esc_html__( 'WooCommerce Admin Subscription Search', 'elasticpress-labs' );
}

/**
* Output feature box summary.
*/
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/feature/TestBooleanSearchOperators.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@ protected function get_feature() {
}

/**
* Test constrcut
* Test construct
*
* @since 1.2.0
*/
public function testConstruct() {
$instance = $this->get_feature();
$instance->set_i18n_strings();

$this->assertEquals( 'boolean_search_operators', $instance->slug );
$this->assertEquals( 'Boolean Search Operators', $instance->title );
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/feature/TestCoAuthorsPlus.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ protected function get_protected_function( $function_name, $class_name = 'Elasti
}

/**
* Test constrcut
* Test construct
*
* @since 1.1.0
*/
public function testConstruct() {
$instance = $this->get_feature();
$instance->set_i18n_strings();

$this->assertEquals( 'co_authors_plus', $instance->slug );
$this->assertEquals( 'Co-Authors Plus', $instance->title );
Expand Down
1 change: 1 addition & 0 deletions tests/phpunit/feature/TestExternalContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ protected function get_feature() {
*/
public function test_construct() {
$instance = $this->get_feature();
$instance->set_i18n_strings();

$this->assertEquals( 'external_content', $instance->slug );
$this->assertEquals( 'External Content', $instance->title );
Expand Down
3 changes: 2 additions & 1 deletion tests/phpunit/feature/TestMetaKeyPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ protected function get_private_function( $function_name, $class_name = 'ElasticP
}

/**
* Test constrcut
* Test construct
*
* @group MetaKeyPattern
*/
public function testConstruct() {
$instance = $this->get_feature();
$instance->set_i18n_strings();

$this->assertEquals( 'meta_key_pattern', $instance->slug );
$this->assertEquals( 'Meta Key Pattern', $instance->title );
Expand Down

0 comments on commit 159e9bd

Please sign in to comment.