当前位置: 首页>>代码示例>>PHP>>正文


PHP StringUtil::cutStr方法代码示例

本文整理汇总了PHP中StringUtil::cutStr方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::cutStr方法的具体用法?PHP StringUtil::cutStr怎么用?PHP StringUtil::cutStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringUtil的用法示例。


在下文中一共展示了StringUtil::cutStr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public final function __construct($attach, $module = "temp")
 {
     if (!is_array($attach) || empty($attach) || !$this->isUploadFile($attach["tmp_name"]) || trim($attach["name"]) == "" || $attach["size"] == 0) {
         $this->_attach = array();
         $this->_errorCode = -1;
         return false;
     } else {
         $attach["type"] = $this->checkDirType($module);
         $attach["size"] = intval($attach["size"]);
         $attach["name"] = trim($attach["name"]);
         $attach["thumb"] = "";
         $attach["ext"] = StringUtil::getFileExt($attach["name"]);
         $attach["name"] = StringUtil::ihtmlSpecialChars($attach["name"], ENT_QUOTES);
         if (90 < strlen($attach["name"])) {
             $attach["name"] = StringUtil::cutStr($attach["name"], 80, "") . "." . $attach["ext"];
         }
         $attach["isimage"] = $this->isImageExt($attach["ext"]);
         $attach["attachdir"] = $this->getTargetDir($attach["type"]);
         $attach["attachname"] = $this->getTargetFileName() . "." . $attach["ext"];
         $attach["attachment"] = $attach["attachdir"] . $attach["attachname"];
         $attach["target"] = FileUtil::getAttachUrl() . "/" . $attach["type"] . "/" . $attach["attachment"];
         $this->_attach =& $attach;
         $this->_errorCode = 0;
         return true;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:26,代码来源:ICUpload.php

示例2: addDigg

 public function addDigg($feedId, $uid)
 {
     $data["feedid"] = $feedId;
     $data["uid"] = $uid;
     $data["uid"] = !$data["uid"] ? Ibos::app()->user->uid : $data["uid"];
     if (!$data["uid"]) {
         $this->addError("addDigg", "未登录不能赞");
         return false;
     }
     $isExit = $this->getIsExists($feedId, $uid);
     if ($isExit) {
         $this->addError("addDigg", "你已经赞过");
         return false;
     }
     $data["ctime"] = time();
     $res = $this->add($data);
     if ($res) {
         $feed = Source::getSourceInfo("feed", $feedId);
         Feed::model()->updateCounters(array("diggcount" => 1), "feedid = " . $feedId);
         Feed::model()->cleanCache($feedId);
         $user = User::model()->fetchByUid($uid);
         $config["{user}"] = $user["realname"];
         $config["{sourceContent}"] = StringUtil::filterCleanHtml($feed["source_body"]);
         $config["{sourceContent}"] = str_replace("◆", "", $config["{sourceContent}"]);
         $config["{sourceContent}"] = StringUtil::cutStr($config["{sourceContent}"], 34);
         $config["{url}"] = $feed["source_url"];
         $config["{content}"] = Ibos::app()->getController()->renderPartial("application.modules.message.views.remindcontent", array("recentFeeds" => Feed::model()->getRecentFeeds()), true);
         Notify::model()->sendNotify($feed["uid"], "message_digg", $config);
         UserUtil::updateCreditByAction("diggweibo", $uid);
         UserUtil::updateCreditByAction("diggedweibo", $feed["uid"]);
     }
     return $res;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:33,代码来源:FeedDigg.php

示例3: processListData

 public static function processListData($interviewList)
 {
     foreach ($interviewList as $k => $interview) {
         $interviewList[$k]["interviewtime"] = date("Y-m-d", $interview["interviewtime"]);
         $interviewList[$k]["interviewer"] = User::model()->fetchRealnameByUid($interview["interviewer"]);
         $interviewList[$k]["process"] = StringUtil::cutStr($interview["process"], 12);
         $interviewList[$k]["realname"] = ResumeDetail::model()->fetchRealnameByResumeId($interview["resumeid"]);
     }
     return $interviewList;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:ICRecruitInterview.php

示例4: getShowNames

 protected function getShowNames($uids)
 {
     $uids = is_array($uids) ? $uids : explode(",", $uids);
     $names = User::model()->fetchRealnamesByUids($uids);
     $nums = count($uids);
     if (4 <= $nums) {
         $show = StringUtil::cutStr($names, 30) . " 等{$nums人}";
     } else {
         $show = $names;
     }
     $ret = array("show" => $show, "title" => $names);
     return $ret;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:13,代码来源:ApprovalController.php

示例5: loadNewSchedules

 private function loadNewSchedules()
 {
     $uid = Yii::app()->user->uid;
     $st = time();
     $schedules = Calendars::model()->fetchNewSchedule($uid, $st);
     if (!empty($schedules)) {
         foreach ($schedules as $k => $schedule) {
             $schedules[$k]["dateAndWeekDay"] = CalendarUtil::getDateAndWeekDay(date("Y-m-d", $schedule["starttime"]));
             $schedules[$k]["category"] = Calendars::model()->handleColor($schedule["category"]);
             $schedules[$k]["cutSubject"] = StringUtil::cutStr($schedule["subject"], 30);
         }
     }
     return $schedules;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:14,代码来源:CalendarApi.php

示例6: processListData

 public static function processListData($contactList)
 {
     foreach ($contactList as $k => $contact) {
         $contactList[$k]["realname"] = ResumeDetail::model()->fetchRealnameByResumeid($contact["resumeid"]);
         $contactList[$k]["inputtime"] = date("Y-m-d", $contact["inputtime"]);
         $contactList[$k]["detail"] = StringUtil::cutStr($contact["detail"], 12);
         if ($contactList[$k]["input"]) {
             $contactList[$k]["input"] = User::model()->fetchRealnameByUid($contact["input"]);
         } else {
             $contactList[$k]["input"] = "";
         }
     }
     return $contactList;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:14,代码来源:ICResumeContact.php

示例7: getView

 public static function getView($view)
 {
     $currentController = Yii::app()->getController();
     $basePath = "application.modules.vote.views.default.";
     $relatedModule = Ibos::getCurrentModuleName();
     $relatedId = EnvUtil::getRequest($relatedModule . "id");
     if ($view == "articleView") {
         $voteData = Vote::model()->fetchVote($relatedModule, $relatedId);
         $votes = VoteUtil::processVoteData($voteData);
         if (!empty($votes)) {
             $voteItemList = $votes["voteItemList"];
             $voteType = $voteItemList[0]["type"];
             if ($voteType == 1) {
                 $view = "articleTextView";
             } elseif ($voteType == 2) {
                 $view = "articleImageView";
             }
             $selectView = $basePath . $view;
             $votePeopleNumber = Vote::model()->fetchUserVoteCount($relatedModule, $relatedId);
             $userHasVote = VoteUtil::checkVote($relatedModule, $relatedId);
             $mothedName = "get" . ucfirst($relatedModule) . "Vote";
             $voteStatus = ICVotePlugManager::$mothedName()->getStatus($relatedModule, $relatedId, $votes["vote"]);
             $votes["vote"]["subject"] = StringUtil::cutStr($votes["vote"]["subject"], 60);
             $data = array("voteData" => $votes, "votePeopleNumber" => $votePeopleNumber, "userHasVote" => $userHasVote, "voteStatus" => $voteStatus, "attachUrl" => Yii::app()->setting->get("setting/attachurl"));
             if ($voteStatus == 2) {
                 $partView = null;
             } else {
                 $partView = $currentController->renderPartial($selectView, $data, true);
             }
         } else {
             $partView = null;
         }
     } elseif ($view == "articleAdd") {
         $selectView = $basePath . $view;
         $partView = $currentController->renderPartial($selectView, array("uploadConfig" => AttachUtil::getUploadConfig()), true);
     } elseif ($view == "articleEdit") {
         $selectView = $basePath . $view;
         $voteData = Vote::model()->fetchVote($relatedModule, $relatedId);
         if (!empty($voteData) && isset($voteData["voteItemList"])) {
             foreach ($voteData["voteItemList"] as $k => $voteItem) {
                 $voteData["voteItemList"][$k]["thumburl"] = FileUtil::fileName($voteItem["picpath"]);
             }
         }
         $data = array("voteData" => $voteData, "uploadConfig" => AttachUtil::getUploadConfig());
         $partView = $currentController->renderPartial($selectView, $data, true);
     }
     return $partView;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:48,代码来源:ICVote.php

示例8: processShareListData

 public static function processShareListData($uid, $data)
 {
     $result = array();
     $attentions = DiaryAttention::model()->fetchAllByAttributes(array("uid" => $uid));
     $auidArr = ConvertUtil::getSubByKey($attentions, "auid");
     foreach ($data as $diary) {
         $diary["content"] = StringUtil::cutStr(strip_tags($diary["content"]), 255);
         $diary["realname"] = User::model()->fetchRealnameByUid($diary["uid"]);
         $diary["addtime"] = ConvertUtil::formatDate($diary["addtime"], "u");
         $isattention = in_array($diary["uid"], $auidArr);
         $diary["isattention"] = $isattention ? 1 : 0;
         $diary["user"] = User::model()->fetchByUid($diary["uid"]);
         $result[] = $diary;
     }
     return $result;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:16,代码来源:ICDiary.php

示例9: update

 private function update()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $contactid = EnvUtil::getRequest("contactid");
         $data = ICResumeContact::processAddOrEditData($_POST);
         $modifySuccess = ResumeContact::model()->modify($contactid, $data);
         if ($modifySuccess) {
             $contact = ResumeContact::model()->fetchByPk($contactid);
             $contact["inputtime"] = date("Y-m-d", $contact["inputtime"]);
             $contact["input"] = User::model()->fetchRealnameByUid($contact["input"]);
             $contact["fullname"] = ResumeDetail::model()->fetchRealnameByResumeid($contact["resumeid"]);
             $contact["detail"] = StringUtil::cutStr($contact["detail"], 12);
             $this->ajaxReturn($contact);
         } else {
             $this->ajaxReturn(array("isSuccess" => 0));
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:18,代码来源:ContactController.php

示例10: update

 private function update()
 {
     if (Yii::app()->request->isAjaxRequest) {
         $interviewid = EnvUtil::getRequest("interviewid");
         $data = ICRecruitInterview::processAddOrEditData($_POST);
         $modifySuccess = ResumeInterview::model()->modify($interviewid, $data);
         if ($modifySuccess) {
             $interview = ResumeInterview::model()->fetchByPk($interviewid);
             $interview["fullname"] = ResumeDetail::model()->fetchRealnameByResumeid($interview["resumeid"]);
             $interview["interviewtime"] = date("Y-m-d", $interview["interviewtime"]);
             $interview["interviewer"] = User::model()->fetchRealnameByUid($interview["interviewer"]);
             $interview["process"] = StringUtil::cutStr($interview["process"], 12);
             $this->ajaxReturn($interview);
         } else {
             $this->ajaxReturn(array("isSuccess" => 0));
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:18,代码来源:InterviewController.php

示例11: handelListData

 public static function handelListData($reports)
 {
     $return = array();
     foreach ($reports as $report) {
         $report["cutSubject"] = StringUtil::cutStr(strip_tags($report["subject"]), 60);
         $report["user"] = User::model()->fetchByUid($report["uid"]);
         $readeruid = $report["readeruid"];
         $report["readercount"] = empty($readeruid) ? 0 : count(explode(",", trim($readeruid, ",")));
         $report["content"] = StringUtil::cutStr(strip_tags($report["content"]), 255);
         $report["addtime"] = ConvertUtil::formatDate($report["addtime"], "u");
         if ($report["stamp"] != 0) {
             $path = Stamp::model()->fetchIconById($report["stamp"]);
             $report["stampPath"] = FileUtil::fileName(Stamp::STAMP_PATH . $path);
         }
         $return[] = $report;
     }
     return $return;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:18,代码来源:ICReport.php

示例12: getListData

 public static function getListData($datas, $uid)
 {
     $listDatas = array();
     $checkTime = 3 * 86400;
     $readArtIds = ArticleReader::model()->fetchReadArtIdsByUid($uid);
     foreach ($datas as $data) {
         $data["subject"] = StringUtil::cutStr($data["subject"], 50);
         $data["readStatus"] = in_array($data["articleid"], $readArtIds) ? 1 : -1;
         if ($data["readStatus"] === -1 && TIMESTAMP - $checkTime < $data["uptime"]) {
             $data["readStatus"] = 2;
         }
         $data["author"] = User::model()->fetchRealnameByUid($data["author"]);
         if (empty($data["uptime"])) {
             $data["uptime"] = $data["addtime"];
         }
         $data["uptime"] = ConvertUtil::formatDate($data["uptime"], "u");
         $keyword = EnvUtil::getRequest("keyword");
         if (!empty($keyword)) {
             $data["subject"] = preg_replace("|({$keyword})|i", "<span style='color:red'>\$1</span>", $data["subject"]);
         }
         if ($data["ishighlight"] == "1") {
             $highLightStyle = $data["highlightstyle"];
             $hiddenInput = "<input type='hidden' id='{$data["articleid"]}_hlstyle' value='{$highLightStyle}'/>";
             $data["subject"] .= $hiddenInput;
             $highLightStyleArr = explode(",", $highLightStyle);
             $color = $highLightStyleArr[1];
             $isB = $highLightStyleArr[0];
             $isI = $highLightStyleArr[2];
             $isU = $highLightStyleArr[3];
             $isB && ($data["subject"] = "<b>{$data["subject"]}</b>");
             $isU && ($data["subject"] = "<u>{$data["subject"]}</u>");
             $fontStyle = "";
             $color != "" && ($fontStyle .= "color:{$color};");
             $isI && ($fontStyle .= "font-style:italic;");
             $fontStyle != "" && ($data["subject"] = "<font style='{$fontStyle}'>{$data["subject"]}</font>");
         }
         $listDatas[] = $data;
     }
     return $listDatas;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:40,代码来源:ICArticle.php

示例13: handleLoops

 private function handleLoops($loops)
 {
     if (!empty($loops)) {
         foreach ($loops as $k => $v) {
             $loops[$k]["subject"] = StringUtil::cutStr($v["subject"], 12);
             $loops[$k]["uptime"] = date("Y-m-d H:i", $v["uptime"]);
             $time = date("H:i", $v["starttime"]) . "至" . date("H:i", $v["endtime"]);
             switch ($v["recurringtype"]) {
                 case "week":
                     $recurringtime = CalendarUtil::digitalToDay($v["recurringtime"]);
                     $loops[$k]["cycle"] = "每周" . $recurringtime . " " . $time;
                     break;
                 case "month":
                     $loops[$k]["cycle"] = "每月" . $v["recurringtime"] . "号 " . $time;
                     break;
                 case "year":
                     $monthDay = explode("-", $v["recurringtime"]);
                     $loops[$k]["cycle"] = "每年" . $monthDay[0] . "月" . $monthDay[1] . "号 " . $time;
                     break;
             }
         }
     }
     return $loops;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:24,代码来源:LoopController.php

示例14: getList

 public function getList($type = 1, $catid = 0, $search = "")
 {
     $gUid = Ibos::app()->user->uid;
     $childCatIds = "";
     if (!empty($catid)) {
         $this->catid = $catid;
         $childCatIds = ArticleCategory::model()->fetchCatidByPid($this->catid, true);
     }
     if (!empty($search)) {
         $this->condition = "subject like '%{$search}%'";
     }
     $articleidArr = ArticleReader::model()->fetchArticleidsByUid(Ibos::app()->user->uid);
     $this->condition = ArticleUtil::joinListCondition($type, $articleidArr, $childCatIds, $this->condition);
     $datas = Article::model()->fetchAllAndPage($this->condition);
     $listData = $datas["datas"];
     foreach ($listData as $key => $value) {
         $value["content"] = StringUtil::cutStr(strip_tags($value["content"]), 30);
         $listData[$key] = array_filter($value);
         $listData[$key]["readstatus"] = ArticleReader::model()->checkIsRead($value["articleid"], $gUid);
     }
     $return["datas"] = $listData;
     $return["pages"] = array("pageCount" => $datas["pages"]->getPageCount(), "page" => $datas["pages"]->getCurrentPage(), "pageSize" => $datas["pages"]->getPageSize());
     return $return;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:24,代码来源:MICArticle.php

示例15: foreach

    foreach ($history as $log) {
        ?>
    
									<?php 
        $row = json_decode($log["message"], true);
        ?>
    
									<tr>
										<td>
											<?php 
        echo ConvertUtil::formatDate($log["logtime"], "u");
        ?>
</td>
										<td>
											<?php 
        echo StringUtil::cutStr(!empty($row["address"]) ? $row["address"] : ConvertUtil::convertIp($row["ip"]), 7);
        ?>
</td>
										<td>
											<?php 
        echo $row["ip"];
        ?>
</td>
										<td>
											<?php 
        echo $terminal[$row["terminal"]];
        ?>
</td>
									</tr>
								<?php 
    }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:index.php


注:本文中的StringUtil::cutStr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。