Add admin UI: setup wizard, goals, rules editor, donations, moderation, overlays, settings
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0b9e6e7cbb
commit
4efdef72f6
18 files changed
+2169
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
declare( strict_types=1 );
|
||||
|
||||
namespace StreamGoals\Admin;
|
||||
|
||||
/** CSV helpers. Guards against spreadsheet formula injection (=, +, -, @, tab, CR prefixes). */
|
||||
final class Csv {
|
||||
|
||||
public static function cell( mixed $v ): string {
|
||||
$s = is_scalar( $v ) || null === $v ? (string) $v : '';
|
||||
if ( '' !== $s && str_contains( "=+-@\t\r", $s[0] ) ) {
|
||||
return "'" . $s;
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
/** @return string[] */
|
||||
public static function row( array $cells ): array {
|
||||
return array_map( array( self::class, 'cell' ), array_values( $cells ) );
|
||||
}
|
||||
|
||||
/** Render one RFC-4180 line (no WordPress needed; used for tests and streaming). */
|
||||
public static function line( array $cells ): string {
|
||||
$out = array();
|
||||
foreach ( self::row( $cells ) as $c ) {
|
||||
$out[] = '"' . str_replace( '"', '""', $c ) . '"';
|
||||
}
|
||||
return implode( ',', $out ) . "\r\n";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user