<?php
 class htmlField extends baseField { var $Conf = array( 'xtype' => 'xhtmleditor', 'setAutoSize' => true, 'inlineEdit' => true, 'height' => '250', 'width' => '100%', 'icon' => 'table_edit.png', ); function edit($addConf,$R) { $toChange[''] = ''; if($toChange) { $R['value'] = strtr($R['value'],$toChange); } if($this->Mizu->Conf['plugins']['changeHtmlFieldUrls']) { $R['value'] = $this->Mizu->parseHtmlTextField($R['value']); } if($this->Mizu->Conf['htmlEditor']) { $this->Conf['xtype'] = $this->Mizu->Conf['htmlEditor']; } return parent::edit($addConf,$R); } function getSetValue($v) { preg_match_all('!(href|src)="(.*)"!imsU',stripslashes($v),$M); $mail = 'mailto:'; $baseH = $this->Mizu->_Url->BaseHref; $act = true; $act = false; if($this->Mizu->Conf['plugins']['changeHtmlFieldUrls']) { $act = true; } if($M[2] AND $act) { foreach($M[2] as $i => $url) { if($url[0]=='{' OR substr($url,0,strlen($mail))==$mail) continue; if(substr($url,0,strlen($baseH))!=$baseH) continue; $opt = array(); $opt['orgUrl'] = $url; if(strpos($url,'?')) { $opt['urlEnd'] = strpos($url,'?'); } else if(strpos($url,'#')) { $opt['urlEnd'] = strpos($url,'#'); } if($opt['urlEnd']) { $opt['addExt'] = substr($url,$opt['urlEnd']); $url = substr($url,0,$opt['urlEnd']); } $url = substr($url,strlen($this->Mizu->_Url->BaseHref)); $R = $this->Mizu->_Url->decodeUrl(false,$url); if(is_numeric($R['id']) AND $R['id']) { $toChange[$opt['orgUrl']] = '{getUrl:'.$R['id'].':'.$R['L'].'}'; } if(!$toChange[$opt['orgUrl']]) { $toChange[$opt['orgUrl']] = substr($opt['orgUrl'],strlen($baseH)); } if($opt['addExt']) { $toChange[$opt['orgUrl']].=$opt['addExt']; } } } $toChange[''] = ''; if($toChange) { $v = strtr($v,$toChange); } return $v; } } ?>