Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/document/PhabricatorTextDocumentEngine.php
<?php | <?php | ||||
abstract class PhabricatorTextDocumentEngine | abstract class PhabricatorTextDocumentEngine | ||||
extends PhabricatorDocumentEngine { | extends PhabricatorDocumentEngine { | ||||
private $encodingMessage = null; | private $encodingMessage = null; | ||||
protected function canRenderDocumentType(PhabricatorDocumentRef $ref) { | protected function canRenderDocumentType(PhabricatorDocumentRef $ref) { | ||||
return $ref->isProbablyText(); | return $ref->isProbablyText(); | ||||
} | } | ||||
public function canConfigureEncoding(PhabricatorDocumentRef $ref) { | public function canConfigureEncoding(PhabricatorDocumentRef $ref) { | ||||
return true; | return true; | ||||
} | } | ||||
protected function newTextDocumentContent($content) { | protected function newTextDocumentContent( | ||||
PhabricatorDocumentRef $ref, | |||||
$content) { | |||||
$lines = phutil_split_lines($content); | $lines = phutil_split_lines($content); | ||||
$view = id(new PhabricatorSourceCodeView()) | $view = id(new PhabricatorSourceCodeView()) | ||||
->setHighlights($this->getHighlightedLines()) | ->setHighlights($this->getHighlightedLines()) | ||||
->setLines($lines); | ->setLines($lines) | ||||
->setSymbolMetadata($ref->getSymbolMetadata()); | |||||
$message = null; | $message = null; | ||||
if ($this->encodingMessage !== null) { | if ($this->encodingMessage !== null) { | ||||
$message = $this->newMessage($this->encodingMessage); | $message = $this->newMessage($this->encodingMessage); | ||||
} | } | ||||
$container = phutil_tag( | $container = phutil_tag( | ||||
'div', | 'div', | ||||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |