array( 'name' => 'California', 'law' => 'California Consumer Privacy Act (CCPA/CPRA)', 'effective' => '2020-01-01', 'gpc' => true, 'appeal' => false, ), 'US-VA' => array( 'name' => 'Virginia', 'law' => 'Virginia Consumer Data Protection Act', 'effective' => '2023-01-01', 'gpc' => null, 'appeal' => true, ), 'US-CO' => array( 'name' => 'Colorado', 'law' => 'Colorado Privacy Act', 'effective' => '2023-07-01', 'gpc' => true, 'appeal' => true, ), 'US-CT' => array( 'name' => 'Connecticut', 'law' => 'Connecticut Data Privacy Act', 'effective' => '2023-07-01', 'gpc' => true, 'appeal' => true, ), 'US-UT' => array( 'name' => 'Utah', 'law' => 'Utah Consumer Privacy Act', 'effective' => '2023-12-31', 'gpc' => null, 'appeal' => false, ), 'US-TX' => array( 'name' => 'Texas', 'law' => 'Texas Data Privacy and Security Act', 'effective' => '2024-07-01', 'gpc' => true, 'appeal' => true, ), 'US-OR' => array( 'name' => 'Oregon', 'law' => 'Oregon Consumer Privacy Act', 'effective' => '2024-07-01', 'gpc' => true, 'appeal' => true, ), 'US-FL' => array( 'name' => 'Florida', 'law' => 'Florida Digital Bill of Rights', 'effective' => '2024-07-01', 'gpc' => null, 'appeal' => null, ), 'US-MT' => array( 'name' => 'Montana', 'law' => 'Montana Consumer Data Privacy Act', 'effective' => '2024-10-01', 'gpc' => true, 'appeal' => true, ), 'US-IA' => array( 'name' => 'Iowa', 'law' => 'Iowa Consumer Data Protection Act', 'effective' => '2025-01-01', 'gpc' => null, 'appeal' => true, ), 'US-DE' => array( 'name' => 'Delaware', 'law' => 'Delaware Personal Data Privacy Act', 'effective' => '2025-01-01', 'gpc' => true, 'appeal' => true, ), 'US-NE' => array( 'name' => 'Nebraska', 'law' => 'Nebraska Data Privacy Act', 'effective' => '2025-01-01', 'gpc' => null, 'appeal' => true, ), 'US-NH' => array( 'name' => 'New Hampshire', 'law' => 'New Hampshire Privacy Act', 'effective' => '2025-01-01', 'gpc' => true, 'appeal' => true, ), 'US-NJ' => array( 'name' => 'New Jersey', 'law' => 'New Jersey Data Privacy Act', 'effective' => '2025-01-15', 'gpc' => true, 'appeal' => true, ), 'US-TN' => array( 'name' => 'Tennessee', 'law' => 'Tennessee Information Protection Act', 'effective' => '2025-07-01', 'gpc' => null, 'appeal' => true, ), 'US-MN' => array( 'name' => 'Minnesota', 'law' => 'Minnesota Consumer Data Privacy Act', 'effective' => '2025-07-31', 'gpc' => true, 'appeal' => true, ), 'US-MD' => array( 'name' => 'Maryland', 'law' => 'Maryland Online Data Privacy Act', 'effective' => '2025-10-01', 'gpc' => true, 'appeal' => true, ), 'US-IN' => array( 'name' => 'Indiana', 'law' => 'Indiana Consumer Data Protection Act', 'effective' => '2026-01-01', 'gpc' => null, 'appeal' => true, ), 'US-KY' => array( 'name' => 'Kentucky', 'law' => 'Kentucky Consumer Data Protection Act', 'effective' => '2026-01-01', 'gpc' => null, 'appeal' => true, ), 'US-RI' => array( 'name' => 'Rhode Island', 'law' => 'Rhode Island Data Transparency and Privacy Protection Act', 'effective' => '2026-01-01', 'gpc' => null, 'appeal' => true, ), // Enacted 2026; details not yet confirmed by RoxxiStudios. 'US-AL' => array( 'name' => 'Alabama', 'law' => null, 'effective' => null, 'gpc' => null, 'appeal' => null, 'verify' => true, ), 'US-LA' => array( 'name' => 'Louisiana', 'law' => null, 'effective' => null, 'gpc' => null, 'appeal' => null, 'verify' => true, ), 'US-OK' => array( 'name' => 'Oklahoma', 'law' => null, 'effective' => null, 'gpc' => null, 'appeal' => null, 'verify' => true, ), 'US-VT' => array( 'name' => 'Vermont', 'law' => null, 'effective' => null, 'gpc' => null, 'appeal' => null, 'verify' => true, ), ); $intl = array( 'EU' => array( 'name' => 'European Union / EEA', 'law' => 'GDPR + ePrivacy Directive', 'effective' => '2018-05-25', 'gpc' => null, 'appeal' => false, 'optin' => true, ), 'UK' => array( 'name' => 'United Kingdom', 'law' => 'UK GDPR + PECR', 'effective' => '2021-01-01', 'gpc' => null, 'appeal' => false, 'optin' => true, ), 'CA' => array( 'name' => 'Canada', 'law' => 'PIPEDA (and Quebec Law 25)', 'effective' => '2023-09-22', 'gpc' => null, 'appeal' => false, ), ); /** * Filter the jurisdiction rules. * * @param array $rules Rules grouped as us / intl. */ return apply_filters( 'goconsent_law_rules', array( 'us' => $us, 'intl' => $intl, ) ); } /** * All 50 states + DC. * * @return array */ public static function us_states() { return array( 'AL' => 'Alabama', 'AK' => 'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', 'DC' => 'District of Columbia', 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming', ); } /** * Rule for a location code ('US-MT', 'EU', ...), or null. * * @param string $code Location code. * @return array|null */ public static function rule_for( $code ) { $cat = Catalog::states(); if ( isset( $cat[ $code ] ) ) { $c = $cat[ $code ]; return array( 'name' => $c['name'], 'law' => $c['effective'] > gmdate( 'Y-m-d' ) ? sprintf( /* translators: 1: law, 2: date. */ __( '%1$s (from %2$s)', 'goconsent' ), $c['law'], $c['effective'] ) : $c['law'], 'effective' => $c['effective'], 'gpc' => (bool) $c['gpc'], 'appeal' => $c['appeal'], ); } $rules = self::all(); if ( isset( $rules['us'][ $code ] ) ) { return $rules['us'][ $code ]; } return isset( $rules['intl'][ $code ] ) ? $rules['intl'][ $code ] : null; } /** * Validate a location code. * * @param mixed $value Raw value. * @return string */ public static function sanitize_location( $value ) { $v = strtoupper( sanitize_text_field( (string) $value ) ); if ( in_array( $v, array( 'EU', 'UK', 'CA', 'OTHER' ), true ) ) { return $v; } if ( preg_match( '/^US-([A-Z]{2})$/', $v, $m ) && isset( self::us_states()[ $m[1] ] ) ) { return $v; } return ''; } /** * Human label for a location code. * * @param string $code Location code. * @return string */ public static function label( $code ) { if ( 0 === strpos( (string) $code, 'US-' ) ) { $states = self::us_states(); $st = substr( $code, 3 ); return isset( $states[ $st ] ) ? $states[ $st ] : ''; } $map = array( 'EU' => __( 'European Union / EEA', 'goconsent' ), 'UK' => __( 'United Kingdom', 'goconsent' ), 'CA' => __( 'Canada', 'goconsent' ), 'OTHER' => __( 'Other country', 'goconsent' ), ); return isset( $map[ $code ] ) ? $map[ $code ] : ''; } /** * Regulator to name in appeal wording. * * @param string $code Location code. * @return string */ public static function regulator( $code ) { if ( 0 === strpos( (string) $code, 'US-' ) ) { /* translators: %s: US state name. */ return sprintf( __( 'the %s Attorney General', 'goconsent' ), self::label( $code ) ); } return __( 'your local data protection authority', 'goconsent' ); } }