forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CL_html.php
86 lines (68 loc) · 2.37 KB
/
CL_html.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?
//************************************************************************
// Leonardo XC Server, https://github.com/leonardoxc/leonardoxc
//
// Copyright (c) 2004-2010 by Andreadakis Manolis
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// $Id: CL_html.php,v 1.5 2010/11/21 14:26:01 manolis Exp $
//
//************************************************************************
class leoHtml {
function html() {
}
function cutString($str,$len ) {
if (mb_strlen($str) <=$len ) return $str;
$str=strip_tags($str);
if (mb_strlen($str) <=$len ) return $str;
return mb_substr($str,0,$len)." ...";
}
function img($imgName,$width=0,$height=0,$align='',$title='',$class='',$id='',$type=1) {
global $CLIENT,$moduleRelPath;
//if ($CLIENT['browser'][0]=='MSIE') $type=0;
//$type=0;
global $OVERRIDE;
if (isset($OVERRIDE['imgtype'])){
$type=$OVERRIDE['imgtype'];
}
if (isset($OVERRIDE['fullurl'])){
$fullurl=$OVERRIDE['fullurl'];
}
$server_url='';
if ($fullurl) {
$server_url="http://".$_SERVER['SERVER_NAME'];
}
$str=" border='0' ";
if ($title) $str.=" title='$title' alt='$title' ";
if ($width) $str.=" width='$width' ";
if ($height) $str.=" height='$height' ";
if ($align) $str.=" align='$align' ";
if ($id) $str.=" id='$id' ";
if ($type==0) {
$dir='';
$strClass='';
if ($class) {
if (preg_match("/^(.+) (.+)$/",$class,$matches) ) {
$dir=$matches[1].'/';
$class=$matches[2];
$strClass=" class='$class' ";
} else $dir=$class.'/';
}
$imgUrl=$server_url.$moduleRelPath."/img/$dir$imgName";
// this is a bad hack for misconfigured dhv server
// has no impact on other servers
$imgUrl=str_replace("http://xc.dhv.de.//img","http://xc.dhv.de/xc/modules/leonardo/img",$imgUrl);
$imgUrl=str_replace("http://xc.dhv.de.//data","http://xc.dhv.de/xc/modules/leonardo/data",$imgUrl);
$imgStr="<img $strClass src='$imgUrl' $str>";
} else {
$imgName=str_replace("\/","-",$imgName);
$imgName=substr($imgName,0,-4);
$imgStr="<img class='$class sprite-$imgName' src='".$server_url.$moduleRelPath."/img/space.gif' $str>";
}
return $imgStr;
}
}
?>