• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfShowingResults函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfShowingResults函数的典型用法代码示例。如果您正苦于以下问题:PHP wfShowingResults函数的具体用法?PHP wfShowingResults怎么用?PHP wfShowingResults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wfShowingResults函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: doQuery

 /**
  * As with QueryPage, 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, $wgContLang;
     $this->offset = $offset;
     $this->limit = $limit;
     $sname = $this->getName();
     $fname = get_class($this) . '::doQuery';
     $sk = $wgUser->getSkin();
     $wgOut->setSyndicated($this->isSyndicated());
     $query = MwRdf::Query($this->getQuery(), $this->getBaseUrl(), $this->getQueryLanguage());
     $librdf_res = $query->execute(MwRdf::StoredModel());
     # let's just dump the tuples into a normal php array shall
     # we?  This will avoid memory management hassels.
     $res = array();
     foreach ($librdf_res as $tuple) {
         $res[] = $tuple;
     }
     $num = count($res);
     $res = $this->preprocessResults($res);
     if ($shownavigation) {
         $wgOut->addHTML($this->getPageHeader());
         $top = wfShowingResults($offset, $num);
         $wgOut->addHTML("<p>{$top}\n");
         # often disable 'next' link when we reach the end
         $atend = $num < $limit;
         $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $atend);
         $wgOut->addHTML("<br />{$sl}</p>\n");
     }
     if ($num > 0) {
         $s = array();
         if (!$this->listoutput) {
             $s[] = "<ol start='" . ($offset + 1) . "' class='special'>";
         }
         # here's where we do the offset and limit
         for ($i = $offset; $i < $num && $i < $offset + $limit; $i++) {
             $format = $this->formatResult($sk, $res[$i]);
             if ($format) {
                 $s[] = $this->listoutput ? $format : "<li>{$format}</li>\n";
             }
         }
         if (!$this->listoutput) {
             $s[] = '</ol>';
         }
         $str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s);
         $wgOut->addHTML($str);
     }
     if ($shownavigation) {
         $wgOut->addHTML("<p>{$sl}</p>\n");
     }
     return $num;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:59,代码来源:QueryPage.php


示例2: doQuery

 /**
  * This is the actual workhorse. It does everything needed to make a
  * real, honest-to-gosh query page.
  * Alas, we need to overwrite the whole beast since we do not assume
  * an SQL-based storage backend.
  *
  * @param $offset database query offset
  * @param $limit database query limit
  */
 function doQuery($offset = false, $limit = false)
 {
     global $wgOut, $wgContLang;
     $options = new SMWRequestOptions();
     $options->limit = $limit;
     $options->offset = $offset;
     $options->sort = true;
     $res = $this->getResults($options);
     $num = count($res);
     $sk = $this->getSkin();
     $sname = $this->getName();
     $wgOut->addHTML($this->getPageHeader());
     // if list is empty, show it
     if ($num == 0) {
         $wgOut->addHTML('<p>' . wfMsgHTML('specialpage-empty') . '</p>');
         return;
     }
     $top = wfShowingResults($offset, $num);
     $wgOut->addHTML("<p>{$top}\n");
     // often disable 'next' link when we reach the end
     $atend = $num < $limit;
     $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $atend);
     $wgOut->addHTML("<br />{$sl}</p>\n");
     if ($num > 0) {
         $s = array();
         if (!$this->listoutput) {
             $s[] = $this->openList($offset);
         }
         foreach ($res as $r) {
             $format = $this->formatResult($sk, $r);
             if ($format) {
                 $s[] = $this->listoutput ? $format : "<li>{$format}</li>\n";
             }
         }
         if (!$this->listoutput) {
             $s[] = $this->closeList();
         }
         $str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s);
         $wgOut->addHTML($str);
     }
     $wgOut->addHTML("<p>{$sl}</p>\n");
     return $num;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:52,代码来源:SMW_QueryPage.php


示例3: 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);
                 $updateddate = $wgLang->date($tRow->qci_timestamp, true, true);
                 $updatedtime = $wgLang->time($tRow->qci_timestamp, true, true);
                 $wgOut->addMeta('Data-Cache-Time', $tRow->qci_timestamp);
                 $wgOut->addInlineScript("var dataCacheTime = '{$tRow->qci_timestamp}';");
                 $wgOut->addWikiMsg('perfcachedts', $updated, $updateddate, $updatedtime);
             } 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;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:79,代码来源:QueryPage.php


示例4: execute

 /**
  * This is the actual workhorse. It does everything needed to make a
  * real, honest-to-gosh query page.
  */
 function execute($par)
 {
     global $wgUser, $wgOut, $wgLang, $wgRequest;
     if (!$this->userCanExecute($wgUser)) {
         $this->displayRestrictionError();
         return;
     }
     if ($this->limit == 0 && $this->offset == 0) {
         list($this->limit, $this->offset) = $wgRequest->getLimitOffset();
     }
     $dbr = wfGetDB(DB_SLAVE);
     $this->setHeaders();
     $wgOut->setSyndicated($this->isSyndicated());
     if ($this->isCached() && !$this->isCacheable()) {
         $wgOut->setSyndicated(false);
         $wgOut->addWikiMsg('querypage-disabled');
         return 0;
     }
     // TODO: Use doQuery()
     // $res = null;
     if (!$this->isCached()) {
         $res = $this->reallyDoQuery($this->limit, $this->offset);
     } else {
         # Get the cached result
         $res = $this->fetchFromCache($this->limit, $this->offset);
         if (!$this->listoutput) {
             # Fetch the timestamp of this update
             $ts = $this->getCachedTimestamp();
             if ($ts) {
                 $updated = $wgLang->timeanddate($ts, true, true);
                 $updateddate = $wgLang->date($ts, true, true);
                 $updatedtime = $wgLang->time($ts, true, true);
                 $wgOut->addMeta('Data-Cache-Time', $ts);
                 $wgOut->addInlineScript("var dataCacheTime = '{$ts}';");
                 $wgOut->addWikiMsg('perfcachedts', $updated, $updateddate, $updatedtime);
             } 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');
             }
         }
     }
     $this->numRows = $dbr->numRows($res);
     $this->preprocessResults($dbr, $res);
     $wgOut->addHTML(Xml::openElement('div', array('class' => 'mw-spcontent')));
     # Top header and navigation
     if ($this->shownavigation) {
         $wgOut->addHTML($this->getPageHeader());
         if ($this->numRows > 0) {
             $wgOut->addHTML('<p>' . wfShowingResults($this->offset, $this->numRows) . '</p>');
             # Disable the "next" link when we reach the end
             $paging = wfViewPrevNext($this->offset, $this->limit, $this->getTitle($par), wfArrayToCGI($this->linkParameters()), $this->numRows < $this->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, $this->getSkin(), $dbr, $res, $this->numRows, $this->offset);
     # Repeat the paging links at the bottom
     if ($this->shownavigation) {
         $wgOut->addHTML('<p>' . $paging . '</p>');
     }
     $wgOut->addHTML(Xml::closeElement('div'));
     return $this->numRows;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:80,代码来源:QueryPage.php


示例5: formHeader

 protected function formHeader($term, $resultsShown, $totalNum)
 {
     global $wgContLang, $wgLang;
     $out = Xml::openElement('div', array('class' => 'mw-search-formheader'));
     $bareterm = $term;
     if ($this->startsWithImage($term)) {
         // Deletes prefixes
         $bareterm = substr($term, strpos($term, ':') + 1);
     }
     $profiles = $this->getSearchProfiles();
     // Outputs XML for Search Types
     $out .= Xml::openElement('div', array('class' => 'search-types'));
     $out .= Xml::openElement('ul');
     foreach ($profiles as $id => $profile) {
         $tooltipParam = isset($profile['namespace-messages']) ? $wgLang->commaList($profile['namespace-messages']) : null;
         $out .= Xml::tags('li', array('class' => $this->active == $id ? 'current' : 'normal'), $this->makeSearchLink($bareterm, $profile['namespaces'], wfMsg($profile['message']), wfMsg($profile['tooltip'], $tooltipParam), isset($profile['parameters']) ? $profile['parameters'] : array()));
     }
     $out .= Xml::closeElement('ul');
     $out .= Xml::closeElement('div');
     // Results-info
     if ($resultsShown > 0) {
         if ($totalNum > 0) {
             $top = wfMsgExt('showingresultsheader', array('parseinline'), $wgLang->formatNum($this->offset + 1), $wgLang->formatNum($this->offset + $resultsShown), $wgLang->formatNum($totalNum), wfEscapeWikiText($term), $wgLang->formatNum($resultsShown));
         } elseif ($resultsShown >= $this->limit) {
             $top = wfShowingResults($this->offset, $this->limit);
         } else {
             $top = wfShowingResultsNum($this->offset, $this->limit, $resultsShown);
         }
         $out .= Xml::tags('div', array('class' => 'results-info'), Xml::tags('ul', null, Xml::tags('li', null, $top)));
     }
     $out .= Xml::element('div', array('style' => 'clear:both'), '', false);
     $out .= Xml::closeElement('div');
     // Adds hidden namespace fields
     if (!$this->searchAdvanced) {
         foreach ($this->namespaces as $ns) {
             $out .= Xml::hidden("ns{$ns}", '1');
         }
     }
     return $out;
 }
开发者ID:BackupTheBerlios,项目名称:swahili-dict,代码行数:40,代码来源:SpecialSearch.php


示例6: 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;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:80,代码来源:SpecialMultiWikiFinder_body.php


示例7: formHeader

 protected function formHeader($resultsShown, $totalNum)
 {
     global $wgLang;
     $out = Xml::openElement('div', array('class' => 'mw-search-formheader'));
     // Results-info
     if ($resultsShown > 0) {
         if ($totalNum > 0) {
             $top = wfMsgExt('showingresultsheader', array('parseinline'), $wgLang->formatNum($this->offset + 1), $wgLang->formatNum($this->offset + $resultsShown), $wgLang->formatNum($totalNum), $wgLang->formatNum($resultsShown));
         } elseif ($resultsShown >= $this->limit) {
             $top = wfShowingResults($this->offset, $this->limit);
         } else {
             $top = wfShowingResultsNum($this->offset, $this->limit, $resultsShown);
         }
         $out .= Xml::tags('div', array('class' => 'results-info'), Xml::tags('ul', null, Xml::tags('li', null, $top)));
     }
     $out .= Xml::element('div', array('style' => 'clear:both'), '', false);
     $out .= Xml::closeElement('div');
     return $out;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:19,代码来源:SpecialSolrSearch.php


示例8: 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';
     $sql = $this->getSQL();
     $dbr =& wfGetDB(DB_SLAVE);
     $querycache = $dbr->tableName('querycache');
     $wgOut->setSyndicated($this->isSyndicated());
     if ($this->isCached()) {
         $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);
                 $cacheNotice = wfMsg('perfcachedts', $updated);
                 $wgOut->addMeta('Data-Cache-Time', $tRow->qci_timestamp);
                 $wgOut->addScript('<script language="JavaScript">var dataCacheTime = \'' . $tRow->qci_timestamp . '\';</script>');
             } else {
                 $cacheNotice = wfMsg('perfcached');
             }
             $wgOut->addWikiText($cacheNotice);
         }
     }
     $sql .= $this->getOrder();
     $sql = $dbr->limitResult($sql, $limit, $offset);
     $res = $dbr->query($sql);
     $num = $dbr->numRows($res);
     $this->preprocessResults($dbr, $res);
     $sk = $wgUser->getSkin();
     if ($shownavigation) {
         $wgOut->addHTML($this->getPageHeader());
         $top = wfShowingResults($offset, $num);
         $wgOut->addHTML("<p>{$top}\n");
         # often disable 'next' link when we reach the end
         $atend = $num < $limit;
         $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $atend);
         $wgOut->addHTML("<br />{$sl}</p>\n");
     }
     if ($num > 0) {
         $s = array();
         if (!$this->listoutput) {
             $s[] = "<ol start='" . ($offset + 1) . "' class='special'>";
         }
         # Only read at most $num rows, because $res may contain the whole 1000
         for ($i = 0; $i < $num && ($obj = $dbr->fetchObject($res)); $i++) {
             $format = $this->formatResult($sk, $obj);
             if ($format) {
                 $attr = isset($obj->usepatrol) && $obj->usepatrol && $obj->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $s[] = $this->listoutput ? $format : "<li{$attr}>{$format}</li>\n";
             }
         }
         if ($this->tryLastResult()) {
             // flush the very last result
             $obj = null;
             $format = $this->formatResult($sk, $obj);
             if ($format) {
                 $attr = isset($obj->usepatrol) && $obj->usepatrol && $obj->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $s[] = "<li{$attr}>{$format}</li>\n";
             }
         }
         $dbr->freeResult($res);
         if (!$this->listoutput) {
             $s[] = '</ol>';
         }
         $str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s);
         $wgOut->addHTML($str);
     }
     if ($shownavigation) {
         $wgOut->addHTML("<p>{$sl}</p>\n");
     }
     return $num;
 }
开发者ID:puring0815,项目名称:OpenKore,代码行数:86,代码来源:QueryPage.php


示例9: showResults

 /**
  * @param string $term
  * @access public
  */
 function showResults($term)
 {
     $fname = 'SpecialSearch::showResults';
     wfProfileIn($fname);
     $this->setupPage($term);
     global $wgUser, $wgOut;
     $sk = $wgUser->getSkin();
     $wgOut->addWikiText(wfMsg('searchresulttext'));
     #if ( !$this->parseQuery() ) {
     if ('' === trim($term)) {
         $wgOut->setSubtitle('');
         $wgOut->addHTML($this->powerSearchBox($term));
         wfProfileOut($fname);
         return;
     }
     global $wgDisableTextSearch;
     if ($wgDisableTextSearch) {
         global $wgForwardSearchUrl;
         if ($wgForwardSearchUrl) {
             $url = str_replace('$1', urlencode($term), $wgForwardSearchUrl);
             $wgOut->redirect($url);
             return;
         }
         global $wgInputEncoding;
         $wgOut->addHTML(wfMsg('searchdisabled'));
         $wgOut->addHTML(wfMsg('googlesearch', htmlspecialchars($term), htmlspecialchars($wgInputEncoding), htmlspecialchars(wfMsg('search'))));
         wfProfileOut($fname);
         return;
     }
     $search =& SearchEngine::create();
     $search->setLimitOffset($this->limit, $this->offset);
     $search->setNamespaces($this->namespaces);
     $titleMatches = $search->searchTitle($term);
     $textMatches = $search->searchText($term);
     $num = ($titleMatches ? $titleMatches->numRows() : 0) + ($textMatches ? $textMatches->numRows() : 0);
     if ($num >= $this->limit) {
         $top = wfShowingResults($this->offset, $this->limit);
     } else {
         $top = wfShowingResultsNum($this->offset, $this->limit, $num);
     }
     $wgOut->addHTML("<p>{$top}</p>\n");
     if ($num || $this->offset) {
         $prevnext = wfViewPrevNext($this->offset, $this->limit, 'Special:Search', wfArrayToCGI($this->powerSearchOptions(), array('search' => $term)));
         $wgOut->addHTML("<br />{$prevnext}\n");
     }
     if ($titleMatches) {
         if ($titleMatches->numRows()) {
             $wgOut->addWikiText('==' . wfMsg('titlematches') . "==\n");
             $wgOut->addHTML($this->showMatches($titleMatches));
         } else {
             $wgOut->addWikiText('==' . wfMsg('notitlematches') . "==\n");
         }
     }
     if ($textMatches) {
         if ($textMatches->numRows()) {
             $wgOut->addWikiText('==' . wfMsg('textmatches') . "==\n");
             $wgOut->addHTML($this->showMatches($textMatches));
         } elseif ($num == 0) {
             # Don't show the 'no text matches' if we received title matches
             $wgOut->addWikiText('==' . wfMsg('notextmatches') . "==\n");
         }
     }
     if ($num == 0) {
         $wgOut->addWikiText(wfMsg('nonefound'));
     }
     if ($num || $this->offset) {
         $wgOut->addHTML("<p>{$prevnext}</p>\n");
     }
     $wgOut->addHTML($this->powerSearchBox($term));
     wfProfileOut($fname);
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:75,代码来源:SpecialSearch.php


示例10: doQuery

 function doQuery($offset, $limit, $shownavigation = true)
 {
     global $wgOut, $wgContLang;
     $res = $this->getIntervalResults($offset, $limit);
     $num = count($res);
     if ($shownavigation) {
         $wgOut->addHTML($this->getPageHeader());
         // if list is empty, display a warning
         if ($num == 0) {
             $wgOut->addHTML('<p>' . wfMsgHTML('specialpage-empty') . '</p>');
             return;
         }
         $top = wfShowingResults($offset, $num);
         $wgOut->addHTML("<p>{$top}\n");
         // often disable 'next' link when we reach the end
         $atend = $num < $limit;
         $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($this->queryPageName()), wfArrayToCGI($this->linkParameters()), $atend);
         $wgOut->addHTML("<br />{$sl}</p>\n");
     }
     if ($num > 0) {
         $s = array();
         if (!$this->listoutput) {
             $s[] = $this->openList($offset);
         }
         foreach ($res as $r) {
             $format = $this->formatResult($r);
             if ($format) {
                 $s[] = $this->listoutput ? $format : "<li>{$format}</li>\n";
             }
         }
         if (!$this->listoutput) {
             $s[] = $this->closeList();
         }
         $str = $this->listoutput ? $wgContLang->listToText($s) : implode('', $s);
         $wgOut->addHTML($str);
     }
     if ($shownavigation) {
         $wgOut->addHTML("<p>{$sl}</p>\n");
     }
     return $num;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:41,代码来源:qp_special.php


示例11: 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, $wgRequest, $wgContLang;
     global $wgMiserMode;
     $sname = $this->getName();
     $fname = get_class($this) . '::doQuery';
     $sql = $this->getSQL();
     $dbr =& wfGetDB(DB_SLAVE);
     $dbw =& wfGetDB(DB_MASTER);
     $querycache = $dbr->tableName('querycache');
     $wgOut->setSyndicated($this->isSyndicated());
     if ($this->isExpensive()) {
         // Disabled recache parameter due to retry problems -- TS
         if ($wgMiserMode) {
             $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\t FROM {$querycache} WHERE qc_type='{$type}'";
             $wgOut->addWikiText(wfMsg('perfcached'));
         }
     }
     $res = $dbr->query($sql . $this->getOrder() . $dbr->limitResult($limit, $offset), $fname);
     $num = $dbr->numRows($res);
     $sk = $wgUser->getSkin();
     if ($shownavigation) {
         $wgOut->addHTML($this->getPageHeader());
         $top = wfShowingResults($offset, $num);
         $wgOut->addHTML("<p>{$top}\n");
         # often disable 'next' link when we reach the end
         if ($num < $limit) {
             $atend = true;
         } else {
             $atend = false;
         }
         $sl = wfViewPrevNext($offset, $limit, $wgContLang->specialPage($sname), wfArrayToCGI($this->linkParameters()), $atend);
         $wgOut->addHTML("<br />{$sl}</p>\n");
     }
     if ($num > 0) {
         $s = "<ol start='" . ($offset + 1) . "' class='special'>";
         # Only read at most $num rows, because $res may contain the whole 1000
         for ($i = 0; $i < $num && ($obj = $dbr->fetchObject($res)); $i++) {
             $format = $this->formatResult($sk, $obj);
             if ($format) {
                 $attr = isset($obj->usepatrol) && $obj->usepatrol && $obj->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $s .= "<li{$attr}>{$format}</li>\n";
             }
         }
         if ($this->tryLastResult()) {
             // flush the very last result
             $obj = null;
             $format = $this->formatResult($sk, $obj);
             if ($format) {
                 $attr = isset($obj->usepatrol) && $obj->usepatrol && $obj->patrolled == 0 ? ' class="not-patrolled"' : '';
                 $s .= "<li{$attr}>{$format}</li>\n";
             }
         }
         $dbr->freeResult($res);
         $s .= '</ol>';
         $wgOut->addHTML($s);
     }
     if ($shownavigation) {
         $wgOut->addHTML("<p>{$sl}</p>\n");
     }
     return $num;
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:71,代码来源:QueryPage.php


示例12: showResults

 /**
  * @param string $term
  * @public
  */
 function showResults($term)
 {
     $fname = 'SpecialSearch::showResults';
     wfProfileIn($fname);
     $this->setupPage($term);
     global $wgOut;
     $wgOut->addWikiMsg('searchresulttext');
     if ('' === trim($term)) {
         // Empty query -- straight view of search form
         $wgOut->setSubtitle('');
         $wgOut->addHTML($this->powerSearchBox($term));
         $wgOut->addHTML($this->powerSearchFocus());
         wfProfileOut($fname);
         return;
     }
     global $wgDisableTextSearch;
     if ($wgDisableTextSearch) {
         global $wgForwardSearchUrl;
         if ($wgForwardSearchUrl) {
             $url = str_replace('$1', urlencode($term), $wgForwardSearchUrl);
             $wgOut->redirect($url);
             return;
         }
         global $wgInputEncoding;
         $wgOut->addHTML(wfMsg('searchdisabled'));
         $wgOut->addHTML(wfMsg('googlesearch', htmlspecialchars($term), htmlspecialchars($wgInputEncoding), htmlspecialchars(wfMsg('searchbutton'))));
         wfProfileOut($fname);
         return;
     }
     $search = SearchEngine::create();
     $search->setLimitOffset($this->limit, $this->offset);
     $search->setNamespaces($this->namespaces);
     $search->showRedirects = $this->searchRedirects;
     $titleMatches = $search->searchTitle($term);
     // Sometimes the search engine knows there are too many hits
     if ($titleMatches instanceof SearchResultTooMany) {
         $wgOut->addWikiText('==' . wfMsg('toomanymatches') . "==\n");
         $wgOut->addHTML($this->powerSearchBox($term));
         $wgOut->addHTML($this->powerSearchFocus());
         wfProfileOut($fname);
         return;
     }
     $textMatches = $search->searchText($term);
     $num = ($titleMatches ? $titleMatches->numRows() : 0) + ($textMatches ? $textMatches->numRows() : 0);
     if ($num > 0) {
         if ($num >= $this->limit) {
             $top = wfShowingResults($this->offset, $this->limit);
         } else {
             $top = wfShowingResultsNum($this->offset, $this->limit, $num);
         }
         $wgOut->addHTML("<p>{$top}</p>\n");
     }
     if ($num || $this->offset) {
         $prevnext = wfViewPrevNext($this->offset, $this->limit, SpecialPage::getTitleFor('Search'), wfArrayToCGI($this->powerSearchOptions(), array('search' => $term)), $num < $this->limit);
         $wgOut->addHTML("<br />{$prevnext}\n");
     }
     if ($titleMatches) {
         if ($titleMatches->numRows()) {
             $wgOut->wrapWikiMsg("==\$1==\n", 'titlematches');
             $wgOut->addHTML($this->showMatches($titleMatches));
         } else {
             $wgOut->wrapWikiMsg("==\$1==\n", 'notitlematches');
         }
         $titleMatches->free();
     }
     if ($textMatches) {
         if ($textMatches->numRows()) {
             $wgOut->wrapWikiMsg("==\$1==\n", 'textmatches');
             $wgOut->addHTML($this->showMatches($textMatches));
         } elseif ($num == 0) {
             # Don't show the 'no text matches' if we received title matches
             $wgOut->wrapWikiMsg("==\$1==\n", 'notextmatches');
         }
         $textMatches->free();
     }
     if ($num == 0) {
         $wgOut->addWikiMsg('nonefound');
     }
     if ($num || $this->offset) {
         $wgOut->addHTML("<p>{$prevnext}</p>\n");
     }
     $wgOut->addHTML($this->powerSearchBox($term));
     wfProfileOut($fname);
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:88,代码来源:SpecialSearch.php


示例13: showResults

 /**
  * @param string $term
  * @public
  */
 function showResults($term)
 {
     wfProfileIn(__METHOD__);
     global $wgOut, $wgUser;
     $sk = $wgUser->getSkin();
     $search = SearchEngine::create();
     $search->setLimitOffset($this->limit, $this->offset);
     $search->setNamespaces($this->namespaces);
     $search->showRedirects = $this->searchRedirects;
     $search->prefix = $this->mPrefix;
     $term = $search->transformSearchTerm($term);
     $this->setupPage($term);
     $rewritten = $search->replacePrefixes($term);
     $titleMatches = $search->searchTitle($rewritten);
     $textMatches = $search->searchText($rewritten);
     // did you mean... suggestions
     if ($textMatches && $textMatches->hasSuggestion()) {
         $st = SpecialPage::getTitleFor('Search');
         $stParams = wfArrayToCGI(array('search' => $textMatches->getSuggestionQuery(), 'fulltext' => wfMsg('search')), $this->powerSearchOptions());
         $suggestLink = $sk->makeKnownLinkObj($st, $textMatches->getSuggestionSnippet(), $stParams);
         $wgOut->addHTML('<div class="searchdidyoumean">' . wfMsg('search-suggest', $suggestLink) . '</div>');
     }
     $wgOut->addWikiMsg('searchresulttext');
     if ('' === trim($term)) {
         // Empty query -- straight view of search form
         $wgOut->setSubtitle('');
         $wgOut->addHTML($this->powerSearchBox($term));
         $wgOut->addHTML($this->powerSearchFocus());
         wfProfileOut(__METHOD__);
         return;
     }
     global $wgDisableTextSearch;
     if ($wgDisableTextSearch) {
         global $wgSearchForwardUrl;
         if ($wgSearchForwardUrl) {
             $url = str_replace('$1', urlencode($term), $wgSearchForwardUrl);
             $wgOut->redirect($url);
             wfProfileOut(__METHOD__);
             return;
         }
         global $wgInputEncoding;
         $wgOut->addHTML(Xml::openElement('fieldset') . Xml::element('legend', null, wfMsg('search-external')) . Xml::element('p', array('class' => 'mw-searchdisabled'), wfMsg('searchdisabled')) . wfMsg('googlesearch', htmlspecialchars($term), htmlspecialchars($wgInputEncoding), htmlspecialchars(wfMsg('searchbutton'))) . Xml::closeElement('fieldset'));
         wfProfileOut(__METHOD__);
         return;
     }
     $wgOut->addHTML($this->shortDialog($term));
     // Sometimes the search engine knows there are too many hits
     if ($titleMatches instanceof SearchResultTooMany) {
         $wgOut->addWikiText('==' . wfMsg('toomanymatches') . "==\n");
         $wgOut->addHTML($this->powerSearchBox($term));
         $wgOut->addHTML($this->powerSearchFocus());
         wfProfileOut(__METHOD__);
         return;
     }
     // show number of results
     $num = ($titleMatches ? $titleMatches->numRows() : 0) + ($textMatches ? $textMatches->numRows() : 0);
     $totalNum = 0;
     if ($titleMatches && !is_null($titleMatches->getTotalHits())) {
         $totalNum += $titleMatches->getTotalHits();
     }
     if ($textMatches && !is_null($textMatches->getTotalHits())) {
         $totalNum += $textMatches->getTotalHits();
     }
     if ($num > 0) {
         if ($totalNum > 0) {
             $top = wfMsgExt('showingresultstotal', array('parseinline'), $this->offset + 1, $this->offset + $num, $totalNum, $num);
         } elseif ($num >= $this->limit) {
             $top = wfShowingResults($this->offset, $this->limit);
         } else {
             $top = wfShowingResultsNum($this->offset, $this->limit, $num);
         }
         $wgOut->addHTML("<p class='mw-search-numberresults'>{$top}</p>\n");
     }
     // prev/next links
     if ($num || $this->offset) {
         $prevnext = wfViewPrevNext($this->offset, $this->limit, SpecialPage::getTitleFor('Search'), wfArrayToCGI($this->powerSearchOptions(), array('search' => $term)), $num < $this->limit);
         $wgOut->addHTML("<p class='mw-search-pager-top'>{$prevnext}</p>\n");
         wfRunHooks('SpecialSearchResults', array($term, &$titleMatches, &$textMatches));
     } else {
         wfRunHooks('SpecialSearchNoResults', array($term));
     }
     if ($titleMatches) {
         if ($titleMatches->numRows()) {
             $wgOut->wrapWikiMsg("==\$1==\n", 'titlematches');
             $wgOut->addHTML($this->showMatches($titleMatches));
         }
         $titleMatches->free();
     }
     if ($textMatches) {
         // output appropriate heading
         if ($textMatches->numRows()) {
             if ($titleMatches) {
                 $wgOut->wrapWikiMsg("==\$1==\n", 'textmatches');
             } else {
                 // if no title matches the heading is redundant
                 $wgOut->addHTML("<hr/>");
//.........这里部分代码省略.........
开发者ID:amjadtbssm,项目名称:website,代码行数:101,代码来源:SpecialSearch.php


示例14: wfSpecialMissingLanguageLinks

/**
 *
 */
function wfSpecialMissingLanguageLinks()
{
    global $wgUser, $wgOut, $wgContLang, $wgTitle, $wgRequest;
    $fname = 'wfSpecialMissingLanguageLinks';
    $thelang = $wgRequest->getText('thelang');
    if ($thelang == 'w') {
        $thelang = 'en';
    }
    # Fix for international wikis
    list($limit, $offset) = wfCheckLimits();
    $dbr =& wfGetDB(DB_SLAVE);
    $cur = $dbr->tableName('cur');
    $sql = "SELECT cur_title FROM {$cur} " . "WHERE cur_namespace=" . NS_MAIN . " AND cur_is_redirect=0 " . "AND cur_title NOT LIKE '%/%' AND cur_text NOT LIKE '%[[" . wfStrencode($thelang) . ":%' " . "LIMIT {$offset}, {$limit}";
    $res = $dbr->query($sql, $fname);
    $mll = wfMsg('missinglanguagelinkstext', $wgContLang->getLanguageName($thelang));
    $top = getMaintenancePageBacklink('missinglanguagelinks');
    $top .= "<p>{$mll}</p><br />";
    $top .= wfShowingResults($offset, $limit);
    $wgOut->addHTML("<p>{$top}\n");
    $sl = wfViewPrevNext($offset, $limit, 'REPLACETHIS');
    $sl = str_replace('REPLACETHIS', sns() . ":Maintenance&subfunction=missinglanguagelinks&thelang=" . htmlspecialchars($thelang), $sl);
    $wgOut->addHTML("<br />{$sl}\n");
    $sk = $wgUser->getSkin();
    $s = '<ol start=' . ($offset + 1) . '>';
    while ($obj = $dbr->fetchObject($res)) {
        $s .= "<li>" . $sk->makeKnownLink($obj->cur_title) . "</li>\n";
    }
    $dbr->freeResult($res);
    $s .= '</ol>';
    $wgOut->addHTML($s);
    $wgOut->addHTML("<p>{$sl}\n");
}
开发者ID:BackupTheBerlios,项目名称:openzaurus-svn,代码行数:35,代码来源:SpecialMaintenance.php


示例15: doQuery

 /**
  * This is the actual workhorse. It does everything needed to make a
  * real, honest-to-gosh query page.
  * Alas, we need to overwrite the whole beast since we do not assume
  * an SQL-based storage backend.
  *
  * @param $offset database query offset
  * @param $limit database query limit
  * @param $property database string query
  */
 function doQuery($offset = false, $limit = false, $property = false)
 {
     $out = $this->getOutput();
     $sk = $this->getSkin();
     $options = new SMWRequestOptions();
     $options->limit = $limit;
     $options->offset = $offset;
     $options->sort = true;
     if ($property) {
         $options->addStringCondition($property, SMWStringCondition::STRCOND_MID);
     }
     $res = $this->getResults($options);
     $num = count($res);
     // often disable 'next' link when we reach the end
     $atend = $num < $limit;
     $this->selectOptions = array('offset' => $offset, 'limit' => $limit, 'end' => $atend, 'count' => $num);
     $out->addHTML($this->getPageHeader());
     // if list is empty, show it
     if ($num == 0) {
         $out->addHTML('<p>' . $this->msg('specialpage-empty')->escaped() . '</p>');
         return;
     }
     // If unused properties and wanted properties are using the searchForm
     // then the useSerchForm if-inclusion can be scrapped
     if (!$this->useSerchForm) {
         $top = wfShowingResults($offset, $num);
         $sl = $this->getLanguage()->viewPrevNext($this->getTitleFor($this->getName()), $this->selectOptions['offset'], $this->selectOptions['limit'] 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfSpecialList函数代码示例发布时间:2022-05-23
下一篇:
PHP wfShorthandToInteger函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap