当前位置:文档之家› THINKSNS常用函数

THINKSNS常用函数

Thinksns常用函数一览表:以下是extend.php:*function get_client_ip(){}获取客户端IP地址*function msubstr($str,$start=0,$length,$charset="utf-8",$suffix=true)字符串截取,支持中文和其它编码*function mStr($str,$length,$charset="utf-8",$suffix=true)字符串截取,支持中文和其它编码*function rand_string($len=6,$type='',$addChars='')产生随机字串,可用来自动生成密码默认长度6位字母和数字混合*function build_verify($length=4,$mode=1)获取登录验证码默认为4位数字*function byte_format($size,$dec=2)字节格式化把字节数格式为B K M G T描述的大小*function is_utf8($string)检查字符串是否是UTF8编码*function highlight_code($str,$show=false)代码加亮*function h($text,$type,$tagsMethod=true,$attrMethod=true,$xssAuto=1,$tags=array(),$attr=array(),$tagsBlack=array(),$attrBlack=array())过滤得到安全的html//function h($text,$tags=null)输出安全的html//function text($text,$parseBr=false)输出纯文本function safe($text,$type='html',$tagsMethod=true,$attrMethod=true,$xssAuto= 1,$tags=array(),$attr=array(),$tagsBlack=array(),$attrBlack=array())*function t($text,$parse_br=false,$quote_style=ENT_NOQUOTES)转换为安全的纯文本//function unescape($str)解析jsescape//function ubb($Text)解析UBB//function build_count_rand($number,$length=4,$mode=1)随机生成一组字符串function remove_xss($val)*function list_to_tree($list,$pk='id',$pid='pid',$child='_child',$root=0)*function list_sort_by($list,$field,$sortby='asc')对查询结果集进行排序*function list_search($list,$condition)在数据列表中搜索//function send_http_status($status)发送Http状态信息//function send_http_header($type='utf8')发送常用http header信息//function imagecreatefrombmp($fname)bmp图像处理兼容函数//function imagebmp(&$im,$filename='',$bit=8,$compression=0)bmp图像处理兼容函数*function friendlyDate($sTime,$type='normal',$alt='false')友好的时间显示*function dateFormat($sTime,$format=null)时间显示//function getMid()获取当前登录用户的UID//function getUserName($uid,$lang='zh')获取用户姓名*function getUserAtString($uid,$type='uid')获取用户Gid[Mentor项目]//function getUserSpace($uid,$class,$target,$text,$icon=true)返回解析的空间地址//function getUserInfo($uid,$uname,$mid,$status=false)获取用户详细信息*function getFollowState($uid,$fid,$type=0)获取关注状态*function isfavorited($weibo_id,$uid,$weibo_id_array=null,$key='')检查给定用户是否收藏给定微博*function isBlackList($uid,$fid)是否为黑名单成员*function getUserFace($uid,$size)获取用户头像function getUserFace($uid,$size)//function convertUidToPath($uid)将用户ID转换为三级路径//function getUserGroupIcon($uid)获取给定用户的用户组图标function getSubBeKeyArray($origin,$key)*function getSubByKey($pArray,$pKey="",$pCondition="")去一个二维数组中的每个数组的固定的键知道的值来形成一个新的一维数组function getMultiArraySubByKey($pArray,$pKey="")*function arrayJoin($pArray1,$pArray2,$pFields,$pType="left")将两个二维数组根据指定的字段来连接起来,连接的方式类似sql查询中的连接*function canJoin($pRow1,$pRow2,$pFields)判断两个行是否满足连接条件*function sortByCol($array,$keyname,$dir=SORT_ASC)根据指定的键对数组排序*function sortByMultiCols($rowset,$args)将一个二维数组按照多个列进行排序,类似SQL语句中的ORDER BY*function getUserEmail($uid)获取给定用户的Email*function getSex($sexid)根据sexid获取性别function matchImages($content='')function matchReplaceImages($content='')function matchReplaceImagesOnce($matches)*function get_str_length($str,$filter=false)获取字符串的长度function getShort($str,$length=40,$ext='')//function infoCss($info)动态通知的评论两边的引号是否显示//function jiami($txt,$key=null)加密函数//function jiemi($txt,$key=null)解密函数*function escape($str)Format a mySQL string correctly for safe mySQL insert(no mater if magic quotes are on or not)*function convert_ip($ip)获取给定IP的物理地址*function convert_ip_tiny($ip,$ipdatafile)@see convert_ip()*function convert_ip_full($ip,$ipdatafile)@see convert_ip()*function desencrypt($input,$key)DES加密函数*function desdecrypt($encrypted,$key)DES解密函数*function pkcs5_pad($text,$blocksize)@see desencrypt()*function pkcs5_unpad($text)@see desdecrypt()*function isValidEmail($email)检查Email地址是否合法*function isEmailAvailable($email,$uid=false)检查Email是否可用*function getUids($content)获取给定字符串中被@用户的uid数组*function keyWordFilter($content)关键字过滤*function checkKeyWord($content)检测内容是否含有关键字*function format($content,$url=false)格式化微博,替换表情/@用户/话题*function group_weibo_format($content,$gid,$url=false)格式化群组微博,替换表情/@用户/话题*function group_themeformat($data)群组话题替换[格式化群组微博专用]*function formatComment($content,$url=false)格式化评论,替换表情和@用户*function themeformat($data)话题替换[格式化微博专用]*function replaceEmot($data)表情替换[格式化微博与格式化评论专用]*function getUserId($name)根据用户昵称获取用户ID[格式化微博与格式化评论专用]*function bindstate($uid,$type)获取用户的绑定状态*function getShortUrl($url)获取给定URL的短地址*function setOnline($uid)将给定用户设为在线*function getOnlineUserCount()获取当前在线用户数(有效期15分钟)*function canAccess()根据access.inc.php检查是否有权访问当前节点(APP_NAME/MODULE_NAME/ACTION_NAME)*function getAppAlias($appname)根据应用名获取应用别名*function stripslashes_deep($value)Navigates through an array and removes slashes from the values.*function object_to_array($var)通过循环遍历将对象转换为数组*function getLocation($province,$city)根据给定的省市的代码获取实际地址*function getFrom($type,$type_data)获取微博来源*function lockSubmit($life_time=30)锁定表单*function isSubmitLocked()检查表单是否已锁定*function unlockSubmit()表单解锁*function real_strip_tags($str,$allowable_tags)对strip_tags函数的扩展,可以过滤object,param,embed等来自编辑器的标签*function isMobile()检查是否是以手机浏览器进入(IN_MOBILE)function isiPhone()function isiPad()function isiOS()function isAndroid()*function getBrowser()获取用户浏览器型号。

相关主题