From 07f5140771388c9e0c8a99b0dd2e5d950bdb173b Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 14 Oct 2021 15:16:42 +1100 Subject: moving h-source subdir out. --- .../ByteStream/AbstractFilterableInputStream.php | 178 ------------------- .../classes/Swift/ByteStream/ArrayByteStream.php | 190 --------------------- .../classes/Swift/ByteStream/FileByteStream.php | 177 ------------------- 3 files changed, 545 deletions(-) delete mode 100755 h-source/External/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php delete mode 100755 h-source/External/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php delete mode 100755 h-source/External/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php (limited to 'h-source/External/swiftmailer/lib/classes/Swift/ByteStream') diff --git a/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php b/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php deleted file mode 100755 index 71bc3f1..0000000 --- a/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/AbstractFilterableInputStream.php +++ /dev/null @@ -1,178 +0,0 @@ -_filters[$key] = $filter; - } - - /** - * Remove an already present StreamFilter based on its $key. - * @param string $key - */ - public function removeFilter($key) - { - unset($this->_filters[$key]); - } - - /** - * Writes $bytes to the end of the stream. - * @param string $bytes - * @throws Swift_IoException - */ - public function write($bytes) - { - $this->_writeBuffer .= $bytes; - foreach ($this->_filters as $filter) - { - if ($filter->shouldBuffer($this->_writeBuffer)) - { - return; - } - } - $this->_doWrite($this->_writeBuffer); - return ++$this->_sequence; - } - - /** - * For any bytes that are currently buffered inside the stream, force them - * off the buffer. - * - * @throws Swift_IoException - */ - public function commit() - { - $this->_doWrite($this->_writeBuffer); - } - - /** - * Attach $is to this stream. - * The stream acts as an observer, receiving all data that is written. - * All {@link write()} and {@link flushBuffers()} operations will be mirrored. - * - * @param Swift_InputByteStream $is - */ - public function bind(Swift_InputByteStream $is) - { - $this->_mirrors[] = $is; - } - - /** - * Remove an already bound stream. - * If $is is not bound, no errors will be raised. - * If the stream currently has any buffered data it will be written to $is - * before unbinding occurs. - * - * @param Swift_InputByteStream $is - */ - public function unbind(Swift_InputByteStream $is) - { - foreach ($this->_mirrors as $k => $stream) - { - if ($is === $stream) - { - if ($this->_writeBuffer !== '') - { - $stream->write($this->_filter($this->_writeBuffer)); - } - unset($this->_mirrors[$k]); - } - } - } - - /** - * Flush the contents of the stream (empty it) and set the internal pointer - * to the beginning. - * @throws Swift_IoException - */ - public function flushBuffers() - { - if ($this->_writeBuffer !== '') - { - $this->_doWrite($this->_writeBuffer); - } - $this->_flush(); - - foreach ($this->_mirrors as $stream) - { - $stream->flushBuffers(); - } - } - - // -- Private methods - - /** Run $bytes through all filters */ - private function _filter($bytes) - { - foreach ($this->_filters as $filter) - { - $bytes = $filter->filter($bytes); - } - return $bytes; - } - - /** Just write the bytes to the stream */ - private function _doWrite($bytes) - { - $this->_commit($this->_filter($bytes)); - - foreach ($this->_mirrors as $stream) - { - $stream->write($bytes); - } - - $this->_writeBuffer = ''; - } - -} diff --git a/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php b/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php deleted file mode 100755 index f918889..0000000 --- a/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/ArrayByteStream.php +++ /dev/null @@ -1,190 +0,0 @@ -_array = $stack; - $this->_arraySize = count($stack); - } - elseif (is_string($stack)) - { - $this->write($stack); - } - else - { - $this->_array = array(); - } - } - - /** - * Reads $length bytes from the stream into a string and moves the pointer - * through the stream by $length. If less bytes exist than are requested the - * remaining bytes are given instead. If no bytes are remaining at all, boolean - * false is returned. - * @param int $length - * @return string - */ - public function read($length) - { - if ($this->_offset == $this->_arraySize) - { - return false; - } - - // Don't use array slice - $end = $length + $this->_offset; - $end = $this->_arraySize<$end - ?$this->_arraySize - :$end; - $ret = ''; - for (; $this->_offset < $end; ++$this->_offset) - { - $ret .= $this->_array[$this->_offset]; - } - return $ret; - } - - /** - * Writes $bytes to the end of the stream. - * @param string $bytes - */ - public function write($bytes) - { - $to_add = str_split($bytes); - foreach ($to_add as $value) - { - $this->_array[] = $value; - } - $this->_arraySize = count($this->_array); - - foreach ($this->_mirrors as $stream) - { - $stream->write($bytes); - } - } - - /** - * Not used. - */ - public function commit() - { - } - - /** - * Attach $is to this stream. - * The stream acts as an observer, receiving all data that is written. - * All {@link write()} and {@link flushBuffers()} operations will be mirrored. - * - * @param Swift_InputByteStream $is - */ - public function bind(Swift_InputByteStream $is) - { - $this->_mirrors[] = $is; - } - - /** - * Remove an already bound stream. - * If $is is not bound, no errors will be raised. - * If the stream currently has any buffered data it will be written to $is - * before unbinding occurs. - * - * @param Swift_InputByteStream $is - */ - public function unbind(Swift_InputByteStream $is) - { - foreach ($this->_mirrors as $k => $stream) - { - if ($is === $stream) - { - unset($this->_mirrors[$k]); - } - } - } - - /** - * Move the internal read pointer to $byteOffset in the stream. - * @param int $byteOffset - * @return boolean - */ - public function setReadPointer($byteOffset) - { - if ($byteOffset > $this->_arraySize) - { - $byteOffset = $this->_arraySize; - } - elseif ($byteOffset < 0) - { - $byteOffset = 0; - } - - $this->_offset = $byteOffset; - } - - /** - * Flush the contents of the stream (empty it) and set the internal pointer - * to the beginning. - */ - public function flushBuffers() - { - $this->_offset = 0; - $this->_array = array(); - $this->_arraySize = 0; - - foreach ($this->_mirrors as $stream) - { - $stream->flushBuffers(); - } - } - -} diff --git a/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php b/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php deleted file mode 100755 index 14773c2..0000000 --- a/h-source/External/swiftmailer/lib/classes/Swift/ByteStream/FileByteStream.php +++ /dev/null @@ -1,177 +0,0 @@ -_path = $path; - $this->_mode = $writable ? 'w+b' : 'rb'; - $this->_quotes = get_magic_quotes_runtime(); - } - - /** - * Get the complete path to the file. - * @return string - */ - public function getPath() - { - return $this->_path; - } - - /** - * Reads $length bytes from the stream into a string and moves the pointer - * through the stream by $length. If less bytes exist than are requested the - * remaining bytes are given instead. If no bytes are remaining at all, boolean - * false is returned. - * @param int $length - * @return string - * @throws Swift_IoException - */ - public function read($length) - { - $fp = $this->_getReadHandle(); - if (!feof($fp)) - { - if ($this->_quotes) - { - set_magic_quotes_runtime(0); - } - $bytes = fread($fp, $length); - if ($this->_quotes) - { - set_magic_quotes_runtime(1); - } - $this->_offset = ftell($fp); - return $bytes; - } - else - { - return false; - } - } - - /** - * Move the internal read pointer to $byteOffset in the stream. - * @param int $byteOffset - * @return boolean - */ - public function setReadPointer($byteOffset) - { - if (isset($this->_reader)) - { - fseek($this->_reader, $byteOffset, SEEK_SET); - } - $this->_offset = $byteOffset; - } - - // -- Private methods - - /** Just write the bytes to the file */ - protected function _commit($bytes) - { - fwrite($this->_getWriteHandle(), $bytes); - $this->_resetReadHandle(); - } - - /** Not used */ - protected function _flush() - { - } - - /** Get the resource for reading */ - private function _getReadHandle() - { - if (!isset($this->_reader)) - { - if (!$this->_reader = fopen($this->_path, 'rb')) - { - throw new Swift_IoException( - 'Unable to open file for reading [' . $this->_path . ']' - ); - } - fseek($this->_reader, $this->_offset, SEEK_SET); - } - return $this->_reader; - } - - /** Get the resource for writing */ - private function _getWriteHandle() - { - if (!isset($this->_writer)) - { - if (!$this->_writer = fopen($this->_path, $this->_mode)) - { - throw new Swift_IoException( - 'Unable to open file for writing [' . $this->_path . ']' - ); - } - } - return $this->_writer; - } - - /** Force a reload of the resource for writing */ - private function _resetWriteHandle() - { - if (isset($this->_writer)) - { - fclose($this->_writer); - $this->_writer = null; - } - } - - /** Force a reload of the resource for reading */ - private function _resetReadHandle() - { - if (isset($this->_reader)) - { - fclose($this->_reader); - $this->_reader = null; - } - } - -} -- cgit v1.2.3