Code Duplication    Length = 12-14 lines in 2 locations

projects/plugins/jetpack/modules/search/class-jetpack-instant-search.php 1 location

@@ 74-85 (lines=12) @@
71
	 * @since 5.0.0
72
	 */
73
	public function init_hooks() {
74
		if ( ! is_admin() ) {
75
			add_filter( 'posts_pre_query', array( $this, 'filter__posts_pre_query' ), 10, 2 );
76
			add_action( 'parse_query', array( $this, 'action__parse_query' ), 10, 1 );
77
78
			add_action( 'init', array( $this, 'set_filters_from_widgets' ) );
79
80
			add_action( 'wp_enqueue_scripts', array( $this, 'load_assets' ) );
81
			add_action( 'wp_footer', array( $this, 'print_instant_search_sidebar' ) );
82
			add_filter( 'body_class', array( $this, 'add_body_class' ), 10 );
83
		} else {
84
			add_action( 'update_option', array( $this, 'track_widget_updates' ), 10, 3 );
85
		}
86
87
		/**
88
		 * Note:

projects/plugins/jetpack/modules/search/class.jetpack-search.php 1 location

@@ 213-226 (lines=14) @@
210
	 * @since 5.0.0
211
	 */
212
	public function init_hooks() {
213
		if ( ! is_admin() ) {
214
			add_filter( 'posts_pre_query', array( $this, 'filter__posts_pre_query' ), 10, 2 );
215
216
			add_filter( 'jetpack_search_es_wp_query_args', array( $this, 'filter__add_date_filter_to_query' ), 10, 2 );
217
218
			add_action( 'did_jetpack_search_query', array( $this, 'store_last_query_info' ) );
219
			add_action( 'failed_jetpack_search_query', array( $this, 'store_query_failure' ) );
220
221
			add_action( 'init', array( $this, 'set_filters_from_widgets' ) );
222
223
			add_action( 'pre_get_posts', array( $this, 'maybe_add_post_type_as_var' ) );
224
		} else {
225
			add_action( 'update_option', array( $this, 'track_widget_updates' ), 10, 3 );
226
		}
227
228
		add_action( 'jetpack_deactivate_module_search', array( $this, 'move_search_widgets_to_inactive' ) );
229
	}