From 2f23fbac16729329ca507f45e0afe613e195641f Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Sat, 6 Dec 2008 00:32:12 +0000 Subject: [PATCH] Fix up Configure extension logo setting handling: * Replace annoying button with an onblur preview and server-side conversion of file names into URLs. --- includes/AjaxFunctions.php | 15 +++++++++++++++ includes/DefaultSettings.php | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/includes/AjaxFunctions.php b/includes/AjaxFunctions.php index d18f7a975c..1a9adbcaa5 100644 --- a/includes/AjaxFunctions.php +++ b/includes/AjaxFunctions.php @@ -139,5 +139,20 @@ function wfAjaxGetThumbnailUrl( $file, $width, $height ) { $url = $file->getThumbnail( $width, $height )->url; + return $url; +} + +/** + * Called in some places (currently just extensions) + * to get the URL for a given file. + */ +function wfAjaxGetFileUrl( $file ) { + $file = wfFindFile( $file ); + + if ( !$file || !$file->exists() ) + return null; + + $url = $file->getUrl(); + return $url; } \ No newline at end of file diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 06035d4bac..4510a912d4 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -3328,7 +3328,7 @@ $wgUseAjax = true; * List of Ajax-callable functions. * Extensions acting as Ajax callbacks must register here */ -$wgAjaxExportList = array( 'wfAjaxGetThumbnailUrl' ); +$wgAjaxExportList = array( 'wfAjaxGetThumbnailUrl', 'wfAjaxGetFileUrl' ); /** * Enable watching/unwatching pages using AJAX. -- 2.20.1