1: <?php
2: /**
3: * xoImgUrl Smarty compiler plug-in
4: *
5: * See the enclosed file LICENSE for licensing information.
6: * If you did not receive this file, get it at http://www.gnu.org/licenses/gpl-2.0.html
7: *
8: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
9: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
10: * @author Skalpa Keo <skalpa@xoops.org>
11: * @package xos_opal
12: * @subpackage xos_opal_Smarty
13: * @since 2.0.14
14: */
15:
16: /**
17: * Inserts the URL of a file resource customizable by themes
18: *
19: * This plug-in works like the {@link smarty_compiler_xoAppUrl() xoAppUrl} plug-in,
20: * except that it is intended to generate the URL of resource files customizable by
21: * themes.
22: *
23: * Here the current theme is asked to check if a custom version of the requested file exists, and
24: * if one is found its URL is returned. Otherwise, the request will be passed to the
25: * theme parents one by one. Ultimately, if no custom version has been found, the resource
26: * default URL location will be returned.
27: *
28: * <b>Note:</b> the themes inheritance system can generate many filesystem accesses depending
29: * on your themes configuration. Because of this, the use of the dynamic syntax with this plug-in
30: * is not possible right now.
31: * @param $argStr
32: * @param $smarty
33: * @return string
34: */
35:
36: function smarty_compiler_xoImgUrl($argStr, &$smarty)
37: {
38: global $xoops, $xoTheme;
39: $path = (isset($xoTheme) && is_object($xoTheme)) ? $xoTheme->resourcePath($argStr) : $argStr;
40:
41: return "\necho '" . addslashes($xoops->url($path)) . "';";
42: }
43: