diff --git a/debug-bar-panel.php b/debug-bar-panel.php index f379163..135efae 100644 --- a/debug-bar-panel.php +++ b/debug-bar-panel.php @@ -9,6 +9,8 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { /** @var PluginUpdateChecker */ private $updateChecker; + private $responseBox = ''; + public function __construct($updateChecker) { $this->updateChecker = $updateChecker; $title = sprintf( @@ -26,8 +28,14 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { esc_attr(wp_create_nonce('puc-ajax')) ); - $responseBox = ''; + $this->displayConfiguration(); + $this->displayStatus(); + $this->displayCurrentUpdate(); + echo ''; + } + + private function displayConfiguration() { echo '

Configuration

'; echo ''; $this->row('Plugin file', htmlentities($this->updateChecker->pluginFile)); @@ -38,7 +46,7 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { if ( function_exists('get_submit_button') ) { $requestInfoButton = get_submit_button('Request Info', 'secondary', 'puc-request-info-button', false, array('id' => 'puc-request-info-button-' . $this->updateChecker->slug)); } - $this->row('Metadata URL', htmlentities($this->updateChecker->metadataUrl) . ' ' . $requestInfoButton . $responseBox); + $this->row('Metadata URL', htmlentities($this->updateChecker->metadataUrl) . ' ' . $requestInfoButton . $this->responseBox); if ( $this->updateChecker->checkPeriod > 0 ) { $this->row('Automatic checks', 'Every ' . $this->updateChecker->checkPeriod . ' hours'); @@ -61,7 +69,9 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { } } echo '
'; + } + private function displayStatus() { echo '

Status

'; echo ''; $state = $this->updateChecker->getUpdateState(); @@ -71,7 +81,7 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { } if ( isset($state, $state->lastCheck) ) { - $this->row('Last check', $this->formatTimeWithDelta($state->lastCheck) . ' ' . $checkNowButton . $responseBox); + $this->row('Last check', $this->formatTimeWithDelta($state->lastCheck) . ' ' . $checkNowButton . $this->responseBox); } else { $this->row('Last check', 'Never'); } @@ -85,7 +95,9 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { } $this->row('Update checker class', htmlentities(get_class($this->updateChecker))); echo '
'; + } + private function displayCurrentUpdate() { $update = $this->updateChecker->getUpdate(); if ( $update !== null ) { echo '

An Update Is Available

'; @@ -98,8 +110,6 @@ class PluginUpdateCheckerPanel extends Debug_Bar_Panel { } else { echo '

No updates currently available

'; } - - echo ''; } private function formatTimeWithDelta($unixTime) {