コード例 #1
0
ファイル: Factory.php プロジェクト: AOEpeople/asdis
 /**
  * @param Tx_Asdis_System_Configuration_Provider $configurationProvider
  */
 public function injectConfigurationProvider(Tx_Asdis_System_Configuration_Provider $configurationProvider)
 {
     try {
         $this->protocolMarker = $configurationProvider->getServerProtocolMarker();
     } catch (Exception $e) {
         $this->protocolMarker = '';
     }
 }
コード例 #2
0
ファイル: ServerRepository.php プロジェクト: AOEpeople/asdis
 /**
  * @param Tx_Asdis_Domain_Model_Page $page
  * @return Tx_Asdis_Domain_Model_Server_Collection
  */
 public function findAllByPage(Tx_Asdis_Domain_Model_Page $page)
 {
     /** @var Tx_Asdis_Domain_Model_Server_Collection $servers */
     $servers = $this->objectManager->get('Tx_Asdis_Domain_Model_Server_Collection');
     $serverDefinitions = $this->configurationProvider->getServerDefinitions();
     foreach ($serverDefinitions as $serverDefinition) {
         $servers->append($this->serverFactory->createServer($serverDefinition['identifier'], $serverDefinition['domain'], $serverDefinition['protocol']));
     }
     return $servers;
 }
コード例 #3
0
ファイル: Url.php プロジェクト: AOEpeople/asdis
 /**
  * @param Tx_Asdis_Domain_Model_Asset $asset
  * @throws Tx_Asdis_Api_Exception_NotEnabledException
  */
 private function distributeAsset(Tx_Asdis_Domain_Model_Asset $asset)
 {
     try {
         if ($this->configurationProvider->isReplacementEnabled()) {
             $collection = new Tx_Asdis_Domain_Model_Asset_Collection();
             $collection->append($asset);
             $distributionAlgorithm = $this->distributionAlgorithmFactory->buildDistributionAlgorithmFromKey($this->configurationProvider->getDistributionAlgorithmKey());
             $distributionAlgorithm->distribute($collection, $this->getServers());
         } else {
             throw new Tx_Asdis_Api_Exception_NotEnabledException(1452171538);
         }
     } catch (Tx_Asdis_System_Configuration_Exception_TypoScriptSettingNotExists $e) {
         throw new Tx_Asdis_Api_Exception_NotEnabledException(1452171530, $e);
     }
 }
コード例 #4
0
ファイル: Page.php プロジェクト: AOEpeople/asdis
 /**
  * Replaces the assets of the page.
  * To force any replacement, you have to call "scrapeAssets" before.
  *
  * @return void
  */
 public function replaceAssets()
 {
     if (FALSE === $this->configurationProvider->isReplacementEnabled()) {
         return;
     }
     $distributionAlgorithmKey = '';
     try {
         $distributionAlgorithmKey = $this->configurationProvider->getDistributionAlgorithmKey();
     } catch (Exception $e) {
     }
     $distributionAlgorithm = $this->distributionAlgorithmFactory->buildDistributionAlgorithmFromKey($distributionAlgorithmKey);
     $distributionAlgorithm->distribute($this->getAssets(), $this->serverRepository->findAllByPage($this));
     $this->pageObject->content = $this->replacementProcessor->replace($this->assets->getReplacementMap(), $this->pageObject->content);
 }