public function createToc($content, $options = [], $origin = 'html')
{
$toc = [];
$counter = [];
if (preg_match_all($this->regex[$origin], $content, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
$language = $options->get('language');
foreach ($matches as $match) {
$offset = $match[0][1];
$tag = strtolower($match['tag'][0]);
$text = trim($match['text'][0]);
if ($origin == 'markdown') {
$tag = 'h' . strlen($tag);
}
// Ignore headings in code, pre or blockquote environments
if (!$text || $tag{0} !== 'h') {
continue;
}
// Extract information from HTML tag
$level = (int) mb_substr($tag, 1);
// Expand tag attributes
$attributes = $this->parseAttributes($match['attr'][0]);
$id = isset($attributes['id']) ? $attributes['id'] : $this->hyphenize($text, $options, $language);
// Replace empty id with hash of text
if (strlen($id) == 0) {
$id = substr(md5($text), 0, 6);
}
if (isset($counter[$id])) {
$id = $id . '-' . $counter[$id]++;
} else {
$counter[$id] = 1;
}
"Array and string offset access syntax with curly braces is no longer supported"
}
/**
* Special case to deal with Fatal errors and the like.
*
* @return void
*/
public function handleShutdown()
{
// If we reached this step, we are in shutdown handler.
// An exception thrown in a shutdown handler will not be propagated
// to the exception handler. Pass that information along.
$this->canThrowExceptions = false;
$error = $this->system->getLastError();
if ($error && Misc::isLevelFatal($error['type'])) {
// If there was a fatal error,
// it was not handled in handleError yet.
$this->allowQuit = false;
$this->handleError(
$error['type'],
$error['message'],
$error['file'],
$error['line']
);
}
}
/**
* @param Throwable $exception
*
* @return Inspector
*/
private function getInspector($exception)
{
return new Inspector($exception);
}
/**
* Resolves the giving handler.
*/
public function registerShutdownFunction(callable $function)
{
$this->whoopsShutdownHandler = $function;
register_shutdown_function([$this, 'handleShutdown']);
}
/**
* Special case to deal with Fatal errors and the like.
*
* @return void
*/
public function handleShutdown()
{
$error = $this->getLastError();
// Ignore core warnings and errors.
if ($error && !($error['type'] & (E_CORE_WARNING | E_CORE_ERROR))) {
$handler = $this->whoopsShutdownHandler;
$handler();
}
}
}
Key | Value |
redirect_after_login | null
|
user | Grav\Common\User\User {#436} |
Key | Value |
LSPHP_ProcessGroup | "on"
|
PATH | "/usr/local/bin:/bin:/usr/bin"
|
HTTP_ACCEPT | "*/*"
|
HTTP_HOST | "www.cherry-laine.com"
|
HTTP_REFERER | "http://www.cherry-laine.com/wp-content/uploads/2015/06/a11.jpg"
|
HTTP_USER_AGENT | "claudebot"
|
DOCUMENT_ROOT | "/home/u139141502/domains/cherry-laine.com/public_html"
|
REMOTE_ADDR | "44.192.107.255"
|
REMOTE_PORT | "34242"
|
SERVER_ADDR | "45.84.205.226"
|
SERVER_NAME | "www.cherry-laine.com"
|
SERVER_ADMIN | "" |
SERVER_PORT | "443"
|
REQUEST_SCHEME | "https"
|
REQUEST_URI | "/wp-content/uploads/2015/06/a11.jpg"
|
REDIRECT_URL | "/wp-content/uploads/2015/06/a11.jpg"
|
REDIRECT_REQUEST_METHOD | "GET"
|
HTTPS | "on"
|
CRAWLER_USLEEP | "1000"
|
CRAWLER_LOAD_LIMIT_ENFORCE | "25"
|
REDIRECT_STATUS | "200"
|
X_SPDY | "HTTP2"
|
SSL_PROTOCOL | "TLSv1.3"
|
SSL_CIPHER | "TLS_AES_256_GCM_SHA384"
|
SSL_CIPHER_USEKEYSIZE | "256"
|
SSL_CIPHER_ALGKEYSIZE | "256"
|
SCRIPT_FILENAME | "/home/u139141502/domains/cherry-laine.com/public_html/index.php"
|
QUERY_STRING | "" |
SCRIPT_URI | "https://www.cherry-laine.com/wp-content/uploads/2015/06/a11.jpg"
|
SCRIPT_URL | "/wp-content/uploads/2015/06/a11.jpg"
|
SCRIPT_NAME | "/index.php"
|
SERVER_PROTOCOL | "HTTP/1.1"
|
SERVER_SOFTWARE | "LiteSpeed"
|
REQUEST_METHOD | "GET"
|
X-LSCACHE | "on,crawler,esi,combine"
|
PHP_SELF | "/index.php"
|
REQUEST_TIME_FLOAT | 1711616664.0554
|
REQUEST_TIME | 1711616664
|