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


PHP PMF_Utils::isLanguage方法代碼示例

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


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

示例1: _getSQLQuery

 /**
  * Build the SQL query for retrieving faq records according to the constraints provided
  *
  * @param   $QueryType
  * @param   $nCatid
  * @param   $bDownwards
  * @param   $lang
  * @param   $date
  * @param   $faqid
  * @return  array
  * @access  private
  * @since   2005-11-02
  * @author  Matteo Scaramuccia <matteo@scaramuccia.com>
  */
 private function _getSQLQuery($QueryType, $nCatid, $bDownwards, $lang, $date, $faqid = 0)
 {
     $now = date('YmdHis');
     $query = sprintf("\n            SELECT\n                fd.id AS id,\n                fd.solution_id AS solution_id,\n                fd.revision_id AS revision_id,\n                fd.lang AS lang,\n                fcr.category_id AS category_id,\n                fd.active AS active,\n                fd.sticky AS sticky,\n                fd.keywords AS keywords,\n                fd.thema AS thema,\n                fd.content AS content,\n                fd.author AS author,\n                fd.email AS email,\n                fd.comment AS comment,\n                fd.datum AS datum,\n                fv.visits AS visits,\n                fv.last_visit AS last_visit\n            FROM\n                %sfaqdata fd,\n                %sfaqvisits fv,\n                %sfaqcategoryrelations fcr\n            WHERE\n                fd.id = fcr.record_id\n            AND\n                fd.lang = fcr.record_lang\n            AND\n                fd.date_start <= '%s'\n            AND\n                fd.date_end   >= '%s'\n            AND ", SQLPREFIX, SQLPREFIX, SQLPREFIX, $now, $now);
     // faqvisits data selection
     if (!empty($faqid)) {
         // Select ONLY the faq with the provided $faqid
         $query .= "fd.id = '" . $faqid . "' AND ";
     }
     $query .= "fd.id = fv.id\n            AND\n                fd.lang = fv.lang";
     $needAndOp = true;
     if (!empty($nCatid) && PMF_Utils::isInteger($nCatid) && $nCatid > 0) {
         if ($needAndOp) {
             $query .= " AND";
         }
         $query .= " (fcr.category_id = " . $nCatid;
         if ($bDownwards) {
             $query .= $this->_getCatidWhereSequence($nCatid, "OR");
         }
         $query .= ")";
         $needAndOp = true;
     }
     if (!empty($date) && PMF_Utils::isLikeOnPMFDate($date)) {
         if ($needAndOp) {
             $query .= " AND";
         }
         $query .= " fd.datum LIKE '" . $date . "'";
         $needAndOp = true;
     }
     if (!empty($lang) && PMF_Utils::isLanguage($lang)) {
         if ($needAndOp) {
             $query .= " AND";
         }
         $query .= " fd.lang = '" . $lang . "'";
         $needAndOp = true;
     }
     switch ($QueryType) {
         case FAQ_QUERY_TYPE_APPROVAL:
             if ($needAndOp) {
                 $query .= " AND";
             }
             $query .= " fd.active = '" . FAQ_SQL_ACTIVE_NO . "'";
             $needAndOp = true;
             break;
         case FAQ_QUERY_TYPE_EXPORT_DOCBOOK:
         case FAQ_QUERY_TYPE_EXPORT_PDF:
         case FAQ_QUERY_TYPE_EXPORT_XHTML:
         case FAQ_QUERY_TYPE_EXPORT_XML:
             if ($needAndOp) {
                 $query .= " AND";
             }
             $query .= " fd.active = '" . FAQ_SQL_ACTIVE_YES . "'";
             $needAndOp = true;
             break;
         default:
             if ($needAndOp) {
                 $query .= " AND";
             }
             $query .= " fd.active = '" . FAQ_SQL_ACTIVE_YES . "'";
             $needAndOp = true;
             break;
     }
     // Sort criteria
     switch ($QueryType) {
         case FAQ_QUERY_TYPE_EXPORT_DOCBOOK:
         case FAQ_QUERY_TYPE_EXPORT_PDF:
         case FAQ_QUERY_TYPE_EXPORT_XHTML:
         case FAQ_QUERY_TYPE_EXPORT_XML:
             // Preferred ordering: Sitemap-like
             // TODO: see if this sort is compatible with the current set of indexes
             $query .= "\nORDER BY fd.thema";
             break;
         case FAQ_QUERY_TYPE_RSS_LATEST:
             $query .= "\nORDER BY fd.datum DESC";
             break;
         default:
             // Normal ordering
             $query .= "\nORDER BY fcr.category_id, fd.id";
             break;
     }
     return $query;
 }
開發者ID:noon,項目名稱:phpMyFAQ,代碼行數:96,代碼來源:Faq.php


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