1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php /** * @version $Id: mossef.php,v 1.4 2005/01/06 01:13:30 eddieajau Exp $ * @package Mambo * @copyright (C) 2000 - 2005 Miro International Pty Ltd * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL * Mambo is Free Software */
/** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
$_MAMBOTS->registerFunction( 'onPrepareContent', 'botMosSef' );
/** * Converting internal relative links to SEF URLs * * <b>Usage:</b> * <code><a href="...relative link..."></code> */ function botMosSef( $published, &$row, &$params, $page=0 ) { global $mosConfig_absolute_path, $mosConfig_live_site;
// define the regular expression for the bot $regex = "#href=\"(.*?)\"#s";
// perform the replacement $row->text = preg_replace_callback( $regex, 'botMosSef_replacer', $row->text );
return true; } /** * Replaces the matched tags * @param array An array of matches (see preg_match_all) * @return string */ function botMosSef_replacer( &$matches ) { if ( substr($matches[1],0,1)=="#" ) { // anchor $temp = split("index.php", $_SERVER['REQUEST_URI']); return "href=\"".sefRelToAbs("index.php".@$temp[1]).$matches[1]."\""; } else { return "href=\"".sefRelToAbs($matches[1])."\""; } } ?>
|