本文整理汇总了PHP中Tracy\Helpers::getSource方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::getSource方法的具体用法?PHP Helpers::getSource怎么用?PHP Helpers::getSource使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracy\Helpers
的用法示例。
在下文中一共展示了Helpers::getSource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
public function log($message, $priority = self::INFO)
{
$context = ['at' => Helpers::getSource()];
if ($message instanceof Throwable) {
$context['exception'] = $message;
$message = '';
}
$this->monolog->addRecord(self::PRIORITY_MAP[$priority] ?? Monolog\Logger::ERROR, $message, $context);
}
示例2: render
/**
* Renders blue screen.
* @param \Exception
* @return void
*/
public function render(\Exception $exception)
{
$panels = $this->panels;
$info = array_filter($this->info);
$source = Helpers::getSource();
$sourceIsUrl = preg_match('#^https?://#', $source);
$title = $exception instanceof \ErrorException ? Helpers::errorTypeToString($exception->getSeverity()) : get_class($exception);
$skipError = $sourceIsUrl && $exception instanceof \ErrorException && !empty($exception->skippable) ? $source . (strpos($source, '?') ? '&' : '?') . '_tracy_skip_error' : NULL;
require __DIR__ . '/templates/bluescreen.phtml';
}
示例3: formatLogLine
/**
* @return string
*/
protected function formatLogLine($message, $exceptionFile = NULL)
{
return implode(' ', array(@date('[Y-m-d H-i-s]'), preg_replace('#\\s*\\r?\\n\\s*#', ' ', $this->formatMessage($message)), ' @ ' . Helpers::getSource(), $exceptionFile ? ' @@ ' . basename($exceptionFile) : NULL));
}
示例4: defaultMailer
/**
* Default mailer.
*
* @param $message
* @param $email
* @param string|\Exception|\Throwable
*
* @internal
*/
public function defaultMailer($message, $email, $exceptionFile = NULL, $priority = NULL)
{
if (!is_null($this->host)) {
$host = $this->host;
} else {
$host = preg_replace('#[^\\w.-]+#', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : php_uname('n'));
}
try {
$emailSendJson = Nette\Utils\Json::decode(file_get_contents($this->directory . '/email-sent'), Nette\Utils\Json::FORCE_ARRAY);
} catch (Nette\Utils\JsonException $e) {
$emailSendJson = [];
}
$emailSendJson[$exceptionFile] = TRUE;
@file_put_contents($this->directory . '/email-sent', Nette\Utils\Json::encode($emailSendJson));
$mail = new Nette\Mail\Message();
$mail->setFrom($this->fromEmail ?: (Nette\Utils\Validators::isEmail("noreply@{$host}") ? "noreply@{$host}" : "noreply@example.tld"))->addTo(is_array($email) ? $email[0] : $email)->setSubject("PHP: An error (" . $this->getTitle($message, $priority) . ") occurred on the server {$host}")->setHtmlBody($this->formatMessage($message) . "\n\nsource: " . Tracy\Helpers::getSource() . (is_null($exceptionFile) ? '' : "\n\nexception link: " . Nette\Utils\Strings::replace($exceptionFile, ['~^(.*)exception--~' => 'http://' . $host . $this->path . 'exception--'])));
if (is_array($email)) {
foreach ($email as $k => $v) {
if ($k == 0) {
continue;
}
$mail->addCc($v);
}
}
$this->mailerClass->send($mail);
}
示例5: defaultMailer
/**
* Default mailer.
* @param string
* @param string
* @return void
* @internal
*/
public function defaultMailer($message, $email)
{
$host = preg_replace('#[^\\w.-]+#', '', isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : php_uname('n'));
$parts = str_replace(array("\r\n", "\n"), array("\n", PHP_EOL), array('headers' => implode("\n", array("From: noreply@{$host}", 'X-Mailer: Tracy', 'Content-Type: text/plain; charset=UTF-8', 'Content-Transfer-Encoding: 8bit')) . "\n", 'subject' => "PHP: An error occurred on the server {$host}", 'body' => $this->formatMessage($message) . "\n\nsource: " . Helpers::getSource()));
mail($email, $parts['subject'], $parts['body'], $parts['headers']);
}