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

PHP stream_filter_register函数代码示例

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

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



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

示例1: runGiven

 /**
  * Handle a "given" step.
  *
  * @param array  &$world    Joined "world" of variables.
  * @param string $action    The description of the step.
  * @param array  $arguments Additional arguments to the step.
  *
  * @return mixed The outcome of the step.
  */
 public function runGiven(&$world, $action, $arguments)
 {
     switch ($action) {
         case 'an incoming message on host':
             $world['hostname'] = $arguments[0];
             $world['type'] = 'Incoming';
             break;
         case 'the SMTP sender address is':
             $world['sender'] = $arguments[0];
             break;
         case 'the SMTP recipient address is':
             $world['recipient'] = $arguments[0];
             break;
         case 'the client address is':
             $world['client'] = $arguments[0];
             break;
         case 'the hostname is':
             $world['hostname'] = $arguments[0];
             break;
         case 'the unmodified message content is':
             $world['infile'] = $arguments[0];
             $world['fp'] = fopen($world['infile'], 'r');
             break;
         case 'the modified message template is':
             $world['infile'] = $arguments[0];
             $world['fp'] = fopen($world['infile'], 'r');
             stream_filter_register('addresses', 'Horde_Kolab_Filter_Helper_AddressFilter');
             stream_filter_append($world['fp'], 'addresses', STREAM_FILTER_READ, array('recipient' => $world['recipient'], 'sender' => $world['sender']));
             break;
         default:
             return $this->notImplemented($action);
     }
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:42,代码来源:StoryTestCase.php


示例2: main

function main()
{
    stream_filter_register('test.md5', 'Md5Filter');
    stream_filter_register('test.ucase', 'UpperCaseFilter');
    doTest('stream_filter_append');
    doTest('stream_filter_prepend');
}
开发者ID:badlamer,项目名称:hhvm,代码行数:7,代码来源:user_filter_order.php


示例3: setup

 public function setup()
 {
     stream_filter_register('horde_crc32', 'Horde_Stream_Filter_Crc32');
     $this->testdata = str_repeat("0123456789ABCDE", 1000);
     $this->fp = fopen('php://temp', 'r+');
     fwrite($this->fp, $this->testdata);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:Crc32Test.php


示例4: setup

 public function setup()
 {
     stream_filter_register('horde_null', 'Horde_Stream_Filter_Null');
     $this->testdata = "abcdefghij";
     $this->fp = fopen('php://temp', 'r+');
     fwrite($this->fp, $this->testdata);
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:7,代码来源:NullTest.php


示例5: register

 /**
  * Attaches the current filter to a stream.
  *
  * @return bool true on success or false on failure.
  */
 public function register()
 {
     if (!$this->isRegistered) {
         $this->isRegistered = stream_filter_register(static::NAME, get_called_class());
     }
     return $this->isRegistered;
 }
开发者ID:migros,项目名称:php-vcr,代码行数:12,代码来源:AbstractCodeTransform.php


示例6: register_default_stream_filters

function register_default_stream_filters()
{
    \stream_filter_register('zlib.deflate', '__SystemLib\\DeflateStreamFilter');
    \stream_filter_register('zlib.inflate', '__SystemLib\\InflateStreamFilter');
    \stream_filter_register('string.rot13', '__SystemLib\\StringRot13StreamFilter');
    \stream_filter_Register('string.toupper', '__SystemLib\\StringToUpperStreamFilter');
    \stream_filter_Register('string.tolower', '__SystemLib\\StringToLowerStreamFilter');
}
开发者ID:jeremyadoux,项目名称:hhvm,代码行数:8,代码来源:default-filters.php


示例7: setUp

 public function setUp()
 {
     // register filter
     $filters = stream_get_filters();
     if (!in_array('crypto.filter', $filters)) {
         stream_filter_register('crypto.filter', 'Fruit\\CryptoKit\\CryptoFilter');
     }
 }
开发者ID:Ronmi,项目名称:fruit-cryptokit,代码行数:8,代码来源:CryptoFilterTest.php


示例8: registerModules

 /**
  * Register Influence loader and filter.
  */
 private function registerModules()
 {
     $loaders = spl_autoload_functions();
     foreach ($loaders as $loader) {
         spl_autoload_unregister($loader);
     }
     spl_autoload_register([$this, 'loadClass']);
     stream_filter_register('influence.reader', 'Influence\\Filter');
 }
开发者ID:komex,项目名称:influence,代码行数:12,代码来源:Influence.php


示例9: sgregister

function sgregister()
{
    static $registered = null;
    if ($registered === null) {
        $registered = 'stream-callback';
        stream_filter_register($registered, 'CallbackFilter');
    }
    return $registered;
}
开发者ID:Finzy,项目名称:stageDB,代码行数:9,代码来源:FilterFns.php


示例10: register

 /**
  * Register the stream filter
  *
  * @return bool
  */
 public static function register()
 {
     $result = false;
     $name = self::getName();
     if (!empty($name) && !in_array($name, stream_get_filters())) {
         $result = stream_filter_register(self::getName(), get_called_class());
     }
     return $result;
 }
开发者ID:janssit,项目名称:www.rvproductions.be,代码行数:14,代码来源:abstract.php


示例11: register

 /**
  * Register this class as a stream filter
  * @throws \RuntimeException
  */
 public static function register()
 {
     if (self::$hasBeenRegistered === true) {
         return;
     }
     if (stream_filter_register(self::getFilterName(), __CLASS__) === false) {
         throw new RuntimeException('Failed to register stream filter: ' . self::getFilterName());
     }
     self::$hasBeenRegistered = true;
 }
开发者ID:rseabra,项目名称:TeamPass,代码行数:14,代码来源:ConvertMbstringEncoding.php


示例12: register

 static function register($filter = null, $class = null)
 {
     if (empty($filter)) {
         $filter = empty($class) ? new static() : new $class();
     }
     $class = get_class($filter);
     self::$registry[$class] = $filter;
     stream_filter_register($class, $class);
     return $filter->filterPrefix = 'php://filter/read=' . $class . '/resource=';
 }
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:10,代码来源:AbstractStreamProcessor.php


示例13: testBodyFilter

 /**
  * @dataProvider bodyFilterProvider()
  */
 public function testBodyFilter($data, $result)
 {
     $params = new stdClass();
     $stream = fopen('php://temp', 'r+');
     stream_filter_register('horde_smtp_body', 'Horde_Smtp_Filter_Body');
     stream_filter_append($stream, 'horde_smtp_body', STREAM_FILTER_WRITE, $params);
     fwrite($stream, $data);
     fclose($stream);
     $this->assertEquals($result, $params->body);
 }
开发者ID:horde,项目名称:horde,代码行数:13,代码来源:FilterBodyTest.php


示例14: testUserFilter

 public function testUserFilter()
 {
     stream_filter_register("strtoupper", "strtoupper_filter");
     $fp = fopen("php://memory", 'r+');
     stream_filter_append($fp, "strtoupper");
     fputs($fp, "test\n");
     rewind($fp);
     $contents = stream_get_contents($fp);
     $this->assertEquals("TEST\n", $contents);
 }
开发者ID:pixlr,项目名称:ZCE-2,代码行数:10,代码来源:StreamsTest.php


示例15: testFilterHandlesBrokenParameter

 /**
  * @dataProvider provideBrokenParameters
  */
 public function testFilterHandlesBrokenParameter($param)
 {
     $fp = fopen('php://memory', 'w+');
     $append = "hello {$param}\n";
     fputs($fp, str_repeat('a', 16384 - strlen($append)) . $append . str_repeat('test', 300));
     rewind($fp);
     stream_filter_register('addresses', 'Horde_Kolab_Filter_Helper_AddressFilter');
     stream_filter_append($fp, 'addresses');
     fread($fp, 16384 - strlen($append));
     $this->assertEquals("hello {$param}\n", fread($fp, strlen($append)));
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:14,代码来源:AddressFilter.php


示例16: register

 /**
  * Register current loader as stream filter in PHP
  *
  * @param string $filterId Identifier for the filter
  * @throws \RuntimeException If registration was failed
  */
 public static function register($filterId = self::FILTER_IDENTIFIER)
 {
     if (!empty(self::$filterId)) {
         throw new \RuntimeException('Stream filter already registered');
     }
     $result = stream_filter_register($filterId, __CLASS__);
     if (!$result) {
         throw new \RuntimeException('Stream filter was not registered');
     }
     self::$filterId = $filterId;
 }
开发者ID:latamautos,项目名称:goaop,代码行数:17,代码来源:SourceTransformingLoader.php


示例17: register_default_stream_filters

function register_default_stream_filters()
{
    \stream_filter_register('zlib.deflate', '__SystemLib\\DeflateStreamFilter');
    \stream_filter_register('zlib.inflate', '__SystemLib\\InflateStreamFilter');
    \stream_filter_register('string.rot13', '__SystemLib\\StringRot13StreamFilter');
    \stream_filter_Register('string.toupper', '__SystemLib\\StringToUpperStreamFilter');
    \stream_filter_Register('string.tolower', '__SystemLib\\StringToLowerStreamFilter');
    \stream_filter_Register('convert.iconv.*', '__SystemLib\\ConvertIconvFilter');
    \stream_filter_Register('convert.*', '__SystemLib\\ConvertFilter');
    \stream_filter_Register('bzip2.*', '__SystemLib\\Bzip2Filter');
}
开发者ID:ezoic,项目名称:hhvm,代码行数:11,代码来源:default-filters.php


示例18: __construct

 public function __construct(MessageFactoryInterface $messageFactory, $entrypoint, $context = null, $useTls = null)
 {
     if ($context === null) {
         $context = stream_context_create();
     }
     $this->entrypoint = $entrypoint;
     $this->messageFactory = $messageFactory;
     $this->context = $context;
     $this->useTls = $useTls;
     stream_filter_register('chunk', '\\Docker\\Http\\Stream\\Filter\\Chunk');
     stream_filter_register('event', '\\Docker\\Http\\Stream\\Filter\\Event');
 }
开发者ID:schmunk42,项目名称:docker-php,代码行数:12,代码来源:DockerAdapter.php


示例19: main

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


示例20: escapeStream

 /**
  * Return the escaped string as a stream.
  *
  * @return resource  The IMAP escaped stream.
  */
 public function escapeStream()
 {
     if ($this->literal()) {
         throw new Horde_Imap_Client_Data_Format_Exception('String requires literal to output.');
     }
     rewind($this->_data->stream);
     $stream = new Horde_Stream_Temp();
     $stream->add($this->_data, true);
     stream_filter_register('horde_imap_client_string_quote', 'Horde_Imap_Client_Data_Format_Filter_Quote');
     stream_filter_append($stream->stream, 'horde_imap_client_string_quote', STREAM_FILTER_READ);
     return $stream->stream;
 }
开发者ID:netcon-source,项目名称:apps,代码行数:17,代码来源:String.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP stream_filter_remove函数代码示例发布时间:2022-05-23
下一篇:
PHP stream_filter_prepend函数代码示例发布时间: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