Index: trunk/extensions/Maps/includes/manipulations/Maps_ParamImageFull.php |
— | — | @@ -0,0 +1,41 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Parameter manipulation ensuring the value is an image url. |
| 6 | + * |
| 7 | + * @since 0.7.1 |
| 8 | + * |
| 9 | + * @file Maps_ParamImage.php |
| 10 | + * @ingroup Maps |
| 11 | + * @ingroup ParameterManipulations |
| 12 | + * |
| 13 | + * @author Jeroen De Dauw |
| 14 | + */ |
| 15 | +class MapsParamImageFull extends ItemParameterManipulation { |
| 16 | + |
| 17 | + /** |
| 18 | + * Constructor. |
| 19 | + * |
| 20 | + * @since 0.7 |
| 21 | + */ |
| 22 | + public function __construct() { |
| 23 | + parent::__construct(); |
| 24 | + } |
| 25 | + |
| 26 | + /** |
| 27 | + * @see ItemParameterManipulation::doManipulation |
| 28 | + * |
| 29 | + * @since 0.7 |
| 30 | + */ |
| 31 | + public function doManipulation( &$value, Parameter $parameter, array &$parameters ) { |
| 32 | + $image = $value; |
| 33 | + $title = Title::newFromText( $image, NS_FILE ); |
| 34 | + |
| 35 | + if ( !is_null( $title ) && $title->getNamespace() == NS_FILE && $title->exists() ) { |
| 36 | + $imagePage = new ImagePage( $title ); |
| 37 | + $image = $imagePage->getDisplayedFile()->getFullUrl(); |
| 38 | + } |
| 39 | + $value = $image; |
| 40 | + } |
| 41 | + |
| 42 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Maps/includes/manipulations/Maps_ParamImageFull.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 43 | + native |