$agg_name ) {
if ( isset( $aggregations[ $agg_name ] ) ) {
$reordered[ $agg_name ] = $aggregations[ $agg_name ];
}
}
return $reordered;
}
/**
* Sends events to Tracks when a search filters widget is updated.
*
* @since 5.8.0
*
* @param string $option The option name. Only "widget_jetpack-search-filters" is cared about.
* @param array $old_value The old option value.
* @param array $new_value The new option value.
*/
public function track_widget_updates( $option, $old_value, $new_value ) {
if ( 'widget_jetpack-search-filters' !== $option ) {
return;
}
$event = Helper::get_widget_tracks_value( $old_value, $new_value );
if ( ! $event ) {
return;
}
$tracking = new \Automattic\Jetpack\Tracking();
$tracking->tracks_record_event(
wp_get_current_user(),
sprintf( 'jetpack_search_widget_%s', $event['action'] ),
$event['widget']
);
}
/**
* Moves any active search widgets to the inactive category.
*
* @since 5.9.0
*/
public function move_search_widgets_to_inactive() {
if ( ! is_active_widget( false, false, Helper::FILTER_WIDGET_BASE, true ) ) {
return;
}
$sidebars_widgets = wp_get_sidebars_widgets();
if ( ! is_array( $sidebars_widgets ) ) {
return;
}
$changed = false;
foreach ( $sidebars_widgets as $sidebar => $widgets ) {
if ( 'wp_inactive_widgets' === $sidebar || str_starts_with( $sidebar, 'orphaned_widgets' ) ) {
continue;
}
if ( is_array( $widgets ) ) {
foreach ( $widgets as $key => $widget ) {
if ( _get_widget_id_base( $widget ) === Helper::FILTER_WIDGET_BASE ) {
$changed = true;
array_unshift( $sidebars_widgets['wp_inactive_widgets'], $widget );
unset( $sidebars_widgets[ $sidebar ][ $key ] );
}
}
}
}
if ( $changed ) {
wp_set_sidebars_widgets( $sidebars_widgets );
}
}
/**
* Determine whether a given WP_Query should be handled by ElasticSearch.
*
* @param WP_Query $query The WP_Query object.
*
* @return bool
*/
public function should_handle_query( $query ) {
/**
* Determine whether a given WP_Query should be handled by ElasticSearch.
*
* @module search
*
* @since 5.6.0
*
* @param bool $should_handle Should be handled by Jetpack Search.
* @param WP_Query $query The WP_Query object.
*/
return apply_filters( 'jetpack_search_should_handle_query', $query->is_main_query() && $query->is_search(), $query );
}
/**
* Transforms an array with fields name as keys and boosts as value into
* shorthand "caret" format.
*
* @param array $fields_boost [ "title" => "2", "content" => "1" ].
*
* @return array [ "title^2", "content^1" ]
*/
private function _get_caret_boosted_fields( array $fields_boost ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
$caret_boosted_fields = array();
foreach ( $fields_boost as $field => $boost ) {
$caret_boosted_fields[] = "$field^$boost";
}
return $caret_boosted_fields;
}
/**
* Apply a multiplier to boost values.
*
* @param array $fields_boost [ "title" => 2, "content" => 1 ].
* @param array $fields_boost_multiplier [ "title" => 0.1234 ].
*
* @return array [ "title" => "0.247", "content" => "1.000" ]
*/
private function _apply_boosts_multiplier( array $fields_boost, array $fields_boost_multiplier ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
foreach ( $fields_boost as $field_name => $field_boost ) {
if ( isset( $fields_boost_multiplier[ $field_name ] ) ) {
$fields_boost[ $field_name ] *= $fields_boost_multiplier[ $field_name ];
}
// Set a floor and format the number as string.
$fields_boost[ $field_name ] = number_format(
max( 0.001, $fields_boost[ $field_name ] ),
3,
'.',
''
);
}
return $fields_boost;
}
}
Fatal error: Uncaught Error: Class 'Automattic\Jetpack\Search\Classic_Search' not found in /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/instant-search/class-instant-search.php:20
Stack trace:
#0 /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/vendor/jetpack-autoloader/class-php-autoloader.php(102): require()
#1 [internal function]: Automattic\Jetpack\Autoloader\jpf11009ded9fc4592b6a05b61ce272b3c_jetpackā„14_3\al5_0_1\PHP_Autoloader::load_class('Automattic\\Jetp...')
#2 /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-search/compatibility/search-0.15.2.php(20): spl_autoload_call('Automattic\\Jetp...')
#3 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(324): Automattic\Jetpack\Search\Compatibility\Jetpack\convert_old_jetpack_search_sidebar(Array, 'sidebars_widget...')
#4 /var/www/html/dportilho.com.br/web/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#5 /var/www/htm in /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/jetpack_vendor/automattic/jetpack-search/src/instant-search/class-instant-search.php on line 20