Exemplo n.º 1
0
 public function setArticleId($article_id)
 {
     // bc
     if ($this->viasql) {
         return parent::setArticleId($article_id);
     }
     $article_id = (int) $article_id;
     $this->article_id = $article_id;
     $rex_article = rex_article::get($article_id, $this->clang);
     if ($rex_article instanceof rex_article) {
         $this->category_id = $rex_article->getCategoryId();
         $this->template_id = $rex_article->getTemplateId();
         return true;
     }
     $this->article_id = 0;
     $this->template_id = 0;
     $this->category_id = 0;
     return false;
 }
Exemplo n.º 2
0
 /**
  * Generiert den Artikel-Cache des Artikelinhalts.
  *
  * @param int $article_id Id des zu generierenden Artikels
  * @param int $clang      ClangId des Artikels
  *
  * @return bool TRUE bei Erfolg, FALSE wenn eine ungütlige article_id übergeben wird, sonst eine Fehlermeldung
  */
 public static function generateArticleContent($article_id, $clang = null)
 {
     foreach (rex_clang::getAllIds() as $_clang) {
         if ($clang !== null && $clang != $_clang) {
             continue;
         }
         $CONT = new rex_article_content_base();
         $CONT->setCLang($_clang);
         $CONT->setEval(false);
         // Content nicht ausführen, damit in Cachedatei gespeichert werden kann
         if (!$CONT->setArticleId($article_id)) {
             return false;
         }
         // --------------------------------------------------- Artikelcontent speichern
         $article_content_file = rex_path::addonCache('structure', "{$article_id}.{$_clang}.content");
         $article_content = $CONT->getArticle();
         // ----- EXTENSION POINT
         $article_content = rex_extension::registerPoint(new rex_extension_point('GENERATE_FILTER', $article_content, ['id' => $article_id, 'clang' => $_clang, 'article' => $CONT]));
         if (rex_file::put($article_content_file, $article_content) === false) {
             return rex_i18n::msg('article_could_not_be_generated') . ' ' . rex_i18n::msg('check_rights_in_directory') . rex_path::addonCache('structure');
         }
     }
     return true;
 }