/**
 * 全站通用 CF7 反垃圾询盘过滤 (2026-09-12, 与 leon-form-viewer spamguard 互补)
 * spamguard 只拦带 http(s) scheme 的外链;本过滤补:西里尔字母/重复字段/裸域名关键词靠 disallowed_keys。
 * 判 spam 后 CF7 不发邮件、不入库 cfdb7,portal 也拉不到。
 */
add_filter( 'wpcf7_spam', 'cf7_site_antispam', 20, 2 );
function cf7_site_antispam( $spam, $submission ) {
	if ( $spam ) {
		return $spam;
	}
	$data = $submission->get_posted_data();
	if ( ! is_array( $data ) ) {
		return $spam;
	}
	$texts = array();
	foreach ( $data as $k => $v ) {
		if ( ! is_string( $k ) ) {
			continue;
		}
		if ( in_array( $k, array( 'cfdb7_status', 'submit', 'cf-turnstile-response', 'g-recaptcha-response' ), true ) ) {
			continue;
		}
		foreach ( array( '_wpcf7', '_leon_', 'cfdb7_' ) as $pfx ) {
			if ( strncmp( $k, $pfx, strlen( $pfx ) ) === 0 ) {
				continue 2;
			}
		}
		$texts[ $k ] = is_array( $v ) ? implode( "\n", $v ) : (string) $v;
	}
	$all = implode( "\n", $texts );
	$reason = '';
	if ( preg_match( '/[\x{0400}-\x{04FF}]/u', $all ) ) {
		// 灯具 B2B 询盘不会出现俄语
		$reason = 'Cyrillic (site-antispam)';
	} else {
		// bot 特征:两个不同字段内容完全相同(排除邮箱确认栏)
		$vals = array_values( array_filter( array_map( 'trim', $texts ) ) );
		$n = count( $vals );
		for ( $i = 0; $i < $n && '' === $reason; $i++ ) {
			for ( $j = $i + 1; $j < $n; $j++ ) {
				if ( strlen( $vals[ $i ] ) >= 20 && strtolower( $vals[ $i ] ) === strtolower( $vals[ $j ] ) && strpos( $vals[ $i ], '@' ) === false ) {
					$reason = 'Duplicate fields (site-antispam)';
					break;
				}
			}
		}
	}
	if ( '' === $reason ) {
		$links = preg_match_all( '#https?://|www\.#i', $all, $m );
		$mail_ru = preg_match( '/@(?:rambler|mail|bk|inbox|list|yandex)\.ru\b/i', $all );
		if ( $links > 2 ) {
			$reason = 'Too many links (site-antispam)';
		} elseif ( $links > 0 && $mail_ru ) {
			$reason = 'RU freemail with link (site-antispam)';
		}
	}
	if ( '' !== $reason ) {
		$submission->add_spam_log( array( 'agent' => 'site-antispam', 'reason' => $reason ) );
		return true;
	}
	return $spam;
}
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//www.lampscreative.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://www.lampscreative.com/post-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:47+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/page-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:47+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/product-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:45+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/category-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:47+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/post_tag-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:47+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/product_cat-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:45+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/product_tag-sitemap.xml</loc>
		<lastmod>2026-08-09T07:12:45+00:00</lastmod>
	</sitemap>
	<sitemap>
		<loc>https://www.lampscreative.com/author-sitemap.xml</loc>
		<lastmod>2025-02-16T05:43:24+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->