當前位置: 首頁>>代碼示例>>PHP>>正文


PHP zmf::pinyin方法代碼示例

本文整理匯總了PHP中zmf::pinyin方法的典型用法代碼示例。如果您正苦於以下問題:PHP zmf::pinyin方法的具體用法?PHP zmf::pinyin怎麽用?PHP zmf::pinyin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zmf的用法示例。


在下文中一共展示了zmf::pinyin方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findAndAdd

 public static function findAndAdd($title, $classify, $logid)
 {
     $title = zmf::filterInput($title, 't', 1);
     if (!$title) {
         return false;
     }
     $info = Tags::model()->find('title=:title AND classify=:classify', array(':title' => $title, ':classify' => $classify));
     if (!$info) {
         if (Yii::app()->session['checkHasBadword'] == 'yes') {
             $status = Posts::STATUS_STAYCHECK;
         } else {
             $status = Posts::STATUS_PASSED;
         }
         unset(Yii::app()->session['checkHasBadword']);
         $_data = array('title' => $title, 'name' => zmf::pinyin($title), 'classify' => $classify, 'status' => $status, 'cTime' => time(), 'length' => mb_strlen($title, 'GBK'));
         $modelB = new Tags();
         $modelB->attributes = $_data;
         if ($modelB->save()) {
             $tagid = $modelB->id;
         }
     } else {
         $tagid = $info['id'];
     }
     if ($tagid && $logid) {
         $_info = TagRelation::model()->find('tagid=:tagid AND logid=:logid AND classify=:classify', array(':tagid' => $tagid, ':logid' => $logid, ':classify' => $classify));
         if (!$_info) {
             $_tagre = array('tagid' => $tagid, 'logid' => $logid, 'classify' => $classify, 'cTime' => zmf::now());
             $modelC = new TagRelation();
             $modelC->attributes = $_tagre;
             $modelC->save();
         }
     }
     return $tagid;
 }
開發者ID:ph7pal,項目名稱:momo,代碼行數:34,代碼來源:Tags.php

示例2: checkAndWriteTag

 /**
  * 檢查傳入的標簽是否已存在,不存在則創建,並檢查是否已存在對應關係,不存在則創建
  * @param type $id
  * @param type $crumb
  */
 public function checkAndWriteTag($id, $crumb, $tagid = 0)
 {
     if (!$tagid) {
         $_crumb = strip_tags(trim($crumb));
         $_taginfo = Tags::model()->find('title=:title', array(':title' => $_crumb));
         if (!$_taginfo) {
             $_tagdata = array('title' => $_crumb, 'name' => zmf::pinyin($_crumb), 'classify' => 'posts', 'cTime' => time(), 'status' => 1);
             $model_tag = new Tags();
             $model_tag->attributes = $_tagdata;
             $_tagid = $model_tag->save(false);
         } else {
             $_tagid = $_taginfo['id'];
         }
     } else {
         $_tagid = $tagid;
     }
     $_tagrel = array('logid' => $id, 'tagid' => $_tagid, 'classify' => 'posts');
     $reinfo = TagRelation::model()->find('logid=:logid AND tagid=:tagid AND classify="posts"', array(':logid' => $id, ':tagid' => $_tagid));
     if (!$reinfo) {
         $model_tagrel = new TagRelation();
         $model_tagrel->attributes = $_tagrel;
         $model_tagrel->save(false);
     }
 }
開發者ID:ph7pal,項目名稱:momo,代碼行數:29,代碼來源:TagRelation.php


注:本文中的zmf::pinyin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。