Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5
Source code for file /joomla/utilities/functions.php

Documentation is available at functions.php

  1. <?php
  2. /**
  3.  * @version        $Id: functions.php 6634 2007-02-15 18:27:18Z Jinx $
  4.  * @package        Joomla.Framework
  5.  * @subpackage    Utilities
  6.  * @copyright    Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
  7.  * @license        GNU/GPL, see LICENSE.php
  8.  *  Joomla! is free software. This version may have been modified pursuant to the
  9.  *  GNU General Public License, and as distributed it includes or is derivative
  10.  *  of works licensed under the GNU General Public License or other free or open
  11.  *  source software licenses. See COPYRIGHT.php for copyright notices and
  12.  *  details.
  13.  */
  14.  
  15. // Check to ensure this file is within the rest of the framework
  16. defined('JPATH_BASE') or die();
  17.  
  18. // Include library dependencies
  19. jimport('joomla.filter.input');
  20.  
  21. /**
  22. * Replaces &amp; with & for xhtml compliance
  23. *
  24. * Needed to handle unicode conflicts due to unicode conflicts
  25. *
  26. * @since 1.0
  27. */
  28. function ampReplace( $text ) {
  29.     $text = str_replace( '&&', '*--*', $text );
  30.     $text = str_replace( '&#', '*-*', $text );
  31.     $text = str_replace( '&amp;', '&', $text );
  32.     $text = preg_replace( '|&(?![\w]+;)|', '&amp;', $text );
  33.     $text = str_replace( '*-*', '&#', $text );
  34.     $text = str_replace( '*--*', '&&', $text );
  35.  
  36.     return $text;
  37. }
  38.  
  39. function mosTreeRecurse( $id, $indent, $list, &$children, $maxlevel=9999, $level=0, $type=1 ) {
  40.     if (@$children[$id] && $level <= $maxlevel) {
  41.         foreach ($children[$id] as $v) {
  42.             $id = $v->id;
  43.  
  44.             if ( $type ) {
  45.                 $pre     = '<sup>L</sup>&nbsp;';
  46.                 $spacer = '.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
  47.             } else {
  48.                 $pre     = '- ';
  49.                 $spacer = '&nbsp;&nbsp;';
  50.             }
  51.  
  52.             if ( $v->parent == 0 ) {
  53.                 $txt     = $v->name;
  54.             } else {
  55.                 $txt     = $pre . $v->name;
  56.             }
  57.             $pt = $v->parent;
  58.             $list[$id] = $v;
  59.             $list[$id]->treename = "$indent$txt";
  60.             $list[$id]->children = count( @$children[$id] );
  61.             $list = mosTreeRecurse( $id, $indent . $spacer, $list, $children, $maxlevel, $level+1, $type );
  62.         }
  63.     }
  64.     return $list;
  65. }
  66. ?>

Documentation generated on Mon, 05 Mar 2007 21:02:18 +0000 by phpDocumentor 1.3.1