Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion admin/importers/class-convertkit-admin-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
);

Expand Down
48 changes: 24 additions & 24 deletions tests/Integration/ImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] )
);
}
Expand All @@ -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]',
];

Expand Down Expand Up @@ -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'] )
);
}
Expand All @@ -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]',
];

Expand Down Expand Up @@ -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'] )
);
}
Expand All @@ -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]',
];

Expand Down Expand Up @@ -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'] )
);
}
Expand All @@ -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]',
];

Expand Down Expand Up @@ -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'] )
);
}
Expand All @@ -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]',
];

Expand Down Expand Up @@ -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'] )
);
}
Expand All @@ -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]',
];

Expand Down