diff --git a/admin/importers/class-convertkit-admin-importer.php b/admin/importers/class-convertkit-admin-importer.php index 174b4eac6..b4a9ccf72 100644 --- a/admin/importers/class-convertkit-admin-importer.php +++ b/admin/importers/class-convertkit-admin-importer.php @@ -288,7 +288,7 @@ public function replace_shortcodes_in_content( $content, $third_party_form_id, $ return preg_replace( $pattern, - '[convertkit_form id="' . $form_id . '"]', + '[convertkit_form form="' . $form_id . '"]', $content ); diff --git a/tests/Integration/ImporterTest.php b/tests/Integration/ImporterTest.php index c11f99668..0b3d27c46 100644 --- a/tests/Integration/ImporterTest.php +++ b/tests/Integration/ImporterTest.php @@ -108,21 +108,21 @@ public function testActiveCampaignReplaceShortcodesInContent() // Test each shortcode is replaced with the Kit form shortcode. foreach ( $shortcodes as $shortcode ) { $this->assertEquals( - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $shortcode, 1, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode.'; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', $this->importer->replace_shortcodes_in_content( $content, 1, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content and duplicate the shortcode. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode: ' . $shortcode; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $content, 1, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); } @@ -143,7 +143,7 @@ public function testActiveCampaignReplaceShortcodesInContentIgnoringOtherShortco // Define the shortcodes to test. $shortcodes = [ - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', '[a_random_shortcode]', ]; @@ -272,21 +272,21 @@ public function testAWeberReplaceShortcodesInContent() // Test each shortcode is replaced with the Kit form shortcode. foreach ( $shortcodes as $shortcode ) { $this->assertEquals( - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $shortcode, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode.'; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', $this->importer->replace_shortcodes_in_content( $content, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content and duplicate the shortcode. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode: ' . $shortcode; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $content, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); } @@ -307,7 +307,7 @@ public function testAWeberReplaceShortcodesInContentIgnoringOtherShortcodes() // Define the shortcodes to test. $shortcodes = [ - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', '[a_random_shortcode]', ]; @@ -435,21 +435,21 @@ public function testCampaignMonitorReplaceShortcodesInContent() // Test each shortcode is replaced with the Kit form shortcode. foreach ( $shortcodes as $shortcode ) { $this->assertEquals( - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $shortcode, 'cm_6912dba75db2d', $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode.'; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', $this->importer->replace_shortcodes_in_content( $content, 'cm_6912dba75db2d', $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content and duplicate the shortcode. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode: ' . $shortcode; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $content, 'cm_6912dba75db2d', $_ENV['CONVERTKIT_API_FORM_ID'] ) ); } @@ -470,7 +470,7 @@ public function testCampaignMonitorReplaceShortcodesInContentIgnoringOtherShortc // Define the shortcodes to test. $shortcodes = [ - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', '[a_random_shortcode]', ]; @@ -539,21 +539,21 @@ public function testMC4WPReplaceShortcodesInContent() // Test each shortcode is replaced with the Kit form shortcode. foreach ( $shortcodes as $shortcode ) { $this->assertEquals( - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $shortcode, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode.'; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', $this->importer->replace_shortcodes_in_content( $content, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content and duplicate the shortcode. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode: ' . $shortcode; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $content, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); } @@ -574,7 +574,7 @@ public function testMC4WPReplaceShortcodesInContentIgnoringOtherShortcodes() // Define the shortcodes to test. $shortcodes = [ - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', '[a_random_shortcode]', ]; @@ -693,21 +693,21 @@ public function testMailPoetReplaceShortcodesInContent() // Test each shortcode is replaced with the Kit form shortcode. foreach ( $shortcodes as $shortcode ) { $this->assertEquals( - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $shortcode, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode.'; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', $this->importer->replace_shortcodes_in_content( $content, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content and duplicate the shortcode. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode: ' . $shortcode; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $content, 10, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); } @@ -728,7 +728,7 @@ public function testMailPoetReplaceShortcodesInContentIgnoringOtherShortcodes() // Define the shortcodes to test. $shortcodes = [ - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', '[a_random_shortcode]', ]; @@ -846,21 +846,21 @@ public function testNewsletterReplaceShortcodesInContent() // Test each shortcode is replaced with the Kit form shortcode. foreach ( $shortcodes as $shortcode ) { $this->assertEquals( - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $shortcode, 0, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode.'; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode.', $this->importer->replace_shortcodes_in_content( $content, 0, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); // Prepend and append some content and duplicate the shortcode. $content = 'Some content before the shortcode: ' . $shortcode . ' Some content after the shortcode: ' . $shortcode; $this->assertEquals( - 'Some content before the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + 'Some content before the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"] Some content after the shortcode: [convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', $this->importer->replace_shortcodes_in_content( $content, 0, $_ENV['CONVERTKIT_API_FORM_ID'] ) ); } @@ -881,7 +881,7 @@ public function testNewsletterReplaceShortcodesInContentIgnoringOtherShortcodes( // Define the shortcodes to test. $shortcodes = [ - '[convertkit_form id="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', + '[convertkit_form form="' . $_ENV['CONVERTKIT_API_FORM_ID'] . '"]', '[a_random_shortcode]', ];