当前位置: 首页>>代码示例>>PHP>>正文


PHP SearchForm::removeId方法代码示例

本文整理汇总了PHP中SearchForm::removeId方法的典型用法代码示例。如果您正苦于以下问题:PHP SearchForm::removeId方法的具体用法?PHP SearchForm::removeId怎么用?PHP SearchForm::removeId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SearchForm的用法示例。


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

示例1: formatResult

 private function formatResult($doc, $hl, $pos, $condensed)
 {
     global $wgUser;
     $skin =& $wgUser->getSkin();
     $ns = @$doc['NamespaceStored'];
     $titleString = $doc['TitleStored'];
     $title = Title::newFromText($ns . ':' . $titleString);
     if ($this->pagetitle && $ns == $this->namespace && $title->getDBkey() == $this->pagetitle) {
         return '';
     }
     if (!$condensed) {
         $birth = $chr = $death = $burial = $marriage = $banns = '';
         $husbandBirth = $husbandDeath = $wifeBirth = $wifeDeath = '';
         if ($ns == 'Person') {
             $birth = $this->getEventInfo($hl, 'PersonBirth');
             $chr = $this->getEventInfo($hl, 'PersonChr');
             $death = $this->getEventInfo($hl, 'PersonDeath');
             $burial = $this->getEventInfo($hl, 'PersonBurial');
         } else {
             if ($ns == 'Family') {
                 $marriage = $this->getEventInfo($hl, 'Marriage');
                 $banns = $this->getEventInfo($hl, 'Banns');
                 $husbandBirth = $this->getEventInfo($doc, 'HusbandBirth');
                 if (!$husbandBirth) {
                     $husbandBirth = $this->getEventInfo($doc, 'HusbandChr');
                 }
                 $husbandDeath = $this->getEventInfo($doc, 'HusbandDeath');
                 if (!$husbandDeath) {
                     $husbandDeath = $this->getEventInfo($doc, 'HusbandBurial');
                 }
                 $wifeBirth = $this->getEventInfo($doc, 'WifeBirth');
                 if (!$wifeBirth) {
                     $wifeBirth = $this->getEventInfo($doc, 'WifeChr');
                 }
                 $wifeDeath = $this->getEventInfo($doc, 'WifeDeath');
                 if (!$wifeDeath) {
                     $wifeDeath = $this->getEventInfo($doc, 'WifeBurial');
                 }
             }
         }
         $imageURL = '';
         if (@$doc['PrimaryImage']) {
             $t = Title::makeTitle(NS_IMAGE, $doc['PrimaryImage']);
             if ($t && $t->exists()) {
                 $i = new Image($t);
                 $imageURL = $i->createThumb(SearchForm::THUMB_WIDTH, SearchForm::THUMB_HEIGHT);
                 $imagePageURL = $t->getLocalURL();
             }
         } else {
             if ($doc['NamespaceStored'] == 'Image') {
                 $t = Title::makeTitle(NS_IMAGE, $doc['TitleStored']);
                 if ($t && $t->exists()) {
                     $i = new Image($t);
                     $imageURL = $i->createThumb(SearchForm::THUMB_WIDTH, SearchForm::THUMB_HEIGHT);
                     $imagePageURL = $t->getLocalURL();
                 }
             }
         }
     }
     $displayTitle = '';
     if ($ns == 'Family') {
         if (@$hl['TitleStored']) {
             $displayTitle = SearchForm::removeId($hl['TitleStored'][0]);
         } else {
             $displayTitle = SearchForm::removeId($titleString);
         }
     } else {
         if ($ns == 'Person') {
             if (@$hl['FullnameStored'][0] && mb_strpos($hl['FullnameStored'][0], ' ') !== false) {
                 $displayTitle = $hl['FullnameStored'][0];
             } else {
                 if (@$hl['TitleStored']) {
                     $displayTitle = SearchForm::removeId($hl['TitleStored'][0]);
                 } else {
                     $displayTitle = SearchForm::removeId($titleString);
                 }
             }
         } else {
             if (@$hl['TitleStored']) {
                 $displayTitle = $hl['TitleStored'][0];
             } else {
                 $displayTitle = $titleString;
             }
         }
     }
     $titleText = $this->prepareValue(($ns ? $ns . ':' : '') . $displayTitle, 200);
     $result = '<tr><td class="searchresult" colspan=2>' . ($this->addSelectButtons() ? $this->getSelectButton($ns, $titleString) : '') . ($this->match ? $this->getMatchCheckbox($titleString, $pos + 1) : '') . '<span class="searchresulttitle">' . $skin->makeKnownLinkObj($title, $titleText, $this->addSelectButtons() ? 'target=' . urlencode($this->target) : '') . '</span></td>' . ($pos >= 0 ? '' : '<td>Recent edit, not yet indexed</td>') . '</tr>';
     // $pos is -1 for recent contribs
     if ($pos >= 0 && !$condensed) {
         $result .= '<tr><td ' . ($imageURL ? 'width="55%"' : 'colspan=2 width="70%"') . '><table width="100%">' . $this->formatValue('Birth', $birth) . (!$birth && $chr ? $this->formatValue('Chr/Bap', $chr) : '') . $this->formatValue('Death', $death) . (!$death && $burial ? $this->formatValue('Burial', $burial) : '') . $this->formatValue('Parents', SearchForm::removeId(@$hl['ParentFamilyTitle'][0])) . $this->formatValue('Spouse', SearchForm::removeSelf($titleString, SearchForm::removeId(@$hl['SpouseFamilyTitle'][0]))) . ($husbandBirth || $husbandDeath ? $this->formatValue('Husband', "{$husbandBirth} - {$husbandDeath}") : '') . ($wifeBirth || $wifeDeath ? $this->formatValue('Wife', "{$wifeBirth} - {$wifeDeath}") : '') . $this->formatValue('Marriage', $marriage) . (!$marriage && $banns ? $this->formatValue('Banns', $banns) : '') . $this->formatValue('Children', SearchForm::removeId(@$hl['ChildTitle'][0])) . $this->formatValue('Author', @$hl['AuthorStored'][0]) . $this->formatValue('Title', @$hl['SourceTitleStored'][0]) . $this->formatValue('Surnames', @$hl['SurnameStored'][0]) . $this->formatValue('Places', @$hl['PlaceStored'][0]) . (@$hl['SourceSubjectStored'][0] ? $this->formatValue('Subject', @$hl['SourceSubjectStored'][0] . (@$doc['SourceSubSubject'] ? ' - ' . @$doc['SourceSubSubject'] : '')) : '') . (@$doc['FromYear'] || @$doc['ToYear'] ? $this->formatValue('Year range', @$doc['FromYear'] . ' - ' . @$doc['ToYear']) : '') . $this->formatValue('Availability', @$hl['SourceAvailabilityStored'][0]) . $this->formatValue('Type', @$hl['PlaceType'][0]) . $this->formatValue('', @$hl['TextStored'][0], true) . '</table></td>' . ($imageURL ? "<td width=\"15%\"><a href=\"{$imagePageURL}\"><img alt=\"\" src=\"{$imageURL}\"/></a></td>" : '') . "<td width=\"24%\" align=\"right\"><table>" . ($this->ecp == 'e' ? '' : $this->formatValue('', $this->getStarsImage($doc['score']), false, false)) . $this->formatValue('Watching', $this->makeUserLinks(@$hl['UserStored'][0]), false, false) . $this->formatValue('Modified', @$doc['LastModDate'] ? date('j M Y', wfTimestamp(TS_UNIX, $doc['LastModDate'] . '000000')) : '') . "</table></td></tr>\n";
     }
     return $result;
 }
开发者ID:k-hasan-19,项目名称:wiki,代码行数:93,代码来源:SpecialSearch.php


注:本文中的SearchForm::removeId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。