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


PHP stream_filter_register函数代码示例

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


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


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