Changeset View
Changeset View
Standalone View
Standalone View
src/applications/pholio/storage/PholioMock.php
<?php | <?php | ||||
final class PholioMock extends PholioDAO | final class PholioMock extends PholioDAO | ||||
implements | implements | ||||
PhabricatorMarkupInterface, | |||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
PhabricatorSubscribableInterface, | PhabricatorSubscribableInterface, | ||||
PhabricatorTokenReceiverInterface, | PhabricatorTokenReceiverInterface, | ||||
PhabricatorFlaggableInterface, | PhabricatorFlaggableInterface, | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
PhabricatorSpacesInterface, | PhabricatorSpacesInterface, | ||||
PhabricatorMentionableInterface, | PhabricatorMentionableInterface, | ||||
PhabricatorFulltextInterface, | PhabricatorFulltextInterface, | ||||
PhabricatorFerretInterface { | PhabricatorFerretInterface { | ||||
const MARKUP_FIELD_DESCRIPTION = 'markup:description'; | |||||
const STATUS_OPEN = 'open'; | const STATUS_OPEN = 'open'; | ||||
const STATUS_CLOSED = 'closed'; | const STATUS_CLOSED = 'closed'; | ||||
protected $authorPHID; | protected $authorPHID; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $name; | protected $name; | ||||
▲ Show 20 Lines • Show All 183 Lines • ▼ Show 20 Lines | public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | ||||
return ($viewer->getPHID() == $this->getAuthorPHID()); | return ($viewer->getPHID() == $this->getAuthorPHID()); | ||||
} | } | ||||
public function describeAutomaticCapability($capability) { | public function describeAutomaticCapability($capability) { | ||||
return pht("A mock's owner can always view and edit it."); | return pht("A mock's owner can always view and edit it."); | ||||
} | } | ||||
/* -( PhabricatorMarkupInterface )----------------------------------------- */ | |||||
public function getMarkupFieldKey($field) { | |||||
$content = $this->getMarkupText($field); | |||||
return PhabricatorMarkupEngine::digestRemarkupContent($this, $content); | |||||
} | |||||
public function newMarkupEngine($field) { | |||||
return PhabricatorMarkupEngine::newMarkupEngine(array()); | |||||
} | |||||
public function getMarkupText($field) { | |||||
if ($this->getDescription()) { | |||||
return $this->getDescription(); | |||||
} | |||||
return null; | |||||
} | |||||
public function didMarkupText($field, $output, PhutilMarkupEngine $engine) { | |||||
require_celerity_resource('phabricator-remarkup-css'); | |||||
return phutil_tag( | |||||
'div', | |||||
array( | |||||
'class' => 'phabricator-remarkup', | |||||
), | |||||
$output); | |||||
} | |||||
public function shouldUseMarkupCache($field) { | |||||
return (bool)$this->getID(); | |||||
} | |||||
/* -( PhabricatorApplicationTransactionInterface )------------------------- */ | /* -( PhabricatorApplicationTransactionInterface )------------------------- */ | ||||
public function getApplicationTransactionEditor() { | public function getApplicationTransactionEditor() { | ||||
return new PholioMockEditor(); | return new PholioMockEditor(); | ||||
} | } | ||||
public function getApplicationTransactionObject() { | public function getApplicationTransactionObject() { | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |