-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lucamauri
committed
Jul 5, 2020
1 parent
f6c2871
commit 4da35f8
Showing
7 changed files
with
96 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"@metadata": { | ||
"authors": ["Luca Mauri"] | ||
}, | ||
"auto-upload": "''Auto upload'' message on GitHub", | ||
"auto-commit": "''Auto commit'' message on GitHub", | ||
"code-from-page": "Prefix to the page name", | ||
"p2g-config-namespace": "Description of the namespace", | ||
"pagetogithub": "Placeholder for product name", | ||
"p2g-specialpage-text": "Intro of the ''Special'' page", | ||
"p2g-specialpage-variables-text": "Intro of the ''Configuration'' section", | ||
"p2g-specialpage-config-title": "Title of the ''config'' section" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
use MediaWiki\MediaWikiServices; | ||
|
||
class PageToGitHubCommon { | ||
function __construct() { | ||
parent::__construct('PageToGitHub'); | ||
|
||
$variablesNames = ["P2GNameSpace", "P2GKeyword", "P2GAddKeyword", "P2GIgnoreMinor","P2GAuthToken", "P2GOwner", "P2GRepo"]; | ||
$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig('PageToGitHub'); | ||
foreach ($variablesNames as $variableName) { | ||
${$variableName} = $config->get($variableName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
use MediaWiki\MediaWikiServices; | ||
|
||
class PageToGitHubSpecial extends SpecialPage { | ||
function __construct() { | ||
parent::__construct('PageToGitHub'); | ||
} | ||
|
||
function execute( $par ) { | ||
$variablesNames = ["P2GNameSpace", "P2GKeyword", "P2GAddKeyword", "P2GIgnoreMinor","P2GAuthToken", "P2GOwner", "P2GRepo"]; | ||
$request = $this->getRequest(); | ||
$output = $this->getOutput(); | ||
$this->setHeaders(); | ||
|
||
# Get request data from, e.g. | ||
$param = $request->getText( 'param' ); | ||
|
||
# Do stuff | ||
$config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig('PageToGitHub'); | ||
|
||
// https://doc.wikimedia.org/mediawiki-core/master/php/classOutputPage.html | ||
$output->addWikiMsg('p2g-specialpage-text'); | ||
$output->addWikiMsg('p2g-specialpage-config-title'); | ||
$output->addWikiMsg('p2g-specialpage-variables-text'); | ||
|
||
$output->addHTML('<table class="wikitable plainlinks" id="p2g-variables"><tbody> | ||
<tr> | ||
<th>Variabile</th> | ||
<th>Valore</th> | ||
</tr>'); | ||
|
||
foreach ($variablesNames as $variableName) { | ||
${$variableName} = $config->get($variableName); | ||
$output->addHTML('<tr>'); | ||
$output->addHTML('<th>' . $variableName . '</th>'); | ||
if ($variableName == 'P2GAuthToken') { | ||
$variableContent = "''hidden''"; | ||
} else { | ||
$variableContent = "<code>" . ${$variableName} . "</code>"; | ||
} | ||
$output->addHTML('<td>'); | ||
$output->addWikiTextAsContent($variableContent); | ||
$output->addHTML('</td>'); | ||
$output->addHTML('</tr>'); | ||
} | ||
|
||
$output->addHTML('</tbody></table>'); | ||
|
||
//$wikitext = 'Hello world!'; | ||
//$output->addWikiTextAsInterface( $wikitext ); | ||
} | ||
} |