openrat-cms

# OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

TextElement.class.php (1052B)


      1 <?php
      2 
      3 /**
      4  * @author $Author$
      5  * @version $Revision$
      6  * @package openrat.text
      7  */
      8 class TextElement extends AbstractElement
      9 {
     10 	var $text = '';
     11 	
     12 	function __construct( $t='' )
     13 	{
     14 		$this->text = $t;
     15 		
     16 		$this->parseStyleClass();
     17 		$this->parseTitleText();
     18 	}
     19 	
     20 	
     21 	function parseStyleClass()
     22 	{
     23 		$char1 = substr($this->text,0,1);
     24 		if	( $char1 == "(" )
     25 		{
     26 			$pos2 = strpos($this->text,")",2);
     27 			if	( $pos2 !== false )
     28 			{
     29 				$this->style = substr($this->text,1,$pos2-1);
     30 				$this->text  = substr($this->text,$pos2+1);
     31 
     32 				// Wenn kein Doppelpunkt in den Styleangaben vorkommt, dann
     33 				// handelt es sich um einen Klassennamen.				
     34 				if	( strpos($this->style,':') === false )
     35 				{
     36 					$this->class = $this->style;
     37 					$this->style = '';
     38 				}
     39 			}
     40 		}
     41 	}
     42 
     43 
     44 
     45 	function parseTitleText()
     46 	{
     47 		$char1 = substr($this->text,0,1);
     48 		if	( $char1 == "'" )
     49 		{
     50 			$pos2 = strpos($this->text,"'",2);
     51 			if	( $pos2 !== false )
     52 			{
     53 				$this->title = substr($this->text,1,$pos2-1);
     54 				$this->text  = substr($this->text,$pos2+1);
     55 			}
     56 		}
     57 	}
     58 
     59 	
     60 }
     61 
     62 ?>