コード例 #1
0
 /**
  * Do something before content is loaded from DB
  * 
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $arrMatches, $cl, $objDownloadLib, $downloadBlock, $matches, $objDownloadsModule;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             // Set download groups
             if (preg_match_all('/{DOWNLOADS_GROUP_([0-9]+)}/', \Env::get('cx')->getPage()->getContent(), $arrMatches)) {
                 /** @ignore */
                 if ($cl->loadFile(ASCMS_MODULE_PATH . '/Downloads/Controller/DownloadsLibrary.class.php')) {
                     $objDownloadLib = new DownloadsLibrary();
                     $objDownloadLib->setGroups($arrMatches[1], \Env::get('cx')->getPage()->getContent());
                 }
             }
             //--------------------------------------------------------
             // Parse the download block 'downloads_category_#ID_list'
             //--------------------------------------------------------
             $content = \Env::get('cx')->getPage()->getContent();
             $downloadBlock = preg_replace_callback("/<!--\\s+BEGIN\\s+downloads_category_(\\d+)_list\\s+-->(.*)<!--\\s+END\\s+downloads_category_\\g1_list\\s+-->/s", function ($matches) {
                 \Env::get('init')->loadLanguageData('Downloads');
                 if (isset($matches[2])) {
                     $objDownloadsModule = new Downloads($matches[2], array('category' => $matches[1]));
                     return $objDownloadsModule->getPage();
                 }
             }, $content);
             \Env::get('cx')->getPage()->setContent($downloadBlock);
             break;
         default:
             break;
     }
 }
コード例 #2
0
 /**
  * Do something before content is loaded from DB
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page       The resolved page
  */
 public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $arrMatches, $cl, $objDownloadLib, $downloadBlock, $matches, $objDownloadsModule, $themesPages, $page_template;
     switch ($this->cx->getMode()) {
         case \Cx\Core\Core\Controller\Cx::MODE_FRONTEND:
             // Set download groups
             if (preg_match_all('/{DOWNLOADS_GROUP_([0-9]+)}/', \Env::get('cx')->getPage()->getContent(), $arrMatches)) {
                 /** @ignore */
                 if ($cl->loadFile(ASCMS_MODULE_PATH . '/Downloads/Controller/DownloadsLibrary.class.php')) {
                     $objDownloadLib = new DownloadsLibrary();
                     $objDownloadLib->setGroups($arrMatches[1], \Env::get('cx')->getPage()->getContent());
                 }
             }
             //--------------------------------------------------------
             // Parse the download block 'downloads_category_#ID_list'
             //--------------------------------------------------------
             $content = $this->cx->getPage()->getContent();
             $this->cx->getPage()->setContent($this->parseDownloadsForTemplate($content));
             $themesPages['index'] = $this->parseDownloadsForTemplate($themesPages['index']);
             $themesPages['sidebar'] = $this->parseDownloadsForTemplate($themesPages['sidebar']);
             $page_template = $this->parseDownloadsForTemplate($page_template);
             break;
         default:
             break;
     }
 }