| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www2/wp-content/plugins/amp/includes/utils/ |
Upload File : |
<?php
class AMP_HTML_Utils {
public static function build_tag( $tag_name, $attributes = array(), $content = '' ) {
$attr_string = self::build_attributes_string( $attributes );
return sprintf( '<%1$s %2$s>%3$s</%1$s>', sanitize_key( $tag_name ), $attr_string, $content );
}
public static function build_attributes_string( $attributes ) {
$string = array();
foreach ( $attributes as $name => $value ) {
if ( '' === $value ) {
$string[] = sprintf( '%s', sanitize_key( $name ) );
} else {
$string[] = sprintf( '%s="%s"', sanitize_key( $name ), esc_attr( $value ) );
}
}
return implode( ' ', $string );
}
public static function is_valid_json( $data ) {
if ( ! empty( $data ) ) {
$decoded = json_decode( $data );
if ( function_exists( 'json_last_error' ) ) {
return ( json_last_error() === JSON_ERROR_NONE );
} else { // PHP 5.2 back-compatibility
return null !== $decoded;
}
}
return false;
}
}