1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8namespace Search\Federated; 9 10class UrlPrefixTransform 11{ 12 private $prefix; 13 14 function __construct($prefix) 15 { 16 $this->prefix = rtrim($prefix, '/'); 17 } 18 19 function __invoke($entry) 20 { 21 if (isset($entry['url'])) { 22 $entry['url'] = $this->prefix . '/' . ltrim($entry['url'], '/'); 23 $entry['_external'] = true; 24 } 25 26 return $entry; 27 } 28} 29