PluginProbe
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages / 3.4.5
Kit (formerly ConvertKit) – Email Newsletter, Email Marketing, Membership, Subscribers and Landing Pages v3.4.5
3.4.5 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 All 198 releases
← All changes | includes/class-convertkit-settings-restrict-content.php +178 -12 2.2.8 → 3.4.5 View file →
@@ -64,8 +64,21 @@
64 64
65 65 }
66 66
67 67 /**
68 + * Returns whether crawlers are permitted to index Member Content in the Plugin settings.
69 + *
70 + * @since 2.4.1
71 + *
72 + * @return bool
73 + */
74 + public function permit_crawlers() {
75 +
76 + return ( $this->settings['permit_crawlers'] === 'on' ? true : false );
77 +
78 + }
79 +
80 + /**
68 81 * Returns Restrict Content settings value for the given key.
69 82 *
70 83 * @since 2.1.0
71 84 *
@@ -89,21 +102,135 @@
89 102
90 103 }
91 104
92 105 /**
93 - * Returns whether Restrict Content is enabled in the Plugin settings.
106 + * Returns this settings group's programmatic name.
94 107 *
95 - * @since 2.1.0
108 + * @since 3.4.0
96 109 *
97 - * @return bool
110 + * @return string
98 111 */
99 - public function enabled() {
112 + public function get_name() {
100 113
101 - return ( $this->settings['enabled'] === 'on' ? true : false );
114 + return 'restrict-content';
102 115
103 116 }
104 117
105 118 /**
119 + * Returns the title of this settings group.
120 + *
121 + * @since 3.4.0
122 + *
123 + * @return string
124 + */
125 + public function get_title() {
126 +
127 + return __( 'Member Content Settings', 'convertkit' );
128 +
129 + }
130 +
131 + /**
132 + * Returns the keys in this settings group that hold credentials or other
133 + * sensitive values.
134 + *
135 + * Member Content settings hold no secrets; returned for interface
136 + * consistency.
137 + *
138 + * @since 3.4.0
139 + *
140 + * @return string[]
141 + */
142 + public function get_secret_keys() {
143 +
144 + return array();
145 +
146 + }
147 +
148 + /**
149 + * Returns the JSON Schema describing this settings group, in the shape
150 + * stored by save() / returned by get(), excluding secret keys.
151 + *
152 + * @since 3.4.0
153 + *
154 + * @return array
155 + */
156 + public function get_schema() {
157 +
158 + return array(
159 + 'type' => 'object',
160 + 'additionalProperties' => false,
161 + 'properties' => array(
162 + 'permit_crawlers' => array(
163 + 'type' => 'string',
164 + 'enum' => array( '', 'on' ),
165 + 'description' => __( 'Whether search engine crawlers are permitted to index Member Content.', 'convertkit' ),
166 + ),
167 + 'no_access_text_form' => array(
168 + 'type' => 'string',
169 + 'description' => __( 'Message shown to a visitor without access when content is restricted by Form.', 'convertkit' ),
170 + ),
171 + 'subscribe_heading' => array(
172 + 'type' => 'string',
173 + 'description' => __( 'Heading shown above the subscribe call-to-action when content is restricted by Product.', 'convertkit' ),
174 + ),
175 + 'subscribe_text' => array(
176 + 'type' => 'string',
177 + 'description' => __( 'Body text shown alongside the subscribe call-to-action when content is restricted by Product.', 'convertkit' ),
178 + ),
179 + 'no_access_text' => array(
180 + 'type' => 'string',
181 + 'description' => __( 'Message shown to a visitor without access when content is restricted by Product.', 'convertkit' ),
182 + ),
183 + 'subscribe_heading_tag' => array(
184 + 'type' => 'string',
185 + 'description' => __( 'Heading shown above the subscribe call-to-action when content is restricted by Tag.', 'convertkit' ),
186 + ),
187 + 'subscribe_text_tag' => array(
188 + 'type' => 'string',
189 + 'description' => __( 'Body text shown alongside the subscribe call-to-action when content is restricted by Tag.', 'convertkit' ),
190 + ),
191 + 'no_access_text_tag' => array(
192 + 'type' => 'string',
193 + 'description' => __( 'Message shown to a visitor without access when content is restricted by Tag.', 'convertkit' ),
194 + ),
195 + 'subscribe_button_label' => array(
196 + 'type' => 'string',
197 + 'description' => __( 'Label for the Subscribe button.', 'convertkit' ),
198 + ),
199 + 'email_text' => array(
200 + 'type' => 'string',
201 + 'description' => __( 'Body text shown above the email log-in form.', 'convertkit' ),
202 + ),
203 + 'email_button_label' => array(
204 + 'type' => 'string',
205 + 'description' => __( 'Label for the email log-in button.', 'convertkit' ),
206 + ),
207 + 'email_heading' => array(
208 + 'type' => 'string',
209 + 'description' => __( 'Heading shown above the email log-in form.', 'convertkit' ),
210 + ),
211 + 'email_description_text' => array(
212 + 'type' => 'string',
213 + 'description' => __( 'Description shown beneath the email log-in heading.', 'convertkit' ),
214 + ),
215 + 'email_check_heading' => array(
216 + 'type' => 'string',
217 + 'description' => __( 'Heading shown after the visitor requests a magic log-in code.', 'convertkit' ),
218 + ),
219 + 'email_check_text' => array(
220 + 'type' => 'string',
221 + 'description' => __( 'Body text shown after the visitor requests a magic log-in code.', 'convertkit' ),
222 + ),
223 + 'container_css_classes' => array(
224 + 'type' => 'string',
225 + 'description' => __( 'Additional CSS classes appended to the Restrict Content container element.', 'convertkit' ),
226 + ),
227 + ),
228 + );
229 +
230 + }
231 +
232 + /**
106 233 * The default settings, used when the ConvertKit Restrict Content Settings haven't been saved
107 234 * e.g. on a new installation.
108 235 *
109 236 * @since 2.1.0
@@ -112,15 +239,33 @@
112 239 */
113 240 public function get_defaults() {
114 241
115 242 $defaults = array(
116 - 'enabled' => '',
117 - 'subscribe_text' => __( 'This content is only available to premium subscribers', 'convertkit' ),
243 + // Permit Crawlers.
244 + 'permit_crawlers' => '',
245 +
246 + // Restrict by Form.
247 + 'no_access_text_form' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ),
248 +
249 + // Restrict by Product.
250 + 'subscribe_heading' => __( 'Read this post with a premium subscription', 'convertkit' ),
251 + 'subscribe_text' => __( 'This post is only available to premium subscribers. Join today to get access to all posts.', 'convertkit' ),
252 + 'no_access_text' => __( 'Your account does not have access to this content. Please use the button above to purchase, or enter the email address you used to purchase the product.', 'convertkit' ),
253 +
254 + // Restrict by Tag.
255 + 'subscribe_heading_tag' => __( 'Subscribe to keep reading', 'convertkit' ),
256 + 'subscribe_text_tag' => __( 'This post is free to read but only available to subscribers. Join today to get access to all posts.', 'convertkit' ),
257 + 'no_access_text_tag' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ),
258 +
259 + // All.
118 260 'subscribe_button_label' => __( 'Subscribe', 'convertkit' ),
119 - 'email_text' => __( 'Already a premium subscriber? Enter the email address used when purchasing below, to receive a login link to access.', 'convertkit' ),
120 - 'email_button_label' => __( 'Send email', 'convertkit' ),
121 - 'email_check_text' => __( 'Check your email and click the link to login, or enter the code from the email below.', 'convertkit' ),
122 - 'no_access_text' => __( 'Your account does not have access to this content. Please use the button below to purchase, or enter the email address you used to purchase the product.', 'convertkit' ),
261 + 'email_text' => __( 'Already subscribed?', 'convertkit' ),
262 + 'email_button_label' => __( 'Log in', 'convertkit' ),
263 + 'email_heading' => __( 'Log in to read this post', 'convertkit' ),
264 + 'email_description_text' => __( 'We\'ll email you a magic code to log you in without a password.', 'convertkit' ),
265 + 'email_check_heading' => __( 'We just emailed you a log in code', 'convertkit' ),
266 + 'email_check_text' => __( 'Enter the code below to finish logging in', 'convertkit' ),
267 + 'container_css_classes' => '',
123 268 );
124 269
125 270 /**
126 271 * The default settings, used when the ConvertKit Restrict Content Settings haven't been saved
@@ -127,9 +272,9 @@
127 272 * e.g. on a new installation.
128 273 *
129 274 * @since 2.1.0
130 275 *
131 - * @param array $defaults
276 + * @param array $defaults Default settings.
132 277 */
133 278 $defaults = apply_filters( 'convertkit_settings_restrict_content_get_defaults', $defaults );
134 279
135 280 return $defaults;
@@ -145,8 +290,29 @@
145 290 */
146 291 public function save( $settings ) {
147 292
148 293 update_option( self::SETTINGS_NAME, array_merge( $this->get(), $settings ) );
294 +
295 + // Reload settings in class, to reflect changes.
296 + $this->refresh_settings();
297 +
298 + }
299 +
300 + /**
301 + * Reloads settings from the options table so this instance has the latest values.
302 + *
303 + * @since 3.3.5
304 + */
305 + private function refresh_settings() {
306 +
307 + $settings = get_option( self::SETTINGS_NAME );
308 +
309 + if ( ! $settings ) {
310 + $this->settings = $this->get_defaults();
311 + return;
312 + }
313 +
314 + $this->settings = array_merge( $this->get_defaults(), $settings );
149 315
150 316 }
151 317
152 318 }