This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function formatBytes($bytes, $precision = 2) | |
{ | |
$base = log($bytes, 1024); | |
$suffixes = array('', 'Кбайт', 'Мбайт', 'Гбайт', 'Тбайт'); | |
return round(pow(1024, $base - floor($base)), $precision) .' '. $suffixes[floor($base)]; | |
} | |
if(is_numeric($aProps['cr_pdf']['VALUE'])){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(!CModule::IncludeModule('highloadblock')) die(); | |
use Bitrix\Highloadblock as HL; | |
use Bitrix\Main\Entity; | |
$hlblock = HL\HighloadBlockTable::getById(5)->fetch(); | |
$hlEntity = HL\HighloadBlockTable::compileEntity($hlblock); | |
$entDataClass = $hlEntity->getDataClass(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Loader; | |
if(!Loader::includeModule("iblock")) die(); | |
$aFilter = array("IBLOCK_ID"=>25, "ACTIVE"=>"Y"); | |
$rPart = CIBlockElement::GetList(array('sort'=>'ASC'), $aFilter, false, false, array()); | |
while($oPart = $rPart->GetNextElement()): | |
$aPart = $oPart->GetFields(); | |
$aPart['PROP'] = $oPart->GetProperties(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$aFilter = Array('IBLOCK_ID'=>9, 'DEPTH_LEVEL'=>1,"UF_SECTION_REF" => $sectionID); | |
$rSect = CIBlockSection::GetList(Array('SORT'=>'ASC'), $aFilter, false, array('UF_*')); | |
$aSections = array(); | |
while($aSect = $rSect->GetNext()) { | |
$aSections[] = $aSect; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$aPropList = array(); | |
$rEnum = CIBlockProperty::GetPropertyEnum($propID, Array('SORT'=>'ASC'), Array("IBLOCK_ID"=>2)); | |
while($aEnum = $rEnum->Fetch()){ | |
$aPropList[] = array('id'=>$aEnum['ID'], 'code'=>$aEnum['XML_ID'] ,'value'=>$aEnum['VALUE']); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Application; | |
$request = Application::getInstance()->getContext()->getRequest(); | |
$value = $request->get("some_name"); | |
$value = $request["some_name"]; | |
$value = $request->getQuery("some_name"); // получение GET-параметра | |
$value = $request->getPost("some_name"); // получение POST-параметра | |
$value = $request->getFile("some_name"); // получение загруженного файла |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
array( | |
"CONDITION" => "#^/weather/([^/]+)/([^/]+)/($|index\\.php|\\?.*)#", | |
"RULE" => "COUNTRY_CODE=$1&CITY_CODE=$2", | |
"ID" => "", | |
"PATH" => "/weather/city.php", | |
), | |
/* | |
/weather/russia/moscow/ => /weather/city.php?COUNTRY_CODE=russia&CITY_CODE=moscow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Bitrix\Main\Application; | |
use Bitrix\Highloadblock\HighloadBlockTable; | |
use Bitrix\Main\Loader; | |
Loader::includeModule('highloadblock'); | |
Loader::includeModule('iblock'); | |
$hlBlockId = 2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
-9007199254740990 to 9007199254740990 | |
*/ | |
function isInt(n) { | |
return +n === n && !(n % 1); | |
} | |
/* | |
-128 to 127 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
AddEventHandler('main', 'OnEventLogGetAuditTypes', 'ASD_OnEventLogGetAuditTypes'); | |
function ASD_OnEventLogGetAuditTypes() | |
{ | |
return array('MY_OWN_TYPE' => '[MY_OWN_TYPE] Мой собственный тип'); | |
} | |
CEventLog::Add(array( | |
"SEVERITY" => "SECURITY", |
OlderNewer