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


PHP ConvertUtil::iIconv方法代码示例

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


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

示例1: fetchBody

 private static function fetchBody($obj, $conn, $folder, $id, $structure, $part)
 {
     $body = $obj->fetchPartBody($conn, $folder, $id, $part);
     $encoding = EmailMimeUtil::getPartEncodingCode($structure, $part);
     if ($encoding == 3) {
         $body = base64_decode($body);
     } elseif ($encoding == 4) {
         $body = quoted_printable_decode($body);
     }
     $charset = EmailMimeUtil::getPartCharset($structure, $part);
     if (empty($charset)) {
         $part_header = $obj->fetchPartHeader($conn, $folder, $id, $part);
         $pattern = "/charset=[\"]?([a-zA-Z0-9_-]+)[\"]?/";
         preg_match($pattern, $part_header, $matches);
         if (count($matches) == 2) {
             $charset = $matches[1];
         }
     }
     if (strcasecmp($charset, "utf-8") == 0) {
         $is_unicode = true;
     } elseif (preg_match("/#[0-9]{5};/", $body)) {
         $is_unicode = false;
     } else {
         $is_unicode = false;
     }
     if (!$is_unicode) {
         $body = ConvertUtil::iIconv($body, "gb2312");
     }
     $url = Yii::app()->urlManager->createUrl("email/web/show", array("webid" => self::$_web["webid"], "folder" => $folder, "id" => $id, "cid" => ""));
     $body = preg_replace("/src=(\")?cid:/i", "src=\"{$url}", $body);
     return $body;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:32,代码来源:WebMailUtil.php

示例2: exportSms

 public static function exportSms($id)
 {
     $ids = is_array($id) ? $id : explode(",", $id);
     header("Content-Type:application/vnd.ms-excel");
     $fileName = ConvertUtil::iIconv(Ibos::lang("SMS export name", "dashboard.default", array("{date}" => date("Ymd"))), CHARSET, "gbk");
     header("Content-Disposition: attachment;filename={$fileName}.csv");
     header("Cache-Control: max-age = 0");
     $head = array("ID", Ibos::lang("Sender", "dashboard.default"), Ibos::lang("Recipient", "dashboard.default"), Ibos::lang("Membership module", "dashboard.default"), Ibos::lang("Recipient phone number", "dashboard.default"), Ibos::lang("Content", "dashboard.default"), Ibos::lang("Result", "dashboard.default"), Ibos::lang("Send time", "dashboard.default"));
     foreach ($head as &$header) {
         $header = ConvertUtil::iIconv($header, CHARSET, "gbk");
     }
     $fp = fopen("php://output", "a");
     fputcsv($fp, $head);
     $cnt = 0;
     $limit = 100;
     $system = Ibos::lang("System", "dashboard.default");
     foreach (NotifySms::model()->fetchAll(sprintf("FIND_IN_SET(id,'%s')", implode(",", $ids))) as $row) {
         if ($limit == $cnt) {
             ob_flush();
             flush();
             $cnt = 0;
         }
         $data = array($row["id"], ConvertUtil::iIconv($row["uid"] == 0 ? $system : User::model()->fetchRealnameByUid($row["uid"]), CHARSET, "gbk"), ConvertUtil::iIconv(User::model()->fetchRealnameByUid($row["touid"]), CHARSET, "gbk"), $row["module"], $row["mobile"], ConvertUtil::iIconv($row["content"], CHARSET, "gbk"), ConvertUtil::iIconv($row["return"], CHARSET, "gbk"), date("Y-m-d H:i:s", $row["ctime"]));
         fputcsv($fp, $data);
     }
     exit;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:27,代码来源:MessageUtil.php

示例3: export

 public static function export($idstr)
 {
     $idArr = is_array($idstr) ? $idstr : explode(",", $idstr);
     if (1 < count($idArr)) {
         $zip = new Zip();
         $exportFileName = Ibos::lang("Form export file pack", "workflow.default", array("{date}" => date("Y-m-d")));
         $zipFileName = FileUtil::getTempPath() . "/" . TIMESTAMP . ".zip";
         foreach ($idArr as $id) {
             $form = self::handleExportSingleForm($id);
             $zip->addFile($form["content"], sprintf("%s.html", ConvertUtil::iIconv($form["title"], CHARSET, "gbk")));
         }
         $fp = fopen($zipFileName, "w");
         if (@fwrite($fp, $zip->file()) !== false) {
             header("Cache-control: private");
             header("Content-type: application/octet-stream");
             header("Accept-Ranges: bytes");
             header("Content-Length: " . sprintf("%u", FileUtil::fileSize($zipFileName)));
             header("Content-Disposition: attachment; filename=" . $exportFileName . ".zip");
             readfile($zipFileName);
             exit;
         }
     } else {
         $id = implode(",", $idArr);
         $form = self::handleExportSingleForm($id);
         ob_end_clean();
         header("Cache-control: private");
         header("Content-type: text/plain");
         header("Accept-Ranges: bytes");
         header("Accept-Length: " . strlen($form["content"]));
         header("Content-Disposition: attachment; filename=" . $form["title"] . ".html");
         echo $form["content"];
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:33,代码来源:WfFormUtil.php

示例4: handleCreditRule

 public function handleCreditRule($event)
 {
     $rules = array();
     $records = CreditRule::model()->fetchAll();
     if (!empty($records)) {
         foreach ($records as $rule) {
             $rule["rulenameuni"] = urlencode(ConvertUtil::iIconv($rule["rulename"], CHARSET, "UTF-8", true));
             $rules[$rule["action"]] = $rule;
         }
     }
     Syscache::model()->modify("creditrule", $rules);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:12,代码来源:CreditRuleCacheProvider.php

示例5: langDecodeMimeString

 public static function langDecodeMimeString($str)
 {
     $a = explode("?", $str);
     $count = count($a);
     if (3 <= $count) {
         $rest = "";
         for ($i = 2; $i < $count; $i++) {
             $rest .= $a[$i];
         }
         if ($a[1] == "B" || $a[1] == "b") {
             $rest = base64_decode($rest);
             $rest = ConvertUtil::iIconv($rest, $a[0]);
             return $rest;
         } else {
             if ($a[1] == "Q" || $a[1] == "q") {
                 $rest = str_replace("_", " ", $rest);
                 return quoted_printable_decode($rest);
             }
         }
     } else {
         return $str;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:23,代码来源:EmailLangUtil.php

示例6: refactor

 private function refactor(&$items, $config, &$max, &$elements)
 {
     foreach ($items as $item) {
         if ($item->hasAttribute("data-type")) {
             $icType = strtolower($item->getAttribute("data-type"));
             if (isset($config[$icType])) {
                 $tag = $item->children(0);
                 if ($tag) {
                     $tagName = $tag->nodeName();
                     $id = intval($item->getAttribute("data-id"));
                     if (!$id) {
                         $itemId = $max + 1;
                         $eName = "data_" . $itemId;
                         $item->setAttribute("data-id", $itemId);
                         foreach ($item->children() as $child) {
                             if (strcasecmp($child->nodeName(), "img") !== 0) {
                                 $child->setAttribute("name", $eName);
                             }
                         }
                     } else {
                         $eName = "data_" . $id;
                         $itemId = $id;
                     }
                     $elements[$eName]["itemid"] = $itemId;
                     $elements[$eName]["tag"] = $tagName;
                     $elementAttrs = $item->getAllAttributes();
                     $content = $item->outertext();
                     foreach ($elementAttrs as $name => $val) {
                         $pattern = "/" . $name . "\\s?=\\s?(\\\"|\\')?" . preg_quote($val, "/") . "(\\\"|\\')?/i";
                         $replacement = $name . "=\"" . $val . "\"";
                         $string = ConvertUtil::iIconv($content, CHARSET, "UTF-8");
                         $content = ConvertUtil::iIconv(preg_replace($pattern, $replacement, $string), "UTF-8", CHARSET);
                         $attrName = strtolower($name);
                         if (in_array($attrName, $this->getSafeItemAttributes())) {
                             $elements[$eName][$attrName] = $val;
                         }
                     }
                     $elements[$eName]["content"] = $item->innertext();
                     $max = $max < $itemId ? $itemId : $max;
                     $item->outertext = "{" . $eName . "}";
                 }
             }
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:45,代码来源:SimpleHtmlParser.php

示例7: makeOrgstructXml

 private function makeOrgstructXml()
 {
     $deptArr = DepartmentUtil::loadDepartment();
     $unit = Ibos::app()->setting->get("setting/unit");
     $str = "<?xml version=\"1.0\" encoding=\"gb2312\" ?>";
     $str .= "<enterprise name=\"" . $unit["fullname"] . "\" postcode=\"" . $unit["zipcode"] . "\" address=\"" . $unit["address"] . "\" phone=\"" . $unit["phone"] . "\" email=\"" . $unit["adminemail"] . "\">";
     $str .= "<departments>";
     $str .= $this->getDeptree($deptArr);
     $str .= "</departments>";
     $str .= "</enterprise>";
     $file = "userdata.xml";
     $fp = @fopen($file, "wb");
     if ($fp) {
         $str = ConvertUtil::iIconv($str, CHARSET, "gbk");
         file_put_contents($file, $str);
         if (0 < filesize($file)) {
             return true;
         }
     }
     return false;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:21,代码来源:ICIMRtx.php

示例8: exportExcel

 public static function exportExcel($id)
 {
     $data = Email::model()->fetchById($id);
     if ($data) {
         $users = UserUtil::loadUser();
         header("Cache-control: private");
         header("Content-type: application/vnd.ms-excel");
         header("Content-Disposition: attachment; filename=" . ConvertUtil::iIconv($data["subject"], CHARSET, "GBK") . "(" . date("Y-m-d") . ").xls");
         //$html = "            <html xmlns:o=\"urn:schemas-microsoft-com:office:office\"\r\n\t\txmlns:x=\"urn:schemas-microsoft-com:office:excel\"\r\n\t\txmlns=\"http://www.w3.org/TR/REC-html40\">\r\n\t\t<head>\r\n\t\t<title></title>\r\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n\t\t</head>\r\n\t\t<body topmargin=\"5\">\r\n\t\t <table border=\"1\" cellspacing=\"1\" width=\"95%\" class=\"small\" cellpadding=\"3\">\r\n\t\t\t<tr style=\"BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;\">\r\n\t\t\t  <td align=\"center\">收件人:</td>\r\n\t\t\t  <td align=\"center\">发件人:</td>\r\n\t\t\t  <td align=\"center\">抄送:</td>\r\n\t\t\t  <td align=\"center\">重要性:</td>\r\n\t\t\t  <td align=\"center\">标题:</td>\r\n\t\t\t  <td align=\"center\">发送时间:</td>\r\n\t\t\t  <td align=\"center\">内容:</td>\r\n\t\t\t  <td align=\"center\">附件名称:</td>\r\n\t\t\t</tr>      ";
         $html = '<html xmlns:o="urn:schemas-microsoft-com:office:office"
     xmlns:x="urn:schemas-microsoft-com:office:excel"
     xmlns="http://www.w3.org/TR/REC-html40">
     <head>
     <title></title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     </head>
     <body topmargin="5">
      <table border="1" cellspacing="1" width="95%" class="small" cellpadding="3">
         <tr style="BACKGROUND: #D3E5FA; color: #000000; font-weight: bold;">
           <td align="center">收件人:</td>
           <td align="center">发件人:</td>
           <td align="center">抄送:</td>
           <td align="center">重要性:</td>
           <td align="center">标题:</td>
           <td align="center">发送时间:</td>
           <td align="center">内容:</td>
           <td align="center">附件名称:</td>
         </tr>';
         $data["toname"] = self::joinStringByArray($data["toids"], $users, "realname", ";");
         $data["content"] = str_replace("  ", "&nbsp;&nbsp;", $data["content"]);
         $data["content"] = str_replace("\n", "<br>", $data["content"]);
         $data["fromname"] = isset($users[$data["fromid"]]) ? $users[$data["fromid"]]["realname"] : "";
         $data["copytoname"] = self::joinStringByArray($data["copytoids"], $users, "realname", ";");
         $important_desc = "";
         if ($data["important"] == "0") {
             $important_desc = "";
         } elseif ($data["important"] == "1") {
             $important_desc = "<font color=\"#ff6600\">一般邮件</font>";
         } elseif ($data["important"] == "2") {
             $important_desc = "<font color=\"#FF0000\">重要邮件</font>";
         }
         $attachmentname = "";
         if ($data["attachmentid"] !== "") {
             $tempdata = AttachUtil::getAttach($data["attachmentid"]);
             foreach ($tempdata as $value) {
                 $attachmentname .= $value["filename"] . "; ";
             }
         }
         $data["sendtime"] = ConvertUtil::formatDate($data["sendtime"]);
         //$html .= "\r\n                <tr>\r\n                    <td nowrap align=\"center\">" . $data["toname"] . "</td>\r\n                    <td nowrap align=\"center\">" . $data["fromname"] . "</td>\r\n                    <td>" . $data["copytoname"] . "</td>\r\n                    <td nowrap align=\"center\">" . $important_desc . "</td>\r\n                    <td nowrap>" . $data["subject"] . "</td>\r\n                    <td nowrap align=\"center\" x:str=\"" . $data["sendtime"] . "\">" . $data["sendtime"] . "</td>\r\n                    <td>" . $data["content"] . "</td>\r\n                    <td>" . $attachmentname . "</td>\r\n                </tr>\r\n            </table>";
         $html .= '<tr>
                     <td nowrap align="center">' . $data["toname"] . '</td>
                     <td nowrap align="center">' . $data["fromname"] . '</td>
                     <td>' . $data["copytoname"] . '</td>
                     <td nowrap align="center">' . $important_desc . '</td>
                     <td nowrap>' . $data["subject"] . '</td>
                     <td nowrap align="center" x:str="' . $data["sendtime"] . '">' . $data["sendtime"] . '</td>
                     <td>' . $data["content"] . '</td>
                     <td>' . $attachmentname . '</td>
                 </tr></table>';
         echo $html;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:63,代码来源:EmailUtil.php


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