prefix; } /** * Resolves table name with or without WP prefix. * Default: without prefix. */ private static function resolve( string $table, bool $with_prefix = false ): string { return $with_prefix ? self::prefix() . $table : $table; } // --- Table Methods --- public static function ADFUZ_ADS( bool $with_prefix = false ): string { return self::resolve( 'adfuz_ads', $with_prefix ); } public static function ADFUZ_ADS_META( bool $with_prefix = false ): string { return self::resolve( 'adfuz_ads_meta', $with_prefix ); } public static function ADFUZ_AD_SPACES( bool $with_prefix = false ): string { return self::resolve( 'adfuz_ad_spaces', $with_prefix ); } public static function ADFUZ_AD_SPACES_META( bool $with_prefix = false ): string { return self::resolve( 'adfuz_ad_spaces_meta', $with_prefix ); } public static function ADFUZ_CAMPAIGNS( bool $with_prefix = false ): string { return self::resolve( 'adfuz_campaigns', $with_prefix ); } public static function ADFUZ_CAMPAIGN_ADS( bool $with_prefix = false ): string { return self::resolve( 'adfuz_campaign_ads', $with_prefix ); } public static function ADFUZ_CAMPAIGN_AD_SPACES( bool $with_prefix = false ): string { return self::resolve( 'adfuz_campaign_ad_spaces', $with_prefix ); } public static function ADFUZ_CAMPAIGNS_META( bool $with_prefix = false ): string { return self::resolve( 'adfuz_campaigns_meta', $with_prefix ); } public static function ADFUZ_AUDIT_LOGS( bool $with_prefix = false ): string { return self::resolve( 'adfuz_audit_logs', $with_prefix ); } public static function ADFUZ_AUDIT_LOGS_META( bool $with_prefix = false ): string { return self::resolve( 'adfuz_audit_logs_meta', $with_prefix ); } public static function adfuz_definitions( bool $with_prefix = true ) { $definitions = array( // Ads array( 'table' => self::ADFUZ_ADS( $with_prefix ), 'group' => 'Ads', 'description' => 'Core ad records', ), array( 'table' => self::ADFUZ_ADS_META( $with_prefix ), 'group' => 'Ads', 'description' => 'Ad metadata', ), // Ad Spaces array( 'table' => self::ADFUZ_AD_SPACES( $with_prefix ), 'group' => 'Ad Spaces', 'description' => 'Ad placement zones', ), array( 'table' => self::ADFUZ_AD_SPACES_META( $with_prefix ), 'group' => 'Ad Spaces', 'description' => 'Ad space metadata', ), // Campaigns array( 'table' => self::ADFUZ_CAMPAIGNS( $with_prefix ), 'group' => 'Campaigns', 'description' => 'Campaign definitions', ), array( 'table' => self::ADFUZ_CAMPAIGNS_META( $with_prefix ), 'group' => 'Campaigns', 'description' => 'Campaign metadata', ), array( 'table' => self::ADFUZ_CAMPAIGN_ADS( $with_prefix ), 'group' => 'Campaigns', 'description' => 'Campaign → Ad mapping', ), array( 'table' => self::ADFUZ_CAMPAIGN_AD_SPACES( $with_prefix ), 'group' => 'Campaigns', 'description' => 'Campaign → Ad Space mapping', ), // Audit array( 'table' => self::ADFUZ_AUDIT_LOGS( $with_prefix ), 'group' => 'Audit & Stats', 'description' => 'Activity audit trail', ), array( 'table' => self::ADFUZ_AUDIT_LOGS_META( $with_prefix ), 'group' => 'Audit & Stats', 'description' => 'Audit log metadata', ), ); return $definitions; } /** * Get ALL tables as array. * Pass true to include WP prefix. */ public static function definitions( bool $with_prefix = true ): array { return apply_filters( 'adfuz/table_name/definitions', self::adfuz_definitions( $with_prefix ), $with_prefix ); } /** * Returns a flat array of table names (existing behaviour preserved). * Now delegates to definitions() — no duplication. */ public static function all( bool $with_prefix = false ): array { return array_column( self::definitions( $with_prefix ), 'table' ); } }