/** * Adds system information into response data (both XML and JSON) * * @param array $data */ public static function addDefaultResponse(array &$data) { if (XenForo_Application::debugMode()) { $data['debug'] = XenForo_Debug::getDebugTemplateParams(); if (!empty($data['debug']['debug_url'])) { $data['debug']['debug_url'] = self::safeConvertApiUriToAbsoluteUri($data['debug']['debug_url'], true); } $session = self::safeGetSession(); if (!empty($session)) { $clientId = $session->getOAuthClientId(); if (!empty($clientId)) { $data['debug']['client_id'] = $clientId; $oauthToken = $session->getOAuthTokenText(); if (!empty($oauthToken)) { $data['debug']['oauth_token'] = $oauthToken; } } $languageId = $session->get('languageId'); if (!empty($languageId)) { $data['debug']['language_id'] = $languageId; } } } if (XenForo_Visitor::getUserId() > 0) { $data['system_info']['visitor_id'] = XenForo_Visitor::getUserId(); $data['system_info']['time'] = XenForo_Application::$time; } }
protected function _debugMode() { if (get_class($this->_template) == 'XenForo_Template_Admin') { $this->_template->addRequiredExternal('css', 'public:th_debug_info_debugonpost'); } else { $this->_template->addRequiredExternal('css', 'th_debug_info_debugonpost'); } $this->_template->addRequiredExternal('js', 'js/themehouse/debugonpost/full/debugonpost.js'); $this->_append("<div id=\"DebugInfo\"><div><a href=\"\" id=\"DebugInfoClose\">Close</a>" . XenForo_Debug::getDebugHtml() . "</div></div>"); }
/** * Adds system information into response data (both XML and JSON) * * @param array $data */ public static function addDefaultResponse(array &$data) { if (XenForo_Application::debugMode()) { $data['debug'] = XenForo_Debug::getDebugTemplateParams(); $session = self::safeGetSession(); if (!empty($session)) { $data['debug']['client_id'] = $session->getOAuthClientId(); $data['debug']['oauth_token'] = $session->getOAuthTokenText(); } } if (empty($data['system_info'])) { $data['system_info'] = array(); } $data['system_info'] += array('visitor_id' => XenForo_Visitor::getUserId(), 'time' => XenForo_Application::$time); }
public function getDebugData() { $database_debug = XenForo_Debug::getDatabaseDebugInfo($this->getModels()->getModel('database')); unset($database_debug['queryHtml']); $included_files_debug = XenForo_Debug::getIncludedFilesDebugInfo(get_included_files()); unset($included_files_debug['includedFileHtml']); return array('time' => microtime(TRUE) - XenForo_Application::get('page_start_time'), 'database' => $database_debug, 'memory' => array('usage' => memory_get_usage(), 'peak' => memory_get_peak_usage()), 'included_files' => $included_files_debug); }
/** * Renders page-level debugging output and replaces the original view content * with it. Alternatively, it could inject itself into the view content. * * @param string $originalContent Original, rendered view content * * @return string Replacement rendered view content */ public function renderDebugOutput($originalContent) { $this->_response->clearHeaders(); $this->_response->setHttpResponseCode(200); $this->_response->setHeader('Content-Type', 'text/html; charset=UTF-8', true); $this->_response->setHeader('Last-Modified', gmdate('D, d M Y H:i:s') . ' GMT', true); return XenForo_Debug::getDebugPageWrapperHtml(XenForo_Debug::getDebugHtml()); }
/** * Renders the container. * @see XenForo_ViewRenderer_Abstract::renderContainer() * * @param string * @param array * * @return string */ public function renderContainer($contents, array $params = array(), array $newParams = array()) { $params['contentTemplate'] = $this->_contentTemplate; $params['debugMode'] = XenForo_Application::debugMode(); $params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps(); if (!empty($params['extraTabs'])) { foreach ($params['extraTabs'] as &$group) { foreach ($group as &$extraTab) { if (!empty($extraTab['linksTemplate'])) { $extraTab['linksTemplate'] = $this->createTemplateObject($extraTab['linksTemplate'], $extraTab); } } } } $params = array_replace_recursive($params, $newParams); $templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER'; $template = $this->createTemplateObject($templateName, $params); //if ($contents instanceof XenForo_Template_Abstract) //{ // $contents = $contents->render(); //} $containerData = $this->_dependencies->getExtraContainerData(); $template->setParams($containerData); $template->setParam('contents', $contents); $template->setParam('noH1', isset($containerData['h1']) && $containerData['h1'] === ''); if ($params['debugMode']) { $template->setParams(XenForo_Debug::getDebugTemplateParams()); } $rendered = $template->render(); return $this->replaceRequiredExternalPlaceholders($template, $rendered); }
/** * Renders the container. * @see XenForo_ViewRenderer_Abstract::renderContainer() * * @param string * @param array * * @return string */ public function renderContainer($contents, array $params = array()) { $options = XenForo_Application::get('options'); $params['debugMode'] = XenForo_Application::debugMode(); $params['debugFormBackground'] = $options->debugFormBackground; if (!empty($params['adminNavigation']['sideLinks'])) { $params['sideNav'] = $this->_renderSideNav($params['adminNavigation']['sideLinksRoot'], $params['adminNavigation']['sideLinks']); } else { $params['sideNav'] = array(); } $params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps(); $params['publicUrl'] = $options->useFriendlyUrls ? './' : 'index.php'; if (!isset($params['allowManualDeferredRun'])) { $params['allowManualDeferredRun'] = true; } $params['hasManualDeferred'] = XenForo_ViewRenderer_Abstract::hasManualDeferredToRun($params['allowManualDeferredRun']) || !empty($params['hasManualDeferred']); $templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER'; $template = $this->createTemplateObject($templateName, $params); if ($contents instanceof XenForo_Template_Abstract) { $contents = $contents->render(); } $template->setParams($this->_dependencies->getExtraContainerData()); $template->setParam('contents', $contents); if ($params['debugMode']) { $template->setParams(XenForo_Debug::getDebugTemplateParams()); } $rendered = $template->render(); $rendered = $this->replaceRequiredExternalPlaceholders($template, $rendered); $language = XenForo_Visitor::getInstance()->getLanguage(); if (isset($language['text_direction']) && $language['text_direction'] == 'RTL') { $rendered = XenForo_Template_Helper_RightToLeft::replaceRtlEntities($rendered); } return $rendered; }
/** * Renders the container. * @see XenForo_ViewRenderer_Abstract::renderContainer() * * @param string * @param array * * @return string */ public function renderContainer($contents, array $params = array()) { $params['contentTemplate'] = $this->_contentTemplate; $params['debugMode'] = XenForo_Application::debugMode(); $params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps(); if (!empty($params['extraTabs'])) { foreach ($params['extraTabs'] as &$group) { foreach ($group as &$extraTab) { if (!empty($extraTab['linksTemplate'])) { $extraTab['linksTemplate'] = $this->createTemplateObject($extraTab['linksTemplate'], $extraTab + $params); } } } } $templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER'; $template = $this->createTemplateObject($templateName, $params); if ($contents instanceof XenForo_Template_Abstract) { $contents = $contents->render(); } $containerData = $this->_dependencies->getExtraContainerData(); $containerData['notices'] = $this->_getNoticesContainerParams($template, $containerData); $template->setParams($containerData); $template->setParam('contents', $contents); $template->setParam('noH1', isset($containerData['h1']) && $containerData['h1'] === ''); if ($params['debugMode']) { $template->setParams(XenForo_Debug::getDebugTemplateParams()); } $rendered = $template->render(); $rendered = $this->replaceRequiredExternalPlaceholders($template, $rendered); $language = XenForo_Visitor::getInstance()->getLanguage(); if (isset($language['text_direction']) && $language['text_direction'] == 'RTL') { $rendered = XenForo_Template_Helper_RightToLeft::replaceRtlEntities($rendered); } return $rendered; }
/** * Renders the container. * @see XenForo_ViewRenderer_Abstract::renderContainer() * * @param string * @param array * * @return string */ public function renderContainer($contents, array $params = array()) { $options = XenForo_Application::get('options'); $params['debugMode'] = XenForo_Application::debugMode(); $params['debugFormBackground'] = $options->debugFormBackground; if (!empty($params['adminNavigation']['sideLinks'])) { $params['sideNav'] = $this->_renderSideNav($params['adminNavigation']['sideLinksRoot'], $params['adminNavigation']['sideLinks']); } else { $params['sideNav'] = array(); } $params['serverTimeInfo'] = XenForo_Locale::getDayStartTimestamps(); $templateName = !empty($params['containerTemplate']) ? $params['containerTemplate'] : 'PAGE_CONTAINER'; $template = $this->createTemplateObject($templateName, $params); if ($contents instanceof XenForo_Template_Abstract) { $contents = $contents->render(); } $template->setParams($this->_dependencies->getExtraContainerData()); $template->setParam('contents', $contents); if ($params['debugMode']) { $template->setParams(XenForo_Debug::getDebugTemplateParams()); } $rendered = $template->render(); return $this->replaceRequiredExternalPlaceholders($template, $rendered); }