ver. 0.280: Articles frontend migration, class.Article removal, Settings facade cleanup
- 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>
This commit is contained in:
@@ -22,6 +22,8 @@ class Site
|
||||
{
|
||||
global $page, $settings, $settings, $lang, $lang_id;
|
||||
|
||||
$articleRepo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||
|
||||
if ( (int) \S::get( 'layout_id' ) )
|
||||
$layout = new \cms\Layout( (int) \S::get( 'layout_id' ) );
|
||||
|
||||
@@ -92,9 +94,9 @@ class Site
|
||||
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
|
||||
|
||||
$news_list_tmp[2] != '' ? $pattern = '[AKTUALNOSCI:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[AKTUALNOSCI:' . $news_list_tmp[1] . ']';
|
||||
$html = str_replace( $pattern, \front\view\Articles::news(
|
||||
$html = str_replace( $pattern, \front\Views\Articles::news(
|
||||
$news_list_tmp[1],
|
||||
\front\factory\Articles::news( $news_list_tmp[1], $news_limit, $lang_id )
|
||||
$articleRepo->news( (int)$news_list_tmp[1], (int)$news_limit, $lang_id )
|
||||
), $html );
|
||||
}
|
||||
|
||||
@@ -175,7 +177,7 @@ class Site
|
||||
//
|
||||
if ( \S::get( 'article' ) )
|
||||
{
|
||||
$article = \front\factory\Articles::article_details( \S::get( 'article' ), $lang_id );
|
||||
$article = $articleRepo->articleDetailsFrontend( (int)\S::get( 'article' ), $lang_id );
|
||||
|
||||
if ( $article['language']['meta_title'] )
|
||||
$page['language']['title'] = $article['language']['meta_title'];
|
||||
@@ -340,7 +342,7 @@ class Site
|
||||
/* atrybut noindex */
|
||||
if ( \S::get( 'article' ) )
|
||||
{
|
||||
\front\factory\Articles::article_noindex( \S::get( 'article' ) ) ? $noindex = 'noindex' : $noindex = 'all';
|
||||
$articleRepo->articleNoindex( (int)\S::get( 'article' ), $lang_id ) ? $noindex = 'noindex' : $noindex = 'all';
|
||||
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
|
||||
}
|
||||
else
|
||||
@@ -390,29 +392,27 @@ class Site
|
||||
}
|
||||
|
||||
// prosta lista aktualności z wybranej podstrony
|
||||
preg_match_all( self::news_list_pattern, $html, $news_list );
|
||||
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
|
||||
preg_match_all( self::news_list_pattern, $html, $news_list_matches );
|
||||
if ( is_array( $news_list_matches[0] ) ) foreach( $news_list_matches[0] as $news_list_tmp )
|
||||
{
|
||||
$news_list_tmp = explode( ':', $news_list_tmp );
|
||||
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
|
||||
$news_list_tmp[2] != '' ? $pattern = '[AKTUALNOSCI_LISTA:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[AKTUALNOSCI_LISTA:' . $news_list_tmp[1] . ']';
|
||||
|
||||
$news_list = \Article::getNews( $news_list_tmp[1], $news_limit, $lang_id );
|
||||
$view_news_list = \Article::newsList( $news_list );
|
||||
$html = str_replace( $pattern, $view_news_list, $html );
|
||||
$newsArticles = $articleRepo->newsListArticles( (int)$news_list_tmp[1], (int)$news_limit, $lang_id );
|
||||
$html = str_replace( $pattern, \front\Views\Articles::newsList( $newsArticles ), $html );
|
||||
}
|
||||
|
||||
// prosta lista z najpopularniejszymi artykułami
|
||||
preg_match_all( self::top_news_pattern, $html, $news_list );
|
||||
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
|
||||
preg_match_all( self::top_news_pattern, $html, $top_news_matches );
|
||||
if ( is_array( $top_news_matches[0] ) ) foreach( $top_news_matches[0] as $news_list_tmp )
|
||||
{
|
||||
$news_list_tmp = explode( ':', $news_list_tmp );
|
||||
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
|
||||
$news_list_tmp[2] != '' ? $pattern = '[NAJPOULARNIEJSZE_ARTYKULY:' . $news_list_tmp[1] . ':' . $news_list_tmp[2] . ']' : $pattern = '[NAJPOULARNIEJSZE_ARTYKULY:' . $news_list_tmp[1] . ']';
|
||||
|
||||
$news_list = \Article::getTopNews( $news_list_tmp[1], $news_limit, $lang_id );
|
||||
$view_news_list = \Article::newsList( $news_list );
|
||||
$html = str_replace( $pattern, $view_news_list, $html );
|
||||
$topArticles = $articleRepo->topArticles( (int)$news_list_tmp[1], (int)$news_limit, $lang_id );
|
||||
$html = str_replace( $pattern, \front\Views\Articles::newsList( $topArticles ), $html );
|
||||
}
|
||||
|
||||
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
|
||||
|
||||
Reference in New Issue
Block a user