| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/INFRABIKEDE/wp-content/plugins/weglot/vendor/weglot/weglot-php/src/Util/ |
Upload File : |
<?php
namespace Weglot\Util;
/**
* Class Text
* @package Weglot\Parser\Util
*/
class Text {
/**
* @param string $word
*
* @return string
*/
public static function fullTrim( $word ) {
return trim( $word, " \t\n\r\0\x0B\xA0�" );
}
/**
* @param string $haystack
* @param string $search
*
* @return bool
*/
public static function contains( $haystack, $search ) {
return strpos( $haystack, $search ) !== false;
}
/**
* @param string $filename
*
* @return string
*/
public static function removeFileExtension( $filename ) {
$filename = !is_null( $filename ) ? $filename : '';
return preg_replace( '/\\.[^.\\s]{3,4}$/', '', $filename );
}
/**
* @param string $regex
*
* @return string
*/
public static function escapeForRegex( $regex ) {
if ( ! is_null( $regex ) ) {
return str_replace( '\\\\/', '\/', str_replace( '/', '\/', $regex ) );
} else {
return str_replace( '\\\\/', '\/', str_replace( '/', '\/', '' ) );
}
}
public static function isJSON( $string ) {
//$json = json_decode( $string );
$string = !is_null( $string ) ? $string : '';
return ( json_last_error() == JSON_ERROR_NONE && in_array( substr( $string, 0, 1 ), array( '{', '[' ) ) );
}
public static function isHTML( $string ) {
if ( ! is_null( $string ) ) {
return strip_tags( $string ) !== $string && is_string( $string );
} else {
return false;
}
}
}