@@ -206,70 +206,6 @@ function ct_woocommerce_wishlist_check($args)
206206 return $ args ;
207207}
208208
209-
210- /**
211- * Test default search string for spam
212- *
213- * @param $search string
214- *
215- * @return string
216- */
217- function apbct_forms__search__testSpam ($ search )
218- {
219- global $ apbct , $ cleantalk_executed ;
220-
221- if (
222- empty ($ search ) ||
223- $ cleantalk_executed ||
224- $ apbct ->settings ['forms__search_test ' ] == 0 ||
225- ($ apbct ->settings ['data__protect_logged_in ' ] != 1 && is_user_logged_in ()) // Skip processing for logged in users.
226- ) {
227- do_action ('apbct_skipped_request ' , __FILE__ . ' -> ' . __FUNCTION__ . '(): ' . __LINE__ , $ _POST );
228-
229- return $ search ;
230- }
231-
232- $ user = apbct_is_user_logged_in () ? wp_get_current_user () : null ;
233-
234- $ base_call_result = apbct_base_call (
235- array (
236- 'message ' => $ search ,
237- 'sender_email ' => $ user !== null ? $ user ->user_email : null ,
238- 'sender_nickname ' => $ user !== null ? $ user ->user_login : null ,
239- 'post_info ' => array ('comment_type ' => 'site_search_wordpress ' ),
240- 'exception_action ' => 0 ,
241- )
242- );
243-
244- if ( isset ($ base_call_result ['ct_result ' ]) ) {
245- $ ct_result = $ base_call_result ['ct_result ' ];
246-
247- $ cleantalk_executed = true ;
248-
249- if ( $ ct_result ->allow == 0 ) {
250- die ($ ct_result ->comment );
251- }
252- }
253-
254- return $ search ;
255- }
256-
257- function apbct_search_add_noindex ()
258- {
259- global $ apbct ;
260-
261- if (
262- ! is_search () || // If it is search results
263- $ apbct ->settings ['forms__search_test ' ] == 0 ||
264- ($ apbct ->settings ['data__protect_logged_in ' ] != 1 && is_user_logged_in ()) // Skip processing for logged in users.
265- ) {
266- return ;
267- }
268-
269- echo '<!-- meta by CleanTalk Anti-Spam Protection plugin --> ' . "\n" ;
270- echo '<meta name="robots" content="noindex,nofollow" /> ' . "\n" ;
271- }
272-
273209/**
274210 * Public function - Tests for Pirate contact forms
275211 * return NULL
@@ -2729,6 +2665,7 @@ function apbct_form__gravityForms__addField($form_string, $form)
27292665 * Gravity forms anti-spam test.
27302666 * @return boolean
27312667 * @psalm-suppress UnusedVariable
2668+ * @psalm-suppress ArgumentTypeCoercion
27322669 */
27332670function apbct_form__gravityForms__testSpam ($ is_spam , $ form , $ entry )
27342671{
@@ -2861,7 +2798,12 @@ function apbct_form__gravityForms__testSpam($is_spam, $form, $entry)
28612798 $ is_spam = true ;
28622799 $ ct_gform_is_spam = true ;
28632800 $ ct_gform_response = $ ct_result ->comment ;
2864- add_action ('gform_entry_created ' , 'apbct_form__gravityForms__add_entry_note ' );
2801+ if ( isset ($ apbct ->settings ['forms__gravityforms_save_spam ' ]) && $ apbct ->settings ['forms__gravityforms_save_spam ' ] == 1 ) {
2802+ add_action ('gform_entry_created ' , 'apbct_form__gravityForms__add_entry_note ' );
2803+ } elseif ( class_exists ('GFFormsModel ' ) && method_exists ('GFFormsModel ' , 'delete_lead ' ) ) {
2804+ /** @psalm-suppress UndefinedClass */
2805+ GFFormsModel::delete_lead ($ entry ['id ' ]);
2806+ }
28652807 }
28662808 }
28672809
@@ -3440,53 +3382,6 @@ function apbct_form_happyforms_test_spam($is_valid, $request, $_form)
34403382 return $ is_valid ;
34413383}
34423384
3443- /**
3444- * Prepare data to add honeypot to the WordPress default search form.
3445- * Fires ct_add_honeypot_field() on hook get_search_form when:
3446- * - method of the form is post
3447- * - spam test of search form is enabled
3448- *
3449- * @param string $form_html
3450- * @return string
3451- */
3452- function apbct_form_search__add_fields ($ form_html )
3453- {
3454- global $ apbct ;
3455-
3456- if ( !empty ($ form_html ) && is_string ($ form_html ) && $ apbct ->settings ['forms__search_test ' ] == 1 ) {
3457- // extract method of the form with DOMDocument
3458- if ( class_exists ('DOMDocument ' ) ) {
3459- libxml_use_internal_errors (true );
3460- $ dom = new DOMDocument ();
3461- if ( @$ dom ->loadHTML ($ form_html ) ) {
3462- $ search_form_dom = $ dom ->getElementById ('searchform ' );
3463- if ( !empty ($ search_form_dom ) ) {
3464- $ method = empty ($ search_form_dom ->getAttribute ('method ' ))
3465- //default method is get for any form if no method specified
3466- ? 'get '
3467- : $ search_form_dom ->getAttribute ('method ' );
3468- }
3469- }
3470- libxml_clear_errors ();
3471- unset($ dom );
3472- }
3473-
3474- // retry extract method of the form with regex
3475- if ( empty ($ method ) ) {
3476- preg_match ('/form.*method="(.*?)"/ ' , $ form_html , $ matches );
3477- $ method = empty ($ matches [1 ])
3478- ? 'get '
3479- : trim ($ matches [1 ]);
3480- }
3481-
3482- $ form_method = strtolower ($ method );
3483-
3484- return str_replace ('</form> ' , Honeypot::generateHoneypotField ('search_form ' , $ form_method ) . '</form> ' , $ form_html );
3485- }
3486-
3487- return $ form_html ;
3488- }
3489-
34903385/**
34913386 * Advanced Classifieds & Directory Pro
34923387 *
0 commit comments