/**
  * Find category by import source and import id
  *
  * @param string $importSource import source
  * @param integer $importId import id
  * @return Tx_Extbase_Persistence_QueryInterface
  */
 public function findOneByImportSourceAndImportId($importSource, $importId)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(FALSE);
     if (Tx_News_Utility_Compatibility::isEqualOrHigherSixZero()) {
         $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
     } else {
         $query->getQuerySettings()->setRespectEnableFields(FALSE);
     }
     return $query->matching($query->logicalAnd($query->equals('importSource', $importSource), $query->equals('importId', $importId)))->execute()->getFirst();
 }
 /**
  * Get all loaded extensions which try to extend EXT:news
  *
  * @return array
  */
 protected function getExtensibleExtensions()
 {
     $loadedExtensions = array_unique(t3lib_div::trimExplode(',', Tx_News_Utility_Compatibility::getLoadedExtensionList(), TRUE));
     // Get the extensions which want to extend news
     $extensibleExtensions = array();
     foreach ($loadedExtensions as $extensionKey) {
         $extensionInfoFile = t3lib_extMgm::extPath($extensionKey, 'Resources/Private/extend-news.txt');
         if (file_exists($extensionInfoFile)) {
             $info = t3lib_div::getUrl($extensionInfoFile);
             $classes = t3lib_div::trimExplode(LF, $info, TRUE);
             foreach ($classes as $class) {
                 $extensibleExtensions[$class][$extensionKey] = 1;
             }
         }
     }
     return $extensibleExtensions;
 }
Example #3
0
 /**
  * Render a video player
  *
  * @param Tx_News_Domain_Model_Media $element
  * @param integer $width
  * @param integer $height
  * @param string $templateFile template file to override. Absolute path
  * @return string
  */
 public function render(Tx_News_Domain_Model_Media $element, $width, $height, $templateFile = '')
 {
     $view = t3lib_div::makeInstance('Tx_Fluid_View_StandaloneView');
     if (!$templateFile || !is_readable($templateFile)) {
         $view->setTemplatePathAndFilename(t3lib_extMgm::extPath('news') . 'Resources/Private/Templates/ViewHelpers/Flv.html');
     } else {
         $view->setTemplatePathAndFilename($templateFile);
     }
     $url = Tx_News_Service_FileService::getCorrectUrl($element->getContent());
     $GLOBALS['TSFE']->getPageRenderer()->addJsFile(self::PATH_TO_JS . 'flowplayer-3.2.4.min.js');
     // override width & height if both are set
     if ($element->getWidth() > 0 && $element->getHeight() > 0) {
         $width = $element->getWidth();
         $height = $element->getHeight();
     }
     $view->assign('width', Tx_News_Utility_Compatibility::convertToPositiveInteger($width));
     $view->assign('height', Tx_News_Utility_Compatibility::convertToPositiveInteger($height));
     $view->assign('uniqueDivId', 'mediaelement-' . Tx_News_Service_FileService::getUniqueId($element));
     $view->assign('url', $url);
     return $view->render();
 }
 protected function generateQuery(Tx_News_Domain_Model_DemandInterface $demand, $respectEnableFields = TRUE)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(FALSE);
     $constraints = $this->createConstraintsFromDemand($query, $demand);
     // Call hook functions for additional constraints
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Domain/Repository/AbstractDemandedRepository.php']['findDemanded'])) {
         $params = array('demand' => $demand, 'respectEnableFields' => &$respectEnableFields, 'query' => $query, 'constraints' => &$constraints);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['Domain/Repository/AbstractDemandedRepository.php']['findDemanded'] as $reference) {
             t3lib_div::callUserFunction($reference, $params, $this);
         }
     }
     if ($respectEnableFields === FALSE) {
         if (Tx_News_Utility_Compatibility::isEqualOrHigherSixZero()) {
             $query->getQuerySettings()->setIgnoreEnableFields(TRUE);
         } else {
             $query->getQuerySettings()->setRespectEnableFields(FALSE);
         }
         $constraints[] = $query->equals('deleted', 0);
     }
     if (!empty($constraints)) {
         $query->matching($query->logicalAnd($constraints));
     }
     if ($orderings = $this->createOrderingsFromDemand($demand)) {
         $query->setOrderings($orderings);
     }
     // @todo consider moving this to a separate function as well
     if ($demand->getLimit() != NULL) {
         $query->setLimit((int) $demand->getLimit());
     }
     // @todo consider moving this to a separate function as well
     if ($demand->getOffset() != NULL) {
         $query->setOffset((int) $demand->getOffset());
     }
     return $query;
 }
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tceforms.php']['getSingleFieldClass'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/Tceforms.php:Tx_News_Hooks_Tceforms';
// Modify flexform values
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['getFlexFormDSClass'][$_EXTKEY] = 'EXT:' . $_EXTKEY . '/Classes/Hooks/T3libBefunc.php:Tx_News_Hooks_T3libBefunc';
/* ===========================================================================
	Custom cache, done with the caching framework
=========================================================================== */
$cachingTableName = 'news_categorycache';
if (!is_array($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName])) {
    $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName] = array();
}
// Define string frontend as default frontend, this must be set with TYPO3 4.5 and below
// and overrides the default variable frontend of 4.6
if (!isset($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['frontend'])) {
    $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['frontend'] = 't3lib_cache_frontend_StringFrontend';
}
if (Tx_News_Utility_Compatibility::convertVersionNumberToInteger(TYPO3_version) < '4006000') {
    // Define database backend as backend for 4.5 and below (default in 4.6)
    if (!isset($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['backend'])) {
        $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['backend'] = 't3lib_cache_backend_DbBackend';
    }
    // Define data and tags table for 4.5 and below (obsolete in 4.6)
    if (!isset($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['options'])) {
        $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['options'] = array();
    }
    if (!isset($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['options']['cacheTable'])) {
        $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['options']['cacheTable'] = 'cf_news_categorycache';
    }
    if (!isset($TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['options']['tagsTable'])) {
        $TYPO3_CONF_VARS['SYS']['caching']['cacheConfigurations'][$cachingTableName]['options']['tagsTable'] = 'cf_news_categorycache';
    }
}
 /**
  * Override default findByUid function to enable also the option to turn of
  * the enableField setting
  *
  * @param integer $uid id of record
  * @param boolean $respectEnableFields if set to false, hidden records are shown
  * @return Tx_News_Domain_Model_News
  */
 public function findByUid($uid, $respectEnableFields = TRUE)
 {
     $query = $this->createQuery();
     $query->getQuerySettings()->setRespectStoragePage(FALSE);
     $query->getQuerySettings()->setRespectSysLanguage(FALSE);
     if (Tx_News_Utility_Compatibility::isEqualOrHigherSixZero()) {
         $query->getQuerySettings()->setIgnoreEnableFields(!$respectEnableFields);
     } else {
         $query->getQuerySettings()->setRespectEnableFields(FALSE);
     }
     return $query->matching($query->logicalAnd($query->equals('uid', $uid), $query->equals('deleted', 0)))->execute()->getFirst();
 }