本文整理汇总了PHP中Streams::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Streams::get方法的具体用法?PHP Streams::get怎么用?PHP Streams::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Streams
的用法示例。
在下文中一共展示了Streams::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Streams_publisher_get
/**
* Used to get list of streams
*
* @param string $params
* publisher id and stream name of existing stream shall be supplied
* @return {void}
* array of streams indexed by names
*/
function Streams_publisher_get($params)
{
// only logged in user can get stream
$user = Users::loggedInUser(true);
$publisherId = Streams::requestedPublisherId(true);
$name = Streams::requestedName(true);
$options = array_merge($_REQUEST, $params);
return Streams::get($user->id, $publisherId, $name, $options);
}
示例2: Streams_category_tool
/**
* This tool generates a category selector.
*
* @param array $options
* An associative array of parameters, containing:
* "publisherId" => Optional. publisherId of the stream to present. If "stream" parameter is empty
* defaults to Streams::requestedPublisherId()
* "name" => Optional. the name of the stream to present. If "stream" parameter is empty
* defaults to Streams::requestedName()
* "stream" => Optional. Object. The stream objects to show categories.
*/
function Streams_category_tool($options)
{
extract($options);
$user = Users::loggedInUser(true);
$userId = $user->id;
// PK of stream to manage categories
$publisherId = Streams::requestedPublisherId(true);
$name = Streams::requestedName(true);
$stream = Streams::get($userId, $publisherId, $name, null, true);
if (!$stream) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => "{publisherId: {$publisherId}, name: {$name}}"));
}
// activate tool frontend
$default = array('publisherId' => $stream->publisherId, 'name' => $stream->name);
$options = array_merge($default, $options);
Q_Response::setToolOptions($options);
// get the list of categories
list($relations, $categories) = Streams::related($userId, $publisherId, $name, true);
return Q::view("Streams/tool/category.php", compact('relations', 'categories', 'stream'));
}
示例3: Streams_get_response_player
/**
* Provide player content to view the stream content
* Uses Streams/$type/get.php view and Streams::get to retrieve stream data
*
**/
function Streams_get_response_player()
{
$user = Users::loggedInUser();
$userId = $user ? $user->id : 0;
$publisherId = Streams::requestedPublisherId(true);
$name = Streams::requestedName(true);
if (substr($name, -1) === '/') {
throw new Q_Exception("Player cannot show multiple streams", compact('publisherId', 'name'));
}
/*
* Get shall return only streams which user is authorized to see.
*/
if (!($stream = Streams::get($userId, $publisherId, $name, null, true))) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => compact('publisherId', 'name')));
}
// join the stream
if ($userId !== 0 && $stream->testWriteLevel('join')) {
Streams_Stream::join($userId, $stream->publisherId, $stream->name);
}
// Let's be nice to poor Windows users
$type = join(DS, explode('/', $stream->type));
return Q::view("Streams/{$type}/get.php", compact('stream', 'userId'));
}