Skip to content

Commit 159e9bd

Browse files
authored
Merge pull request #125 from 10up/fix/124
Fix: Function _load_textdomain_just_in_time was called incorrectly
2 parents f61c5d8 + fa4871d commit 159e9bd

13 files changed

+129
-18
lines changed

includes/classes/Feature/BooleanSearchOperators.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ class BooleanSearchOperators extends Feature {
3636
public function __construct() {
3737
$this->slug = 'boolean_search_operators';
3838

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

4143
$this->requires_install_reindex = false;
4244
$this->default_settings = [
@@ -46,6 +48,16 @@ public function __construct() {
4648
parent::__construct();
4749
}
4850

51+
/**
52+
* Sets i18n strings.
53+
*
54+
* @return void
55+
* @since 2.4.0
56+
*/
57+
public function set_i18n_strings(): void {
58+
$this->title = esc_html__( 'Boolean Search Operators', 'elasticpress-labs' );
59+
}
60+
4961
/**
5062
* Setup Feature Functionality
5163
*/

includes/classes/Feature/CoAuthorsPlus.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ class CoAuthorsPlus extends Feature {
4646
public function __construct() {
4747
$this->slug = 'co_authors_plus';
4848

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

5153
$this->requires_install_reindex = true;
5254

@@ -59,6 +61,16 @@ public function __construct() {
5961
parent::__construct();
6062
}
6163

64+
/**
65+
* Sets i18n strings.
66+
*
67+
* @return void
68+
* @since 2.4.0
69+
*/
70+
public function set_i18n_strings(): void {
71+
$this->title = esc_html__( 'Co-Authors Plus', 'elasticpress-labs' );
72+
}
73+
6274
/**
6375
* Setup all feature filters
6476
*

includes/classes/Feature/ElasticPressLabs.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,26 @@ class ElasticPressLabs extends \ElasticPress\Feature {
3434
public function __construct() {
3535
$this->slug = 'elasticpress_labs';
3636

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

3941
$this->requires_install_reindex = false;
4042
$this->default_settings = [];
4143

4244
parent::__construct();
4345
}
4446

47+
/**
48+
* Sets i18n strings.
49+
*
50+
* @return void
51+
* @since 2.4.0
52+
*/
53+
public function set_i18n_strings(): void {
54+
$this->title = esc_html__( 'ElasticPress Labs', 'elasticpress-labs' );
55+
}
56+
4557
/**
4658
* Output feature box summary.
4759
*/

includes/classes/Feature/ExternalContent.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,26 @@ class ExternalContent extends Feature {
3333
public function __construct() {
3434
$this->slug = 'external_content';
3535

36+
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
37+
$this->set_i18n_strings();
38+
}
39+
40+
parent::__construct();
41+
}
42+
43+
/**
44+
* Sets i18n strings.
45+
*
46+
* @return void
47+
* @since 2.4.0
48+
*/
49+
public function set_i18n_strings(): void {
3650
$this->title = esc_html__( 'External Content', 'elasticpress-labs' );
3751

3852
$this->summary = __(
3953
'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>.',
4054
'elasticpress-labs'
4155
);
42-
43-
parent::__construct();
4456
}
4557

4658
/**

includes/classes/Feature/MetaKeyPattern.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class MetaKeyPattern extends \ElasticPress\Feature {
3131
public function __construct() {
3232
$this->slug = 'meta_key_pattern';
3333

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

3638
$this->requires_install_reindex = false;
3739
$this->default_settings = [
@@ -42,6 +44,16 @@ public function __construct() {
4244
parent::__construct();
4345
}
4446

47+
/**
48+
* Sets i18n strings.
49+
*
50+
* @return void
51+
* @since 2.4.0
52+
*/
53+
public function set_i18n_strings(): void {
54+
$this->title = esc_html__( 'Meta Key Pattern', 'elasticpress-labs' );
55+
}
56+
4557
/**
4658
* Output feature box summary.
4759
*/

includes/classes/Feature/SearchAlgorithm.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class SearchAlgorithm extends \ElasticPress\Feature {
2929
public function __construct() {
3030
$this->slug = 'search_algorithm';
3131

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

3436
$this->requires_install_reindex = false;
3537
$this->default_settings = [
@@ -39,6 +41,16 @@ public function __construct() {
3941
parent::__construct();
4042
}
4143

44+
/**
45+
* Sets i18n strings.
46+
*
47+
* @return void
48+
* @since 2.4.0
49+
*/
50+
public function set_i18n_strings(): void {
51+
$this->title = esc_html__( 'Search Algorithm Version', 'elasticpress-labs' );
52+
}
53+
4254
/**
4355
* Output feature box summary.
4456
*/

includes/classes/Feature/SearchTemplates.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ class SearchTemplates extends Feature {
3636
public function __construct() {
3737
$this->slug = 'search_templates';
3838

39+
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
40+
$this->set_i18n_strings();
41+
}
42+
43+
parent::__construct();
44+
}
45+
46+
/**
47+
* Sets i18n strings.
48+
*
49+
* @return void
50+
*/
51+
public function set_i18n_strings(): void {
3952
$this->title = esc_html__( 'Search Templates', 'elasticpress-labs' );
4053

4154
$this->summary = '<p>' . sprintf(
@@ -48,8 +61,6 @@ public function __construct() {
4861
) . '</p>' .
4962
'<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>' .
5063
'<p>' . __( 'Requires an <a href="https://www.elasticpress.io/" target="_blank">ElasticPress.io plan</a> to function.', 'elasticpress-labs' ) . '</p>';
51-
52-
parent::__construct();
5364
}
5465

5566
/**

includes/classes/Feature/Users.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ class Users extends Feature {
2222
public function __construct() {
2323
$this->slug = 'users';
2424

25-
$this->title = esc_html__( 'Users', 'elasticpress-labs' );
26-
27-
$this->summary = __( 'Improve user search relevancy and query performance.', 'elasticpress-labs' );
28-
29-
$this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#users', 'elasticpress-labs' );
25+
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.2.0', '<' ) ) {
26+
$this->set_i18n_strings();
27+
}
3028

3129
$this->requires_install_reindex = true;
3230

@@ -35,6 +33,20 @@ public function __construct() {
3533
parent::__construct();
3634
}
3735

36+
/**
37+
* Sets i18n strings.
38+
*
39+
* @return void
40+
* @since 2.4.0
41+
*/
42+
public function set_i18n_strings(): void {
43+
$this->title = esc_html__( 'Users', 'elasticpress-labs' );
44+
45+
$this->summary = __( 'Improve user search relevancy and query performance.', 'elasticpress-labs' );
46+
47+
$this->docs_url = __( 'https://elasticpress.zendesk.com/hc/en-us/articles/360050447492-Configuring-ElasticPress-via-the-Plugin-Dashboard#users', 'elasticpress-labs' );
48+
}
49+
3850
/**
3951
* Hook search functionality
4052
*/

includes/classes/Feature/WooCommerceSubscriptionSearch.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,25 @@ class WooCommerceSubscriptionSearch extends \ElasticPress\Feature {
3030
public function __construct() {
3131
$this->slug = 'woocommerce_subscription_search';
3232

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

3537
$this->requires_install_reindex = true;
3638

3739
parent::__construct();
3840
}
3941

42+
/**
43+
* Sets i18n strings.
44+
*
45+
* @return void
46+
* @since 2.4.0
47+
*/
48+
public function set_i18n_strings(): void {
49+
$this->title = esc_html__( 'WooCommerce Admin Subscription Search', 'elasticpress-labs' );
50+
}
51+
4052
/**
4153
* Output feature box summary.
4254
*/

tests/phpunit/feature/TestBooleanSearchOperators.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ protected function get_feature() {
3737
}
3838

3939
/**
40-
* Test constrcut
40+
* Test construct
4141
*
4242
* @since 1.2.0
4343
*/
4444
public function testConstruct() {
4545
$instance = $this->get_feature();
46+
$instance->set_i18n_strings();
4647

4748
$this->assertEquals( 'boolean_search_operators', $instance->slug );
4849
$this->assertEquals( 'Boolean Search Operators', $instance->title );

tests/phpunit/feature/TestCoAuthorsPlus.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ protected function get_protected_function( $function_name, $class_name = 'Elasti
5353
}
5454

5555
/**
56-
* Test constrcut
56+
* Test construct
5757
*
5858
* @since 1.1.0
5959
*/
6060
public function testConstruct() {
6161
$instance = $this->get_feature();
62+
$instance->set_i18n_strings();
6263

6364
$this->assertEquals( 'co_authors_plus', $instance->slug );
6465
$this->assertEquals( 'Co-Authors Plus', $instance->title );

tests/phpunit/feature/TestExternalContent.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ protected function get_feature() {
5454
*/
5555
public function test_construct() {
5656
$instance = $this->get_feature();
57+
$instance->set_i18n_strings();
5758

5859
$this->assertEquals( 'external_content', $instance->slug );
5960
$this->assertEquals( 'External Content', $instance->title );

tests/phpunit/feature/TestMetaKeyPattern.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ protected function get_private_function( $function_name, $class_name = 'ElasticP
4747
}
4848

4949
/**
50-
* Test constrcut
50+
* Test construct
5151
*
5252
* @group MetaKeyPattern
5353
*/
5454
public function testConstruct() {
5555
$instance = $this->get_feature();
56+
$instance->set_i18n_strings();
5657

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

0 commit comments

Comments
 (0)