public static function notificator_Render($parser, $receiver = '', $receiverLabel = '') { global $wgScript, $wgTitle; if (!$receiverLabel) { $receiverLabel = $receiver; } // Check that the database table is in place if (!Notificator::checkDatabaseTableExists()) { $output = '<span class="error">' . htmlspecialchars(wfMsg('notificator-db-table-does-not-exist')) . '</span>'; return array($output, 'noparse' => true, 'isHTML' => true); } // The rendering is different, depending on whether a valid e-mail address // has been provided, or not - the differing part of the HTML form is being // built here if (Notificator::receiverIsValid($receiver)) { // Valid e-mail address available, so build a hidden input with that address // set, and a button $receiverInputAndSubmitButton = Html::hidden('receiver', $receiver) . Html::element('input', array('type' => 'submit', 'value' => wfMsg('notificator-notify-address-or-name', $receiverLabel))); } else { // No (valid) e-mail address available, build a text input and a button $receiverInputAndSubmitButton = Html::element('input', array('type' => 'text', 'name' => 'receiver', 'value' => wfMsg('notificator-e-mail-address'), 'onfocus' => 'if (this.value == \'' . wfMsg('notificator-e-mail-address') . '\') {this.value=\'\'}')) . Html::element('input', array('type' => 'submit', 'value' => wfMsg('notificator-notify'))); } // Now we assemble the form, consisting of two hidden inputs for page ID and rev ID, // as well as the $receiverInputAndSubmitButton built above $output = Html::rawElement('form', array('action' => SpecialPage::getTitleFor('Notificator')->getLocalURL(), 'method' => 'post', 'enctype' => 'multipart/form-data'), Html::hidden('pageId', $wgTitle->getArticleID()) . Html::hidden('revId', $wgTitle->getLatestRevID()) . $receiverInputAndSubmitButton); return $parser->insertStripItem($output, $parser->mStripState); }