From 8ca6cc32b2c789a3149861159ad258f2cb9491e3 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 14:39:39 +0200 Subject: Adding upstream version 2.11.4. Signed-off-by: Daniel Baumann --- .../vendor/Zend/ProgressBar/Adapter/Exception.php | 37 ++++++ library/vendor/Zend/ProgressBar/Adapter/JsPull.php | 115 ++++++++++++++++ library/vendor/Zend/ProgressBar/Adapter/JsPush.php | 146 +++++++++++++++++++++ 3 files changed, 298 insertions(+) create mode 100644 library/vendor/Zend/ProgressBar/Adapter/Exception.php create mode 100644 library/vendor/Zend/ProgressBar/Adapter/JsPull.php create mode 100644 library/vendor/Zend/ProgressBar/Adapter/JsPush.php (limited to 'library/vendor/Zend/ProgressBar/Adapter') diff --git a/library/vendor/Zend/ProgressBar/Adapter/Exception.php b/library/vendor/Zend/ProgressBar/Adapter/Exception.php new file mode 100644 index 0000000..110fced --- /dev/null +++ b/library/vendor/Zend/ProgressBar/Adapter/Exception.php @@ -0,0 +1,37 @@ +_exitAfterSend = $exitAfterSend; + } + + /** + * Defined by Zend_ProgressBar_Adapter_Interface + * + * @param float $current Current progress value + * @param float $max Max progress value + * @param float $percent Current percent value + * @param integer $timeTaken Taken time in seconds + * @param integer $timeRemaining Remaining time in seconds + * @param string $text Status text + * @return void + */ + public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text) + { + $arguments = array( + 'current' => $current, + 'max' => $max, + 'percent' => ($percent * 100), + 'timeTaken' => $timeTaken, + 'timeRemaining' => $timeRemaining, + 'text' => $text, + 'finished' => false + ); + + $data = Zend_Json::encode($arguments); + + // Output the data + $this->_outputData($data); + } + + /** + * Defined by Zend_ProgressBar_Adapter_Interface + * + * @return void + */ + public function finish() + { + $data = Zend_Json::encode(array('finished' => true)); + + $this->_outputData($data); + } + + /** + * Outputs given data the user agent. + * + * This split-off is required for unit-testing. + * + * @param string $data + * @return void + */ + protected function _outputData($data) + { + echo $data; + + if ($this->_exitAfterSend) { + exit; + } + } +} diff --git a/library/vendor/Zend/ProgressBar/Adapter/JsPush.php b/library/vendor/Zend/ProgressBar/Adapter/JsPush.php new file mode 100644 index 0000000..f43d85e --- /dev/null +++ b/library/vendor/Zend/ProgressBar/Adapter/JsPush.php @@ -0,0 +1,146 @@ +_updateMethodName = $methodName; + + return $this; + } + + /** + * Set the finish method name + * + * @param string $methodName + * @return Zend_ProgressBar_Adapter_JsPush + */ + public function setFinishMethodName($methodName) + { + $this->_finishMethodName = $methodName; + + return $this; + } + + /** + * Defined by Zend_ProgressBar_Adapter_Interface + * + * @param float $current Current progress value + * @param float $max Max progress value + * @param float $percent Current percent value + * @param integer $timeTaken Taken time in seconds + * @param integer $timeRemaining Remaining time in seconds + * @param string $text Status text + * @return void + */ + public function notify($current, $max, $percent, $timeTaken, $timeRemaining, $text) + { + $arguments = array( + 'current' => $current, + 'max' => $max, + 'percent' => ($percent * 100), + 'timeTaken' => $timeTaken, + 'timeRemaining' => $timeRemaining, + 'text' => $text + ); + + $data = ''; + + // Output the data + $this->_outputData($data); + } + + /** + * Defined by Zend_ProgressBar_Adapter_Interface + * + * @return void + */ + public function finish() + { + if ($this->_finishMethodName === null) { + return; + } + + $data = ''; + + $this->_outputData($data); + } + + /** + * Outputs given data the user agent. + * + * This split-off is required for unit-testing. + * + * @param string $data + * @return void + */ + protected function _outputData($data) + { + // 1024 padding is required for Safari, while 256 padding is required + // for Internet Explorer. The
is required so Safari actually + // executes the