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


PHP Stats::validate_type方法代碼示例

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


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

示例1: get_latest_sql

 /**
  * get_latest_sql
  * Get the latest sql
  */
 public static function get_latest_sql($type, $user_id = null)
 {
     if (is_null($user_id)) {
         $user_id = $GLOBALS['user']->id;
     }
     $user_id = intval($user_id);
     $type = Stats::validate_type($type);
     $sql = "SELECT `object_id` as `id` FROM user_flag" . " WHERE object_type = '" . $type . "' AND `user` = '" . $user_id . "'";
     if (AmpConfig::get('catalog_disable')) {
         $sql .= " AND " . Catalog::get_enable_filter($type, '`object_id`');
     }
     $sql .= " ORDER BY `date` DESC ";
     return $sql;
 }
開發者ID:axelsimon,項目名稱:ampache,代碼行數:18,代碼來源:userflag.class.php

示例2: get_highest_sql

 /**
  * get_highest_sql
  * Get highest sql
  */
 public static function get_highest_sql($type)
 {
     $type = Stats::validate_type($type);
     $sql = "SELECT `object_id` as `id`, AVG(`rating`) AS `rating` FROM rating" . " WHERE object_type = '" . $type . "'";
     if (AmpConfig::get('catalog_disable')) {
         $sql .= " AND " . Catalog::get_enable_filter($type, '`object_id`');
     }
     $sql .= " GROUP BY object_id ORDER BY `rating` DESC ";
     return $sql;
 }
開發者ID:axelsimon,項目名稱:ampache,代碼行數:14,代碼來源:rating.class.php

示例3: get_latest_sql

 /**
  * get_latest_sql
  * Get the latest sql
  */
 public static function get_latest_sql($type, $user_id = null)
 {
     if (is_null($user_id)) {
         $user_id = $GLOBALS['user']->id;
     }
     $user_id = intval($user_id);
     $sql = "SELECT `user_flag`.`object_id` as `id`, `user_flag`.`object_type` as `type`, `user_flag`.`user` as `user` FROM `user_flag`";
     if ($user_id <= 0) {
         // Get latest only from user rights >= content manager
         $sql .= " LEFT JOIN `user` ON `user`.`id` = `user_flag`.`user`" . " WHERE `user`.`access` >= 50";
     }
     if (!is_null($type)) {
         if ($user_id <= 0) {
             $sql .= " AND";
         } else {
             $sql .= " WHERE";
         }
         $type = Stats::validate_type($type);
         $sql .= " `user_flag`.`object_type` = '" . $type . "'";
         if ($user_id > 0) {
             $sql .= " AND `user_flag`.`user` = '" . $user_id . "'";
         }
         if (AmpConfig::get('catalog_disable')) {
             $sql .= " AND " . Catalog::get_enable_filter($type, '`object_id`');
         }
     }
     $sql .= " ORDER BY `user_flag`.`date` DESC ";
     return $sql;
 }
開發者ID:nioc,項目名稱:ampache,代碼行數:33,代碼來源:userflag.class.php


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