PHP Classes

File: htdocs/class/smarty3_plugins/compiler.xoAppUrl.php

Recommend this page to a friend!
  Packages of Michael Beck   Xoops 2.5   htdocs/class/smarty3_plugins/compiler.xoAppUrl.php   Download  
File: htdocs/class/smarty3_plugins/compiler.xoAppUrl.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Xoops 2.5
Modular content management publication system
Author: By
Last change:
Date: 2 months ago
Size: 1,235 bytes
 

Contents

Class file image Download
<?php
/**
 * xoAppUrl Smarty compiler plug-in
 *
 * See the enclosed file LICENSE for licensing information. If you did not
 * receive this file, get it at http://www.gnu.org/licenses/gpl-2.0.html
 *
 * @copyright (c) 2000-2025 XOOPS Project (https://xoops.org)
 * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
 * @author Skalpa Keo <skalpa@xoops.org>
 * @package xos_opal
 * @subpackage xos_opal_Smarty
 * @since 2.0.14
 */

/**
 * Build application relative URL
 *
 * This plug-in allows you to generate a module location URL. It uses any URL rewriting
 * mechanism and rules you'll have configured for the system.
 *
 * // Generate a URL using a physical path
 * <{xoAppUrl 'modules/something/yourpage.php'}>
 *
 * The path should be in a form understood by Xoops::url()
 *
 * @param string[] $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_compiler_xoAppUrl($params, Smarty $smarty)
{
    global
$xoops;
   
$arg = reset($params);
   
$url = trim($arg, " '\"\t\n\r\0\x0B");

    if (
strpos($url, '/') === 0) {
       
$url = 'www' . $url;
    }
    return
"<?php echo '" . addslashes(htmlspecialchars($xoops->url($url), ENT_QUOTES | ENT_HTML5)) . "'; ?>";
}