本文整理汇总了PHP中string::convercharacter方法的典型用法代码示例。如果您正苦于以下问题:PHP string::convercharacter方法的具体用法?PHP string::convercharacter怎么用?PHP string::convercharacter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类string
的用法示例。
在下文中一共展示了string::convercharacter方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sharetosns
function sharetosns($did, $content, $op)
{
$doc = $_ENV['hdapi']->get_doc_title_by_id($did, 'title, summary');
$title = $doc['title'];
$summary = trim($doc['summary']);
if (empty($summary)) {
$doc = $_ENV['hdapi']->get_doc_title_by_id($did, 'content');
$summary = trim(strip_tags($doc['content']));
$summary = substr($summary, 0, 250);
}
$appkey = $this->base->setting['site_appkey'];
if ('gbk' == strtolower(WIKI_CHARSET)) {
$title = string::hiconv($title, 'utf-8', 'gbk');
$summary = string::hiconv($summary, 'utf-8', 'gbk');
$content = string::hiconv($content, 'utf-8', 'gbk');
}
$summary = string::convercharacter($summary);
$link = urlencode(WIKI_URL . '/?doc-innerlink-' . urlencode($title));
$rows = $this->db->fetch_first("SELECT attachment FROM " . DB_TABLEPRE . "attachment WHERE did='{$did}' and isimage=1 order by id desc limit 1");
if (!empty($rows)) {
if (strpos($rows['attachment'], '_') === false) {
$rows['attachment'] = str_replace('.', '_140.', $rows['attachment']);
if (is_file(HDWIKI_ROOT . '/' . $rows['attachment'])) {
$pic = urlencode(WIKI_URL . '/' . $rows['attachment']);
} else {
$pic = '';
}
}
} else {
$pic = '';
}
$post = 'op=' . $op . '&appkey=' . $appkey . '&url=' . $link . '&title=' . urlencode($title) . '&content=' . urlencode($content) . '&pic=' . $pic . '&summary=' . urlencode($summary);
$data = $this->hfopen(SNS_SHARE_URL, 0, $post);
$obj = $_ENV['hdapi']->unjson($data);
return $obj;
}
示例2: doimport
function doimport()
{
$title = string::hiconv($this->post['title']);
$data = $_ENV['doc']->get_doc_by_title($title);
$page = $this->cache->getcache('systemdata');
if (empty($page)) {
$page = 1;
}
$_ENV['hdapi']->roll_docs($page, 10);
$this->cache->writecache('systemdata', ++$page);
if ($data) {
$this->message(0, '', 2);
}
$doc['content'] = $_ENV['hdapi']->get_content_import($title, 2, true);
$doc['tags'] = array($title);
$doc['search_tags'] = $title;
if ($doc['content'] && is_string($doc['content'])) {
$doc['category'] = $this->post['cid'];
$doc['title'] = $title;
$doc['letter'] = string::getfirstletter($title);
$doc['content'] = mysql_real_escape_string($doc['content']);
$doc['content'] = str_replace('\\r\\n', "\r\n", $doc['content']);
$doc['tags'] = $_ENV['doc']->jointags($doc['tags']);
$doc['summary'] = trim(string::convercharacter(strip_tags($doc['content'])));
$doc['images'] = util::getimagesnum($doc['content']);
$doc['time'] = $this->time;
$doc['words'] = string::hstrlen($doc['content']);
$doc['visible'] = '1';
//$this->setting['verify_doc']?'0':'1';
$did = $_ENV['doc']->add_doc($doc);
$_ENV['doc']->add_searchindex($did, $doc['title'], $doc['search_tags'], $doc['content']);
$_ENV['user']->add_credit($this->user['uid'], 'doc-create', $this->setting['credit_create']);
$_ENV['user']->update_field('creates', $this->user['creates'] + 1, $this->user['uid']);
$_ENV['category']->update_category_docs($this->post['category']);
//$data = array('did'=>$did, 'name'=>'互动百科 '.$title, 'url'=>'http://www.hudong.com/wiki/'.urlencode($this->post['title']));
//$_ENV['reference']->add($data);
$this->message(1, '', 2);
} else {
if ($doc['content'] && is_array($doc['content'])) {
$this->message($doc['content']['return_type'] . '_' . $doc['content']['return_info'], '', 2);
} else {
$this->message(2, '', 2);
}
}
}
示例3: set_focus_doc
function set_focus_doc($dids, $doctype)
{
$doclist = $this->get_doc_by_ids($dids);
foreach ($doclist as $key => $doc) {
$title = string::haddslashes($doc['rawtitle'], 1);
$tag = string::haddslashes($this->jointags($doc['tag']), 1);
if ($doctype == 2) {
$summary = trim(string::convercharacter(string::substring(strip_tags($doc['content']), 0, 30)));
} elseif ($doctype == 3) {
$summary = trim(string::convercharacter(string::substring(strip_tags($doc['content']), 0, 80)));
} else {
$summary = trim(string::convercharacter(string::substring(strip_tags($doc['content']), 0, 100)));
}
$summary = string::haddslashes($summary, 1);
$image = $this->setfocusimg(util::getfirstimg($doc['content']));
$this->db->query("REPLACE INTO " . DB_TABLEPRE . "focus (did,title,tag,summary,image,time,type)VALUES (" . $doc['did'] . ",'{$title}','{$tag}','{$summary}','{$image}','" . $this->base->time . "','{$doctype}')");
}
return true;
}
示例4: doimport
function doimport()
{
//global $wmdb;
if (file_exists($this->configfile) && file_exists($this->sumfile)) {
include $this->configfile;
include $this->sumfile;
} else {
$this->message('5|0', '', 2);
}
$this->wmdb = new hddb(WDB_HOST, WDB_USER, WDB_PW, WDB_NAME, WDB_CHARSET, WDB_CONNECT);
//$wmdb = $this->wmdb;
//判断做到哪一步了.
if (file_exists($this->processfile)) {
include $this->processfile;
list($type, $i) = explode('|', $process);
if ($type >= 5) {
$this->message('5|0', '', 2);
}
} else {
list($type, $i) = array(1, 0);
}
$totalnum = array(1 => $catsum, 2 => $usersum, 3 => $docsum, 4 => $clinksum);
$totalnum = $totalnum[$type];
$j = 10;
for (; $i < $totalnum; $i += $j) {
$msg = $type . '|' . (($n = $i + $j) >= $totalnum ? $totalnum : $n);
if ($type == 1 || $type == 2 || $type == 4) {
//导入分类和用户。
$hdsql = $_ENV['mwimport']->get_sql($this->wmdb, $type, $i, $j);
if (!$hdsql || $this->db->query($hdsql)) {
$_ENV['mwimport']->writefile($this->processfile, '<?php $process = "' . $msg . '"; ?>');
} else {
$this->message('5|0', '', 2);
}
} elseif ($type == 3) {
include HDWIKI_ROOT . '/plugins/mwimport/text/Mediawiki.php';
$parser = 'Mediawiki';
$text_wiki = new Text_Wiki_Mediawiki();
$sql = "SELECT a.page_id, a.page_title, b.old_text, b.old_flags, b.old_id FROM " . WDB_TABLEPRE . "page a, " . WDB_TABLEPRE . "text b WHERE a.page_namespace = 0 AND a.page_latest = b.old_id limit " . $i . ",{$j}";
$query = $this->wmdb->query($sql);
while ($doc = $this->wmdb->fetch_array($query)) {
if ($_ENV['doc']->get_doc_by_title($doc['page_title'])) {
continue;
}
$doc['did'] = $doc['page_id'];
$doc['title'] = $doc['page_title'];
$doc['letter'] = string::getfirstletter($doc['page_title']);
$wiki = $text_wiki->singleton($parser);
$result = $wiki->transform($source);
$doc['old_text'] = $wiki->transform($doc['old_text']);
//加入对内容的处理和过滤。
$doc['old_text'] = mysql_real_escape_string($doc['old_text']);
$doc['tags'] = '';
$doc['summary'] = trim(string::convercharacter(string::substring(strip_tags($doc['old_text']), 0, 100)));
$doc['images'] = util::getimagesnum($doc['old_text']);
$doc['time'] = $this->time;
$doc['words'] = string::hstrlen($doc['old_text']);
$doc['visible'] = '1';
$doc['cid'] = $_ENV['mwimport']->get_cid($this->wmdb, '', $doc['did']);
$sql = "SELECT rev_user,rev_user_text FROM " . WDB_TABLEPRE . "revision WHERE rev_page = " . $doc['page_id'] . " ORDER BY rev_id ";
$user = $this->wmdb->fetch_first($sql);
$this->db->query("REPLACE INTO " . DB_TABLEPRE . "doc\r\n\t\t\t (did,cid,letter,title,tag ,summary ,content,author,authorid,time,lastedit,lasteditor,lasteditorid,visible,editions)\r\n\t\t\t VALUES (" . $doc['did'] . "," . $doc['cid'] . ",'" . $doc['letter'] . "','" . $doc['title'] . "','" . $doc['tags'] . "','" . $doc['summary'] . "','" . $doc['old_text'] . "',\r\n\t\t\t '" . $user['rev_user_text'] . "','" . $user['rev_user'] . "',\r\n\t\t\t " . $doc['time'] . "," . $doc['time'] . ",'" . $user['rev_user_text'] . "','" . $user['rev_user'] . "','" . $doc['visible'] . "',1)");
}
$_ENV['mwimport']->writefile($this->processfile, '<?php $process = "' . $msg . '"; ?>');
}
$this->message($msg, '', 2);
}
$msg = $type + 1 . '|0';
$_ENV['mwimport']->writefile($this->processfile, '<?php $process = "' . $msg . '"; ?>');
$this->message($msg, '', 2);
}
示例5: doeditsection
function doeditsection()
{
$this->_anti_copy();
if (4 != $this->user['groupid'] && $this->time - $this->user['regtime'] < $this->setting['forbidden_edit_time'] * 60) {
$this->message($this->view->lang['editTimeLimit1'] . $this->setting['forbidden_edit_time'] . $this->view->lang['editTimeLimit2'], 'BACK', 0);
}
if ('0' === $this->user['checkup']) {
$this->message($this->view->lang['createDocTip17'], 'BACK', 0);
}
@($did = isset($this->get[2]) ? $this->get[2] : $this->post['did']);
@($id = isset($this->get[3]) ? $this->get[3] : $this->post['section_id']);
if (!is_numeric($did) || !is_numeric($id)) {
$this->message($this->view->lang['parameterError'], 'index.php', 0);
}
$doc = $this->db->fetch_by_field('doc', 'did', $did);
//eval($this->plugin['hdapi']['hooks']['readcontent']);
$this->load("hdapi");
if ($this->setting['site_nick'] && $this->setting["hdapi_bklm"]) {
if ($_ENV["hdapi"]->islock($doc["title"])) {
$doc["locked"] = 1;
$this->message("该词条正在被百科联盟网站锁定编辑中", "BACK", 0);
} else {
$_ENV["hdapi"]->lock($doc["title"]);
$content = $_ENV["hdapi"]->get_content($doc["title"]);
if (is_string($content) && !empty($content)) {
$doc["content"] = $content;
}
}
}
if (!(bool) $doc) {
$this->message($this->view->lang['docNotExist'], 'index.php', 0);
}
if ($doc['visible'] == '0' && !$this->checkable('admin_doc-audit')) {
$this->message($this->view->lang['viewDocTip4'], 'index.php', 0);
}
if (!isset($this->post['publishsubmit'])) {
$editlockuid = $_ENV['doc']->iseditlocked($did);
if ($editlockuid != 0 && $editlockuid != $this->user['uid']) {
$this->message($this->view->lang['viewDocTip5'] . $this->view->lang['viewDocTip6'], 'BACK', 0);
}
if ($doc['locked']) {
$this->header("doc-view-" . $doc['did'] . "-locked");
}
$array_section = $_ENV['doc']->splithtml($doc['content']);
if (!isset($array_section[$id + 1]['value'])) {
$this->header('doc-edit-' . $did);
}
//$doc['tag']=$_ENV['doc']->spilttags($doc['tag']);
$doc['content'] = $array_section[$id + 1]['value'];
$this->view->assign("savetime", 60000);
$ramus = isset($this->get[4]) ? $this->get[4] : '';
$autosave = $_ENV['doc']->is_autosave($this->user['uid'], $doc['did']);
if ((bool) $autosave) {
if ($ramus) {
$doc['content'] = $autosave['content'];
} else {
$autosave['content'] = str_replace(array("\r\n", "\r", "\n"), "", addslashes($autosave['content']));
$autosave['showtime'] = $this->date($autosave['time']);
$this->view->assign("autosave", $autosave);
}
}
$doc['content'] = $this->setting['auto_picture'] ? $_ENV['doc']->auto_picture($doc['content'], $did) : $doc['content'];
$doc['title'] = $doc['title'] . "-" . $array_section[$id]['value'];
$doc['section_id'] = $id;
$this->view->assign('navtitle', $doc['title'] . '-' . $this->view->lang['editionEdit'] . '-');
$this->view->assign("page_action", "editsection");
$doc = str_replace("&", "&", $doc);
$doc['title'] = htmlspecialchars(stripslashes($doc['title']));
$this->view->assign("doc", $doc);
$this->view->assign("doc_verification_edit_code", $this->setting['checkcode'] != 3 && $this->setting['doc_verification_edit_code']);
$this->view->assign('g_img_big', $this->setting['img_width_big']);
$this->view->assign('g_img_small', $this->setting['img_width_small']);
//$this->view->display("editor");
$_ENV['block']->view('editor');
} else {
if ($this->setting['checkcode'] != 3 && $this->setting['doc_verification_edit_code'] && strtolower($this->post['code']) != $_ENV['user']->get_code()) {
$this->message($this->view->lang['codeError'], 'BACK', 0);
}
if (trim($this->post['content']) == "") {
$this->message($this->view->lang['contentIsNull'], 'BACK', 0);
}
$tem = $_ENV['doc']->splithtml($doc['content']);
$tem[$id + 1]['value'] = $_ENV['doc']->replace_danger_word(stripcslashes($this->post['content']));
$doc['content'] = string::haddslashes(string::stripscript($_ENV['doc']->joinhtml($tem)), 1);
//$doc['tags']=$_ENV['doc']->jointags($this->post['tags']);
$doc['tags'] = $this->post['tags'];
$doc['tags'] = $_ENV['doc']->replace_danger_word($doc['tags']);
$doc['summary'] = trim(strip_tags($_ENV['doc']->replace_danger_word($this->post['summary'])));
$doc['summary'] = (bool) $doc['summary'] ? $doc['summary'] : $doc['content'];
$doc['summary'] = trim(string::convercharacter(string::substring(strip_tags($doc['summary']), 0, 100)));
$doc['images'] = util::getimagesnum($doc['content']);
$doc['time'] = $this->time;
$doc['visible'] = $this->setting['verify_doc'] ? '0' : '1';
$doc['words'] = string::hstrlen($doc['content']);
$doc['reason'] = htmlspecialchars(trim(implode(',', $this->post['editreason']), ' \\t\\n,'));
/*foreach($this->post['tags'] as $search_tags){
$doc['search_tags'] .=string::convert_to_unicode($search_tags).";";
} */
if (!$_ENV['doc']->check_submit_interval($this->user['uid'])) {
if ($this->setting['save_spam']) {
//.........这里部分代码省略.........