|
|
<?php
|
|
|
// +----------------------------------------------------------------------
|
|
|
// | 徐州梦创信息科技有限公司—专业的游戏运营,推广解决方案.
|
|
|
// +----------------------------------------------------------------------
|
|
|
// | Copyright (c) 2013 http://www.vlcms.com All rights reserved.
|
|
|
// +----------------------------------------------------------------------
|
|
|
// | Author: kefu@vlcms.com QQ:97471547
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
/**
|
|
|
* 后台公共文件
|
|
|
* 主要定义后台公共函数库
|
|
|
*/
|
|
|
/**
|
|
|
* 隐藏超出文字
|
|
|
* @param string $str 要隐藏字符串
|
|
|
* @param integer $len 要限制的字符串长度
|
|
|
* @return string
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
function sl_wbnr($str='',$len=18) {
|
|
|
if(mb_strlen($str,'utf-8')>$len) {
|
|
|
return mb_substr($str,0,18,'utf-8') . '...';
|
|
|
} else {
|
|
|
return $str;
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 用零补足数据
|
|
|
* @param string $str 字符串
|
|
|
* @param integer $len 要限制的小数长度
|
|
|
* @return string
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
function add_zero_on_number($n='',$w=0) {
|
|
|
$val = set_zero_on_number($n,$w);
|
|
|
$arr = explode('.',$val);
|
|
|
if($arr[1]) {
|
|
|
if(strlen($arr[1].'')==$w) {return $val;}
|
|
|
else {
|
|
|
$len = $w-strlen($arr[1].'');
|
|
|
for($i=0;$i<$len;$i++) {
|
|
|
$val .= '0';
|
|
|
}
|
|
|
return $val;
|
|
|
}
|
|
|
} else {
|
|
|
return $val.'.00';
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 计算和
|
|
|
* @param string $a
|
|
|
* @param string $b
|
|
|
* @return string
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
function add_two_number($a,$b) {
|
|
|
return set_zero_on_number($a)+set_zero_on_number($b);
|
|
|
}
|
|
|
/**
|
|
|
* 空数据设置为0
|
|
|
* @param string $n 字符串
|
|
|
* @param integer $len 要限制的字符串长度
|
|
|
* @return string
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
function set_zero_on_number($n='',$w=0) {
|
|
|
if(empty($n)) {
|
|
|
if($w>0){round(floatval(0),$w);}else{return 0;}
|
|
|
} else {
|
|
|
if($w>0){round(floatval($n),$w);}else{return $n;}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 更改数据单位 鹿文学
|
|
|
function number_format_on_mobile($number) {
|
|
|
if(!is_numeric($number) || $number < 1) {return 0;}
|
|
|
|
|
|
$len = strlen($number.'');
|
|
|
switch($len) {
|
|
|
case 4:return intval($number/100)/10 . 'k';break;
|
|
|
case 5:return intval($number/1000) . 'k';break;
|
|
|
case 6:return intval($number/100000) . 'hk';break;
|
|
|
case 7:return intval($number/100000)/10 .'m';break;
|
|
|
default: return $number;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
//替换游戏名称
|
|
|
function substr_game_name($name) {
|
|
|
return '<span class="gamename">'.str_replace(array('(安','(苹'),array('</span><span class="gametype and">(安','</span><span class="gametype ios">(苹'),$name).'</span>';
|
|
|
}
|
|
|
|
|
|
/* 解析列表定义规则*/
|
|
|
|
|
|
function get_list_field($data, $grid,$model){
|
|
|
|
|
|
// 获取当前字段数据
|
|
|
foreach($grid['field'] as $field){
|
|
|
$array = explode('|',$field);
|
|
|
$temp = $data[$array[0]];
|
|
|
// 函数支持
|
|
|
if(isset($array[1])){
|
|
|
$temp = call_user_func($array[1], $temp);
|
|
|
}
|
|
|
$data2[$array[0]] = $temp;
|
|
|
}
|
|
|
if(!empty($grid['format'])){
|
|
|
$value = preg_replace_callback('/\[([a-z_]+)\]/', function($match) use($data2){return $data2[$match[1]];}, $grid['format']);
|
|
|
}else{
|
|
|
$value = implode(' ',$data2);
|
|
|
}
|
|
|
|
|
|
// 链接支持
|
|
|
if(!empty($grid['href'])){
|
|
|
$links = explode(',',$grid['href']);
|
|
|
foreach($links as $link){
|
|
|
$array = explode('|',$link);
|
|
|
$href = $array[0];
|
|
|
if(preg_match('/^\[([a-z_]+)\]$/',$href,$matches)){
|
|
|
$val[] = $data2[$matches[1]];
|
|
|
}else{
|
|
|
$show = isset($array[1])?$array[1]:$value;
|
|
|
// 替换系统特殊字符串
|
|
|
$href = str_replace(
|
|
|
array('[DELETE]','[EDIT]','[MODEL]'),
|
|
|
array('del?ids=[id]&model=[MODEL]','edit?id=[id]&model=[MODEL]',$model['id']),
|
|
|
$href);
|
|
|
|
|
|
// 替换数据变量
|
|
|
$href = preg_replace_callback('/\[([a-z_]+)\]/', function($match) use($data){return $data[$match[1]];}, $href);
|
|
|
|
|
|
$val[] = '<a href="'.U($href).'">'.$show.'</a>';
|
|
|
}
|
|
|
}
|
|
|
$value = implode(' ',$val);
|
|
|
}
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
// lwx 获取游戏开放类型名称
|
|
|
|
|
|
function get_open_type($type='') {
|
|
|
if (empty($type) || !is_numeric($type)) {return '不限';}
|
|
|
$cl = M("opentype","tab_")->where("status=1 and id=$type")->limit(1)->select();
|
|
|
return $cl[0]['open_name'];
|
|
|
}
|
|
|
|
|
|
// lwx 获取状态名
|
|
|
|
|
|
function get_recommend_status($type='') {
|
|
|
if (empty($type) || !is_numeric($type) ) {return '全部';}
|
|
|
switch($type) {
|
|
|
case 0: $text = "不推荐";break;
|
|
|
case 1: $text = "推荐";break;
|
|
|
case 2: $text = "热门";break;
|
|
|
case 3: $text = "最新";break;
|
|
|
default: $text = "全部";
|
|
|
}
|
|
|
return $text;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 获取模型名称
|
|
|
function get_model_by_id($id){
|
|
|
return $model = M('Model')->getFieldById($id,'title');
|
|
|
}
|
|
|
|
|
|
// 获取属性类型信息
|
|
|
function get_attribute_type($type=''){
|
|
|
// TODO 可以加入系统配置
|
|
|
static $_type = array(
|
|
|
'num' => array('数字','int(10) UNSIGNED NOT NULL'),
|
|
|
'string' => array('字符串','varchar(255) NOT NULL'),
|
|
|
'textarea' => array('文本框','text NOT NULL'),
|
|
|
'datetime' => array('时间','int(10) NOT NULL'),
|
|
|
'bool' => array('布尔','tinyint(2) NOT NULL'),
|
|
|
'select' => array('枚举','char(50) NOT NULL'),
|
|
|
'radio' => array('单选','char(10) NOT NULL'),
|
|
|
'checkbox' => array('多选','varchar(100) NOT NULL'),
|
|
|
'editor' => array('编辑器','text NOT NULL'),
|
|
|
'picture' => array('上传图片','int(10) UNSIGNED NOT NULL'),
|
|
|
'file' => array('上传附件','int(10) UNSIGNED NOT NULL'),
|
|
|
);
|
|
|
return $type?$_type[$type][0]:$_type;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取对应状态的文字信息
|
|
|
* @param int $status
|
|
|
* @return string 状态文字 ,false 未获取到
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_status_title($status = null){
|
|
|
if(!isset($status)){
|
|
|
return false;
|
|
|
}
|
|
|
switch ($status){
|
|
|
case -1 : return '已删除'; break;
|
|
|
case 0 : return '禁用'; break;
|
|
|
case 1 : return '正常'; break;
|
|
|
case 2 : return '待审核'; break;
|
|
|
default : return false; break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取数据的状态操作
|
|
|
function show_status_op($status) {
|
|
|
switch ($status){
|
|
|
case 0 : return '启用'; break;
|
|
|
case 1 : return '禁用'; break;
|
|
|
case 2 : return '审核'; break;
|
|
|
default : return false; break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取数据的状态操作
|
|
|
function show_applys_op($status) {
|
|
|
switch ($status){
|
|
|
case 1 : return '通过'; break;
|
|
|
case 2 : return '驳回'; break;
|
|
|
default : return '所有'; break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取数据的状态操作
|
|
|
function get_status_op($status) {
|
|
|
switch ($status){
|
|
|
case 0 : return '否'; break;
|
|
|
case 1 : return '是'; break;
|
|
|
default : return false; break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取数据的状态操作
|
|
|
function get_channel_op($status) {
|
|
|
switch ($status){
|
|
|
case 0 : return '没有'; break;
|
|
|
case 1 : return '一级公会'; break;
|
|
|
case 2 : return '二级公会'; break;
|
|
|
default : return false; break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 获取数据的状态操作
|
|
|
function get_promote_state($status) {
|
|
|
switch ($status){
|
|
|
case 0 : return '禁用'; break;
|
|
|
case 1 : return '启用'; break;
|
|
|
default : return false; break;
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
* 获取对应游戏类型的文字信息
|
|
|
*/
|
|
|
function get_game_types($type = null){
|
|
|
if(!isset($type)){
|
|
|
return false;
|
|
|
}
|
|
|
$map['status']=1;
|
|
|
$map['id']=$type;
|
|
|
$cl = M("game_type","tab_")->where($map)->find();
|
|
|
return $cl['type_name'];
|
|
|
}
|
|
|
/**
|
|
|
* 获取配置的类型
|
|
|
* @param string $type 配置类型
|
|
|
* @return string
|
|
|
*/
|
|
|
function get_config_type($type=0){
|
|
|
$list = C('CONFIG_TYPE_LIST');
|
|
|
return $list[$type];
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取配置的分组
|
|
|
* @param string $group 配置分组
|
|
|
* @return string
|
|
|
*/
|
|
|
function get_config_group($group=0){
|
|
|
$list = C('CONFIG_GROUP_LIST');
|
|
|
return $group?$list[$group]:'';
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* select返回的数组进行整数映射转换
|
|
|
*
|
|
|
* @param array $map 映射关系二维数组 array(
|
|
|
* '字段名1'=>array(映射关系数组),
|
|
|
* '字段名2'=>array(映射关系数组),
|
|
|
* ......
|
|
|
* )
|
|
|
* @author 朱亚杰 <zhuyajie@topthink.net>
|
|
|
* @return array
|
|
|
*
|
|
|
* array(
|
|
|
* array('id'=>1,'title'=>'标题','status'=>'1','status_text'=>'正常')
|
|
|
* ....
|
|
|
* )
|
|
|
*
|
|
|
*/
|
|
|
function int_to_string(&$data,$map=array('status'=>array(1=>'正常',-1=>'删除',0=>'禁用',2=>'未审核',3=>'草稿'))) {
|
|
|
if($data === false || $data === null ){
|
|
|
return $data;
|
|
|
}
|
|
|
$data = (array)$data;
|
|
|
foreach ($data as $key => $row){
|
|
|
foreach ($map as $col=>$pair){
|
|
|
if(isset($row[$col]) && isset($pair[$row[$col]])){
|
|
|
$data[$key][$col.'_text'] = $pair[$row[$col]];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 动态扩展左侧菜单,base.html里用到
|
|
|
* @author 朱亚杰 <zhuyajie@topthink.net>
|
|
|
*/
|
|
|
function extra_menu($extra_menu,&$base_menu){
|
|
|
foreach ($extra_menu as $key=>$group){
|
|
|
if( isset($base_menu['child'][$key]) ){
|
|
|
$base_menu['child'][$key] = array_merge( $base_menu['child'][$key], $group);
|
|
|
}else{
|
|
|
$base_menu['child'][$key] = $group;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取参数的所有父级分类
|
|
|
* @param int $cid 分类id
|
|
|
* @return array 参数分类和父类的信息集合
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_parent_category($cid){
|
|
|
if(empty($cid)){
|
|
|
return false;
|
|
|
}
|
|
|
$cates = M('Category')->where(array('status'=>1))->field('id,title,pid')->order('sort')->select();
|
|
|
$child = get_category($cid); //获取参数分类的信息
|
|
|
$pid = $child['pid'];
|
|
|
$temp = array();
|
|
|
$res[] = $child;
|
|
|
while(true){
|
|
|
foreach ($cates as $key=>$cate){
|
|
|
if($cate['id'] == $pid){
|
|
|
$pid = $cate['pid'];
|
|
|
array_unshift($res, $cate); //将父分类插入到数组第一个元素前
|
|
|
}
|
|
|
}
|
|
|
if($pid == 0){
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
return $res;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 检测验证码
|
|
|
* @param integer $id 验证码ID
|
|
|
* @return boolean 检测结果
|
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
|
*/
|
|
|
function check_verify($code, $id = 1){
|
|
|
$verify = new \Think\Verify();
|
|
|
return $verify->check($code, $id);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取当前分类的文档类型
|
|
|
* @param int $id
|
|
|
* @return array 文档类型数组
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_type_bycate($id = null){
|
|
|
if(empty($id)){
|
|
|
return false;
|
|
|
}
|
|
|
$type_list = C('DOCUMENT_MODEL_TYPE');
|
|
|
$model_type = M('Category')->getFieldById($id, 'type');
|
|
|
$model_type = explode(',', $model_type);
|
|
|
foreach ($type_list as $key=>$value){
|
|
|
if(!in_array($key, $model_type)){
|
|
|
unset($type_list[$key]);
|
|
|
}
|
|
|
}
|
|
|
return $type_list;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取当前文档的分类
|
|
|
* @param int $id
|
|
|
* @return array 文档类型数组
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_cate($cate_id = null){
|
|
|
if(empty($cate_id)){
|
|
|
return false;
|
|
|
}
|
|
|
$cate = M('Category')->where('id='.$cate_id)->getField('title');
|
|
|
return $cate;
|
|
|
}
|
|
|
|
|
|
// 分析枚举类型配置值 格式 a:名称1,b:名称2
|
|
|
function parse_config_attr($string) {
|
|
|
$array = preg_split('/[,;\r\n]+/', trim($string, ",;\r\n"));
|
|
|
if(strpos($string,':')){
|
|
|
$value = array();
|
|
|
foreach ($array as $val) {
|
|
|
list($k, $v) = explode(':', $val);
|
|
|
$value[$k] = $v;
|
|
|
}
|
|
|
}else{
|
|
|
$value = $array;
|
|
|
}
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
// 获取子文档数目
|
|
|
function get_subdocument_count($id=0){
|
|
|
return M('Document')->where('pid='.$id)->count();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 分析枚举类型字段值 格式 a:名称1,b:名称2
|
|
|
// 暂时和 parse_config_attr功能相同
|
|
|
// 但请不要互相使用,后期会调整
|
|
|
function parse_field_attr($string) {
|
|
|
if(0 === strpos($string,':')){
|
|
|
// 采用函数定义
|
|
|
return eval(substr($string,1).';');
|
|
|
}
|
|
|
$array = preg_split('/[,;\r\n]+/', trim($string, ",;\r\n"));
|
|
|
if(strpos($string,':')){
|
|
|
$value = array();
|
|
|
foreach ($array as $val) {
|
|
|
list($k, $v) = explode(':', $val);
|
|
|
$value[$k] = $v;
|
|
|
}
|
|
|
}else{
|
|
|
$value = $array;
|
|
|
}
|
|
|
return $value;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取行为数据
|
|
|
* @param string $id 行为id
|
|
|
* @param string $field 需要获取的字段
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_action($id = null, $field = null){
|
|
|
if(empty($id) && !is_numeric($id)){
|
|
|
return false;
|
|
|
}
|
|
|
$list = S('action_list');
|
|
|
if(empty($list[$id])){
|
|
|
$map = array('status'=>array('gt', -1), 'id'=>$id);
|
|
|
$list[$id] = M('Action')->where($map)->field(true)->find();
|
|
|
}
|
|
|
return empty($field) ? $list[$id] : $list[$id][$field];
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据条件字段获取数据
|
|
|
* @param mixed $value 条件,可用常量或者数组
|
|
|
* @param string $condition 条件字段
|
|
|
* @param string $field 需要返回的字段,不传则返回整个数据
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_document_field($value = null, $condition = 'id', $field = null){
|
|
|
if(empty($value)){
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
//拼接参数
|
|
|
$map[$condition] = $value;
|
|
|
$info = M('Model')->where($map);
|
|
|
if(empty($field)){
|
|
|
$info = $info->field(true)->find();
|
|
|
}else{
|
|
|
$info = $info->getField($field);
|
|
|
}
|
|
|
return $info;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取行为类型
|
|
|
* @param intger $type 类型
|
|
|
* @param bool $all 是否返回全部类型
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
*/
|
|
|
function get_action_type($type, $all = false){
|
|
|
$list = array(
|
|
|
1=>'系统',
|
|
|
2=>'用户',
|
|
|
);
|
|
|
if($all){
|
|
|
return $list;
|
|
|
}
|
|
|
return $list[$type];
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 邮件发送函数
|
|
|
*/
|
|
|
function sendMail($to, $title, $content) {
|
|
|
|
|
|
Vendor('PHPMailer.PHPMailerAutoload');
|
|
|
$mail = new PHPMailer(); //实例化
|
|
|
$mail->IsSMTP(); // 启用SMTP
|
|
|
$mail->Host=C('MAIL_HOST'); //smtp服务器的名称(这里以QQ邮箱为例)
|
|
|
$mail->SMTPAuth = C('MAIL_SMTPAUTH'); //启用smtp认证
|
|
|
$mail->Username = C('MAIL_USERNAME'); //你的邮箱名
|
|
|
$mail->Password = C('MAIL_PASSWORD') ; //邮箱密码
|
|
|
$mail->From = C('MAIL_FROM'); //发件人地址(也就是你的邮箱地址)
|
|
|
$mail->FromName = C('MAIL_FROMNAME'); //发件人姓名
|
|
|
$mail->AddAddress($to,"尊敬的客户");
|
|
|
$mail->WordWrap = 50; //设置每行字符长度
|
|
|
$mail->IsHTML(C('MAIL_ISHTML')); // 是否HTML格式邮件
|
|
|
$mail->CharSet=C('MAIL_CHARSET'); //设置邮件编码
|
|
|
$mail->Subject =$title; //邮件主题
|
|
|
$mail->Body = $content; //邮件内容
|
|
|
$mail->AltBody = "这是一个纯文本的身体在非营利的HTML电子邮件客户端"; //邮件正文不支持HTML的备用显示
|
|
|
return($mail->Send());
|
|
|
}
|
|
|
|
|
|
//字符转数组
|
|
|
function get_screenshot($screenshot){
|
|
|
$array=explode(",", $screenshot);
|
|
|
return $array;
|
|
|
}
|
|
|
|
|
|
function get_img_url($cover_id){
|
|
|
if(empty($cover_id)){
|
|
|
return "";
|
|
|
}
|
|
|
$picture = M('Picture')->where(array('status'=>1))->getById($cover_id);
|
|
|
if (C('STORAGE_TYPE')) {
|
|
|
if(!empty($picture['oss_url'])){
|
|
|
return $picture['oss_url'];
|
|
|
}else{
|
|
|
return 'http://' . $_SERVER['HTTP_HOST'] . __ROOT__.$picture['path'];
|
|
|
}
|
|
|
}else{
|
|
|
return 'http://' . $_SERVER['HTTP_HOST'] .__ROOT__.$picture['path'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*根据用户名获取用户id
|
|
|
*/
|
|
|
/* function get_user_id($account){
|
|
|
$model = M("user",'tab_');
|
|
|
$map["account"] = $account;
|
|
|
$reg = $model->where($map)->find();
|
|
|
if($reg){
|
|
|
return $reg["id"];
|
|
|
}else{
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
} */
|
|
|
|
|
|
//获取游戏类型名称
|
|
|
function get_game_category_name($id){
|
|
|
$model = M('GameType','tab_');
|
|
|
$data = $model
|
|
|
->field("type_name")
|
|
|
->find($id);
|
|
|
if(empty($data['type_name'])){
|
|
|
return "";
|
|
|
}else{
|
|
|
return $data['type_name'];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* 获取手机系统类型 鹿文学 2017-11-21 */
|
|
|
function get_device_type() {
|
|
|
//全部变成小写字母
|
|
|
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
|
|
|
$type = 0;
|
|
|
//分别进行判断
|
|
|
if(strpos($agent, 'iphone') || strpos($agent, 'ipad')) {
|
|
|
$type = 2;
|
|
|
}
|
|
|
|
|
|
if(strpos($agent, 'android')) {
|
|
|
$type = 1;
|
|
|
}
|
|
|
return $type;
|
|
|
}
|
|
|
|
|
|
/*替换汉字*/
|
|
|
function substr_cut($user_name,$symbol="*"){
|
|
|
$strlen = mb_strlen($user_name, 'utf-8');
|
|
|
$firstStr = mb_substr($user_name, 0, 1, 'utf-8');
|
|
|
$lastStr = mb_substr($user_name, -1, 1, 'utf-8');
|
|
|
return $strlen == 2 ? $firstStr . str_repeat('*', mb_strlen($user_name, 'utf-8') - 1) : $firstStr . str_repeat($symbol, $strlen - 2) . $lastStr;
|
|
|
} |