//Order Details Publicfunction Details () {$id= I ('get.id'); $comm= $ This-getinstance (); $res= $comm->select_view (1,0,'orders'); $res= $res ['List'][0]; $needRep=Array ('username','Address','Mobile','Expressno' ); foreach($res as$key =$row) { if(In_array ($key, $needRep)) {if($row) {$need= $ This->repstar ($row,"Utf-8"); $res [$key]=$need; } } } $ This->assign ('Data', $res); $ This-display (); } //Change the Stars . Privatefunction Repstar ($str, $encoding ="Utf-8") {$len=Mb_strlen ($str, $encoding); //determine if it is greater than 2$need =NULL; if(!$len) { return false; } if($len >1){ if($len%2!=0) {$len-=1; } $need= Mb_substr ($str,0, $len/2, $encoding); $star= $ This->getstar ($len/2+1); $need.=$star; }Else{$need="*"; } return$need; } //generate the required stars Privatefunction Getstar ($nun) {$reVal=NULL; if($nun) { for($i =0; $i < $nun; $i + +) {$reVal.="*"; } return$reVal; }Else{ return false; } }
PHP Replacement function