本文整理汇总了PHP中XML::closeElement方法的典型用法代码示例。如果您正苦于以下问题:PHP XML::closeElement方法的具体用法?PHP XML::closeElement怎么用?PHP XML::closeElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML
的用法示例。
在下文中一共展示了XML::closeElement方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfSpecialCategories
/**
* @file
* @ingroup SpecialPage
*/
function wfSpecialCategories($par = null)
{
global $wgOut, $wgRequest;
if ($par == '') {
$from = $wgRequest->getText('from');
} else {
$from = $par;
}
$cap = new CategoryPager($from);
$wgOut->addHTML(XML::openElement('div', array('class' => 'mw-spcontent')) . wfMsgExt('categoriespagetext', array('parse')) . $cap->getStartForm($from) . $cap->getNavigationBar() . '<ul>' . $cap->getBody() . '</ul>' . $cap->getNavigationBar() . XML::closeElement('div'));
}
示例2: execute
function execute($par)
{
global $wgOut, $wgUser;
$this->setHeaders();
if (!$wgUser->isAllowed('stafflog')) {
throw new PermissionsError('stafflog');
}
$pager = new StaffLoggerPager("");
$sTypesDropDown = XML::openElement('select', array('name' => 'type', 'id' => 'StaffLogFilterType'));
foreach ($this->aTypes as $k => $v) {
$sTypesDropDown .= XML::option($v, $k, $k == $this->request->getText('type', ''));
}
$sTypesDropDown .= XML::closeElement('select');
$wgOut->addHTML(XML::openElement('form', array('method' => 'get', 'action' => $this->getTitle()->getLocalURL())) . XML::openElement('fieldset') . XML::element('legend', null, wfMsg('stafflog-filter-label'), false) . XML::inputLabel(wfMsg('stafflog-filter-user'), 'user', 'StaffLogFilterUser', false, htmlspecialchars($this->request->getText('user', ''), ENT_QUOTES, 'UTF-8')) . XML::label(wfMsg('stafflog-filter-type'), 'StaffLogFilterType') . ' ' . $sTypesDropDown . ' ' . XML::submitButton(wfMsg('stafflog-filter-apply')) . XML::closeElement('fieldset') . XML::closeElement('form') . XML::openElement('div', array('class' => 'mw-spcontent')) . $pager->getNavigationBar() . '<ul>' . $pager->getBody() . '</ul>' . $pager->getNavigationBar() . XML::closeElement('div'));
}
示例3: execute
function execute($par)
{
global $wgOut, $wgRequest;
$format = $wgRequest->getVal("format", false);
if ($format === "xml" || $format === "csv") {
$this->generateList($format);
} else {
$wgOut->setPageTitle(wfMsg('newwikis'));
$up = new NewWikisPage($par);
# getBody() first to check, if empty
$usersbody = $up->getBody();
$s = XML::openElement('div', array('class' => 'mw-spcontent'));
$s .= $up->getPageHeader();
if ($usersbody) {
$s .= $up->getNavigationBar();
$s .= '<ul>' . $usersbody . '</ul>';
$s .= $up->getNavigationBar();
} else {
$s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
}
$s .= XML::closeElement('div');
$wgOut->addHTML($s);
}
}
示例4: outputResults
public function outputResults($skin, $data)
{
global $wgContLang, $wgLang, $wgOut;
wfProfileIn(__METHOD__);
$num = 0;
$html = array();
if ($this->mShow) {
$wgOut->addHTML(XML::openElement('div', array('class' => 'mw-spcontent')));
}
if (isset($data) && $data['numrec'] > 0) {
$num = $data['numrec'];
if ($this->mShow) {
$html[] = XML::openElement('ol', array('start' => $this->offset + 1, 'class' => 'special'));
}
if ($data['numrec'] <= self::ORDER_ROWS) {
arsort($data['order']);
}
$loop = 0;
$skip = 0;
foreach ($data['order'] as $city_id => $ordered) {
# check loop
if ($loop >= $this->offset && $loop < $this->limit + $this->offset) {
list($page_id, $page_url, $page_server) = $data['rows'][$city_id];
# page url
if (empty($page_url) || empty($page_server)) {
$oGTitle = GlobalTitle::newFromText($this->mPageTitle, $this->mPageNS, $city_id);
if (is_object($oGTitle)) {
$page_url = $oGTitle->getFullURL();
$page_server = $oGTitle->getServer();
}
if (empty($page_url) || empty($page_server)) {
$skip++;
continue;
}
}
# check Wiki
if (!empty($city_id)) {
$oWikia = WikiFactory::getWikiByID($city_id);
if (empty($oWikia) || empty($oWikia->city_public)) {
continue;
}
}
if (empty($this->mShow)) {
$res = "";
$this->data[$city_id] = array('city_id' => $city_id, 'page_id' => $page_id, 'url' => $page_url);
} else {
$res = wfSpecialList(Xml::openElement('a', array('href' => $page_url)) . $page_url . Xml::closeElement('a'), "");
}
$html[] = $this->mShow ? Xml::openElement('li') . $res . Xml::closeElement('li') : "";
}
$loop++;
}
$num = $num - $skip;
if ($this->mShow) {
$html[] = XML::closeElement('ol');
}
}
# Top header and navigation
if ($this->mShow) {
$wgOut->addHTML('<p>' . wfMsgExt('multiwikirecords', array(), $num) . '</p>');
if ($num > 0) {
$wgOut->addHTML('<p>' . wfShowingResults($this->offset, $num) . '</p>');
# Disable the "next" link when we reach the end
$paging = $wgLang->viewPrevNext(SpecialPage::getTitleFor($this->mName), $this->offset, $this->limit, $this->linkParameters(), $num < $this->limit);
$wgOut->addHTML('<p>' . $paging . '</p>');
} else {
$wgOut->addHTML(XML::closeElement('div'));
return;
}
}
$html = $this->mShow ? implode('', $html) : $wgContLang->listToText($html);
$wgOut->addHTML($html);
# Repeat the paging links at the bottom
if ($this->mShow) {
$wgOut->addHTML('<p>' . $paging . '</p>');
}
$wgOut->addHTML(XML::closeElement('div'));
wfProfileOut(__METHOD__);
return $num;
}
示例5: exportSite
/**
* Writes a <site> tag representing the given Site object.
*
* @param Site $site
*/
private function exportSite(Site $site)
{
if ($site->getType() !== Site::TYPE_UNKNOWN) {
$siteAttr = array('type' => $site->getType());
} else {
$siteAttr = null;
}
fwrite($this->sink, "\t" . XML::openElement('site', $siteAttr) . "\n");
fwrite($this->sink, "\t\t" . XML::element('globalid', null, $site->getGlobalId()) . "\n");
if ($site->getGroup() !== Site::GROUP_NONE) {
fwrite($this->sink, "\t\t" . XML::element('group', null, $site->getGroup()) . "\n");
}
if ($site->getSource() !== Site::SOURCE_LOCAL) {
fwrite($this->sink, "\t\t" . XML::element('source', null, $site->getSource()) . "\n");
}
if ($site->shouldForward()) {
fwrite($this->sink, "\t\t" . XML::element('forward', null, '') . "\n");
}
foreach ($site->getAllPaths() as $type => $path) {
fwrite($this->sink, "\t\t" . XML::element('path', array('type' => $type), $path) . "\n");
}
foreach ($site->getLocalIds() as $type => $ids) {
foreach ($ids as $id) {
fwrite($this->sink, "\t\t" . XML::element('localid', array('type' => $type), $id) . "\n");
}
}
//@todo: export <data>
//@todo: export <config>
fwrite($this->sink, "\t" . XML::closeElement('site') . "\n");
}
示例6: wfSpecialListusers
/**
* constructor
* $par string (optional) A group to list users from
*/
function wfSpecialListusers($par = null)
{
global $wgRequest, $wgOut;
$up = new UsersPager($par);
# getBody() first to check, if empty
$usersbody = $up->getBody();
$s = XML::openElement('div', array('class' => 'mw-spcontent'));
$s .= $up->getPageHeader();
if ($usersbody) {
$s .= $up->getNavigationBar();
$s .= '<ul>' . $usersbody . '</ul>';
$s .= $up->getNavigationBar();
} else {
$s .= '<p>' . wfMsgHTML('listusers-noresult') . '</p>';
}
$s .= XML::closeElement('div');
$wgOut->addHTML($s);
}
示例7: doQuery
/**
* This is the actual workhorse. It does everything needed to make a
* real, honest-to-gosh query page.
*
* @param $offset database query offset
* @param $limit database query limit
* @param $shownavigation show navigation like "next 200"?
*/
function doQuery($offset, $limit, $shownavigation = true)
{
global $wgUser, $wgOut, $wgLang, $wgContLang;
$this->offset = $offset;
$this->limit = $limit;
$sname = $this->getName();
$fname = get_class($this) . '::doQuery';
$dbr = wfGetDB(DB_SLAVE);
$wgOut->setSyndicated($this->isSyndicated());
if (!$this->isCached()) {
$sql = $this->getSQL();
} else {
# Get the cached result
$querycache = $dbr->tableName('querycache');
$type = $dbr->strencode($sname);
$sql = "SELECT qc_type as type, qc_namespace as namespace,qc_title as title, qc_value as value\n\t\t\t\t FROM {$querycache} WHERE qc_type='{$type}'";
if (!$this->listoutput) {
# Fetch the timestamp of this update
$tRes = $dbr->select('querycache_info', array('qci_timestamp'), array('qci_type' => $type), $fname);
$tRow = $dbr->fetchObject($tRes);
if ($tRow) {
$updated = $wgLang->timeAndDate($tRow->qci_timestamp, true, true);
$wgOut->addMeta('Data-Cache-Time', $tRow->qci_timestamp);
$wgOut->addInlineScript("var dataCacheTime = '{$tRow->qci_timestamp}';");
$wgOut->addWikiMsg('perfcachedts', $updated);
} else {
$wgOut->addWikiMsg('perfcached');
}
# If updates on this page have been disabled, let the user know
# that the data set won't be refreshed for now
global $wgDisableQueryPageUpdate;
if (is_array($wgDisableQueryPageUpdate) && in_array($this->getName(), $wgDisableQueryPageUpdate)) {
$wgOut->addWikiMsg('querypage-no-updates');
}
}
}
$sql .= $this->getOrder();
$sql = $dbr->limitResult($sql, $limit, $offset);
$res = $dbr->query($sql);
$num = $dbr->numRows($res);
$this->preprocessResults($dbr, $res);
$wgOut->addHTML(XML::openElement('div', array('class' => 'mw-spcontent')));
# Top header and navigation
if ($shownavigation) {
$wgOut->addHTML($this->getPageHeader());
if ($num > 0) {
$wgOut->addHTML('<p>' . wfShowingResults($offset, $num) . '</p>');
# Disable the "next" link when we reach the end
$paging = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $num < $limit);
$wgOut->addHTML('<p>' . $paging . '</p>');
} else {
# No results to show, so don't bother with "showing X of Y" etc.
# -- just let the user know and give up now
$wgOut->addHTML('<p>' . wfMsgHtml('specialpage-empty') . '</p>');
$wgOut->addHTML(XML::closeElement('div'));
return;
}
}
# The actual results; specialist subclasses will want to handle this
# with more than a straight list, so we hand them the info, plus
# an OutputPage, and let them get on with it
$this->outputResults($wgOut, $wgUser->getSkin(), $dbr, $res, $dbr->numRows($res), $offset);
# Repeat the paging links at the bottom
if ($shownavigation) {
$wgOut->addHTML('<p>' . $paging . '</p>');
}
$wgOut->addHTML(XML::closeElement('div'));
return $num;
}