-
Notifications
You must be signed in to change notification settings - Fork 8
Importer: MailPoet #995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Importer: MailPoet #995
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0bd94b3
Importers: MailPoet
n7studios 8e70cfc
Merge branch 'main' into importers-mailpoet
n7studios fb21643
Merge remote-tracking branch 'origin/tests-elementor-dismiss-notice' …
n7studios 471437a
Importers: Newsletter Plugin
n7studios 1862c04
Added Integration Tests
n7studios 97ff831
Added End to End Tests
n7studios a1b9c3f
Merge pull request #997 from Kit/importers-newsletter
n7studios File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
admin/importers/class-convertkit-admin-importer-mailpoet.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| <?php | ||
| /** | ||
| * ConvertKit Admin Importer Mailpoet class. | ||
| * | ||
| * @package ConvertKit | ||
| * @author ConvertKit | ||
| */ | ||
|
|
||
| /** | ||
| * Import and migrate data from Mailpoet to Kit. | ||
| * | ||
| * @package ConvertKit | ||
| * @author ConvertKit | ||
| */ | ||
| class ConvertKit_Admin_Importer_Mailpoet extends ConvertKit_Admin_Importer { | ||
|
|
||
| /** | ||
| * Holds the shortcode name for Mailpoet forms. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @var string | ||
| */ | ||
| public $shortcode_name = 'mailpoet_form'; | ||
|
|
||
| /** | ||
| * Holds the ID attribute name for Mailpoet forms. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @var string | ||
| */ | ||
| public $shortcode_id_attribute = 'id'; | ||
|
|
||
| /** | ||
| * Holds the block name for Mailpoet forms. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @var string | ||
| */ | ||
| public $block_name = 'mailpoet/subscription-form-block'; | ||
|
|
||
| /** | ||
| * Holds the ID attribute name for Mailpoet forms. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @var string | ||
| */ | ||
| public $block_id_attribute = 'formId'; | ||
|
|
||
| /** | ||
| * Returns an array of Mailpoet form IDs and titles. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @return array | ||
| */ | ||
| public function get_forms() { | ||
|
|
||
| global $wpdb; | ||
|
|
||
| // Query wp_mailpoet_forms for forms that are not deleted. | ||
| $results = $wpdb->get_results( | ||
| "SELECT id, name FROM {$wpdb->prefix}mailpoet_forms WHERE deleted_at IS NULL" | ||
| ); | ||
|
|
||
| if ( empty( $results ) ) { | ||
| return array(); | ||
| } | ||
|
|
||
| $forms = array(); | ||
| foreach ( $results as $form ) { | ||
| $forms[ $form->id ] = $form->name; | ||
| } | ||
|
|
||
| return $forms; | ||
|
|
||
| } | ||
|
|
||
| } | ||
49 changes: 49 additions & 0 deletions
49
admin/importers/class-convertkit-admin-importer-newsletter.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
| /** | ||
| * ConvertKit Admin Importer Newsletter class. | ||
| * | ||
| * @package ConvertKit | ||
| * @author ConvertKit | ||
| */ | ||
|
|
||
| /** | ||
| * Import and migrate data from Newsletter to Kit. | ||
| * | ||
| * @package ConvertKit | ||
| * @author ConvertKit | ||
| */ | ||
| class ConvertKit_Admin_Importer_Newsletter extends ConvertKit_Admin_Importer { | ||
|
|
||
| /** | ||
| * Holds the shortcode name for Newsletter forms. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @var string | ||
| */ | ||
| public $shortcode_name = 'newsletter_form'; | ||
|
|
||
| /** | ||
| * Holds the block name for Newsletter forms. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @var string | ||
| */ | ||
| public $block_name = 'tnp/minimal'; | ||
|
|
||
| /** | ||
| * Returns an array of the Newsletter Default Form, if the shortcode | ||
| * or block is used. | ||
| * | ||
| * @since 3.1.6 | ||
| * | ||
| * @return array | ||
| */ | ||
| public function get_forms() { | ||
|
|
||
| return $this->get_form_ids_in_posts(); | ||
|
|
||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this unnecessary? Without it, wouldn't the function already return the empty array on line 73 when there's no results since the foreach loop on line 74 would do nothing?