-1

I've got an API key from themoviedb.org and I want to use it with the MediaWiki extension External Data. But if I put it as plain wikitext it will be in plain sight.

Is there a simple way to add it as a custom variable in LocalSettings.php and then call this variable as a magic word or something in wikitext? And if so, will the key be secure that way?

leo
  • 8,106
  • 7
  • 48
  • 80
Protonotarios
  • 553
  • 4
  • 15
  • What do you mean by `I want to use it in a MediaWiki site`? Are you making javascript calls to themoviedb.org? Or is there an extension that forces you to store a key as wiki text (in that case: Stop using it!). Or? – leo May 04 '15 at 20:07
  • In my wiki I make api calls to themoviedb.org to get movie data which then are rendered in wiki pages (via extension ExternalData). All api calls contain my api key. For example, a person search would be: `http://api.themoviedb.org/3/search/person?api_key=XXXXXXX&query=Brad%20Pitt` where XXXXXXX=my api key. So, if anyone presses Edit on a page will see the above. Therefore I thought that it might be possible to use some variable defined in LocalSettings.php. This is what extensions handling certain api's do (eg Flickr extension). But here there is no such thing, just a url in plain wikitext. – Protonotarios May 04 '15 at 22:28
  • 1
    Ok, re-tag your question, as this is about a specific extension to MediaWiki – leo May 05 '15 at 06:33
  • 1
    And for an answer, please read the documentation for ExternalData: http://www.mediawiki.org/wiki/Extension:External_Data#Retrieving_data (se *String replacement in URLs*) – leo May 05 '15 at 06:35
  • Yes!!! That's exactly it!! Thank you so much leo! You may post is as an answer with this link http://www.mediawiki.org/wiki/Extension:External_Data#String_replacement_in_URLs – Protonotarios May 05 '15 at 06:52

1 Answers1

1

There is no built in function in MediaWiki for “placeholders” in wikitext like the ones you are describing. Extensions with that need tend to use their own, custom solutions.

For Extension:External Data, you can add a variable called $edgStringReplacements to LocalSettings.php, see the documentation.

leo
  • 8,106
  • 7
  • 48
  • 80
  • 1
    Thanks leo! You've answered both my questions. Because, besides the External Data extension, I really wanted to know if there is a way to "hide" strings in page source. – Protonotarios May 05 '15 at 21:30