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


PHP OutputPage::addWikiText方法代码示例

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


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

示例1: showEditFormFields

 /**
  * Show error message for missing or incorrect captcha on EditPage.
  * @param EditPage $editPage
  * @param OutputPage $out
  */
 function showEditFormFields(&$editPage, &$out)
 {
     $page = $editPage->getArticle()->getPage();
     if (!isset($page->ConfirmEdit_ActivateCaptcha)) {
         return;
     }
     if ($this->action !== 'edit') {
         unset($page->ConfirmEdit_ActivateCaptcha);
         $out->addWikiText($this->getMessage($this->action));
         $out->addHTML($this->getForm($out));
     }
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:17,代码来源:Captcha.php

示例2: editCallback

 /**
  * Insert the captcha prompt into an edit form.
  * @param OutputPage $out
  */
 function editCallback(&$out)
 {
     $out->addWikiText($this->getMessage($this->action));
     $out->addHTML($this->getForm());
     $this->addCSS(&$out);
 }
开发者ID:nomaster,项目名称:KittenAuth,代码行数:10,代码来源:KittenAuth.php

示例3: setTopText

 /**
  * Send the text to be displayed above the options
  *
  * @param $out OutputPage
  * @param $opts FormOptions
  */
 function setTopText(OutputPage $out, FormOptions $opts)
 {
     $out->addWikiText(wfMsgForContentNoTrans('recentchangestext'));
 }
开发者ID:rocLv,项目名称:conference,代码行数:10,代码来源:SpecialRecentchanges.php

示例4: undelete

 /**
  * This is the meaty bit -- restores archived revisions of the given page
  * to the cur/old tables. If the page currently exists, all revisions will
  * be stuffed into old, otherwise the most recent will go into cur.
  * The deletion log will be updated with an undeletion notice.
  *
  * Returns true on success.
  *
  * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
  * @return bool
  */
 function undelete($timestamps)
 {
     global $wgUser, $wgOut, $wgLang, $wgDeferredUpdateList;
     global $wgUseSquid, $wgInternalServer, $wgLinkCache;
     global $wgDBtype;
     $fname = "doUndeleteArticle";
     $restoreAll = empty($timestamps);
     $restoreRevisions = count($timestamps);
     $dbw =& wfGetDB(DB_MASTER);
     extract($dbw->tableNames('page', 'archive'));
     # Does this page already exist? We'll have to update it...
     $article = new Article($this->title);
     $options = $wgDBtype == 'PostgreSQL' ? '' : 'FOR UPDATE';
     $page = $dbw->selectRow('page', array('page_id', 'page_latest'), array('page_namespace' => $this->title->getNamespace(), 'page_title' => $this->title->getDBkey()), $fname, $options);
     if ($page) {
         # Page already exists. Import the history, and if necessary
         # we'll update the latest revision field in the record.
         $newid = 0;
         $pageId = $page->page_id;
         $previousRevId = $page->page_latest;
         $previousTimestamp = $page->rev_timestamp;
     } else {
         # Have to create a new article...
         $newid = $article->insertOn($dbw);
         $pageId = $newid;
         $previousRevId = 0;
         $previousTimestamp = 0;
     }
     if ($restoreAll) {
         $oldones = '1';
         # All revisions...
     } else {
         $oldts = implode(',', array_map(array(&$dbw, 'addQuotes'), array_map(array(&$dbw, 'timestamp'), $timestamps)));
         $oldones = "ar_timestamp IN ( {$oldts} )";
     }
     /**
      * Restore each revision...
      */
     $result = $dbw->select('archive', array('ar_rev_id', 'ar_text', 'ar_comment', 'ar_user', 'ar_user_text', 'ar_timestamp', 'ar_minor_edit', 'ar_flags', 'ar_text_id'), array('ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), $oldones), $fname, array('ORDER BY' => 'ar_timestamp'));
     $revision = null;
     while ($row = $dbw->fetchObject($result)) {
         $revision = new Revision(array('page' => $pageId, 'id' => $row->ar_rev_id, 'text' => Revision::getRevisionText($row, 'ar_'), 'comment' => $row->ar_comment, 'user' => $row->ar_user, 'user_text' => $row->ar_user_text, 'timestamp' => $row->ar_timestamp, 'minor_edit' => $row->ar_minor_edit, 'text_id' => $row->ar_text_id));
         $revision->insertOn($dbw);
     }
     if ($revision) {
         # FIXME: Update latest if newer as well...
         if ($newid) {
             # FIXME: update article count if changed...
             $article->updateRevisionOn($dbw, $revision, $previousRevId);
             # Finally, clean up the link tables
             $wgLinkCache = new LinkCache();
             # Select for update
             $wgLinkCache->forUpdate(true);
             # Create a dummy OutputPage to update the outgoing links
             $dummyOut = new OutputPage();
             $dummyOut->addWikiText($revision->getText());
             $u = new LinksUpdate($newid, $this->title->getPrefixedDBkey());
             array_push($wgDeferredUpdateList, $u);
             #TODO: SearchUpdate, etc.
         }
         if ($newid) {
             Article::onArticleCreate($this->title);
         } else {
             Article::onArticleEdit($this->title);
         }
     } else {
         # Something went terribly worong!
     }
     # Now that it's safely stored, take it out of the archive
     $dbw->delete('archive', array('ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), $oldones), $fname);
     # Touch the log!
     $log = new LogPage('delete');
     if ($restoreAll) {
         $reason = '';
     } else {
         $reason = wfMsgForContent('undeletedrevisions', $restoreRevisions);
     }
     $log->addEntry('restore', $this->title, $reason);
     return true;
 }
开发者ID:BackupTheBerlios,项目名称:blahtex,代码行数:91,代码来源:SpecialUndelete.php

示例5: renderFormHeader

 /**
  * Print extra field for 'title'
  *
  * @param OutputPage $wgOut
  */
 public function renderFormHeader($wgOut)
 {
     global $wgRequest;
     $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $oTmpl->set_vars(array("formErrors" => $this->mFormErrors, "formData" => $this->mFormData, "isReload" => $wgRequest->getVal('wpIsReload', 0) == 1, "editIntro" => $wgOut->parse($this->mEditIntro)));
     $wgOut->setPageTitle(wfMsg("createpage"));
     $wgOut->addScriptFile('edit.js');
     if ($this->mPreviewTitle == null) {
         $wgOut->addHTML('<div id="custom_createpagetext">');
         $wgOut->addWikiText(wfMsgForContent('newarticletext'));
         $wgOut->addHTML('</div>');
     }
     $wgOut->addHTML($oTmpl->render("createFormHeader"));
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:SpecialCreatePage.class.php

示例6: displayACLForm

 /**
  * What we should do if the permission action is clicked.
  * @param OutputPage $output
  * @param Article $article
  * @param Title $title
  * @param User $user
  * @param WebRequest $request
  * @Param MediaWiki $wiki
  */
 static function displayACLForm($output, $article, $title, $user, $request, $wiki)
 {
     global $wgParser;
     if ($request->getVal('action') != self::$ACTION) {
         return true;
     }
     $text = "";
     $owner = MWUtil::pageOwner($title, true);
     $text .= "Page owner is '''" . $owner->getName() . "'''.";
     ACL::loadUserGroups();
     $ownergroups = ACL::getUserGroups($owner);
     $ogroups = " Owner belongs to these user groups:";
     if ($ownergroups) {
         foreach ($ownergroups as $g) {
             $ogroups .= $g['name'] . ",";
         }
     } else {
         $ogroups = " Owner does not belong to any user group";
     }
     $text .= $ogroups . "\n\n";
     $permissionpage = ACL_ACL . ":" . $article->getID();
     $permissiontitle = Title::newFromText($permissionpage);
     $ns = $title->getNSText();
     if (!$ns) {
         $ns = "Main";
     }
     $sp = SpecialPage::getPage("FormEdit");
     $sp_url = $sp->getTitle()->getLocalURL();
     $sp_url .= "?form=" . self::$FORM . "&target={$permissionpage}&ACL Page Permission[PageId]={$article->getID()}&ACL Page Permission[PageName]={$title->getDBkey()}&ACL Page Permission[Namespace]={$ns}";
     if ($permissiontitle->exists()) {
         $text .= "[[{$permissionpage}|View Page Permission]]\n\n----\n";
         $output->addWikiText($text);
         $output->addHTML("<a href='{$sp_url}'>Edit permission for this page</a>");
     } else {
         $text .= "No page specific Permission is set.";
         $output->addWikiText($text);
         $output->addHTML("<a href='{$sp_url}'>Set permission for this page</a>");
     }
     return false;
 }
开发者ID:kghbln,项目名称:semanticaccesscontrol,代码行数:49,代码来源:PermissionTab.php

示例7: showUserpage

	protected function showUserpage( $step ) {
		global $wgRequest;

		$textareaId = 'userpagetext';

		$header = new HtmlTag( 'h2' );
		$step_message = 'translate-fs-userpage-title';
		$header->style( 'opacity', 0.4 )->content( wfMsg( $step_message ) );

		if ( $step ) {
			$this->out->addHtml( $header );
			return $step;
		}

		$userpage = $this->user->getUserPage();
		$preload = "I am My Name and....";

		if ( $wgRequest->wasPosted() &&
			$this->user->matchEditToken( $wgRequest->getVal( 'token' ) ) &&
			$wgRequest->getText( 'step' ) === 'userpage' )
		{
			$babel = array();
			for ( $i = 0; $i < 5; $i++ ) {
				$language = $wgRequest->getText( "babel-$i-language", '-' );
				if ( $language === '-' ) continue;
				$level = $wgRequest->getText( "babel-$i-level", '-' );
				$babel[$language] = $level;
			}

			arsort( $babel );
			$babeltext = '{{#babel:';
			foreach ( $babel as $language => $level ) {
				if ( $level === 'N' ) $level = '';
				else $level = "-$level";
				$babeltext .= "$language$level|";
			}
			$babeltext = trim( $babeltext, '|' );
			$babeltext .= "}}\n";

			$article = new Article( $userpage, 0 );
			$status = $article->doEdit( $babeltext . $wgRequest->getText( $textareaId ), $this->getTitle() );

			if ( $status->isOK() ) {
				$header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) );
				$this->out->addHtml( $header );
				$this->out->addWikiMsg( 'translate-fs-userpage-done' );

				return false;
			} else {
				$this->out->addWikiText( $status->getWikiText() );
				$preload = $wgRequest->getText( 'userpagetext' );
			}
		}

		if ( $userpage->exists() ) {
			$revision = Revision::newFromTitle( $userpage );
			$text = $revision->getText();
			$preload = $text;

			if ( preg_match( '/{{#babel:/i', $text ) ) {
				$header->content( $header->content . wfMsg( 'translate-fs-pagetitle-done' ) );
				$this->out->addHtml( $header );

				return false;
			}
		}

		$this->out->addHtml( $header->style( 'opacity', false ) );

		$this->out->addWikiMsg( 'translate-fs-userpage-help' );
		global $wgLang;

		$form = new HtmlTag( 'form' );
		$items = new TagContainer();
		$form->param( 'method', 'post' )->content( $items );

		$items[] = new RawHtml( Html::hidden( 'step', 'userpage' ) );
		$items[] = new RawHtml( Html::hidden( 'token', $this->user->editToken() ) );
		$items[] = new RawHtml( Html::hidden( 'title', $this->getTitle() ) );

		$languages = $this->languages( $wgLang->getCode() );
		$selector = new XmlSelect();
		$selector->addOption( wfMessage( 'translate-fs-selectlanguage' )->text(), '-' );
		$selector->addOptions( $languages );

		// Building a skill selector
		$skill = new XmlSelect();
		$levels = 'N,5,4,3,2,1';
		foreach ( explode( ',', $levels ) as $level ) {
			$skill->addOption( wfMessage( "translate-fs-userpage-level-$level" )->text(), $level );
		}
		for ( $i = 0; $i < 5; $i++ ) {
			// Prefill en-2 and [wgLang]-N if [wgLang] != en
			if ( $i === 0 ) {
				$skill->setDefault( '2' );
				$selector->setDefault( 'en' );
			} elseif ( $i === 1 && $wgLang->getCode() !== 'en' ) {
				$skill->setDefault( 'N' );
				$selector->setDefault( $wgLang->getCode() );
			} else {
//.........这里部分代码省略.........
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:101,代码来源:SpecialFirstSteps.php

示例8: editCallback

 /**
  * Insert the captcha prompt into an edit form.
  *
  * @param \OutputPage $out
  */
 public function editCallback(&$out)
 {
     $out->addWikiText($this->captcha->getMessage($this->action));
     $out->addHTML($this->captcha->getForm());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:Captcha.class.php


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