root/branches/release-26/php/lib/function.mtasseturl.php @ 1174

Revision 1174, 0.7 kB (checked in by bchoate, 23 months ago)

Updated copyright year for source.

Line 
1<?php
2# Movable Type (r) Open Source (C) 2001-2008 Six Apart, Ltd.
3# This program is distributed under the terms of the
4# GNU General Public License, version 2.
5#
6# $Id$
7
8function smarty_function_mtasseturl($args, &$ctx) {
9    $asset = $ctx->stash('asset');
10    if (!$asset) return '';
11    $blog =& $ctx->stash('blog');
12
13    $url = $asset['asset_url'];
14
15    $site_url = $blog['blog_site_url'];
16    $site_url = preg_replace('/\/$/', '', $site_url);
17    $url = preg_replace('/^%r/', $site_url, $url);
18
19    $archive_url = $blog['blog_archive_url'];
20    if ($archive_url) {
21        $archive_url = preg_replace('/\/$/', '', $archive_url);
22        $url = preg_replace('/^%a/', $archive_url, $url);
23    }
24
25    return $url;
26}
27?>
28
Note: See TracBrowser for help on using the browser.