本文整理汇总了PHP中app\Post::isLocked方法的典型用法代码示例。如果您正苦于以下问题:PHP Post::isLocked方法的具体用法?PHP Post::isLocked怎么用?PHP Post::isLocked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Post
的用法示例。
在下文中一共展示了Post::isLocked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: authorize
/**
* Returns if the client has access to this form.
*
* @return boolean
*/
public function authorize()
{
// Ban check.
$ban = Ban::getBan($this->ip(), $this->board->board_uri);
if ($ban) {
$this->ban = $ban;
return false;
}
// Locked thread check.
if ($this->thread instanceof Post && $this->thread->isLocked() && !$this->user->canPostInLockedThreads($this->board)) {
return false;
}
## TODO ##
// Separate these permsisions.
return $this->user->canPostThread() || $this->user->canPostReply();
}
示例2: postToJson
/**
* Converts a single post in standard legacy API output.
*
* @param \App\Post $post
* @return array
*/
protected function postToJson(Post $post)
{
// Actual post information.
$postArray = ['no' => (int) $post->board_id, 'resto' => (int) $post->reply_to_board_id ?: 0, 'sticky' => (bool) $post->isStickied(), 'locked' => (bool) $post->isLocked(), 'cyclical' => (bool) $post->isCyclic(), 'name' => (string) $post->author, 'sub' => (string) $post->subject, 'com' => (string) $post->getBodyFormatted(), 'time' => (int) $post->created_at->timestamp, 'last_modified' => (int) $post->bumped_last->timestamp, 'omitted_posts' => 0, 'omitted_images' => 0];
// Attachment information.
foreach ($post->attachments as $attachmentIndex => $attachment) {
$attachmentArray = ['filename' => $attachment->getBaseFileName(), 'ext' => "." . $attachment->getExtension(), 'tim' => $attachment->getFileName("%t-%i"), 'md5' => base64_encode(hex2bin($attachment->hash)), 'fsize' => $attachment->filesize, 'tn_h' => $attachment->thumbnail_height, 'tn_w' => $attachment->thumbnail_width, 'h' => $attachment->file_height, 'w' => $attachment->file_width];
if ($attachmentIndex === 0) {
$postArray = array_merge($postArray, $attachmentArray);
} else {
if (!isset($postArray['extra_files'])) {
$postArray['extra_files'] = [];
}
$postArray['extra_files'][] = $attachmentArray;
}
}
return $postArray;
}