Skip to content

Commit

Permalink
Fix: Function _load_textdomain_just_in_time was called incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy committed Jan 24, 2025
1 parent 06fe831 commit 0c8d74f
Show file tree
Hide file tree
Showing 23 changed files with 225 additions and 113 deletions.
9 changes: 9 additions & 0 deletions includes/classes/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
}
}
24 changes: 16 additions & 8 deletions includes/classes/Feature/Autosuggest/Autosuggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<p>' . __( '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' ) . '</p>';

$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 = [
Expand All @@ -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 = '<p>' . __( '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' ) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#autosuggest', 'elasticpress' );
}

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

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

$this->summary = '<p>' . __( '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 <code>WP_Comment_Query</code> directly.', 'elasticpress' ) . '</p>';

$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 );

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 = '<p>' . __( '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 <code>WP_Comment_Query</code> directly.', 'elasticpress' ) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#comments', 'elasticpress' );
}


/**
* Setup search functionality
*
Expand Down
20 changes: 14 additions & 6 deletions includes/classes/Feature/DidYouMean/DidYouMean.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<p>' . __( '"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 <a href="https://www.elasticpress.io/documentation/article/did-you-mean/">this tutorial</a>.', 'elasticpress' ) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/did-you-mean/', 'elasticpress' );

$this->requires_install_reindex = true;

$this->available_during_installation = true;
Expand All @@ -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 = '<p>' . __( '"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 <a href="https://www.elasticpress.io/documentation/article/did-you-mean/">this tutorial</a>.', 'elasticpress' ) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/did-you-mean/', 'elasticpress' );
}

/**
* Setup search functionality.
*
Expand Down
16 changes: 12 additions & 4 deletions includes/classes/Feature/Documents/Documents.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<p>' . __( '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' ) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#documents', 'elasticpress' );

$this->requires_install_reindex = false;

parent::__construct();
}

/**
Expand Down
44 changes: 26 additions & 18 deletions includes/classes/Feature/Facets/Facets.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ class Facets extends Feature {
public function __construct() {
$this->slug = 'facets';

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

$this->summary = '<p>' .
( wp_is_block_theme()
? sprintf(
/* translators: Site Editor URL */
__( 'Adds <a href="%s">filter blocks</a> 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 <a href="%s">filter widgets</a> 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' ) )
)
) . '</p>';

$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 = [
Expand Down Expand Up @@ -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 = '<p>' .
( wp_is_block_theme()
? sprintf(
/* translators: Site Editor URL */
__( 'Adds <a href="%s">filter blocks</a> 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 <a href="%s">filter widgets</a> 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' ) )
)
) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#filters', 'elasticpress' );
}

/**
* Setup hooks and filters for feature
*
Expand Down
27 changes: 18 additions & 9 deletions includes/classes/Feature/InstantResults/InstantResults.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<p>' . __( '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' ) . '</p>' .
'<p>' . __( 'Requires an <a href="https://www.elasticpress.io/" target="_blank">ElasticPress.io plan</a> or a custom proxy to function.', 'elasticpress' ) . '</p>';

$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();
Expand All @@ -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 = '<p>' . __( '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' ) . '</p>' .
'<p>' . __( 'Requires an <a href="https://www.elasticpress.io/" target="_blank">ElasticPress.io plan</a> or a custom proxy to function.', 'elasticpress' ) . '</p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#instant-results', 'elasticpress' );
}


/**
* Output detailed feature description.
*
Expand Down
22 changes: 15 additions & 7 deletions includes/classes/Feature/ProtectedContent/ProtectedContent.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,28 @@ class ProtectedContent extends Feature {
public function __construct() {
$this->slug = 'protected_content';

$this->title = esc_html__( 'Protected Content', 'elasticpress' );

$this->summary = '<p>' . __( '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' ) . '</p>' .
'<p><em>' . __( 'We recommend using a secured Elasticsearch setup, such as ElasticPress.io, to prevent potential exposure of content not intended for the public.', 'elasticpress' ) . '</em></p>';

$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;

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 = '<p>' . __( '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' ) . '</p>' .
'<p><em>' . __( 'We recommend using a secured Elasticsearch setup, such as ElasticPress.io, to prevent potential exposure of content not intended for the public.', 'elasticpress' ) . '</em></p>';

$this->docs_url = __( 'https://www.elasticpress.io/documentation/article/configuring-elasticpress-via-the-plugin-dashboard/#protected-content', 'elasticpress' );
}

/**
* Setup all feature filters
*
Expand Down
23 changes: 19 additions & 4 deletions includes/classes/Feature/RelatedPosts/RelatedPosts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<p>' . __( '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 <a href="https://www.elasticpress.io/documentation/article/related-posts-api/">API functions</a>.', 'elasticpress' ) . '</p>';

$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();
}

/**
Expand Down Expand Up @@ -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 = '<p>' . __( '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 <a href="https://www.elasticpress.io/documentation/article/related-posts-api/">API functions</a>.', 'elasticpress' ) . '</p>';

$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 );
Expand Down
25 changes: 18 additions & 7 deletions includes/classes/Feature/Search/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ class Search extends Feature {
public function __construct() {
$this->slug = 'search';

$this->title = esc_html__( 'Post Search', 'elasticpress' );

$this->summary = '<p>' . __( 'Instantly find the content you’re looking for. The first time.', 'elasticpress' ) . '</p>' .
'<p>' . __( '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' ) . '</p>';

$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 = [
Expand All @@ -74,13 +67,31 @@ 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 = '<p>' . __( 'Instantly find the content you’re looking for. The first time.', 'elasticpress' ) . '</p>' .
'<p>' . __( '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' ) . '</p>';

$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
*
* @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' ] );

Expand Down
Loading

0 comments on commit 0c8d74f

Please sign in to comment.