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


PHP string::getfirstletter方法代码示例

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


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

示例1: input_db_docs

 function input_db_docs($str, $cid)
 {
     $docs = explode($this->exploder, $str);
     $num = array('all' => 0, 'in' => 0);
     $num['all'] = count($docs) - 1;
     $time = time();
     if (is_array($docs)) {
         foreach ($docs as $doc) {
             if ($doc) {
                 $sql = "SELECT * FROM `" . DB_TABLEPRE . "doc` WHERE title='{$doc}'";
                 if (!is_array($this->db->fetch_first($sql))) {
                     $letter = string::getfirstletter($doc);
                     $author = $this->base->user['username'];
                     $authorid = $this->base->user['uid'];
                     $sql = "INSERT INTO `" . DB_TABLEPRE . "doc` (`cid`,`letter`,`title`,`author`,`authorid`,`time`,`lastedit`,`lasteditor`) VALUES ('{$cid}','{$letter}','{$doc}','{$author}','{$authorid}','{$time}','{$time}','{$author}')";
                     $this->db->query($sql);
                     $num['in']++;
                 }
             }
         }
     }
     return $num;
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:23,代码来源:hdapi.class.php

示例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);
         }
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:45,代码来源:admin_hdapi.php

示例3: change_name

 function change_name($did, $title)
 {
     $letter = string::getfirstletter($title);
     if ($this->db->query("UPDATE " . DB_TABLEPRE . "doc SET title='{$title}',letter='{$letter}' WHERE did={$did}")) {
         $this->db->query("UPDATE " . DB_TABLEPRE . "edition SET title='{$title}' WHERE did={$did}");
         return true;
     } else {
         return false;
     }
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:10,代码来源:doc.class.php

示例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);
 }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:71,代码来源:admin_mwimport.php

示例5: docreate


//.........这里部分代码省略.........
             $this->view->assign('navtitle', "{$title}-" . $this->view->lang['createDoc'] . "-");
             $this->view->assign("page_action", "create");
             $this->view->assign("attachment_open", $this->setting['attachment_open']);
             //$this->view->assign("attachment_type","['".implode("','",$_ENV['attachment']->get_attachment_type())."']");
             $this->view->assign('attachment_size', $this->setting['attachment_size']);
             $doc['title'] = stripcslashes($doc['title']);
             eval($this->plugin['doctemplate']['hooks']['doctemplate']);
             //载入类别模版。
             $this->view->assign('doc', $doc);
             $this->view->assign("doc_verification_create_code", $this->setting['checkcode'] != 3 && $this->setting['doc_verification_create_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_create_code'] && strtolower($this->post['code']) != $_ENV['user']->get_code()) {
                 $this->message($this->view->lang['codeError'], 'BACK', 0);
             }
             if (@trim($this->post['content']) == '' || @trim($this->post['title']) == '') {
                 $this->message($this->view->lang['contentIsNull'], 'BACK', 0);
             }
             $doc['title'] = string::substring(string::stripscript($_ENV['doc']->replace_danger_word(trim($this->post['title']))), 0, 80);
             $_doc = $this->db->fetch_by_field('doc', 'title', $doc['title']);
             if ((bool) $_doc && !empty($_doc['content'])) {
                 $this->message($this->view->lang['createDocTip5'], 'BACK', 0);
             }
             if (!(bool) $_ENV['category']->vilid_category($this->post['category'])) {
                 $this->message($this->view->lang['categoryNotExist'], 'BACK', 0);
             }
             if (@(!(bool) $this->post['summary'])) {
                 $doc['summary'] = trim(strip_tags($_ENV['doc']->replace_danger_word($this->post['summary'])));
             }
             $doc['did'] = $this->post['did'];
             $doc['letter'] = string::getfirstletter($this->post['title']);
             $doc['category'] = $this->post['category'];
             //$doc['tags']=$_ENV['doc']->jointags($this->post['tags']);
             $doc['tags'] = $this->post['tags'];
             $doc['tags'] = $_ENV['doc']->replace_danger_word($doc['tags']);
             $doc['content'] = string::stripscript($_ENV['doc']->replace_danger_word($this->post['content']));
             $doc['content'] = $this->setting['auto_picture'] ? $_ENV['doc']->auto_picture($doc['content'], $doc['did']) : $doc['content'];
             $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['words'] = string::hstrlen($doc['content']);
             $doc['visible'] = $this->setting['verify_doc'] != 0 ? '0' : '1';
             if (strpos($this->user['regulars'], 'doc-immunity') === false && 4 != $this->user['groupid']) {
                 if (!$_ENV['doc']->check_submit_interval($this->user['uid'])) {
                     if ($this->setting['save_spam']) {
                         $doc['visible'] = 0;
                     } else {
                         $this->message(sprintf($this->view->lang['submit_interval_msg'], $this->setting['submit_min_interval']), "BACK", 0);
                     }
                 }
                 if (!$_ENV['doc']->check_eng_pcnt($doc['content']) || !$_ENV['doc']->check_extlink_pcnt($doc['content'])) {
                     if ($this->setting['save_spam']) {
                         $doc['visible'] = 0;
                     } else {
                         $this->message($this->view->lang['spam_msg'], "BACK", 0);
                     }
                 }
             }
             if (strpos($this->user['regulars'], 'doc-immunity') !== false || 4 == $this->user['groupid'] || !$this->setting['verify_doc'] || $this->setting['verify_doc'] == -1 && $this->user['newdocs'] == -1) {
                 $doc['visible'] = 1;
             }
开发者ID:meiwenhui,项目名称:hdwiki,代码行数:67,代码来源:doc.php


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