本文整理汇总了PHP中XString类的典型用法代码示例。如果您正苦于以下问题:PHP XString类的具体用法?PHP XString怎么用?PHP XString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatData
public function formatData()
{/*{{{*/
$item = "<item>\n";
$data = $this->data;
foreach($data as $key=>$value)
{
if ($key == 'diseasevotes')
{
$item .= "<diseasevotes>\n";
foreach ($value as $voteItems)
{
$item .= "<diseasevote>\n";
foreach ($voteItems as $voteKey => $voteValue)
{
$newkey = XString::convertToUnicode($voteKey);
$newvalue = XString::convertToUnicode($voteValue);
$item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
}
$item .= "</diseasevote>\n";
}
$item .= "</diseasevotes>\n";
}
else
{
$newkey = XString::convertToUnicode($key);
$newvalue = XString::convertToUnicode($value);
$item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
}
}
$item .= '</item>';
return $item;
}/*}}}*/
示例2: getRealData
private function getRealData(Hospital $hospital, $hospitalName = '')
{/*{{{*/
$res = array();
if ($hospitalName)
{
$hsName = $hospitalName;
}
else
{
$hsName = $hospital->name;
}
$hospitals['item']['key'] = $hsName;
$hospitals['item']['title'] = XString::truncate($hospital->commonName.'科室列表_门诊时间表_专家推荐_好大夫在线',59,'');
$hospitals['item']['level'] = $hospital->getGradeStr();//
$hospitals['item']['url'] = $hospital->getUrl();
$hospitals['item']['address'] = strip_tags($hospital->address);
$hospitals['item']['address_url'] = $hospital->getReMapUrl();
$hospitals['item']['description'] = strip_tags($hospital->intro);
$hospitals['item']['description_url'] = $hospital->getInfoUrl();
$hospitals['item']['luxian'] = $hospital->addressinfo;
$hospitals['item']['telephone'] = $hospital->phone;
$hospitals['item']['online_doctors'] = $hospital->spaceCount;
$hospitals['item']['online_doctors_url'] = $hospital->getDoctorUrl();
$hospitals['item']['tel_doctors'] = HospitalClient::getInstance()->getHospitalDirectCallCount($hospital->id);
$hospitals['item']['tel_doctors_url'] = $hospital->getTelDoctorUrl();
$hospitals['item']['showurl'] = 'www.haodf.com/';
$res[] = $hospitals;
BeanFinder::get('LocalCache')->removeAll();
return $res;
}/*}}}*/
示例3: getRealData
private function getRealData(Hospital $hospital, $hospitalName = '', $isPlus)
{/*{{{*/
$res = array();
if ($hospitalName)
{
$hsName = $hospitalName;
}
else
{
$hsName = $hospital->name;
}
$res['key'] = $hsName;
$res['url'] = $hospital->getUrl();
$res['title'] = XString::truncate($hsName.'科室列表_门诊时间表_专家推荐_好大夫在线', 58, '...');
$res['type'] = isset(self::$hospitalLevelList[$hospital->grade])?self::$hospitalLevelList[$hospital->grade]:'';
$res['address'] = XString::truncate($hospital->address, 65, '');
$res['mapUrl'] = $hospital->getReMapUrl();
$res['tel'] = XString::truncate($this->getPhoneStr($hospital->phone), 66, '...');
$res['zixunUrl'] = $hospital->getDoctorUrl();
$res['jiahaoUrl'] = $hospital->getJiaHaoUrl();
$res['doctorUrl'] = $hospital->getDiseaseUrl();
$res['keshiUrl'] = $hospital->getScheduleUrl();
$res['showUrl'] = 'www.haodf.com';
$res['infoUrl'] = $hospital->getInfoUrl();
$res['date'] = date('Y-m-d', time());
return $res;
}/*}}}*/
示例4: buildData
private function buildData($datas)
{/*{{{*/
$res = array();
if (false == $datas)
{
return $res;
}
foreach($datas as $hospital)
{
$intro = (empty($hospital->conclusion))?$hospital->intro:$hospital->conclusion;
$intro = XString::truncate(strip_tags($intro),500);
$hospitalFacultyInfo = $this->getHospitalFacultyForm($hospital->id);
$res[$hospital->id]['item'] = array(
'key' => $hospital->name,
'title' => $hospital->name,
'synonym' => $hospital->synonyms,
'url' => $hospital->getUrl(),
'grade' => $hospital->getGradeStr(),
'address' => $hospital->address,
'phone' => $hospital->phone,
'way' => XString::cntrim(strip_tags($hospital->addressInfo)),
'intro' => XString::cntrim(strip_tags($intro)),
'zixunInfo' => ($hospital->spaceCount)?"咨询".$hospital->spaceCount."位大夫":"",
'zixunInfoUrl' => ($hospital->spaceCount)?$hospital->getDoctorUrl():"",
'hospitalInfo' => "科室".$hospital->facultyCount."个, 大夫".$hospital->doctorCount."人",
'hospitalFacultyCnt' => $hospital->facultyCount,
'hospitalInfoUrl' => $hospital->getScheduleUrl(),
'hospitalFacultyInfo' => $hospitalFacultyInfo,
);
unset($hospital);
}
return $res;
}/*}}}*/
示例5: formatData
public function formatData()
{/*{{{*/
$item = "<display>\n";
$data = $this->data;
foreach($data as $key=>$value)
{
if($key == 'contents')
{
$contents = $data['contents'];
if(false == empty($contents))
{
foreach($contents as $content)
{
$newkey = XString::convertToUnicode($content['type']);
$newvalue = XString::convertToUnicode($content['content']);
$item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
unset($newkey, $newvalue, $content);
}
}
unset($contents);
}
else
{
$newkey = XString::convertToUnicode($key);
$newvalue = XString::convertToUnicode($value);
$item .= "<{$newkey}><![CDATA[{$newvalue}]]></{$newkey}>\n";
unset($newkey, $newvalue);
}
unset($key, $value);
}
$item .= '</display>';
unset($data);
return $item;
}/*}}}*/
示例6: getRealData
private function getRealData(Disease $disease, $diseaseName = '')
{/*{{{*/
$diseaseList = array();
$res = array();
if ($diseaseName)
{
$dName = $diseaseName;
}
else
{
$dName = $disease->name;
}
//为了Grave'S疾病"'"转义问题
$dName = preg_replace('/'/', "'", $dName);
$res['key'] = $dName;
$res['url'] = $disease->getUrl();
$res['title'] = XString::truncate($dName."症状_治疗_".$dName."好评专家_咨询_预约_好大夫在线", 56, '...');
$res['showUrl'] = 'www.haodf.com';
$res['pageSize'] = rand(58, 62).'K';
$res['date'] = date('Y-m-d', time());
$res['content'] = XString::truncate($dName.'好评专家'.$disease->goodVoteCount.'位,可咨询'.$dName.'问题,预约专家门诊,权威专家亲自介绍'.$dName.'病因,症状,治疗,如何护理'.$dName.'患者等.', 156, '...');
$diseaseList['item'] = $res;
return $diseaseList;
}/*}}}*/
示例7: getData
protected function getData($nowPage, $pageSize)
{/*{{{*/
$dataList = $this->prepareData($nowPage, $pageSize);
$res = array();
foreach ($dataList as $data)
{
$tempData = array();
$tempData['item']['key'] = $data['dname'].'医院';
$tempData['item']['url'] = 'http://haoping.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm';
$tempData['item']['showUrl'] = XString::truncate('haoping.haodf.com/jibing/'.$data['dkey'].'/yiyuan.htm', 38, '...');
$tempData['item']['title'] = $data['dname']."推荐医院_好大夫在线";
$tempData['item']['pageSize'] = rand(58, 62).'K';
$tempData['item']['date'] = date('Y-m-d', time());
$tempData['item']['content'] = "各地".$data['dname']."医院就医指南";
foreach ($data['formdata'] as $key => $form)
{
$data['formdata'][$key]['form']['diseaseHospitalUrl'] = 'http://haoping.haodf.com/hospital/'.Codec::getInstance()->encodeId($form['form']['hid']).'/'.$data['dkey'].'.htm';
unset($form);
}
$tempData['item'] = $tempData['item'] + $data['formdata'];
$res[] = $tempData;
unset($data);
}
return $res;
}/*}}}*/
示例8: filterContent
private function filterContent($content)
{/*{{{*/
$content = trim(strip_tags($content));
$content = str_replace('&nbsp;', '', $content);
$content = str_replace(' ', '', $content);
return XString::truncate($content, 500, '...');
}/*}}}*/
示例9: detail
public function detail($request, $response)
{/*{{{*/
$articleId = intval($request->getRequest('article_id', 0));
$article = DAL::get()->find('article', $articleId);
if($article->isNull())
{
$this->_exit404();
}
DBC::requireFalse($article->isDelete(), "文章已经被删除了!");
DBC::requireFalse($article->isShield(), "文章正在审核中!");
if ($article->isAuditing())
{
$result = $this->filterArticle($article);
if (false == empty($result['title']) || false == empty($result['content']))
{
DBC::requireFalse(true, "文章正在审核中!");
}
}
$isShare = $request->getRequest('isShare', '');
//分享文章阅读量统计
if(false == empty($isShare))
{
HitClient::getInstance()->increaseArticleHitsForShare($article->id);
}
$response->article = $article;
$response->topTitle = XString::truncate($article->title, 18);
$response->title = $article->title."_好大夫在线";
$articleAttachmentRef = new NullEntity();
if ($article->hasDocAttachment())
{
$articleAttachmentRef = ArticleClient::getInstance()->getValidAttachmentRef($article->id);
}
$response->articleAttachmentRef = $articleAttachmentRef;
}/*}}}*/
示例10: postTopic
public function postTopic($request, $response)
{
$groupIds = $request->groupIds;
if(!$groupIds)
{
$response->message = '没有选择话题所在的组!';
MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
return false;
}
$title = $request->title;
$content = preg_replace("/<\/?a[^>]*>/i", "", $request->content);
if(XString::cntrim($title) == '' || XString::cntrim($content) == '')
{
$response->message = '话题标题和内容都不能为空!';
MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/post', array('delay' => 6, 'button' => 'back'));
return false;
}
$groups = DAL::get()->find('regroup', $groupIds);
foreach($groups as $group)
{
if($group->reboard->isNull() == false)
{
$member = ForumClient::getInstance()->getMemberByUserIdAndGroupId($this->user->id, $group->id);
if($member->isNull() == false && $member->isForbiddened())
{
$response->message = '您的发言没有成功,可能是已被禁止发言!服务电话:'.HdfPhoneNumber::PHONE_FENZHEN;
MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
return false;
}
ResidentEvilClient::getInstance()->createTopic($group->space, $group->reboard, $this->user, $title, $content);
}
}
$response->message = '话题发表成功!';
MsgHtml::msg($response->message, 'http://'.URL_PREFIX.'passport.haodf.com/mypatient/index', array('delay' => 6, 'button' => 'back'));
}
示例11: getData
protected function getData($nowPage, $pageSize)
{/*{{{*/
$hospitalList = DAL::get()->find_all_AllHospital4Sc('hospital', $nowPage, $pageSize);
$doctorDescription = array();
foreach($hospitalList as $hospital)
{
$doctorList = DAL::get()->find_all_by_hospitalid('doctor', $hospital->id);
foreach($doctorList as $doctor)
{
$tempIntroArray = array();
$tempIntroArray['key'] = $hospital->commonName.$doctor->name;
$tempIntroArray['city'] = $hospital->city;
$tempIntroArray['doctor_name'] = $doctor->name;
$tempIntroArray['doctor_pic'] = '';
$tempIntroArray['doctor_link'] = $doctor->getTouchUrl();
$tempIntroArray['hospital'] = $hospital->name;
$tempIntroArray['department'] = $doctor->getHospitalFacultyName();
$tempIntroArray['doctor_title'] = $doctor->grade." ".$doctor->educateGrade;
$tempIntroArray['good_at'] = trim(XString::truncate($doctor->specialize, 200));
$doctorIntro = trim(XString::truncate(strip_tags($doctor->intro), 200));
$tempIntroArray['personal_details'] = $doctorIntro;
$tempIntroArray['personal_details_link'] = $doctor->getTouchIntroUrl();
$tempIntroArray['site_name'] = '好大夫在线';
$doctorDescription[] = array('item' => $tempIntroArray);
unset($doctor);
}
unset($doctorList);
unset($hospital);
BeanFinder::get('LocalCache')->removeAll();
}
unset($hospitalList);
BeanFinder::get('LocalCache')->removeAll();
return $doctorDescription;
}/*}}}*/
示例12: getServiceOrderList
private function getServiceOrderList($userId, $pageId, $pageSize)
{/*{{{*/
$serviceOrderList = DAL::get()->find_all_charge_orders('serviceorder', $userId, ServiceDef::TYPE_FLOW);
foreach ($serviceOrderList as $key => $serviceOrder)
{
$flow = $serviceOrder->source;
if (false == $flow instanceof DoctorPatientRef || $flow->space->isNull())
{
unset($serviceOrderList[$key]);
continue;
}
if ($serviceOrder->isUnpaid() && $flow->hasSpaceLeftAllowCnt())
{
unset($serviceOrderList[$key]);
}
}
XString::sortArray($serviceOrderList, 'ctime');
$showList = array_slice($serviceOrderList, ($pageId-1)*$pageSize, $pageSize);
$pageInfo['pages'] = ceil(count($serviceOrderList)/ $pageSize);
$pageInfo['pagesize'] = $pageSize;
$pageInfo['nowpage'] = $pageId;
$pageInfo['total'] = count($serviceOrderList);
return array('list' => $showList, 'pageInfo' => $pageInfo);
}/*}}}*/
示例13: getRealData
private function getRealData(Hospital $hospital, $hospitalName = '')
{/*{{{*/
$res = array();
$hospitalList = array();
if ($hospitalName)
{
$hsName = $hospitalName;
}
else
{
$hsName = $hospital->name;
}
$res['key'] = $hsName;
$res['url'] = $hospital->getUrl();
$res['title'] = XString::truncate($hsName.'科室列表,门诊时间,专家推荐_好大夫在线', 59, '...');
$res['showUrl'] = 'www.haodf.com';
$res['pageSize'] = rand(60, 66).'K';
$res['date'] = date('Y-m-d', time());
$extContent = ($hospital->spaceCount > 0) ? ",以及".$hospital->spaceCount."位医生提供免费网上咨询":"";
$res['content'] = "提供医院简介、地址、预约挂号电话、科室门诊时间,包括".$hsName.$hospital->facultyCount."个科室、".$hospital->doctorCount."位医生的相关介绍".$extContent;
$hospitalList['item'] = $res;
BeanFinder::get('LocalCache')->removeAll();
return $hospitalList;
}/*}}}*/
示例14: before
public function before($context)
{
$userId = $context->request->userId;
$user = DAL::get()->find('user', $userId);
$action = strtolower($context->request->action);
$os = $context->request->os;
$ver = $context->request->v;
if(false !== strpos($action, 'doctoruser') || false !== strpos($action, 'main') || $context->request->xdoc || false !== strpos($action, 'flowref_uploadsound'))
{
}
else
{
if ($user->isNull() || $user->getCertificateForMobile() != $context->request->certificateToken)
{
$this->echoErrorCode();
}
if($user->hasSpace())
{
$space = $user->getSpace();
if($user->name != 'malijuanmlj' && $space->host instanceof Doctor && $space->host->hospitalfaculty->hospital->isInnerTestHospital() && false == RequestDelegate::isOfficeIp())
{
$this->echoErrorCode();
}
}
//绑定设备验证
if ($os == 'ios' && $ver >= '3.0.3' || $os == 'android' && $ver >= '3.0.8')
{
$deviceToken = $os == 'ios' ? $context->request->deviceOpenUDID : $context->request->deviceToken;
$doctorUser = DAL::get()->find_by_userid_and_status('doctoruser', $userId, DoctorUser::STATUS_BIND, true);
if($doctorUser->isNull() == false && $doctorUser->deviceToken != $deviceToken && false == in_array($userId, DoctorUser::$doctorId4Test))
{
$msg = "您的账号于 ".date('H:m', strtotime($doctorUser->ctime))." 在一台 ".$doctorUser->deviceType." 手机登录。如非本人操作,则密码可能已泄露,建议重新登录修改密码或直接联系我们 ".HdfPhoneNumber::PHONE_DOCTORHELP." 修改密码";
$msg = XString::convertToUnicode($msg);
echo '{"errorCode":"888","msg":"'.$msg.'","content":[]}';
exit;
}
}
}
if (($os == 'ios' && $ver >= '3.0.1' || $os == 'android' && $ver >= '3.0.5') && $this->actionIsNotInActions($context->action))
{
if ($user->id == 0) return;//用户id是0 的过滤
$doctorOwner = DAL::get()->find_by_userid('DoctorOwner', $user->id);
if (false == $doctorOwner->isNull() && $doctorOwner->isPreDoctor())
{
$predoctor = $doctorOwner->source;
if ($predoctor->isRefused())
{
echo '{"errorCode":"8000","msg":"","content":[]}';
exit;
}
if ($predoctor->isAbnormal())
{
echo '{"errorCode":"8001","msg":"","content":[]}';
exit;
}
}
}
}
示例15: getDoctorArticleList
/**
* @brief 获取医生的文章列表
* @author
* @exampleUrl http://dev.mobile-api.haodf.com/patientapi/article_getDoctorArticleList?userId=581662815&pageId=1&pageSize=10
*
* @Param $doctorId 用户id
* @Param $pageSize 每页显示数
* @Param $nowPage 当前页码
*
* @Returns array('id', 'sn', 'price', 'statusDesc', 'flowId', 'spaceId', 'doctorName', 'hospitalName', 'hospitalFacultyName', 'alertMsg', 'needPay', 'caseType', 'doctorAssistant', 'doctorAssistantTel');
*/
public function getDoctorArticleList($userId, $doctorId, $pageSize = 10, $pageId = 1)
{/*{{{*/
$doctor = DAL::get()->find('doctor', $doctorId);
$user = DAL::get()->find('user', $userId);
if($userId != $this->currentUserId)
{
$this->setErrorCode(309);
return 0;
}
if ($user->isNull() || $user->id == 0)
{
$this->setErrorCode(107);
return 0;
}
if($doctor->isNull())
{
$this->setErrorCode(132);
return 0;
}
if ($doctor->space->isNull())
{
$this->setErrorCode(144);
return 0;
}
$res = ArticleClient::getInstance()->getList($doctor->space->id, '', $pageId, $pageSize, array('articleLevel' => Article::LEVEL_2, 'orderby' => 'topLevel desc, fld_ArticleCreateTime desc'));
$myDoctor = DAL::get()->find_by_userIdAndDoctorId('userdoctor', $userId, $doctor->id);
$results = array();
$articleIds = array();
foreach($res['articleList'] as $article)
{
$result = array();
$result['id'] = $article->id;
$result['title'] = $article->title;
$result['doctorName'] = $article->space->host->name." ".$article->space->host->hospitalfaculty->hospital->commonName;
$result['content'] = XString::truncate(str_replace(array("\n", "\t", "\r", " "), "", strip_tags(htmlspecialchars_decode($article->content))), 50);
$result['ctime'] = $article->ctime;
$result['hits'] = HitClient::getInstance()->getArticleHitsForMobile($article->id) + $article->hits;
$result['url'] = '';
$result['type'] = "article";
$result['isSelfOwner'] = 0;
$result['subscriptionId'] = $myDoctor->id;
$result['subscriptionType'] = 'userdoctor';
$articleIds[] = $article->id;
$results[$article->id] = $result;
}
$readStatus = SubscriptionClient::getInstance()->getUserSubscriptionReadStatus($userId, $articleIds);
foreach($readStatus as $contentId => $status)
{
$results[$contentId]['readStatus'] = $status;
}
$this->content = array_values($results);
$pageInfo['pages'] = $res['pageInfo']['pages'];
$pageInfo['pagesize'] = $pageSize;
$pageInfo['nowpage'] = $pageId;
$pageInfo['total'] = $res['pageInfo']['total'];
$this->pageInfo = $pageInfo;
}/*}}}*/