Example #1
0
 /**
  * Validates that the revised contents are valid JSON.
  * If not valid, rejects edit with error message.
  * @param EditPage $editor
  * @param string $text Content of the revised article.
  * @param string &$error Error message to return.
  * @param string $summary Edit summary provided for edit.
  * @return True
  */
 static function onEditFilterMerged($editor, $text, &$error, $summary)
 {
     if (!$editor->getTitle()->inNamespace(NS_CAMPAIGN)) {
         return true;
     }
     $content = new CampaignContent($text);
     try {
         $content->validate();
     } catch (JsonSchemaException $e) {
         $error = $e->getMessage();
     }
     return true;
 }