forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCL_html.php
executable file
·65 lines (52 loc) · 1.73 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
<?
//************************************************************************
// Leonardo XC Server, http://www.leonardoxc.net
//
// 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;
$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.'/';
}
$imgStr="<img $strClass src='".$moduleRelPath."/img/$dir$imgName' $str>";
} else {
$imgName=str_replace("\/","-",$imgName);
$imgName=substr($imgName,0,-4);
$imgStr="<img class='$class sprite-$imgName ' src='".$moduleRelPath."/img/space.gif' $str>";
}
return $imgStr;
}
}
?>