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


PHP wfScript函数代码示例

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


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

示例1: execute

 public function execute()
 {
     global $wgUser, $wgArticleFeedbackRatingTypes, $wgArticleFeedbackSMaxage, $wgArticleFeedbackNamespaces;
     $params = $this->extractRequestParams();
     // Anon token check
     if ($wgUser->isAnon()) {
         if (!isset($params['anontoken'])) {
             $this->dieUsageMsg(array('missingparam', 'anontoken'));
         } elseif (strlen($params['anontoken']) != 32) {
             $this->dieUsage('The anontoken is not 32 characters', 'invalidtoken');
         }
         $token = $params['anontoken'];
     } else {
         $token = '';
     }
     // Load check, is this page ArticleFeedback-enabled ?
     // Keep in sync with ext.articleFeedback.startup.js
     $title = Title::newFromID($params['pageid']);
     if (is_null($title) || !in_array($title->getNamespace(), $wgArticleFeedbackNamespaces) || $title->isRedirect()) {
         // ...then error out
         $this->dieUsage('ArticleFeedback is not enabled on this page', 'invalidpage');
     }
     $dbw = wfGetDB(DB_MASTER);
     // Query the latest ratings by this user for this page,
     // possibly for an older revision
     // Select from the master to prevent replag-induced bugs
     $res = $dbw->select('article_feedback', array('aa_rating_id', 'aa_rating_value', 'aa_revision'), array('aa_user_text' => $wgUser->getName(), 'aa_page_id' => $params['pageid'], 'aa_rating_id' => array_keys($wgArticleFeedbackRatingTypes), 'aa_user_anon_token' => $token), __METHOD__, array('ORDER BY' => 'aa_revision DESC', 'LIMIT' => count($wgArticleFeedbackRatingTypes)));
     $lastRatings = array();
     foreach ($res as $row) {
         $lastRatings[$row->aa_rating_id]['value'] = $row->aa_rating_value;
         $lastRatings[$row->aa_rating_id]['revision'] = $row->aa_revision;
     }
     $pageId = $params['pageid'];
     $revisionId = $params['revid'];
     foreach ($wgArticleFeedbackRatingTypes as $ratingID => $unused) {
         $lastPageRating = false;
         $lastRevRating = false;
         if (isset($lastRatings[$ratingID])) {
             $lastPageRating = intval($lastRatings[$ratingID]['value']);
             if (intval($lastRatings[$ratingID]['revision']) == $revisionId) {
                 $lastRevRating = $lastPageRating;
             }
         }
         $thisRating = false;
         if (isset($params["r{$ratingID}"])) {
             $thisRating = intval($params["r{$ratingID}"]);
         }
         $this->insertRevisionRating($pageId, $revisionId, $ratingID, $thisRating - $lastRevRating, $thisRating, $lastRevRating);
         $this->insertPageRating($pageId, $ratingID, $thisRating - $lastPageRating, $thisRating, $lastPageRating);
         $this->insertUserRatings($pageId, $revisionId, $wgUser, $token, $ratingID, $thisRating, $params['bucket']);
     }
     $this->insertProperties($revisionId, $wgUser, $token, $params);
     $squidUpdate = new SquidUpdate(array(wfAppendQuery(wfScript('api'), array('action' => 'query', 'format' => 'json', 'list' => 'articlefeedback', 'afpageid' => $pageId, 'afanontoken' => '', 'afuserrating' => 0, 'maxage' => 0, 'smaxage' => $wgArticleFeedbackSMaxage))));
     $squidUpdate->doUpdate();
     wfRunHooks('ArticleFeedbackChangeRating', array($params));
     $r = array('result' => 'Success');
     $this->getResult()->addValue(null, $this->getModuleName(), $r);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:58,代码来源:ApiArticleFeedback.php

示例2: performUploadInit

 public function performUploadInit($comment, $pageText, $watch, $user)
 {
     $check = $this->mUpload->validateNameAndOverwrite();
     if ($check !== true) {
         $this->getVerificationError($check);
     }
     $session = $this->mUpload->setupChunkSession($comment, $pageText, $watch);
     return array('uploadUrl' => wfExpandUrl(wfScript('api')) . "?" . wfArrayToCGI(array('action' => 'firefoggupload', 'token' => $user->editToken(), 'format' => 'json', 'chunksession' => $session, 'filename' => $this->mUpload->getDesiredName())));
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:9,代码来源:ApiFirefoggChunkedUpload.php

示例3: getPreloadedText

 /**
 	@brief Fetch the edit form and return the text in #wpTextbox1.
 	@param title The page to be opened for editing.
 */
 public function getPreloadedText($title)
 {
     $url = wfAppendQuery(wfScript('index'), array('title' => $title, 'action' => 'edit'));
     $this->loadFromURL($url);
     $elem = $this->getElementById('wpTextbox1');
     if (!$elem) {
         return null;
     }
     return trim($elem->textContent);
 }
开发者ID:ATCARES,项目名称:mediawiki-moderation,代码行数:14,代码来源:ModerationTestsuiteHTML.php

示例4: setUp

 protected function setUp()
 {
     global $wgServer;
     parent::setUp();
     self::$apiUrl = $wgServer . wfScript('api');
     ApiQueryInfo::resetTokenCache();
     // tokens are invalid because we cleared the session
     self::$users = array('sysop' => new TestUser('Apitestsysop', 'Api Test Sysop', 'api_test_sysop@example.com', array('sysop')), 'uploader' => new TestUser('Apitestuser', 'Api Test User', 'api_test_user@example.com', array()));
     $this->setMwGlobals(array('wgAuth' => new StubObject('wgAuth', 'AuthPlugin'), 'wgRequest' => new FauxRequest(array()), 'wgUser' => self::$users['sysop']->user));
     $this->apiContext = new ApiTestContext();
 }
开发者ID:lourinaldi,项目名称:mediawiki,代码行数:11,代码来源:ApiTestCase.php

示例5: setUp

 protected function setUp()
 {
     global $wgServer, $wgDisableAuthManager;
     parent::setUp();
     self::$apiUrl = $wgServer . wfScript('api');
     ApiQueryInfo::resetTokenCache();
     // tokens are invalid because we cleared the session
     self::$users = ['sysop' => static::getTestSysop(), 'uploader' => static::getTestUser()];
     $this->setMwGlobals(['wgAuth' => $wgDisableAuthManager ? new AuthPlugin() : new MediaWiki\Auth\AuthManagerAuthPlugin(), 'wgRequest' => new FauxRequest([]), 'wgUser' => self::$users['sysop']->user]);
     $this->apiContext = new ApiTestContext();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:11,代码来源:ApiTestCase.php

示例6: setUp

 function setUp()
 {
     global $wgContLang, $wgAuth, $wgMemc, $wgRequest, $wgUser, $wgServer;
     parent::setUp();
     self::$apiUrl = $wgServer . wfScript('api');
     $wgMemc = new EmptyBagOStuff();
     $wgContLang = Language::factory('en');
     $wgAuth = new StubObject('wgAuth', 'AuthPlugin');
     $wgRequest = new FauxRequest(array());
     self::$users = array('sysop' => new ApiTestUser('Apitestsysop', 'Api Test Sysop', 'api_test_sysop@sample.com', array('sysop')), 'uploader' => new ApiTestUser('Apitestuser', 'Api Test User', 'api_test_user@sample.com', array()));
     $wgUser = self::$users['sysop']->user;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:12,代码来源:ApiTestCase.php

示例7: execute

 function execute($par)
 {
     $mime = $par ? $par : $this->getRequest()->getText('mime');
     $mime = trim($mime);
     $this->setHeaders();
     $this->outputHeader();
     $this->getOutput()->addHTML(Xml::openElement('form', array('id' => 'specialmimesearch', 'method' => 'get', 'action' => wfScript())) . Xml::openElement('fieldset') . Html::hidden('title', $this->getPageTitle()->getPrefixedText()) . Xml::element('legend', null, $this->msg('mimesearch')->text()) . Xml::inputLabel($this->msg('mimetype')->text(), 'mime', 'mime', 20, $mime) . ' ' . Xml::submitButton($this->msg('ilsubmit')->text()) . Xml::closeElement('fieldset') . Xml::closeElement('form'));
     list($this->major, $this->minor) = File::splitMime($mime);
     if ($this->major == '' || $this->minor == '' || $this->minor == 'unknown' || !self::isValidType($this->major)) {
         return;
     }
     parent::execute($par);
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:13,代码来源:SpecialMIMEsearch.php

示例8: performUploadInit

	public function performUploadInit($comment, $pageText, $watchlist, $user) {
		// Verify the initial upload request
		$this->verifyUploadInit();
		
		$session = $this->mUpload->setupChunkSession( $comment, $pageText, $watchlist );
		return array('uploadUrl' =>
			wfExpandUrl( wfScript( 'api' ) ) . "?" .
			wfArrayToCGI( array(
				'action' => 'resumableupload',
				'token' => $user->editToken(),
				'format' => 'json',
				'chunksession' => $session,
				'filename' => $this->mUpload->getDesiredName(),
			) ) );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:15,代码来源:ApiResumableUpload.php

示例9: setUp

 protected function setUp()
 {
     global $wgContLang, $wgAuth, $wgMemc, $wgRequest, $wgUser, $wgServer;
     parent::setUp();
     self::$apiUrl = $wgServer . wfScript('api');
     $wgMemc = new EmptyBagOStuff();
     $wgContLang = Language::factory('en');
     $wgAuth = new StubObject('wgAuth', 'AuthPlugin');
     $wgRequest = new FauxRequest(array());
     ApiQueryInfo::resetTokenCache();
     // tokens are invalid because we cleared the session
     self::$users = array('sysop' => new TestUser('Apitestsysop', 'Api Test Sysop', 'api_test_sysop@example.com', array('sysop')), 'uploader' => new TestUser('Apitestuser', 'Api Test User', 'api_test_user@example.com', array()));
     $wgUser = self::$users['sysop']->user;
     $this->apiContext = new ApiTestContext();
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:15,代码来源:ApiTestCase.php

示例10: __construct

 /**
  * Registers core modules and runs registration hooks.
  */
 public function __construct()
 {
     global $IP, $wgResourceModules, $wgResourceLoaderSources, $wgLoadScript, $wgEnableJavaScriptTest;
     wfProfileIn(__METHOD__);
     // Add 'local' source first
     $this->addSource('local', array('loadScript' => $wgLoadScript, 'apiScript' => wfScript('api')));
     // Add other sources
     $this->addSource($wgResourceLoaderSources);
     // Register modules shared between mwEmbed and mediaWiki:
     $this->register(include "{$IP}/resources/MwEmbedSharedResources.php");
     // Register extension modules
     wfRunHooks('ResourceLoaderRegisterModules', array(&$this));
     $this->register($wgResourceModules);
     if ($wgEnableJavaScriptTest === true) {
         $this->registerTestModules();
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:EfncoPlugins,项目名称:Media-Management-based-on-Kaltura,代码行数:21,代码来源:MwEmbedResourceLoader.php

示例11: initPrinter

    /**
     * Initialize the printer function and prepares the output headers, etc.
     * This method must be the first outputing method during execution.
     * A help screen's header is printed for the HTML-based output
     */
    function initPrinter($isError)
    {
        $isHtml = $this->getIsHtml();
        $mime = $isHtml ? 'text/html' : $this->getMimeType();
        $script = wfScript('api');
        // Some printers (ex. Feed) do their own header settings,
        // in which case $mime will be set to null
        if (is_null($mime)) {
            return;
        }
        // skip any initialization
        header("Content-Type: {$mime}; charset=utf-8");
        if ($isHtml) {
            ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>MediaWiki API</title>
</head>
<body>
<?php 
            if (!$isError) {
                ?>
<br/>
<small>
You are looking at the HTML representation of the <?php 
                echo $this->mFormat;
                ?>
 format.<br/>
HTML is good for debugging, but probably is not suitable for your application.<br/>
See <a href='http://www.mediawiki.org/wiki/API'>complete documentation</a>, or 
<a href='<?php 
                echo $script;
                ?>
'>API help</a> for more information.
</small>
<?php 
            }
            ?>
<pre>
<?php 
        }
    }
开发者ID:mediawiki-extensions,项目名称:bizzwiki,代码行数:48,代码来源:ApiFormatBase.php

示例12: execute

 public function execute($par)
 {
     $redirect = $this->getRedirect($par);
     $query = $this->getRedirectQuery();
     // Redirect to a page title with possible query parameters
     if ($redirect instanceof Title) {
         $url = $redirect->getFullURL($query);
         $this->getOutput()->redirect($url);
         return $redirect;
     } elseif ($redirect === true) {
         // Redirect to index.php with query parameters
         $url = wfAppendQuery(wfScript('index'), $query);
         $this->getOutput()->redirect($url);
         return $redirect;
     } else {
         $class = get_class($this);
         throw new MWException("RedirectSpecialPage {$class} doesn't redirect!");
     }
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:19,代码来源:RedirectSpecialPage.php

示例13: execute

 /**
  * Main execution point
  *
  * @param string $subpage
  */
 public function execute($subpage)
 {
     // Backwards-compatibility: redirect to new feed URLs
     $feedFormat = $this->getRequest()->getVal('feed');
     if (!$this->including() && $feedFormat) {
         $query = $this->getFeedQuery();
         $query['feedformat'] = $feedFormat === 'atom' ? 'atom' : 'rss';
         $this->getOutput()->redirect(wfAppendQuery(wfScript('api'), $query));
         return;
     }
     // 10 seconds server-side caching max
     $this->getOutput()->setSquidMaxage(10);
     // Check if the client has a cached version
     $lastmod = $this->checkLastModified();
     if ($lastmod === false) {
         return;
     }
     parent::execute($subpage);
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:24,代码来源:SpecialRecentchanges.php

示例14: factory

 /**
  * Get a webservice handler.
  *
  * @see $wgTranslateTranslationServices
  * @param string $name Name of the service.
  * @param array $config
  * @return TranslationWebService|null
  */
 public static function factory($name, $config)
 {
     $handlers = array('microsoft' => 'MicrosoftWebService', 'apertium' => 'ApertiumWebService', 'yandex' => 'YandexWebService', 'remote-ttmserver' => 'RemoteTTMServerWebService', 'cxserver' => 'CxserverWebService', 'youdao' => 'YoudaoWebService');
     if (!isset($config['timeout'])) {
         $config['timeout'] = 3;
     }
     // Alter local ttmserver instance to appear as remote
     // to take advantage of the query aggregator. But only
     // if they are public.
     if (isset($config['class']) && $config['class'] === 'ElasticSearchTTMServer' && isset($config['public']) && $config['public'] === true) {
         $config['type'] = 'remote-ttmserver';
         $config['service'] = $name;
         $config['url'] = wfExpandURl(wfScript('api'), PROTO_CANONICAL);
     }
     if (isset($handlers[$config['type']])) {
         $class = $handlers[$config['type']];
         return new $class($name, $config);
     }
     return null;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:28,代码来源:TranslationWebService.php

示例15: wfSpecialFavoritelist

 function wfSpecialFavoritelist($par)
 {
     global $wgUser, $wgOut, $wgLang, $wgRequest;
     global $wgRCShowFavoritingUsers, $wgEnotifFavoritelist, $wgShowUpdatedMarker;
     // Add feed links
     $flToken = $wgUser->getOption('favoritelisttoken');
     if (!$flToken) {
         $flToken = sha1(mt_rand() . microtime(true));
         $wgUser->setOption('favoritelisttoken', $flToken);
         $wgUser->saveSettings();
     }
     global $wgServer, $wgScriptPath, $wgFeedClasses;
     $apiParams = array('action' => 'feedfavoritelist', 'allrev' => 'allrev', 'flowner' => $wgUser->getName(), 'fltoken' => $flToken);
     $feedTemplate = wfScript('api') . '?';
     foreach ($wgFeedClasses as $format => $class) {
         $theseParams = $apiParams + array('feedformat' => $format);
         $url = $feedTemplate . wfArrayToCGI($theseParams);
         $wgOut->addFeedLink($format, $url);
     }
     $skin = $wgUser->getSkin();
     $specialTitle = SpecialPage::getTitleFor('Favoritelist');
     $wgOut->setRobotPolicy('noindex,nofollow');
     # Anons don't get a favoritelist
     if ($wgUser->isAnon()) {
         $wgOut->setPageTitle(wfMsg('favoritenologin'));
         $llink = $skin->linkKnown(SpecialPage::getTitleFor('Userlogin'), wfMsgHtml('loginreqlink'), array(), array('returnto' => $specialTitle->getPrefixedText()));
         $wgOut->addHTML(wfMsgWikiHtml('favoritelistanontext', $llink));
         return;
     }
     $wgOut->setPageTitle(wfMsg('favoritelist'));
     $sub = wfMsgExt('favoritelistfor', 'parseinline', $wgUser->getName());
     $sub .= '<br />' . FavoritelistEditor::buildTools($wgUser->getSkin());
     $wgOut->setSubtitle($sub);
     if (($mode = FavoritelistEditor::getMode($wgRequest, $par)) !== false) {
         $editor = new FavoritelistEditor();
         $editor->execute($wgUser, $wgOut, $wgRequest, $mode);
         return;
     }
     $this->viewFavList($wgUser, $wgOut, $wgRequest, $mode);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:40,代码来源:SpecialFavoritelist.php


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