public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_CONFIG, $objNewsML, $arrMatches, $page_template, $themesPages, $cl;
     // Set NewsML messages
     if ($_CONFIG['feedNewsMLStatus'] == '1') {
         if (preg_match_all('/{NEWSML_([0-9A-Z_-]+)}/', \Env::get('cx')->getPage()->getContent(), $arrMatches)) {
             /** @ignore */
             if ($cl->loadFile(\Env::get('cx')->getCodeBaseModulePath() . '/Feed/Controller/NewsML.class.php')) {
                 $objNewsML = new NewsML();
                 $objNewsML->setNews($arrMatches[1], \Env::get('cx')->getPage()->getContent());
             }
         }
         if (preg_match_all('/{NEWSML_([0-9A-Z_-]+)}/', $page_template, $arrMatches)) {
             /** @ignore */
             if ($cl->loadFile(\Env::get('cx')->getCodeBaseModulePath() . '/Feed/Controller/NewsML.class.php')) {
                 $objNewsML = new NewsML();
                 $objNewsML->setNews($arrMatches[1], $page_template);
             }
         }
         if (preg_match_all('/{NEWSML_([0-9A-Z_-]+)}/', $themesPages['index'], $arrMatches)) {
             /** @ignore */
             if ($cl->loadFile(\Env::get('cx')->getCodeBaseModulePath() . '/Feed/Controller/NewsML.class.php')) {
                 $objNewsML = new NewsML();
                 $objNewsML->setNews($arrMatches[1], $themesPages['index']);
             }
         }
     }
 }
Пример #2
0
 /**
  * Add or update a newsML category
  * @access private
  * @global object $objDatabase
  * @global array $_ARRAYLANG
  */
 function _newsMLSaveCategory()
 {
     global $_ARRAYLANG;
     if (isset($_POST['save'])) {
         $categoryId = isset($_GET['categoryId']) ? intval($_GET['categoryId']) : 0;
         $categoryName = isset($_POST['feedNewsMLCategoryName']) ? preg_replace('/[^a-zA-Z0-9-_\\s]+/', '', $_POST['feedNewsMLCategoryName']) : '';
         $providerId = isset($_POST['feedNewsMLProviderId']) ? intval($_POST['feedNewsMLProviderId']) : 0;
         $arrSubjectCodeMethods = array('all', 'only', 'exclude');
         $subjectCodeMethod = isset($_POST['feedNewsMLSubjectCode']) && in_array($_POST['feedNewsMLSubjectCode'], $arrSubjectCodeMethods) ? $_POST['feedNewsMLSubjectCode'] : 'all';
         $arrTmpSubjectCodes = isset($_POST['feedNewsMLSubjects']) ? explode(',', $_POST['feedNewsMLSubjects']) : array();
         $arrSubjectCodes = array();
         foreach ($arrTmpSubjectCodes as $subjectCode) {
             array_push($arrSubjectCodes, intval($subjectCode));
         }
         $msgCount = isset($_POST['feedNewsMLCategoryMsgCount']) ? intval($_POST['feedNewsMLCategoryMsgCount']) : $this->_objNewsML->standardMessageCount;
         $showPics = isset($_POST['feedNewsMLCategoryShowPics']) ? intval($_POST['feedNewsMLCategoryShowPics']) : 0;
         $templateHtml = isset($_POST['feedNewsMLCategoryTemplate']) ? contrexx_addslashes($_POST['feedNewsMLCategoryTemplate']) : '';
         $templateHtml = preg_replace('/\\[\\[([A-Za-z0-9_]*?)\\]\\]/', '{\\1}', $templateHtml);
         if ($categoryId != 0) {
             if ($this->_objNewsML->updateCategory($categoryId, $providerId, $categoryName, $arrSubjectCodes, $subjectCodeMethod, $templateHtml, $msgCount, $showPics) === false) {
                 $_SESSION['strErrMessage'] .= $_ARRAYLANG['TXT_FEED_CATEGORY_COULD_NOT_BE_UPDATED'] . "<br />";
             }
         } else {
             if ($this->_objNewsML->addCategory($providerId, $categoryName, $arrSubjectCodes, $subjectCodeMethod, $templateHtml, $msgCount, $showPics) === false) {
                 $_SESSION['strErrMessage'] .= $_ARRAYLANG['TXT_FEED_COULD_NOT_ADD_CATEGORY'] . "<br />";
             }
         }
         $this->_objNewsML->initCategories();
     }
 }