本文整理汇总了PHP中XString::truncate方法的典型用法代码示例。如果您正苦于以下问题:PHP XString::truncate方法的具体用法?PHP XString::truncate怎么用?PHP XString::truncate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XString
的用法示例。
在下文中一共展示了XString::truncate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}/*}}}*/
示例2: 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;
}/*}}}*/
示例3: 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;
}/*}}}*/
示例4: 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;
}/*}}}*/
示例5: 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;
}/*}}}*/
示例6: updateBaseInfo
public function updateBaseInfo($request, $response)
{
$vars = $request->var;
if ($request->is_ajax) {
$vars = XString::toGbkDeep($vars);
}
if (!empty($vars['birthday']))
$vars['birthday'] = XDateTime::valueOf($vars['birthday']);
DoctorClient::getInstance()->modifyByDoctor($this->_newSpace->host->id, $vars);
//调用同步新浪微博接口(更新医生个人信息和修改医生资料)
//MessageQueueClient::getInstance()->regEvent(new UpdateDoctorInformationSinaWeiboEvent($this->_newSpace->user->id));
if ($request->is_ajax)
{
$results = array(
'grade' => XString::convertToUnicode($this->_newSpace->host->grade),
'educate_grade' => XString::convertToUnicode($this->_newSpace->host->educateGrade),
'specialize' => XString::convertToUnicode($this->_newSpace->host->specialize),
'intro' => XString::convertToUnicode(XString::truncate($this->_newSpace->host->intro, 100)),
'status' => 0,
);
echo json_encode($results);
exit;
}
$this->message('您的医生资料提交成功!将在1个工作日内审核后生效!', $response, array(
'buttons' => array(
array('text' => '继续修改', 'url' => $this->_newSpace->getUrl()."admindoctor/showbaseinfo"),
array('text' => '进入个人网站', 'url' => $this->_newSpace->getUrl())
),
));
}
示例7: filterContent
private function filterContent($content)
{/*{{{*/
$content = trim(strip_tags($content));
$content = str_replace(' ', '', $content);
$content = str_replace(' ', '', $content);
return XString::truncate($content, 500, '...');
}/*}}}*/
示例8: 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;
}/*}}}*/
示例9: 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;
}/*}}}*/
示例10: 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;
}/*}}}*/
示例11: 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;
}/*}}}*/
示例12: ajaxPostDoctorInfo
public function ajaxPostDoctorInfo($request, $response)
{
/*{{{*/
$vars = $request->getRequest('var', array());
if (count($vars) > 0) {
$vars = XString::toGbkDeep($vars);
if ($vars['birthday']) {
$vars['birthday'] = XDateTime::valueOf($vars['birthday']);
}
DoctorClient::getInstance()->modifyByDoctor($this->space->host->id, $vars);
$results = array('res' => 'success', 'specialize' => XString::convertToUnicode($vars['specialize']), 'intro' => XString::convertToUnicode(XString::truncate($vars['intro'], 100)));
echo json_encode($results);
} else {
echo '{"res":"failure", "msg":"请填写完整您的个人信息"}';
}
return self::DIRECT_OUTPUT;
}
示例13: getDoctorComment
private function getDoctorComment($doctor)
{/*{{{*/
$cureExp = DAL::get()->find_all_Doctor2Comments('cureexp', $doctor->id);
foreach($cureExp as $key => $cure)
{
if($cure->isNull())
{
unset($cureExp[$key]);
}
}
$thankLetter = array();
if(count($cureExp) < 2)
{
$thankLetter = DAL::get()->find_all_Doctor2Comments('curethankletter', $doctor->id);
foreach($thankLetter as $key => $letter)
{
if($letter->isNull())
{
unset($thankLetter[$key]);
}
}
}
$sum = count($cureExp) + count($thankLetter);
$res = array();
if($sum == 0)
{
return false;
}
else
{
foreach ($cureExp as $key => $comment)
{
$content = trim(XString::truncate(strip_tags($comment->content), 200));
$res[$key]['comment']['content'] = mb_substr($content, 5 , 200,'gbk');
$res[$key]['comment']['diseaseName'] = $comment->disease->name?$comment->disease->name:'';
}
foreach($thankLetter as $key => $comment)
{
$content = trim(XString::truncate(strip_tags($comment->content), 200));
$res[$key]['comment']['content'] = $content;
$res[$key]['comment']['diseaseName'] = $comment->disease->name?$comment->disease->name:'';
}
}
return $res;
}/*}}}*/
示例14: getRealData
private function getRealData($thankLetter)
{/*{{{*/
$res = array();
$res['id'] = $thankLetter->id;
$res['doctorId'] = Codec::getInstance()->encodeId($thankLetter->doctorId);
if (false == $thankLetter->doctor->isNull())
{
$res['doctorName'] = $thankLetter->doctor->name;
}
if (false == $thankLetter->doctor->isNull() && false == $thankLetter->doctor->hospitalfaculty->isNull())
{
$res['hospitalFacultyId'] = $thankLetter->doctor->hospitalfaculty->getEncodeId();
}
$res['content'] = strip_tags($thankLetter->content);
$res['patient'] = $thankLetter->user->isNull()?$thankLetter->ipLocation : XString::truncate($thankLetter->user->name, 1, "***");
$res['ctime'] = $thankLetter->ctime;
return $res;
}/*}}}*/
示例15: makeDescString
private function makeDescString(Doctor $doctor)
{/*{{{*/
$extInfo = '';
if ($doctor->space->isCaseOpen())
{
$extInfo .= "在线咨询".$doctor->name.",";
}
if ($doctor->space->phoneOpened)
{
$extInfo .= "电话咨询".$doctor->name.",";
}
if ($doctor->space->isBookingOpened())
{
$extInfo .= "预约".$doctor->name."门诊,";
}
return ($doctor->hospitalfaculty->isNull()) ? $doctor->name.$doctor->grade
."简介、门诊时间,".$response->extInfo."患者找".$doctor->name."看病的".$doctor->commentCount."篇经验。".$doctor->name."擅长".XString::truncate($doctor->specialize, 120)
: $doctor->hospitalfaculty->hospital->commonName.$doctor->hospitalfaculty->name.$doctor->name.$doctor->grade
."简介、门诊时间,".$extInfo."患者找".$doctor->name."看病的".$doctor->commentCount."篇经验。".$doctor->name."擅长".XString::truncate($doctor->specialize, 120);
}/*}}}*/