本文整理匯總了PHP中PMF_Utils::isInteger方法的典型用法代碼示例。如果您正苦於以下問題:PHP PMF_Utils::isInteger方法的具體用法?PHP PMF_Utils::isInteger怎麽用?PHP PMF_Utils::isInteger使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PMF_Utils
的用法示例。
在下文中一共展示了PMF_Utils::isInteger方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例2: isLikeOnPMFDate
/**
* Checks if a date is a phpMyFAQ valid date
*
* @param integer $date Date
* @return integer
*/
public static function isLikeOnPMFDate($date)
{
// Test if the passed string is in the format: %YYYYMMDDhhmmss%
$testdate = $date;
// Suppress first occurence of '%'
if (substr($testdate, 0, 1) == '%') {
$testdate = substr($testdate, 1);
}
// Suppress last occurence of '%'
if (substr($testdate, -1, 1) == '%') {
$testdate = substr($testdate, 0, strlen($testdate) - 1);
}
// PMF date consists of numbers only: YYYYMMDDhhmmss
return PMF_Utils::isInteger($testdate);
}