← All changes
|
includes/class-convertkit-settings-restrict-content.php
+134
-7
2.3.2
→
2.7.4
View file →
| @@ -64,8 +64,113 @@ | ||
| 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 | + /** | |
| 81 | + * Returns whether login by email is required for Member Content by Tag functionality. | |
| 82 | + * | |
| 83 | + * @since 2.7.2 | |
| 84 | + * | |
| 85 | + * @return bool | |
| 86 | + */ | |
| 87 | + public function require_tag_login() { | |
| 88 | + | |
| 89 | + return ( $this->settings['require_tag_login'] === 'on' ? true : false ); | |
| 90 | + | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * Returns the reCAPTCHA Site Key Plugin setting. | |
| 95 | + * | |
| 96 | + * @since 2.6.8 | |
| 97 | + * | |
| 98 | + * @return string | |
| 99 | + */ | |
| 100 | + public function get_recaptcha_site_key() { | |
| 101 | + | |
| 102 | + return $this->settings['recaptcha_site_key']; | |
| 103 | + | |
| 104 | + } | |
| 105 | + | |
| 106 | + /** | |
| 107 | + * Returns whether the reCAPTCHA Site Key has been set in the Plugin settings. | |
| 108 | + * | |
| 109 | + * @since 2.6.8 | |
| 110 | + * | |
| 111 | + * @return bool | |
| 112 | + */ | |
| 113 | + public function has_recaptcha_site_key() { | |
| 114 | + | |
| 115 | + return ! empty( $this->get_recaptcha_site_key() ); | |
| 116 | + | |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * Returns the reCAPTCHA Secret Key Plugin setting. | |
| 121 | + * | |
| 122 | + * @since 2.6.8 | |
| 123 | + * | |
| 124 | + * @return string | |
| 125 | + */ | |
| 126 | + public function get_recaptcha_secret_key() { | |
| 127 | + | |
| 128 | + return $this->settings['recaptcha_secret_key']; | |
| 129 | + | |
| 130 | + } | |
| 131 | + | |
| 132 | + /** | |
| 133 | + * Returns whether the reCAPTCHA Secret Key has been set in the Plugin settings. | |
| 134 | + * | |
| 135 | + * @since 2.6.8 | |
| 136 | + * | |
| 137 | + * @return bool | |
| 138 | + */ | |
| 139 | + public function has_recaptcha_secret_key() { | |
| 140 | + | |
| 141 | + return ! empty( $this->get_recaptcha_secret_key() ); | |
| 142 | + | |
| 143 | + } | |
| 144 | + | |
| 145 | + /** | |
| 146 | + * Returns whether the reCAPTCH Site Key and Secret Key are defined | |
| 147 | + * in the Plugin settings. | |
| 148 | + * | |
| 149 | + * @since 2.6.8 | |
| 150 | + * | |
| 151 | + * @return bool | |
| 152 | + */ | |
| 153 | + public function has_recaptcha_site_and_secret_keys() { | |
| 154 | + | |
| 155 | + return $this->get_recaptcha_site_key() && $this->has_recaptcha_secret_key(); | |
| 156 | + | |
| 157 | + } | |
| 158 | + | |
| 159 | + /** | |
| 160 | + * Returns the reCAPTCHA minimum score Plugin setting. | |
| 161 | + * | |
| 162 | + * @since 2.6.8 | |
| 163 | + * | |
| 164 | + * @return float | |
| 165 | + */ | |
| 166 | + public function get_recaptcha_minimum_score() { | |
| 167 | + | |
| 168 | + return (float) $this->settings['recaptcha_minimum_score']; | |
| 169 | + | |
| 170 | + } | |
| 171 | + | |
| 172 | + /** | |
| 68 | 173 | * Returns Restrict Content settings value for the given key. |
| 69 | 174 | * |
| 70 | 175 | * @since 2.1.0 |
| 71 | 176 | * |
| @@ -99,14 +204,36 @@ | ||
| 99 | 204 | */ |
| 100 | 205 | public function get_defaults() { |
| 101 | 206 | |
| 102 | 207 | $defaults = array( |
| 103 | - 'subscribe_text' => __( 'This content is only available to premium subscribers', 'convertkit' ), | |
| 104 | - 'subscribe_button_label' => __( 'Subscribe', 'convertkit' ), | |
| 105 | - 'email_text' => __( 'Already a premium subscriber? Enter the email address used when purchasing below, to receive a login link to access.', 'convertkit' ), | |
| 106 | - 'email_button_label' => __( 'Send email', 'convertkit' ), | |
| 107 | - 'email_check_text' => __( 'Check your email and click the link to login, or enter the code from the email below.', 'convertkit' ), | |
| 108 | - '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' ), | |
| 208 | + // Permit Crawlers. | |
| 209 | + 'permit_crawlers' => '', | |
| 210 | + | |
| 211 | + // Restrict by Form. | |
| 212 | + 'no_access_text_form' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ), | |
| 213 | + | |
| 214 | + // Restrict by Product. | |
| 215 | + 'subscribe_heading' => __( 'Read this post with a premium subscription', 'convertkit' ), | |
| 216 | + 'subscribe_text' => __( 'This post is only available to premium subscribers. Join today to get access to all posts.', 'convertkit' ), | |
| 217 | + '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' ), | |
| 218 | + | |
| 219 | + // Restrict by Tag. | |
| 220 | + 'subscribe_heading_tag' => __( 'Subscribe to keep reading', 'convertkit' ), | |
| 221 | + 'subscribe_text_tag' => __( 'This post is free to read but only available to subscribers. Join today to get access to all posts.', 'convertkit' ), | |
| 222 | + 'require_tag_login' => '', // blank|on. | |
| 223 | + 'recaptcha_site_key' => '', | |
| 224 | + 'recaptcha_secret_key' => '', | |
| 225 | + 'recaptcha_minimum_score' => '0.5', | |
| 226 | + 'no_access_text_tag' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ), | |
| 227 | + | |
| 228 | + // All. | |
| 229 | + 'subscribe_button_label' => __( 'Subscribe', 'convertkit' ), | |
| 230 | + 'email_text' => __( 'Already subscribed?', 'convertkit' ), | |
| 231 | + 'email_button_label' => __( 'Log in', 'convertkit' ), | |
| 232 | + 'email_heading' => __( 'Log in to read this post', 'convertkit' ), | |
| 233 | + 'email_description_text' => __( 'We\'ll email you a magic code to log you in without a password.', 'convertkit' ), | |
| 234 | + 'email_check_heading' => __( 'We just emailed you a log in code', 'convertkit' ), | |
| 235 | + 'email_check_text' => __( 'Enter the code below to finish logging in', 'convertkit' ), | |
| 109 | 236 | ); |
| 110 | 237 | |
| 111 | 238 | /** |
| 112 | 239 | * The default settings, used when the ConvertKit Restrict Content Settings haven't been saved |
| @@ -113,9 +240,9 @@ | ||
| 113 | 240 | * e.g. on a new installation. |
| 114 | 241 | * |
| 115 | 242 | * @since 2.1.0 |
| 116 | 243 | * |
| 117 | - * @param array $defaults | |
| 244 | + * @param array $defaults Default settings. | |
| 118 | 245 | */ |
| 119 | 246 | $defaults = apply_filters( 'convertkit_settings_restrict_content_get_defaults', $defaults ); |
| 120 | 247 | |
| 121 | 248 | return $defaults; |