Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Nov 1, 2023
2 parents 685fb71 + 6f496fd commit fe2bf9e
Show file tree
Hide file tree
Showing 23 changed files with 461 additions and 269 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: |
sudo npm config set cache "${{ env.NODE_CACHE }}" --global
- name: Prepare npm cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.NODE_CACHE }}
key: npm-${{ env.NODE_VERSION }}-${{ hashFiles('**/package-lock.json') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
composer config -g cache-dir "${{ env.COMPOSER_CACHE }}"
- name: Prepare composer cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ env.COMPOSER_CACHE }}
key: composer-${{ env.COMPOSER_VERSION }}-${{ hashFiles('**/composer.lock') }}
Expand Down
Binary file removed .wordpress-org/screenshot-1.jpg
Binary file not shown.
Binary file added .wordpress-org/screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .wordpress-org/screenshot-2.jpg
Binary file not shown.
Binary file added .wordpress-org/screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .wordpress-org/screenshot-3.jpg
Binary file not shown.
Binary file added .wordpress-org/screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .wordpress-org/screenshot-4.jpg
Binary file not shown.
Binary file added .wordpress-org/screenshot-4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed .wordpress-org/screenshot-5.jpg
Binary file not shown.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ All notable changes to this project will be documented in this file, per [the Ke
### Security
-->

## [2.2.0] - 2023-11-01

### Added
- Compatibility with ElasticPress 5.0.0. Props [@felipeelia](https://github.com/felipeelia) and [@burhandodhy](https://github.com/burhandodhy) via [#81](https://github.com/10up/ElasticPress/pull/81) and [#85](https://github.com/10up/ElasticPress/pull/85).

### Changed
- Features do not autoactivate anymore. Props [@felipeelia](https://github.com/felipeelia) via [#88](https://github.com/10up/ElasticPress/pull/88).

### Security
- Bumped `@babel/traverse` from 7.19.3 to 7.23.2. Props [@dependabot](https://github.com/dependabot) via [#80](https://github.com/10up/ElasticPressLabs/pull/80).


## [2.1.1] - 2023-09-28

### Added
Expand Down Expand Up @@ -90,6 +102,7 @@ All notable changes to this project will be documented in this file, per [the Ke
- Initial plugin release.

[Unreleased]: https://github.com/10up/ElasticPressLabs/compare/trunk...develop
[2.2.0]: https://github.com/10up/ElasticPressLabs/compare/2.1.1...2.2.0
[2.1.1]: https://github.com/10up/ElasticPressLabs/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/10up/ElasticPressLabs/compare/2.0.0...2.1.0
[2.0.0]: https://github.com/10up/ElasticPressLabs/compare/1.2.0...2.0.0
Expand Down
19 changes: 8 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,17 @@ This plugin provides a simple interface to enable and disable features.

## Screenshots

1. ElasticPress Labs options section within ElasticPress Features settings screen, showing with `Status: Enabled`.
![](/.wordpress-org/screenshot-1.jpg)
1. Settings to allow boolean search operators in search queries.
![](/.wordpress-org/screenshot-1.png)

2. Settings to allow boolean search operators in search queries.
![](/.wordpress-org/screenshot-2.jpg)
2. Settings to add Co-Authors Plus plugin support.
![](/.wordpress-org/screenshot-2.png)

3. Settings to add Co-Authors Plus plugin support.
![](/.wordpress-org/screenshot-3.jpg)
3. Settings to include or exclude meta key patterns.
![](/.wordpress-org/screenshot-3.png)

4. Settings to include or exclude meta key patterns.
![](/.wordpress-org/screenshot-4.jpg)

5. Settings to change the version of the search algorithm between 3.4 and 3.5.
![](/.wordpress-org/screenshot-5.jpg)
4. Settings to change the version of the search algorithm between default, 3.5, and 4.0.
![](/.wordpress-org/screenshot-4.png)

## Support Level

Expand Down
4 changes: 2 additions & 2 deletions elasticpresslabs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: ElasticPress Labs
* Plugin URI: https://github.com/10up/ElasticPressLabs
* Description: A developer focused interface to commonly ElasticPress plugin issues.
* Version: 2.1.1
* Version: 2.2.0
* Requires at least: 5.6
* Requires PHP: 7.0
* Author: 10up
Expand All @@ -18,7 +18,7 @@
*/

// Useful global constants.
define( 'ELASTICPRESS_LABS_VERSION', '2.1.1' );
define( 'ELASTICPRESS_LABS_VERSION', '2.2.0' );
define( 'ELASTICPRESS_LABS_URL', plugin_dir_url( __FILE__ ) );
define( 'ELASTICPRESS_LABS_PATH', plugin_dir_path( __FILE__ ) );
define( 'ELASTICPRESS_LABS_INC', ELASTICPRESS_LABS_PATH . 'includes/' );
Expand Down
37 changes: 36 additions & 1 deletion includes/classes/Feature/BooleanSearchOperators.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public function requirements_status() {
return new FeatureRequirementsStatus( 2, esc_html__( 'This feature requires the "Post Search" feature to be enabled', 'elasticpress-labs' ) );
}

return parent::requirements_status();
return new FeatureRequirementsStatus( 1 );
}

/**
Expand All @@ -318,6 +318,25 @@ public function output_feature_box_summary() {
* Output feature box long
*/
public function output_feature_box_long() {
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.0.0', '<' ) ) {
echo wp_kses( $this->get_instructions(), 'ep-html' );
return;
}

_doing_it_wrong(
__METHOD__,
esc_html__( 'Settings are now generated via the set_settings_schema() method.' ),
'ElasticPress Labs 2.2.0'
);
}

/**
* Generate the instructions text
*
* @since 2.2.0
*/
public function get_instructions() {
ob_start();
?>
<p><?php esc_html_e( 'Allows users to search using the following boolean operators:', 'elasticpress-labs' ); ?></p>
<ul>
Expand Down Expand Up @@ -403,5 +422,21 @@ public function output_feature_box_long() {
</li>
</ul>
<?php
return ob_get_clean();
}

/**
* Set the `settings_schema` attribute
*
* @since 2.2.0
*/
public function set_settings_schema() {
$this->settings_schema = [
[
'key' => 'instructions',
'label' => $this->get_instructions(),
'type' => 'markup',
],
];
}
}
32 changes: 29 additions & 3 deletions includes/classes/Feature/CoAuthorsPlus.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public function __construct() {

$this->is_protected_content_feature_active = $protected_content_feature && $protected_content_feature->is_active();

$this->requires_feature = 'protected_content';

parent::__construct();
}

Expand Down Expand Up @@ -202,9 +204,33 @@ public function output_feature_box_summary() {
* @since 1.1.0
*/
public function output_feature_box_long() {
?>
<p><?php echo wp_kses_post( __( 'If using the Co-Authors Plus plugin and the Protected Content feature, enable this feature to visit the Admin Post List screen by Author name <code>wp-admin/edit.php?author_name=&lt;name&gt;</code> and see correct results.', 'elasticpress-labs' ) ); ?></p>
<?php
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.0.0', '<' ) ) {
?>
<p><?php echo wp_kses_post( __( 'If using the Co-Authors Plus plugin and the Protected Content feature, enable this feature to visit the Admin Post List screen by Author name <code>wp-admin/edit.php?author_name=&lt;name&gt;</code> and see correct results.', 'elasticpress-labs' ) ); ?></p>
<?php
return;
}

_doing_it_wrong(
__METHOD__,
esc_html__( 'Settings are now generated via the set_settings_schema() method.' ),
'ElasticPress Labs 2.2.0'
);
}

/**
* Set the `settings_schema` attribute
*
* @since 2.2.0
*/
public function set_settings_schema() {
$this->settings_schema = [
[
'key' => 'instructions',
'label' => '<p>' . __( 'If using the Co-Authors Plus plugin and the Protected Content feature, enable this feature to visit the Admin Post List screen by Author name <code>wp-admin/edit.php?author_name=&lt;name&gt;</code> and see correct results.', 'elasticpress-labs' ) . '</p>',
'type' => 'markup',
],
];
}

/**
Expand Down
121 changes: 77 additions & 44 deletions includes/classes/Feature/MetaKeyPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,54 +85,87 @@ public function setup() {
* Display field settings on the Dashboard.
*/
public function output_feature_box_settings() {
$settings = $this->get_settings();

if ( ! $settings ) {
$settings = [];
}
if ( ! defined( 'EP_VERSION' ) || version_compare( EP_VERSION, '5.0.0', '<' ) ) {
$settings = $this->get_settings();

$settings = wp_parse_args( $settings, $this->default_settings );
if ( ! $settings ) {
$settings = [];
}

?>
<div class="field js-toggle-feature" data-feature="<?php echo esc_attr( $this->slug ); ?>">
<div class="field-name status">
<label for="meta_key_allow_pattern">
<?php esc_html_e( 'Allow patterns', 'elasticpress-labs' ); ?>
</label>
$settings = wp_parse_args( $settings, $this->default_settings );

?>
<div class="field js-toggle-feature" data-feature="<?php echo esc_attr( $this->slug ); ?>">
<div class="field-name status">
<label for="meta_key_allow_pattern">
<?php esc_html_e( 'Allow patterns', 'elasticpress-labs' ); ?>
</label>
</div>
<div class="input-wrap">
<textarea
class="setting-field large-text code"
id="meta_key_allow_pattern"
rows="4"
name="settings[meta_key_allow_pattern]"
><?php echo empty( $settings['meta_key_allow_pattern'] ) ? '' : esc_textarea( $settings['meta_key_allow_pattern'] ); ?></textarea>
<p class="field-description">
<?php esc_html_e( 'Separate multiple regular expressions with line breaks.', 'elasticpress-labs' ); ?>
<?php esc_html_e( 'Include the weight of the pattern adding a pipe (|) followed by a number. Example: /^[a-z]/|5', 'elasticpress-labs' ); ?>
</p>
</div>
</div>
<div class="input-wrap">
<textarea
class="setting-field large-text code"
id="meta_key_allow_pattern"
rows="4"
name="settings[meta_key_allow_pattern]"
><?php echo empty( $settings['meta_key_allow_pattern'] ) ? '' : esc_textarea( $settings['meta_key_allow_pattern'] ); ?></textarea>
<p class="field-description">
<?php esc_html_e( 'Separate multiple regular expressions with line breaks.', 'elasticpress-labs' ); ?>
<?php esc_html_e( 'Include the weight of the pattern adding a pipe (|) followed by a number. Example: /^[a-z]/|5', 'elasticpress-labs' ); ?>
</p>
</div>
</div>

<div class="field js-toggle-feature" data-feature="<?php echo esc_attr( $this->slug ); ?>">
<div class="field-name status">
<label for="meta_key_deny_pattern">
<?php esc_html_e( 'Deny patterns', 'elasticpress-labs' ); ?>
</label>
</div>
<div class="input-wrap">
<textarea
class="setting-field large-text code"
id="meta_key_deny_pattern"
rows="4"
name="settings[meta_key_deny_pattern]"
><?php echo empty( $settings['meta_key_deny_pattern'] ) ? '' : esc_textarea( $settings['meta_key_deny_pattern'] ); ?></textarea>
<p class="field-description">
<?php esc_html_e( 'Separate multiple regular expressions with line breaks.', 'elasticpress-labs' ); ?>
</p>
<div class="field js-toggle-feature" data-feature="<?php echo esc_attr( $this->slug ); ?>">
<div class="field-name status">
<label for="meta_key_deny_pattern">
<?php esc_html_e( 'Deny patterns', 'elasticpress-labs' ); ?>
</label>
</div>
<div class="input-wrap">
<textarea
class="setting-field large-text code"
id="meta_key_deny_pattern"
rows="4"
name="settings[meta_key_deny_pattern]"
><?php echo empty( $settings['meta_key_deny_pattern'] ) ? '' : esc_textarea( $settings['meta_key_deny_pattern'] ); ?></textarea>
<p class="field-description">
<?php esc_html_e( 'Separate multiple regular expressions with line breaks.', 'elasticpress-labs' ); ?>
</p>
</div>
</div>
</div>
<?php
<?php
return;
}

_doing_it_wrong(
__METHOD__,
esc_html__( 'Settings are now generated via the set_settings_schema() method.' ),
'ElasticPress Labs 2.2.0'
);
}

/**
* Set the `settings_schema` attribute
*
* @since 2.2.0
*/
public function set_settings_schema() {
$this->settings_schema = [
[
'default' => '',
'help' => __( '<p>Separate multiple regular expressions with line breaks.</p><p>Include the weight of the pattern adding a pipe (|) followed by a number. Example: /^[a-z]/|5</p>', 'elasticpress-labs' ),
'key' => 'meta_key_allow_pattern',
'label' => __( 'Allow patterns', 'elasticpress-labs' ),
'type' => 'textarea',
],
[
'default' => '',
'help' => __( 'Separate multiple regular expressions with line breaks.', 'elasticpress-labs' ),
'key' => 'meta_key_deny_pattern',
'label' => __( 'Deny patterns', 'elasticpress-labs' ),
'type' => 'textarea',
],
];
}

/**
Expand Down Expand Up @@ -435,7 +468,7 @@ public function after_save_settings( $slug ) {
* @since 2.4
*/
public function requirements_status() {
$status = new ElasticPress\FeatureRequirementsStatus( 0 );
$status = new ElasticPress\FeatureRequirementsStatus( 1 );

if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
$url = admin_url( 'network/admin.php?page=elasticpress-sync' );
Expand Down
Loading

0 comments on commit fe2bf9e

Please sign in to comment.