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


PHP string::hiconv方法代码示例

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


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

示例1: douniontitle

 function douniontitle()
 {
     @header('Content-type: application/json; charset=' . WIKI_CHARSET);
     $len = strlen('plugin-hdapi-hdapi-uniontitle-');
     $did = substr($_SERVER['QUERY_STRING'], $len);
     $doc = $_ENV["hdapi"]->get_doc_title_by_id($did, 'title');
     if (!isset($doc['title'])) {
         exit;
     }
     $is_private_title = $_ENV['hdapi']->is_private_title($doc['title']);
     if (!empty($is_private_title)) {
         exit;
     }
     $uniontitle = $_ENV["hdapi"]->get_uniontitle_by_did($did);
     if (empty($uniontitle)) {
         $uniontitle = $_ENV["hdapi"]->get_tit_url($doc['title']);
         if (isset($uniontitle['docdeclaration']) && strtolower(WIKI_CHARSET) == 'gbk') {
             $uniontitle['docdeclaration'] = string::hiconv($uniontitle['docdeclaration'], 'gbk', 'utf-8');
         }
         if (!empty($uniontitle['docdeclaration'])) {
             $_ENV["hdapi"]->save_uniontitle_by_did($did, $uniontitle['docdeclaration']);
         }
     }
     if (is_array($uniontitle) && isset($uniontitle['docdeclaration'])) {
         $uniontitle = $uniontitle['docdeclaration'];
     } else {
         $uniontitle = '';
     }
     echo $uniontitle;
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:30,代码来源:hdapi.php

示例2: doadd

 /**
 添加、编辑参考资料
 编辑操作被整合到了add当中,由$_ENV['reference']->add()实现,
 如果 $data 当中包含 id 信息则执行edit操作,否则执行add操作。
 */
 function doadd()
 {
     if ($this->get[2] == 'checkable') {
         if ($this->checkable('reference-add')) {
             if ($this->setting['doc_verification_reference_code']) {
                 exit('CODE');
             } else {
                 exit('OK');
             }
         } else {
             exit('0');
         }
     }
     $data = $this->post['data'];
     //检查验证码
     if ($this->setting['checkcode'] != 3 && $this->setting['doc_verification_reference_code'] && strtolower($data['code']) != $_ENV['user']->get_code()) {
         exit('code.error');
     }
     if (WIKI_CHARSET == 'GBK') {
         $data['name'] = string::hiconv($data['name']);
     }
     if (empty($data['name'])) {
         exit('0');
     }
     $insert_id = $_ENV['reference']->add($data);
     if (is_int($insert_id)) {
         echo $insert_id;
     } else {
         echo $insert_id ? '1' : '0';
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:36,代码来源:reference.php

示例3: dolist

 function dolist()
 {
     $page = !empty($this->get[2]) && is_numeric($this->get[2]) ? $this->get[2] : 1;
     $num = !empty($this->get[3]) && is_numeric($this->get[3]) ? $this->get[3] : 50;
     if ($page < 1) {
         $page = 1;
     }
     $doclist = array();
     $count = $_ENV['archiver']->get_total_num();
     if (0 < $count) {
         // 获得词条最大ID
         $maxdid = $_ENV['archiver']->get_max_did();
         $doclist = $_ENV['archiver']->get_doc_list(array('page' => $page, 'num' => $num));
         // 分页数据
         $totalpage = ceil($count / $num);
         $outhtml = $_ENV['archiver']->get_html_list($doclist, $totalpage, $num, $count, $maxdid);
     } else {
         $outhtml = $_ENV['archiver']->get_html_header() . 'No Body! No Body!' . $_ENV['archiver']->get_html_footer();
     }
     if ('gbk' == strtolower(WIKI_CHARSET)) {
         $outhtml = string::hiconv($outhtml, 'utf-8', 'gbk');
     }
     $_ENV['archiver']->close_mysql();
     echo $outhtml;
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:25,代码来源:archiver.php

示例4: doedit

 function doedit()
 {
     if (!isset($this->post['editsubmit'])) {
         $did = isset($this->get[2]) ? $this->get[2] : '';
         if (!is_numeric($did)) {
             $this->message($this->view->lang['docIdMustNum'], 'BACK');
         }
         $focus = $this->db->fetch_by_field('focus', 'did', $did);
         $focus['time'] = $this->date($focus['time']);
         $this->view->assign("focus", $focus);
         $this->view->display("admin_focus_content");
     } else {
         $did = isset($this->post['did']) ? $this->post['did'] : '';
         if (!is_numeric($did)) {
             $this->message($this->view->lang['docIdMustNum'], 'BACK');
         }
         $summary = string::hiconv($this->post['summary']);
         $image = string::hiconv($this->post['image']);
         $order = $this->post['displayorder'];
         $type = $this->post['doctype'];
         if (is_numeric($order) && $_ENV['doc']->save_focus_content($did, $summary, $image, $order, $type)) {
             $this->cache->removecache('data_' . $GLOBALS['theme'] . '_index');
             $this->message($this->view->lang['docEditSuccess'], "index.php?admin_focus-edit-{$did}");
         } else {
             $this->message($this->view->lang['docEditFail'], 'BACK');
         }
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:28,代码来源:admin_focus.php

示例5: edit_marker

 function edit_marker($did, $marker)
 {
     if ('gbk' == strtolower(WIKI_CHARSET)) {
         $marker['title'] = string::hiconv($marker['title'], 'gbk', 'utf-8');
         $marker['description'] = string::hiconv($marker['description'], 'gbk', 'utf-8');
     }
     $this->db->query("REPLACE INTO " . DB_TABLEPRE . "googlemap (`did`,`title`,`description`,`lat`,`lng`,`zoom`,`created`) values \n    \t\t({$did}, '{$marker['title']}', '{$marker['description']}', '{$marker['lat']}', '{$marker['lng']}', '{$marker['zoom']}', {$this->base->time});");
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:8,代码来源:googlemap.class.php

示例6: doedit

 function doedit()
 {
     $regularname = string::hiconv(trim($this->post['regularname']));
     $regularexpr = trim($this->post['regularexpr']);
     $regulargroupid = $this->post['regulargroupid'];
     $regulargroupid = is_numeric($regulargroupid) ? intval($regulargroupid) : 0;
     $regularname = string::hiconv($regularname);
     $_ENV['regular']->edit_regular($regularname, $regularexpr, $regulargroupid, $this->post['id']);
     $this->message($this->view->lang['regularEditSuccess'], 'index.php?admin_regular');
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:10,代码来源:admin_regular.php

示例7: image

 function image($srcfile, $targetfile, $settingnew = '')
 {
     $watermarks = is_array($settingnew) ? $settingnew : unserialize($this->base->setting['watermark']);
     foreach ($watermarks as $key => $value) {
         $this->{$key} = $value;
     }
     if ($this->watermarktype == 2 && WIKI_CHARSET == 'GBK') {
         $this->watermarktext['text'] = string::hiconv($this->watermarktext['text'], 'utf-8', 'gbk');
     }
     if ($this->watermarkstatus == '0') {
         return false;
     }
     $this->imageimpath = $this->formaturl(urldecode($this->imageimpath));
     $this->watermarktext['fontpath'] = './style/default/' . $this->watermarktext['fontpath'];
     $this->srcfile = strpos($srcfile, HDWIKI_ROOT) !== false ? realpath(HDWIKI_ROOT . $srcfile) : $srcfile;
     $this->targetfile = strpos($targetfile, HDWIKI_ROOT) !== false ? realpath(HDWIKI_ROOT . $targetfile) : $targetfile;
     $this->attachinfo = @getimagesize($this->srcfile);
     $this->attach['size'] = @filesize($this->srcfile);
     if (!$this->imagelib || !$this->imageimpath) {
         //gd库
         switch ($this->attachinfo['mime']) {
             case 'image/jpeg':
                 $this->imagecreatefromfunc = function_exists('imagecreatefromjpeg') ? 'imagecreatefromjpeg' : '';
                 $this->imagefunc = function_exists('imagejpeg') ? 'imagejpeg' : '';
                 break;
             case 'image/gif':
                 $this->imagecreatefromfunc = function_exists('imagecreatefromgif') ? 'imagecreatefromgif' : '';
                 $this->imagefunc = function_exists('imagegif') ? 'imagegif' : '';
                 break;
             case 'image/png':
                 $this->imagecreatefromfunc = function_exists('imagecreatefrompng') ? 'imagecreatefrompng' : '';
                 $this->imagefunc = function_exists('imagepng') ? 'imagepng' : '';
                 break;
         }
     } else {
         //imagemagick
         $this->imagecreatefromfunc = $this->imagefunc = TRUE;
     }
     if ($this->attachinfo['mime'] == 'image/gif') {
         if ($this->imagecreatefromfunc && !@imagecreatefromgif($srcfile)) {
             //imagemagick并且返回gif图片失败
             return FALSE;
         }
         $fp = fopen($srcfile, 'rb');
         $targetfilecontent = fread($fp, $this->attach['size']);
         fclose($fp);
         $this->animatedgif = strpos($targetfilecontent, 'NETSCAPE2.0') === FALSE ? 0 : 1;
         //判断是静态还是动态
     }
     if ($this->watermarkminwidth && $this->attachinfo[0] <= $this->watermarkminwidth && $this->watermarkminheight && $this->attachinfo[1] <= $this->watermarkminheight || $this->watermarktype == 2 && (!file_exists($this->watermarktext['fontpath']) || !is_file($this->watermarktext['fontpath']))) {
         return false;
     }
     return $this->imagelib && $this->imageimpath ? $this->Watermark_IM() : $this->Watermark_GD();
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:54,代码来源:watermark.class.php

示例8: dodefault

 function dodefault()
 {
     $len = strlen('plugin-momo-momo-default-');
     $title = substr($_SERVER['QUERY_STRING'], $len);
     $title = urldecode($title);
     $title = trim($title);
     $title2 = $title;
     $title = urldecode($title);
     if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
         $title = string::hiconv($title, $to = 'gbk', $from = 'utf-8');
     }
     $doc = $_ENV['momo']->get_doc_by_title($title);
     if ($doc) {
         $doc['image'] = util::getfirstimg($doc['content']);
         $momourl = trim($this->plugin[momo][vars][momourl]);
         if ($momourl) {
             $doc['url'] = $momourl . "index.php?doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
         } else {
             $doc['url'] = $this->setting['site_url'] . "/" . $this->setting['seo_prefix'] . "doc-view-" . $doc['did'] . $this->setting['seo_suffix'];
         }
         $doc_exists = 1;
     } else {
         $url = 'http://www.hudong.com/validateDocSummary.do?doc_title=' . $title2;
         $data = util::hfopen($url);
         $doc_exists = 1;
         if ($data && stripos($data, '<flag>true</flag>') && preg_match_all("/<\\!\\[CDATA\\[(.*)\\]\\]>/", $data, $matches)) {
             $summary = $matches[1][1];
             $image = $matches[1][2];
             if ($summary == 'null') {
                 $summary = '';
             }
             if ($image == 'null') {
                 $image = '';
             }
             if (string::hstrtoupper(WIKI_CHARSET) == 'GBK') {
                 $summary = string::hiconv($summary, $to = 'gbk', $from = 'utf-8');
             }
             $doc = array('image' => $image, 'url' => 'http://www.hudong.com/wiki/' . $title, 'summary' => $summary);
         } else {
             $doc_exists = 0;
         }
     }
     $this->view->assign("doc_exists", $doc_exists);
     $this->view->assign("doc", $doc);
     $this->view->assign("encode", WIKI_CHARSET);
     $this->view->assign("title", $title);
     $this->view->display('file://plugins/momo/view/momo');
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:48,代码来源:momo.php

示例9: create_doc_page

 /**
  * 创建分页的词条 sitemap. 有剩余返回当前offset,无剩余返回false
  *
  * @return mixed
  */
 function create_doc_page()
 {
     //获取上次创建分页;
     $current_page = $this->_lastpage_get();
     //如果实际总分页小于当前分页(生成sitemap后又删除一些词条的情况下),则当前页=总分页。
     $rs = $this->db->fetch_first("SELECT count(did) as count_id from " . DB_TABLEPRE . "doc where visible = 1");
     $total_page = empty($rs['count_id']) ? 0 : floor($rs['count_id'] / 1000);
     if ($total_page < $current_page) {
         $current_page = $total_page;
     }
     $current_offset = $current_page * 1000;
     $query = $this->db->query("SELECT did, title, lastedit FROM " . DB_TABLEPRE . "doc where visible = 1 order by did asc limit {$current_offset}, 1000");
     $this->_sitemap_start_new();
     $doc = array();
     $page_last_did = 0;
     while ($row = $this->db->fetch_array($query)) {
         $doc_id = '1' == $this->base->setting['seo_type'] && '1' == $this->base->setting['seo_type_doc'] ? rawurlencode(string::hiconv($row['title'])) : $row['did'];
         $doc['loc'] = WIKI_URL . '/' . $this->base->view->url("doc-view-{$doc_id}");
         $doc['lastmod'] = gmdate('Y-m-d\\TH:i:s+00:00', $row['lastedit']);
         $doc['changefreq'] = $this->setting['doc_changefreq'];
         //////////////////
         $doc['priority'] = "0.8";
         ////////////////
         $this->_sitemap_add_item($doc);
         $page_last_did = $row['did'];
     }
     $this->_sitemap_end_save('sitemap_doc_' . $current_page);
     if ($this->db->affected_rows() < 1000) {
         //如果当前不足一页(每页1000条),则记录最后页为当前页,下次更新继续以当前页更新。
         $this->_lastpage_log($current_page);
     } else {
         //否则记录下次更新以下页开始更新。
         $this->_lastpage_log($current_page + 1);
     }
     $rs = $this->db->fetch_first("SELECT max(did) as max_id from " . DB_TABLEPRE . "doc where visible = 1");
     if (!empty($rs['max_id']) && $page_last_did < $rs['max_id']) {
         //如果当前页最后一条的did小于数据库中的最大did,则表示尚未完毕
         return $current_offset;
     } else {
         //如果是最后,创建索引页
         $this->_create_index();
         return false;
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:49,代码来源:sitemap.class.php

示例10: dosavesynonym

 function dosavesynonym()
 {
     $destdid = $this->post['destdid'];
     if (!is_numeric($destdid)) {
         exit;
     }
     $synonyms = array();
     foreach ($this->post['srctitles'] as $srctitle) {
         $srctitle = htmlspecialchars(string::haddslashes(string::hiconv(trim($srctitle))));
         if ('' != $srctitle) {
             $synonyms[] = $srctitle;
         }
     }
     $desttitle = trim($this->post['desttitle']);
     if (WIKI_CHARSET == 'GBK') {
         $desttitle = string::hiconv($desttitle);
     }
     if (empty($synonyms)) {
         $_ENV['synonym']->removesynonym($destdid);
         exit("empty");
     }
     $srctitles = $synonyms;
     $filter = $_ENV["synonym"]->is_filter($srctitles, $desttitle);
     if ($filter[0] < 0) {
         echo $filter[0];
         exit;
     }
     if (is_array($srctitles) && !empty($desttitle)) {
         $num = $_ENV['synonym']->savesynonym($destdid, $desttitle, $srctitles);
         if ($num > 0) {
             $synonyms_list = $_ENV['synonym']->get_synonym_by_dest($destdid, '');
             $str = '';
             for ($i = 0; $i < count($synonyms_list); $i++) {
                 $str .= "<a href='index.php?doc-innerlink-" . urlencode($synonyms_list[$i]['srctitle']) . "' name='synonym'> " . $synonyms_list[$i]['srctitle'] . "</a>";
             }
             exit($str);
         } else {
             exit('0');
         }
     } else {
         echo $filter[0];
         exit;
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:44,代码来源:synonym.php

示例11: doadd

 function doadd()
 {
     if (!isset($this->post['submit'])) {
         $this->view->display('admin_addgift');
     } else {
         $title = htmlspecialchars(string::haddslashes(string::hiconv(trim($this->post['title']))));
         $credit = trim($this->post['credit']);
         $description = htmlspecialchars(string::haddslashes(string::hiconv(trim($this->post['description']))));
         $imgname = $_FILES['giftfile']['name'];
         $extname = file::extname($imgname);
         $destfile = 'uploads/gift/' . util::random(8) . '.' . $extname;
         $uploadreturn = file::uploadfile($_FILES['giftfile'], $destfile);
         util::image_compress($destfile, '', 500, 500, '');
         $iamge = util::image_compress($destfile, '', 106, 106, '_s');
         $destfile = $iamge['tempurl'];
         if ($uploadreturn['result'] === false) {
             $this->message($uploadreturn['msg'], 'index.php?admin_gift-search');
         }
         $_ENV['gift']->add($title, $destfile, $credit, $description);
         $this->message($this->view->lang['usermanageOptSuccess'], 'index.php?admin_gift-search');
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:22,代码来源:admin_gift.php

示例12: get_html_view

 function get_html_view($doc)
 {
     if (!empty($doc)) {
         $outxml = '';
         if ('gbk' == strtolower(WIKI_CHARSET)) {
             $transition = 1;
         } else {
             $transition = 0;
         }
         foreach ($doc as $k => $v) {
             if ($transition) {
                 $v = string::hiconv($v, 'utf-8', 'gbk', 1);
             }
             $outxml .= "<{$k}><![CDATA[" . $v . "]]></{$k}>\n";
         }
     } else {
         $outxml = 'No Body! No Body!';
     }
     return $this->get_xml_header() . $outxml . $this->get_xml_footer();
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:20,代码来源:archiver.class.php

示例13: doreport

 function doreport()
 {
     $usernames = array();
     $id = $this->post['id'];
     $report = trim(htmlspecialchars(WIKI_CHARSET == GBK ? string::hiconv($this->post['report']) : $this->post['report']));
     if (empty($id) || empty($report)) {
         $this->message(-1, '', 2);
     }
     $users = $_ENV["user"]->get_users('groupid', 4);
     if (!(bool) $users) {
         $this->message(-2, '', 2);
     } else {
         foreach ($users as $user) {
             $usernames[] = $user['username'];
         }
     }
     $sendto = join(',', $usernames);
     $subject = $this->view->lang['commentReportObj'];
     if ($this->user['uid'] == '0') {
         $from = $this->ip;
     } else {
         $from = $this->user['username'];
     }
     $comment = $this->db->fetch_by_field('comment', 'id', $id);
     if (!(bool) $comment) {
         $this->message(-1, '', 2);
     }
     $doc = $this->db->fetch_by_field('doc', 'did', $comment['did']);
     $report = $this->view->lang['commentCom'] . $this->view->lang['commentUser'] . $comment['author'] . '<br/>' . $this->view->lang['commentCom'] . $this->view->lang['commentTime'] . $this->date($comment['time']) . "<br/>" . $this->view->lang['commentId'] . $comment['id'] . '<br/>' . $this->view->lang['commentsDocTitle'] . $doc['title'] . "<br/>" . $this->view->lang['commentContent'] . $comment['comment'] . '<br/>' . $this->view->lang['commentReportReason'] . $report;
     $sendarray = array('sendto' => $sendto, 'subject' => $subject, 'content' => $report, 'isdraft' => 1, 'user' => $this->user);
     $_ENV['pms']->send_ownmessage($sendarray);
     $this->message(1, '', 2);
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:33,代码来源:comment.php

示例14: save

 function save($did, &$titlelist)
 {
     if (empty($titlelist)) {
         return;
     }
     //词条列表和同义词列表
     $doclist = $this->_getdoc($titlelist);
     $synonymlist = $this->_getsynonym($titlelist);
     $sql = "insert INTO " . DB_TABLEPRE . "innerlinkcache (`did`,`title`,`titleid`)VALUES";
     $data = array();
     foreach ($titlelist as $key => $title) {
         $title2 = urlencode($title);
         $titleid = isset($doclist[$title2]) ? $doclist[$title2] : 0;
         if (!$titleid) {
             $titleid = isset($synonymlist[$title2]) ? -1 : 0;
         }
         $data[] = "('{$did}','{$title}','{$titleid}')";
         $title2 = 'gbk' == strtolower(WIKI_CHARSET) ? string::hiconv($title, 'utf-8', 'gbk') : $title;
         $title2 = urlencode($title2);
         $this->titles[$title2][0] = $titleid;
     }
     $sql .= implode(',', $data);
     $this->db->query($sql);
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:24,代码来源:innerlink.class.php

示例15: dosave

 function dosave()
 {
     $synonym = str_replace(array("\n", "\r"), ' ', string::hiconv(trim($this->post['synonym']), '', '', true));
     if (empty($synonym)) {
         $this->message($_ENV["synonym"]->encode_data(array(-1, '')), '', 2);
     }
     if (count(explode(',', $synonym)) > 10) {
         $this->message($_ENV["synonym"]->encode_data(array(-8, '')), '', 2);
     }
     $srctitles = array_unique(explode(',', $synonym));
     $returnsyn = stripslashes(implode(',', $srctitles));
     $i = false;
     if (isset($this->post['destdid'])) {
         $destdid = $this->post['destdid'];
         if (!is_numeric($destdid)) {
             $this->message($_ENV["synonym"]->encode_data(array(-1, '')), '', 2);
         }
         $doc = $this->db->fetch_by_field('doc', 'did', $destdid);
         $desttitle = addslashes($doc['title']);
         $i = true;
     } elseif (isset($this->post['desttitle'])) {
         $desttitle = string::hiconv(trim($this->post['desttitle']), '', '', true);
         if ($doc = $this->db->fetch_by_field('doc', 'title', $desttitle)) {
             $destdid = $doc['did'];
         } else {
             $this->message($_ENV["synonym"]->encode_data(array(-7, $desttitle)), '', 2);
         }
     } else {
         $this->message($_ENV["synonym"]->encode_data(array(-1, '')), '', 2);
     }
     $filter = $_ENV["synonym"]->is_filter($srctitles, $desttitle, !$i);
     if ($filter[0] < 0) {
         $this->message($_ENV["synonym"]->encode_data($filter), '', 2);
     }
     if ($_ENV["synonym"]->savesynonym($destdid, $desttitle, $srctitles)) {
         if ($i) {
             $this->message($_ENV["synonym"]->encode_data(array(1, $returnsyn)), '', 2);
         }
         $this->message($_ENV["synonym"]->encode_data(array(1, $desttitle, $doc['author'], $this->date($doc['time']), $destdid, $returnsyn)), '', 2);
     } else {
         $this->message($_ENV["synonym"]->encode_data(array(-1, '')), '', 2);
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:43,代码来源:admin_synonym.php


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