当前位置: 首页>>代码示例>>PHP>>正文


PHP Post::isLocked方法代码示例

本文整理汇总了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();
 }
开发者ID:GodOfConquest,项目名称:infinity-next,代码行数:21,代码来源:PostRequest.php

示例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;
 }
开发者ID:LulzNews,项目名称:infinity-next,代码行数:24,代码来源:BoardController.php


注:本文中的app\Post::isLocked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。