本文整理汇总了PHP中Streams类的典型用法代码示例。如果您正苦于以下问题:PHP Streams类的具体用法?PHP Streams怎么用?PHP Streams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Streams类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Streams_invitations_response
/**
* Displays an HTML document that can be printed, ideally with line breaks.
* Uses a particular view for the layout.
* @param {array} $_REQUEST
* @param {string} $_REQUEST.invitingUserId Required. The id of the user that generated the invitations with a call to Streams::invite.
* @param {string} $_REQUEST.batch Required. The name of the batch under which invitations were saved during a call to Streams::invite.
* @param {string} [$_REQUEST.limit=100] The maximum number of invitations to show on the page
* @param {string} [$_REQUEST.offset=0] Used for paging
* @param {string} [$_REQUEST.title='Invitations'] Override the title of the document
* @param {string} [$_REQUEST.layout='default'] The name of the layout to use for the HTML document
* @see Users::addLink()
*/
function Streams_invitations_response()
{
Q_Request::requireFields(array('batch', 'invitingUserId'), true);
$invitingUserId = $_REQUEST['invitingUserId'];
$batch = $_REQUEST['batch'];
$title = Q::ifset($_REQUEST, 'layout', 'title');
$layoutKey = Q::ifset($_REQUEST, 'layout', 'default');
$limit = min(1000, Q::ifset($_REQUEST, 'limit', 100));
$offset = Q::ifset($_REQUEST, 'offset', 0);
$layout = Q_Config::expect('Streams', 'invites', 'layout', $layoutKey);
$app = Q_Config::expect('Q', 'app');
$pattern = Streams::invitationsPath($invitingUserId) . DS . $batch . DS . "*.html";
$filenames = glob($pattern);
$parts = array();
foreach ($filenames as $f) {
if (--$offset > 0) {
continue;
}
$parts[] = file_get_contents($f);
if (--$limit == 0) {
break;
}
}
$content = implode("\n\n<div class='Q_pagebreak Streams_invitations_separator'></div>\n\n", $parts);
echo Q::view($layout, compact('content', 'parts'));
return false;
}
开发者ID:atirjavid,项目名称:Platform,代码行数:39,代码来源:response.php
示例2: Streams_category_response_player
/**
* Provide player content to view the members of category listing
* Uses Streams/$type/category.php view (Streams/$streamType/category/get.php can be used for viewing the category
* stream itself if type of category is $streamType/category)
* and Streams::related to retrieve streams data
*
**/
function Streams_category_response_player()
{
$user = Users::loggedInUser();
$userId = $user ? $user->id : 0;
// These are PK of the category!
$publisherId = Streams::requestedPublisherId(true);
$name = Streams::requestedName(true);
// need to know publisher and type of the streams to list
$streamType = Streams::requestedType();
if ($streamType) {
$prefix = "{$streamType}/";
}
$stream_publisherId = Q::expect('Streams', $streamType, 'publisher');
if (substr($name, -1) === '/') {
throw new Q_Exception("Player cannot show listing for multiple categories", compact('publisherId', 'name'));
}
/*
* Get shall return only streams which user is authorized to see.
*/
$categories = Streams::fetch($userId, $publisherId, $name);
if (empty($categories)) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => compact('publisherId', 'name')));
}
$category = reset($categories);
// Are you authorized to see category content?
if (!$category->testReadLevel('content')) {
throw new Users_Exception_NotAuthorized();
}
// get all the streams which are members of this category
// as Streams::get verifies access rights, it's safe to show all streams' content
list($relations, $streams) = Streams::related($userId, $publisherId, $name, true, array('prefix' => $prefix, 'skipAccess' => true));
Q::view("Stream/{$type}/category.php", compact('relations', 'streams', 'userId'));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:40,代码来源:player.php
示例3: Streams_related_post
/**
* Used to create a new relation
*
* @param array $_REQUEST
* toPublisherId, toStreamName, type
* fromPublisherId, fromStreamName, weight
* @return {void}
*/
function Streams_related_post($params)
{
$user = Users::loggedInUser(true);
$asUserId = $user->id;
$toPublisherId = $_REQUEST['toPublisherId'];
$toStreamName = $_REQUEST['toStreamName'];
$type = $_REQUEST['type'];
$fromPublisherId = $_REQUEST['fromPublisherId'];
$fromStreamName = $_REQUEST['fromStreamName'];
// TODO: When we start supporting multiple hosts, this will have to be rewritten
// to make servers communicate with one another when establishing relations between streams
if (!($stream = Streams::fetch($asUserId, $toPublisherId, $toStreamName))) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with those fields'), array('publisherId', 'name'));
}
if (!($stream = Streams::fetch($asUserId, $fromPublisherId, $fromStreamName))) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with those fields'), array('fromPublisherId', 'from_name'));
}
$weight = "+1";
if (isset($_REQUEST['weight'])) {
if (!$stream->testWriteLevel('relations')) {
throw new Users_Exception_NotAuthorized();
}
$weight = $_REQUEST['weight'];
}
$result = Streams::relate($asUserId, $toPublisherId, $toStreamName, $type, $fromPublisherId, $fromStreamName, compact('weight'));
Q_Response::setSlot('result', $result);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:35,代码来源:post.php
示例4: __construct
/**
* Constructor
*
* @param io.streams.InputStream in
*/
public function __construct(InputStream $in)
{
$this->in = Streams::readableFd($in);
if (!stream_filter_append($this->in, 'bzip2.decompress', STREAM_FILTER_READ)) {
throw new \io\IOException('Could not append stream filter');
}
}
开发者ID:xp-framework,项目名称:core,代码行数:12,代码来源:Bz2DecompressingInputStream.class.php
示例5: Streams_stream_response_data
function Streams_stream_response_data()
{
// happens only during non-GET requests
if (isset(Streams::$cache['removed_count'])) {
return array('removed_count' => Streams::$cache['removed_count']);
}
if (isset(Streams::$cache['result'])) {
return Streams::$cache['result'];
}
if (isset(Streams::$cache['stream'])) {
$user = Users::loggedInUser();
$userId = $user ? $user->id : "";
return Streams::$cache['stream']->exportArray(array('asUserId' => $userId));
}
$publisherId = Streams::requestedPublisherId(true);
$name = Streams::requestedName(true);
$fields = Streams::requestedFields();
$user = Users::loggedInUser();
$userId = $user ? $user->id : 0;
$streams = array();
foreach (Streams::fetch($userId, $publisherId, $name, $fields) as $key => $stream) {
$streams[$key] = $stream->exportArray(array('asUserId' => $userId));
if ($userId && !empty($_REQUEST['join'])) {
$stream->join();
// NOTE: one of the rare times we may change state in a response handler
}
}
return Streams::$cache['result'] = array('stream' => empty($streams) ? null : reset($streams));
}
开发者ID:dmitriz,项目名称:Platform,代码行数:29,代码来源:data.php
示例6: Websites_seo_post
function Websites_seo_post()
{
if (empty($_REQUEST['streamName'])) {
throw new Q_Exception_RequiredField(array('field' => 'streamName'));
}
$prefix = "Websites/seo/";
if (substr($_REQUEST['streamName'], 0, strlen($prefix)) !== $prefix) {
throw new Q_Exception_WrongValue(array('field' => 'streamName', 'range' => "string beginning with {$prefix}"));
}
$user = Users::loggedInUser(true);
$publisherId = Users::communityId();
$type = "Websites/seo";
if (!Streams::isAuthorizedToCreate($user->id, $publisherId, $type)) {
throw new Users_Exception_NotAuthorized();
}
$stream = new Streams_Stream($publisherId);
$stream->publisherId = $publisherId;
$stream->name = $_REQUEST['streamName'];
$stream->type = $type;
if (isset($_REQUEST['uri'])) {
$stream->setAttribute('uri', $_REQUEST['uri']);
}
$stream->save();
$stream->post($user->id, array('type' => 'Streams/created', 'content' => '', 'instructions' => Q::json_encode($stream->toArray())), true);
$stream->subscribe();
// autosubscribe to streams you yourself create, using templates
Q_Response::setSlot('stream', $stream->exportArray());
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:28,代码来源:post.php
示例7: Streams_invite_response_data
function Streams_invite_response_data()
{
if (isset(Streams::$cache['invited'])) {
return Streams::$cache['invited'];
}
$user = Users::loggedInUser(true);
$publisherId = Streams::requestedPublisherId();
$streamType = Streams::requestedType();
$invitingUserId = Streams::requestedField('invitingUserId');
$limit = Q::ifset($_REQUEST, 'limit', Q_Config::get('Streams', 'invites', 'limit', 100));
$invited = Streams_Invited::select('*')->where(array('userId' => $user->id, 'state' => 'pending', 'expireTime <' => new Db_Expression('CURRENT_TIMESTAMP')))->limit($limit)->fetchDbRows(null, null, 'token');
$query = Streams_Invite::select('*')->where(array('token' => array_keys($invited)));
if (isset($publisherId)) {
$query = $query->where(array('publisherId' => $publisherId));
}
if (isset($streamType)) {
$query = $query->where(array('streamName' => new Db_Range($streamType . '/', true, false, true)));
}
if (isset($invitingUserId)) {
$query = $query->where(array('invitingUserId' => $invitingUserId));
}
$invites = $query->fetchDbRows();
$streams = array();
foreach ($invites as $invite) {
$stream = new Streams_Stream();
$stream->publisherId = $invite->publisherId;
$stream->name = $invite->streamName;
if ($stream->retrieve()) {
$streams[$invite->token] = $stream->exportArray();
$streams[$invite->token]['displayName'] = $invite->displayName;
}
}
return compact('streams', 'invites');
}
开发者ID:dmitriz,项目名称:Platform,代码行数:34,代码来源:data.php
示例8: Shipping_scheduled_response_content
function Shipping_scheduled_response_content($params)
{
// redirect to home page if not logged in
if (!Users::loggedInUser()) {
header("Location: " . Q_Request::baseUrl());
exit;
}
// get "Shipping/shipments" stream
$publisherId = Users::communityId();
$streamName = 'Shipping/shipment/' . Q_Request::uri()->shipmentStreamName;
$stream = Streams::fetchOne($publisherId, $publisherId, $streamName);
//$xml = simplexml_load_file(APP_DIR.'/classes/dhl/response.xml');
//$xml = simplexml_load_string(str_replace('req:', '', file_get_contents(APP_DIR.'/classes/dhl/response.xml')));
//print_r($xml); exit;
// test pickup
//$carrier = new Shipping_Carrier_DHL();
//$carrier->createAWBBarCode($stream, 'iVBORw0KGgoAAAANSUhEUgAAAYwAAABeAQMAAAAKdrGZAAAABlBMVEX///8AAABVwtN+AAAAaklEQVR42mNkYGBIyL8wZcutG2wTzVMZfG99eep7y1tp5oIokaMMOtabG6PuTflrnnHqVfI013vzlRYwMDAxkAxGtYxqGdUyqmVUy6iWUS2jWka1jGoZ1TKqZVTLqJZRLaNaRrWMaiEVAABqDRe8DYfcJgAAAABJRU5ErkJggg==', "AWBBarCode");
// -----------
//echo Shipping::getShipmentRelation($stream, true);
//unlink("/tmp/dhl-api-autoload.php");
if (!$stream || !$stream->testReadLevel('see')) {
throw new Users_Exception_NotAuthorized();
}
return Q::view('Shipping/content/scheduled.php', compact('streamName'));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:25,代码来源:content.php
示例9: Streams_participant_response_participant
function Streams_participant_response_participant()
{
if (isset(Streams::$cache['participant'])) {
return Streams::$cache['participant'];
}
$publisherId = Streams::requestedPublisherId(true);
$streamName = Streams::requestedName(true);
if (empty($_REQUEST['userId'])) {
throw new Q_Exception_RequiredField(array('field' => 'userId'));
}
$user = Users::loggedInUser();
$userId = $user ? $user->id : "";
$stream = Streams::fetch($userId, $publisherId, $streamName);
if (empty($stream)) {
throw new Q_Exception_MissingRow(array('table' => 'Stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
}
$stream = reset($stream);
if (!$stream->testReadLevel('participants')) {
throw new Users_Exception_NotAuthorized();
}
$p = new Streams_Participant();
$p->publisherId = $publisherId;
$p->streamName = $streamName;
$p->userId = $_REQUEST['userId'];
if ($p->retrieve()) {
return $p->exportArray();
}
return null;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:29,代码来源:participant.php
示例10: __construct
/**
* Constructor
*
* @param io.streams.InputStream in
*/
public function __construct(InputStream $in)
{
$this->in = Streams::readableFd($in);
if (!stream_filter_append($this->in, 'zlib.inflate', STREAM_FILTER_READ)) {
throw new IOException('Could not append stream filter');
}
}
开发者ID:melogamepay,项目名称:xp-framework,代码行数:12,代码来源:InflatingInputStream.class.php
示例11: Websites_seo_tool
/**
* Tool for admins to edit the url, title, keywords, description of the current page
* @class Websites seo
* @constructor
* @param {Object} [$options] Options for the tool
* @param {String} [$options.skipIfNotAuthorized=true] Whether to skip rendering the contents of the tool if the logged-in user is not authorized to edit the SEO information for this page.
*/
function Websites_seo_tool($options)
{
$skipIfNotAuthorized = Q::ifset($options, 'skipIfNotAuthorized', true);
if ($skipIfNotAuthorized) {
$websitesUserId = Users::communityId();
$sha1 = sha1(Q_Dispatcher::uri());
$seoStreamName = "Websites/seo/{$sha1}";
$stream = Streams::fetchOne(null, $websitesUserId, $seoStreamName);
$user = Users::loggedInUser();
if (!$user or $stream and !$stream->testWriteLevel('suggest')) {
$options['skip'] = true;
}
if (!$stream and !Streams::isAuthorizedToCreate($user->id, $websitesUserId, 'Websites/seo')) {
$options['skip'] = true;
}
}
unset($options['skipIfNotAuthorized']);
Q_Response::addStylesheet('plugins/Websites/css/Websites.css');
Q_Response::addScript("plugins/Websites/js/Websites.js");
Q_Response::setToolOptions($options);
$user = Users::loggedInUser(false, false);
$userId = $user ? $user->id : "";
$communityId = Users::communityId();
$sha1 = sha1(Q_Dispatcher::uri());
$seoStreamName = "Websites/seo/{$sha1}";
$streams = Streams::fetch($userId, $communityId, array("Websites/header", "Websites/title", "Websites/slogan", $seoStreamName));
foreach ($streams as $name => $s) {
if ($s) {
$s->addPreloaded($userId);
}
}
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:39,代码来源:tool.php
示例12: Streams_message_post
/**
* Used to post messages to EXISTING stream
* $_REQUEST shall contain the content of the message. Also may include 'streamNames'
* field which is an array of additional names of the streams to post message to.
*
* @param string $params
* publisher id and stream name of existing stream shall be supplied
* @return {void}
*/
function Streams_message_post()
{
$user = Users::loggedInUser(true);
$publisherId = Streams::requestedPublisherId(true);
$streamName = Streams::requestedName(true);
// check if type is allowed
$streams = Streams::fetch($user->id, $publisherId, $streamName);
if (empty($streams)) {
throw new Streams_Exception_NoSuchStream();
}
$stream = reset($streams);
if (empty($_REQUEST['type'])) {
throw new Q_Exception_RequiredField(array('field' => 'type'), 'type');
}
$type = $_REQUEST['type'];
if (!Q_Config::get("Streams", "types", $stream->type, "messages", $type, 'post', false)) {
throw new Q_Exception("This app doesn't support directly posting messages of type '{$type}' for streams of type '{$stream->type}'");
}
$result = Streams_Message::post($user->id, $publisherId, $streamName, $_REQUEST);
if (is_array($result)) {
Streams::$cache['messages'] = $result;
} else {
Streams::$cache['message'] = $result;
}
}
开发者ID:dmitriz,项目名称:Platform,代码行数:34,代码来源:post.php
示例13: Websites_article_tool
/**
* This tool generates an HTML article viewer that lets authorized users edit the article.
* @class Websites article
* @constructor
* @param {Object} [$options] parameters for the tool
* @param {String} $options.publisherId The article publisher's user id
* @param {String} $options.streamName The article's stream name
* @param {String} $options.stream The article's stream, if it is already fetched
* @param {String} [$options.html=array()] Any additional for the Streams/html editor
* @param {String} [$options.getintouch=array()] Additional options for the Users/getintouch tool, in case it's rendered
*/
function Websites_article_tool($options)
{
$publisherId = $options['publisherId'];
$streamName = $options['streamName'];
$article = Q::ifset($options, 'stream', Streams::fetchOne(null, $publisherId, $streamName));
if (!$article) {
throw new Q_Exception_MissingRow(array('table' => 'article', 'criteria' => $streamName));
}
$getintouch = array_merge(array('user' => $article->userId, 'email' => true, 'sms' => true, 'call' => true, 'between' => "", 'emailSubject' => 'Reaching out from your website', 'class' => 'Q_button Q_clickable'), Q::ifset($options, 'getintouch', array()));
$canView = $article->testReadLevel('content');
$canEdit = $article->testWriteLevel('edit');
if ($article->getintouch) {
if (is_array($git = json_decode($article->getintouch, true))) {
$getintouch = array_merge($getintouch, $git);
}
}
$getintouch['class'] = 'Q_button';
if (!$canView) {
throw new Users_Exception_NotAuthorized();
}
$html = Q::ifset($options, 'html', array());
$article->addPreloaded();
Q_Response::addStylesheet('plugins/Websites/css/Websites.css');
Q_Response::addScript("plugins/Websites/js/Websites.js");
Q_Response::setToolOptions($options);
return Q::view("Websites/tool/article.php", compact('article', 'getintouch', 'canEdit', 'canView', 'html'));
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:38,代码来源:tool.php
示例14: Streams_after_Q_image_save
function Streams_after_Q_image_save($params)
{
$user = Users::loggedInUser(true);
$path = $subpath = $data = $save = null;
extract($params, EXTR_OVERWRITE);
if (isset(Users::$cache['iconUrlWasChanged']) and Users::$cache['iconUrlWasChanged'] === false) {
// the logged-in user's icon was changed without the url changing
$stream = Streams::fetchOne($user->id, $user->id, "Streams/user/icon");
} else {
if (!empty(Streams::$cache['canWriteToStream'])) {
// some stream's icon was being changed
$stream = Streams::$cache['canWriteToStream'];
}
}
if (empty($stream)) {
return;
}
$url = $data[''];
$stream->icon = Q_Valid::url($url) ? $url : Q_Request::baseUrl() . '/' . $url;
$sizes = array();
foreach ($save as $k => $v) {
$sizes[] = "{$k}";
}
sort($sizes);
$stream->setAttribute('sizes', $sizes);
if (empty(Streams::$beingSavedQuery)) {
$stream->changed($user->id);
} else {
$stream->save();
}
}
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:Q_image_save.php
示例15: Streams_before_Q_responseExtras
function Streams_before_Q_responseExtras()
{
Q_Response::addScript('plugins/Streams/js/Streams.js');
$host = Q_Config::get('Streams', 'node', 'host', Q_Config::get('Q', 'node', 'host', null));
$port = Q_Config::get('Streams', 'node', 'port', Q_Config::get('Q', 'node', 'port', null));
$user = Users::loggedInUser();
if ($user) {
Q_Response::setScriptData('Q.plugins.Users.loggedInUser.displayName', Streams::displayName($user));
}
if (!Q_Request::isAjax()) {
$invite_url = Q_Config::get('Streams', 'invite', 'url', "http://invites.to");
Q_Response::setScriptData('Q.plugins.Streams.invite.url', $invite_url);
if (isset($host) && isset($port)) {
Q_Response::setScriptData('Q.plugins.Streams.node', array("http://{$host}:{$port}"));
}
if ($sizes = Q_Config::expect('Streams', 'types', 'Streams/image', 'sizes')) {
sort($sizes);
Q_Response::setScriptData('Q.plugins.Streams.image.sizes', $sizes);
}
$defaults = array('readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['join'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']);
Q_Response::setScriptData('Q.plugins.Streams.defaults', $defaults);
if ($froalaKey = Q_Config::get('Streams', 'froala', 'key', null)) {
Q_Response::setScriptData('Q.plugins.Streams.froala.key', $froalaKey);
}
}
Q_Response::addStylesheet("plugins/Streams/css/Streams.css");
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:27,代码来源:Q_responseExtras.php
示例16: Streams_0_8_8_Streams_mysql
function Streams_0_8_8_Streams_mysql()
{
$communityId = Users::communityId();
$user = Users_User::fetch($communityId, true);
Streams::create($communityId, $communityId, 'Streams/resource', array('name' => 'Streams/invitations', 'readLevel' => 0, 'writeLevel' => 0, 'adminLevel' => 0));
Streams_Access::insert(array('publisherId' => $communityId, 'streamName' => "Streams/invitations", 'ofUserId' => '', 'grantedByUserId' => null, 'ofContactLabel' => "{$app}/admins", 'readLevel' => Streams::$READ_LEVEL['messages'], 'writeLevel' => Streams::$WRITE_LEVEL['close'], 'adminLevel' => Streams::$ADMIN_LEVEL['invite']))->execute();
}
开发者ID:AndreyTepaykin,项目名称:Platform,代码行数:7,代码来源:0.8.8-Streams.mysql.php
示例17: Streams_after_Q_objects
function Streams_after_Q_objects()
{
$user = Users::loggedInUser();
if (!$user) {
return;
}
$invite = Streams::$followedInvite;
if (!$invite) {
return;
}
$displayName = $user->displayName();
if ($displayName) {
return;
}
$stream = new Streams_Stream();
$stream->publisherId = $invite->publisherId;
$stream->name = $invite->streamName;
if (!$stream->retrieve()) {
throw new Q_Exception_MissingRow(array('table' => 'stream', 'criteria' => 'with that name'), 'streamName');
}
// Prepare the complete invite dialog
$invitingUser = Users_User::fetch($invite->invitingUserId);
list($relations, $related) = Streams::related($user->id, $stream->publisherId, $stream->name, false);
$params = array('displayName' => null, 'action' => 'Streams/basic', 'icon' => $user->iconUrl(), 'token' => $invite->token, 'user' => array('icon' => $invitingUser->iconUrl(), 'displayName' => $invitingUser->displayName(array('fullAccess' => true))), 'stream' => $stream->exportArray(), 'relations' => Db::exportArray($relations), 'related' => Db::exportArray($related));
$config = Streams_Stream::getConfigField($stream->type, 'invite', array());
$defaults = Q::ifset($config, 'dialog', array());
$tree = new Q_Tree($defaults);
if ($tree->merge($params)) {
$dialogData = $tree->getAll();
if ($dialogData) {
Q_Response::setScriptData('Q.plugins.Streams.invite.dialog', $dialogData);
Q_Response::addTemplate('Streams/invite/complete');
}
}
}
开发者ID:dmitriz,项目名称:Platform,代码行数:35,代码来源:Q_objects.php
示例18: Websites_before_Streams_Stream_save_Websites_article
function Websites_before_Streams_Stream_save_Websites_article($params)
{
$stream = $params['stream'];
$modifiedFields = $params['modifiedFields'];
if ($stream->wasRetrieved()) {
return;
}
$user = new Users_User();
if (empty($stream->userId) and empty($modifiedFields['userId'])) {
if ($liu = Users::loggedInUser()) {
$stream->userId = $liu->id;
} else {
throw new Q_Exception_RequiredField(array('field' => 'userId'));
}
}
$user->id = $stream->userId;
if (!$user->retrieve()) {
throw new Users_Exception_NoSuchUser();
}
$title = Streams::displayName($user, array('fullAccess' => true));
if (isset($title)) {
$stream->title = $title;
}
$stream->icon = $user->iconUrl();
$s = Streams::fetchOne($user->id, $user->id, "Streams/user/icon");
if (!$s or !($sizes = $s->getAttribute('sizes', null))) {
$sizes = Q_Config::expect('Users', 'icon', 'sizes');
sort($sizes);
}
$stream->setAttribute('sizes', $sizes);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:31,代码来源:Streams_Stream_save_Websites_article.php
示例19: Streams_message_response_messages
function Streams_message_response_messages()
{
if (isset(Streams::$cache['message'])) {
$message = Streams::$cache['message'];
return Db::exportArray(array($message->ordinal => $message));
}
if (isset(Streams::$cache['messages'])) {
return Db::exportArray(Streams::$cache['messages']);
}
$publisherId = Streams::requestedPublisherId(true);
$streamName = Streams::requestedName(true);
$type = Streams::requestedMessageType();
$stream = Q::ifset(Streams::$cache, 'stream', Streams::fetchOne(null, $publisherId, $streamName, true));
$maxLimit = Streams_Stream::getConfigField($type, 'getMessagesLimit', 100);
$limit = min($maxLimit, Q::ifset($_REQUEST, 'limit', $maxLimit));
if (isset($_REQUEST['ordinal'])) {
$min = $_REQUEST['ordinal'];
$limit = 1;
}
if (isset($_REQUEST['min'])) {
$min = $_REQUEST['min'];
}
$max = isset($_REQUEST['max']) ? $_REQUEST['max'] : -1;
if (isset($_REQUEST['ascending'])) {
$ascending = $_REQUEST['ascending'];
}
if (!$stream->testReadLevel('messages')) {
throw new Users_Exception_NotAuthorized();
}
$messages = $stream->getMessages(compact('type', 'min', 'max', 'limit', 'ascending'));
return Db::exportArray($messages);
}
开发者ID:dmitriz,项目名称:Platform,代码行数:32,代码来源:messages.php
示例20: Streams_invitations_response
/**
* Displays an HTML document that can be printed, ideally with line breaks.
* Uses a particular view for the layout.
* @param {array} $_REQUEST
* @param {string} $_REQUEST.invitingUserId Required. The id of the user that generated the invitations with a call to Streams::invite.
* @param {string} $_REQUEST.batch Required. The name of the batch under which invitations were saved during a call to Streams::invite.
* @param {string} [$_REQUEST.limit=100] The maximum number of invitations to show on the page
* @param {string} [$_REQUEST.offset=0] Used for paging
* @param {string} [$_REQUEST.title='Invitations'] Override the title of the document
* @param {string} [$_REQUEST.layout='default'] The name of the layout to use for the HTML document
* @see Users::addLink()
*/
function Streams_invitations_response()
{
Q_Request::requireFields(array('batch', 'invitingUserId'), true);
$invitingUserId = $_REQUEST['invitingUserId'];
$batch = $_REQUEST['batch'];
$user = Users::loggedInUser(true);
$stream = Streams::fetchOne(null, $invitingUserId, 'Streams/invitations', true);
if (!$stream->testReadLevel('content')) {
throw new Users_Exception_NotAuthorized();
}
$title = Q::ifset($_REQUEST, 'layout', 'title');
$layoutKey = Q::ifset($_REQUEST, 'layout', 'default');
$limit = min(1000, Q::ifset($_REQUEST, 'limit', 100));
$offset = Q::ifset($_REQUEST, 'offset', 0);
$layout = Q_Config::expect('Streams', 'invites', 'layout', $layoutKey);
$pattern = Streams::invitationsPath($invitingUserId) . DS . $batch . DS . "*.html";
$filenames = glob($pattern);
$parts = array();
foreach ($filenames as $f) {
if (--$offset > 0) {
continue;
}
$parts[] = file_get_contents($f);
if (--$limit == 0) {
break;
}
}
$content = implode("\n\n<div class='Q_pagebreak Streams_invitations_separator'></div>\n\n", $parts);
echo Q::view($layout, compact('title', 'content', 'parts'));
return false;
}
开发者ID:dmitriz,项目名称:Platform,代码行数:43,代码来源:response.php
注:本文中的Streams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论