本文整理汇总了PHP中wfArrayToCgi函数的典型用法代码示例。如果您正苦于以下问题:PHP wfArrayToCgi函数的具体用法?PHP wfArrayToCgi怎么用?PHP wfArrayToCgi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfArrayToCgi函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setSyndicated
protected function setSyndicated()
{
$request = $this->getRequest();
$queryParams = array('level' => $request->getIntOrNull('level'), 'tag' => $request->getVal('tag'), 'category' => $request->getVal('category'));
$this->getOutput()->setSyndicated(true);
$this->getOutput()->setFeedAppendQuery(wfArrayToCgi($queryParams));
}
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:7,代码来源:ProblemChanges_body.php
示例2: show
/**
* purge is slightly weird because it can be either formed or formless depending
* on user permissions
*/
public function show()
{
$this->setHeaders();
// This will throw exceptions if there's a problem
$this->checkCanExecute($this->getUser());
$user = $this->getUser();
if ($user->pingLimiter('purge')) {
// TODO: Display actionthrottledtext
return;
}
if ($user->isAllowed('purge')) {
// This will update the database immediately, even on HTTP GET.
// Lots of uses may exist for this feature, so just ignore warnings.
Profiler::instance()->getTransactionProfiler()->resetExpectations();
$this->redirectParams = wfArrayToCgi(array_diff_key($this->getRequest()->getQueryValues(), ['title' => null, 'action' => null]));
if ($this->onSubmit([])) {
$this->onSuccess();
}
} else {
$this->redirectParams = $this->getRequest()->getVal('redirectparams', '');
$form = $this->getForm();
if ($form->show()) {
$this->onSuccess();
}
}
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:30,代码来源:PurgeAction.php
示例3: __construct
function __construct()
{
parent::__construct();
$this->classname = "google";
$this->resourceModules[] = 'ext.MultiMaps.Google';
$urlArgs = array();
$urlArgs['sensor'] = 'false';
$urlArgs['v'] = '3.10';
$this->headerItem .= \Html::linkedScript('//maps.googleapis.com/maps/api/js?' . wfArrayToCgi($urlArgs)) . "\n";
}
开发者ID:MapsMD,项目名称:mediawikiMaps,代码行数:10,代码来源:Google.php
示例4: passCaptcha
function passCaptcha()
{
global $wgRequest;
$ticket = $wgRequest->getVal('Asirra_Ticket');
$api = 'http://challenge.asirra.com/cgi/Asirra?';
$params = array('action' => 'ValidateTicket', 'ticket' => $ticket);
$response = Http::get($api . wfArrayToCgi($params));
$xml = simplexml_load_string($response);
$result = $xml->xpath('/AsirraValidation/Result');
return strval($result[0]) === 'Pass';
}
开发者ID:yusufchang,项目名称:app,代码行数:11,代码来源:Asirra.class.php
示例5: fetchLinks
/**
* @return array[]|bool The 'interwikimap' sub-array or false on failure.
*/
protected function fetchLinks()
{
$url = wfArrayToCgi(array('action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'interwikimap', 'sifilteriw' => 'local', 'format' => 'json'));
if (!empty($this->source)) {
$url = rtrim($this->source, '?') . '?' . $url;
}
$json = Http::get($url);
$data = json_decode($json, true);
if (is_array($data)) {
return $data['query']['interwikimap'];
} else {
return false;
}
}
开发者ID:Benestar,项目名称:mediawiki-extensions-Wikibase,代码行数:17,代码来源:populateInterwiki.php
示例6: 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.
*
* @note : If MW_PHPUNIT_TEST is defined, the call to the external site is skipped, and the title
* is normalized using the local normalization rules as implemented by the Title class.
*
* @see Site::normalizePageName
*
* @since 1.21
*
* @param string $pageName
*
* @return string
* @throws MWException
*/
public function normalizePageName($pageName)
{
// 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
if (defined('MW_PHPUNIT_TEST')) {
// If the code is under test, don't call out to other sites, just normalize locally.
// Note: this may cause results to be inconsistent with the actual normalization used by the respective remote site!
$t = Title::newFromText($pageName);
return $t->getPrefixedText();
} else {
// Make sure the string is normalized into NFC (due to the bug 40017)
// but do nothing to the whitespaces, that should work appropriately.
// @see https://bugzilla.wikimedia.org/show_bug.cgi?id=40017
$pageName = UtfNormal::cleanUp($pageName);
// Build the args for the specific call
$args = array('action' => 'query', 'prop' => 'info', 'redirects' => true, 'converttitles' => true, 'format' => 'json', 'titles' => $pageName);
$url = $this->getFileUrl('api.php') . '?' . wfArrayToCgi($args);
// Go on call the external site
//@todo: we need a good way to specify a timeout here.
$ret = Http::get($url);
}
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:nischayn22,项目名称:mediawiki-core,代码行数:67,代码来源:MediaWikiSite.php
示例7: show
/**
* purge is slightly weird because it can be either formed or formless depending
* on user permissions
*/
public function show()
{
$this->setHeaders();
// This will throw exceptions if there's a problem
$this->checkCanExecute($this->getUser());
if ($this->getUser()->isAllowed('purge')) {
$this->redirectParams = wfArrayToCgi(array_diff_key($this->getRequest()->getQueryValues(), array('title' => null, 'action' => null)));
if ($this->onSubmit(array())) {
$this->onSuccess();
}
} else {
$this->redirectParams = $this->getRequest()->getVal('redirectparams', '');
$form = $this->getForm();
if ($form->show()) {
$this->onSuccess();
}
}
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:22,代码来源:PurgeAction.php
示例8: getPageUrl
/**
* Returns the (partial) URL for the given page (including any section identifier).
*
* @param TitleValue $page The link's target
* @param array $params any additional URL parameters.
*
* @return string
*/
public function getPageUrl(TitleValue $page, $params = array())
{
//TODO: move the code from Linker::linkUrl here!
//The below is just a rough estimation!
$name = $this->formatter->getPrefixedText($page);
$name = str_replace(' ', '_', $name);
$name = wfUrlencode($name);
$url = $this->baseUrl . $name;
if ($params) {
$separator = strpos($url, '?') ? '&' : '?';
$url .= $separator . wfArrayToCgi($params);
}
$fragment = $page->getFragment();
if ($fragment !== '') {
$url = $url . '#' . wfUrlencode($fragment);
}
return $url;
}
开发者ID:Tarendai,项目名称:spring-website,代码行数:26,代码来源:MediaWikiPageLinkRenderer.php
示例9: getForm
/**
* Get the HTMLForm to control behavior
* @return HTMLForm|null
*/
protected function getForm()
{
$this->fields = $this->getFormFields();
// Give hooks a chance to alter the form, adding extra fields or text etc
wfRunHooks('ActionModifyFormFields', array($this->getName(), &$this->fields, $this->page));
$form = new HTMLForm($this->fields, $this->getContext(), $this->getName());
$form->setSubmitCallback(array($this, 'onSubmit'));
// Retain query parameters (uselang etc)
$form->addHiddenField('action', $this->getName());
// Might not be the same as the query string
$params = array_diff_key($this->getRequest()->getQueryValues(), array('action' => null, 'title' => null));
$form->addHiddenField('redirectparams', wfArrayToCgi($params));
$form->addPreText($this->preText());
$form->addPostText($this->postText());
$this->alterForm($form);
// Give hooks a chance to alter the form, adding extra fields or text etc
wfRunHooks('ActionBeforeFormDisplay', array($this->getName(), &$form, $this->page));
return $form;
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:23,代码来源:FormAction.php
示例10: createPDF
/**
* Gets a DOMDocument, searches it for files, uploads files and markus to webservice and generated PDF.
* @param DOMDocument $oHtmlDOM The source markup
* @return string The resulting PDF as bytes
*/
public function createPDF(&$oHtmlDOM)
{
$this->findFiles($oHtmlDOM);
$this->uploadFiles();
//HINT: http://www.php.net/manual/en/class.domdocument.php#96055
//But: Formated Output is evil because is will destroy formatting in <pre> Tags!
$sHtmlDOM = $oHtmlDOM->saveXML($oHtmlDOM->documentElement);
//Save temporary
$sTmpHtmlFile = BSDATADIR . DS . 'UEModulePDF' . DS . $this->aParams['document-token'] . '.html';
$sTmpPDFFile = BSDATADIR . DS . 'UEModulePDF' . DS . $this->aParams['document-token'] . '.pdf';
file_put_contents($sTmpHtmlFile, $sHtmlDOM);
$aOptions = array('timeout' => 120, 'postData' => array('fileType' => '', 'documentToken' => $this->aParams['document-token'], 'sourceHtmlFile_name' => basename($sTmpHtmlFile), 'sourceHtmlFile' => '@' . $sTmpHtmlFile, 'wikiId' => wfWikiID()));
if (BsConfig::get('MW::TestMode')) {
$aOptions['postData']['debug'] = "true";
}
global $bsgUEModulePDFCURLOptions;
$aOptions = array_merge_recursive($aOptions, $bsgUEModulePDFCURLOptions);
wfRunHooks('BSUEModulePDFCreatePDFBeforeSend', array($this, &$aOptions, $oHtmlDOM));
$vHttpEngine = Http::$httpEngine;
Http::$httpEngine = 'curl';
//HINT: http://www.php.net/manual/en/function.curl-setopt.php#refsect1-function.curl-setopt-notes
//Upload HTML source
//TODO: Handle $sResponse
$sResponse = Http::post($this->aParams['soap-service-url'] . '/UploadAsset', $aOptions);
//Now do the rendering
//We re-send the paramters but this time without the file.
unset($aOptions['postData']['sourceHtmlFile']);
unset($aOptions['postData']['fileType']);
//We do not want the request to be multipart/formdata because that's more difficult to handle on Servlet-side
$aOptions['postData'] = wfArrayToCgi($aOptions['postData']);
$vPdfByteArray = Http::post($this->aParams['soap-service-url'] . '/RenderPDF', $aOptions);
Http::$httpEngine = $vHttpEngine;
if ($vPdfByteArray == false) {
wfDebugLog('BS::UEModulePDF', 'BsPDFServlet::createPDF: Failed creating "' . $this->aParams['document-token'] . '"');
}
file_put_contents($sTmpPDFFile, $vPdfByteArray);
//Remove temporary file
if (!BsConfig::get('MW::TestMode')) {
unlink($sTmpHtmlFile);
unlink($sTmpPDFFile);
}
return $vPdfByteArray;
}
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:48,代码来源:PDFServlet.class.php
示例11: getForm
/**
* Get the HTMLForm to control behavior
* @return HTMLForm|null
*/
protected function getForm()
{
$this->fields = $this->getFormFields();
// Give hooks a chance to alter the form, adding extra fields or text etc
Hooks::run('ActionModifyFormFields', [$this->getName(), &$this->fields, $this->page]);
$form = new HTMLForm($this->fields, $this->getContext(), $this->getName());
$form->setSubmitCallback([$this, 'onSubmit']);
$title = $this->getTitle();
$form->setAction($title->getLocalURL(['action' => $this->getName()]));
// Retain query parameters (uselang etc)
$params = array_diff_key($this->getRequest()->getQueryValues(), ['action' => null, 'title' => null]);
if ($params) {
$form->addHiddenField('redirectparams', wfArrayToCgi($params));
}
$form->addPreText($this->preText());
$form->addPostText($this->postText());
$this->alterForm($form);
// Give hooks a chance to alter the form, adding extra fields or text etc
Hooks::run('ActionBeforeFormDisplay', [$this->getName(), &$form, $this->page]);
return $form;
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:25,代码来源:FormAction.php
示例12: doPairs
protected function doPairs()
{
if (!isset($this->config['key'])) {
throw new TranslationWebServiceException('API key is not set');
}
$pairs = array();
$params = array('key' => $this->config['key']);
$url = $this->config['pairs'] . '?' . wfArrayToCgi($params);
// BC MW <= 1.24
$json = Http::request('GET', $url, array('timeout' => $this->config['timeout']));
$response = FormatJson::decode($json);
if (!is_object($response)) {
$exception = 'Malformed reply from remote server: ' . strval($json);
throw new TranslationWebServiceException($exception);
}
foreach ($response->dirs as $pair) {
list($source, $target) = explode('-', $pair);
$pairs[$source][$target] = true;
}
return $pairs;
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:21,代码来源:YandexWebService.php
示例13: fetchImageQuery
protected function fetchImageQuery($query)
{
global $wgMemc;
$url = $this->mApiBase . '?' . wfArrayToCgi(array_merge($query, array('format' => 'json', 'action' => 'query')));
if (!isset($this->mQueryCache[$url])) {
$key = wfMemcKey('ForeignAPIRepo', 'Metadata', md5($url));
$data = $wgMemc->get($key);
if (!$data) {
$data = Http::get($url);
if (!$data) {
return null;
}
$wgMemc->set($key, $data, 3600);
}
if (count($this->mQueryCache) > 100) {
// Keep the cache from growing infinitely
$this->mQueryCache = array();
}
$this->mQueryCache[$url] = $data;
}
return json_decode($this->mQueryCache[$url], true);
}
开发者ID:amjadtbssm,项目名称:website,代码行数:22,代码来源:ForeignAPIRepo.php
示例14: show
public function show()
{
$this->setHeaders();
// This will throw exceptions if there's a problem
$this->checkCanExecute($this->getUser());
$user = $this->getUser();
if ($user->pingLimiter('purge')) {
// TODO: Display actionthrottledtext
return;
}
if ($this->getRequest()->wasPosted()) {
$this->redirectParams = wfArrayToCgi(array_diff_key($this->getRequest()->getQueryValues(), ['title' => null, 'action' => null]));
if ($this->onSubmit([])) {
$this->onSuccess();
}
} else {
$this->redirectParams = $this->getRequest()->getVal('redirectparams', '');
$form = $this->getForm();
if ($form->show()) {
$this->onSuccess();
}
}
}
开发者ID:paladox,项目名称:mediawiki,代码行数:23,代码来源:PurgeAction.php
示例15: threadCommands
/**
* @param $thread Thread
* Example return value:
* array (
* edit => array( 'label' => 'Edit',
* 'href' => 'http...',
* 'enabled' => false ),
* reply => array( 'label' => 'Reply',
* 'href' => 'http...',
* 'enabled' => true )
* )
*/
function threadCommands($thread)
{
$commands = array();
$isLqtPage = LqtDispatch::isLqtPage($thread->getTitle());
$history_url = self::permalinkUrlWithQuery($thread, array('action' => 'history'));
$commands['history'] = array('label' => wfMessage('history_short')->parse(), 'href' => $history_url, 'enabled' => true);
if ($thread->isHistorical()) {
return array();
}
$user_can_edit = $thread->root()->getTitle()->quickUserCan('edit');
$editMsg = $user_can_edit ? 'edit' : 'viewsource';
if ($isLqtPage) {
$commands['edit'] = array('label' => wfMessage($editMsg)->parse(), 'href' => $this->talkpageUrl($this->title, 'edit', $thread, true, $this->request), 'enabled' => true);
}
if ($this->user->isAllowed('delete')) {
$delete_url = $thread->title()->getLocalURL('action=delete');
$deleteMsg = $thread->type() == Threads::TYPE_DELETED ? 'lqt_undelete' : 'delete';
$commands['delete'] = array('label' => wfMessage($deleteMsg)->parse(), 'href' => $delete_url, 'enabled' => true);
}
if ($isLqtPage) {
if (!$thread->isTopmostThread() && $this->user->isAllowed('lqt-split')) {
$splitUrl = SpecialPage::getTitleFor('SplitThread', $thread->title()->getPrefixedText())->getLocalURL();
$commands['split'] = array('label' => wfMessage('lqt-thread-split')->parse(), 'href' => $splitUrl, 'enabled' => true);
}
if ($this->user->isAllowed('lqt-merge')) {
$mergeParams = $_GET;
$mergeParams['lqt_merge_from'] = $thread->id();
unset($mergeParams['title']);
$mergeUrl = $this->title->getLocalURL(wfArrayToCgi($mergeParams));
$label = wfMessage('lqt-thread-merge')->parse();
$commands['merge'] = array('label' => $label, 'href' => $mergeUrl, 'enabled' => true);
}
}
$commands['link'] = array('label' => wfMessage('lqt_permalink')->parse(), 'href' => $thread->title()->getLocalURL(), 'enabled' => true, 'showlabel' => true, 'tooltip' => wfMessage('lqt_permalink')->parse());
Hooks::run('LiquidThreadsThreadCommands', array($thread, &$commands));
return $commands;
}
开发者ID:Rikuforever,项目名称:wiki,代码行数:49,代码来源:View.php
示例16: appendQueryArray
/**
* Appends or replaces value of query variables.
*
* @param array $array of values to replace/add to query
* @param bool $onlyquery whether to only return the query string and not
* the complete URL
* @return String
*/
public function appendQueryArray($array, $onlyquery = false)
{
global $wgTitle;
$newquery = $this->getQueryValues();
unset($newquery['title']);
$newquery = array_merge($newquery, $array);
$query = wfArrayToCgi($newquery);
return $onlyquery ? $query : $wgTitle->getLocalURL($query);
}
开发者ID:mangowi,项目名称:mediawiki,代码行数:17,代码来源:WebRequest.php
示例17: link
/**
* This function returns an HTML link to the given target. It serves a few
* purposes:
* 1) If $target is a Title, the correct URL to link to will be figured
* out automatically.
* 2) It automatically adds the usual classes for various types of link
* targets: "new" for red links, "stub" for short articles, etc.
* 3) It escapes all attribute values safely so there's no risk of XSS.
* 4) It provides a default tooltip if the target is a Title (the page
* name of the target).
* link() replaces the old functions in the makeLink() family.
*
* @param $target Title Can currently only be a Title, but this may
* change to support Images, literal URLs, etc.
* @param $text string The HTML contents of the <a> element, i.e.,
* the link text. This is raw HTML and will not be escaped. If null,
* defaults to the prefixed text of the Title; or if the Title is just a
* fragment, the contents of the fragment.
* @param $customAttribs array A key => value array of extra HTML attri-
* butes, such as title and class. (href is ignored.) Classes will be
* merged with the default classes, while other attributes will replace
* default attributes. All passed attribute values will be HTML-escaped.
* A false attribute value means to suppress that attribute.
* @param $query array The query string to append to the URL
* you're linking to, in key => value array form. Query keys and values
* will be URL-encoded.
* @param $options string|array String or array of strings:
* 'known': Page is known to exist, so don't check if it does.
* 'broken': Page is known not to exist, so don't check if it does.
* 'noclasses': Don't add any classes automatically (includes "new",
* "stub", "mw-redirect", "extiw"). Only use the class attribute
* provided, if any, so you get a simple blue link with no funny i-
* cons.
* 'forcearticlepath': Use the article path always, even with a querystring.
* Has compatibility issues on some setups, so avoid wherever possible.
* @return string HTML <a> attribute
*/
public static function link($target, $html = null, $customAttribs = array(), $query = array(), $options = array())
{
wfProfileIn(__METHOD__);
if (!$target instanceof Title) {
wfProfileOut(__METHOD__);
return "<!-- ERROR -->{$html}";
}
$options = (array) $options;
$dummy = new DummyLinker();
// dummy linker instance for bc on the hooks
$ret = null;
if (!wfRunHooks('LinkBegin', array($dummy, $target, &$html, &$customAttribs, &$query, &$options, &$ret))) {
wfProfileOut(__METHOD__);
return $ret;
}
# Normalize the Title if it's a special page
$target = self::normaliseSpecialPage($target);
# If we don't know whether the page exists, let's find out.
wfProfileIn(__METHOD__ . '-checkPageExistence');
if (!in_array('known', $options) and !in_array('broken', $options)) {
if ($target->isKnown()) {
$options[] = 'known';
} else {
$options[] = 'broken';
}
}
wfProfileOut(__METHOD__ . '-checkPageExistence');
$oldquery = array();
if (in_array("forcearticlepath", $options) && $query) {
$oldquery = $query;
$query = array();
}
# Note: we want the href attribute first, for prettiness.
$attribs = array('href' => self::linkUrl($target, $query, $options));
if (in_array('forcearticlepath', $options) && $oldquery) {
$attribs['href'] = wfAppendQuery($attribs['href'], wfArrayToCgi($oldquery));
}
$attribs = array_merge($attribs, self::linkAttribs($target, $customAttribs, $options));
if (is_null($html)) {
$html = self::linkText($target);
}
$ret = null;
if (wfRunHooks('LinkEnd', array($dummy, $target, $options, &$html, &$attribs, &$ret))) {
$ret = Html::rawElement('a', $attribs, $html);
}
wfProfileOut(__METHOD__);
return $ret;
}
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:85,代码来源:Linker.php
示例18: _proxy
protected function _proxy($params)
{
foreach ($params as $key => $val) {
if (is_null($val)) {
// Don't pass nulls to remote
unset($params[$key]);
}
}
$target = $this->mProxy . '?' . wfArrayToCgi($params);
$blob = Http::get($target, $this->mTimeout);
if ($blob === false) {
throw new MWException("SVN proxy error");
}
$data = unserialize($blob);
return $data;
}
开发者ID:yusufchang,项目名称:app,代码行数:16,代码来源:Subversion.php
示例19: wfAppendQuery
/**
* Append a query string to an existing URL, which may or may not already
* have query string parameters already. If so, they will be combined.
*
* @param string $url
* @param string|string[] $query String or associative array
* @return string
*/
function wfAppendQuery($url, $query)
{
if (is_array($query)) {
$query = wfArrayToCgi($query);
}
if ($query != '') {
if (false === strpos($url, '?')) {
$url .= '?';
} else {
$url .= '&';
}
$url .= $query;
}
return $url;
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:23,代码来源:GlobalFunctions.php
示例20: getEscapedProfileUrl
function getEscapedProfileUrl($_filter = false, $_sort = false, $_expand = false)
{
// @codingStandardsIgnoreStart
global $filter, $sort, $expand;
// @codingStandardsIgnoreEnd
if ($_expand === false) {
$_expand = $expand;
}
return htmlspecialchars('?' . wfArrayToCgi(['filter' => $_filter ? $_filter : $filter, 'sort' => $_sort ? $_sort : $sort, 'expand' => implode(',', array_keys($_expand))]));
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:10,代码来源:profileinfo.php
注:本文中的wfArrayToCgi函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论