Skip to content

Instantly share code, notes, and snippets.

@jenstornell
Last active July 9, 2017 16:31
Show Gist options
  • Save jenstornell/c4990a30eedd1dd69e6a to your computer and use it in GitHub Desktop.
Save jenstornell/c4990a30eedd1dd69e6a to your computer and use it in GitHub Desktop.
Plugin for Kirby Panel Bar - It calculates the loading time of the current page. PHP 5.4 and above required.
<?php
/*
1. Place the file as /site/plugins/panel-bar-loading-time/panel-bar-loading-time.php
2. Add it to the items array of the panel-bar like this:
'time' => panelbar__loadingTime(),
*/
function panelbar__loadingTime() {
$time = number_format( ( microtime( true ) - $_SERVER['REQUEST_TIME_FLOAT'] ), 2 );
$time_item = panelbar::link(array(
'id' => 'time',
'icon' => 'clock-o',
'url' => '#',
'label' => $time,
'mobile' => 'text',
));
return $time_item;
}
@distantnative
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment