當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。