mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CiteThisPage
synced 2024-11-27 17:00:15 +00:00
Add php code sniffer
Change-Id: I95b39047cf07694b276728d2831bc811ee9e329d
This commit is contained in:
parent
ddb86d726d
commit
f403a8d42e
|
@ -9,14 +9,17 @@ class CiteThisPageHooks {
|
|||
* @param $revid
|
||||
* @return bool
|
||||
*/
|
||||
public static function onSkinTemplateBuildNavUrlsNav_urlsAfterPermalink( &$skintemplate, &$nav_urls, &$oldid, &$revid ) {
|
||||
public static function onSkinTemplateBuildNavUrlsNav_urlsAfterPermalink(
|
||||
&$skintemplate, &$nav_urls, &$oldid, &$revid
|
||||
) {
|
||||
// check whether we’re in the right namespace, the $revid has the correct type and is not empty
|
||||
// (which would mean that the current page doesn’t exist)
|
||||
$title = $skintemplate->getTitle();
|
||||
if ( $title->isContentPage() && $revid !== 0 && !empty( $revid ) )
|
||||
if ( $title->isContentPage() && $revid !== 0 && !empty( $revid ) ) {
|
||||
$nav_urls['citeThisPage'] = array(
|
||||
'args' => array( 'page' => $title->getPrefixedDBkey(), 'id' => $revid )
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ if ( function_exists( 'wfLoadExtension' ) ) {
|
|||
$wgMessagesDirs['CiteThisPage'] = __DIR__ . '/i18n';
|
||||
$wgExtensionMessagesFiles['CiteThisPageAliases'] = __DIR__ . '/CiteThisPage.alias.php';
|
||||
/* wfWarn(
|
||||
'Deprecated PHP entry point used for CiteThisPage extension. Please use wfLoadExtension instead, ' .
|
||||
'Deprecated PHP entry point used for CiteThisPage extension. ' .
|
||||
'Please use wfLoadExtension instead, ' .
|
||||
'see https://www.mediawiki.org/wiki/Extension_registration for more details.'
|
||||
); */
|
||||
return true;
|
||||
|
|
|
@ -113,11 +113,12 @@ class CiteThisPageOutput {
|
|||
|
||||
$msg = wfMessage( 'citethispage-content' )->inContentLanguage()->plain();
|
||||
if ( $msg == '' ) {
|
||||
# With MediaWiki 1.20 the plain text files were deleted and the text moved into SpecialCite.i18n.php
|
||||
# With MediaWiki 1.20 the plain text files were deleted
|
||||
# and the text moved into SpecialCite.i18n.php
|
||||
# This code is kept for b/c in case an installation has its own file "citethispage-content-xx"
|
||||
# for a previously not supported language.
|
||||
global $wgContLang, $wgContLanguageCode;
|
||||
$dir = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
|
||||
$dir = __DIR__ . DIRECTORY_SEPARATOR;
|
||||
$code = $wgContLang->lc( $wgContLanguageCode );
|
||||
if ( file_exists( "${dir}citethispage-content-$code" ) ) {
|
||||
$msg = file_get_contents( "${dir}citethispage-content-$code" );
|
||||
|
@ -125,7 +126,9 @@ class CiteThisPageOutput {
|
|||
$msg = file_get_contents( "${dir}citethispage-content" );
|
||||
}
|
||||
}
|
||||
$ret = $wgParser->parse( $msg, $this->mTitle, $this->mParserOptions, false, true, $this->getRevId() );
|
||||
$ret = $wgParser->parse(
|
||||
$msg, $this->mTitle, $this->mParserOptions, false, true, $this->getRevId()
|
||||
);
|
||||
$wgOut->addModuleStyles( 'ext.citeThisPage' );
|
||||
|
||||
# Introduced in 1.24
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
{
|
||||
"require-dev": {
|
||||
"jakub-onderka/php-parallel-lint": "0.9.2"
|
||||
"jakub-onderka/php-parallel-lint": "0.9.2",
|
||||
"mediawiki/mediawiki-codesniffer": "0.5.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": [
|
||||
"parallel-lint . --exclude node_modules --exclude vendor"
|
||||
"parallel-lint . --exclude node_modules --exclude vendor",
|
||||
"phpcs -p -s"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue