'something', 'post_parent' => '', 'include_styles' => '', ), $atts ); $id = $atts['id']; $post_parent = $atts['post_parent']; $include_styles = $atts['include_styles']; $inst = wd_asl()->instances->get(0); $style = $inst['data']; // Set the "_fo" item to indicate that the non-ajax search was made via this form, and save the options there // phpcs:ignore WordPress.Security.NonceVerification.Missing if ( isset($_POST['p_asl_data']) || isset($_POST['np_asl_data']) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing $_p_data = wp_unslash($_POST['p_asl_data'] ?? $_POST['np_asl_data']); // phpcs:ignore // A serialized form (sanitize_text_field() would strip its encoded "[]"), values are only compared. // Anything else is not a form: the settings stay as the admin set them. if ( is_string($_p_data) ) { $_fo = array(); parse_str($_p_data, $_fo); foreach ( array( 'asl_gen', 'categoryset' ) as $_fo_list ) { $_fo[ $_fo_list ] = isset($_fo[ $_fo_list ]) && is_array($_fo[ $_fo_list ]) ? array_filter($_fo[ $_fo_list ], 'is_scalar') : array(); } $style['_fo'] = $_fo; } } $settings_hidden = !$style['show_frontend_search_settings']; // Triggered by URL // phpcs:ignore WordPress.Security.NonceVerification.Recommended if ( isset($_GET['asl_s']) && is_string($_GET['asl_s']) ) { $style['auto_populate'] = 'phrase'; // This is sanitized later on $style['auto_populate_phrase'] = wp_unslash($_GET['asl_s']); // phpcs:ignore $style['auto_populate_count'] = intval($style['maxresults']); } if ( $post_parent !== '' ) { $post_parent = array_unique( array_map( 'intval', array_filter( explode(',', $post_parent), 'is_numeric' ) ) ); if ( !empty($post_parent) ) { $current_instance = self::$instance_count; add_action( 'asl_layout_in_form', function ( $search_id ) use ( $post_parent, $current_instance ) { if ( $current_instance !== intval($search_id) ) { return; } foreach ( $post_parent as $pid ) { echo ""; } } ); } } $out = ''; /** * This is a very special case, only used when the user explicitly wants the styles to be * printed via an argument. */ if ( $include_styles ) { $styles = ( new WD_ASL_Styles() )->get(); ob_start(); foreach ( $styles['src'] as $style_url ) : // phpcs:ignore ?> load_google_fonts->value ) { return false; } $imports = array( '//fonts.googleapis.com/css?family=Open+Sans', ); $imports = apply_filters('asl_custom_fonts', $imports); $fonts = array(); foreach ( $imports as $import ) { $import = trim(str_replace(array( '@import url(', ');', 'https:', 'http:' ), '', $import)); $import = trim(str_replace('//fonts.googleapis.com/css?family=', '', $import)); if ( $import !== '' ) { $fonts[] = $import; } } if ( count($fonts) > 0 ) { ?>