mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-18 09:10:59 +00:00
70c116a17a
There's no product need for anything other than an upper limit on edit count. If one arises in the future we can adjust accordingly, but better to keep the JSON, and any UI implementation, simple for now. Change-Id: I892847ad78b19695f0f0f664002d3c566f7806de
38 lines
1,013 B
PHP
38 lines
1,013 B
PHP
<?php
|
|
/**
|
|
* Utilities for ResourceLoader modules used by EditCheck.
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace MediaWiki\Extension\VisualEditor\EditCheck;
|
|
|
|
use MessageLocalizer;
|
|
|
|
class ResourceLoaderData {
|
|
protected static array $defaults = [
|
|
'addReference' => [
|
|
'minimumCharacters' => 50,
|
|
'beforePunctuation' => false,
|
|
// TODO: when we have multiple edit checks this will likely be a generic block:
|
|
// account: loggedin, loggedout, anything non-truthy means allow either
|
|
'account' => false,
|
|
'maximumEditcount' => 100
|
|
],
|
|
];
|
|
|
|
/**
|
|
* Return configuration data for edit checks, fetched from an on-wiki JSON message
|
|
*
|
|
* @param MessageLocalizer $context
|
|
* @return array Configuration data for edit checks
|
|
*/
|
|
public static function getConfig( MessageLocalizer $context ) {
|
|
$raw_config = json_decode( $context->msg( 'editcheck-config.json' )->inContentLanguage()->plain(), true );
|
|
|
|
return array_replace_recursive( self::$defaults, $raw_config ?? [] );
|
|
}
|
|
}
|