HEX
Server: Apache/2
System: Linux bq-e705.pointdnshere.com 4.18.0-513.11.1.el8_9.x86_64 #1 SMP Wed Jan 17 02:00:40 EST 2024 x86_64
User: wellmix (1103)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/wellmix/public_html/wp-content/plugins/weglot/src/helpers/class-helper-json-inline-weglot.php
<?php

namespace WeglotWP\Helpers;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}


/**
 *
 * @since 2.0
 */
abstract class Helper_Json_Inline_Weglot {

	/**
	 * @since 2.3.0
	 *
	 * @param string $string
	 * @return boolean
	 */
	public static function is_json( $string ) {
		return is_string( $string ) && is_array( \json_decode( $string, true ) ) && ( JSON_ERROR_NONE === \json_last_error() ) ? true : false;
	}

	/**
	 * @since 2.3.0
	 *
	 * @param string $string
	 * @return boolean
	 */
	public static function is_xml( $string ) {
		return is_string( $string ) && simplexml_load_string( $string, "SimpleXMLElement", LIBXML_NOERROR ) ? true : false;
	}
}