File modules/wikiparser/model/HeadlineElement.class.php
Last commit: Sat Feb 22 22:45:05 2020 +0100 Jan Dankert Refactoring: Enable Autoloading, Fix namespace structure.
1 <?php 2 3 namespace wikiparser\model; 4 5 use wikiparser\model\AbstractElement; 6 7 /** 8 * @author $Author$ 9 * @version $Revision$ 10 * @package openrat.text 11 */ 12 class HeadlineElement extends AbstractElement 13 { 14 var $level = 1; 15 16 17 /** 18 * Konstruktor. 19 */ 20 function __construct($level = 1) 21 { 22 $this->level = $level; 23 } 24 25 26 function getText() 27 { 28 $name = ''; 29 foreach ($this->children as $child) { 30 if (strtolower(get_class($child)) == 'textelement') { 31 $name .= $child->text; 32 } 33 } 34 35 return $name; 36 } 37 38 39 function getName() 40 { 41 $name = strtolower($this->getText()); 42 43 // return urlencode( $name ); 44 $gueltig = 'abcdefghijklmnopqrstuvwxyz0123456789.-_'; 45 $tmp = strtr($name, $gueltig, str_repeat('#', strlen($gueltig))); 46 $name = str_replace('.', '', strtr($name, $tmp, str_repeat('.', strlen($tmp)))); 47 48 return $name; 49 } 50 } 51 52 ?>
Downloadmodules/wikiparser/model/HeadlineElement.class.php
History Sat, 22 Feb 2020 22:45:05 +0100 Jan Dankert Refactoring: Enable Autoloading, Fix namespace structure.