← All changes
|
includes/class-convertkit-settings-restrict-content.php
+98
-17
3.3.2
→
2.8.6
View file →
| @@ -90,8 +90,87 @@ | ||
| 90 | 90 | |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 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 | + /** | |
| 94 | 173 | * Returns Restrict Content settings value for the given key. |
| 95 | 174 | * |
| 96 | 175 | * @since 2.1.0 |
| 97 | 176 | * |
| @@ -126,33 +205,35 @@ | ||
| 126 | 205 | public function get_defaults() { |
| 127 | 206 | |
| 128 | 207 | $defaults = array( |
| 129 | 208 | // Permit Crawlers. |
| 130 | - 'permit_crawlers' => '', | |
| 209 | + 'permit_crawlers' => '', | |
| 131 | 210 | |
| 132 | 211 | // Restrict by Form. |
| 133 | - 'no_access_text_form' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ), | |
| 212 | + 'no_access_text_form' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ), | |
| 134 | 213 | |
| 135 | 214 | // Restrict by Product. |
| 136 | - 'subscribe_heading' => __( 'Read this post with a premium subscription', 'convertkit' ), | |
| 137 | - 'subscribe_text' => __( 'This post is only available to premium subscribers. Join today to get access to all posts.', 'convertkit' ), | |
| 138 | - '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' ), | |
| 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' ), | |
| 139 | 218 | |
| 140 | 219 | // Restrict by Tag. |
| 141 | - 'subscribe_heading_tag' => __( 'Subscribe to keep reading', 'convertkit' ), | |
| 142 | - 'subscribe_text_tag' => __( 'This post is free to read but only available to subscribers. Join today to get access to all posts.', 'convertkit' ), | |
| 143 | - 'require_tag_login' => '', // blank|on. | |
| 144 | - 'no_access_text_tag' => __( 'Your account does not have access to this content. Please use the form above to subscribe.', 'convertkit' ), | |
| 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' ), | |
| 145 | 227 | |
| 146 | 228 | // All. |
| 147 | - 'subscribe_button_label' => __( 'Subscribe', 'convertkit' ), | |
| 148 | - 'email_text' => __( 'Already subscribed?', 'convertkit' ), | |
| 149 | - 'email_button_label' => __( 'Log in', 'convertkit' ), | |
| 150 | - 'email_heading' => __( 'Log in to read this post', 'convertkit' ), | |
| 151 | - 'email_description_text' => __( 'We\'ll email you a magic code to log you in without a password.', 'convertkit' ), | |
| 152 | - 'email_check_heading' => __( 'We just emailed you a log in code', 'convertkit' ), | |
| 153 | - 'email_check_text' => __( 'Enter the code below to finish logging in', 'convertkit' ), | |
| 154 | - 'container_css_classes' => '', | |
| 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' ), | |
| 155 | 236 | ); |
| 156 | 237 | |
| 157 | 238 | /** |
| 158 | 239 | * The default settings, used when the ConvertKit Restrict Content Settings haven't been saved |