本文整理汇总了PHP中Html::rawElement方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::rawElement方法的具体用法?PHP Html::rawElement怎么用?PHP Html::rawElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::rawElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMessagesFormatted
function getMessagesFormatted($severity = self::MESSAGE_WARNING, $header = null)
{
global $wgTitle, $wgUser;
$ret = '';
foreach ($this->mMessages as $message) {
if ($message[1] <= $severity) {
$ret .= '* ' . $message[0] . "\n";
}
}
if ($ret != '') {
if (!$this->mParser) {
$parser = new Parser();
}
if ($header == null) {
$header = '';
} elseif ($header != '') {
$header = Html::rawElement('div', array('class' => 'heading'), $header);
}
$ret = Html::rawElement('div', array('class' => 'messages'), $header . "\n" . $ret);
$ret = $parser->parse($ret, $wgTitle, ParserOptions::newFromUser($wgUser));
} else {
$ret = null;
}
return $ret;
}
示例2: genContributionScoreTable
/**
* Function generates Contribution Scores tables in HTML format (not wikiText)
*
* @param $days int Days in the past to run report for
* @param $limit int Maximum number of users to return (default 50)
*
* @return HTML Table representing the requested Contribution Scores.
*/
function genContributionScoreTable($days, $limit, $title = null, $options = 'none')
{
global $wgContribScoreIgnoreBots, $wgContribScoreIgnoreBlockedUsers, $wgContribScoresUseRealName, $wgLang;
$opts = explode(',', strtolower($options));
$dbr = wfGetDB(DB_SLAVE);
$userTable = $dbr->tableName('user');
$userGroupTable = $dbr->tableName('user_groups');
$revTable = $dbr->tableName('revision');
$ipBlocksTable = $dbr->tableName('ipblocks');
$sqlWhere = "";
$nextPrefix = "WHERE";
if ($days > 0) {
$date = time() - 60 * 60 * 24 * $days;
$dateString = $dbr->timestamp($date);
$sqlWhere .= " {$nextPrefix} rev_timestamp > '{$dateString}'";
$nextPrefix = "AND";
}
if ($wgContribScoreIgnoreBlockedUsers) {
$sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ipb_user FROM {$ipBlocksTable} WHERE ipb_user <> 0)";
$nextPrefix = "AND";
}
if ($wgContribScoreIgnoreBots) {
$sqlWhere .= " {$nextPrefix} rev_user NOT IN (SELECT ug_user FROM {$userGroupTable} WHERE ug_group='bot')";
$nextPrefix = "AND";
}
$sqlMostPages = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY page_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
$sqlMostRevs = "SELECT rev_user,\n\t\t\t\t\t\t COUNT(DISTINCT rev_page) AS page_count,\n\t\t\t\t\t\t COUNT(rev_id) AS rev_count\n\t\t\t\t\t\t FROM {$revTable}\n\t\t\t\t\t\t {$sqlWhere}\n\t\t\t\t\t\t GROUP BY rev_user\n\t\t\t\t\t\t ORDER BY rev_count DESC\n\t\t\t\t\t\t LIMIT {$limit}";
$sql = "SELECT user_id, " . "user_name, " . "user_real_name, " . "page_count, " . "rev_count, " . "page_count+SQRT(rev_count-page_count)*2 AS wiki_rank " . "FROM {$userTable} u JOIN (({$sqlMostPages}) UNION ({$sqlMostRevs})) s ON (user_id=rev_user) " . "ORDER BY wiki_rank DESC " . "LIMIT {$limit}";
$res = $dbr->query($sql);
$sortable = in_array('nosort', $opts) ? '' : ' sortable';
$output = "<table class=\"wikitable contributionscores plainlinks{$sortable}\" >\n" . "<tr class='header'>\n" . Html::element('th', array(), wfMsg('contributionscores-score')) . Html::element('th', array(), wfMsg('contributionscores-pages')) . Html::element('th', array(), wfMsg('contributionscores-changes')) . Html::element('th', array(), wfMsg('contributionscores-username'));
$altrow = '';
foreach ($res as $row) {
// Use real name if option used and real name present.
if ($wgContribScoresUseRealName && $row->user_real_name !== '') {
$userLink = Linker::userLink($row->user_id, $row->user_name, $row->user_real_name);
} else {
$userLink = Linker::userLink($row->user_id, $row->user_name);
}
$output .= Html::closeElement('tr');
$output .= "<tr class='{$altrow}'>\n<td class='content'>" . $wgLang->formatNum(round($row->wiki_rank, 0)) . "\n</td><td class='content'>" . $wgLang->formatNum($row->page_count) . "\n</td><td class='content'>" . $wgLang->formatNum($row->rev_count) . "\n</td><td class='content'>" . $userLink;
# Option to not display user tools
if (!in_array('notools', $opts)) {
$output .= Linker::userToolLinks($row->user_id, $row->user_name);
}
$output .= Html::closeElement('td') . "\n";
if ($altrow == '' && empty($sortable)) {
$altrow = 'odd ';
} else {
$altrow = '';
}
}
$output .= Html::closeElement('tr');
$output .= Html::closeElement('table');
$dbr->freeResult($res);
if (!empty($title)) {
$output = Html::rawElement('table', array('cellspacing' => 0, 'cellpadding' => 0, 'class' => 'contributionscores-wrapper', 'lang' => $wgLang->getCode(), 'dir' => $wgLang->getDir()), "\n" . "<tr>\n" . "<td style='padding: 0px;'>{$title}</td>\n" . "</tr>\n" . "<tr>\n" . "<td style='padding: 0px;'>{$output}</td>\n" . "</tr>\n");
}
return $output;
}
示例3: EditPageBeforeEditToolbar
/**
* EditPageBeforeEditToolbar hook
*
* Disable the old toolbar if the new one is enabled
*
* @param $toolbar html
* @return bool
*/
public static function EditPageBeforeEditToolbar(&$toolbar)
{
if (self::isEnabled('toolbar')) {
$toolbar = Html::rawElement('div', array('class' => 'wikiEditor-oldToolbar', 'style' => 'display:none;'), $toolbar);
}
return true;
}
示例4: renderMessageHtml
/**
* Render message box with system messages, e.g. errors or already logged-in notices
*
* @param bool $register Whether the user can register an account
*/
protected function renderMessageHtml($register = false)
{
$msgBox = '';
// placeholder for displaying any login-related system messages (eg errors)
// Render logged-in notice (beta/alpha)
if ($this->data['loggedin']) {
$msg = $register ? 'mobile-frontend-userlogin-loggedin-register' : 'userlogin-loggedin';
$msgBox .= Html::element('div', array('class' => 'alert warning'), wfMessage($msg)->params($this->data['loggedinuser'])->parse());
}
// Render login errors
$message = $this->data['message'];
$messageType = $this->data['messagetype'];
if ($message) {
$heading = '';
$class = 'alert';
if ($messageType == 'error') {
$heading = wfMessage('mobile-frontend-sign-in-error-heading')->text();
$class .= ' error';
}
$msgBox .= Html::openElement('div', array('class' => $class));
$msgBox .= $heading ? Html::rawElement('h2', array(), $heading) : '';
$msgBox .= $message;
$msgBox .= Html::closeElement('div');
} else {
$msgBox .= $this->getLogoHtml();
}
echo $msgBox;
}
示例5: getHTML
public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
{
global $sfgTabIndex, $sfgFieldNum, $sfgShowOnSelect;
$checkbox_class = $is_mandatory ? 'mandatoryField' : 'createboxInput';
$span_class = 'checkboxSpan';
if (array_key_exists('class', $other_args)) {
$span_class .= ' ' . $other_args['class'];
}
$input_id = "input_{$sfgFieldNum}";
// get list delimiter - default is comma
if (array_key_exists('delimiter', $other_args)) {
$delimiter = $other_args['delimiter'];
} else {
$delimiter = ',';
}
$cur_values = SFUtils::getValuesArray($cur_value, $delimiter);
if (($possible_values = $other_args['possible_values']) == null) {
$possible_values = array();
}
$text = '';
foreach ($possible_values as $key => $possible_value) {
$cur_input_name = $input_name . '[' . $key . ']';
if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels'])) {
$label = $other_args['value_labels'][$possible_value];
} else {
$label = $possible_value;
}
$checkbox_attrs = array('id' => $input_id, 'tabindex' => $sfgTabIndex, 'class' => $checkbox_class);
if (in_array($possible_value, $cur_values)) {
$checkbox_attrs['checked'] = 'checked';
}
if ($is_disabled) {
$checkbox_attrs['disabled'] = 'disabled';
}
$checkbox_input = Html::input($cur_input_name, $possible_value, 'checkbox', $checkbox_attrs);
// Make a span around each checkbox, for CSS purposes.
$text .= "\t" . Html::rawElement('span', array('class' => $span_class), $checkbox_input . ' ' . $label) . "\n";
$sfgTabIndex++;
$sfgFieldNum++;
}
$outerSpanID = "span_{$sfgFieldNum}";
$outerSpanClass = 'checkboxesSpan';
if ($is_mandatory) {
$outerSpanClass .= ' mandatoryFieldSpan';
}
if (array_key_exists('show on select', $other_args)) {
$outerSpanClass .= ' sfShowIfChecked';
foreach ($other_args['show on select'] as $div_id => $options) {
if (array_key_exists($outerSpanID, $sfgShowOnSelect)) {
$sfgShowOnSelect[$outerSpanID][] = array($options, $div_id);
} else {
$sfgShowOnSelect[$outerSpanID] = array(array($options, $div_id));
}
}
}
$text .= Html::hidden($input_name . '[is_list]', 1);
$outerSpanAttrs = array('id' => $outerSpanID, 'class' => $outerSpanClass);
$text = "\t" . Html::rawElement('span', $outerSpanAttrs, $text) . "\n";
return $text;
}
示例6: formatValue
function formatValue($name, $value)
{
global $wgLang, $wgContLang;
static $linker = null;
if (empty($linker)) {
$linker = class_exists('DummyLinker') ? new DummyLinker() : new Linker();
}
$row = $this->mCurrentRow;
$ns = $row->page_namespace;
$title = $row->page_title;
if (is_null($ns)) {
$ns = $row->thread_article_namespace;
$title = $row->thread_article_title;
}
switch ($name) {
case 'thread_subject':
$title = Title::makeTitleSafe($ns, $title);
$link = $linker->link($title, $value, array(), array(), array('known'));
return Html::rawElement('div', array('dir' => $wgContLang->getDir()), $link);
case 'th_timestamp':
$formatted = $wgLang->timeanddate($value);
$title = Title::makeTitleSafe($ns, $title);
return $linker->link($title, $formatted, array(), array('lqt_oldid' => $row->th_id));
default:
return parent::formatValue($name, $value);
}
}
示例7: formatRow
function formatRow($row)
{
$time = htmlspecialchars($this->getLanguage()->userDate($row->log_timestamp, $this->getUser()));
$paramsSerialized = unserialize($row->log_params);
$paramsOldFormat = null;
// If the params aren't serialized, it's an older log format
if ($paramsSerialized === false) {
$paramsOldFormat = explode("\n", $row->log_params);
}
$targetName = $paramsSerialized === false ? $paramsOldFormat[0] : $paramsSerialized['4::target'];
$logPageId = (int) $row->log_page;
$currentTitle = $logPageId && $logPageId !== 0 ? Title::newFromID($logPageId) : null;
$targetTitleObj = Title::newFromText($targetName);
// Make sure the target is NS_MAIN
if ($targetTitleObj->getNamespace() !== NS_MAIN) {
return false;
}
$originalNameDisplay = '';
if ($currentTitle && $targetName !== $currentTitle->getFullText()) {
$originalNameDisplay = ' ' . $this->msg('newarticles-original-title')->params($targetName);
}
$pageLink = Linker::link($originalNameDisplay ? $currentTitle : $targetTitleObj);
$articleTypeDisplay = '';
if (isset($row->pp_value) && $row->pp_value === 'portal') {
$pageLink = Html::rawElement('strong', [], $pageLink);
$articleTypeReadable = WRArticleType::getReadableArticleTypeFromCode($row->pp_value);
$articleTypeDisplay = $this->msg('newarticles-articletype')->params($articleTypeReadable)->text();
$articleTypeDisplay = ' ' . $articleTypeDisplay;
}
$formattedRow = Html::rawElement('li', [], "{$time}: {$pageLink}{$articleTypeDisplay}{$originalNameDisplay}") . "\n";
return $formattedRow;
}
示例8: onGetPreferences
/**
* Hook: GetPreferences adds user preference
* @see https://www.mediawiki.org/wiki/Manual:Hooks/GetPreferences
*
* @param User $user
* @param array $preferences
*
* @return true
*/
public static function onGetPreferences($user, &$preferences)
{
// Intro text, do not escape the message here as it contains
// href links
$preferences['srf-prefs-intro'] = array('type' => 'info', 'label' => ' ', 'default' => Html::rawElement('span', array('class' => 'srf-prefs-intro'), wfMessage('srf-prefs-intro-text')->parseAsBlock()), 'section' => 'smw/srf', 'raw' => 1, 'rawrow' => 1);
return true;
}
示例9: wfSpecialCiteToolbox
/**
* add the cite link to the toolbar
*
* @param $skin Skin
*
* @return bool
*/
function wfSpecialCiteToolbox(&$skin)
{
if (isset($skin->data['nav_urls']['cite'])) {
echo Html::rawElement('li', array('id' => 't-cite'), Linker::link(SpecialPage::getTitleFor('Cite'), wfMessage('cite_article_link')->text(), Linker::tooltipAndAccessKeyAttribs('cite-article'), $skin->data['nav_urls']['cite']['args']));
}
return true;
}
示例10: mathTagHook
function mathTagHook($content, $attributes, $parser)
{
$text = MathHooks::mathTagHook($content, $attributes, $parser);
// the MathHooks::mathTagHooks function returns a array with some attributes, but we only want to change the text, which is at [0].
$text[0] = Html::rawElement('span', array('class' => 'math-wrapper'), $text[0]);
return $text;
}
示例11: getFormatOutput
/**
* Prepare data output
*
* @since 1.8
*
* @param array $data label => value
*/
protected function getFormatOutput(array $data)
{
//Init
$dataObject = array();
static $statNr = 0;
$chartID = 'sparkline-' . $this->params['charttype'] . '-' . ++$statNr;
$this->isHTML = true;
// Prepare data array
foreach ($data as $key => $value) {
if ($value >= $this->params['min']) {
$dataObject['label'][] = $key;
$dataObject['value'][] = $value;
}
}
$dataObject['charttype'] = $this->params['charttype'];
// Encode data objects
$requireHeadItem = array($chartID => FormatJson::encode($dataObject));
SMWOutputs::requireHeadItem($chartID, Skin::makeVariablesScript($requireHeadItem));
// RL module
SMWOutputs::requireResource('ext.srf.sparkline');
// Processing placeholder
$processing = SRFUtils::htmlProcessingElement(false);
// Chart/graph placeholder
$chart = Html::rawElement('div', array('id' => $chartID, 'class' => 'container', 'style' => "display:none;"), null);
// Beautify class selector
$class = $this->params['class'] ? ' ' . $this->params['class'] : '';
// Chart/graph wrappper
return Html::rawElement('span', array('class' => 'srf-sparkline' . $class), $processing . $chart);
}
示例12: display
protected function display()
{
$output = $this->getOutput();
// Top Infobox Messaging
if ($this->msgType != null) {
$msg = wfMessage($this->msgKey);
if ($msg->exists()) {
$output->addHTML(Html::rawElement('div', array('class' => "informations {$this->msgType}"), $msg->parse()));
}
}
switch (strtolower($this->action)) {
case strtolower(self::ACTION_USE_INVITATION):
$this->displayInvitation();
break;
case strtolower(self::ACTION_NEW):
$this->displayNew();
break;
case strtolower(self::ACTION_CHANGE):
$this->displayChange();
break;
case strtolower(self::ACTION_RENEW):
$this->displayRenew();
break;
case strtolower(self::ACTION_CANCEL):
$this->processCancel();
break;
case strtolower(self::ACTION_LIST):
default:
$this->displayList();
break;
}
}
示例13: execute
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->disallowUserJs();
# Prevent hijacked user scripts from sniffing passwords etc.
$this->requireLogin('prefsnologintext2');
$this->checkReadOnly();
if ($par == 'reset') {
$this->showResetForm();
return;
}
$out->addModules('mediawiki.special.preferences');
$out->addModuleStyles('mediawiki.special.preferences.styles');
if ($this->getRequest()->getCheck('success')) {
$out->wrapWikiMsg(Html::rawElement('div', array('class' => 'mw-preferences-messagebox successbox', 'id' => 'mw-preferences-success'), Html::element('p', array(), '$1')), 'savedprefs');
}
$this->addHelpLink('Help:Preferences');
// Load the user from the master to reduce CAS errors on double post (T95839)
$user = $this->getUser()->getInstanceForUpdate() ?: $this->getUser();
$htmlForm = Preferences::getFormObject($user, $this->getContext());
$htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit'));
$sectionTitles = $htmlForm->getPreferenceSections();
$prefTabs = '';
foreach ($sectionTitles as $key) {
$prefTabs .= Html::rawElement('li', array('role' => 'presentation', 'class' => $key === 'personal' ? 'selected' : null), Html::rawElement('a', array('id' => 'preftab-' . $key, 'role' => 'tab', 'href' => '#mw-prefsection-' . $key, 'aria-controls' => 'mw-prefsection-' . $key, 'aria-selected' => $key === 'personal' ? 'true' : 'false', 'tabIndex' => $key === 'personal' ? 0 : -1), $htmlForm->getLegend($key)));
}
$out->addHTML(Html::rawElement('ul', array('id' => 'preftoc', 'role' => 'tablist'), $prefTabs));
$htmlForm->show();
}
示例14: getHTML
public static function getHTML($cur_value, $input_name, $is_mandatory, $is_disabled, $other_args)
{
global $sfgTabIndex, $sfgFieldNum;
global $wgOut;
$scripts = array("https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false");
$scriptsHTML = '';
foreach ($scripts as $script) {
$scriptsHTML .= Html::linkedScript($script);
}
$wgOut->addHeadItem($scriptsHTML, $scriptsHTML);
$wgOut->addModules('ext.semanticforms.maps');
$parsedCurValue = SFOpenLayersInput::parseCoordinatesString($cur_value);
$coordsInput = Html::element('input', array('type' => 'text', 'class' => 'sfCoordsInput', 'name' => $input_name, 'value' => $parsedCurValue, 'size' => 40));
$mapUpdateButton = Html::element('input', array('type' => 'button', 'class' => 'sfUpdateMap', 'value' => wfMessage('sf-maps-setmarker')->parse()), null);
$addressLookupInput = Html::element('input', array('type' => 'text', 'class' => 'sfAddressInput', 'size' => 40, 'placeholder' => wfMessage('sf-maps-enteraddress')->parse()), null);
$addressLookupButton = Html::element('input', array('type' => 'button', 'class' => 'sfLookUpAddress', 'value' => wfMessage('sf-maps-lookupcoordinates')->parse()), null);
$mapCanvas = Html::element('div', array('class' => 'sfMapCanvas', 'style' => 'height: 500px; width: 500px;'), 'Map goes here...');
$fullInputHTML = <<<END
<div style="padding-bottom: 10px;">
{$coordsInput}
{$mapUpdateButton}
</div>
<div style="padding-bottom: 10px;">
{$addressLookupInput}
{$addressLookupButton}
</div>
{$mapCanvas}
END;
$text = Html::rawElement('div', array('class' => 'sfGoogleMapsInput'), $fullInputHTML);
return $text;
}
示例15: execute
/**
* Show the special page
* @param string|null $par
*/
public function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
$out->addModuleStyles('mediawiki.special');
$out->addHTML(\Html::openElement('table', array('class' => 'wikitable mw-listgrouprights-table')) . '<tr>' . \Html::element('th', null, $this->msg('listgrants-grant')->text()) . \Html::element('th', null, $this->msg('listgrants-rights')->text()) . '</tr>');
foreach ($this->getConfig()->get('GrantPermissions') as $grant => $rights) {
$descs = array();
$rights = array_filter($rights);
// remove ones with 'false'
foreach ($rights as $permission => $granted) {
$descs[] = $this->msg('listgrouprights-right-display', \User::getRightDescription($permission), '<span class="mw-listgrants-right-name">' . $permission . '</span>')->parse();
}
if (!count($descs)) {
$grantCellHtml = '';
} else {
sort($descs);
$grantCellHtml = '<ul><li>' . implode("</li>\n<li>", $descs) . '</li></ul>';
}
$id = \Sanitizer::escapeId($grant);
$out->addHTML(\Html::rawElement('tr', array('id' => $id), "<td>" . $this->msg("grant-{$grant}")->escaped() . "</td>" . "<td>" . $grantCellHtml . '</td>'));
}
$out->addHTML(\Html::closeElement('table'));
}