Heray-Was-Here
Server : Apache/2.4.52 (Debian)
System : Linux 1b21ca041b67 5.10.0-44-amd64 #1 SMP Debian 5.10.257-1 (2026-05-27) x86_64
User : www-data ( 33)
PHP Version : 7.4.28
Disable Function : NONE
Directory :  /var/www/html/wp-content/plugins/leadin/public/utils/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/html/wp-content/plugins/leadin/public/utils/class-requestutils.php
<?php

namespace Leadin\utils;

/**
 * Static class containing methods used on ajax requests handling.
 */
class RequestUtils {
	/**
	 * Send JSON response.
	 *
	 * @param Mixed  $body response to send as JSON.
	 * @param Number $code http code to return.
	 */
	private static function send( $body, $code ) {
		wp_send_json( $body, intval( $code ) );
	}

	/**
	 * Send JSON response with 200 code.
	 *
	 * @param Mixed $body response to send as JSON.
	 */
	public static function send_json( $body = array() ) {
		self::send( $body, 200 );
	}

	/**
	 * Send error response with message
	 *
	 * @param String $error Message to be sent on te JSON.
	 * @param Number $code  Error code to be sent in the error. Default 400.
	 */
	public static function send_error_message( $error, $code = 400 ) {
		self::send(
			array(
				'error' => $error,
			),
			intval( $code )
		);
	}

	/**
	 * Send JSON response with a message key.
	 *
	 * @param String $message Message to be sent on te JSON.
	 */
	public static function send_message( $message ) {
		self::send(
			array(
				'message' => $message,
			),
			200
		);
	}
}

Hry