get_results("select id,post_title,post_content from {$wpdb->posts} where ( post_content like '%/s'; preg_match_all( $pattern, $post_content, $matches ); if( !empty( $matches[1] ) ) { foreach( $matches[1] as $match ) { $form_array = json_decode( $match, true ); if( $form_array !== null ) { $unique_id = $form_array['uniqueID']; $form_title = strlen( $post_title ) > 30 ? substr( $post_title, 0, 30 ) . '...' : $post_title; $form_value = $unique_id . ' - ' . $form_title; $triggers[$unique_id] = $form_value; } } } $advanced_pattern = '//s'; preg_match_all( $advanced_pattern, $post_content, $advanced_matches ); if( !empty( $advanced_matches[1] ) ) { foreach( $advanced_matches[1] as $match ) { $form_array = json_decode( $match, true ); if( $form_array !== null ) { $unique_id = isset( $form_array['uniqueID'] ) ? $form_array['uniqueID'] : ''; if( !empty( $unique_id ) ) { $key = 'adv_' . $form_array['id']; $form_title = strlen( $post_title ) > 30 ? substr( $post_title, 0, 30 ) . '...' : $post_title; $form_value = 'Adv ' . $unique_id . ' - ' . $form_title; $triggers[$key] = $form_value; } } } } } return $triggers; } function adfoin_kadence_get_form_fields( $form_provider, $form_id ) { if( $form_provider != 'kadence' ) { return; } global $wpdb; if( str_contains( $form_id, 'adv_' ) ) { $form_id = explode( 'adv_', $form_id ); $post_id = (int) $form_id[1]; $post = $wpdb->get_results( $wpdb->prepare( "select id,post_content from {$wpdb->posts} where id = %d", $post_id ) ); if( empty( $post ) ) { return; } $form_content = $post[0]->post_content; $fields = array(); $lines = explode( "\n", $form_content ); $pattern = '/\{.*\}/s'; foreach( $lines as $line ) { preg_match_all( $pattern, $line, $matches ); if( !empty( $matches[0] ) ) { foreach( $matches[0] as $match ) { $form_array = json_decode( $match, true ); if( isset( $form_array['uniqueID'], $form_array['formID'], $form_array['label'] ) ) { $fields['field' . $form_array['uniqueID']] = $form_array['label']; } } } } $fields['form_id'] = __( 'Form ID', 'advanced-form-integration' ); return $fields; } $post_id = explode( '_', $form_id ); $post_id = (int) $post_id[0]; $post = $wpdb->get_results( $wpdb->prepare( "select id,post_content from {$wpdb->posts} where id = %d", $post_id ) ); if( empty( $post ) ) { return; } $form_content = $post[0]->post_content; $contentArray = explode('