/**
  * Serializes the CollaborationHubContent object.
  *
  * @param $content Content
  * @param $format string|null
  * @return mixed
  */
 public function serializeContent(Content $content, $format = null)
 {
     if ($format === self::FORMAT_WIKI) {
         return $content->convertToHumanEditable();
     }
     return parent::serializeContent($content, $format);
 }
コード例 #2
0
 /**
  * @param string $format
  * @return bool
  */
 public function isSupportedFormat($format)
 {
     // An error in an earlier version of Scribunto means we might see this.
     if ($format === 'CONTENT_FORMAT_TEXT') {
         $format = CONTENT_FORMAT_TEXT;
     }
     return parent::isSupportedFormat($format);
 }
コード例 #3
0
 public function __construct($modelId = CONTENT_MODEL_CSS)
 {
     parent::__construct($modelId, array(CONTENT_FORMAT_CSS));
 }
コード例 #4
0
 public function __construct($modelId = CONTENT_MODEL_WIKITEXT)
 {
     parent::__construct($modelId, array(CONTENT_FORMAT_WIKITEXT));
 }
コード例 #5
0
 public function __construct()
 {
     parent::__construct("RevisionTestModifyableContent", array(CONTENT_FORMAT_TEXT));
 }
コード例 #6
0
 public function __construct()
 {
     parent::__construct('BackupTextPassTestModel');
 }
コード例 #7
0
 public function getDataForSearchIndex(WikiPage $page, ParserOutput $parserOutput, SearchEngine $engine)
 {
     $fields = parent::getDataForSearchIndex($page, $parserOutput, $engine);
     $structure = new WikiTextStructure($parserOutput);
     $fields['heading'] = $structure->headings();
     // text fields
     $fields['opening_text'] = $structure->getOpeningText();
     $fields['text'] = $structure->getMainText();
     // overwrites one from ContentHandler
     $fields['auxiliary_text'] = $structure->getAuxiliaryText();
     $fields['defaultsort'] = $structure->getDefaultSort();
     // Until we have full first-class content handler for files, we invoke it explicitly here
     if (NS_FILE == $page->getTitle()->getNamespace()) {
         $fields = array_merge($fields, $this->getFileHandler()->getDataForSearchIndex($page, $parserOutput, $engine));
     }
     return $fields;
 }
コード例 #8
0
 public function testSupportsDirectEditing()
 {
     $handler = new TextContentHandler();
     $this->assertTrue($handler->supportsDirectEditing(), 'direct editing is supported');
 }
 public function merge3(Content $oldContent, Content $myContent, Content $yourContent)
 {
     // You could implement smart DOM-based diff/merge here.
     // The default implementation is line-based, which isn't too great for XML.
     return parent::merge3($oldContent, $myContent, $yourContent);
 }
コード例 #10
0
 /**
  * Only allow this content handler to be used in the Module namespace
  * @param Title $title
  * @return bool
  */
 public function canBeUsedOn(Title $title)
 {
     if ($title->getNamespace() !== NS_MODULE) {
         return false;
     }
     return parent::canBeUsedOn($title);
 }
コード例 #11
0
 public function __construct($modelId = 'JsonSchema')
 {
     parent::__construct($modelId, array(CONTENT_FORMAT_JSON));
 }
コード例 #12
0
 /**
  * @param string $modelId
  */
 public function __construct($modelId = CONTENT_MODEL_JAVASCRIPT)
 {
     parent::__construct($modelId, array(CONTENT_FORMAT_JAVASCRIPT));
 }
 public function __construct($modelId = 'Notebook')
 {
     parent::__construct($modelId);
 }