|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Leonidas\Library\System\Model\Post; |
|
4
|
|
|
|
|
5
|
|
|
use Leonidas\Contracts\System\Model\Author\AuthorInterface; |
|
6
|
|
|
use Leonidas\Contracts\System\Model\Category\CategoryCollectionInterface; |
|
7
|
|
|
use Leonidas\Contracts\System\Model\Comment\CommentCollectionInterface; |
|
8
|
|
|
use Leonidas\Contracts\System\Model\Post\PostInterface; |
|
9
|
|
|
use Leonidas\Contracts\System\Model\Tag\TagCollectionInterface; |
|
10
|
|
|
use Leonidas\Contracts\Util\AutoInvokerInterface; |
|
11
|
|
|
use Leonidas\Library\System\Model\Abstracts\AllAccessGrantedTrait; |
|
12
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\FilterablePostModelTrait; |
|
13
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MimePostModelTrait; |
|
14
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MutableAuthoredPostModelTrait; |
|
15
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MutableCommentablePostModelTrait; |
|
16
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MutableContentPostModelTrait; |
|
17
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MutableDatablePostModelTrait; |
|
18
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MutablePingablePostModelTrait; |
|
19
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\MutablePostModelTrait; |
|
20
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\PolymorphicPostModelTrait; |
|
21
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\RestrictablePostModelTrait; |
|
22
|
|
|
use Leonidas\Library\System\Model\Abstracts\Post\ValidatesPostTypeTrait; |
|
23
|
|
|
use Leonidas\Library\System\Model\Post\Abstracts\MutablePostTrait; |
|
24
|
|
|
use WP_Post; |
|
25
|
|
|
|
|
26
|
|
|
class Post implements PostInterface |
|
27
|
|
|
{ |
|
28
|
|
|
use AllAccessGrantedTrait; |
|
29
|
|
|
use FilterablePostModelTrait; |
|
|
|
|
|
|
30
|
|
|
use MimePostModelTrait; |
|
31
|
|
|
use MutableAuthoredPostModelTrait; |
|
|
|
|
|
|
32
|
|
|
use MutableCommentablePostModelTrait; |
|
33
|
|
|
use MutableContentPostModelTrait; |
|
34
|
|
|
use MutableDatablePostModelTrait; |
|
35
|
|
|
use MutablePingablePostModelTrait; |
|
36
|
|
|
use MutablePostModelTrait; |
|
|
|
|
|
|
37
|
|
|
use MutablePostTrait; |
|
38
|
|
|
use PolymorphicPostModelTrait; |
|
39
|
|
|
use RestrictablePostModelTrait; |
|
40
|
|
|
use ValidatesPostTypeTrait; |
|
|
|
|
|
|
41
|
|
|
|
|
42
|
|
|
public function __construct( |
|
43
|
|
|
WP_Post $post, |
|
44
|
|
|
AutoInvokerInterface $autoInvoker, |
|
45
|
|
|
?AuthorInterface $author = null, |
|
46
|
|
|
?TagCollectionInterface $tags = null, |
|
47
|
|
|
?CategoryCollectionInterface $categories = null, |
|
48
|
|
|
?CommentCollectionInterface $comments = null |
|
49
|
|
|
) { |
|
50
|
|
|
$this->assertPostType($post, 'post'); |
|
51
|
|
|
|
|
52
|
|
|
$this->post = $post; |
|
53
|
|
|
$this->autoInvoker = $autoInvoker; |
|
54
|
|
|
|
|
55
|
|
|
$author && $this->author = $author; |
|
56
|
|
|
$tags && $this->tags = $tags; |
|
57
|
|
|
$categories && $this->categories = $categories; |
|
58
|
|
|
$comments && $this->comments = $comments; |
|
59
|
|
|
|
|
60
|
|
|
$this->getAccessProvider = new PostTemplateTags($this, $post); |
|
61
|
|
|
$this->setAccessProvider = new PostSetAccessProvider($this); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
public function __toString(): string |
|
65
|
|
|
{ |
|
66
|
|
|
return $this->getAccessProvider->get('content'); |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
|