コード例 #1
0
 /**
  * Get Total Advertisements.
  *
  * @param string $sTable Default 'Ads'
  * @return integer
  */
 public function total($sTable = 'Ads')
 {
     $this->cache->start(self::CACHE_GROUP, 'total' . $sTable, 604800);
     if (!($iData = $this->cache->get())) {
         AdsCore::checkTable($sTable);
         $rStmt = Db::getInstance()->prepare('SELECT COUNT(adsId) AS totalAds FROM' . Db::prefix($sTable));
         $rStmt->execute();
         $oRow = $rStmt->fetch(\PDO::FETCH_OBJ);
         Db::free($rStmt);
         $iData = (int) $oRow->totalAds;
         unset($oRow);
         $this->cache->put($iData);
     }
     return $iData;
 }
コード例 #2
0
 /**
  * Check table.
  *
  * @see \PH7\Framework\Mvc\Model\Engine\Util\Various::launchErr()
  *
  * @param string $sTable
  * @return mixed (string | void) Returns the table if it is correct.
  * @throws \PH7\Framework\Mvc\Model\Engine\Util\Various::launchErr() If the table is not valid.
  */
 public static function checkTable($sTable)
 {
     switch ($sTable) {
         case 'Members':
         case 'AlbumsPictures':
         case 'AlbumsVideos':
         case 'Pictures':
         case 'Videos':
         case 'Games':
         case 'Blogs':
         case 'Notes':
             return $sTable;
             break;
             /** Check Ads Tables **/
             \PH7\AdsCore::checkTable($sTable);
         default:
             static::launchErr($sTable);
     }
 }