HEX
Server: Apache
System: Linux p3plzcpnl503801.prod.phx3.secureserver.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User: aqo14e2iyyd9 (9667755)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/aqo14e2iyyd9/public_html/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 );
	}
}