/** * Page generation */ function __finish() { static $executed = false; if ($executed) { return; } $executed = true; /** * Cleaning of output */ if (OUT_CLEAN) { ob_end_clean(); } /** * Detection of compression */ $ob = false; $Config = Config::instance(true); if (API || $Config && !zlib_compression() && $Config->core['gzip_compression']) { ob_start('ob_gzhandler'); $ob = true; } /** * For AJAX and API requests only content without page template */ if (!$this->interface) { /** * Processing of replacing in content */ echo $this->process_replacing($this->Content ?: (API ? 'null' : '')); } else { Trigger::instance()->run('System/Page/pre_display'); class_exists('\\cs\\Error', false) && Error::instance(true)->display(); /** * Processing of template, substituting of content, preparing for the output */ $this->prepare(); /** * Processing of replacing in content */ $this->Html = $this->process_replacing($this->Html); /** * Getting of debug information */ if (DEBUG && (User::instance(true)->admin() || $Config->can_be_admin && $Config->core['ip_admin_list_only'])) { $this->get_debug_info(); } Trigger::instance()->run('System/Page/display'); echo str_replace(['<!--debug_info-->', '<!--generate time-->', '<!--peak memory usage-->'], [$this->debug_info ? h::level(h::{'div#cs-debug.uk-modal div.uk-modal-dialog-large'}(h::level($this->debug_info), ['title' => Language::instance()->debug, 'style' => 'margin-left: -45%; width: 90%;']), $this->level['debug_info']) : '', format_time(round(microtime(true) - MICROTIME, 5)), format_filesize(memory_get_usage(), 5) . h::{'sup[level=0]'}(format_filesize(memory_get_peak_usage(), 5))], rtrim($this->Html)); } if ($ob) { ob_end_flush(); } }
/** * Adding of content on the page * * @param string $add * @param bool|int $level * * @return Index */ function content($add, $level = false) { if ($level !== false) { $this->Content .= h::level($add, $level); } else { $this->Content .= $add; } return $this; }