PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 2.0.3
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v2.0.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 2.3.2 All 195 releases
← All changes | includes/class-convertkit-post.php +4 -88 2.2.02.0.3 View file →
@@ -49,11 +49,9 @@
49 49 $this->post_id = $post_id;
50 50
51 51 // Get Post Meta.
52 52 $meta = get_post_meta( $post_id, self::POST_META_KEY, true );
53 -
54 - // If no settings exist, or the settings are a string, fallback to the default settings.
55 - if ( ! $meta || is_string( $meta ) ) {
53 + if ( ! $meta ) {
56 54 // Fallback to default settings.
57 55 $meta = $this->get_default_settings();
58 56
59 57 // Backward compat check for older Plugin version settings.
@@ -130,76 +128,8 @@
130 128
131 129 }
132 130
133 131 /**
134 - * Returns the restrict content setting for the Post, which might be a
135 - * Form, Tag or Product.
136 - *
137 - * @since 2.1.0
138 - *
139 - * @return string
140 - */
141 - public function get_restrict_content() {
142 -
143 - return $this->settings['restrict_content'];
144 -
145 - }
146 -
147 - /**
148 - * Returns the restrict content setting's resource type.
149 - *
150 - * @since 2.1.0
151 - *
152 - * @return string
153 - */
154 - public function get_restrict_content_type() {
155 -
156 - // No type if restrict content isn't enabled on this Post.
157 - if ( ! $this->restrict_content_enabled() ) {
158 - return '';
159 - }
160 -
161 - // No type if the setting isn't of the expected format resource_ID.
162 - if ( strpos( $this->settings['restrict_content'], '_' ) === false ) {
163 - return '';
164 - }
165 -
166 - // Extract resource type from the setting.
167 - list( $resource_type, $resource_id ) = explode( '_', $this->settings['restrict_content'] );
168 -
169 - // Return resource type.
170 - return $resource_type;
171 -
172 - }
173 -
174 - /**
175 - * Returns the restrict content setting's resource ID.
176 - *
177 - * @since 2.1.0
178 - *
179 - * @return bool|int
180 - */
181 - public function get_restrict_content_id() {
182 -
183 - // No ID if restrict content isn't enabled on this Post.
184 - if ( ! $this->restrict_content_enabled() ) {
185 - return false;
186 - }
187 -
188 - // No ID if the setting isn't of the expected format resource_ID.
189 - if ( strpos( $this->settings['restrict_content'], '_' ) === false ) {
190 - return false;
191 - }
192 -
193 - // Extract resource ID from the setting.
194 - list( $resource_type, $resource_id ) = explode( '_', $this->settings['restrict_content'] );
195 -
196 - // Return resource ID.
197 - return (int) $resource_id;
198 -
199 - }
200 -
201 - /**
202 132 * Whether the Post has a ConvertKit Form defined.
203 133 *
204 134 * @since 1.9.6
205 135 *
@@ -263,21 +193,8 @@
263 193
264 194 }
265 195
266 196 /**
267 - * Whether the Post has a ConvertKit Form, Tag or Product defined for restricted content.
268 - *
269 - * @since 2.0.0
270 - *
271 - * @return bool
272 - */
273 - public function restrict_content_enabled() {
274 -
275 - return ! empty( $this->settings['restrict_content'] );
276 -
277 - }
278 -
279 - /**
280 197 * Saves Post settings to the Post.
281 198 *
282 199 * @since 1.9.6
283 200 *
@@ -300,12 +217,11 @@
300 217 */
301 218 public function get_default_settings() {
302 219
303 220 $defaults = array(
304 - 'form' => '-1', // -1: Plugin Default Form, 0: No Form, 1+: Specific Form ID on ConvertKit.
305 - 'landing_page' => '',
306 - 'tag' => '',
307 - 'restrict_content' => '',
221 + 'form' => '-1', // -1: Plugin Default Form, 0: No Form, 1+: Specific Form ID on ConvertKit.
222 + 'landing_page' => '',
223 + 'tag' => '',
308 224 );
309 225
310 226 /**
311 227 * The default settings, used to populate the Post's Settings when a Post has no Settings.