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


PHP Title::getPrefixedDbKey方法代码示例

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


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

示例1: isLocalSource

 /**
  * Check if the given local page title is a spam regex source.
  * @param Title $title
  * @return bool
  */
 function isLocalSource($title)
 {
     global $wgDBname;
     if ($title->getNamespace() == NS_MEDIAWIKI) {
         $sources = array("Spam-blacklist", "Spam-whitelist");
         if (in_array($title->getDBkey(), $sources)) {
             return true;
         }
     }
     $thisHttp = wfExpandUrl($title->getFullUrl('action=raw'), PROTO_HTTP);
     $thisHttpRegex = '/^' . preg_quote($thisHttp, '/') . '(?:&.*)?$/';
     foreach ($this->files as $fileName) {
         $matches = array();
         if (preg_match('/^DB: (\\w*) (.*)$/', $fileName, $matches)) {
             if ($wgDBname == $matches[1]) {
                 if ($matches[2] == $title->getPrefixedDbKey()) {
                     // Local DB fetch of this page...
                     return true;
                 }
             }
         } elseif (preg_match($thisHttpRegex, $fileName)) {
             // Raw view of this page
             return true;
         }
     }
     return false;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:32,代码来源:SpamBlacklist_body.php

示例2: wfShowIndirectLinks

/**
 * @param int   $level
 * @param Title $target
 * @param int   $limit
 * @param int   $offset
 * @access private
 */
function wfShowIndirectLinks($level, $target, $limit, $offset = 0)
{
    global $wgOut, $wgUser;
    $fname = 'wfShowIndirectLinks';
    $dbr =& wfGetDB(DB_READ);
    // Read one extra row as an at-end check
    $queryLimit = $limit + 1;
    $limitSql = $level == 0 ? "{$offset},{$queryLimit}" : $queryLimit;
    $res = $dbr->select(array('pagelinks', 'page'), array('page_id', 'page_namespace', 'page_title', 'page_is_redirect'), array('pl_from=page_id', 'pl_namespace' => $target->getNamespace(), 'pl_title' => $target->getDbKey()), $fname, array('LIMIT' => $limitSql));
    if (0 == $dbr->numRows($res)) {
        if (0 == $level) {
            $wgOut->addWikiText(wfMsg('nolinkshere'));
        }
        return;
    }
    if (0 == $level) {
        $wgOut->addWikiText(wfMsg('linkshere'));
    }
    $sk = $wgUser->getSkin();
    $isredir = ' (' . wfMsg('isredirect') . ")\n";
    if ($dbr->numRows($res) == 0) {
        return;
    }
    $atend = $dbr->numRows($res) <= $limit;
    if ($level == 0) {
        $specialTitle = Title::makeTitle(NS_SPECIAL, 'Whatlinkshere');
        $prevnext = wfViewPrevNext($offset, $limit, $specialTitle, 'target=' . urlencode($target->getPrefixedDbKey()), $atend);
        $wgOut->addHTML($prevnext);
    }
    $wgOut->addHTML('<ul>');
    $linksShown = 0;
    while ($row = $dbr->fetchObject($res)) {
        if (++$linksShown > $limit) {
            // Last row is for checks only; don't display it.
            break;
        }
        $nt = Title::makeTitle($row->page_namespace, $row->page_title);
        if ($row->page_is_redirect) {
            $extra = 'redirect=no';
        } else {
            $extra = '';
        }
        $link = $sk->makeKnownLinkObj($nt, '', $extra);
        $wgOut->addHTML('<li>' . $link);
        if ($row->page_is_redirect) {
            $wgOut->addHTML($isredir);
            if ($level < 2) {
                wfShowIndirectLinks($level + 1, $nt, 500);
            }
        }
        $wgOut->addHTML("</li>\n");
    }
    $wgOut->addHTML("</ul>\n");
    if ($level == 0) {
        $wgOut->addHTML($prevnext);
    }
}
开发者ID:BackupTheBerlios,项目名称:enotifwiki,代码行数:64,代码来源:SpecialWhatlinkshere.php

示例3: revisionFields

	/**
	 * @return string
	 */
	function revisionFields() {
		$out = '';
		foreach( $this->mRevisions as $id ) {
			$out .= Html::hidden( 'revision[]', $id );
		}
		if( $this->mTarget ) {
			$out .= Html::hidden( 'target', $this->mTarget->getPrefixedDbKey() );
		}
		foreach( $this->mTimestamps as $timestamp ) {
			$out .= Html::hidden( 'timestamp[]', wfTimestamp( TS_MW, $timestamp ) );
		}
		return $out;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:HideRevision_body.php

示例4: isLocalSource

	/**
	 * Check if the given local page title is a spam regex source.
	 *
	 * @param Title $title
	 * @return bool
	 */
	public static function isLocalSource( $title ) {
		global $wgDBname, $wgBlacklistSettings;

		if( $title->getNamespace() == NS_MEDIAWIKI ) {
			$sources = array();
			foreach ( self::$blacklistTypes as $type => $class ) {
				$type = ucfirst( $type );
				$sources += array(
					"$type-blacklist",
					"$type-whitelist"
				);
			}

			if( in_array( $title->getDBkey(), $sources ) ) {
				return true;
			}
		}

		$thisHttp = wfExpandUrl( $title->getFullUrl( 'action=raw' ), PROTO_HTTP );
		$thisHttpRegex = '/^' . preg_quote( $thisHttp, '/' ) . '(?:&.*)?$/';

		$files = array();
		foreach ( self::$blacklistTypes as $type => $class ) {
			if ( isset( $wgBlacklistSettings[$type]['files'] ) ) {
				$files += $wgBlacklistSettings[$type]['files'];
			}
		}

		foreach( $files as $fileName ) {
			$matches = array();
			if ( preg_match( '/^DB: (\w*) (.*)$/', $fileName, $matches ) ) {
				if ( $wgDBname == $matches[1] ) {
					if( $matches[2] == $title->getPrefixedDbKey() ) {
						// Local DB fetch of this page...
						return true;
					}
				}
			} elseif( preg_match( $thisHttpRegex, $fileName ) ) {
				// Raw view of this page
				return true;
			}
		}

		return false;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:51,代码来源:BaseBlacklist.php

示例5: showRevision

 private function showRevision($timestamp)
 {
     if (!preg_match('/[0-9]{14}/', $timestamp)) {
         return 0;
     }
     $archive = new PageArchive($this->mTargetObj);
     wfRunHooks('UndeleteForm::showRevision', array(&$archive, $this->mTargetObj));
     $rev = $archive->getRevision($timestamp);
     $out = $this->getOutput();
     $user = $this->getUser();
     if (!$rev) {
         $out->addWikiMsg('undeleterevision-missing');
         return;
     }
     if ($rev->isDeleted(Revision::DELETED_TEXT)) {
         if (!$rev->userCan(Revision::DELETED_TEXT, $user)) {
             $out->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'rev-deleted-text-permission');
             return;
         } else {
             $out->wrapWikiMsg("<div class='mw-warning plainlinks'>\n\$1\n</div>\n", 'rev-deleted-text-view');
             $out->addHTML('<br />');
             // and we are allowed to see...
         }
     }
     if ($this->mDiff) {
         $previousRev = $archive->getPreviousRevision($timestamp);
         if ($previousRev) {
             $this->showDiff($previousRev, $rev);
             if ($this->mDiffOnly) {
                 return;
             } else {
                 $out->addHTML('<hr />');
             }
         } else {
             $out->addWikiMsg('undelete-nodiff');
         }
     }
     $link = Linker::linkKnown($this->getTitle($this->mTargetObj->getPrefixedDBkey()), htmlspecialchars($this->mTargetObj->getPrefixedText()));
     $lang = $this->getLanguage();
     // date and time are separate parameters to facilitate localisation.
     // $time is kept for backward compat reasons.
     $time = $lang->userTimeAndDate($timestamp, $user);
     $d = $lang->userDate($timestamp, $user);
     $t = $lang->userTime($timestamp, $user);
     $userLink = Linker::revUserTools($rev);
     if ($this->mPreview) {
         $openDiv = '<div id="mw-undelete-revision" class="mw-warning">';
     } else {
         $openDiv = '<div id="mw-undelete-revision">';
     }
     $out->addHTML($openDiv);
     // Revision delete links
     if (!$this->mDiff) {
         $revdel = Linker::getRevDeleteLink($user, $rev, $this->mTargetObj);
         if ($revdel) {
             $out->addHTML("{$revdel} ");
         }
     }
     $out->addHTML($this->msg('undelete-revision')->rawParams($link)->params($time)->rawParams($userLink)->params($d, $t)->parse() . '</div>');
     wfRunHooks('UndeleteShowRevision', array($this->mTargetObj, $rev));
     if ($this->mPreview) {
         // Hide [edit]s
         $popts = $out->parserOptions();
         $popts->setEditSection(false);
         $out->parserOptions($popts);
         $out->addWikiTextTitleTidy($rev->getText(Revision::FOR_THIS_USER, $user), $this->mTargetObj, true);
     }
     $out->addHTML(Xml::element('textarea', array('readonly' => 'readonly', 'cols' => intval($user->getGlobalPreference('cols')), 'rows' => intval($user->getGlobalPreference('rows'))), $rev->getText(Revision::FOR_THIS_USER, $user) . "\n") . Xml::openElement('div') . Xml::openElement('form', array('method' => 'post', 'action' => $this->getTitle()->getLocalURL(array('action' => 'submit')))) . Xml::element('input', array('type' => 'hidden', 'name' => 'target', 'value' => $this->mTargetObj->getPrefixedDbKey())) . Xml::element('input', array('type' => 'hidden', 'name' => 'timestamp', 'value' => $timestamp)) . Xml::element('input', array('type' => 'hidden', 'name' => 'wpEditToken', 'value' => $user->getEditToken())) . Xml::element('input', array('type' => 'submit', 'name' => 'preview', 'value' => $this->msg('showpreview')->text())) . Xml::element('input', array('name' => 'diff', 'type' => 'submit', 'value' => $this->msg('showdiff')->text())) . Xml::closeElement('form') . Xml::closeElement('div'));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:69,代码来源:SpecialUndelete.php

示例6: addGoodLinkObj

 /**
  * Add a link for the title to the link cache
  * @param int $id
  * @param Title $title
  * @param int $len
  * @param int $redir
  */
 public function addGoodLinkObj($id, $title, $len = -1, $redir = NULL)
 {
     $dbkey = $title->getPrefixedDbKey();
     $this->mGoodLinks[$dbkey] = $id;
     $this->mGoodLinkFields[$dbkey] = array('length' => $len, 'redirect' => $redir);
 }
开发者ID:akoehn,项目名称:wikireader,代码行数:13,代码来源:LinkCache.php

示例7: jsEdit

	/**
	 * Returns link attributes that enable javascript translation dialog.
	 * Will degrade gracefully if user does not have permissions or JavaScript
	 * is not enabled.
	 * @param $title Title Title object for the translatable message.
	 * @param $group \string The group in which this message belongs to.
	 *   Optional, but avoids a lookup later if provided.
	 * @return \array
	 */
	public static function jsEdit( Title $title, $group = "" ) {
		global $wgUser;

		if ( !$wgUser->getOption( 'translate-jsedit' ) ) {
			return array();
		}

		return array(
			'onclick' => Xml::encodeJsCall(
				'return mw.translate.openDialog', array( $title->getPrefixedDbKey(), $group ) ),
			'title' => wfMsg( 'translate-edit-title', $title->getPrefixedText() )
		);
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:22,代码来源:TranslationEditPage.php

示例8: jsEdit

 /**
  * Returns link attributes that enable javascript translation dialog.
  * Will degrade gracefully if user does not have permissions or JavaScript
  * is not enabled.
  * @param $title Title Title object for the translatable message.
  * @param $group \string The group in which this message belongs to.
  *   Optional, but avoids a lookup later if provided.
  * @param $type \string Force the type of editor to be used. Use dialog
  *   where embedded editor is no applicable.
  * @return \array
  */
 public static function jsEdit(Title $title, $group = "", $type = 'default')
 {
     $context = RequestContext::getMain();
     if ($type === 'default') {
         $text = 'tqe-anchor-' . substr(sha1($title->getPrefixedText()), 0, 12);
         $onclick = "jQuery( '#{$text}' ).dblclick(); return false;";
     } else {
         $onclick = Xml::encodeJsCall('return mw.translate.openDialog', array($title->getPrefixedDbKey(), $group));
     }
     return array('onclick' => $onclick, 'title' => $context->msg('translate-edit-title', $title->getPrefixedText())->text());
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:22,代码来源:TranslationEditPage.php

示例9: addGoodLinkObj

 /**
  * Add a link for the title to the link cache
  * @param int $id
  * @param Title $title
  * @param int $len
  * @param int $redir
  */
 public function addGoodLinkObj($id, $title, $len = -1, $redir = null)
 {
     $dbkey = $title->getPrefixedDbKey();
     $this->mGoodLinks[$dbkey] = intval($id);
     $this->mGoodLinkFields[$dbkey] = array('length' => intval($len), 'redirect' => intval($redir));
 }
开发者ID:rocLv,项目名称:conference,代码行数:13,代码来源:LinkCache.php


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