\nRequire all denied\n\n" ); // phpcs:ignore WordPress.WP.AlternativeFunctions } foreach ( array( $root, $dir ) as $d ) { if ( ! file_exists( $d . '/index.html' ) ) { file_put_contents( $d . '/index.html', '' ); // phpcs:ignore WordPress.WP.AlternativeFunctions } } return $dir; } /** * New unguessable file name for an export. * * @param int $export_id Export id. * @return string */ public static function new_file_name( $export_id ) { return sprintf( 'recast-export-%d-%s.csv', (int) $export_id, wp_generate_password( 32, false ) ); } /** * Absolute path for a file name. * * @param string $file_name File name. * @return string */ public static function path( $file_name ) { return trailingslashit( self::dir() ) . basename( (string) $file_name ); } /** * Deletes a file. * * @param string|null $file_name File name. * @return void */ public static function delete( $file_name ) { if ( ! $file_name ) { return; } $path = self::path( $file_name ); if ( file_exists( $path ) ) { wp_delete_file( $path ); } } }