当前位置: 首页>>代码示例>>PHP>>正文


PHP stream_filter_remove函数代码示例

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


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


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