has_forms_in_posts() ) { return $importers; } // Bail if no third party forms exist for this importer. if ( ! $this->has_forms() ) { return $importers; } // Add this importer to the list of importers. $importers[ $this->name ] = array( 'name' => $this->name, 'title' => $this->title, 'description' => $this->description, 'forms' => $this->get_forms(), ); return $importers; } /** * Replaces third party form shortcodes and blocks with Kit form shortcodes and blocks. * * @since 3.1.7 * * @param array $mappings Mappings. */ public function import( $mappings ) { // Iterate through the mappings, replacing the third party form shortcodes and blocks with the Kit form shortcodes and blocks. foreach ( $mappings as $third_party_form_id => $kit_form_id ) { // Skip empty Kit Form IDs i.e. no mapping was provided for this third party form. if ( empty( $kit_form_id ) ) { continue; } if ( $this->block_name ) { $this->replace_blocks_in_posts( $third_party_form_id, (int) $kit_form_id ); } if ( $this->shortcode_name ) { $this->replace_shortcodes_in_posts( $third_party_form_id, (int) $kit_form_id ); } } } /** * Returns an array of post IDs that contain the third party form block or shortcode. * * @since 3.1.5 * * @return array */ public function get_forms_in_posts() { global $wpdb; // Build WHERE clauses and values. $post_content_clauses = array(); $post_content_values = array(); if ( $this->shortcode_name ) { $post_content_clauses[] = 'post_content LIKE %s'; $post_content_values[] = '%[' . $this->shortcode_name . '%'; } if ( $this->block_name ) { $post_content_clauses[] = 'post_content LIKE %s'; $post_content_values[] = '%