8 * @copyright 2019 Someone <someone@somenet.org>
14 * Occurs after a new article has been created.
15 * @see http://www.mediawiki.org/wiki/Manual:Hooks/ArticleInsertComplete
17 static function onPageContentInsertComplete(WikiPage $wikiPage, $user, $text, $summary, $isminor, $iswatch, $section, $flags, $revision){
18 if (stripos($wikiPage->getTitle()->getText(), 'FSPlenum') === false) return;
20 $post = wfMessage('mmmotify-onPageContentInsertComplete')->plain().'\n'.$wikiPage->getTitle()->getFullURL().'\n\n----\n';
22 $text = ContentHandler::getContentText($wikiPage->getRevision()->getContent( Revision::RAW));
23 preg_match_all('/^={1,2}[^=].*$/m', $text, $out);
25 foreach ($out[0] as $heading) {
26 $post .= $heading.'\n';
29 self::send_curl_request('{"text": "'.str_replace('"', '\"', $post).'"}');
34 private static function send_curl_request($postData) {
35 global $MMIncomingWebhookUrl;
38 curl_setopt($h, CURLOPT_URL, $MMIncomingWebhookUrl);
39 curl_setopt($h, CURLOPT_POST, 1);
40 curl_setopt($h, CURLOPT_POSTFIELDS, $postData);
41 curl_setopt($h, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: '.strlen($postData)));
42 curl_setopt($h, CURLOPT_RETURNTRANSFER, true);
43 $curl_output = curl_exec($h);