本文整理汇总了PHP中Streams::requestedMessageType方法的典型用法代码示例。如果您正苦于以下问题:PHP Streams::requestedMessageType方法的具体用法?PHP Streams::requestedMessageType怎么用?PHP Streams::requestedMessageType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Streams
的用法示例。
在下文中一共展示了Streams::requestedMessageType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: 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();
$maxLimit = Q_Config::get('Streams', 'defaults', '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'];
}
$user = Users::loggedInUser();
$userId = $user ? $user->id : "";
$stream = isset(Streams::$cache['stream']) ? Streams::$cache['stream'] : Streams::fetchOne($userId, $publisherId, $streamName);
if (!$stream) {
throw new Q_Exception_MissingRow(array('table' => 'Stream', 'criteria' => "{publisherId: '{$publisherId}', name: '{$streamName}'}"));
}
if (!$stream->testReadLevel('messages')) {
throw new Users_Exception_NotAuthorized();
}
$messages = $stream->getMessages(compact('type', 'min', 'max', 'limit', 'ascending'));
return Db::exportArray($messages);
}