- Add 8 frontend methods to ArticleRepository (with Redis cache) - Create front\Views\Articles (rendering + utility methods) - Rewire front\view\Site::show() and front\controls\Site::route() to repo + Views - Update 5 article templates to use \front\Views\Articles:: - Convert front\factory\Articles and front\view\Articles to facades - Remove class.Article (entity + static methods migrated to repo + Views) - Remove front\factory\Settings facade (already migrated) - Fix: eliminate global $lang from articleNoindex(), inline page sort query - Tests: 450 OK, 1431 assertions (+13 new) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php
|
|
namespace front\factory;
|
|
|
|
/**
|
|
* FASADA — deleguje do \Domain\Article\ArticleRepository i \front\Views\Articles
|
|
* Zachowana dla wstecznej kompatybilności. Nowy kod powinien używać bezpośrednio repo + Views.
|
|
*/
|
|
class Articles
|
|
{
|
|
static public function generateTableOfContents( $content )
|
|
{
|
|
return \front\Views\Articles::generateTableOfContents( $content );
|
|
}
|
|
|
|
static public function processHeaders( $matches )
|
|
{
|
|
return \front\Views\Articles::processHeaders( $matches );
|
|
}
|
|
|
|
static public function generateHeadersIds( $text )
|
|
{
|
|
return \front\Views\Articles::generateHeadersIds( $text );
|
|
}
|
|
|
|
public static function get_image( $article )
|
|
{
|
|
return \front\Views\Articles::getImage( $article );
|
|
}
|
|
|
|
public static function article_noindex( $article_id )
|
|
{
|
|
global $lang;
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
return $repo->articleNoindex( (int)$article_id, $lang[0] );
|
|
}
|
|
|
|
public static function article_details( $article_id, $lang_id )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
return $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
|
}
|
|
|
|
public static function artciles_id( $page_id, $lang_id, $articles_limit, $sort_type, $from )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
return $repo->articlesIds( (int)$page_id, $lang_id, (int)$articles_limit, (int)$sort_type, (int)$from );
|
|
}
|
|
|
|
public static function page_articles_count( $page_id, $lang_id )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
return $repo->pageArticlesCount( (int)$page_id, $lang_id );
|
|
}
|
|
|
|
public static function page_articles( $page, $lang_id, $bs )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
return $repo->pageArticles( $page, $lang_id, (int)$bs );
|
|
}
|
|
|
|
public static function news( $page_id, $limit = 6, $lang_id )
|
|
{
|
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
|
return $repo->news( (int)$page_id, (int)$limit, $lang_id );
|
|
}
|
|
}
|