本文整理汇总了PHP中stream_bucket_append函数的典型用法代码示例。如果您正苦于以下问题:PHP stream_bucket_append函数的具体用法?PHP stream_bucket_append怎么用?PHP stream_bucket_append使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stream_bucket_append函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filter
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
if (!empty($this->_previous)) {
$bucket->data = $this->_previous . $bucket->data;
$this->_previous = '';
}
if (!feof($this->stream) && preg_match('/(%[12]\\$|%[12]|%)$/', $bucket->data)) {
$this->_previous .= $bucket->data;
return PSFS_FEED_ME;
}
$consumed += $bucket->datalen;
if (preg_match('/%([12])\\$s/', $bucket->data, $matches)) {
if ($matches[1] == '1') {
$bucket->data = preg_replace('/%1\\$s/', $this->_sender, $bucket->data);
} else {
$bucket->data = preg_replace('/%2\\$s/', $this->_recipient, $bucket->data);
}
}
$bucket->datalen = strlen($bucket->data);
stream_bucket_append($out, $bucket);
}
if (!empty($this->_previous)) {
if ($closing) {
$bucket = stream_bucket_new($this->stream, $this->_previous);
$bucket->data = $this->_previous;
$consumed += strlen($this->_previous);
$this->_previous = '';
stream_bucket_append($out, $bucket);
}
}
return PSFS_PASS_ON;
}
开发者ID:raz0rsdge,项目名称:horde,代码行数:33,代码来源:AddressFilter.php
示例2: filter
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$this->data .= $bucket->data;
$this->bucket = $bucket;
$consumed = 0;
}
if ($closing) {
$consumed += strlen($this->data);
if (isset($this->bucket)) {
$bucket = $this->bucket;
} else {
$bucket = stream_bucket_new($this->stream, '');
}
$f = self::$registry[get_class($this)];
AbstractStreamProcessor__lazyUriResolver::bind($this->stream, $f->uri);
$bucket->data = $f->process($this->data);
$bucket->datalen = strlen($bucket->data);
stream_bucket_append($out, $bucket);
$this->bucket = null;
$this->data = '';
return PSFS_PASS_ON;
}
return PSFS_FEED_ME;
}
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:25,代码来源:AbstractStreamProcessor.php
示例3: filter
public function filter($in, $out, &$consumed, $closing) : int
{
while ($bucket = stream_bucket_make_writeable($in)) {
stream_bucket_append($out, stream_bucket_new($this->stream, str_rot13($bucket->data)));
}
return \PSFS_PASS_ON;
}
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:7,代码来源:default-filters.php
示例4: filter
/**
* The main filter method.
* Implemented according to \php_user_filter class. Will loop over all stream buckets, buffer them and perform
* the needed actions.
*
* @param resource $in Incoming bucket brigade we need to filter
* @param resource $out Outgoing bucket brigade with already filtered content
* @param integer $consumed The count of altered characters as buckets pass the filter
* @param boolean $closing Is the stream about to close?
*
* @throws \Exception
* @throws \PHPParser_Error
*
* @return integer
*
* @link http://www.php.net/manual/en/php-user-filter.filter.php
*
* TODO The buffering does not work that well, maybe we should implement universal buffering within parent class!
*/
public function filter($in, $out, &$consumed, $closing)
{
// Get our buckets from the stream
$buffer = '';
while ($bucket = stream_bucket_make_writeable($in)) {
$buffer .= $bucket->data;
// Tell them how much we already processed, and stuff it back into the output
$consumed += $bucket->datalen;
// Save a bucket for later reuse
$bigBucket = $bucket;
}
// Beautify all the buckets!
$parser = new \PHPParser_Parser(new \PHPParser_Lexer());
$prettyPrinter = new \PHPParser_PrettyPrinter_Default();
try {
// parse
$stmts = $parser->parse($buffer);
$data = '<?php ' . $prettyPrinter->prettyPrint($stmts);
} catch (PHPParser_Error $e) {
throw $e;
}
// Refill the bucket with the beautified data
// Do not forget to set the length!
$bigBucket->data = $data;
$bigBucket->datalen = strlen($data);
// Only append our big bucket
stream_bucket_append($out, $bigBucket);
return PSFS_PASS_ON;
}
开发者ID:techdivision,项目名称:php-by-contract,代码行数:48,代码来源:BeautifyFilter.php
示例5: filter
/**
* Filter some data.
*
* @param resource $in Read from this input stream
* @param resource $out Write to this output stream
* @param int $consumed Count of bytes processed
* @param bool $closing Is the input about to end?
*
* @return int PSFS_PASS_ON / PSFS_FEED_ME / PSFS_ERR_FATAL
*/
public function filter($in, $out, &$consumed, $closing) : int
{
$return = PSFS_FEED_ME;
// While input data is available, continue to read it.
while ($bucket_in = stream_bucket_make_writeable($in)) {
$this->data .= $bucket_in->data;
$consumed += $bucket_in->datalen;
// While we have complete GEDCOM records, process them.
while (preg_match('/(.*?[\\r\\n]\\s*)(0.*)/s', $this->data, $match) === 1) {
list(, $data, $this->data) = $match;
// Send this record output.
$data = $this->filterData($data);
$bucket_out = stream_bucket_new($this->stream, $data);
$return = PSFS_PASS_ON;
stream_bucket_append($out, $bucket_out);
}
}
// Process the final record.
if ($closing && $this->data !== '') {
$data = $this->filterData($this->data);
$bucket_out = stream_bucket_new($this->stream, $data);
$return = PSFS_PASS_ON;
stream_bucket_append($out, $bucket_out);
}
return $return;
}
开发者ID:fisharebest,项目名称:lib-gedcom,代码行数:36,代码来源:AbstractGedcomFilter.php
示例6: filter
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:bug46164-1.php
示例7: filter
function filter($in, $out, &$consumed, $closing)
{
if (!$closing) {
$bucket = stream_bucket_new($this->stream, "42");
stream_bucket_append($out, $bucket);
}
return PSFS_ERR_FATAL;
}
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:filter_errors_user.php
示例8: filter
function filter($in, $out, &$consumed, $closing)
{
while ($ib = stream_bucket_make_writeable($in)) {
$ob = stream_bucket_new($this->stream, strtoupper($ib->data));
stream_bucket_append($out, $ob);
}
return PSFS_PASS_ON;
}
开发者ID:badlamer,项目名称:hhvm,代码行数:8,代码来源:user_filter_order.php
示例9: filter
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = preg_replace(self::$pattern, '', $bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:spress,项目名称:spress-import,代码行数:9,代码来源:ValidUtf8XmlFilter.php
示例10: filter
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$consumed += $bucket->datalen;
$bucket->data = call_user_func($this->params["func"], $this, $bucket->data, $closing);
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:m6w6,项目名称:atick,代码行数:9,代码来源:Filter.php
示例11: filter
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = preg_replace("/[\r\n]+\$/", "\r\n", $bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:ChigusaYasoda,项目名称:ec-cube,代码行数:9,代码来源:Lf2crlfFilter.php
示例12: filter
/**
* Filter implementation converts encoding before returning PSFS_PASS_ON.
*
* @param resource $in
* @param resource $out
* @param int $consumed
* @param bool $closing
* @return int
*/
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = mb_convert_encoding($bucket->data, 'UTF-8', $this->charset);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:surebert,项目名称:MailMimeParser,代码行数:18,代码来源:CharsetStreamFilter.php
示例13: filter
/**
* @see stream_filter_register()
*/
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = str_replace($this->_search, $this->_replace, $bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:evltuma,项目名称:moodle,代码行数:12,代码来源:Null.php
示例14: filter_impl
function filter_impl($in, $out)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = strtoupper($bucket->data) . $bucket->data;
$consumed += $bucket->datalen;
$bucket->datalen *= 2;
stream_bucket_append($out, $bucket);
}
}
开发者ID:badlamer,项目名称:hhvm,代码行数:9,代码来源:user_filter_bad_return_type.php
示例15: filter
/**
* Collect intercepted data
*
* @param resource $in
* @param resource $out
* @param int $consumed
* @param bool $closing
* @return int
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.ShortVariable)
*/
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
self::$_collectedData .= $bucket->data;
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:relue,项目名称:magento2,代码行数:21,代码来源:OutputBambooTest.php
示例16: filter
public function filter($in, $out, &$consumed, $closing)
{
while ($res = stream_bucket_make_writeable($in)) {
$res->data = @mb_convert_encoding($res->data, $this->encoding_to, $this->encoding_from);
$consumed += $res->datalen;
stream_bucket_append($out, $res);
}
return PSFS_PASS_ON;
}
开发者ID:arvenil,项目名称:csv,代码行数:9,代码来源:FilterTranscode.php
示例17: filter
/**
* @param $in
* @param $out
* @param $consumed
* @param $closing
*
* @return int|void
*
* @link http://stackoverflow.com/a/3466609/372654
*/
function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = preg_replace('/[^\\x{0009}\\x{000a}\\x{000d}\\x{0020}-\\x{D7FF}\\x{E000}-\\x{FFFD}]+/u', '', $bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:halilim,项目名称:xml-iterator,代码行数:19,代码来源:Utf8Filter.php
示例18: filter
/**
* @see stream_filter_register()
*/
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$consumed += $bucket->datalen;
$this->params->crc32 = $this->_crc32Combine($this->params->crc32, crc32($bucket->data), $bucket->datalen);
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:netcon-source,项目名称:apps,代码行数:12,代码来源:Crc32.php
示例19: filter
public function filter($in, $out, &$consumed, $closing)
{
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = $this->handler->convert($bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:duncan3dc,项目名称:bom-string,代码行数:9,代码来源:StreamFilter.php
示例20: filter
public function filter($in, $out, &$consumed, $closing)
{
printf("filtering\n");
while ($bucket = stream_bucket_make_writeable($in)) {
$bucket->data = strtoupper($bucket->data);
$consumed += $bucket->datalen;
stream_bucket_append($out, $bucket);
}
return PSFS_PASS_ON;
}
开发者ID:badlamer,项目名称:hhvm,代码行数:10,代码来源:user_filter_autoload.php
注:本文中的stream_bucket_append函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论