auto-patch 638-dev-dev01-2024-05-14T20_44_36

This commit is contained in:
root
2024-05-14 20:44:36 +00:00
parent a941559057
commit 5dbb0b284e
1812 changed files with 29671 additions and 14588 deletions

View File

@@ -77,6 +77,13 @@ function relevanssi_index_ninja_table( $table_id ) {
)
);
foreach ( $rows as $row ) {
if ( empty( $row->value ) ) {
continue;
}
$json_decoded = json_decode( $row->value );
if ( ! is_object( $json_decoded ) ) {
continue;
}
$array_values = array_map(
function ( $value ) {
if ( is_object( $value ) ) {
@@ -84,7 +91,7 @@ function relevanssi_index_ninja_table( $table_id ) {
}
return strval( $value );
},
array_values( get_object_vars( json_decode( $row->value ) ) )
array_values( get_object_vars( $json_decoded ) )
);
$table_contents .= ' ' . implode( ' ', $array_values );

View File

@@ -10,25 +10,6 @@
* @see https://www.relevanssi.com/
*/
/**
* Enables TablePress shortcodes for Relevanssi indexing.
*
* @return null|object The TablePress controller.
*/
function relevanssi_enable_tablepress_shortcodes() {
$my_tablepress_controller = null;
if ( defined( 'TABLEPRESS_ABSPATH' ) ) {
if ( ! isset( TablePress::$model_options ) ) {
include_once TABLEPRESS_ABSPATH . 'classes/class-model.php';
include_once TABLEPRESS_ABSPATH . 'models/model-options.php';
TablePress::$model_options = new TablePress_Options_Model();
}
$my_tablepress_controller = TablePress::load_controller( 'frontend' );
$my_tablepress_controller->init_shortcodes();
}
return $my_tablepress_controller;
}
add_filter( 'relevanssi_post_content', 'relevanssi_table_filter' );
/**

View File

@@ -13,6 +13,7 @@
add_filter( 'relevanssi_indexing_restriction', 'relevanssi_woocommerce_restriction' );
add_filter( 'relevanssi_admin_search_blocked_post_types', 'relevanssi_woocommerce_admin_search_blocked_post_types' );
add_filter( 'relevanssi_modify_wp_query', 'relevanssi_woocommerce_filters' );
add_filter( 'relevanssi_post_ok', 'relevanssi_variation_post_ok', 10, 2 );
/**
* This action solves the problems introduced by adjust_posts_count() in
@@ -280,3 +281,20 @@ function relevanssi_filtered_term_product_counts_query( $query ) {
return $query;
}
/**
* Checks the parent product status for product variations.
*
* @param bool $ok Whether the post is OK to return in search.
* @param int $post_id The post ID.
*
* @return bool
*/
function relevanssi_variation_post_ok( $ok, $post_id ) : bool {
$post_type = relevanssi_get_post_type( $post_id );
if ( 'product_variation' === $post_type ) {
$parent = get_post_parent( $post_id );
return apply_filters( 'relevanssi_post_ok', $ok, $parent->ID );
}
return $ok;
}