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


PHP FileUtil::fileName方法代码示例

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


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

示例1: processDefaultListData

 public static function processDefaultListData($data)
 {
     $dashboardConfig = Yii::app()->setting->get("setting/diaryconfig");
     $lockday = $dashboardConfig["lockday"] ? intval($dashboardConfig["lockday"]) : 0;
     $return = array();
     foreach ($data as $value) {
         $readeruid = $value["readeruid"];
         if (empty($readeruid)) {
             $value["readercount"] = 0;
         } else {
             $value["readercount"] = count(explode(",", trim($readeruid, ",")));
         }
         $todayTime = (int) strtotime(date("Y-m-d", time()));
         $diaryTime = (int) $value["diarytime"];
         $diffDay = ($todayTime - $diaryTime) / (24 * 60 * 60);
         if (0 < $lockday && $lockday < $diffDay) {
             $value["editIsLock"] = 1;
         } else {
             $value["editIsLock"] = 0;
         }
         $value["content"] = StringUtil::cutStr(strip_tags($value["content"]), 255);
         $value["diarytime"] = DiaryUtil::getDateAndWeekDay(date("Y-m-d", $value["diarytime"]));
         $value["addtime"] = ConvertUtil::formatDate($value["addtime"], "u");
         if ($value["stamp"] != 0) {
             $path = Stamp::model()->fetchIconById($value["stamp"]);
             $value["stampPath"] = FileUtil::fileName(Stamp::STAMP_PATH . $path);
         }
         $return[] = $value;
     }
     return $return;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:31,代码来源:ICDiary.php

示例2: save

 public function save($imgname, $type = NULL, $interlace = true)
 {
     if (empty($this->img)) {
         throw new Exception("没有可以被保存的图像资源");
     }
     if (is_null($type)) {
         $type = $this->info["type"];
     } else {
         $type = strtolower($type);
     }
     if ("jpeg" == $type || "jpg" == $type) {
         $type = "jpeg";
         imageinterlace($this->img, $interlace);
     }
     if ("gif" == $type && !empty($this->gif)) {
         $this->gif->save($imgname);
     } else {
         $fun = "image{$type}";
         if (!LOCAL) {
             $temp = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($imgname), $this->info["type"]);
             $fun($this->img, $temp);
             $content = file_get_contents($temp);
             Ibos::engine()->IO()->file()->writeFile($imgname, $content);
         } else {
             $fun($this->img, $imgname);
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:ImageGd.class.php

示例3: getDocFile

 private function getDocFile($var)
 {
     if ($var["isNew"]) {
         $typeId = AttachUtil::attachType($var["param"]["filetype"], "id");
         $map = array(self::DOC_WORD => array("fileName" => $var["lang"]["New doc"] . ".doc", "fileUrl" => self::OFFICE_PATH . "new.doc", "typeId" => self::DOC_WORD), self::DOC_EXCEL => array("fileName" => $var["lang"]["New excel"] . ".xls", "fileUrl" => self::OFFICE_PATH . "new.doc", "typeId" => self::DOC_WORD), self::DOC_PPT => array("fileName" => $var["lang"]["New ppt"] . ".ppt", "fileUrl" => self::OFFICE_PATH . "new.ppt", "typeId" => self::DOC_WORD));
         return $map[$typeId];
     } else {
         return array("typeId" => AttachUtil::attachType(StringUtil::getFileExt($var["attach"]["attachment"]), "id"), "fileName" => $var["attach"]["filename"], "fileUrl" => FileUtil::fileName(FileUtil::getAttachUrl() . "/" . $var["attach"]["attachment"]));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:10,代码来源:IWMainOffice.php

示例4: handleListData

 public static function handleListData($data)
 {
     $reminds = AssignmentRemind::model()->fetchAllByUid(Ibos::app()->user->uid);
     foreach ($data as $k => $assignment) {
         $data[$k] = self::handleShowData($assignment);
         $aid = $assignment["assignmentid"];
         $data[$k]["remindtime"] = in_array($aid, array_keys($reminds)) ? $reminds[$aid] : 0;
         if ($assignment["stamp"] != 0) {
             $path = Stamp::model()->fetchIconById($assignment["stamp"]);
             $data[$k]["stampPath"] = FileUtil::fileName(Stamp::STAMP_PATH . $path);
         }
     }
     return $data;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:14,代码来源:AssignmentUtil.php

示例5: makeThumb

 public static function makeThumb($attach, $width, $height)
 {
     $attachUrl = FileUtil::getAttachUrl();
     $file = sprintf("%s/%s", $attachUrl, $attach["attachment"]);
     $fileext = StringUtil::getFileExt($file);
     $thumbName = self::getThumbName($attach, $width, $height);
     if (LOCAL) {
         $res = ImageUtil::thumb2($file, $thumbName, "", $width, $height);
     } else {
         $tempFile = FileUtil::getTempPath() . "tmp." . $fileext;
         $orgImgname = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($file), $fileext);
         ImageUtil::thumb2($orgImgname, $tempFile, "", $width, $height);
         FileUtil::createFile($thumbName, file_get_contents($tempFile));
     }
     return $thumbName;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:16,代码来源:WbCommonUtil.php

示例6: handleIconUrl

 private function handleIconUrl($reports, $returnUserInfo = false)
 {
     $stampPath = FileUtil::fileName(Stamp::STAMP_PATH);
     foreach ($reports as $k => $report) {
         if ($returnUserInfo) {
             $reports[$k]["userInfo"] = User::model()->fetchByUid($report["uid"]);
         }
         if ($report["stamp"] != 0) {
             $stamp = Stamp::model()->fetchIconById($report["stamp"]);
             $reports[$k]["iconUrl"] = $stampPath . $stamp;
         } else {
             $reports[$k]["iconUrl"] = "";
         }
     }
     return $reports;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:16,代码来源:ReportApi.php

示例7: actionUploadAvatar

 public function actionUploadAvatar()
 {
     $upload = FileUtil::getUpload($_FILES["Filedata"]);
     if (!$upload->save()) {
         $this->ajaxReturn(array("msg" => Ibos::lang("Save failed", "message"), "IsSuccess" => false));
     } else {
         $info = $upload->getAttach();
         $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
         $fileUrl = FileUtil::fileName($file);
         $tempSize = FileUtil::imageSize($fileUrl);
         if ($tempSize[0] < 180 || $tempSize[1] < 180) {
             $this->ajaxReturn(array("msg" => Ibos::lang("Avatar size error"), "IsSuccess" => false), "json");
         }
         $this->ajaxReturn(array("data" => $fileUrl, "file" => $file, "IsSuccess" => true));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:16,代码来源:InfoController.php

示例8: actionIndex

 public function actionIndex()
 {
     $formSubmit = EnvUtil::submitCheck("stampSubmit");
     $stampPath = Stamp::STAMP_PATH;
     if ($formSubmit) {
         if (isset($_POST["stamps"])) {
             foreach ($_POST["stamps"] as $id => $stamp) {
                 if (FileUtil::fileExists($stamp["stamp"])) {
                     Stamp::model()->delImg($id, "stamp");
                     $stamp["stamp"] = DashboardUtil::moveTempFile($stamp["stamp"], $stampPath);
                 }
                 if (FileUtil::fileExists($stamp["icon"])) {
                     Stamp::model()->delImg($id, "icon");
                     $stamp["icon"] = DashboardUtil::moveTempFile($stamp["icon"], $stampPath);
                 }
                 Stamp::model()->modify($id, $stamp);
             }
         }
         if (isset($_POST["newstamps"])) {
             foreach ($_POST["newstamps"] as $value) {
                 if (!empty($value["stamp"])) {
                     $value["stamp"] = DashboardUtil::moveTempFile($value["stamp"], $stampPath);
                 }
                 if (!empty($value["icon"])) {
                     $value["icon"] = DashboardUtil::moveTempFile($value["icon"], $stampPath);
                 }
                 Stamp::model()->add($value);
             }
         }
         if (!empty($_POST["removeId"])) {
             $removeIds = explode(",", trim($_POST["removeId"], ","));
             Stamp::model()->deleteByIds($removeIds);
         }
         clearstatcache();
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         if (EnvUtil::getRequest("op") === "upload") {
             $fakeUrl = $this->imgUpload("stamp");
             $realUrl = FileUtil::fileName($fakeUrl);
             return $this->ajaxReturn(array("fakeUrl" => $fakeUrl, "url" => $realUrl));
         }
         $data = array("stampUrl" => $stampPath, "list" => Stamp::model()->fetchAll(), "maxSort" => Stamp::model()->getMaxSort());
         $this->render("index", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:45,代码来源:SysstampController.php

示例9: 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

示例10: upload

 public function upload()
 {
     $uid = intval(EnvUtil::getRequest("uid"));
     $this->upload->save();
     $attach = $this->upload->getAttach();
     $attachment = $attach["type"] . "/" . $attach["attachment"];
     $data = array("dateline" => TIMESTAMP, "filename" => $attach["name"], "filesize" => $attach["size"], "attachment" => $attachment, "isimage" => $attach["isimage"], "uid" => $uid);
     $aid = Attachment::model()->add(array("uid" => $uid, "tableid" => 127), true);
     $data["aid"] = $aid;
     AttachmentUnused::model()->add($data);
     $file["aid"] = $aid;
     $file["name"] = $attach["name"];
     $file["url"] = FileUtil::fileName(FileUtil::getAttachUrl() . "/" . $attachment);
     if (!empty($file) && is_array($file)) {
         return CJSON::encode($file);
     } else {
         return CJSON::encode(array("aid" => 0, "url" => 0, "name" => 0));
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:19,代码来源:RecruitAttach.php

示例11: actionUpload

 public function actionUpload()
 {
     if ($_FILES["avatar"]) {
         $upload = FileUtil::getUpload($_FILES["avatar"]);
         if (!$upload->save()) {
             echo "出错了";
         } else {
             $info = $upload->getAttach();
             $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
             $fileUrl = FileUtil::fileName($file);
             $uid = Yii::app()->user->uid;
             $tempAvatar = $file;
             $avatarPath = "data/avatar/";
             $avatarBig = UserUtil::getAvatar($uid, "big");
             $avatarMiddle = UserUtil::getAvatar($uid, "middle");
             $avatarSmall = UserUtil::getAvatar($uid, "small");
             if (LOCAL) {
                 FileUtil::makeDirs($avatarPath . dirname($avatarBig));
             }
             FileUtil::createFile("data/avatar/" . $avatarBig, "");
             FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
             FileUtil::createFile("data/avatar/" . $avatarSmall, "");
             Yii::import("ext.ThinkImage.ThinkImage", true);
             $imgObj = new ThinkImage(THINKIMAGE_GD);
             $imgTemp = $imgObj->open($tempAvatar);
             $params = array("w" => $imgTemp->width(), "h" => $imgTemp->height(), "x" => "0", "y" => "0");
             if ($params["h"] < $params["w"]) {
                 $params["x"] = ($params["w"] - $params["h"]) / 2;
                 $params["w"] = $params["h"];
             } else {
                 $params["y"] = ($params["h"] - $params["w"]) / 2;
                 $params["h"] = $params["w"];
             }
             $imgObj->open($tempAvatar)->crop($params["w"], $params["h"], $params["x"], $params["y"])->save($tempAvatar);
             $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
             $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
             $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:40,代码来源:settingController.php

示例12: actionIndex

 public function actionIndex()
 {
     $formSubmit = EnvUtil::submitCheck("loginSubmit");
     $bgPath = LoginTemplate::BG_PATH;
     if ($formSubmit) {
         if (isset($_POST["bgs"])) {
             foreach ($_POST["bgs"] as $id => $bg) {
                 if (FileUtil::fileExists($bg["image"])) {
                     LoginTemplate::model()->delImg($id);
                     $bg["image"] = DashboardUtil::moveTempFile($bg["image"], $bgPath);
                 }
                 $bg["disabled"] = isset($bg["disabled"]) ? 0 : 1;
                 LoginTemplate::model()->modify($id, $bg);
             }
         }
         if (isset($_POST["newbgs"])) {
             foreach ($_POST["newbgs"] as $value) {
                 if (!empty($value["image"])) {
                     $value["image"] = DashboardUtil::moveTempFile($value["image"], $bgPath);
                 }
                 LoginTemplate::model()->add($value);
             }
         }
         if (!empty($_POST["removeId"])) {
             $removeIds = explode(",", trim($_POST["removeId"], ","));
             LoginTemplate::model()->deleteByIds($removeIds, $bgPath);
         }
         clearstatcache();
         $this->success(Ibos::lang("Save succeed", "message"));
     } else {
         if (EnvUtil::getRequest("op") === "upload") {
             $fakeUrl = $this->imgUpload("bg");
             $realUrl = FileUtil::fileName($fakeUrl);
             return $this->ajaxReturn(array("fakeUrl" => $fakeUrl, "url" => $realUrl));
         }
         $data = array("list" => LoginTemplate::model()->fetchAll(), "bgpath" => $bgPath);
         $this->render("index", $data);
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:39,代码来源:LoginController.php

示例13: getPercentage

 private static function getPercentage($voteItemList)
 {
     $numberCount = 0;
     foreach ($voteItemList as $index => $voteItem) {
         $voteItemList[$index]["picpath"] = FileUtil::fileName($voteItem["picpath"]);
         $numberCount += $voteItem["number"];
     }
     $length = count($voteItemList);
     if ($numberCount == 0) {
         for ($i = 0; $i < $length; $i++) {
             $voteItemList[$i]["percentage"] = "0%";
             $voteItemList[$i]["color_style"] = "";
         }
     } else {
         $percentageCount = 0;
         $count = 0;
         $colors = array("#91CE31", "#EE8C0C", "#E26F50", "#3497DB");
         $colorLength = count($colors);
         for ($i = 0; $i < $length; $i++) {
             $percentage = round($voteItemList[$i]["number"] / $numberCount * 100);
             $voteItemList[$i]["percentage"] = $percentage;
             $percentageCount = $percentageCount + $voteItemList[$i]["percentage"];
             $voteItemList[$i]["color_style"] = $colors[$count];
             $count++;
             if ($colorLength <= $count) {
                 $count = 0;
             }
         }
         if ($percentageCount != 100) {
             $voteItemList[0]["percentage"] = $voteItemList[0]["percentage"] + 1;
         }
         for ($i = 0; $i < $length; $i++) {
             $voteItemList[$i]["percentage"] = $voteItemList[$i]["percentage"] . "%";
         }
     }
     return $voteItemList;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:37,代码来源:VoteUtil.php

示例14: actionPostimg

 public function actionPostimg()
 {
     $upload = FileUtil::getUpload($_FILES["pmimage"], "mobile");
     if (!$upload->save()) {
         echo "出错了";
     } else {
         $info = $upload->getAttach();
         $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
         $fileUrl = FileUtil::fileName($file);
         $filePath = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachdir"];
         $filename = "tumb_" . $info["attachname"];
         if (LOCAL) {
             FileUtil::makeDirs($filePath . dirname($filename));
         }
         FileUtil::createFile($filePath . $filename, "");
         Yii::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         $imgObj->open($fileUrl)->thumb(180, 180, 1)->save($filePath . $filename);
         $content = "<a href='" . $fileUrl . "'><img src='" . $filePath . $filename . "' /></a>";
         $id = intval(isset($_POST["pmid"]) ? $_POST["pmid"] : 0);
         $touid = intval(isset($_POST["pmtouid"]) ? $_POST["touid"] : 0);
         if (!$id && $touid) {
             $data = array("content" => $content, "touid" => $touid, "type" => 1);
             $res = MessageContent::model()->postMessage($data, Yii::app()->user->uid);
             $message = array("listid" => $res, "IsSuccess" => true);
         } else {
             $res = MessageContent::model()->replyMessage($id, $content, Yii::app()->user->uid);
             if ($res) {
                 $message = array("IsSuccess" => true, "data" => Ibos::lang("Private message send success"));
             } else {
                 $message = array("IsSuccess" => false, "data" => Ibos::lang("Private message send fail"));
             }
         }
         $this->ajaxReturn($message, "JSONP");
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:36,代码来源:PmController.php

示例15: download

 public function download($attach, $downloadInfo)
 {
     $attachUrl = FileUtil::getAttachUrl();
     $attachment = FileUtil::fileName($attachUrl . "/" . $attach["attachment"]);
     Attachment::model()->updateDownload($attach["aid"]);
     header("Location:{$attachment}");
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:7,代码来源:SAEFile.php


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