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


PHP Stream类代码示例

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


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

示例1: __construct

 function __construct()
 {
     // extracting notification options for this script
     // if you want other cronjob script use filename like
     // notify_%notification_interval%.php where %notification_interval%
     // is an interval name (we have 4 parameters for this field in DB now:
     // off, hourly, daily, weekly
     // name is case sensitive!
     $filename = explode(DS, __FILE__);
     $filename = end($filename);
     $filename = explode('.', $filename);
     $filename = $filename[0];
     $notification_interval = substr($filename, 7);
     $this->initConnection();
     //get the list of users with hourly notifications
     $users = $this->dbGetCol('SELECT users.id FROM users INNER JOIN preference ON users.id = preference.user_id WHERE preference.preference="notification_interval" AND preference.value="' . $notification_interval . '"');
     foreach ($users as $user_id) {
         $stream = new Stream();
         $stream->getUserNotifications($user_id, $notification_interval);
         $message = '';
         $message = $this->messageFromStream($user_id, $stream);
         if ($message) {
             $message = '<div style="width:450px; border:1px solid #000;"><div style="padding:5px;color:white; background-color:#345270">SlideWiki news stream for the latest week:</div><div style="padding:5px;">' . $message . '</div></div>';
             $this->sendEmailTo($user_id, $message);
         }
     }
 }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:27,代码来源:notify_weekly.php

示例2: activities

 function activities()
 {
     $stream = new Stream();
     $stream->getMainPageStream(50);
     $this->set('stream', $stream);
     $this->set('page_title', 'Latest activities - SlideWiki');
     $this->set('page_keywords', 'SlideWiki, activities, presentations');
 }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:8,代码来源:StaticController.php

示例3: setStream

 /**
  * Set up a new Stream in pool
  *
  * @param Stream $stream
  * @throws Exception
  */
 public function setStream(Stream $stream)
 {
     /** @var $stream Stream */
     if (!$stream->isResource()) {
         throw new Exception("Is not a valid cURL Handle resource", Exception::INVALID_CURL);
     }
     curl_multi_add_handle($this->curl, $stream->getResource());
     $this->streams[$stream->getResource(true)] = $stream;
 }
开发者ID:pulyavin,项目名称:streams,代码行数:15,代码来源:Streamer.php

示例4: testExpectStepsToNextToken

 public function testExpectStepsToNextToken()
 {
     $token1 = new Token(Token::IDENTIFIER, 'foo');
     $token2 = new Token(Token::IDENTIFIER, 'bar');
     $this->mockTokenizer->expects($this->exactly(3))->method('nextToken')->will($this->onConsecutiveCalls($token1, $token2, new Token(Token::EOF)));
     $stream = new Stream($this->mockTokenizer);
     $this->assertSame($token1, $stream->expect(Token::IDENTIFIER, 'foo'));
     $this->assertSame($token2, $stream->expect(Token::IDENTIFIER, 'bar'));
 }
开发者ID:bugadani,项目名称:minty,代码行数:9,代码来源:StreamTest.php

示例5: get_contents

 public function get_contents()
 {
     $data = 'Test';
     $f = new Stream();
     $f->open(STREAM_MODE_WRITE);
     $f->write($data);
     $f->close();
     $this->assertEquals($data, FileUtil::getContents($f));
 }
开发者ID:Gamepay,项目名称:xp-framework,代码行数:9,代码来源:FileUtilTest.class.php

示例6: SaveSize

 function SaveSize()
 {
     $size = new Stream();
     $size->SetByteOrder($this->byteOrder);
     $size->AddInt32($this->size);
     $i = 0;
     for ($i = 0; $i < 4; $i++) {
         $c = ord($size->stream[$i]);
         $this->stream[$i] = chr($c);
     }
 }
开发者ID:49038554,项目名称:Buddy,代码行数:11,代码来源:Stream.php

示例7: readCheckType

 public static function readCheckType(Stream $reader, $expectedType)
 {
     if ($reader instanceof IntReader) {
         $type = $reader->readInt();
     } else {
         $type = self::readIntEndian($reader);
     }
     if ($type != $expectedType) {
         throw new IOException("Expected chunk of type 0x" . dechex($expectedType) . ", read 0x" . dechex($type) . ".");
     }
 }
开发者ID:ralphvanetten,项目名称:php-apk-parser,代码行数:11,代码来源:ReadUtil.php

示例8: activities

 function activities()
 {
     $feed_type = $_GET['output'];
     if (!isset($feed_type)) {
         $feed_type = "RSS1.0";
     }
     //define channel
     $rss = new UniversalFeedCreator();
     $rss->useCached();
     $title = "SlideWiki -- Latest activities";
     $description = "list of latest activities on SlideWiki";
     $link = "http://slidewiki.org/";
     $syndicationURL = "http://slidewiki.aksw.org/feed/activities";
     $rss->title = $title;
     $rss->description = $description;
     $rss->link = $link;
     $rss->syndicationURL = $syndicationURL;
     $stream = new Stream();
     $stream->getMainPageStream(20);
     //channel items/entries
     foreach ($stream->activities as $i => $s) {
         switch ($s->type) {
             case 'created_deck':
                 $s->type = 'created deck';
                 break;
             case 'translated_deck_from':
                 $s->type = 'translated deck';
                 break;
             case 'commented_deck_revision':
                 $s->type = 'commented deck';
                 break;
             case 'followed_deck':
                 $s->type = 'started following deck';
                 break;
             case 'translated_deck':
                 $s->type = 'translated deck';
                 break;
             case 'created_deck_revision':
                 $s->type = 'created deck revision';
                 break;
         }
         $item = new FeedItem();
         $item->title = 'Activity ' . ($i + 1);
         $item->link = "http://slidewiki.org/?url=main/deck_stream&deck=" . $s->object->id;
         $item->description = '<a href="http://slidewiki.org/user/' . $s->subject->id . '">' . $s->subject->username . '</a> ' . $s->type . ' <a href="http://slidewiki.org/deck/' . $s->object->id . '_' . $s->object->slug_title . '">' . $s->object->title . '</a>';
         $item->source = "http://slidewiki.org/";
         $item->date = $s->timestamp;
         $item->author = '';
         $rss->addItem($item);
     }
     //Valid parameters are RSS0.91, RSS1.0, RSS2.0, PIE0.1 (deprecated),
     // MBOX, OPML, ATOM, ATOM1.0, ATOM0.3, HTML, JS
     $rss->outputFeed($feed_type);
 }
开发者ID:TBoonX,项目名称:SlideWiki,代码行数:54,代码来源:FeedController.php

示例9: executeAddWallpost

 public function executeAddWallpost(sfWebRequest $request)
 {
     $message = $request->getPostParameter('message');
     $source_id = $this->getUser()->getAttribute('viewing_profile_id');
     $actor_id = $this->getUser()->getAttribute('id');
     $stream = new Stream();
     $stream->message = $message;
     $stream->actor_id = $actor_id;
     $stream->source_id = $source_id;
     $stream->save();
     $this->redirect('profile/index?uid=' . $source_id);
 }
开发者ID:rsanders16,项目名称:NexusPlus,代码行数:12,代码来源:actions.class.php

示例10: index

 public function index()
 {
     $CRs = new CR($this->db);
     $Actus = new Actu($this->db);
     $Streams = new Stream($this->db);
     $this->f3->set('actus', $Actus->all(10));
     $this->f3->set('streams', $Streams->find(NULL, array('order' => 'twitch_username ASC')));
     $this->f3->set('crs', $CRs->all(10));
     $this->f3->set('site_title', 'Un torrent d\'informations — thetartuffebay.org');
     $this->f3->set('page_head', 'Le premier site d\'information des tartuffes :o');
     $this->f3->set('view', 'home.htm');
 }
开发者ID:XaaT,项目名称:ttb,代码行数:12,代码来源:HomeController.php

示例11: view

 public function view()
 {
     $CR = new CR($this->db);
     $myCr = $CR->byUserName($this->f3->get('PARAMS.name'));
     $this->f3->set('list_cr', $myCr);
     $Stream = new Stream($this->db);
     $this->f3->set('list_stream', $myStream = $Stream->byUserName($this->f3->get('PARAMS.name')));
     if (!count($myCr) && !count($myStream)) {
         $this->f3->error(404);
         //$this->f3->reroute('@home');
     }
     $this->f3->set('site_title', 'Les CRs, Streams, Actus de ' . $this->f3->get('PARAMS.name') . ' | thetartuffebay.org');
     $this->f3->set('view', 'profil/view.htm');
 }
开发者ID:XaaT,项目名称:ttb,代码行数:14,代码来源:ProfilController.php

示例12: server_loop

 function server_loop()
 {
     while (true) {
         $read_fds = $this->fds;
         $write = $exp = null;
         if (stream_select($read_fds, $write, $exp, null)) {
             foreach ($read_fds as $socket) {
                 $socket_id = (int) $socket;
                 if ($socket_id == $this->server_socket_id) {
                     if ($client_socket_id = parent::accept()) {
                         $this->fds[$client_socket_id] = $this->client_sock[$client_socket_id];
                         $this->protocol->onConnect($this, $client_socket_id, 0);
                     }
                 } else {
                     $data = Stream::read($socket, $this->buffer_size);
                     if ($data !== false) {
                         $this->protocol->onReceive($this, $socket_id, 0, $data);
                     } else {
                         $this->close($socket_id);
                     }
                 }
             }
         }
     }
 }
开发者ID:jinguanio,项目名称:swoole_websocket,代码行数:25,代码来源:SelectTCP.php

示例13: testFromPath

 public function testFromPath()
 {
     file_put_contents($path = tempnam(sys_get_temp_dir(), 'whatever'), 'foo');
     $stream = Stream::fromPath($path);
     $this->assertInstanceOf(Stream::class, $stream);
     $this->assertSame('foo', (string) $stream);
 }
开发者ID:innmind,项目名称:filesystem,代码行数:7,代码来源:StreamTest.php

示例14: actionUpdate

 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     $author = $model->author;
     $stream = new Stream();
     if (isset($_POST['Playlists'])) {
         $playlists = $_POST['Playlists'];
         if (isset($_POST['Stream']['url']) && $playlists['type'] == 2) {
             //2 - stream
             $exitstStream = Stream::model()->findByAttributes(array('playlist_id' => $id));
             if (!empty($exitstStream)) {
                 $stream = $exitstStream;
             }
             $stream->attributes = array('playlist_id' => $id, 'url' => $_POST['Stream']['url']);
             $stream->save();
             $playlists['files'] = '';
         } else {
             $stream->deleteAll("`playlist_id` = :playlist_id", array('playlist_id' => $id));
         }
         $model->attributes = $playlists;
         if ($author) {
             $model->author = $author;
         }
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     if (count($model->stream) > 0) {
         $stream = $model->stream[0];
     }
     $this->render('update', array('model' => $model, 'stream' => $stream));
 }
开发者ID:AlexanderKosianchuk,项目名称:rtvgroup,代码行数:37,代码来源:PlaylistsController.php

示例15: getStream

 /**
  * Get stream of the uploaded file
  * @return \Exedra\Http\Stream
  */
 public function getStream()
 {
     if (!$this->stream) {
         $this->stream = Stream::createFromPath($this->path);
     }
     return $this->stream;
 }
开发者ID:rosengate,项目名称:exedra,代码行数:11,代码来源:UploadedFile.php


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