Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorSourceDocumentEngine.php
<?php | <?php | ||||
final class PhabricatorSourceDocumentEngine | final class PhabricatorSourceDocumentEngine | ||||
extends PhabricatorTextDocumentEngine { | extends PhabricatorTextDocumentEngine { | ||||
const ENGINEKEY = 'source'; | const ENGINEKEY = 'source'; | ||||
public function getViewAsLabel(PhabricatorDocumentRef $ref) { | public function getViewAsLabel(PhabricatorDocumentRef $ref) { | ||||
return pht('View as Source'); | return pht('View as Source'); | ||||
} | } | ||||
public function canConfigureHighlighting(PhabricatorDocumentRef $ref) { | public function canConfigureHighlighting(PhabricatorDocumentRef $ref) { | ||||
return true; | return true; | ||||
} | } | ||||
public function canBlame(PhabricatorDocumentRef $ref) { | |||||
return true; | |||||
} | |||||
protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | protected function getDocumentIconIcon(PhabricatorDocumentRef $ref) { | ||||
return 'fa-code'; | return 'fa-code'; | ||||
} | } | ||||
protected function getContentScore(PhabricatorDocumentRef $ref) { | protected function getContentScore(PhabricatorDocumentRef $ref) { | ||||
return 1500; | return 1500; | ||||
} | } | ||||
Show All 16 Lines | if ($highlighting !== null) { | ||||
phutil_format_bytes($highlight_limit))); | phutil_format_bytes($highlight_limit))); | ||||
} else { | } else { | ||||
$content = PhabricatorSyntaxHighlighter::highlightWithFilename( | $content = PhabricatorSyntaxHighlighter::highlightWithFilename( | ||||
$ref->getName(), | $ref->getName(), | ||||
$content); | $content); | ||||
} | } | ||||
} | } | ||||
$options = array(); | |||||
if ($ref->getBlameURI()) { | |||||
$content = phutil_split_lines($content); | |||||
$blame = range(1, count($content)); | |||||
$blame = array_fuse($blame); | |||||
$options['blame'] = $blame; | |||||
} | |||||
return array( | return array( | ||||
$messages, | $messages, | ||||
$this->newTextDocumentContent($ref, $content), | $this->newTextDocumentContent($ref, $content, $options), | ||||
); | ); | ||||
} | } | ||||
} | } |