1 | <?php |
||
13 | class Page extends AliasModel |
||
14 | { |
||
15 | /** |
||
16 | * The content of the page |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $content; |
||
20 | |||
21 | /** |
||
22 | * The creation date of the page |
||
23 | * @var TimeDate |
||
24 | */ |
||
25 | protected $created; |
||
26 | |||
27 | /** |
||
28 | * The date the page was last updated |
||
29 | * @var TimeDate |
||
30 | */ |
||
31 | protected $updated; |
||
32 | |||
33 | /** |
||
34 | * The ID of the author of the page |
||
35 | * @var int |
||
36 | */ |
||
37 | protected $author; |
||
38 | |||
39 | protected $is_draft; |
||
40 | protected $is_unlisted; |
||
41 | |||
42 | const DEFAULT_STATUS = 'live'; |
||
43 | |||
44 | const DELETED_COLUMN = 'is_deleted'; |
||
45 | const TABLE = 'pages'; |
||
46 | |||
47 | const CREATE_PERMISSION = Permission::CREATE_PAGE; |
||
48 | const EDIT_PERMISSION = Permission::EDIT_PAGE; |
||
49 | const SOFT_DELETE_PERMISSION = Permission::SOFT_DELETE_PAGE; |
||
50 | const HARD_DELETE_PERMISSION = Permission::HARD_DELETE_PAGE; |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | protected function assignResult($page) |
||
64 | 1 | ||
65 | /** |
||
66 | 1 | * {@inheritdoc} |
|
67 | 1 | */ |
|
68 | 1 | protected function assignLazyResult($page) |
|
74 | |||
75 | /** |
||
76 | * Get the raw content of the page |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getContent() |
||
80 | { |
||
81 | $this->lazyLoad(); |
||
82 | |||
83 | return $this->content; |
||
84 | } |
||
85 | |||
86 | /** |
||
87 | * Get the page's submission time |
||
88 | * @return TimeDate |
||
89 | */ |
||
90 | public function getCreated() |
||
96 | |||
97 | /** |
||
98 | * Get the time when the page was last updated |
||
99 | * @return TimeDate |
||
100 | */ |
||
101 | public function getUpdated() |
||
102 | { |
||
103 | $this->lazyLoad(); |
||
104 | |||
105 | return $this->updated->copy(); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * Get the user who created the page |
||
110 | * @return Player The page's author |
||
111 | */ |
||
112 | public function getAuthor() |
||
113 | { |
||
114 | return Player::get($this->author); |
||
115 | } |
||
116 | |||
117 | /** |
||
118 | * Set the content of the page |
||
119 | * |
||
120 | * @param string $content |
||
121 | * @return self |
||
122 | */ |
||
123 | public function setContent($content) |
||
124 | { |
||
125 | return $this->updateProperty($this->content, "content", $content); |
||
126 | } |
||
127 | |||
128 | /** |
||
129 | 1 | * Update the last edit timestamp |
|
130 | * @return self |
||
131 | 1 | */ |
|
132 | public function updateEditTimestamp() |
||
136 | |||
137 | /** |
||
138 | 1 | * Create a new Page |
|
139 | * |
||
140 | 1 | * @param string $title The title of the page |
|
141 | * @param string $content The content of page |
||
142 | * @param int $authorID The ID of the author |
||
143 | * @param string $status Page status: 'live','disabled',or 'deleted' |
||
144 | * |
||
145 | * @return Page An object representing the page that was just created |
||
146 | */ |
||
147 | public static function addPage($title, $content, $authorID, $status = "live") |
||
158 | |||
159 | /** |
||
160 | * {@inheritdoc} |
||
161 | */ |
||
162 | public static function getRouteName($action = 'show') |
||
166 | |||
167 | /** |
||
168 | * {@inheritdoc} |
||
169 | */ |
||
170 | protected static function getDisallowedAliases() |
||
178 | |||
179 | /** |
||
180 | * {@inheritdoc} |
||
181 | */ |
||
182 | public static function getActiveStatuses() |
||
186 | 1 | ||
187 | 1 | /** |
|
188 | 1 | * {@inheritdoc} |
|
189 | 1 | */ |
|
190 | 1 | public static function getEagerColumns($prefix = null) |
|
204 | |||
205 | /** |
||
206 | * {@inheritdoc} |
||
207 | 1 | */ |
|
208 | public static function getLazyColumns() |
||
212 | |||
213 | /** |
||
214 | * Get a query builder for pages |
||
215 | * @return QueryBuilder |
||
216 | */ |
||
217 | public static function getQueryBuilder() |
||
223 | |||
224 | /** |
||
225 | * {@inheritdoc} |
||
226 | */ |
||
227 | 1 | public static function getActiveModels(QueryBuilderFlex &$qb) |
|
236 | |||
237 | /** |
||
238 | * {@inheritdoc} |
||
239 | 1 | */ |
|
240 | public static function getEagerColumnsList() |
||
252 | |||
253 | /** |
||
254 | 1 | * Get the home page |
|
255 | * @deprecated |
||
256 | 1 | * @return Page |
|
257 | 1 | */ |
|
258 | public static function getHomePage() |
||
262 | } |
||
263 |
This check looks for accesses to local static members using the fully qualified name instead of
self::
.While this is perfectly valid, the fully qualified name of
Certificate::TRIPLEDES_CBC
could just as well be replaced byself::TRIPLEDES_CBC
. Referencing local members withself::
assured the access will still work when the class is renamed, makes it perfectly clear that the member is in fact local and will usually be shorter.