← All changes
|
admin/class-convertkit-admin-settings-restrict-content.php
+140
-17
2.3.0
→
2.5.2
View file →
| @@ -64,35 +64,87 @@ | ||
| 64 | 64 | * @since 2.1.0 |
| 65 | 65 | */ |
| 66 | 66 | public function register_fields() { |
| 67 | 67 | |
| 68 | + // Permit Crawlers. | |
| 68 | 69 | add_settings_field( |
| 69 | - 'enabled', | |
| 70 | - __( 'Enable', 'convertkit' ), | |
| 71 | - array( $this, 'enable_callback' ), | |
| 70 | + 'permit_crawlers', | |
| 71 | + __( 'Permit Search Engine Crawlers', 'convertkit' ), | |
| 72 | + array( $this, 'permit_crawlers_callback' ), | |
| 72 | 73 | $this->settings_key, |
| 73 | 74 | $this->name, |
| 74 | 75 | array( |
| 75 | - 'name' => 'enabled', | |
| 76 | - 'description' => __( 'Enables the Member Content functionality, displaying configuration options on pages to require a subscription to a ConvertKit product', 'convertkit' ), | |
| 76 | + 'name' => 'permit_crawlers', | |
| 77 | + 'label_for' => 'permit_crawlers', | |
| 78 | + 'label' => __( 'When enabled, search engine crawlers (such as Google and Bing) are able to access Member Content for indexing.', 'convertkit' ), | |
| 79 | + 'description' => '', | |
| 77 | 80 | ) |
| 78 | 81 | ); |
| 79 | 82 | |
| 83 | + // Restrict by Product. | |
| 80 | 84 | add_settings_field( |
| 85 | + 'subscribe_heading', | |
| 86 | + __( 'Product: Subscribe Heading', 'convertkit' ), | |
| 87 | + array( $this, 'text_callback' ), | |
| 88 | + $this->settings_key, | |
| 89 | + $this->name, | |
| 90 | + array( | |
| 91 | + 'name' => 'subscribe_heading', | |
| 92 | + 'label_for' => 'subscribe_heading', | |
| 93 | + 'description' => array( | |
| 94 | + __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a ConvertKit Product, displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), | |
| 95 | + ), | |
| 96 | + ) | |
| 97 | + ); | |
| 98 | + | |
| 99 | + add_settings_field( | |
| 81 | 100 | 'subscribe_text', |
| 82 | - __( 'Subscribe Text', 'convertkit' ), | |
| 101 | + __( 'Product: Subscribe Text', 'convertkit' ), | |
| 102 | + array( $this, 'textarea_callback' ), | |
| 103 | + $this->settings_key, | |
| 104 | + $this->name, | |
| 105 | + array( | |
| 106 | + 'name' => 'subscribe_text', | |
| 107 | + 'label_for' => 'subscribe_text', | |
| 108 | + 'description' => array( | |
| 109 | + __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a ConvertKit Product, displays text explaining why the content is only available to subscribers.', 'convertkit' ), | |
| 110 | + ), | |
| 111 | + ) | |
| 112 | + ); | |
| 113 | + | |
| 114 | + // Restrict by Tag. | |
| 115 | + add_settings_field( | |
| 116 | + 'subscribe_heading_tag', | |
| 117 | + __( 'Tag: Subscribe Heading', 'convertkit' ), | |
| 83 | 118 | array( $this, 'text_callback' ), |
| 84 | 119 | $this->settings_key, |
| 85 | 120 | $this->name, |
| 86 | 121 | array( |
| 87 | - 'name' => 'subscribe_text', | |
| 122 | + 'name' => 'subscribe_heading_tag', | |
| 123 | + 'label_for' => 'subscribe_heading_tag', | |
| 88 | 124 | 'description' => array( |
| 89 | - __( 'The text to display above the subscribe button, explaining why the content is only available to subscribers.', 'convertkit' ), | |
| 125 | + __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a ConvertKit Tag, displays text in a heading explaining why the content is only available to subscribers.', 'convertkit' ), | |
| 90 | 126 | ), |
| 91 | 127 | ) |
| 92 | 128 | ); |
| 93 | 129 | |
| 94 | 130 | add_settings_field( |
| 131 | + 'subscribe_text_tag', | |
| 132 | + __( 'Tag: Subscribe Text', 'convertkit' ), | |
| 133 | + array( $this, 'textarea_callback' ), | |
| 134 | + $this->settings_key, | |
| 135 | + $this->name, | |
| 136 | + array( | |
| 137 | + 'name' => 'subscribe_text_tag', | |
| 138 | + 'label_for' => 'subscribe_text_tag', | |
| 139 | + 'description' => array( | |
| 140 | + __( 'When a Page, Post or Custom Post\'s Member Content setting is set to a ConvertKit Tag, displays text explaining why the content is only available to subscribers.', 'convertkit' ), | |
| 141 | + ), | |
| 142 | + ) | |
| 143 | + ); | |
| 144 | + | |
| 145 | + // All. | |
| 146 | + add_settings_field( | |
| 95 | 147 | 'subscribe_button_label', |
| 96 | 148 | __( 'Subscribe Button Label', 'convertkit' ), |
| 97 | 149 | array( $this, 'text_callback' ), |
| 98 | 150 | $this->settings_key, |
| @@ -98,10 +150,11 @@ | ||
| 98 | 150 | $this->settings_key, |
| 99 | 151 | $this->name, |
| 100 | 152 | array( |
| 101 | 153 | 'name' => 'subscribe_button_label', |
| 154 | + 'label_for' => 'subscribe_button_label', | |
| 102 | 155 | 'description' => array( |
| 103 | - __( 'The text to display for the call to action button to subscribe to the ConvertKit product.', 'convertkit' ), | |
| 156 | + __( 'The text to display for the call to action button to subscribe.', 'convertkit' ), | |
| 104 | 157 | ), |
| 105 | 158 | ) |
| 106 | 159 | ); |
| 107 | 160 | |
| @@ -112,15 +165,46 @@ | ||
| 112 | 165 | $this->settings_key, |
| 113 | 166 | $this->name, |
| 114 | 167 | array( |
| 115 | 168 | 'name' => 'email_text', |
| 169 | + 'label_for' => 'email_text', | |
| 116 | 170 | 'description' => array( |
| 117 | - __( 'The text to display above the email form, instructing the subscriber to enter their email address to receive a login link to access the member\'s only content.', 'convertkit' ), | |
| 171 | + __( 'The text to display asking if the subscriber has already subscribed.', 'convertkit' ), | |
| 118 | 172 | ), |
| 119 | 173 | ) |
| 120 | 174 | ); |
| 121 | 175 | |
| 122 | 176 | add_settings_field( |
| 177 | + 'email_heading', | |
| 178 | + __( 'Email Heading', 'convertkit' ), | |
| 179 | + array( $this, 'text_callback' ), | |
| 180 | + $this->settings_key, | |
| 181 | + $this->name, | |
| 182 | + array( | |
| 183 | + 'name' => 'email_heading', | |
| 184 | + 'label_for' => 'email_heading', | |
| 185 | + 'description' => array( | |
| 186 | + __( 'The heading to display above the email field, directing the subscriber to log in.', 'convertkit' ), | |
| 187 | + ), | |
| 188 | + ) | |
| 189 | + ); | |
| 190 | + | |
| 191 | + add_settings_field( | |
| 192 | + 'email_description_text', | |
| 193 | + __( 'Email Field Description', 'convertkit' ), | |
| 194 | + array( $this, 'text_callback' ), | |
| 195 | + $this->settings_key, | |
| 196 | + $this->name, | |
| 197 | + array( | |
| 198 | + 'name' => 'email_description_text', | |
| 199 | + 'label_for' => 'email_description_text', | |
| 200 | + 'description' => array( | |
| 201 | + __( 'The text to display below the email field, explaining the subscriber will receive a code by email.', 'convertkit' ), | |
| 202 | + ), | |
| 203 | + ) | |
| 204 | + ); | |
| 205 | + | |
| 206 | + add_settings_field( | |
| 123 | 207 | 'email_button_label', |
| 124 | 208 | __( 'Email Button Label', 'convertkit' ), |
| 125 | 209 | array( $this, 'text_callback' ), |
| 126 | 210 | $this->settings_key, |
| @@ -126,15 +210,31 @@ | ||
| 126 | 210 | $this->settings_key, |
| 127 | 211 | $this->name, |
| 128 | 212 | array( |
| 129 | 213 | 'name' => 'email_button_label', |
| 214 | + 'label_for' => 'email_button_label', | |
| 130 | 215 | 'description' => array( |
| 131 | - __( 'The text to display for the button to submit the subscriber\'s email address and receive a login link to access the member only content.', 'convertkit' ), | |
| 216 | + __( 'The text to display for the button to submit the subscriber\'s email address and receive a login link to access the member-only content.', 'convertkit' ), | |
| 132 | 217 | ), |
| 133 | 218 | ) |
| 134 | 219 | ); |
| 135 | 220 | |
| 136 | 221 | add_settings_field( |
| 222 | + 'email_check_heading', | |
| 223 | + __( 'Email Check Heading', 'convertkit' ), | |
| 224 | + array( $this, 'text_callback' ), | |
| 225 | + $this->settings_key, | |
| 226 | + $this->name, | |
| 227 | + array( | |
| 228 | + 'name' => 'email_check_heading', | |
| 229 | + 'label_for' => 'email_check_heading', | |
| 230 | + 'description' => array( | |
| 231 | + __( 'The heading to display telling the subscriber an email with a log in code was just sent.', 'convertkit' ), | |
| 232 | + ), | |
| 233 | + ) | |
| 234 | + ); | |
| 235 | + | |
| 236 | + add_settings_field( | |
| 137 | 237 | 'email_check_text', |
| 138 | 238 | __( 'Email Check Text', 'convertkit' ), |
| 139 | 239 | array( $this, 'text_callback' ), |
| 140 | 240 | $this->settings_key, |
| @@ -140,8 +240,9 @@ | ||
| 140 | 240 | $this->settings_key, |
| 141 | 241 | $this->name, |
| 142 | 242 | array( |
| 143 | 243 | 'name' => 'email_check_text', |
| 244 | + 'label_for' => 'email_check_text', | |
| 144 | 245 | 'description' => array( |
| 145 | 246 | __( 'The text to display instructing the subscriber to check their email for the login link that was sent.', 'convertkit' ), |
| 146 | 247 | ), |
| 147 | 248 | ) |
| @@ -154,10 +255,11 @@ | ||
| 154 | 255 | $this->settings_key, |
| 155 | 256 | $this->name, |
| 156 | 257 | array( |
| 157 | 258 | 'name' => 'no_access_text', |
| 259 | + 'label_for' => 'no_access_text', | |
| 158 | 260 | 'description' => array( |
| 159 | - __( 'The text to display for a subscriber who authenticates via the login link, but does not have access to the product.', 'convertkit' ), | |
| 261 | + __( 'The text to display for a subscriber who authenticates via the login link, but is not subscribed.', 'convertkit' ), | |
| 160 | 262 | ), |
| 161 | 263 | ) |
| 162 | 264 | ); |
| 163 | 265 | |
| @@ -170,9 +272,9 @@ | ||
| 170 | 272 | */ |
| 171 | 273 | public function print_section_info() { |
| 172 | 274 | |
| 173 | 275 | ?> |
| 174 | - <p class="description"><?php esc_html_e( 'Defines the text and button labels to display when a Page, Post or Custom Post has its Member Content setting set to a Product, and the visitor has not authenticated/subscribed.', 'convertkit' ); ?></p> | |
| 276 | + <p class="description"><?php esc_html_e( 'Defines the text and button labels to display when a Page, Post or Custom Post has its Member Content setting defined.', 'convertkit' ); ?></p> | |
| 175 | 277 | <div class="notice notice-warning"> |
| 176 | 278 | <p> |
| 177 | 279 | <?php |
| 178 | 280 | printf( |
| @@ -204,19 +306,20 @@ | ||
| 204 | 306 | |
| 205 | 307 | /** |
| 206 | 308 | * Renders the input for the Enable setting. |
| 207 | 309 | * |
| 208 | - * @since 2.1.0 | |
| 310 | + * @since 2.4.1 | |
| 209 | 311 | * |
| 210 | 312 | * @param array $args Setting field arguments (name,description). |
| 211 | 313 | */ |
| 212 | - public function enable_callback( $args ) { | |
| 314 | + public function permit_crawlers_callback( $args ) { | |
| 213 | 315 | |
| 214 | 316 | // Output field. |
| 215 | 317 | echo $this->get_checkbox_field( // phpcs:ignore WordPress.Security.EscapeOutput |
| 216 | 318 | $args['name'], |
| 217 | 319 | 'on', |
| 218 | - $this->settings->enabled(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 320 | + $this->settings->permit_crawlers(), // phpcs:ignore WordPress.Security.EscapeOutput | |
| 321 | + $args['label'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 219 | 322 | $args['description'] // phpcs:ignore WordPress.Security.EscapeOutput |
| 220 | 323 | ); |
| 221 | 324 | |
| 222 | 325 | } |
| @@ -236,9 +339,29 @@ | ||
| 236 | 339 | esc_attr( $this->settings->get_by_key( $args['name'] ) ), |
| 237 | 340 | $args['description'], // phpcs:ignore WordPress.Security.EscapeOutput |
| 238 | 341 | array( |
| 239 | 342 | 'widefat', |
| 240 | - 'enabled', | |
| 343 | + ) | |
| 344 | + ); | |
| 345 | + | |
| 346 | + } | |
| 347 | + | |
| 348 | + /** | |
| 349 | + * Renders the input for the textarea setting. | |
| 350 | + * | |
| 351 | + * @since 2.3.5 | |
| 352 | + * | |
| 353 | + * @param array $args Setting field arguments (name,description). | |
| 354 | + */ | |
| 355 | + public function textarea_callback( $args ) { | |
| 356 | + | |
| 357 | + // Output field. | |
| 358 | + echo $this->get_textarea_field( // phpcs:ignore WordPress.Security.EscapeOutput | |
| 359 | + $args['name'], | |
| 360 | + esc_attr( $this->settings->get_by_key( $args['name'] ) ), | |
| 361 | + $args['description'], // phpcs:ignore WordPress.Security.EscapeOutput | |
| 362 | + array( | |
| 363 | + 'widefat', | |
| 241 | 364 | ) |
| 242 | 365 | ); |
| 243 | 366 | |
| 244 | 367 | } |