From f7b49c5ec4f03aa05f60b16e3aba0ea42c6fa69f Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Tue, 14 Dec 2021 17:34:21 -0700 Subject: [PATCH 1/4] Add filter to remove search weighting engine --- includes/classes/Feature/Search/Search.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/classes/Feature/Search/Search.php b/includes/classes/Feature/Search/Search.php index 1d1e2d9ab0..b400b93084 100644 --- a/includes/classes/Feature/Search/Search.php +++ b/includes/classes/Feature/Search/Search.php @@ -75,9 +75,11 @@ public function setup() { add_action( 'init', [ $this, 'search_setup' ] ); add_filter( 'ep_sanitize_feature_settings', [ $this, 'sanitize_highlighting_settings' ] ); - // Set up weighting sub-module - $this->weighting = new Weighting(); - $this->weighting->setup(); + if ( apply_filters( 'ep_load_search_weighting', true ) ) { + // Set up weighting sub-module + $this->weighting = new Weighting(); + $this->weighting->setup(); + } $this->synonyms = new Synonyms(); $this->synonyms->setup(); From 13b247d34c97475217f68252b8bf51d89d8df05a Mon Sep 17 00:00:00 2001 From: Felipe Elia Date: Mon, 20 Dec 2021 10:15:30 -0300 Subject: [PATCH 2/4] Update GH actions versions --- .github/workflows/build-docs.yml | 6 +++--- .github/workflows/push-asset-readme-update.yml | 2 +- .github/workflows/push-deploy.yml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 9e18d6fc63..a667b35dcb 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 with: path: 'wp-content/plugins/elasticpress' @@ -52,7 +52,7 @@ jobs: wp cli-command-docs elasticpress --custom-order=index,activate-feature,deactivate-feature,list-features,get-algorithm-version,set-algorithm-version --remove=delete_transient_on_int,custom_get_transient --custom-intro='The following WP-CLI commands are supported by ElasticPress:' > wp-content/plugins/elasticpress/docs/wp-cli.md - name: Use Node.js 10 - uses: actions/setup-node@v1 + uses: actions/setup-node@v2 with: node-version: '10.x' @@ -65,7 +65,7 @@ jobs: CI: true - name: Deploy to GH Pages - uses: maxheld83/ghpages@v0.2.1 + uses: maxheld83/ghpages@v0.3.0 env: BUILD_DIR: 'docs-built/' GH_PAT: ${{ secrets.GH_PAT }} \ No newline at end of file diff --git a/.github/workflows/push-asset-readme-update.yml b/.github/workflows/push-asset-readme-update.yml index 81aa43c0de..fcced51aeb 100644 --- a/.github/workflows/push-asset-readme-update.yml +++ b/.github/workflows/push-asset-readme-update.yml @@ -8,7 +8,7 @@ jobs: name: Push to master runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: WordPress.org plugin asset/readme update uses: 10up/action-wordpress-plugin-asset-update@stable env: diff --git a/.github/workflows/push-deploy.yml b/.github/workflows/push-deploy.yml index 406c65f96d..6055338fe3 100644 --- a/.github/workflows/push-deploy.yml +++ b/.github/workflows/push-deploy.yml @@ -8,7 +8,7 @@ jobs: name: New tag runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v2 - name: WordPress Plugin Deploy uses: 10up/action-wordpress-plugin-deploy@stable env: From 5707fe1bedbb1c48851e6b6ddaf15aeb4420dfb4 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Tue, 4 Jan 2022 11:50:18 -0700 Subject: [PATCH 3/4] Add filter to Weighting class instead --- includes/classes/Feature/Search/Search.php | 8 +++----- includes/classes/Feature/Search/Weighting.php | 12 ++++++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/includes/classes/Feature/Search/Search.php b/includes/classes/Feature/Search/Search.php index b400b93084..1d1e2d9ab0 100644 --- a/includes/classes/Feature/Search/Search.php +++ b/includes/classes/Feature/Search/Search.php @@ -75,11 +75,9 @@ public function setup() { add_action( 'init', [ $this, 'search_setup' ] ); add_filter( 'ep_sanitize_feature_settings', [ $this, 'sanitize_highlighting_settings' ] ); - if ( apply_filters( 'ep_load_search_weighting', true ) ) { - // Set up weighting sub-module - $this->weighting = new Weighting(); - $this->weighting->setup(); - } + // Set up weighting sub-module + $this->weighting = new Weighting(); + $this->weighting->setup(); $this->synonyms = new Synonyms(); $this->synonyms->setup(); diff --git a/includes/classes/Feature/Search/Weighting.php b/includes/classes/Feature/Search/Weighting.php index ab2e20554d..f00217a945 100644 --- a/includes/classes/Feature/Search/Weighting.php +++ b/includes/classes/Feature/Search/Weighting.php @@ -22,6 +22,18 @@ class Weighting { * Sets up the weighting module */ public function setup() { + /** + * Filter to disable loading of Search weighting engine. + * + * @hook ep_disable_search_weighting + * @since 4.0 + * @param bool Whether to disable search weighting engine. Defaults to false. + * @return bool Whether to disable search weighting engine. + */ + if ( apply_filters( 'ep_disable_search_weighting', false ) ) { + return; + } + add_action( 'admin_menu', [ $this, 'add_weighting_submenu_page' ], 15 ); add_action( 'admin_post_ep-weighting', [ $this, 'handle_save' ] ); add_filter( 'ep_formatted_args', [ $this, 'do_weighting' ], 20, 2 ); // After date decay, etc are injected From f56a6e933e0c5f7b1fe4acdaaf6e499d67708135 Mon Sep 17 00:00:00 2001 From: Rebecca Hum <16962021+rebeccahum@users.noreply.github.com> Date: Tue, 4 Jan 2022 11:54:29 -0700 Subject: [PATCH 4/4] Fix spacing linting issue --- includes/classes/Feature/Search/Weighting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/classes/Feature/Search/Weighting.php b/includes/classes/Feature/Search/Weighting.php index f00217a945..2f56b6cf3b 100644 --- a/includes/classes/Feature/Search/Weighting.php +++ b/includes/classes/Feature/Search/Weighting.php @@ -24,7 +24,7 @@ class Weighting { public function setup() { /** * Filter to disable loading of Search weighting engine. - * + * * @hook ep_disable_search_weighting * @since 4.0 * @param bool Whether to disable search weighting engine. Defaults to false. @@ -33,7 +33,7 @@ public function setup() { if ( apply_filters( 'ep_disable_search_weighting', false ) ) { return; } - + add_action( 'admin_menu', [ $this, 'add_weighting_submenu_page' ], 15 ); add_action( 'admin_post_ep-weighting', [ $this, 'handle_save' ] ); add_filter( 'ep_formatted_args', [ $this, 'do_weighting' ], 20, 2 ); // After date decay, etc are injected