本文整理汇总了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;
}