mirror of
https://github.com/openvk/openvk
synced 2024-11-15 11:39:13 +03:00
39 lines
933 B
PHP
39 lines
933 B
PHP
<?php declare(strict_types=1);
|
|
namespace openvk\Web\Models\Entities\WikiPage;
|
|
use openvk\Web\Models\Repositories\WikiPages;
|
|
use openvk\Web\Models\Entities\Postable;
|
|
|
|
class WikiPage extends Postable {
|
|
protected $tableName = "wikipages";
|
|
|
|
function getTitle(): string
|
|
{
|
|
return $this->getRecord()->title;
|
|
}
|
|
|
|
function getSource(): string
|
|
{
|
|
return $this->getRecord()->source;
|
|
}
|
|
|
|
function getHitCounter(): int
|
|
{
|
|
return $this->getRecord()->hits;
|
|
}
|
|
|
|
function getText(array $ctx = []): string
|
|
{
|
|
$counter = 0;
|
|
$parser = new Parser($this, new WikiPages, $counter, ["firstInclusion" => "yes"], array_merge([
|
|
"time" => time(),
|
|
], $ctx));
|
|
|
|
return $parser->asHTML();
|
|
}
|
|
|
|
function view(): void
|
|
{
|
|
$this->stateChanges("hits", $this->getRecord()->hits + 1);
|
|
$this->save();
|
|
}
|
|
}
|