Manual:Hooks/IsUploadAllowedFromUrl

From Linux Web Expert

IsUploadAllowedFromUrl
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 65102)</tvar></translate>
Allows overriding the result of UploadFromUrl::isAllowedUrl()
<translate> Define function:</translate>
public static function onIsUploadAllowedFromUrl( string $url, bool &$allowed ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"IsUploadAllowedFromUrl": "MediaWiki\\Extension\\MyExtension\\Hooks::onIsUploadAllowedFromUrl"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> upload/UploadFromUrl.php
<translate> Function(s):</translate> isAllowedUrl
<translate> Interface:</translate> IsUploadAllowedFromUrlHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:IsUploadAllowedFromUrl extensions</tvar>.</translate>


Details

  • $url: URL used to upload from
  • &$allowed: Boolean indicating if uploading is allowed for given URL