PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 1.9.7.2
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v1.9.7.2
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 2.3.1 All 196 releases
← All changes | admin/class-convertkit-admin-post.php +9 -51 2.2.81.9.7.2 View file →
@@ -59,11 +59,8 @@
59 59
60 60 // Enqueue Select2 CSS.
61 61 convertkit_select2_enqueue_styles();
62 62
63 - // Enqueue Post CSS.
64 - wp_enqueue_style( 'convertkit-post', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/post.css', array(), CONVERTKIT_PLUGIN_VERSION );
65 -
66 63 /**
67 64 * Enqueue CSS for the Settings Screen at Settings > ConvertKit
68 65 *
69 66 * @since 1.9.6.4
@@ -117,16 +114,12 @@
117 114 include CONVERTKIT_PLUGIN_PATH . '/views/backend/post/no-api-key.php';
118 115 return;
119 116 }
120 117
121 - // Initialize Restrict Content Settings class.
122 - $restrict_content_settings = new ConvertKit_Settings_Restrict_Content();
123 -
124 118 // Fetch Post Settings, Forms, Landing Pages and Tags.
125 119 $convertkit_post = new ConvertKit_Post( $post->ID );
126 120 $convertkit_forms = new ConvertKit_Resource_Forms();
127 121 $convertkit_landing_pages = new ConvertKit_Resource_Landing_Pages();
128 - $convertkit_products = new ConvertKit_Resource_Products();
129 122 $convertkit_tags = new ConvertKit_Resource_Tags();
130 123
131 124 // Get settings page link.
132 125 $settings_link = convertkit_get_settings_link();
@@ -136,9 +129,9 @@
136 129
137 130 }
138 131
139 132 /**
140 - * Saves Post Settings when either editing a Post/Page or using the Quick Edit functionality.
133 + * Save Post Settings.
141 134 *
142 135 * @since 1.9.6
143 136 *
144 137 * @param int $post_id Post ID.
@@ -160,9 +153,9 @@
160 153 return;
161 154 }
162 155
163 156 // Bail if the nonce verification fails.
164 - if ( ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['wp-convertkit-save-meta-nonce'] ) ), 'wp-convertkit-save-meta' ) ) {
157 + if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['wp-convertkit-save-meta-nonce'] ) ), 'wp-convertkit-save-meta' ) ) {
165 158 return;
166 159 }
167 160
168 161 // Bail if no ConvertKit settings were posted.
@@ -169,52 +162,17 @@
169 162 if ( ! isset( $_POST['wp-convertkit'] ) ) {
170 163 return;
171 164 }
172 165
173 - // Save Post's settings.
174 - $this->save_post_settings( $post_id, $_POST['wp-convertkit'] );
166 + // Build metadata.
167 + $meta = array(
168 + 'form' => ( isset( $_POST['wp-convertkit']['form'] ) ? sanitize_text_field( wp_unslash( $_POST['wp-convertkit']['form'] ) ) : '-1' ),
169 + 'landing_page' => ( isset( $_POST['wp-convertkit']['landing_page'] ) ? sanitize_text_field( wp_unslash( $_POST['wp-convertkit']['landing_page'] ) ) : '' ),
170 + 'tag' => ( isset( $_POST['wp-convertkit']['tag'] ) ? sanitize_text_field( wp_unslash( $_POST['wp-convertkit']['tag'] ) ) : '' ),
171 + );
175 172
176 - }
177 -
178 - /**
179 - * Saves the Post's settings submitted via $_POST or $_REQUEST.
180 - * Can be used across Edit, Quick Edit and Bulk Edit.
181 - *
182 - * @since 1.9.8.0
183 - *
184 - * @param int $post_id Post ID.
185 - * @param array $settings Settings.
186 - */
187 - public function save_post_settings( $post_id, $settings ) {
188 -
189 - // Get Post's settings.
173 + // Save metadata.
190 174 $convertkit_post = new ConvertKit_Post( $post_id );
191 - $meta = $convertkit_post->get();
192 -
193 - // Update Post's setting values if they were included in the $_POST data.
194 - // Some values may not be included in the $_POST data e.g. if Quick Edit is used and no Landing Page was specified,
195 - // in which case the existing Post's value will be used.
196 - // This ensures settings are not deleted by accident.
197 - foreach ( $meta as $key => $existing_value ) {
198 - // Skip if this setting isn't included in the $_POST data.
199 - if ( ! isset( $settings[ $key ] ) ) {
200 - continue;
201 - }
202 -
203 - // Sanitize value.
204 - $new_value = sanitize_text_field( wp_unslash( $settings[ $key ] ) );
205 -
206 - // Skip if the setting value is -2, as this means it's a Bulk Edit request and this setting
207 - // is set as 'No Change'.
208 - if ( $new_value == '-2' ) { // phpcs:ignore WordPress.PHP.StrictComparisons
209 - continue;
210 - }
211 -
212 - // Update setting using posted value.
213 - $meta[ $key ] = $new_value;
214 - }
215 -
216 - // Save settings.
217 175 $convertkit_post->save( $meta );
218 176
219 177 // If a Form or Landing Page was specified, request a review.
220 178 // This can safely be called multiple times, as the review request