PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.4
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.4
3.4.4 3.4.3 3.4.2 3.4.1 3.4.0 3.3.9 3.3.8 3.3.7 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 3.3.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 All 197 releases
convertkit / admin / importers / class-convertkit-admin-importer-mc4wp.php

class-convertkit-admin-importer-mc4wp.php in Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages 3.4.4, at admin/importers/class-convertkit-admin-importer-mc4wp.php

114 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ConvertKit Admin Importer MC4WP class.
4 *
5 * @package ConvertKit
6 * @author ConvertKit
7 */
8
9 /**
10 * Import and migrate data from Mailchimp (MC4WP) to Kit.
11 *
12 * @package ConvertKit
13 * @author ConvertKit
14 */
15 class ConvertKit_Admin_Importer_MC4WP extends ConvertKit_Admin_Importer {
16
17 /**
18 * Holds the programmatic name of the importer (lowercase, no spaces).
19 *
20 * @since 3.1.7
21 *
22 * @var string
23 */
24 public $name = 'mc4wp';
25
26 /**
27 * Holds the title of the importer (for display in the importer list).
28 *
29 * @since 3.1.7
30 *
31 * @var string
32 */
33 public $title = 'MC4WP';
34
35 /**
36 * Holds the shortcode name for MC4WP forms.
37 *
38 * @since 3.1.0
39 *
40 * @var string
41 */
42 public $shortcode_name = 'mc4wp_form';
43
44 /**
45 * Holds the ID attribute name for MC4WP forms.
46 *
47 * @since 3.1.0
48 *
49 * @var string
50 */
51 public $shortcode_id_attribute = 'id';
52
53 /**
54 * Holds the block name for MC4WP forms.
55 *
56 * @since 3.1.6
57 *
58 * @var string
59 */
60 public $block_name = 'mailchimp-for-wp/form';
61
62 /**
63 * Holds the ID attribute name for MC4WP forms.
64 *
65 * @since 3.1.6
66 *
67 * @var string
68 */
69 public $block_id_attribute = 'id';
70
71 /**
72 * Constructor
73 *
74 * @since 3.1.7
75 */
76 public function __construct() {
77
78 // Register this as an importer, if MC4WP forms exist.
79 add_filter( 'convertkit_get_form_importers', array( $this, 'register' ) );
80
81 }
82
83 /**
84 * Returns an array of MC4WP form IDs and titles.
85 *
86 * @since 3.1.0
87 *
88 * @return array
89 */
90 public function get_forms() {
91
92 $posts = new WP_Query(
93 array(
94 'post_type' => 'mc4wp-form',
95 'post_status' => 'publish',
96 'update_post_cache' => false,
97 )
98 );
99
100 if ( ! $posts->post_count ) {
101 return array();
102 }
103
104 $forms = array();
105 foreach ( $posts->posts as $form ) {
106 $forms[ $form->ID ] = $form->post_title;
107 }
108
109 return $forms;
110
111 }
112
113 }
114