// ===== PHASE 3 BLOCKING RULES ===== /** * Get ad category blocking rules by topic */ function hnf_get_ad_category_rules() { return array( 'health' => array( 'allowed' => array('health-news', 'medical-advice', 'wellness'), 'blocked' => array('unsafe-remedies', 'unproven-treatments', 'medical-scams'), 'explanation' => 'Health articles - block unproven medical claims' ), 'finance' => array( 'allowed' => array('financial-services', 'news', 'investment-advice'), 'blocked' => array('penny-stocks', 'day-trading', 'forex-scams', 'get-rich-quick'), 'explanation' => 'Financial articles - block risky schemes' ), 'politics' => array( 'allowed' => array('political-news', 'government', 'policy'), 'blocked' => array('political-betting', 'controversial-campaigns'), 'explanation' => 'Political content - block betting/propaganda' ), 'sports' => array( 'allowed' => array('sports-news', 'game-results', 'athlete-profiles'), 'blocked' => array('sports-betting', 'gambling'), 'explanation' => 'Sports articles - block betting ads' ), 'dating' => array( 'allowed' => array('relationship-advice', 'dating-tips'), 'blocked' => array('dating-scams', 'romance-fraud'), 'explanation' => 'Dating content - block romance scams' ), 'crypto' => array( 'allowed' => array('blockchain-news', 'crypto-education'), 'blocked' => array('pump-and-dump', 'rug-pulls', 'crypto-scams'), 'explanation' => 'Crypto articles - block fraud schemes' ), 'abortion' => array( 'allowed' => array('healthcare', 'legal-news'), 'blocked' => array('abortion-pills-illegal', 'unregulated-procedures'), 'explanation' => 'Abortion-related - block unsafe/illegal services' ), 'pregnancy' => array( 'allowed' => array('prenatal-care', 'pregnancy-health', 'maternity'), 'blocked' => array('unsafe-pregnancy-treatments', 'fetal-scams'), 'explanation' => 'Pregnancy content - block unsafe remedies' ) ); } /** * Check if ad is safe for topic */ function hnf_is_ad_safe_for_topic( $topic, $ad_category ) { $rules = hnf_get_ad_category_rules(); $topic_rules = $rules[ $topic ]; if ( ! $topic_rules ) { return true; // No rules = allow } // Check if ad is in blocked list if ( in_array( $ad_category, $topic_rules['blocked'] ) ) { error_log( "[HNF Phase 3] BLOCKED ad category '$ad_category' for topic '$topic': " . $topic_rules['explanation'] ); return false; } return true; } // ===== END PHASE 3 BLOCKING ===== ?>