Skip to content

Commit

Permalink
New pro setting: enable_rest_api
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaydsouza committed Oct 11, 2024
1 parent d9169d7 commit 674a2c0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
27 changes: 26 additions & 1 deletion includes/admin/settings/class-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,14 @@ public static function settings_general() {
'type' => 'checkbox',
'options' => false,
),
'enable_rest_api' => array(
'id' => 'enable_rest_api',
'name' => esc_html__( 'Enable REST API', 'better-search' ),
'desc' => esc_html__( 'When enabled, the REST API endpoint (search) will display relevant search results.', 'better-search' ),
'type' => 'checkbox',
'options' => false,
'pro' => true,
),
'track_popular' => array(
'id' => 'track_popular',
'name' => esc_html__( 'Enable search tracking', 'better-search' ),
Expand Down Expand Up @@ -437,6 +445,12 @@ public static function settings_search() {
'max' => 100,
'min' => 0,
),
'search_header' => array(
'id' => 'search_header',
'name' => '<h3>' . esc_html__( 'Inclusion options', 'better-search' ) . '</h3>',
'desc' => '',
'type' => 'header',
),
'search_excerpt' => array(
'id' => 'search_excerpt',
'name' => esc_html__( 'Search Excerpt', 'better-search' ),
Expand Down Expand Up @@ -472,6 +486,12 @@ public static function settings_search() {
'type' => 'checkbox',
'options' => false,
),
'exclude_header' => array(
'id' => 'exclude_header',
'name' => '<h3>' . esc_html__( 'Exclusion options', 'better-search' ) . '</h3>',
'desc' => '',
'type' => 'header',
),
'exclude_protected_posts' => array(
'id' => 'exclude_protected_posts',
'name' => esc_html__( 'Exclude password protected posts', 'better-search' ),
Expand Down Expand Up @@ -1086,7 +1106,12 @@ public function change_settings_on_save( $settings ) {
*/
public static function after_setting_output( $output, $args ) {
if ( isset( $args['pro'] ) && $args['pro'] ) {
$output .= '<a class="bsearch_button bsearch_button_gold" target="_blank" href="https://webberzone.com/plugins/better-search/pro/" title="' . esc_attr__( 'Upgrade to Pro', 'better-search' ) . '">' . esc_html__( 'Upgrade to Pro', 'better-search' ) . '</a>';
$output .= sprintf(
'<a class="bsearch_button bsearch_button_gold" target="_blank" href="%s" title="%s">%s</a>',
esc_url( 'https://webberzone.com/plugins/better-search/pro/' ),
esc_attr__( 'Upgrade to Pro', 'better-search' ),
esc_html__( 'Upgrade to Pro', 'better-search' )
);
}

return $output;
Expand Down
1 change: 0 additions & 1 deletion includes/class-main.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ private function init() {
$this->shortcodes = new Frontend\Shortcodes();
$this->display = new Frontend\Display();
$this->live_search = new Frontend\Live_Search();
$this->pro = new Pro\Pro();

$this->hooks();

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ You can report security bugs through the Patchstack Vulnerability Disclosure Pro
* Features:
* New live search feature that shows search results as you type.
* [Pro] New setting to only show search results above a certain relevance threshold.
* [Pro] New setting *Enable REST API* which allows the REST API to utilize the Better Search search engine when enabled. [Read this knowledge base article for more information ahout how Better Search enhances the Search endpoint](https://webberzone.com/support/knowledgebase/better-search-rest-api/).

* Enhancements/Modifications:
* Renamed `Better_Search` to `Better_Search_Core_Query`. Each of the methods now remove the filter from itself. It will also automatically parse wp_query parameters.
Expand Down

0 comments on commit 674a2c0

Please sign in to comment.