• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP stream_filter_remove函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中stream_filter_remove函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_filter_remove函数的具体用法?PHP stream_filter_remove怎么用?PHP stream_filter_remove使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了stream_filter_remove函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * @param array $opts  Additional options:
  *   - eol: (boolean) If true, normalize EOLs in input. @since 2.2.0
  *   - skipscan: (boolean) If true, don't scan input for
  *               binary/literal/quoted data. @since 2.2.0
  */
 public function __construct($data, array $opts = array())
 {
     /* String data is stored in a stream. */
     $this->_data = new Horde_Stream_Temp();
     $this->_filter = $this->_filterParams();
     if (empty($opts['skipscan'])) {
         stream_filter_register('horde_imap_client_string', 'Horde_Imap_Client_Data_Format_Filter_String');
         $res = stream_filter_append($this->_data->stream, 'horde_imap_client_string', STREAM_FILTER_WRITE, $this->_filter);
     } else {
         $res = null;
     }
     if (empty($opts['eol'])) {
         $res2 = null;
     } else {
         stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
         $res2 = stream_filter_append($this->_data->stream, 'horde_eol', STREAM_FILTER_WRITE);
     }
     $this->_data->add($data);
     if (!is_null($res)) {
         stream_filter_remove($res);
     }
     if (!is_null($res2)) {
         stream_filter_remove($res2);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:String.php


示例2: testCrc32

 public function testCrc32()
 {
     $filter = stream_filter_prepend($this->fp, 'horde_bin2hex', STREAM_FILTER_READ);
     rewind($this->fp);
     $this->assertEquals(bin2hex($this->testdata), stream_get_contents($this->fp));
     stream_filter_remove($filter);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:Bin2hexTest.php


示例3: __construct

 /**
  * @param array $opts  Additional options:
  *   - eol: (boolean) If true, normalize EOLs in input. @since 2.2.0
  *   - skipscan: (boolean) If true, don't scan input for
  *               binary/literal/quoted data. @since 2.2.0
  *
  * @throws Horde_Imap_Client_Data_Format_Exception
  */
 public function __construct($data, array $opts = array())
 {
     /* String data is stored in a stream. */
     $this->_data = new Horde_Stream_Temp();
     if (empty($opts['skipscan'])) {
         $this->_filter = $this->_filterParams();
         stream_filter_register('horde_imap_client_string', 'Horde_Imap_Client_Data_Format_Filter_String');
         $res = stream_filter_append($this->_data->stream, 'horde_imap_client_string', STREAM_FILTER_WRITE, $this->_filter);
     } else {
         $res = null;
     }
     if (empty($opts['eol'])) {
         $res2 = null;
     } else {
         stream_filter_register('horde_eol', 'Horde_Stream_Filter_Eol');
         $res2 = stream_filter_append($this->_data->stream, 'horde_eol', STREAM_FILTER_WRITE);
     }
     $this->_data->add($data);
     if (!is_null($res)) {
         stream_filter_remove($res);
     }
     if (!is_null($res2)) {
         stream_filter_remove($res2);
     }
     if (isset($this->_filter) && $this->_filter->nonascii && !$this instanceof Horde_Imap_Client_Data_Format_String_Support_Nonascii) {
         throw new Horde_Imap_Client_Data_Format_Exception('String contains non-ASCII characters.');
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:36,代码来源:String.php


示例4: doBackup

 protected function doBackup($stream, $tables, $gzip = false)
 {
     $db = Am_Di::getInstance()->db;
     $stream_filter = null;
     $hash = null;
     $len = 0;
     if ($gzip) {
         $hash = hash_init('crc32b');
         // gzip file header
         fwrite($stream, $this->getGzHeader());
         if (!($stream_filter = stream_filter_append($stream, "zlib.deflate", STREAM_FILTER_WRITE, self::COMPRESSION_LEVEL))) {
             throw new Am_Exception_InternalError("Could not attach gzencode filter to output stream");
         }
     }
     $this->out($stream, "### aMember Pro " . AM_VERSION . " database backup\n", $len, $hash);
     $this->out($stream, "### Created: " . date('Y-m-d H:i:s') . "\n", $len, $hash);
     foreach ($tables as $table) {
         $this->out($stream, "\n\nDROP TABLE IF EXISTS {$table};\n", $len, $hash);
         $r = $db->selectRow("SHOW CREATE TABLE {$table}");
         $this->out($stream, $r['Create Table'] . ";\n", $len, $hash);
         $q = $db->queryResultOnly("SELECT * FROM {$table}");
         while ($a = $db->fetchRow($q)) {
             $fields = join(',', array_keys($a));
             $values = join(',', array_map(array($db, 'escape'), array_values($a)));
             $this->out($stream, "INSERT INTO {$table} ({$fields}) VALUES ({$values});\n", $len, $hash);
         }
         $db->freeResult($q);
     }
     if ($stream_filter) {
         stream_filter_remove($stream_filter);
         fwrite($stream, $this->getGzFooter($len, $hash));
     }
     return $stream;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:34,代码来源:BackupProcessor.php


示例5: testNull

 public function testNull()
 {
     $filter = stream_filter_prepend($this->fp, 'horde_null', STREAM_FILTER_READ);
     rewind($this->fp);
     $this->assertEquals('abcdefghij', stream_get_contents($this->fp));
     stream_filter_remove($filter);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:NullTest.php


示例6: __construct

 /**
  */
 public function __construct($data)
 {
     /* String data is stored in a stream. */
     $this->_data = new Horde_Stream_Temp();
     stream_filter_register('horde_imap_client_string', 'Horde_Imap_Client_Data_Format_Filter_String');
     $this->_filter = $this->_filterParams();
     $res = stream_filter_append($this->_data->stream, 'horde_imap_client_string', STREAM_FILTER_WRITE, $this->_filter);
     $this->_data->add($data);
     stream_filter_remove($res);
 }
开发者ID:netcon-source,项目名称:apps,代码行数:12,代码来源:String.php


示例7: testCrc32

 public function testCrc32()
 {
     $params = new stdClass();
     $filter = stream_filter_prepend($this->fp, 'horde_crc32', STREAM_FILTER_READ, $params);
     rewind($this->fp);
     while (fread($this->fp, 1024)) {
     }
     $this->assertObjectHasAttribute('crc32', $params);
     $this->assertEquals(crc32($this->testdata), $params->crc32);
     stream_filter_remove($filter);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:11,代码来源:Crc32Test.php


示例8: test_64166

function test_64166($data)
{
    $fd = fopen('php://temp', 'w+');
    fwrite($fd, $data);
    rewind($fd);
    $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array('line-break-chars' => "\n", 'line-length' => 74));
    var_dump(stream_get_contents($fd, -1, 0));
    stream_filter_remove($res);
    rewind($fd);
    stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array('line-break-chars' => "\n", 'line-length' => 6));
    var_dump(stream_get_contents($fd, -1, 0));
    fclose($fd);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:13,代码来源:bug64166.php


示例9: close

 /**
  * Close this buffer. Flushes this buffer and then calls the close()
  * method on the underlying OuputStream.
  *
  */
 public function close()
 {
     if (!$this->out) {
         return;
     }
     // Remove deflating filter so we can continue writing "raw"
     stream_filter_remove($this->filter);
     // Write GZIP footer:
     // * CRC32    (CRC-32 checksum)
     // * ISIZE    (Input size)
     fwrite($this->out, pack('VV', create(new CRC32($this->md->digest()))->asInt32(), $this->length));
     fclose($this->out);
     $this->out = NULL;
 }
开发者ID:melogamepay,项目名称:xp-framework,代码行数:19,代码来源:GzCompressingOutputStream.class.php


示例10: close

 /**
  * Close this buffer. Flushes this buffer and then calls the close()
  * method on the underlying OuputStream.
  *
  */
 public function close()
 {
     if (!$this->out) {
         return;
     }
     // Remove deflating filter so we can continue writing "raw"
     stream_filter_remove($this->filter);
     $final = hash_final($this->md, true);
     // Write GZIP footer:
     // * CRC32    (CRC-32 checksum)
     // * ISIZE    (Input size)
     fwrite($this->out, pack('aaaaV', $final[3], $final[2], $final[1], $final[0], $this->length));
     fclose($this->out);
     $this->out = null;
     $this->md = null;
 }
开发者ID:xp-framework,项目名称:core,代码行数:21,代码来源:GzCompressingOutputStream.class.php


示例11: getReadFilehandle

 public function getReadFilehandle()
 {
     if (!$this->final_read_fh) {
         $this->flushBuffer();
         stream_filter_remove($this->gz_filter);
         $crc = hash_final($this->file_hash, TRUE);
         // hash_final is a string, not an integer
         fwrite($this->__fh, $crc[3] . $crc[2] . $crc[1] . $crc[0]);
         // need to reverse the hash_final string so it's little endian
         fwrite($this->__fh, pack("V", $this->uncompressed_bytes), 4);
         $this->filesize = ftell($this->__fh);
         rewind($this->__fh);
         $this->final_read_fh = $this->__fh;
     }
     return $this->final_read_fh;
 }
开发者ID:unlox775,项目名称:GZTempFile,代码行数:16,代码来源:GZTempFile.php


示例12: main

function main()
{
    $fname = tempnam('/tmp', 'foo');
    stream_filter_register('ClosingFilter', 'ClosingFilter');
    $f = fopen($fname, 'r+');
    $filter = stream_filter_append($f, 'ClosingFilter', STREAM_FILTER_WRITE);
    fwrite($f, 'foo bar');
    fwrite($f, 'herp derp');
    var_dump('written, removing');
    stream_filter_remove($filter);
    var_dump('removed');
    fwrite($f, 'post filter');
    fclose($f);
    var_dump(file_get_contents($fname));
    unlink($fname);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:user_filter_remove.php


示例13: main

function main()
{
    stream_filter_register('Foo', 'Foo');
    stream_filter_register('Bar', 'Bar');
    $f = fopen('php://memory', 'r+');
    $filter = stream_filter_append($f, 'Foo', STREAM_FILTER_WRITE);
    fwrite($f, 'herp');
    stream_filter_remove($filter);
    rewind($f);
    var_dump(fread($f, 1024));
    $f = fopen('php://memory', 'r+');
    $filter = stream_filter_append($f, 'Bar', STREAM_FILTER_WRITE);
    fwrite($f, 'herp');
    stream_filter_remove($filter);
    rewind($f);
    var_dump(fread($f, 1024));
}
开发者ID:badlamer,项目名称:hhvm,代码行数:17,代码来源:filter_pass_on_feed_me.php


示例14: main

function main()
{
    $fname = tempnam('/tmp', 'foo');
    $in = 'herpderp';
    // Build a large blob that's hard to compress
    for ($i = 0; $i < 1000; ++$i) {
        $in .= md5($in);
    }
    var_dump('input md5: ' . md5($in));
    $f = fopen($fname, 'r+');
    $filter = stream_filter_append($f, 'zlib.deflate', STREAM_FILTER_WRITE);
    foreach (str_split($in, 8096) as $chunk) {
        fwrite($f, $chunk);
    }
    stream_filter_remove($filter);
    var_dump('deflated size: ' . fstat($f)['size']);
    fclose($f);
    $contents = file_get_contents($fname);
    var_dump('deflated contents: ' . md5($contents));
    $f = fopen($fname, 'r+');
    $filter = stream_filter_append($f, 'zlib.inflate', STREAM_FILTER_WRITE);
    foreach (str_split($contents, 8096) as $chunk) {
        var_dump('chunk write: ' . strlen($chunk));
        fwrite($f, $chunk);
    }
    stream_filter_remove($filter);
    var_dump('stream size: ' . fstat($f)['size']);
    rewind($f);
    var_dump('inflated stream size: ' . fstat($f)['size']);
    var_dump('inflated stream md5: ' . md5(fread($f, fstat($f)['size'])));
    fclose($f);
    var_dump('inflated file size: ' . stat($fname)['size']);
    var_dump('inflated file md5: ' . md5(file_get_contents($fname)));
    unlink($fname);
    /* Handy for debugging - should match. Commented out as it's HHVM-only.
    
      $inflator = new __SystemLib\ChunkedInflator();
      $output = '';
      foreach (str_split($contents, 8096) as $chunk) {
        $output .= $inflator->inflateChunk($chunk);
      }
      var_dump('chunkedinflator size: '.strlen($output));
      var_dump('chunkedinflator md5: '.md5($output));
    */
}
开发者ID:RavuAlHemio,项目名称:hhvm,代码行数:45,代码来源:large_chunked_deflate_inflate_filter.php


示例15: test_64166

function test_64166($data)
{
    $fd = fopen('php://temp', 'w+');
    fwrite($fd, $data);
    rewind($fd);
    $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array('line-break-chars' => "\n", 'line-length' => 74));
    $str = "";
    while (($c = fread($fd, 1)) != "") {
        $str .= $c;
    }
    var_dump($str);
    stream_filter_remove($res);
    rewind($fd);
    stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array('line-break-chars' => "\n", 'line-length' => 6));
    $str = "";
    while (($c = fread($fd, 1)) != "") {
        $str .= $c;
    }
    var_dump($str);
    fclose($fd);
}
开发者ID:badlamer,项目名称:hhvm,代码行数:21,代码来源:bug64166_2.php


示例16: _checkEncoding

 /**
  * Checks if the data needs to be encoded like e.g., when outputing binary
  * data in-line during ITEMOPERATIONS requests.
  *
  * @param mixed  $data  The data to check. A string or stream resource.
  * @param string $tag   The tag we are outputing.
  *
  * @return mixed  The encoded data. A string or stream resource with
  *                a filter attached.
  */
 protected function _checkEncoding($data, $tag)
 {
     if ($tag == Horde_ActiveSync_Request_ItemOperations::ITEMOPERATIONS_DATA) {
         // See Bug: 14086. Use a STREAM_FILTER_WRITE and perform the
         // filtering here instead of using the currently broken behavior of
         // PHP when using base64-encode as STREAM_FILTER_READ. feof() is
         // apparently not safe to use when using STREAM_FILTER_READ.
         if (is_resource($data)) {
             $temp = fopen('php://temp/', 'r+');
             $filter = stream_filter_prepend($temp, 'convert.base64-encode', STREAM_FILTER_WRITE);
             rewind($data);
             while (!feof($data)) {
                 fwrite($temp, fread($data, 8192));
             }
             stream_filter_remove($filter);
             rewind($temp);
             return $temp;
         } else {
             return base64_encode($data);
         }
     }
     return $data;
 }
开发者ID:horde,项目名称:horde,代码行数:33,代码来源:AirSyncBaseLocation.php


示例17: EncodeQP

 public function EncodeQP($string, $line_max = 76, $space_conv = false)
 {
     if (function_exists('quoted_printable_encode')) {
         return quoted_printable_encode($string);
     }
     $filters = stream_get_filters();
     if (!in_array('convert.*', $filters)) {
         return $this->EncodeQPphp($string, $line_max, $space_conv);
     }
     $fp = fopen('php://temp/', 'r+');
     $string = preg_replace('/\\r\\n?/', $this->LE, $string);
     $params = array('line-length' => $line_max, 'line-break-chars' => $this->LE);
     $s = stream_filter_append($fp, 'convert.quoted-printable-encode', STREAM_FILTER_READ, $params);
     fputs($fp, $string);
     rewind($fp);
     $out = stream_get_contents($fp);
     stream_filter_remove($s);
     $out = preg_replace('/^\\./m', '=2E', $out);
     fclose($fp);
     return $out;
 }
开发者ID:pengweifu,项目名称:myConfigFiles,代码行数:21,代码来源:Mail.class.php


示例18: _validateBodyData

 /**
  * Validate the body data to ensure consistent EOL and UTF8 data. Returns
  * body data in a stream object.
  *
  * @param array $data  The body data. @see self::_bodyPartText() for
  *                     structure.
  *
  * @return array  The validated body data array. @see self::_bodyPartText()
  */
 protected function _validateBodyData(&$data)
 {
     $stream = new Horde_Stream_Temp(array('max_memory' => 1048576));
     $filter_h = stream_filter_append($stream->stream, 'horde_eol', STREAM_FILTER_WRITE);
     $stream->add(Horde_ActiveSync_Utils::ensureUtf8($data['body'], $data['charset']), true);
     stream_filter_remove($filter_h);
     $data['body'] = $stream;
 }
开发者ID:horde,项目名称:horde,代码行数:17,代码来源:MessageBodyData.php


示例19: removeFilter

 /**
  * Remove a filter
  *
  * @param string $filter   The name of the filter
  * @return  bool   Returns TRUE if the filter was detached, FALSE otherwise
  */
 public function removeFilter($filter)
 {
     $result = false;
     if (!is_resource($filter) && isset($this->_filters[$filter])) {
         $filter = $this->_filters[$filter];
     }
     if (is_resource($filter)) {
         $result = stream_filter_remove($filter);
     }
     return $result;
 }
开发者ID:daodaoliang,项目名称:nooku-framework,代码行数:17,代码来源:abstract.php


示例20: getEncodedStream

 /**
  * if this was created with a stream, return a filtered stream for
  * reading the content. very useful for large file attachments.
  *
  * @param string $EOL
  * @return stream
  * @throws Exception\RuntimeException if not a stream or unable to append filter
  */
 public function getEncodedStream($EOL = Mime::LINEEND)
 {
     if (!$this->isStream) {
         throw new Exception\RuntimeException('Attempt to get a stream from a string part');
     }
     //stream_filter_remove(); // ??? is that right?
     switch ($this->encoding) {
         case Mime::ENCODING_QUOTEDPRINTABLE:
             if (array_key_exists(Mime::ENCODING_QUOTEDPRINTABLE, $this->filters)) {
                 stream_filter_remove($this->filters[Mime::ENCODING_QUOTEDPRINTABLE]);
             }
             $filter = stream_filter_append($this->content, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array('line-length' => 76, 'line-break-chars' => $EOL));
             $this->filters[Mime::ENCODING_QUOTEDPRINTABLE] = $filter;
             if (!is_resource($filter)) {
                 throw new Exception\RuntimeException('Failed to append quoted-printable filter');
             }
             break;
         case Mime::ENCODING_BASE64:
             if (array_key_exists(Mime::ENCODING_BASE64, $this->filters)) {
                 stream_filter_remove($this->filters[Mime::ENCODING_BASE64]);
             }
             $filter = stream_filter_append($this->content, 'convert.base64-encode', STREAM_FILTER_READ, array('line-length' => 76, 'line-break-chars' => $EOL));
             $this->filters[Mime::ENCODING_BASE64] = $filter;
             if (!is_resource($filter)) {
                 throw new Exception\RuntimeException('Failed to append base64 filter');
             }
             break;
         default:
     }
     return $this->content;
 }
开发者ID:yakamoz-fang,项目名称:concrete,代码行数:39,代码来源:Part.php



注:本文中的stream_filter_remove函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP stream_get_contents函数代码示例发布时间:2022-05-23
下一篇:
PHP stream_filter_register函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap