当前位置: 首页>>代码示例>>PHP>>正文


PHP Piwik_ShouldPrintBackTraceWithMessage函数代码示例

本文整理汇总了PHP中Piwik_ShouldPrintBackTraceWithMessage函数的典型用法代码示例。如果您正苦于以下问题:PHP Piwik_ShouldPrintBackTraceWithMessage函数的具体用法?PHP Piwik_ShouldPrintBackTraceWithMessage怎么用?PHP Piwik_ShouldPrintBackTraceWithMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Piwik_ShouldPrintBackTraceWithMessage函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Piwik_ExitWithMessage

 /**
  * Displays info/warning/error message in a friendly UI and exits.
  *
  * @param string $message Main message, must be html encoded before calling
  * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color
  * @param bool $optionalLinks If true, will show links to the Piwik website for help
  * @param bool $optionalLinkBack If true, displays a link to go back
  */
 function Piwik_ExitWithMessage($message, $optionalTrace = false, $optionalLinks = false, $optionalLinkBack = false)
 {
     @header('Content-Type: text/html; charset=utf-8');
     @header('HTTP/1.1 500 Internal Server Error');
     if ($optionalTrace) {
         $optionalTrace = '<span class="exception-backtrace">Backtrace:<br /><pre>' . $optionalTrace . '</pre></span>';
     }
     $isCli = PHP_SAPI == 'cli';
     if ($optionalLinks) {
         $optionalLinks = '<ul>
                         <li><a target="_blank" href="http://piwik.org">Piwik.org homepage</a></li>
                         <li><a target="_blank" href="http://piwik.org/faq/">Piwik Frequently Asked Questions</a></li>
                         <li><a target="_blank" href="http://piwik.org/docs/">Piwik Documentation</a></li>
                         <li><a target="_blank" href="http://forum.piwik.org/">Piwik Forums</a></li>
                         <li><a target="_blank" href="http://demo.piwik.org">Piwik Online Demo</a></li>
                         </ul>';
     }
     if ($optionalLinkBack) {
         $optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a><br/>';
     }
     $headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
     $footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
     $headerPage = str_replace('{$HTML_TITLE}', PAGE_TITLE_WHEN_ERROR, $headerPage);
     $content = '<p>' . $message . '</p>
                 <p>' . $optionalLinkBack . '<a href="index.php">Go to Piwik</a><br/>
                    <a href="index.php?module=Login">Login</a>' . '</p>' . ' ' . (Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') . ' ' . $optionalLinks;
     $message = str_replace(array("<br />", "<br>", "<br/>", "</p>"), "\n", $message);
     $message = str_replace("\t", "", $message);
     $message = strip_tags($message);
     if ($isCli) {
         echo $message;
     } else {
         echo $headerPage . $content . $footerPage;
     }
     echo "\n";
     error_log(sprintf("Error in Piwik: %s", str_replace("\n", " ", $message)));
     exit(1);
 }
开发者ID:Abine,项目名称:piwik,代码行数:46,代码来源:testMinimumPhpVersion.php

示例2: formatExceptionMessage

 private function formatExceptionMessage(Exception $exception)
 {
     $message = $exception->getMessage();
     if (\Piwik_ShouldPrintBackTraceWithMessage()) {
         $message .= "\n" . $exception->getTraceAsString();
     }
     return Renderer::formatValueXml($message);
 }
开发者ID:pombredanne,项目名称:ArcherSys,代码行数:8,代码来源:ResponseBuilder.php

示例3: buildView

 protected function buildView()
 {
     $this->overrideSomeConfigPropertiesIfNeeded();
     try {
         $this->beforeLoadDataTable();
         $this->loadDataTableFromAPI();
         $this->postDataTableLoadedFromAPI();
         $requestPropertiesAfterLoadDataTable = $this->requestConfig->getProperties();
         $this->applyFilters();
         $this->addVisualizationInfoFromMetricMetadata();
         $this->afterAllFiltersAreApplied();
         $this->beforeRender();
         $this->logMessageIfRequestPropertiesHaveChanged($requestPropertiesAfterLoadDataTable);
     } catch (NoAccessException $e) {
         throw $e;
     } catch (\Exception $e) {
         Log::error("Failed to get data from API: " . $e->getMessage() . "\n" . $e->getTraceAsString());
         $message = $e->getMessage();
         if (\Piwik_ShouldPrintBackTraceWithMessage()) {
             $message .= "\n" . $e->getTraceAsString();
         }
         $loadingError = array('message' => $message);
     }
     $view = new View("@CoreHome/_dataTable");
     if (!empty($loadingError)) {
         $view->error = $loadingError;
     }
     $view->assign($this->templateVars);
     $view->visualization = $this;
     $view->visualizationTemplate = static::TEMPLATE_FILE;
     $view->visualizationCssClass = $this->getDefaultDataTableCssClass();
     $view->reportMetdadata = $this->getReportMetadata();
     if (null === $this->dataTable) {
         $view->dataTable = null;
     } else {
         $view->dataTableHasNoData = !$this->isThereDataToDisplay();
         $view->dataTable = $this->dataTable;
         // if it's likely that the report data for this data table has been purged,
         // set whether we should display a message to that effect.
         $view->showReportDataWasPurgedMessage = $this->hasReportBeenPurged();
         $view->deleteReportsOlderThan = Option::get('delete_reports_older_than');
     }
     $view->idSubtable = $this->requestConfig->idSubtable;
     $view->clientSideParameters = $this->getClientSideParametersToSet();
     $view->clientSideProperties = $this->getClientSidePropertiesToSet();
     $view->properties = array_merge($this->requestConfig->getProperties(), $this->config->getProperties());
     $view->reportLastUpdatedMessage = $this->reportLastUpdatedMessage;
     $view->footerIcons = $this->config->footer_icons;
     $view->isWidget = Common::getRequestVar('widget', 0, 'int');
     return $view;
 }
开发者ID:bossrabbit,项目名称:piwik,代码行数:51,代码来源:Visualization.php

示例4: decorateExceptionWithDebugTrace

 /**
  * @param Exception $e
  * @return Exception
  */
 protected function decorateExceptionWithDebugTrace(Exception $e)
 {
     // If we are in tests, show full backtrace
     if (defined('PIWIK_PATH_TEST_TO_ROOT')) {
         if (\Piwik_ShouldPrintBackTraceWithMessage()) {
             $message = $e->getMessage() . " in \n " . $e->getFile() . ":" . $e->getLine() . " \n " . $e->getTraceAsString();
         } else {
             $message = $e->getMessage() . "\n \n --> To temporarily debug this error further, set const PIWIK_PRINT_ERROR_BACKTRACE=true; in index.php";
         }
         return new Exception($message);
     }
     return $e;
 }
开发者ID:brienomatty,项目名称:elmsln,代码行数:17,代码来源:ResponseBuilder.php

示例5: Piwik_GetErrorMessagePage

 /**
  * Displays info/warning/error message in a friendly UI and exits.
  *
  * Note: this method should not be called by anyone other than FrontController.
  *
  * @param string $message Main message, must be html encoded before calling
  * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color
  * @param bool $optionalLinks If true, will show links to the Piwik website for help
  * @param bool $optionalLinkBack If true, displays a link to go back
  * @param bool|string $logoUrl The URL to the logo to use.
  * @param bool|string $faviconUrl The URL to the favicon to use.
  * @return string
  */
 function Piwik_GetErrorMessagePage($message, $optionalTrace = false, $optionalLinks = false, $optionalLinkBack = false, $logoUrl = false, $faviconUrl = false, $isCli = null)
 {
     if (!headers_sent()) {
         header('Content-Type: text/html; charset=utf-8');
         $isInternalServerError = preg_match('/(sql|database|mysql)/i', $message);
         if ($isInternalServerError) {
             header('HTTP/1.1 500 Internal Server Error');
         }
     }
     if (empty($logoUrl)) {
         $logoUrl = "plugins/Morpheus/images/logo-header.png";
     }
     if (empty($faviconUrl)) {
         $faviconUrl = "plugins/CoreHome/images/favicon.ico";
     }
     if ($optionalTrace) {
         $optionalTrace = '<h2>Stack trace</h2><pre>' . htmlentities($optionalTrace) . '</pre>';
     }
     if ($isCli === null) {
         $isCli = PHP_SAPI == 'cli';
     }
     if ($optionalLinks) {
         $optionalLinks = '<ul>
                         <li><a rel="noreferrer" target="_blank" href="http://piwik.org">Piwik.org homepage</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://piwik.org/faq/">Piwik Frequently Asked Questions</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://piwik.org/docs/">Piwik Documentation</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://forum.piwik.org/">Piwik Forums</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://demo.piwik.org">Piwik Online Demo</a></li>
                         </ul>';
     }
     if ($optionalLinkBack) {
         $optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a>';
     }
     $headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
     $headerPage = str_replace('%logoUrl%', $logoUrl, $headerPage);
     $headerPage = str_replace('%faviconUrl%', $faviconUrl, $headerPage);
     $footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
     $headerPage = str_replace('{$HTML_TITLE}', PAGE_TITLE_WHEN_ERROR, $headerPage);
     $content = '<h2>' . $message . '</h2>
                 <p>' . $optionalLinkBack . ' | <a href="index.php">Go to Piwik</a> |
                    <a href="index.php?module=Login">Login</a>' . '</p>' . ' ' . (Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') . ' ' . $optionalLinks;
     $message = str_replace(array("<br />", "<br>", "<br/>", "</p>"), "\n", $message);
     $message = str_replace("\t", "", $message);
     $message = strip_tags($message);
     if (!$isCli) {
         $message = $headerPage . $content . $footerPage;
     }
     $message .= "\n";
     error_log(sprintf("Error in Piwik: %s", str_replace("\n", " ", $message)));
     return $message;
 }
开发者ID:hichnik,项目名称:piwik,代码行数:64,代码来源:testMinimumPhpVersion.php

示例6: getExceptionMessage

 protected function getExceptionMessage()
 {
     $message = $this->exception->getMessage();
     if (\Piwik_ShouldPrintBackTraceWithMessage()) {
         $message .= "\n" . $this->exception->getTraceAsString();
     }
     return self::renderHtmlEntities($message);
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:8,代码来源:Renderer.php

示例7: decorateExceptionWithDebugTrace

 /**
  * @param Exception $e
  * @return Exception
  */
 protected function decorateExceptionWithDebugTrace(Exception $e)
 {
     // If we are in tests, show full backtrace
     if (defined('PIWIK_PATH_TEST_TO_ROOT')) {
         if (self::DISPLAY_BACKTRACE_DEBUG || \Piwik_ShouldPrintBackTraceWithMessage()) {
             $message = $e->getMessage() . " in \n " . $e->getFile() . ":" . $e->getLine() . " \n " . $e->getTraceAsString();
         } else {
             $message = $e->getMessage() . "\n \n --> To temporarily debug this error further, set const DISPLAY_BACKTRACE_DEBUG=true; in " . basename(__FILE__);
         }
         return new Exception($message);
     }
     return $e;
 }
开发者ID:KiwiJuicer,项目名称:handball-dachau,代码行数:17,代码来源:ResponseBuilder.php

示例8: Piwik_GetErrorMessagePage

 /**
  * Displays info/warning/error message in a friendly UI and exits.
  *
  * Note: this method should not be called by anyone other than FrontController.
  *
  * @param string $message Main message, must be html encoded before calling
  * @param bool|string $optionalTrace Backtrace; will be displayed in lighter color
  * @param bool $optionalLinks If true, will show links to the Piwik website for help
  * @param bool $optionalLinkBack If true, displays a link to go back
  * @param bool|string $logoUrl The URL to the logo to use.
  * @param bool|string $faviconUrl The URL to the favicon to use.
  * @return string
  */
 function Piwik_GetErrorMessagePage($message, $optionalTrace = false, $optionalLinks = false, $optionalLinkBack = false, $logoUrl = false, $faviconUrl = false, $isCli = null)
 {
     error_log(sprintf("Error in Piwik: %s", str_replace("\n", " ", strip_tags($message))));
     if (!headers_sent()) {
         header('Content-Type: text/html; charset=utf-8');
         $isInternalServerError = preg_match('/(sql|database|mysql)/i', $message);
         if ($isInternalServerError) {
             header('HTTP/1.1 500 Internal Server Error');
         }
     }
     // We return only an HTML fragment for AJAX requests
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
         return "<div class='alert alert-danger'><strong>Error:</strong> {$message}</div>";
     }
     if (empty($logoUrl)) {
         $logoUrl = "plugins/Morpheus/images/logo-header.png";
     }
     if (empty($faviconUrl)) {
         $faviconUrl = "plugins/CoreHome/images/favicon.png";
     }
     if ($optionalTrace) {
         $optionalTrace = '<h2>Stack trace</h2><pre>' . htmlentities($optionalTrace) . '</pre>';
     }
     if ($isCli === null) {
         $isCli = PHP_SAPI == 'cli';
     }
     if ($optionalLinks) {
         $optionalLinks = '<ul>
                         <li><a rel="noreferrer" target="_blank" href="http://piwik.org">Piwik.org homepage</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://piwik.org/faq/">Piwik Frequently Asked Questions</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://piwik.org/docs/">Piwik Documentation</a></li>
                         <li><a rel="noreferrer" target="_blank" href="http://forum.piwik.org/">Piwik Forums</a></li>
                         <li><a rel="noreferrer" target="_blank" href="https://piwik.pro/contact/?pk_campaign=App_AnErrorOccured&pk_source=Piwik_App&pk_medium=ProfessionalServicesLink#contact-form">Professional help (Piwik PRO)</a></li>
                         </ul>';
     }
     if ($optionalLinkBack) {
         $optionalLinkBack = '<a href="javascript:window.history.back();">Go Back</a>';
     }
     $headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutHeader.tpl');
     $headerPage = str_replace('%logoUrl%', $logoUrl, $headerPage);
     $headerPage = str_replace('%faviconUrl%', $faviconUrl, $headerPage);
     $footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/simpleLayoutFooter.tpl');
     $headerPage = str_replace('{$HTML_TITLE}', PAGE_TITLE_WHEN_ERROR, $headerPage);
     $content = '<h2>' . $message . '</h2>
                 <p>' . $optionalLinkBack . ' | <a href="index.php">Go to Piwik</a>' . '</p>' . ' ' . (Piwik_ShouldPrintBackTraceWithMessage() ? $optionalTrace : '') . ' ' . $optionalLinks;
     $message = str_replace(array("<br />", "<br>", "<br/>", "</p>"), "\n", $message);
     $message = str_replace("\t", "", $message);
     $message = strip_tags($message);
     if (!$isCli) {
         $message = $headerPage . $content . $footerPage;
     }
     $message .= "\n";
     return $message;
 }
开发者ID:sebastianpiskorski,项目名称:piwik,代码行数:67,代码来源:testMinimumPhpVersion.php


注:本文中的Piwik_ShouldPrintBackTraceWithMessage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。