| @@ -7,9 +7,9 @@ | ||
| 7 | 7 | * Class FrmAntiSpam. |
| 8 | 8 | * |
| 9 | 9 | * This token class generates tokens that are used in our Anti-Spam checking. |
| 10 | 10 | * |
| 11 | - * @since 4.11 | |
| 11 | + * @since xx.xx | |
| 12 | 12 | */ |
| 13 | 13 | class FrmAntiSpam extends FrmValidate { |
| 14 | 14 | |
| 15 | 15 | /** |
| @@ -20,10 +20,8 @@ | ||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * @param int $form_id |
| 24 | - * | |
| 25 | - * @return void | |
| 26 | 24 | */ |
| 27 | 25 | public static function maybe_init( $form_id ) { |
| 28 | 26 | $antispam = new self( $form_id ); |
| 29 | 27 | if ( $antispam->run_antispam() ) { |
| @@ -33,11 +31,9 @@ | ||
| 33 | 31 | |
| 34 | 32 | /** |
| 35 | 33 | * Initialise the actions for the Anti-spam. |
| 36 | 34 | * |
| 37 | - * @since 4.11 | |
| 38 | - * | |
| 39 | - * @return void | |
| 35 | + * @since xx.xx | |
| 40 | 36 | */ |
| 41 | 37 | public function init() { |
| 42 | 38 | add_filter( 'frm_form_attributes', array( $this, 'add_token_to_form' ), 10, 1 ); |
| 43 | 39 | add_filter( 'frm_form_div_attributes', array( $this, 'add_token_to_form' ), 10, 1 ); |
| @@ -45,9 +41,9 @@ | ||
| 45 | 41 | |
| 46 | 42 | /** |
| 47 | 43 | * Return a valid token. |
| 48 | 44 | * |
| 49 | - * @since 4.11 | |
| 45 | + * @since xx.xx | |
| 50 | 46 | * |
| 51 | 47 | * @param mixed $current True to use current time, otherwise a timestamp string. |
| 52 | 48 | * |
| 53 | 49 | * @return string Token. |
| @@ -94,9 +90,9 @@ | ||
| 94 | 90 | * These two filters are available if a user wants to extend the times. |
| 95 | 91 | * 'frm_form_token_check_before_today' |
| 96 | 92 | * 'frm_form_token_check_after_today' |
| 97 | 93 | * |
| 98 | - * @since 4.11 | |
| 94 | + * @since xx.xx | |
| 99 | 95 | * |
| 100 | 96 | * @return array Array of all valid tokens to check against. |
| 101 | 97 | */ |
| 102 | 98 | private function get_valid_tokens() { |
| @@ -146,9 +142,9 @@ | ||
| 146 | 142 | * Tokens are valid for some period of time (see frm_token_validity_in_hours |
| 147 | 143 | * and frm_token_validity_in_days to extend the validation period). |
| 148 | 144 | * By default tokens are valid for day. |
| 149 | 145 | * |
| 150 | - * @since 4.11 | |
| 146 | + * @since xx.xx | |
| 151 | 147 | * |
| 152 | 148 | * @param string $token Token to validate. |
| 153 | 149 | * |
| 154 | 150 | * @return bool Whether the token is valid or not. |
| @@ -160,9 +156,9 @@ | ||
| 160 | 156 | |
| 161 | 157 | /** |
| 162 | 158 | * Add the token field to the form. |
| 163 | 159 | * |
| 164 | - * @since 4.11 | |
| 160 | + * @since xx.xx | |
| 165 | 161 | * |
| 166 | 162 | * @param string $attributes |
| 167 | 163 | * |
| 168 | 164 | * @return string |
| @@ -173,10 +169,8 @@ | ||
| 173 | 169 | } |
| 174 | 170 | |
| 175 | 171 | /** |
| 176 | 172 | * @param int $form_id |
| 177 | - * | |
| 178 | - * @return void | |
| 179 | 173 | */ |
| 180 | 174 | public static function maybe_echo_token( $form_id ) { |
| 181 | 175 | $antispam = new self( $form_id ); |
| 182 | 176 | if ( $antispam->run_antispam() ) { |
| @@ -193,9 +187,9 @@ | ||
| 193 | 187 | |
| 194 | 188 | /** |
| 195 | 189 | * Validate Anti-spam if enabled. |
| 196 | 190 | * |
| 197 | - * @since 4.11 | |
| 191 | + * @since xx.xx | |
| 198 | 192 | * |
| 199 | 193 | * @return bool|string True or a string with the error. |
| 200 | 194 | */ |
| 201 | 195 | public function validate() { |
| @@ -240,9 +234,9 @@ | ||
| 240 | 234 | |
| 241 | 235 | /** |
| 242 | 236 | * Helper to run our filter on all the responses for the antispam checks. |
| 243 | 237 | * |
| 244 | - * @since 4.11 | |
| 238 | + * @since xx.xx | |
| 245 | 239 | * |
| 246 | 240 | * @param bool|string $is_valid Is valid entry or not. |
| 247 | 241 | * |
| 248 | 242 | * @return bool|string Is valid or message. |
| @@ -253,9 +247,9 @@ | ||
| 253 | 247 | |
| 254 | 248 | /** |
| 255 | 249 | * Helper to get the missing token message. |
| 256 | 250 | * |
| 257 | - * @since 4.11 | |
| 251 | + * @since xx.xx | |
| 258 | 252 | * |
| 259 | 253 | * @return string missing token message. |
| 260 | 254 | */ |
| 261 | 255 | private function get_missing_token_message() { |
| @@ -264,9 +258,9 @@ | ||
| 264 | 258 | |
| 265 | 259 | /** |
| 266 | 260 | * Helper to get the invalid token message. |
| 267 | 261 | * |
| 268 | - * @since 4.11 | |
| 262 | + * @since xx.xx | |
| 269 | 263 | * |
| 270 | 264 | * @return string Invalid token message. |
| 271 | 265 | */ |
| 272 | 266 | private function get_invalid_token_message() { |
| @@ -275,9 +269,9 @@ | ||
| 275 | 269 | |
| 276 | 270 | /** |
| 277 | 271 | * If a user is a super admin, add a support link to the message. |
| 278 | 272 | * |
| 279 | - * @since 4.11 | |
| 273 | + * @since xx.xx | |
| 280 | 274 | * |
| 281 | 275 | * @return string Support text if super admin, empty string if not. |
| 282 | 276 | */ |
| 283 | 277 | private function maybe_get_support_text() { |
| @@ -298,10 +292,8 @@ | ||
| 298 | 292 | } |
| 299 | 293 | |
| 300 | 294 | /** |
| 301 | 295 | * Clear third party cache plugins to avoid data-tokens missing or appearing when the antispam setting is changed. |
| 302 | - * | |
| 303 | - * @return void | |
| 304 | 296 | */ |
| 305 | 297 | public static function clear_caches() { |
| 306 | 298 | self::clear_w3_total_cache(); |
| 307 | 299 | self::clear_wp_fastest_cache(); |
| @@ -308,11 +300,8 @@ | ||
| 308 | 300 | self::clear_wp_super_cache(); |
| 309 | 301 | self::clear_wp_optimize(); |
| 310 | 302 | } |
| 311 | 303 | |
| 312 | - /** | |
| 313 | - * @return void | |
| 314 | - */ | |
| 315 | 304 | private static function clear_w3_total_cache() { |
| 316 | 305 | if ( is_callable( 'w3tc_flush_all' ) ) { |
| 317 | 306 | w3tc_flush_all(); |
| 318 | 307 | } |
| @@ -317,18 +306,12 @@ | ||
| 317 | 306 | w3tc_flush_all(); |
| 318 | 307 | } |
| 319 | 308 | } |
| 320 | 309 | |
| 321 | - /** | |
| 322 | - * @return void | |
| 323 | - */ | |
| 324 | 310 | private static function clear_wp_fastest_cache() { |
| 325 | 311 | do_action( 'wpfc_clear_all_cache' ); |
| 326 | 312 | } |
| 327 | 313 | |
| 328 | - /** | |
| 329 | - * @return void | |
| 330 | - */ | |
| 331 | 314 | private static function clear_wp_super_cache() { |
| 332 | 315 | if ( function_exists( 'wp_cache_clean_cache' ) ) { |
| 333 | 316 | global $file_prefix; |
| 334 | 317 | wp_cache_clean_cache( $file_prefix, true ); |
| @@ -334,11 +317,8 @@ | ||
| 334 | 317 | wp_cache_clean_cache( $file_prefix, true ); |
| 335 | 318 | } |
| 336 | 319 | } |
| 337 | 320 | |
| 338 | - /** | |
| 339 | - * @return void | |
| 340 | - */ | |
| 341 | 321 | private static function clear_wp_optimize() { |
| 342 | 322 | if ( class_exists( 'WP_Optimize' ) ) { |
| 343 | 323 | WP_Optimize()->get_page_cache()->purge(); |
| 344 | 324 | } |