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

PHP wfAppendQuery函数代码示例

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

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



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

示例1: passCaptcha

 /**
  * Check, if the user solved the captcha.
  *
  * Based on reference implementation:
  * https://github.com/google/recaptcha#php
  *
  * @return boolean
  */
 function passCaptcha()
 {
     global $wgRequest, $wgReCaptchaSecretKey, $wgReCaptchaSendRemoteIP;
     $url = 'https://www.google.com/recaptcha/api/siteverify';
     // Build data to append to request
     $data = array('secret' => $wgReCaptchaSecretKey, 'response' => $wgRequest->getVal('g-recaptcha-response'));
     if ($wgReCaptchaSendRemoteIP) {
         $data['remoteip'] = $wgRequest->getIP();
     }
     $url = wfAppendQuery($url, $data);
     $request = MWHttpRequest::factory($url, array('method' => 'GET'));
     $status = $request->execute();
     if (!$status->isOK()) {
         $this->error = 'http';
         $this->logStatusError($status);
         return false;
     }
     $response = FormatJson::decode($request->getContent(), true);
     if (!$response) {
         $this->error = 'json';
         $this->logStatusError($this->error);
         return false;
     }
     if (isset($response['error-codes'])) {
         $this->error = 'recaptcha-api';
         $this->logCheckError($response['error-codes']);
         return false;
     }
     return $response['success'];
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:38,代码来源:ReCaptchaNoCaptcha.class.php


示例2: fetchScriptList

 protected function fetchScriptList()
 {
     $data = array('action' => 'query', 'format' => 'php', 'list' => 'allpages', 'apnamespace' => '8', 'aplimit' => '500');
     $baseUrl = $this->getArg(0);
     $pages = array();
     do {
         $url = wfAppendQuery($baseUrl, $data);
         $strResult = Http::get($url);
         //$result = FormatJson::decode( $strResult ); // Still broken
         $result = unserialize($strResult);
         if (!empty($result['query']['allpages'])) {
             foreach ($result['query']['allpages'] as $page) {
                 if (substr($page['title'], -3) === '.js') {
                     strtok($page['title'], ':');
                     $pages[] = strtok('');
                 }
             }
         }
         if (!empty($result['query-continue'])) {
             $data['apfrom'] = $result['query-continue']['allpages']['apfrom'];
             $this->output("Fetching new batch from {$data['apfrom']}\n");
         }
     } while (isset($result['query-continue']));
     return $pages;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:25,代码来源:importSiteScripts.php


示例3: stage

 public function stage(GatewayType $adapter, $normalized, &$stagedData)
 {
     if ($adapter->isBatchProcessor()) {
         // Only makes sense for real users.
         return;
     }
     if (!empty($normalized['returnto'])) {
         $returnto = $normalized['returnto'];
     } else {
         $returnto = '';
     }
     if (isset($normalized['payment_method']) && $normalized['payment_method'] === 'cc') {
         // Add order ID to the returnto URL, only if it's not already there.
         //TODO: This needs to be more robust (like actually pulling the
         //qstring keys, resetting the values, and putting it all back)
         //but for now it'll keep us alive.
         if ($adapter->getOrderIDMeta('generate') && !empty($returnto) && !strpos($returnto, 'order_id')) {
             $queryArray = array('order_id' => $normalized['order_id']);
             $stagedData['returnto'] = wfAppendQuery($returnto, $queryArray);
         }
     } else {
         // FIXME: An empty returnto should be handled by the result switcher instead.
         $stagedData['returnto'] = ResultPages::getThankYouPage($adapter);
     }
 }
开发者ID:wikimedia,项目名称:wikimedia-fundraising-crm-vendor,代码行数:25,代码来源:IngenicoReturntoHelper.php


示例4: getFailPageFromParams

 /**
  * @param bool $rapidFail if true, render a form as a fail page rather than redirect
  * @param string $failPage either a wiki page title, or a URL to an external wiki
  *                         page title.
  * @param array $data information about the current request.
  *                    language, gateway, payment_method, and payment_submethod must be set
  * @param Psr\Log\LoggerInterface $logger
  * @return string full URL of the fail page, or just form name in case of rapidFail
  */
 private static function getFailPageFromParams($rapidFail, $failPage, $data, LoggerInterface $logger)
 {
     if (isset($data['language'])) {
         $language = $data['language'];
     } else {
         $language = WmfFramework::getLanguageCode();
     }
     // Prefer RapidFail.
     if ($rapidFail) {
         // choose which fail page to go for.
         try {
             $fail_ffname = GatewayFormChooser::getBestErrorForm($data['gateway'], $data['payment_method'], $data['payment_submethod']);
             return $fail_ffname;
         } catch (Exception $e) {
             $logger->error('Cannot determine best error form. ' . $e->getMessage());
         }
     }
     if (filter_var($failPage, FILTER_VALIDATE_URL)) {
         return self::appendLanguageAndMakeURL($failPage, $language);
     }
     // FIXME: either add Special:FailPage to avoid depending on wiki content,
     // or update the content on payments to be consistent with the /lang
     // format of ThankYou pages so we can use appendLanguageAndMakeURL here.
     $failTitle = Title::newFromText($failPage);
     $url = wfAppendQuery($failTitle->getFullURL(), array('uselang' => $language));
     return $url;
 }
开发者ID:wikimedia,项目名称:wikimedia-fundraising-crm-vendor,代码行数:36,代码来源:ResultPages.php


示例5: getSupportUrl

 /**
  * Target URL for a link provided by a support button/aid.
  *
  * @param $title Title Title object for the translation message.
  * @since 2015.09
  */
 public static function getSupportUrl(Title $title)
 {
     global $wgTranslateSupportUrl, $wgTranslateSupportUrlNamespace;
     $namespace = $title->getNamespace();
     // Fetch the configuration for this namespace if possible, or the default.
     if (isset($wgTranslateSupportUrlNamespace[$namespace])) {
         $config = $wgTranslateSupportUrlNamespace[$namespace];
     } elseif ($wgTranslateSupportUrl) {
         $config = $wgTranslateSupportUrl;
     } else {
         throw new TranslationHelperException("Support page not configured");
     }
     // Preprocess params
     $params = array();
     if (isset($config['params'])) {
         foreach ($config['params'] as $key => $value) {
             $params[$key] = str_replace('%MESSAGE%', $title->getPrefixedText(), $value);
         }
     }
     // Return the URL or make one from the page
     if (isset($config['url'])) {
         return wfAppendQuery($config['url'], $params);
     } elseif (isset($config['page'])) {
         $page = Title::newFromText($config['page']);
         if (!$page) {
             throw new TranslationHelperException("Support page not configured properly");
         }
         return $page->getFullUrl($params);
     } else {
         throw new TranslationHelperException("Support page not configured properly");
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:38,代码来源:SupportAid.php


示例6: fetchScriptList

 protected function fetchScriptList()
 {
     $data = ['action' => 'query', 'format' => 'json', 'list' => 'allpages', 'apnamespace' => '8', 'aplimit' => '500', 'continue' => ''];
     $baseUrl = $this->getArg(0);
     $pages = [];
     while (true) {
         $url = wfAppendQuery($baseUrl, $data);
         $strResult = Http::get($url, [], __METHOD__);
         $result = FormatJson::decode($strResult, true);
         $page = null;
         foreach ($result['query']['allpages'] as $page) {
             if (substr($page['title'], -3) === '.js') {
                 strtok($page['title'], ':');
                 $pages[] = strtok('');
             }
         }
         if ($page !== null) {
             $this->output("Fetched list up to {$page['title']}\n");
         }
         if (isset($result['continue'])) {
             // >= 1.21
             $data = array_replace($data, $result['continue']);
         } elseif (isset($result['query-continue']['allpages'])) {
             // <= 1.20
             $data = array_replace($data, $result['query-continue']['allpages']);
         } else {
             break;
         }
     }
     return $pages;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:31,代码来源:importSiteScripts.php


示例7: execute

	public function execute( $par ) {
		global $wgOut, $wgRequest;
		global $wgVariablePagePossibilities;

		$lang = ( preg_match( '/^[A-Za-z-]+$/', $wgRequest->getVal( 'lang' ) ) )
				? $wgRequest->getVal( 'lang' )
				: 'en' ;
		$utm_source = $wgRequest->getVal( 'utm_source' );
		$utm_medium = $wgRequest->getVal( 'utm_medium' );
		$utm_campaign = $wgRequest->getVal( 'utm_campaign' );
		$referrer = ( $wgRequest->getVal( 'referrer' ))
				? $wgRequest->getVal( 'referrer' )
				: $wgRequest->getHeader( 'referer' );
	
		$query = array();
		if ( strlen( $lang ) ) $query[ 'language' ] = $lang;
		if ( strlen( $utm_source ) ) $query[ 'utm_source' ] = $utm_source;
		if ( strlen( $utm_medium ) ) $query[ 'utm_medium' ] = $utm_medium;
		if ( strlen( $utm_campaign ) ) $query[ 'utm_campaign' ] = $utm_campaign;
		if ( strlen( $referrer ) ) $query[ 'referrer' ] = $referrer;

		// determine the URL to which we will redirect the user
		$url = $this->determinePage( $wgVariablePagePossibilities );
		$wgOut->redirect( wfAppendQuery( $url, $query ) );
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:25,代码来源:VariablePage.body.php


示例8: 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


示例9: getApiURL

 /**
  * Get the API URL constructed from the domain template of sites
  */
 public static function getApiURL($language, $params = null)
 {
     global $wgContentTranslationSiteTemplates;
     $domain = self::getDomainCode($language);
     // $wgContentTranslationSiteTemplates['api'] is protocol relative path
     $url = 'https:' . str_replace('$1', $domain, $wgContentTranslationSiteTemplates['api']);
     $url = wfAppendQuery($url, $params);
     return $url;
 }
开发者ID:Rjaylyn,项目名称:mediawiki-extensions-ContentTranslation,代码行数:12,代码来源:SiteMapper.php


示例10: doRequest

 private function doRequest($apiUrl)
 {
     $params = array('action' => 'query', 'list' => 'allpages', 'apnamespace' => 120, 'aplimit' => 300, 'format' => 'json', 'rawcontinue' => 1);
     if (isset($this->continuation) && $this->continuation !== null) {
         $params['apfrom'] = $this->continuation;
     }
     $json = Http::get(wfAppendQuery($apiUrl, $params), array(), __METHOD__);
     return json_decode($json, true);
 }
开发者ID:addshore,项目名称:WikibaseImport,代码行数:9,代码来源:PropertyIdLister.php


示例11: doRequest

 private function doRequest(array $ids)
 {
     $params = array('action' => 'wbgetentities', 'ids' => implode('|', $ids), 'format' => 'json');
     $json = Http::get(wfAppendQuery($this->apiUrl, $params), array(), __METHOD__);
     $data = json_decode($json, true);
     if ($data) {
         return $data;
     }
     $this->logger->error('Failed to decode json api response');
 }
开发者ID:addshore,项目名称:WikibaseImport,代码行数:10,代码来源:ApiEntityLookup.php


示例12: 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


示例13: wfCSSRender

function wfCSSRender(&$parser, $css)
{
    global $wgCSSPath, $wgStylePath, $wgCSSIdentifier;
    $css = trim($css);
    $title = Title::newFromText($css);
    $rawProtection = "{$wgCSSIdentifier}=1";
    $headItem = '<!-- Begin Extension:CSS -->';
    if (is_object($title) && $title->exists()) {
        # Article actually in the db
        $params = "action=raw&ctype=text/css&{$rawProtection}";
        $url = $title->getLocalURL($params);
        $headItem .= HTML::linkedStyle($url);
    } elseif ($css[0] == '/') {
        # Regular file
        $base = $wgCSSPath === false ? $wgStylePath : $wgCSSPath;
        $url = wfAppendQuery($base . $css, $rawProtection);
        # Verify the expanded URL is still using the base URL
        if (strpos(wfExpandUrl($url), wfExpandUrl($base)) === 0) {
            $headItem .= HTML::linkedStyle($url);
        } else {
            $headItem .= '<!-- Invalid/malicious path  -->';
        }
    } else {
        # Inline CSS; use data URI to prevent injection.  JavaScript
        # will use a canary to verify load and will safely convert to
        # style tag if load fails.
        # Generate random CSS color that isn't black or white.
        $color = dechex(mt_rand(1, hexdec('fffffe')));
        $color = str_pad($color, 6, '0', STR_PAD_LEFT);
        # Prepend canary CSS to sanitized user CSS
        $canaryId = "{$wgCSSIdentifier}-canary-{$color}";
        $canaryCSS = "#{$canaryId}{background:#{$color} !important}";
        $css = $canaryCSS . Sanitizer::checkCss($css);
        # Encode data URI and append link tag
        $dataPrefix = 'data:text/css;charset=UTF-8;base64,';
        $url = $dataPrefix . base64_encode($css);
        $headItem .= HTML::linkedStyle($url);
        # Calculate URI prefix to match link tag
        $hrefPrefix = $dataPrefix . base64_encode('#' . $canaryId);
        $hrefPrefix = substr($url, 0, strlen($hrefPrefix));
        # Add JS to verify the link tag loaded and fallback if needed
        $parser->getOutput()->addModules('ext.CSS');
        $headItem .= HTML::inlineScript(<<<INLINESCRIPT
jQuery( function( \$ ) {
\t\$( 'link[href^="{$hrefPrefix}"]' )
\t\t.cssExtensionDataURIFallback( '{$canaryId}', '{$color}' );
} );
INLINESCRIPT
);
    }
    $headItem .= '<!-- End Extension:CSS -->';
    $parser->getOutput()->addHeadItem($headItem);
    return '';
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:54,代码来源:CSS.php


示例14: addMatchedText

 /**
  * Hook function called with &match=lang
  * Transform $text into a bilingual version
  * @param $out OutputPage
  * @param $text
  */
 function addMatchedText(&$out, &$text)
 {
     global $wgContLang, $wgContLanguageCode, $wgRequest, $wgLang, $wgMemc, $wgDoubleWikiCacheTime;
     $match_request = $wgRequest->getText('match');
     if ($match_request === '') {
         return true;
     }
     $this->addMatchingTags($text, $match_request);
     $langLinks = $out->getLanguageLinks();
     foreach ($langLinks as $l) {
         $nt = Title::newFromText($l);
         $iw = $nt->getInterwiki();
         if ($iw !== $match_request) {
             continue;
         }
         $key = wfMemcKey('doublewiki', $wgLang->getCode(), $nt->getPrefixedDbKey());
         $cachedText = $wgMemc->get($key);
         if ($cachedText) {
             $text = $cachedText;
         } else {
             $url = $nt->getCanonicalURL();
             $myURL = $out->getTitle()->getLocalURL();
             $languageName = $wgContLang->getLanguageName($iw);
             $myLanguage = $wgLang->getLanguageName($wgContLang->getCode());
             $translation = Http::get(wfAppendQuery($url, array('action' => 'render')));
             if ($translation !== null) {
                 break;
             }
             /**
              * first find all links that have no 'class' parameter.
              * these links are local so we add '?match=xx' to their url,
              * unless it already contains a '?'
              */
             $translation = preg_replace("/<a href=\"http:\\/\\/([^\"\\?]*)\"(([\\s]+)(c(?!lass=)|[^c\\>\\s])([^\\>\\s]*))*\\>/i", "<a href=\"http://\\1?match={$wgContLanguageCode}\"\\2>", $translation);
             // now add class='extiw' to these links
             $translation = preg_replace("/<a href=\"http:\\/\\/([^\"]*)\"(([\\s]+)(c(?!lass=)|[^c\\>\\s])([^\\>\\s]*))*\\>/i", "<a href=\"http://\\1\" class=\"extiw\"\\3>", $translation);
             // use class='extiw' for images too
             $translation = preg_replace("/<a href=\"http:\\/\\/([^\"]*)\"([^\\>]*)class=\"image\"([^\\>]*)\\>/i", "<a href=\"http://\\1\"\\2class=\"extiw\"\\3>", $translation);
             // add prefixes to internal links, in order to prevent duplicates
             $translation = preg_replace("/<a href=\"#(.*?)\"/i", "<a href=\"#l_\\1\"", $translation);
             $translation = preg_replace("/<li id=\"(.*?)\"/i", "<li id=\"l_\\1\"", $translation);
             $text = preg_replace("/<a href=\"#(.*?)\"/i", "<a href=\"#r_\\1\"", $text);
             $text = preg_replace("/<li id=\"(.*?)\"/i", "<li id=\"r_\\1\"", $text);
             // add ?match= to local links of the local wiki
             $text = preg_replace("/<a href=\"\\/([^\"\\?]*)\"/i", "<a href=\"/\\1?match={$match_request}\"", $text);
             // do the job
             $text = $this->matchColumns($text, $myLanguage, $myURL, $wgContLanguageCode, $translation, $languageName, $url, $match_request);
             $wgMemc->set($key, $text, $wgDoubleWikiCacheTime);
         }
         break;
     }
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:59,代码来源:DoubleWiki_body.php


示例15: onSkinTemplateTabs

	/**
	 * Purpose: Add custom tabs
	 *
	 * When editing in read-only data-set, if you have the copy permission, you can
	 * make a copy into the designated community dataset and edit the data there.
	 * This is accessible through an 'edit copy' tab which is added below.
	 *
	 * @param $skin Skin as passed by MW
	 * @param $tabs as passed by MW
	 */
	public static function onSkinTemplateTabs( $skin, $content_actions ) {
		global $wgUser, $wgCommunity_dc, $wdShowEditCopy, $wdHandlerClasses;

		$title = $skin->getTitle();

		if ( !self::isWikidataNs( $title ) ) {
			return true;
		}

		$ns = $title->getNamespace();
		$editChanged = false;
		$dc = wdGetDataSetContext();

		if ( $wdHandlerClasses[ $ns ] == 'DefinedMeaning' ) {

			# Hackishly determine which DMID we're on by looking at the page title component
			$tt = $title->getText();
			$rpos1 = strrpos( $tt, '(' );
			$rpos2 = strrpos( $tt, ')' );
			$dmid = ( $rpos1 && $rpos2 ) ? substr( $tt, $rpos1 + 1, $rpos2 - $rpos1 - 1 ) : 0;
			if ( $dmid ) {
				$copyTitle = SpecialPage::getTitleFor( 'Copy' );
				if ( $dc != $wgCommunity_dc && $wdShowEditCopy ) {
					$editChanged = true;
					$content_actions['edit'] = array(
						'class' => false,
						'text' => wfMsg( 'ow_nstab_edit_copy' ),
						'href' => $copyTitle->getLocalUrl( "action=copy&dmid=$dmid&dc1=$dc&dc2=$wgCommunity_dc" )
					);
				}
				$content_actions['nstab-definedmeaning'] = array(
					 'class' => 'selected',
					 'text' => wfMsg( 'ow_nstab_definedmeaning' ),
					 'href' => $title->getLocalUrl( "dataset=$dc" )
				);
			}
		}

		// Prevent move tab being shown.
		unset( $content_actions['move'] );

		// Add context dataset (old hooks 'GetEditLinkTrail' and 'GetHistoryLinkTrail')
		if ( !$editChanged && $content_actions['edit'] != null ) {
			$content_actions['edit']['href'] = wfAppendQuery( $content_actions['edit']['href'], "dataset=$dc" );
		}

		$content_actions['history']['href'] = wfAppendQuery( $content_actions['history']['href'], "dataset=$dc" );

		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:60,代码来源:Wikidata.hooks.php


示例16: requestParsoid

 protected function requestParsoid($method, $title, $params)
 {
     global $wgVisualEditorParsoidURL, $wgVisualEditorParsoidTimeout, $wgVisualEditorParsoidForwardCookies;
     $url = $wgVisualEditorParsoidURL . '/' . urlencode($this->getApiSource()) . '/' . urlencode($title->getPrefixedDBkey());
     $data = array_merge($this->getProxyConf(), array('method' => $method, 'timeout' => $wgVisualEditorParsoidTimeout));
     if ($method === 'POST') {
         $data['postData'] = $params;
     } else {
         $url = wfAppendQuery($url, $params);
     }
     $req = MWHttpRequest::factory($url, $data);
     // Forward cookies, but only if configured to do so and if there are read restrictions
     if ($wgVisualEditorParsoidForwardCookies && !User::isEveryoneAllowed('read')) {
         $req->setHeader('Cookie', $this->getRequest()->getHeader('Cookie'));
     }
     $status = $req->execute();
     if ($status->isOK()) {
         // Pass thru performance data from Parsoid to the client, unless the response was
         // served directly from Varnish, in  which case discard the value of the XPP header
         // and use it to declare the cache hit instead.
         $xCache = $req->getResponseHeader('X-Cache');
         if (is_string($xCache) && strpos(strtolower($xCache), 'hit') !== false) {
             $xpp = 'cached-response=true';
             $hit = true;
         } else {
             $xpp = $req->getResponseHeader('X-Parsoid-Performance');
             $hit = false;
         }
         WikiaLogger::instance()->debug('ApiVisualEditor', array('hit' => $hit, 'method' => $method, 'url' => $url));
         if ($xpp !== null) {
             $resp = $this->getRequest()->response();
             $resp->header('X-Parsoid-Performance: ' . $xpp);
         }
     } elseif ($status->isGood()) {
         $this->dieUsage($req->getContent(), 'parsoidserver-http-' . $req->getStatus());
     } elseif ($errors = $status->getErrorsByType('error')) {
         $error = $errors[0];
         $code = $error['message'];
         if (count($error['params'])) {
             $message = $error['params'][0];
         } else {
             $message = 'MWHttpRequest error';
         }
         $this->dieUsage($message, 'parsoidserver-' . $code);
     }
     // TODO pass through X-Parsoid-Performance header, merge with getHTML above
     return $req->getContent();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:48,代码来源:ApiVisualEditor.php


示例17: 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


示例18: 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


示例19: 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()->setCdnMaxage(10);
     // Check if the client has a cached version
     $lastmod = $this->checkLastModified();
     if ($lastmod === false) {
         return;
     }
     $this->addHelpLink('//meta.wikimedia.org/wiki/Special:MyLanguage/Help:Recent_changes', true);
     parent::execute($subpage);
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:25,代码来源:SpecialRecentchanges.php


示例20: normalizePageName

 /**
  * Returns the normalized form of the given page title, using the
  * normalization rules of the given site. If the given title is a redirect,
  * the redirect weill be resolved and the redirect target is returned.
  *
  * @note This actually makes an API request to the remote site, so beware
  *   that this function is slow and depends on an external service.
  *
  * @see Site::normalizePageName
  *
  * @since 1.27
  *
  * @param string $pageName
  * @param string $apiUrl
  *
  * @return string
  * @throws \MWException
  */
 public function normalizePageName($pageName, $apiUrl)
 {
     // Check if we have strings as arguments.
     if (!is_string($pageName)) {
         throw new \MWException('$pageName must be a string');
     }
     // Go on call the external site
     // Make sure the string is normalized into NFC (due to T42017)
     // but do nothing to the whitespaces, that should work appropriately.
     // @see https://phabricator.wikimedia.org/T42017
     $pageName = Validator::cleanUp($pageName);
     // Build the args for the specific call
     $args = ['action' => 'query', 'prop' => 'info', 'redirects' => true, 'converttitles' => true, 'format' => 'json', 'titles' => $pageName];
     $url = wfAppendQuery($apiUrl, $args);
     // Go on call the external site
     // @todo we need a good way to specify a timeout here.
     $ret = $this->http->get($url, [], __METHOD__);
     if ($ret === false) {
         wfDebugLog("MediaWikiSite", "call to external site failed: {$url}");
         return false;
     }
     $data = FormatJson::decode($ret, true);
     if (!is_array($data)) {
         wfDebugLog("MediaWikiSite", "call to <{$url}> returned bad json: " . $ret);
         return false;
     }
     $page = static::extractPageRecord($data, $pageName);
     if (isset($page['missing'])) {
         wfDebugLog("MediaWikiSite", "call to <{$url}> returned a marker for a missing page title! " . $ret);
         return false;
     }
     if (isset($page['invalid'])) {
         wfDebugLog("MediaWikiSite", "call to <{$url}> returned a marker for an invalid page title! " . $ret);
         return false;
     }
     if (!isset($page['title'])) {
         wfDebugLog("MediaWikiSite", "call to <{$url}> did not return a page title! " . $ret);
         return false;
     }
     return $page['title'];
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:59,代码来源:MediaWikiPageNameNormalizer.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wfAppendToArrayIfNotDefault函数代码示例发布时间:2022-05-23
下一篇:
PHP weekday_short_name函数代码示例发布时间: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