%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.219.45.88 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 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, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/components/bitrix/ui.toolbar/ |
Upload File : |
<? use Bitrix\Main\Loader; use Bitrix\Main\ModuleManager; use Bitrix\Main\UI\Extension; use Bitrix\UI\Toolbar\Facade\Toolbar; if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die(); } class UIToolbarComponent extends CBitrixComponent { private $toolbarId; /** * Execute component. * * @return void */ public function executeComponent() { Loader::includeModule('ui'); Extension::load(["ui.buttons", "ui.buttons.icons"]); $this->toolbarId = $this->arParams["TOOLBAR_ID"] ?? Toolbar::DEFAULT_ID; if($this->toolbarId === Toolbar::DEFAULT_ID) { $GLOBALS["APPLICATION"]->addBufferContent([$this, "includeTemplate"]); $this->initComponentTemplate(); $GLOBALS["APPLICATION"]->setAdditionalCSS($this->getTemplate()->getFolder()."/style.css"); $GLOBALS["APPLICATION"]->addHeadScript($this->getTemplate()->getFolder()."/script.js"); } else { $this->arResult["TOOLBAR_ID"] = $this->toolbarId; $this->arResult["CONTAINER_ID"] = "toolbar_" . $this->randString(); $this->includeComponentTemplate("common"); } } public function includeTemplate() { //it's a dirty hack to prevent showing a white screen when some php error happens. if ($this->shouldPreventOutputBuffering()) { return ""; } ob_start(); $pageTitle = $GLOBALS["APPLICATION"]->getViewContent("pagetitle"); $insidePageTitle = $GLOBALS["APPLICATION"]->getViewContent("inside_pagetitle"); $inPageTitle = $GLOBALS["APPLICATION"]->getViewContent("in_pagetitle"); $isBitrix24Cloud = ModuleManager::isModuleInstalled("bitrix24"); /** @var \CIntranetToolbar $oldToolbar */ $oldToolbar = null; if (isset($GLOBALS["INTRANET_TOOLBAR"])) { $oldToolbar = $GLOBALS["INTRANET_TOOLBAR"]; } $oldToolbarButtons = ( !$isBitrix24Cloud && ( $oldToolbar instanceof \CIntranetToolbar && $oldToolbar->isEnabled() && count($oldToolbar->getButtons()) > 0 )); if ($pageTitle <> '' || $insidePageTitle <> '' || $inPageTitle <> '' || $oldToolbarButtons) { $this->includeComponentTemplate("old"); } else { $this->includeComponentTemplate(); } return ob_get_clean(); } private function shouldPreventOutputBuffering() { if (defined("BX_BUFFER_SHUTDOWN")) { return true; } $trace = \Bitrix\Main\Diag\Helper::getBackTrace(0, DEBUG_BACKTRACE_IGNORE_ARGS); foreach ($trace as $traceLine) { if ( isset($traceLine['function']) && in_array( $traceLine['function'], ['ob_end_flush', 'ob_end_clean', 'LocalRedirect', 'ForkActions', 'fastcgi_finish_request'] ) ) { return true; } } return false; } }