diff --git a/includes/classes/Feature.php b/includes/classes/Feature.php index 43295b5b4..dfd208291 100644 --- a/includes/classes/Feature.php +++ b/includes/classes/Feature.php @@ -622,4 +622,13 @@ protected function set_settings_schema() { ]; } } + + /** + * Sets the i18n strings for the feature. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + } } diff --git a/includes/classes/Feature/Autosuggest/Autosuggest.php b/includes/classes/Feature/Autosuggest/Autosuggest.php index b811965b1..85445c3d1 100644 --- a/includes/classes/Feature/Autosuggest/Autosuggest.php +++ b/includes/classes/Feature/Autosuggest/Autosuggest.php @@ -40,14 +40,6 @@ class Autosuggest extends Feature { public function __construct() { $this->slug = 'autosuggest'; - $this->title = esc_html__( 'Autosuggest', 'elasticpress' ); - - $this->short_title = esc_html__( 'Autosuggest', 'elasticpress' ); - - $this->summary = '

' . __( 'Input fields of type "search" or with the CSS class "search-field" or "ep-autosuggest" will be enhanced with autosuggest functionality. As text is entered into the search field, suggested content will appear below it, based on top search results for the text. Suggestions link directly to the content.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#autosuggest', 'elasticpress' ); - $this->requires_install_reindex = true; $this->default_settings = [ @@ -63,6 +55,22 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Autosuggest', 'elasticpress' ); + + $this->short_title = esc_html__( 'Autosuggest', 'elasticpress' ); + + $this->summary = '

' . __( 'Input fields of type "search" or with the CSS class "search-field" or "ep-autosuggest" will be enhanced with autosuggest functionality. As text is entered into the search field, suggested content will appear below it, based on top search results for the text. Suggestions link directly to the content.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#autosuggest', 'elasticpress' ); + } + /** * Output feature box long * diff --git a/includes/classes/Feature/Comments/Comments.php b/includes/classes/Feature/Comments/Comments.php index 302c24b48..81813aebe 100644 --- a/includes/classes/Feature/Comments/Comments.php +++ b/includes/classes/Feature/Comments/Comments.php @@ -36,12 +36,6 @@ class Comments extends Feature { public function __construct() { $this->slug = 'comments'; - $this->title = esc_html__( 'Comments', 'elasticpress' ); - - $this->summary = '

' . __( 'This feature will empower your website to overcome traditional WordPress comment search and query limitations that can present themselves at scale. This feature is only needed if you are using WP_Comment_Query directly.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#comments', 'elasticpress' ); - $this->requires_install_reindex = true; Indexables::factory()->register( new Indexable\Comment\Comment(), false ); @@ -49,6 +43,21 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Comments', 'elasticpress' ); + + $this->summary = '

' . __( 'This feature will empower your website to overcome traditional WordPress comment search and query limitations that can present themselves at scale. This feature is only needed if you are using WP_Comment_Query directly.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#comments', 'elasticpress' ); + } + + /** * Setup search functionality * diff --git a/includes/classes/Feature/DidYouMean/DidYouMean.php b/includes/classes/Feature/DidYouMean/DidYouMean.php index 63e60d4e1..8b28771b5 100644 --- a/includes/classes/Feature/DidYouMean/DidYouMean.php +++ b/includes/classes/Feature/DidYouMean/DidYouMean.php @@ -21,12 +21,6 @@ class DidYouMean extends Feature { public function __construct() { $this->slug = 'did-you-mean'; - $this->title = esc_html__( 'Did You Mean', 'elasticpress' ); - - $this->summary = '

' . __( '"Did You Mean" search feature provides alternative suggestions for misspelled or ambiguous search queries, enhancing search accuracy and user experience. To display suggestions in your theme, please follow this tutorial.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/did-you-mean/', 'elasticpress' ); - $this->requires_install_reindex = true; $this->available_during_installation = true; @@ -40,6 +34,20 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Did You Mean', 'elasticpress' ); + + $this->summary = '

' . __( '"Did You Mean" search feature provides alternative suggestions for misspelled or ambiguous search queries, enhancing search accuracy and user experience. To display suggestions in your theme, please follow this tutorial.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/did-you-mean/', 'elasticpress' ); + } + /** * Setup search functionality. * diff --git a/includes/classes/Feature/Documents/Documents.php b/includes/classes/Feature/Documents/Documents.php index f70602125..4785f9444 100644 --- a/includes/classes/Feature/Documents/Documents.php +++ b/includes/classes/Feature/Documents/Documents.php @@ -25,15 +25,23 @@ class Documents extends Feature { public function __construct() { $this->slug = 'documents'; + $this->requires_install_reindex = false; + + parent::__construct(); + } + + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { $this->title = esc_html__( 'Documents', 'elasticpress' ); $this->summary = '

' . __( 'Website search results will include popular document file types, using file names as well as their content. Supported file types include: ppt, pptx, doc, docx, xls, xlsx, pdf, csv, txt.', 'elasticpress' ) . '

'; $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#documents', 'elasticpress' ); - - $this->requires_install_reindex = false; - - parent::__construct(); } /** diff --git a/includes/classes/Feature/Facets/Facets.php b/includes/classes/Feature/Facets/Facets.php index 72e0868cd..76e636b48 100644 --- a/includes/classes/Feature/Facets/Facets.php +++ b/includes/classes/Feature/Facets/Facets.php @@ -38,24 +38,6 @@ class Facets extends Feature { public function __construct() { $this->slug = 'facets'; - $this->title = esc_html__( 'Filters', 'elasticpress' ); - - $this->summary = '

' . - ( wp_is_block_theme() - ? sprintf( - /* translators: Site Editor URL */ - __( 'Adds filter blocks that administrators can add to the website’s templates and template parts, so that visitors can filter applicable content and search results by one or more taxonomy terms, metafields, and date ranges.', 'elasticpress' ), - esc_url( admin_url( 'site-editor.php' ) ) - ) - : sprintf( - /* translators: Widgets Edit Screen URL */ - __( 'Adds filter widgets that administrators can add to the website’s sidebars (widgetized areas), so that visitors can filter applicable content and search results by one or more taxonomy terms, metafields, and date ranges.', 'elasticpress' ), - esc_url( admin_url( 'widgets.php' ) ) - ) - ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#filters', 'elasticpress' ); - $this->requires_install_reindex = false; $this->default_settings = [ @@ -103,6 +85,32 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Filters', 'elasticpress' ); + + $this->summary = '

' . + ( wp_is_block_theme() + ? sprintf( + /* translators: Site Editor URL */ + __( 'Adds filter blocks that administrators can add to the website’s templates and template parts, so that visitors can filter applicable content and search results by one or more taxonomy terms, metafields, and date ranges.', 'elasticpress' ), + esc_url( admin_url( 'site-editor.php' ) ) + ) + : sprintf( + /* translators: Widgets Edit Screen URL */ + __( 'Adds filter widgets that administrators can add to the website’s sidebars (widgetized areas), so that visitors can filter applicable content and search results by one or more taxonomy terms, metafields, and date ranges.', 'elasticpress' ), + esc_url( admin_url( 'widgets.php' ) ) + ) + ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#filters', 'elasticpress' ); + } + /** * Setup hooks and filters for feature * diff --git a/includes/classes/Feature/InstantResults/InstantResults.php b/includes/classes/Feature/InstantResults/InstantResults.php index 4635089e1..50aa3995c 100644 --- a/includes/classes/Feature/InstantResults/InstantResults.php +++ b/includes/classes/Feature/InstantResults/InstantResults.php @@ -67,15 +67,6 @@ class InstantResults extends Feature { public function __construct() { $this->slug = 'instant-results'; - $this->title = esc_html__( 'Instant Results', 'elasticpress' ); - - $this->short_title = esc_html__( 'Instant Results', 'elasticpress' ); - - $this->summary = '

' . __( 'WordPress search forms will display results instantly. When the search query is submitted, a modal will open that populates results by querying ElasticPress directly, bypassing WordPress. As the user refines their search, results are refreshed.', 'elasticpress' ) . '

' . - '

' . __( 'Requires an ElasticPress.io plan or a custom proxy to function.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#instant-results', 'elasticpress' ); - $this->host = trailingslashit( Utils\get_host() ); $this->index = Indexables::factory()->get( 'post' )->get_index_name(); @@ -102,6 +93,24 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Instant Results', 'elasticpress' ); + + $this->short_title = esc_html__( 'Instant Results', 'elasticpress' ); + + $this->summary = '

' . __( 'WordPress search forms will display results instantly. When the search query is submitted, a modal will open that populates results by querying ElasticPress directly, bypassing WordPress. As the user refines their search, results are refreshed.', 'elasticpress' ) . '

' . + '

' . __( 'Requires an ElasticPress.io plan or a custom proxy to function.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#instant-results', 'elasticpress' ); + } + + /** * Output detailed feature description. * diff --git a/includes/classes/Feature/ProtectedContent/ProtectedContent.php b/includes/classes/Feature/ProtectedContent/ProtectedContent.php index d8c197368..96e47562f 100644 --- a/includes/classes/Feature/ProtectedContent/ProtectedContent.php +++ b/includes/classes/Feature/ProtectedContent/ProtectedContent.php @@ -30,13 +30,6 @@ class ProtectedContent extends Feature { public function __construct() { $this->slug = 'protected_content'; - $this->title = esc_html__( 'Protected Content', 'elasticpress' ); - - $this->summary = '

' . __( 'Syncs unpublished content — including private, draft, and scheduled posts — improving load times in places like the administrative dashboard where WordPress needs to include protected content in a query.', 'elasticpress' ) . '

' . - '

' . __( 'We recommend using a secured Elasticsearch setup, such as ElasticPress.io, to prevent potential exposure of content not intended for the public.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#protected-content', 'elasticpress' ); - $this->requires_install_reindex = true; $this->available_during_installation = true; @@ -44,6 +37,21 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Protected Content', 'elasticpress' ); + + $this->summary = '

' . __( 'Syncs unpublished content — including private, draft, and scheduled posts — improving load times in places like the administrative dashboard where WordPress needs to include protected content in a query.', 'elasticpress' ) . '

' . + '

' . __( 'We recommend using a secured Elasticsearch setup, such as ElasticPress.io, to prevent potential exposure of content not intended for the public.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#protected-content', 'elasticpress' ); + } + /** * Setup all feature filters * diff --git a/includes/classes/Feature/RelatedPosts/RelatedPosts.php b/includes/classes/Feature/RelatedPosts/RelatedPosts.php index e3806d95c..0ba809d05 100644 --- a/includes/classes/Feature/RelatedPosts/RelatedPosts.php +++ b/includes/classes/Feature/RelatedPosts/RelatedPosts.php @@ -26,15 +26,23 @@ class RelatedPosts extends Feature { public function __construct() { $this->slug = 'related_posts'; + $this->requires_install_reindex = false; + + parent::__construct(); + } + + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { $this->title = esc_html__( 'Related Posts', 'elasticpress' ); $this->summary = '

' . __( 'Instantly deliver engaging and precise related content with no impact on site performance. Output related content using our block or directly in your theme using our API functions.', 'elasticpress' ) . '

'; $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#related-posts', 'elasticpress' ); - - $this->requires_install_reindex = false; - - parent::__construct(); } /** @@ -157,12 +165,19 @@ public function find_related( $post_id, $return = 5 ) { return $query->posts; } + /** * Setup all feature filters * * @since 2.1 */ public function setup() { + $this->title = esc_html__( 'Related Posts', 'elasticpress' ); + + $this->summary = '

' . __( 'Instantly deliver engaging and precise related content with no impact on site performance. Output related content using our block or directly in your theme using our API functions.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#related-posts', 'elasticpress' ); + add_action( 'widgets_init', [ $this, 'register_widget' ] ); add_filter( 'widget_types_to_hide_from_legacy_widget_block', [ $this, 'hide_legacy_widget' ] ); add_filter( 'ep_formatted_args', [ $this, 'formatted_args' ], 10, 2 ); diff --git a/includes/classes/Feature/Search/Search.php b/includes/classes/Feature/Search/Search.php index 9bdf44cd4..219e75676 100644 --- a/includes/classes/Feature/Search/Search.php +++ b/includes/classes/Feature/Search/Search.php @@ -52,13 +52,6 @@ class Search extends Feature { public function __construct() { $this->slug = 'search'; - $this->title = esc_html__( 'Post Search', 'elasticpress' ); - - $this->summary = '

' . __( 'Instantly find the content you’re looking for. The first time.', 'elasticpress' ) . '

' . - '

' . __( 'Overcome higher-end performance and functional limits posed by the traditional WordPress structured (SQL) database to deliver superior keyword search, instantly. ElasticPress indexes custom fields, tags, and other metadata to improve search results. Fuzzy matching accounts for misspellings and verb tenses.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#post-search', 'elasticpress' ); - $this->requires_install_reindex = false; $this->default_settings = [ @@ -74,6 +67,21 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Post Search', 'elasticpress' ); + + $this->summary = '

' . __( 'Instantly find the content you’re looking for. The first time.', 'elasticpress' ) . '

' . + '

' . __( 'Overcome higher-end performance and functional limits posed by the traditional WordPress structured (SQL) database to deliver superior keyword search, instantly. ElasticPress indexes custom fields, tags, and other metadata to improve search results. Fuzzy matching accounts for misspellings and verb tenses.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#post-search', 'elasticpress' ); + } + /** * We need to delay search setup up since it will fire after protected content and protected * content filters into the search setup @@ -81,6 +89,9 @@ public function __construct() { * @since 2.2 */ public function setup() { + + Indexables::factory()->activate( 'post' ); + add_action( 'init', [ $this, 'search_setup' ] ); add_filter( 'ep_sanitize_feature_settings', [ $this, 'sanitize_highlighting_settings' ] ); diff --git a/includes/classes/Feature/SearchOrdering/SearchOrdering.php b/includes/classes/Feature/SearchOrdering/SearchOrdering.php index 3dde59649..41d2b1400 100644 --- a/includes/classes/Feature/SearchOrdering/SearchOrdering.php +++ b/includes/classes/Feature/SearchOrdering/SearchOrdering.php @@ -52,12 +52,6 @@ class SearchOrdering extends Feature { public function __construct() { $this->slug = 'searchordering'; - $this->title = esc_html__( 'Custom Search Results', 'elasticpress' ); - - $this->summary = '

' . __( 'Selected posts will be inserted into search results in the specified position.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#custom-search-results', 'elasticpress' ); - $this->requires_install_reindex = false; $this->requires_feature = 'search'; @@ -65,6 +59,20 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Custom Search Results', 'elasticpress' ); + + $this->summary = '

' . __( 'Selected posts will be inserted into search results in the specified position.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#custom-search-results', 'elasticpress' ); + } + /** * Setup Feature Functionality */ diff --git a/includes/classes/Feature/Terms/Terms.php b/includes/classes/Feature/Terms/Terms.php index f81998885..fde866156 100644 --- a/includes/classes/Feature/Terms/Terms.php +++ b/includes/classes/Feature/Terms/Terms.php @@ -33,12 +33,6 @@ class Terms extends Feature { public function __construct() { $this->slug = 'terms'; - $this->title = esc_html__( 'Terms', 'elasticpress' ); - - $this->summary = '

' . __( 'This feature will empower your website to overcome traditional WordPress term search and query limitations that can present themselves at scale. This feature is only needed if you are using WP_Term_Query directly.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#terms', 'elasticpress' ); - $this->requires_install_reindex = true; Indexables::factory()->register( new Indexable\Term\Term(), false ); @@ -46,6 +40,20 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'Terms', 'elasticpress' ); + + $this->summary = '

' . __( 'This feature will empower your website to overcome traditional WordPress term search and query limitations that can present themselves at scale. This feature is only needed if you are using WP_Term_Query directly.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#terms', 'elasticpress' ); + } + /** * Setup search functionality * diff --git a/includes/classes/Feature/WooCommerce/WooCommerce.php b/includes/classes/Feature/WooCommerce/WooCommerce.php index 689840c61..b87ed6663 100644 --- a/includes/classes/Feature/WooCommerce/WooCommerce.php +++ b/includes/classes/Feature/WooCommerce/WooCommerce.php @@ -54,12 +54,6 @@ class WooCommerce extends Feature { public function __construct() { $this->slug = 'woocommerce'; - $this->title = esc_html__( 'WooCommerce', 'elasticpress' ); - - $this->summary = '

' . __( 'Most caching and performance tools can’t keep up with the nearly infinite ways your visitors might filter or navigate your products. No matter how many products, filters, or customers you have, ElasticPress will keep your online store performing quickly. If used in combination with the Protected Content feature, ElasticPress will also accelerate order searches and back end product management.', 'elasticpress' ) . '

'; - - $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#woocommerce', 'elasticpress' ); - $this->requires_install_reindex = true; $this->setting_requires_install_reindex = 'orders'; @@ -77,6 +71,20 @@ public function __construct() { parent::__construct(); } + /** + * Sets i18n strings. + * + * @return void + * @since 5.2.0 + */ + public function set_i18n_strings(): void { + $this->title = esc_html__( 'WooCommerce', 'elasticpress' ); + + $this->summary = '

' . __( 'Most caching and performance tools can’t keep up with the nearly infinite ways your visitors might filter or navigate your products. No matter how many products, filters, or customers you have, ElasticPress will keep your online store performing quickly. If used in combination with the Protected Content feature, ElasticPress will also accelerate order searches and back end product management.', 'elasticpress' ) . '

'; + + $this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#woocommerce', 'elasticpress' ); + } + /** * Setup all feature filters * diff --git a/includes/classes/Features.php b/includes/classes/Features.php index c0231bb60..103100719 100644 --- a/includes/classes/Features.php +++ b/includes/classes/Features.php @@ -330,6 +330,8 @@ public function setup_features() { do_action( 'ep_setup_features' ); foreach ( $this->registered_features as $feature_slug => $feature ) { + $feature->set_i18n_strings(); + if ( $feature->is_active() ) { $feature->setup(); } diff --git a/includes/classes/Indexable/Comment/Comment.php b/includes/classes/Indexable/Comment/Comment.php index 49ad4082a..08082cd4f 100644 --- a/includes/classes/Indexable/Comment/Comment.php +++ b/includes/classes/Indexable/Comment/Comment.php @@ -33,24 +33,17 @@ class Comment extends Indexable { public $slug = 'comment'; /** - * Create indexable and initialize dependencies + * Instantiate the indexable SyncManager and QueryIntegration, the main responsibles for the WP integration. * - * @since 3.6.0 + * @since 4.5.0 + * @return void */ - public function __construct() { + public function setup() { $this->labels = [ 'plural' => esc_html__( 'Comments', 'elasticpress' ), 'singular' => esc_html__( 'Comment', 'elasticpress' ), ]; - } - /** - * Instantiate the indexable SyncManager and QueryIntegration, the main responsibles for the WP integration. - * - * @since 4.5.0 - * @return void - */ - public function setup() { $this->sync_manager = new SyncManager( $this->slug ); $this->query_integration = new QueryIntegration(); } diff --git a/includes/classes/Indexable/Post/Post.php b/includes/classes/Indexable/Post/Post.php index f3ff530de..c02201fd1 100644 --- a/includes/classes/Indexable/Post/Post.php +++ b/includes/classes/Indexable/Post/Post.php @@ -42,11 +42,12 @@ class Post extends Indexable { public $support_indexing_advanced_pagination = true; /** - * Create indexable and initialize dependencies + * Instantiate the indexable SyncManager and QueryIntegration * - * @since 3.0 + * @since 5.2.0 + * @return void */ - public function __construct() { + public function setup() { $this->labels = [ 'plural' => esc_html__( 'Posts', 'elasticpress' ), 'singular' => esc_html__( 'Post', 'elasticpress' ), diff --git a/includes/classes/Indexable/Term/Term.php b/includes/classes/Indexable/Term/Term.php index 0f67fa0b1..bb2d35545 100644 --- a/includes/classes/Indexable/Term/Term.php +++ b/includes/classes/Indexable/Term/Term.php @@ -32,24 +32,17 @@ class Term extends Indexable { public $slug = 'term'; /** - * Create indexable and initialize dependencies + * Instantiate the indexable SyncManager and QueryIntegration, the main responsibles for the WP integration. * - * @since 3.1 + * @since 4.5.0 + * @return void */ - public function __construct() { + public function setup() { $this->labels = [ 'plural' => esc_html__( 'Terms', 'elasticpress' ), 'singular' => esc_html__( 'Term', 'elasticpress' ), ]; - } - /** - * Instantiate the indexable SyncManager and QueryIntegration, the main responsibles for the WP integration. - * - * @since 4.5.0 - * @return void - */ - public function setup() { $this->sync_manager = new SyncManager( $this->slug ); $this->query_integration = new QueryIntegration( $this->slug ); } diff --git a/tests/php/features/TestAutosuggest.php b/tests/php/features/TestAutosuggest.php index 953da07c0..e4501dad4 100644 --- a/tests/php/features/TestAutosuggest.php +++ b/tests/php/features/TestAutosuggest.php @@ -68,6 +68,7 @@ protected function get_feature() { */ public function testConstruct() { $instance = new ElasticPress\Feature\Autosuggest\Autosuggest(); + $instance->set_i18n_strings(); $this->assertEquals( 'autosuggest', $instance->slug ); $this->assertEquals( 'Autosuggest', $instance->title ); diff --git a/tests/php/features/TestComments.php b/tests/php/features/TestComments.php index f6e8309ca..89cd70eaa 100644 --- a/tests/php/features/TestComments.php +++ b/tests/php/features/TestComments.php @@ -73,6 +73,7 @@ protected function get_feature() { */ public function testConstruct() { $instance = new ElasticPress\Feature\Comments\Comments(); + $instance->set_i18n_strings(); $this->assertEquals( 'comments', $instance->slug ); $this->assertEquals( 'Comments', $instance->title ); diff --git a/tests/php/features/TestDidYouMean.php b/tests/php/features/TestDidYouMean.php index befbe8926..ff3015924 100644 --- a/tests/php/features/TestDidYouMean.php +++ b/tests/php/features/TestDidYouMean.php @@ -43,6 +43,7 @@ public function set_up() { */ public function testConstruct() { $instance = new ElasticPress\Feature\DidYouMean\DidYouMean(); + $instance->set_i18n_strings(); $this->assertEquals( 'did-you-mean', $instance->slug ); $this->assertEquals( 'Did You Mean', $instance->title ); diff --git a/tests/php/features/TestSearchOrdering.php b/tests/php/features/TestSearchOrdering.php index 2f2554672..924f89960 100644 --- a/tests/php/features/TestSearchOrdering.php +++ b/tests/php/features/TestSearchOrdering.php @@ -73,6 +73,8 @@ public function get_feature() { */ public function testConstruct() { $instance = new \ElasticPress\Feature\SearchOrdering\SearchOrdering(); + $instance->set_i18n_strings(); + $this->assertSame( 'searchordering', $instance->slug ); $this->assertSame( 'Custom Search Results', $instance->title ); } diff --git a/tests/php/indexables/TestPost.php b/tests/php/indexables/TestPost.php index d48e8d46d..b6c16fedd 100644 --- a/tests/php/indexables/TestPost.php +++ b/tests/php/indexables/TestPost.php @@ -6167,6 +6167,7 @@ function ( $args ) { public function testPostConstructor() { $post = new \ElasticPress\Indexable\Post\Post(); + $post->setup(); $this->assertSame( 'Posts', $post->labels['plural'] ); $this->assertSame( 'Post', $post->labels['singular'] ); diff --git a/tests/php/screen/TestStatusReport.php b/tests/php/screen/TestStatusReport.php index cebc284d6..816283028 100644 --- a/tests/php/screen/TestStatusReport.php +++ b/tests/php/screen/TestStatusReport.php @@ -64,7 +64,7 @@ public function testGetReportsSkipped() { $reports = $status_report->get_reports(); $this->assertSame( - [ 'failed-queries', 'elasticpress', 'indices', 'last-sync', 'features' ], + [ 'failed-queries', 'wordpress', 'elasticpress', 'indices', 'last-sync', 'features' ], array_keys( $reports ) ); }