HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/triad-infosec/wp-content/plugins/wpforms/src/Pro/Helpers/CSV.php
<?php

namespace WPForms\Pro\Helpers;

/**
 * CSV related helper methods.
 *
 * @since 1.7.7
 */
class CSV {

	/**
	 * Formulas start characters.
	 *
	 * @since 1.7.7
	 *
	 * @var array
	 */
	const FORMULAS_START_CHARS = [ '=', '-', '+', '@', "\t", "\r" ];

	/**
	 * Escape string for CSV.
	 *
	 * @since 1.7.7
	 *
	 * @param mixed $value Value to escape.
	 *
	 * @return string
	 */
	public function escape_value( $value ) {

		// Prevent formulas in spreadsheet applications.
		if ( in_array( substr( (string) $value, 0, 1 ), self::FORMULAS_START_CHARS, true ) ) {
			$value = "'" . $value;
		}

		return html_entity_decode( $value, ENT_QUOTES );
	}
}