Views: 12183
Last Modified: 23.03.2023
Configuration
Located in the namespace \Bitrix\Main\Config. Consists of 2 classes: \Bitrix\Main\Config\Configuration и \Bitrix\Main\Config\Option.
Configuration
$realm = \Bitrix\Main\Config\Configuration::getValue("http_auth_realm");
if (is_null($realm))
$realm = "Bitrix Site Manager"
Class is responsible for the global settings of the entire application. (This feature is determined by pure data in the old core.) Class operates a single base of settings stored in the file /bitrix/.settings.php
. The data stored are random. For example, the entire data pool can be stored for named connections.
Option
$cookiePrefix = \Bitrix\Main\Config\Option::get('main', 'cookie_name', 'BITRIX_SM');
$cookieLogin = $request->getCookie($cookiePrefix.'_LOGIN');
$cookieMd5Pass = $request->getCookie($cookiePrefix.'_UIDN');
The option class is virtually the same as the COption class of the old core and works with the parameters of modules and sites stored in the database. It is controlled from the administrative section: settings of specific forms, setup, etc.
Files
Work with files is object-oriented. It is located in the Bitrix\Main\IO namespace and has 3 basic classes:
Some other classes, including abstract, for managing hierarchy are also available in addition to these classes.
Other classes
The folder bitrix/modules/main/lib
contains class library for implementing different frequent actions, included in the Main module and not spread among different modules. В том числе в соответствующих пространствах лежат файлы и API для работы:
Equivalent CUtil::jSPostUnescape() in Core D7
If you need to use HttpRequest in AJAX queries:
Application::getInstance()->getContext()->getRequest()->getPost('name')
you'll have to consider that CUtil::JSPostUnescape won't help in case of encoding win-1251.
You can use instead:
use Bitrix\Main\Web\PostDecodeFilter;
...
Application::getInstance()->getContext()->getRequest()->addFilter(new PostDecodeFilter)
After this, you can get decoded data via getPost.