uawdijnntqw1x1x1
IP : 3.128.190.174
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
www
/
axolotl
/
data
/
www
/
rostov.axolotls.ru
/
bitrix
/
modules
/
abtest
/
lib
/
eventhandler.php
/
/
<?php namespace Bitrix\ABTest; use Bitrix\Main\Application; use Bitrix\Main\Localization; Localization\Loc::loadMessages(__FILE__); class EventHandler { /** * Passes an A/B-test mode string from request to session * * @return void */ public static function onPageStart() { $applicationContext = Application::getInstance()->getContext(); if ($mode = $applicationContext->getRequest()->get('abtest_mode')) $_SESSION['ABTEST_MODE'] = $mode; } /** * Defines if site template should be overridden * * @param \Bitrix\Main\Event $event Event. * @return string|null */ public static function onGetCurrentSiteTemplate(\Bitrix\Main\Event $event) { $template = $event->getParameter('template'); $result = null; if ($context = Helper::getContext()) { if ($context['section'] == 'B') $result = Helper::getAlternative('template', $template); } return $result; } /** * Defines if page file should be overridden * * @param \Bitrix\Main\Event $event Event. * @return string|null */ public static function onFileRewrite(\Bitrix\Main\Event $event) { $path = $event->getParameter('path'); $result = null; if ($context = Helper::getContext()) { if ($context['section'] == 'B') $result = Helper::getAlternative('page', $path); } return $result; } /** * Returns A/B-test related attribute types * * @return array */ public static function onGetAttributeTypes() { $sections = array( 'A' => array('NAME' => Localization\Loc::getMessage('ABTEST_CONV_TEST_SECTION_A_NAME')), 'B' => array('NAME' => Localization\Loc::getMessage('ABTEST_CONV_TEST_SECTION_B_NAME')) ); return array( 'abtest' => array( 'MODULE' => 'abtest', 'NAME' => Localization\Loc::getMessage('ABTEST_CONVATTR_TEST_NAME'), 'SORT' => 5000, 'GET_VALUES' => function(array $ids) { $result = ABTestTable::getList(array( 'select' => array('ID', 'NAME'), 'filter' => array('ID' => $ids), 'order' => array('SORT' => 'ASC'), )); $values = array(); while ($abtest = $result->fetch()) { if (empty($abtest['NAME'])) $abtest['NAME'] = str_replace('#ID#', $abtest['ID'], Localization\Loc::getMessage('ABTEST_CONV_TEST_TITLE')); $values[$abtest['ID']] = array( 'NAME' => $abtest['NAME'] ); } return $values; } ), 'abtest_section' => array( 'MODULE' => 'abtest', 'NAME' => Localization\Loc::getMessage('ABTEST_CONVATTR_TEST_SECTION_NAME'), 'SORT' => 5100, 'GET_VALUES' => function(array $ids) use ($sections) { $values = array(); foreach ($ids as $id) { if (!empty($sections[$id])) $values[$id] = $sections[$id]; } return $values; } ), ); } /** * Sets A/B-test related attributes to conversion context * * @param \Bitrix\Conversion\DayContext $conversionContext Conversion context. * @return void */ public static function onConversionSetContextAttributes(\Bitrix\Conversion\DayContext $conversionContext) { if ($abtest = Helper::getActiveTest()) { if ($context = Helper::getContext()) { if ($context['abtest'] != $abtest['ID']) return; if (!in_array($context['section'], array('A', 'B'))) return; $conversionContext->setAttribute('abtest', $context['abtest']); $conversionContext->setAttribute('abtest_section', $context['section']); } } } /** * Adds A/B-test related buttons to Control Panel * * @return void */ public static function onPanelCreate() { global $USER, $APPLICATION; if ($USER->canDoOperation('view_other_settings')) { if ($context = Helper::getContext()) { $baseUri = \CHTTP::urlDeleteParams($APPLICATION->getCurPage(), array('abtest_mode')); $groupAUri = \CHTTP::urlAddParams($baseUri, array('abtest_mode' => intval($context['abtest']).'|A')); $groupBUri = \CHTTP::urlAddParams($baseUri, array('abtest_mode' => intval($context['abtest']).'|B')); $resetUri = \CHTTP::urlAddParams($baseUri, array('abtest_mode' => 'reset')); $APPLICATION->addPanelButton(array( 'ID' => 'abtest_options', 'SRC' => $context['section'] == 'B' ? '/bitrix/images/abtest/ab-icon-b.png' : '/bitrix/images/abtest/ab-icon-a.png', 'TEXT' => str_replace('#ID#', intval($context['abtest']), Localization\Loc::getMessage('ABTEST_PANEL_MENU_BTN')), 'TYPE' => 'BIG', 'MAIN_SORT' => 900, 'SORT' => 10, 'MENU' => array( array( 'ACTION' => "jsUtils.Redirect([], '".\CUtil::jsEscape($groupAUri)."'); ", 'TEXT' => Localization\Loc::getMessage('ABTEST_PANEL_MENU_MODE_A'), 'CHECKED' => $context['section'] == 'A' ? true : false, ), array( 'ACTION' => "jsUtils.Redirect([], '".\CUtil::jsEscape($groupBUri)."'); ", 'TEXT' => Localization\Loc::getMessage('ABTEST_PANEL_MENU_MODE_B'), 'CHECKED' => $context['section'] == 'B' ? true : false, ), array( 'ACTION' => "jsUtils.Redirect([], '".\CUtil::jsEscape($resetUri)."'); ", 'TEXT' => Localization\Loc::getMessage('ABTEST_PANEL_MENU_RESET'), ) ) )); } } } }
/var/www/axolotl/data/www/rostov.axolotls.ru/bitrix/modules/abtest/lib/eventhandler.php