Exemplo n.º 1
0
 protected function _getEmoticonImg($emoticonCode, $height = null)
 {
     $emoticon = CM_Emoticon::findByCode($emoticonCode);
     if (!$emoticon) {
         throw new CM_Exception_Invalid('Cannot find emoticon for code `' . $emoticonCode . '`.');
     }
     $urlCdn = $this->_mockSite->getUrlCdn();
     $siteType = $this->_mockSite->getId();
     $deployVersion = CM_App::getInstance()->getDeployVersion();
     $heightAttribute = $height ? ' height="' . $height . '"' : '';
     return '<img src="' . $urlCdn . '/layout/' . $siteType . '/' . $deployVersion . '/img/emoticon/' . $emoticon->getFileName() . '" class="emoticon emoticon-' . $emoticon->getName() . '" title="' . $emoticon->getDefaultCode() . '"' . $heightAttribute . ' />';
 }
Exemplo n.º 2
0
 /**
  * @param CM_Site_Abstract $site
  * @param string           $zoneName
  * @return array
  * @throws CM_Exception_Invalid
  */
 protected function _getZoneData(CM_Site_Abstract $site, $zoneName)
 {
     $cacheKey = CM_CacheConst::AdproviderZones . '_siteId:' . $site->getId();
     $cache = CM_Cache_Local::getInstance();
     if (false === ($zones = $cache->get($cacheKey))) {
         $zones = CM_Config::get()->CM_Adprovider->zones;
         if (isset($site->getConfig()->CM_Adprovider->zones)) {
             $zones = array_merge($zones, $site->getConfig()->CM_Adprovider->zones);
         }
         $cache->set($cacheKey, $zones);
     }
     if (!array_key_exists($zoneName, $zones)) {
         return null;
     }
     return $zones[$zoneName];
 }
Exemplo n.º 3
0
 /**
  * @param CM_Site_Abstract $site
  * @param string           $zoneName
  * @return mixed
  * @throws CM_Exception_Invalid
  */
 protected function _getZone(CM_Site_Abstract $site, $zoneName)
 {
     $cacheKey = CM_CacheConst::AdproviderZones . '_siteId:' . $site->getId();
     $cache = CM_Cache_Local::getInstance();
     if (false === ($zones = $cache->get($cacheKey))) {
         $zones = CM_Config::get()->CM_Adprovider->zones;
         if (isset($site->getConfig()->CM_Adprovider->zones)) {
             $zones = array_merge($zones, $site->getConfig()->CM_Adprovider->zones);
         }
         $cache->set($cacheKey, $zones);
     }
     if (!array_key_exists($zoneName, $zones)) {
         throw new CM_Exception_Invalid('Zone `' . $zoneName . '` not configured.');
     }
     return $zones[$zoneName];
 }