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:
@@ -45,7 +45,7 @@ define( 'REDBEAN_MODEL_PREFIX', '' );
|
|||||||
|
|
||||||
date_default_timezone_set( 'Europe/Warsaw' );
|
date_default_timezone_set( 'Europe/Warsaw' );
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
|
|
||||||
if ( file_exists( 'config.php' ) )
|
if ( file_exists( 'config.php' ) )
|
||||||
include 'config.php';
|
include 'config.php';
|
||||||
|
|||||||
2
ajax.php
2
ajax.php
@@ -52,7 +52,7 @@ if ( !$lang = \S::get_session( 'lang' ) )
|
|||||||
|
|
||||||
if ( !$settings = \S::get_session( 'settings' ) )
|
if ( !$settings = \S::get_session( 'settings' ) )
|
||||||
{
|
{
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
\S::set_session( 'settings', $settings );
|
\S::set_session( 'settings', $settings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
api.php
2
api.php
@@ -50,7 +50,7 @@ $mdb = new medoo( [
|
|||||||
'charset' => 'utf8'
|
'charset' => 'utf8'
|
||||||
] );
|
] );
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
|
|
||||||
if ( \S::get( 'ekomi_csv' ) )
|
if ( \S::get( 'ekomi_csv' ) )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -858,7 +858,342 @@ class ArticleRepository
|
|||||||
|
|
||||||
if ( is_array( $rows ) ) {
|
if ( is_array( $rows ) ) {
|
||||||
foreach ( $rows as $row ) {
|
foreach ( $rows as $row ) {
|
||||||
$articles[] = \front\factory\Articles::article_details( $row['id'], 'pl' );
|
$articles[] = $this->articleDetailsFrontend( $row['id'], 'pl' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $articles;
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// FRONTEND METHODS (z Redis cache)
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera szczegoly artykulu dla frontendu (z copy_from fallback + Redis cache).
|
||||||
|
*/
|
||||||
|
public function articleDetailsFrontend(int $articleId, string $langId): ?array
|
||||||
|
{
|
||||||
|
$cacheHandler = new \CacheHandler();
|
||||||
|
$cacheKey = "ArticleRepository::articleDetailsFrontend:{$articleId}:{$langId}";
|
||||||
|
|
||||||
|
$objectData = $cacheHandler->get($cacheKey);
|
||||||
|
|
||||||
|
if ($objectData) {
|
||||||
|
return unserialize($objectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
$article = $this->db->get('pp_articles', '*', ['id' => $articleId]);
|
||||||
|
|
||||||
|
if (!$article) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $this->db->select('pp_articles_langs', '*', [
|
||||||
|
'AND' => ['article_id' => $articleId, 'lang_id' => $langId]
|
||||||
|
]);
|
||||||
|
|
||||||
|
if (is_array($results)) {
|
||||||
|
foreach ($results as $row) {
|
||||||
|
if ($row['copy_from']) {
|
||||||
|
$results2 = $this->db->select('pp_articles_langs', '*', [
|
||||||
|
'AND' => ['article_id' => $articleId, 'lang_id' => $row['copy_from']]
|
||||||
|
]);
|
||||||
|
if (is_array($results2)) {
|
||||||
|
foreach ($results2 as $row2) {
|
||||||
|
$article['language'] = $row2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$article['language'] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$article['images'] = $this->db->select('pp_articles_images', '*', [
|
||||||
|
'article_id' => $articleId,
|
||||||
|
'ORDER' => ['o' => 'ASC', 'id' => 'DESC']
|
||||||
|
]);
|
||||||
|
|
||||||
|
$article['files'] = $this->db->select('pp_articles_files', '*', [
|
||||||
|
'article_id' => $articleId
|
||||||
|
]);
|
||||||
|
|
||||||
|
$article['pages'] = $this->db->select('pp_articles_pages', 'page_id', [
|
||||||
|
'article_id' => $articleId
|
||||||
|
]);
|
||||||
|
|
||||||
|
$cacheHandler->set($cacheKey, $article);
|
||||||
|
|
||||||
|
return $article;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera ID artykulow ze strony z sortowaniem i paginacja (z Redis cache).
|
||||||
|
*/
|
||||||
|
public function articlesIds(int $pageId, string $langId, int $limit, int $sortType, int $from): ?array
|
||||||
|
{
|
||||||
|
$output = null;
|
||||||
|
|
||||||
|
switch ($sortType) {
|
||||||
|
case 0: $order = 'date_add ASC'; break;
|
||||||
|
case 1: $order = 'date_add DESC'; break;
|
||||||
|
case 2: $order = 'date_modify ASC'; break;
|
||||||
|
case 3: $order = 'date_modify DESC'; break;
|
||||||
|
case 4: $order = 'o ASC'; break;
|
||||||
|
case 5: $order = 'title ASC'; break;
|
||||||
|
case 6: $order = 'title DESC'; break;
|
||||||
|
default: $order = 'id ASC'; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$cacheHandler = new \CacheHandler();
|
||||||
|
$cacheKey = "ArticleRepository::articlesIds:{$pageId}:{$langId}:{$limit}:{$sortType}:{$from}:{$order}";
|
||||||
|
|
||||||
|
$objectData = $cacheHandler->get($cacheKey);
|
||||||
|
|
||||||
|
if ($objectData) {
|
||||||
|
return unserialize($objectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $this->db->query(
|
||||||
|
'SELECT * FROM ( '
|
||||||
|
. 'SELECT '
|
||||||
|
. 'a.id, date_modify, date_add, o, '
|
||||||
|
. '( CASE '
|
||||||
|
. 'WHEN copy_from IS NULL THEN title '
|
||||||
|
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||||
|
. 'SELECT title FROM pp_articles_langs '
|
||||||
|
. 'WHERE lang_id = al.copy_from AND article_id = a.id '
|
||||||
|
. ') '
|
||||||
|
. 'END ) AS title '
|
||||||
|
. 'FROM '
|
||||||
|
. 'pp_articles_pages AS ap '
|
||||||
|
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||||
|
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||||
|
. 'WHERE '
|
||||||
|
. 'status = 1 AND page_id = ' . (int)$pageId . ' AND lang_id = \'' . $langId . '\' '
|
||||||
|
. ') AS q1 '
|
||||||
|
. 'WHERE q1.title IS NOT NULL '
|
||||||
|
. 'ORDER BY q1.' . $order . ' '
|
||||||
|
. 'LIMIT ' . (int)$from . ',' . (int)$limit
|
||||||
|
)->fetchAll();
|
||||||
|
|
||||||
|
if (is_array($results) && !empty($results)) {
|
||||||
|
foreach ($results as $row) {
|
||||||
|
$output[] = $row['id'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$cacheHandler->set($cacheKey, $output);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zlicza artykuly na stronie (z Redis cache).
|
||||||
|
*/
|
||||||
|
public function pageArticlesCount(int $pageId, string $langId): int
|
||||||
|
{
|
||||||
|
$cacheHandler = new \CacheHandler();
|
||||||
|
$cacheKey = "ArticleRepository::pageArticlesCount:{$pageId}:{$langId}";
|
||||||
|
|
||||||
|
$objectData = $cacheHandler->get($cacheKey);
|
||||||
|
|
||||||
|
if ($objectData) {
|
||||||
|
return (int)unserialize($objectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
$results = $this->db->query(
|
||||||
|
'SELECT COUNT(0) FROM ( '
|
||||||
|
. 'SELECT '
|
||||||
|
. 'a.id, '
|
||||||
|
. '( CASE '
|
||||||
|
. 'WHEN copy_from IS NULL THEN title '
|
||||||
|
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||||
|
. 'SELECT title FROM pp_articles_langs '
|
||||||
|
. 'WHERE lang_id = al.copy_from AND article_id = a.id '
|
||||||
|
. ') '
|
||||||
|
. 'END ) AS title '
|
||||||
|
. 'FROM '
|
||||||
|
. 'pp_articles_pages AS ap '
|
||||||
|
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||||
|
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||||
|
. 'WHERE '
|
||||||
|
. 'status = 1 AND page_id = ' . (int)$pageId . ' AND lang_id = \'' . $langId . '\' '
|
||||||
|
. ') AS q1 '
|
||||||
|
. 'WHERE q1.title IS NOT NULL'
|
||||||
|
)->fetchAll();
|
||||||
|
|
||||||
|
$count = isset($results[0][0]) ? (int)$results[0][0] : 0;
|
||||||
|
|
||||||
|
$cacheHandler->set($cacheKey, $count);
|
||||||
|
|
||||||
|
return $count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera paginowane artykuly ze strony.
|
||||||
|
*
|
||||||
|
* @return array{articles: ?array, ls: int}
|
||||||
|
*/
|
||||||
|
public function pageArticles(array $page, string $langId, int $bs): array
|
||||||
|
{
|
||||||
|
$count = $this->pageArticlesCount((int)$page['id'], $langId);
|
||||||
|
$articlesLimit = (int)($page['articles_limit'] ?: 10);
|
||||||
|
$ls = (int)ceil($count / $articlesLimit);
|
||||||
|
|
||||||
|
if ($bs < 1) {
|
||||||
|
$bs = 1;
|
||||||
|
} elseif ($bs > $ls) {
|
||||||
|
$bs = $ls;
|
||||||
|
}
|
||||||
|
|
||||||
|
$from = $articlesLimit * ($bs - 1);
|
||||||
|
|
||||||
|
if ($from < 0) {
|
||||||
|
$from = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'articles' => $this->articlesIds((int)$page['id'], $langId, $articlesLimit, (int)($page['sort_type'] ?? 0), $from),
|
||||||
|
'ls' => $ls,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera artykuly-aktualnosci ze strony (z sortowaniem wg page_sort).
|
||||||
|
*/
|
||||||
|
public function news(int $pageId, int $limit, string $langId): ?array
|
||||||
|
{
|
||||||
|
$sort = (int)$this->db->get('pp_pages', 'sort_type', ['id' => $pageId]);
|
||||||
|
|
||||||
|
$articlesIds = $this->articlesIds($pageId, $langId, $limit, $sort, 0);
|
||||||
|
|
||||||
|
$articles = null;
|
||||||
|
if (is_array($articlesIds) && !empty($articlesIds)) {
|
||||||
|
foreach ($articlesIds as $articleId) {
|
||||||
|
$articles[] = $this->articleDetailsFrontend($articleId, $langId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $articles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sprawdza czy artykul ma flage noindex (z Redis cache).
|
||||||
|
*/
|
||||||
|
public function articleNoindex(int $articleId, string $langId): bool
|
||||||
|
{
|
||||||
|
$cacheHandler = new \CacheHandler();
|
||||||
|
$cacheKey = "ArticleRepository::articleNoindex:{$articleId}:{$langId}";
|
||||||
|
|
||||||
|
$objectData = $cacheHandler->get($cacheKey);
|
||||||
|
|
||||||
|
if ($objectData) {
|
||||||
|
return (bool)unserialize($objectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
$noindex = $this->db->get('pp_articles_langs', 'noindex', [
|
||||||
|
'AND' => ['article_id' => $articleId, 'lang_id' => $langId]
|
||||||
|
]);
|
||||||
|
|
||||||
|
$cacheHandler->set($cacheKey, $noindex);
|
||||||
|
|
||||||
|
return (bool)$noindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera najpopularniejsze artykuly ze strony (wg views DESC, z Redis cache).
|
||||||
|
*/
|
||||||
|
public function topArticles(int $pageId, int $limit, string $langId): ?array
|
||||||
|
{
|
||||||
|
$cacheHandler = new \CacheHandler();
|
||||||
|
$cacheKey = "ArticleRepository::topArticles:{$pageId}:{$limit}:{$langId}";
|
||||||
|
|
||||||
|
$objectData = $cacheHandler->get($cacheKey);
|
||||||
|
|
||||||
|
if (!$objectData) {
|
||||||
|
$articlesData = $this->db->query(
|
||||||
|
'SELECT * FROM ( '
|
||||||
|
. 'SELECT '
|
||||||
|
. 'a.id, date_add, views, '
|
||||||
|
. '( CASE '
|
||||||
|
. 'WHEN copy_from IS NULL THEN title '
|
||||||
|
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||||
|
. 'SELECT title FROM pp_articles_langs '
|
||||||
|
. 'WHERE lang_id = al.copy_from AND article_id = a.id '
|
||||||
|
. ') '
|
||||||
|
. 'END ) AS title '
|
||||||
|
. 'FROM '
|
||||||
|
. 'pp_articles_pages AS ap '
|
||||||
|
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||||
|
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||||
|
. 'WHERE '
|
||||||
|
. 'status = 1 AND page_id = ' . (int)$pageId . ' AND lang_id = \'' . $langId . '\' '
|
||||||
|
. ') AS q1 '
|
||||||
|
. 'WHERE q1.title IS NOT NULL '
|
||||||
|
. 'ORDER BY q1.views DESC '
|
||||||
|
. 'LIMIT 0, ' . (int)$limit
|
||||||
|
)->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$cacheHandler->set($cacheKey, $articlesData);
|
||||||
|
} else {
|
||||||
|
$articlesData = unserialize($objectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
$articles = null;
|
||||||
|
if (\S::is_array_fix($articlesData)) {
|
||||||
|
foreach ($articlesData as $row) {
|
||||||
|
$articles[] = $this->articleDetailsFrontend((int)$row['id'], $langId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $articles;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera najnowsze artykuly ze strony (wg date_add DESC, z Redis cache).
|
||||||
|
*/
|
||||||
|
public function newsListArticles(int $pageId, int $limit, string $langId): ?array
|
||||||
|
{
|
||||||
|
$cacheHandler = new \CacheHandler();
|
||||||
|
$cacheKey = "ArticleRepository::newsListArticles:{$pageId}:{$limit}:{$langId}";
|
||||||
|
|
||||||
|
$objectData = $cacheHandler->get($cacheKey);
|
||||||
|
|
||||||
|
if (!$objectData) {
|
||||||
|
$articlesData = $this->db->query(
|
||||||
|
'SELECT * FROM ( '
|
||||||
|
. 'SELECT '
|
||||||
|
. 'a.id, date_add, '
|
||||||
|
. '( CASE '
|
||||||
|
. 'WHEN copy_from IS NULL THEN title '
|
||||||
|
. 'WHEN copy_from IS NOT NULL THEN ( '
|
||||||
|
. 'SELECT title FROM pp_articles_langs '
|
||||||
|
. 'WHERE lang_id = al.copy_from AND article_id = a.id '
|
||||||
|
. ') '
|
||||||
|
. 'END ) AS title '
|
||||||
|
. 'FROM '
|
||||||
|
. 'pp_articles_pages AS ap '
|
||||||
|
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
||||||
|
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
||||||
|
. 'WHERE '
|
||||||
|
. 'status = 1 AND page_id = ' . (int)$pageId . ' AND lang_id = \'' . $langId . '\' '
|
||||||
|
. ') AS q1 '
|
||||||
|
. 'WHERE q1.title IS NOT NULL '
|
||||||
|
. 'ORDER BY q1.date_add DESC '
|
||||||
|
. 'LIMIT 0, ' . (int)$limit
|
||||||
|
)->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
|
||||||
|
$cacheHandler->set($cacheKey, $articlesData);
|
||||||
|
} else {
|
||||||
|
$articlesData = unserialize($objectData);
|
||||||
|
}
|
||||||
|
|
||||||
|
$articles = null;
|
||||||
|
if (\S::is_array_fix($articlesData)) {
|
||||||
|
foreach ($articlesData as $row) {
|
||||||
|
$articles[] = $this->articleDetailsFrontend((int)$row['id'], $langId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1524,7 +1524,7 @@ class ProductRepository
|
|||||||
{
|
{
|
||||||
global $lang_id;
|
global $lang_id;
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details( true );
|
$settings = ( new \Domain\Settings\SettingsRepository( $this->db ) )->allSettings( true );
|
||||||
|
|
||||||
$domainPrefix = 'https';
|
$domainPrefix = 'https';
|
||||||
$url = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
|
$url = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
|
||||||
|
|||||||
@@ -1,217 +0,0 @@
|
|||||||
<?php
|
|
||||||
class Article implements \ArrayAccess
|
|
||||||
{
|
|
||||||
public function __construct( $article_id, $lang_id )
|
|
||||||
{
|
|
||||||
global $mdb;
|
|
||||||
|
|
||||||
$result = $mdb -> get( 'pp_articles', '*', [ 'id' => (int)$article_id ] );
|
|
||||||
if ( \S::is_array_fix( $result ) ) foreach ( $result as $key => $val )
|
|
||||||
$this -> $key = $val;
|
|
||||||
|
|
||||||
$results = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $lang_id ] ] );
|
|
||||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
|
||||||
{
|
|
||||||
if ( $row['copy_from'] )
|
|
||||||
{
|
|
||||||
$results2 = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $row['copy_from'] ] ] );
|
|
||||||
if ( is_array( $results2 ) ) foreach ( $results2 as $row2 )
|
|
||||||
$this -> language = $row2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$this -> language = $row;
|
|
||||||
|
|
||||||
preg_match_all( \front\view\Site::container_pattern, $this -> language['entry'], $container_list );
|
|
||||||
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
|
|
||||||
{
|
|
||||||
$container_list_tmp = explode( ':', $container_list_tmp );
|
|
||||||
$this -> language['entry'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $this -> language['entry'] );
|
|
||||||
}
|
|
||||||
|
|
||||||
preg_match_all( \front\view\Site::container_pattern, $this -> language['text'], $container_list );
|
|
||||||
if ( is_array( $container_list[0] ) ) foreach( $container_list[0] as $container_list_tmp )
|
|
||||||
{
|
|
||||||
$container_list_tmp = explode( ':', $container_list_tmp );
|
|
||||||
$this -> language['text'] = str_replace( '[KONTENER:' . $container_list_tmp[1] . ']', \front\view\Scontainers::scontainer( $container_list_tmp[1] ), $this -> language['text'] );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this -> images = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'ASC' ] ] );
|
|
||||||
$this -> files = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
|
|
||||||
$this -> pages = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
|
|
||||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
|
||||||
{
|
|
||||||
if ( !$row['language_id'] )
|
|
||||||
$params[ $row['name'] ] = $row['value'];
|
|
||||||
else
|
|
||||||
$params[ $row['name'] ][$row['language_id']] = $row['value'];
|
|
||||||
}
|
|
||||||
$this -> params = $params;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function get_from_cache( $article_id, $lang_id )
|
|
||||||
{
|
|
||||||
$cacheHandler = new \CacheHandler();
|
|
||||||
$cacheKey = "\Article::get_from_cache:$article_id:$lang_id";
|
|
||||||
|
|
||||||
$objectData = $cacheHandler -> get( $cacheKey );
|
|
||||||
|
|
||||||
if ( !$objectData )
|
|
||||||
{
|
|
||||||
$article = new \Article( $article_id, $lang_id );
|
|
||||||
|
|
||||||
$cacheHandler -> set( $cacheKey, $article );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unserialize( $objectData );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $article;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function updateView()
|
|
||||||
{
|
|
||||||
global $mdb;
|
|
||||||
$mdb -> update( 'pp_articles', [ 'views[+]' => 1 ], [ 'id' => $this -> id ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function newsList( $articles )
|
|
||||||
{
|
|
||||||
return \Tpl::view( 'articles/news-list', [
|
|
||||||
'articles' => $articles
|
|
||||||
] );
|
|
||||||
}
|
|
||||||
|
|
||||||
// pobierz najczęściej wyświtlane artykuły
|
|
||||||
static public function getTopNews( $page_id, $limit = 6, $lang_id )
|
|
||||||
{
|
|
||||||
global $mdb;
|
|
||||||
|
|
||||||
$cacheHandler = new \CacheHandler();
|
|
||||||
$cacheKey = "\Article::getTopNews:$page_id:$limit:$lang_id";
|
|
||||||
|
|
||||||
$objectData = $cacheHandler -> get( $cacheKey );
|
|
||||||
|
|
||||||
if ( !$objectData )
|
|
||||||
{
|
|
||||||
$articles_id = $mdb -> query( 'SELECT * FROM ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'a.id, date_add, views, '
|
|
||||||
. '( CASE '
|
|
||||||
. 'WHEN copy_from IS NULL THEN title '
|
|
||||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_langs '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
|
||||||
. ') '
|
|
||||||
. 'END ) AS title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_pages AS ap '
|
|
||||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
|
||||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
|
||||||
. ') AS q1 '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'q1.title IS NOT NULL '
|
|
||||||
. 'ORDER BY '
|
|
||||||
. 'q1.views DESC '
|
|
||||||
. 'LIMIT '
|
|
||||||
. '0, ' . (int)$limit ) -> fetchAll( \PDO::FETCH_ASSOC );
|
|
||||||
|
|
||||||
$cacheHandler -> set( $cacheKey, $articles_id );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$articles_id = unserialize( $objectData );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( \S::is_array_fix( $articles_id ) ) foreach ( $articles_id as $article_tmp )
|
|
||||||
{
|
|
||||||
$article = \Article::get_from_cache( $article_tmp['id'], $lang_id );
|
|
||||||
$articles[] = $article;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $articles;
|
|
||||||
}
|
|
||||||
|
|
||||||
static public function getNews( $page_id, $limit = 6, $lang_id )
|
|
||||||
{
|
|
||||||
global $mdb;
|
|
||||||
|
|
||||||
if ( !$articles_id = \Cache::fetch( "getNews:$page_id:$limit:$lang_id" ) )
|
|
||||||
{
|
|
||||||
$articles_id = $mdb -> query( 'SELECT * FROM ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'a.id, date_add, '
|
|
||||||
. '( CASE '
|
|
||||||
. 'WHEN copy_from IS NULL THEN title '
|
|
||||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_langs '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
|
||||||
. ') '
|
|
||||||
. 'END ) AS title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_pages AS ap '
|
|
||||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
|
||||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
|
||||||
. ') AS q1 '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'q1.title IS NOT NULL '
|
|
||||||
. 'ORDER BY '
|
|
||||||
. 'q1.date_add DESC '
|
|
||||||
. 'LIMIT '
|
|
||||||
. '0, ' . (int)$limit ) -> fetchAll( \PDO::FETCH_ASSOC );
|
|
||||||
\Cache::store( "getNews:$page_id:$limit:$lang_id", $articles_id );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( \S::is_array_fix( $articles_id ) ) foreach ( $articles_id as $article_tmp )
|
|
||||||
{
|
|
||||||
$article = \Article::get_from_cache( $article_tmp['id'], $lang_id );
|
|
||||||
$articles[] = $article;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $articles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __get( $variable )
|
|
||||||
{
|
|
||||||
if ( array_key_exists( $variable, $this -> data ) )
|
|
||||||
return $this -> $variable;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __set( $variable, $value )
|
|
||||||
{
|
|
||||||
$this -> $variable = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function offsetExists( $offset )
|
|
||||||
{
|
|
||||||
return isset( $this -> $offset );
|
|
||||||
}
|
|
||||||
|
|
||||||
public function offsetGet( $offset )
|
|
||||||
{
|
|
||||||
return $this -> $offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function offsetSet( $offset, $value )
|
|
||||||
{
|
|
||||||
$this -> $offset = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function offsetUnset( $offset )
|
|
||||||
{
|
|
||||||
unset( $this -> $offset );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -573,7 +573,7 @@ class S
|
|||||||
{
|
{
|
||||||
global $mdb;
|
global $mdb;
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details( true );
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings( true );
|
||||||
|
|
||||||
$url = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
|
$url = preg_replace( '#^(http(s)?://)?w{3}\.#', '$1', $_SERVER['SERVER_NAME'] );
|
||||||
|
|
||||||
|
|||||||
241
autoload/front/Views/Articles.php
Normal file
241
autoload/front/Views/Articles.php
Normal file
@@ -0,0 +1,241 @@
|
|||||||
|
<?php
|
||||||
|
namespace front\Views;
|
||||||
|
|
||||||
|
class Articles
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Renderuje pelny widok pojedynczego artykulu.
|
||||||
|
*/
|
||||||
|
public static function fullArticle( $article )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->article = $article;
|
||||||
|
return $tpl->render( 'articles/article' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renderuje liste artykulow w trybie miniaturek z pagerem.
|
||||||
|
*/
|
||||||
|
public static function miniatureArticlesList( $articles, $ls, $bs, $page )
|
||||||
|
{
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
if ( is_array( $articles ) ) foreach ( $articles as $article )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->article = $article;
|
||||||
|
$out .= $tpl->render( 'articles/article-miniature' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $ls > 1 )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->ls = $ls;
|
||||||
|
$tpl->bs = $bs ? $bs : 1;
|
||||||
|
$tpl->page = $page;
|
||||||
|
$out .= $tpl->render( 'site/pager' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renderuje liste artykulow w trybie wprowadzen z pagerem.
|
||||||
|
*/
|
||||||
|
public static function entryArticlesList( $articles, $ls, $bs, $page )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->page_id = $page['id'];
|
||||||
|
$tpl->articles = $articles;
|
||||||
|
$out = $tpl->render( 'articles/articles-entries' );
|
||||||
|
|
||||||
|
if ( $ls > 1 )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->ls = $ls;
|
||||||
|
$tpl->bs = $bs ? $bs : 1;
|
||||||
|
$tpl->page = $page;
|
||||||
|
$out .= $tpl->render( 'site/pager' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renderuje liste pelnych artykulow z pagerem.
|
||||||
|
*/
|
||||||
|
public static function fullArticlesList( $articles, $ls, $bs, $page )
|
||||||
|
{
|
||||||
|
$out = '';
|
||||||
|
|
||||||
|
if ( is_array( $articles ) ) foreach ( $articles as $article )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->article = $article;
|
||||||
|
$out .= $tpl->render( 'articles/article-full' );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $ls > 1 )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->ls = $ls;
|
||||||
|
$tpl->bs = $bs ? $bs : 1;
|
||||||
|
$tpl->page = $page;
|
||||||
|
$out .= $tpl->render( 'site/pager' );
|
||||||
|
}
|
||||||
|
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renderuje box z aktualnosciami.
|
||||||
|
*/
|
||||||
|
public static function news( $page_id, $articles )
|
||||||
|
{
|
||||||
|
$tpl = new \Tpl;
|
||||||
|
$tpl->page_id = $page_id;
|
||||||
|
$tpl->articles = $articles;
|
||||||
|
return $tpl->render( 'articles/news' );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renderuje prosta liste artykulow (news-list).
|
||||||
|
*/
|
||||||
|
public static function newsList( $articles )
|
||||||
|
{
|
||||||
|
return \Tpl::view( 'articles/news-list', [
|
||||||
|
'articles' => $articles
|
||||||
|
] );
|
||||||
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// UTILITY (czyste transformacje HTML, brak DB)
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generuje spis tresci z naglowkow HTML.
|
||||||
|
*/
|
||||||
|
public static function generateTableOfContents( $content )
|
||||||
|
{
|
||||||
|
$result = '';
|
||||||
|
$currentLevel = [];
|
||||||
|
|
||||||
|
preg_match_all( '/<(h[1-6])([^>]*)>(.*?)<\/\1>/', $content, $matches, PREG_SET_ORDER );
|
||||||
|
|
||||||
|
$firstLevel = true;
|
||||||
|
|
||||||
|
foreach ( $matches as $match )
|
||||||
|
{
|
||||||
|
$level = intval( substr( $match[1], 1 ) );
|
||||||
|
|
||||||
|
while ( $level < count( $currentLevel ) )
|
||||||
|
{
|
||||||
|
$result .= '</li></ol>';
|
||||||
|
array_pop( $currentLevel );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $level > count( $currentLevel ) )
|
||||||
|
{
|
||||||
|
while ( $level > count( $currentLevel ) )
|
||||||
|
{
|
||||||
|
if ( count( $currentLevel ) > 0 || $firstLevel )
|
||||||
|
{
|
||||||
|
$result .= '<ol>';
|
||||||
|
$firstLevel = false;
|
||||||
|
}
|
||||||
|
array_push( $currentLevel, 0 );
|
||||||
|
}
|
||||||
|
$result .= '<li>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$result .= '</li><li>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$currentLevel[ count( $currentLevel ) - 1 ]++;
|
||||||
|
|
||||||
|
preg_match( '/\sid="([^"]*)"/', $match[2], $idMatches );
|
||||||
|
$id = isset( $idMatches[1] ) ? $idMatches[1] : '';
|
||||||
|
|
||||||
|
$result .= sprintf(
|
||||||
|
'<a href="#%s">%s</a>',
|
||||||
|
urlencode( strtolower( $id ) ),
|
||||||
|
$match[3]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
while ( !empty( $currentLevel ) )
|
||||||
|
{
|
||||||
|
$result .= '</li></ol>';
|
||||||
|
array_pop( $currentLevel );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( substr( $result, 0, 8 ) === '<ol><ol>' )
|
||||||
|
return substr( $result, 4, -5 );
|
||||||
|
else
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback dla processHeaders.
|
||||||
|
*/
|
||||||
|
public static function processHeaders( $matches )
|
||||||
|
{
|
||||||
|
$level = $matches[1];
|
||||||
|
$attrs = $matches[2];
|
||||||
|
$content = $matches[3];
|
||||||
|
$id_attr = 'id=';
|
||||||
|
$id_attr_pos = strpos( $attrs, $id_attr );
|
||||||
|
if ( $id_attr_pos === false )
|
||||||
|
{
|
||||||
|
$id = \S::seo( $content );
|
||||||
|
$attrs .= sprintf( ' id="%s"', $id );
|
||||||
|
}
|
||||||
|
|
||||||
|
return sprintf( '<h%d%s>%s</h%d>', $level, $attrs, $content, $level );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dodaje atrybuty id do naglowkow HTML.
|
||||||
|
*/
|
||||||
|
public static function generateHeadersIds( $text )
|
||||||
|
{
|
||||||
|
$pattern = '/<h([1-6])(.*?)>(.*?)<\/h\1>/si';
|
||||||
|
$text = preg_replace_callback( $pattern, array( __CLASS__, 'processHeaders' ), $text );
|
||||||
|
return $text;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pobiera glowne zdjecie artykulu (z entry, text lub galerii).
|
||||||
|
*/
|
||||||
|
public static function getImage( $article )
|
||||||
|
{
|
||||||
|
if ( $main_img = $article['language']['main_image'] )
|
||||||
|
return $main_img;
|
||||||
|
|
||||||
|
$dom = new \DOMDocument();
|
||||||
|
@$dom->loadHTML( mb_convert_encoding( $article['language']['entry'], 'HTML-ENTITIES', 'UTF-8' ) );
|
||||||
|
$images = $dom->getElementsByTagName( 'img' );
|
||||||
|
foreach ( $images as $img )
|
||||||
|
{
|
||||||
|
$src = $img->getAttribute( 'src' );
|
||||||
|
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
|
||||||
|
return $src;
|
||||||
|
}
|
||||||
|
|
||||||
|
$dom = new \DOMDocument();
|
||||||
|
@$dom->loadHTML( mb_convert_encoding( $article['language']['text'], 'HTML-ENTITIES', 'UTF-8' ) );
|
||||||
|
$images = $dom->getElementsByTagName( 'img' );
|
||||||
|
foreach ( $images as $img )
|
||||||
|
{
|
||||||
|
$src = $img->getAttribute( 'src' );
|
||||||
|
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
|
||||||
|
return $src;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( $article['images'] )
|
||||||
|
return $article['images'][0]['src'];
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,8 +35,10 @@ class Site
|
|||||||
{
|
{
|
||||||
global $page, $lang_id, $settings;
|
global $page, $lang_id, $settings;
|
||||||
|
|
||||||
|
$articleRepo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
|
||||||
if ( \S::get( 'article' ) )
|
if ( \S::get( 'article' ) )
|
||||||
return \front\view\Articles::full_article( \S::get( 'article' ), $lang_id );
|
return \front\Views\Articles::fullArticle( $articleRepo->articleDetailsFrontend( (int)\S::get( 'article' ), $lang_id ) );
|
||||||
|
|
||||||
// wyświetlenie pojedynczego produktu
|
// wyświetlenie pojedynczego produktu
|
||||||
if ( $product )
|
if ( $product )
|
||||||
@@ -86,26 +88,35 @@ class Site
|
|||||||
|
|
||||||
if ( $page['id'] )
|
if ( $page['id'] )
|
||||||
{
|
{
|
||||||
|
$bs = (int)\S::get( 'bs' );
|
||||||
|
$pageArticlesResult = $articleRepo->pageArticles( $page, $lang_id, $bs ?: 1 );
|
||||||
|
$articlesForPage = [];
|
||||||
|
if ( is_array( $pageArticlesResult['articles'] ) ) {
|
||||||
|
foreach ( $pageArticlesResult['articles'] as $aid ) {
|
||||||
|
$articlesForPage[] = $articleRepo->articleDetailsFrontend( (int)$aid, $lang_id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch ( $page['page_type'] )
|
switch ( $page['page_type'] )
|
||||||
{
|
{
|
||||||
/* pełne artykuły */
|
/* pełne artykuły */
|
||||||
case 0:
|
case 0:
|
||||||
return \front\view\Articles::full_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
return \front\Views\Articles::fullArticlesList( $articlesForPage, $pageArticlesResult['ls'], $bs ?: 1, $page );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* wprowadzenia */
|
/* wprowadzenia */
|
||||||
case 1:
|
case 1:
|
||||||
return \front\view\Articles::entry_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
return \front\Views\Articles::entryArticlesList( $articlesForPage, $pageArticlesResult['ls'], $bs ?: 1, $page );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* miniaturki */
|
/* miniaturki */
|
||||||
case 2:
|
case 2:
|
||||||
return \front\view\Articles::miniature_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
return \front\Views\Articles::miniatureArticlesList( $articlesForPage, $pageArticlesResult['ls'], $bs ?: 1, $page );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* strona kontaktu */
|
/* strona kontaktu */
|
||||||
case 4:
|
case 4:
|
||||||
$out = \front\view\Articles::full_articles_list( $page, $lang_id, \S::get( 'bs' ) );
|
$out = \front\Views\Articles::fullArticlesList( $articlesForPage, $pageArticlesResult['ls'], $bs ?: 1, $page );
|
||||||
$out .= \front\view\Site::contact();
|
$out .= \front\view\Site::contact();
|
||||||
return $out;
|
return $out;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,317 +1,66 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace front\factory;
|
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
|
class Articles
|
||||||
{
|
{
|
||||||
static public function generateTableOfContents($content) {
|
static public function generateTableOfContents( $content )
|
||||||
$result = '';
|
{
|
||||||
$currentLevel = [];
|
return \front\Views\Articles::generateTableOfContents( $content );
|
||||||
|
|
||||||
preg_match_all('/<(h[1-6])([^>]*)>(.*?)<\/\1>/', $content, $matches, PREG_SET_ORDER);
|
|
||||||
|
|
||||||
$firstLevel = true;
|
|
||||||
|
|
||||||
foreach ($matches as $match) {
|
|
||||||
$level = intval(substr($match[1], 1));
|
|
||||||
|
|
||||||
while ($level < count($currentLevel)) {
|
|
||||||
$result .= '</li></ol>';
|
|
||||||
array_pop($currentLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($level > count($currentLevel)) {
|
|
||||||
while ($level > count($currentLevel)) {
|
|
||||||
if (count($currentLevel) > 0 || $firstLevel) {
|
|
||||||
$result .= '<ol>';
|
|
||||||
$firstLevel = false;
|
|
||||||
}
|
|
||||||
array_push($currentLevel, 0);
|
|
||||||
}
|
|
||||||
$result .= '<li>';
|
|
||||||
} else {
|
|
||||||
$result .= '</li><li>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$currentLevel[count($currentLevel) - 1]++;
|
|
||||||
|
|
||||||
preg_match('/\sid="([^"]*)"/', $match[2], $idMatches);
|
|
||||||
$id = isset($idMatches[1]) ? $idMatches[1] : '';
|
|
||||||
|
|
||||||
$result .= sprintf(
|
|
||||||
'<a href="#%s">%s</a>',
|
|
||||||
urlencode(strtolower($id)),
|
|
||||||
$match[3]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!empty($currentLevel)) {
|
|
||||||
$result .= '</li></ol>';
|
|
||||||
array_pop($currentLevel);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (substr($result, 0, 8) === '<ol><ol>') {
|
|
||||||
return substr($result, 4, -5);
|
|
||||||
} else {
|
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// funkcja wywoływana dla każdego dopasowania do wyrażenia regularnego
|
|
||||||
static public function processHeaders( $matches )
|
static public function processHeaders( $matches )
|
||||||
{
|
{
|
||||||
$level = $matches[1];
|
return \front\Views\Articles::processHeaders( $matches );
|
||||||
$attrs = $matches[2];
|
|
||||||
$content = $matches[3];
|
|
||||||
$id_attr = 'id=';
|
|
||||||
$id_attr_pos = strpos($attrs, $id_attr);
|
|
||||||
if ($id_attr_pos === false) { // jeśli nie ma atrybutu id
|
|
||||||
$id = \S::seo( $content );
|
|
||||||
$attrs .= sprintf(' id="%s"', $id);
|
|
||||||
}
|
|
||||||
|
|
||||||
$html = sprintf( '<h%d%s>%s</h%d>', $level, $attrs, $content, $level );
|
|
||||||
return $html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function generateHeadersIds( $text )
|
static public function generateHeadersIds( $text )
|
||||||
{
|
{
|
||||||
$pattern = '/<h([1-6])(.*?)>(.*?)<\/h\1>/si';
|
return \front\Views\Articles::generateHeadersIds( $text );
|
||||||
|
|
||||||
$text = preg_replace_callback( $pattern, array(__CLASS__, 'processHeaders'), $text );
|
|
||||||
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function news( $page_id, $limit = 6, $lang_id )
|
|
||||||
{
|
|
||||||
$sort = \front\factory\Pages::page_sort( $page_id );
|
|
||||||
|
|
||||||
$articles_id = \front\factory\Articles::artciles_id( (int)$page_id, $lang_id, $limit, $sort, 0 );
|
|
||||||
if ( is_array( $articles_id ) and !empty( $articles_id ) ) foreach ( $articles_id as $article_id )
|
|
||||||
$articles[] = \front\factory\Articles::article_details( $article_id, $lang_id );
|
|
||||||
|
|
||||||
return $articles;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function get_image( $article )
|
public static function get_image( $article )
|
||||||
{
|
{
|
||||||
if ( $main_img = $article['language']['main_image'] )
|
return \front\Views\Articles::getImage( $article );
|
||||||
return $main_img;
|
|
||||||
|
|
||||||
$dom = new \DOMDocument();
|
|
||||||
$dom -> loadHTML( mb_convert_encoding( $article['language']['entry'], 'HTML-ENTITIES', "UTF-8" ) );
|
|
||||||
$images = $dom -> getElementsByTagName( 'img' );
|
|
||||||
foreach ( $images as $img )
|
|
||||||
{
|
|
||||||
$src = $img -> getAttribute( 'src' );
|
|
||||||
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
|
|
||||||
return $src;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dom = new \DOMDocument();
|
|
||||||
$dom -> loadHTML( mb_convert_encoding( $article['language']['text'], 'HTML-ENTITIES', "UTF-8" ) );
|
|
||||||
$images = $dom -> getElementsByTagName( 'img' );
|
|
||||||
foreach ( $images as $img )
|
|
||||||
{
|
|
||||||
$src = $img -> getAttribute( 'src' );
|
|
||||||
if ( file_exists( substr( $src, 1, strlen( $src ) ) ) )
|
|
||||||
return $src;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $article['images'] )
|
|
||||||
return $article['images'][0]['src'];
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function article_noindex( $article_id )
|
public static function article_noindex( $article_id )
|
||||||
{
|
{
|
||||||
global $mdb, $lang;
|
global $lang;
|
||||||
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
$cacheHandler = new \CacheHandler();
|
return $repo->articleNoindex( (int)$article_id, $lang[0] );
|
||||||
$cacheKey = "\front\factory\Articles::article_noindex:$article_id";
|
|
||||||
|
|
||||||
$objectData = $cacheHandler -> get( $cacheKey );
|
|
||||||
|
|
||||||
if ( !$objectData )
|
|
||||||
{
|
|
||||||
$noindex = $mdb -> get( 'pp_articles_langs', 'noindex', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $lang[0] ] ] );
|
|
||||||
|
|
||||||
$cacheHandler -> set( $cacheKey, $noindex );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unserialize( $objectData );
|
|
||||||
}
|
|
||||||
return $noindex;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function page_articles( $page, $lang_id, $bs )
|
|
||||||
{
|
|
||||||
$count = \front\factory\Articles::page_articles_count( $page['id'], $lang_id );
|
|
||||||
$ls = ceil( $count / $page['articles_limit'] );
|
|
||||||
|
|
||||||
if ( $bs < 1 )
|
|
||||||
$bs = 1;
|
|
||||||
else if ( $bs > $ls )
|
|
||||||
$bs = $ls;
|
|
||||||
|
|
||||||
$from = $page['articles_limit'] * ( $bs - 1 );
|
|
||||||
|
|
||||||
if ( $from < 0 )
|
|
||||||
$from = 0;
|
|
||||||
|
|
||||||
$results['articles'] = \front\factory\Articles::artciles_id( (int)$page['id'], $lang_id, (int)$page['articles_limit'], $page['sort_type'], $from );
|
|
||||||
$results['ls'] = $ls;
|
|
||||||
|
|
||||||
return $results;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function article_details( $article_id, $lang_id )
|
public static function article_details( $article_id, $lang_id )
|
||||||
{
|
{
|
||||||
global $mdb;
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
return $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
||||||
$cacheHandler = new \CacheHandler();
|
|
||||||
$cacheKey = "\front\factory\Articles::article_details:$article_id:$lang_id";
|
|
||||||
|
|
||||||
$objectData = $cacheHandler->get($cacheKey);
|
|
||||||
|
|
||||||
if ( !$objectData )
|
|
||||||
{
|
|
||||||
$article = $mdb -> get( 'pp_articles', '*', [ 'id' => (int)$article_id ] );
|
|
||||||
|
|
||||||
$results = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $lang_id ] ] );
|
|
||||||
if ( is_array( $results ) ) foreach ( $results as $row )
|
|
||||||
{
|
|
||||||
if ( $row['copy_from'] )
|
|
||||||
{
|
|
||||||
$results2 = $mdb -> select( 'pp_articles_langs', '*', [ 'AND' => [ 'article_id' => (int)$article_id, 'lang_id' => $row['copy_from'] ] ] );
|
|
||||||
if ( is_array( $results2 ) ) foreach ( $results2 as $row2 )
|
|
||||||
$article['language'] = $row2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
$article['language'] = $row;
|
|
||||||
}
|
|
||||||
|
|
||||||
$article['images'] = $mdb -> select( 'pp_articles_images', '*', [ 'article_id' => (int)$article_id, 'ORDER' => [ 'o' => 'ASC', 'id' => 'DESC' ] ] );
|
|
||||||
$article['files'] = $mdb -> select( 'pp_articles_files', '*', [ 'article_id' => (int)$article_id ] );
|
|
||||||
$article['pages'] = $mdb -> select( 'pp_articles_pages', 'page_id', [ 'article_id' => (int)$article_id ] );
|
|
||||||
|
|
||||||
$cacheHandler -> set( $cacheKey, $article );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unserialize( $objectData );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $article;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function artciles_id( $page_id, $lang_id, $articles_limit, $sort_type, $from )
|
public static function artciles_id( $page_id, $lang_id, $articles_limit, $sort_type, $from )
|
||||||
{
|
{
|
||||||
global $mdb;
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
return $repo->articlesIds( (int)$page_id, $lang_id, (int)$articles_limit, (int)$sort_type, (int)$from );
|
||||||
switch ( $sort_type )
|
|
||||||
{
|
|
||||||
case 0: $order = 'date_add ASC'; break;
|
|
||||||
case 1: $order = 'date_add DESC'; break;
|
|
||||||
case 2: $order = 'date_modify ASC'; break;
|
|
||||||
case 3: $order = 'date_modify DESC'; break;
|
|
||||||
case 4: $order = 'o ASC'; break;
|
|
||||||
case 5: $order = 'title ASC'; break;
|
|
||||||
case 6: $order = 'title DESC'; break;
|
|
||||||
default: $order = 'id ASC'; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$cacheHandler = new \CacheHandler();
|
|
||||||
$cacheKey = "\front\factory\Artiles::artciles_id:$page_id:$lang_id:$articles_limit:$sort_type:$from:$order";
|
|
||||||
|
|
||||||
$objectData = $cacheHandler->get($cacheKey);
|
|
||||||
|
|
||||||
if ( !$objectData )
|
|
||||||
{
|
|
||||||
$results = $mdb -> query( 'SELECT * FROM ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'a.id, date_modify, date_add, o, '
|
|
||||||
. '( CASE '
|
|
||||||
. 'WHEN copy_from IS NULL THEN title '
|
|
||||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_langs '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
|
||||||
. ') '
|
|
||||||
. 'END ) AS title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_pages AS ap '
|
|
||||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
|
||||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
|
||||||
. ') AS q1 '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'q1.title IS NOT NULL '
|
|
||||||
. 'ORDER BY '
|
|
||||||
. 'q1.' . $order . ' '
|
|
||||||
. 'LIMIT '
|
|
||||||
. (int)$from . ',' . (int)$articles_limit ) -> fetchAll();
|
|
||||||
if ( is_array( $results ) and !empty( $results ) ) foreach ( $results as $row )
|
|
||||||
$output[] = $row['id'];
|
|
||||||
|
|
||||||
$cacheHandler -> set( $cacheKey, $output );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unserialize($objectData);
|
|
||||||
}
|
|
||||||
return $output;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function page_articles_count( $page_id, $lang_id )
|
public static function page_articles_count( $page_id, $lang_id )
|
||||||
{
|
{
|
||||||
global $mdb;
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
return $repo->pageArticlesCount( (int)$page_id, $lang_id );
|
||||||
|
}
|
||||||
|
|
||||||
$cacheHandler = new \CacheHandler();
|
public static function page_articles( $page, $lang_id, $bs )
|
||||||
$cacheKey = "\front\factory\Articles::page_articles_count:$page_id:$lang_id";
|
{
|
||||||
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
return $repo->pageArticles( $page, $lang_id, (int)$bs );
|
||||||
|
}
|
||||||
|
|
||||||
$objectData = $cacheHandler -> get( $cacheKey );
|
public static function news( $page_id, $limit = 6, $lang_id )
|
||||||
|
{
|
||||||
if ( !$objectData )
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
{
|
return $repo->news( (int)$page_id, (int)$limit, $lang_id );
|
||||||
$results = $mdb -> query( 'SELECT COUNT(0) FROM ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'a.id, '
|
|
||||||
. '( CASE '
|
|
||||||
. 'WHEN copy_from IS NULL THEN title '
|
|
||||||
. 'WHEN copy_from IS NOT NULL THEN ( '
|
|
||||||
. 'SELECT '
|
|
||||||
. 'title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_langs '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'lang_id = al.copy_from AND article_id = a.id '
|
|
||||||
. ') '
|
|
||||||
. 'END ) AS title '
|
|
||||||
. 'FROM '
|
|
||||||
. 'pp_articles_pages AS ap '
|
|
||||||
. 'INNER JOIN pp_articles AS a ON a.id = ap.article_id '
|
|
||||||
. 'INNER JOIN pp_articles_langs AS al ON al.article_id = ap.article_id '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'status = 1 AND page_id = ' . (int)$page_id . ' AND lang_id = \'' . $lang_id . '\' '
|
|
||||||
. ') AS q1 '
|
|
||||||
. 'WHERE '
|
|
||||||
. 'q1.title IS NOT NULL' ) -> fetchAll();
|
|
||||||
$articles_count = $results[0][0];
|
|
||||||
|
|
||||||
$cacheHandler -> set( $cacheKey, $articles_count );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return unserialize( $objectData );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $articles_count;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
namespace front\factory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fasada delegujaca do Domain\Settings\SettingsRepository.
|
|
||||||
*/
|
|
||||||
class Settings
|
|
||||||
{
|
|
||||||
public static function settings_details($admin = false)
|
|
||||||
{
|
|
||||||
global $mdb;
|
|
||||||
$repo = new \Domain\Settings\SettingsRepository($mdb);
|
|
||||||
return $repo->allSettings($admin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function get_single_settings_value($param)
|
|
||||||
{
|
|
||||||
global $mdb;
|
|
||||||
$repo = new \Domain\Settings\SettingsRepository($mdb);
|
|
||||||
return $repo->getSingleValue($param);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,90 +1,57 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace front\view;
|
namespace front\view;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
class Articles
|
||||||
{
|
{
|
||||||
public static function news( $page_id, $articles )
|
public static function news( $page_id, $articles )
|
||||||
{
|
{
|
||||||
$tpl = new \Tpl;
|
return \front\Views\Articles::news( $page_id, $articles );
|
||||||
$tpl -> page_id = $page_id;
|
|
||||||
$tpl -> articles = $articles;
|
|
||||||
return $tpl -> render( 'articles/news' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function full_article( $article_id, $lang_id )
|
public static function full_article( $article_id, $lang_id )
|
||||||
{
|
{
|
||||||
$tpl = new \Tpl;
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
$tpl -> article = \front\factory\Articles::article_details( $article_id, $lang_id );
|
$article = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
||||||
return $tpl -> render( 'articles/article' );
|
return \front\Views\Articles::fullArticle( $article );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
|
public static function miniature_articles_list( $page, $lang_id, $bs = 1 )
|
||||||
{
|
{
|
||||||
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
$results = $repo->pageArticles( $page, $lang_id, (int)$bs );
|
||||||
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
|
|
||||||
{
|
$articles = [];
|
||||||
$tpl = new \Tpl;
|
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article_id )
|
||||||
$tpl -> article = \front\factory\Articles::article_details( $article, $lang_id );
|
$articles[] = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
||||||
$out .= $tpl -> render( 'articles/article-miniature' );
|
|
||||||
}
|
return \front\Views\Articles::miniatureArticlesList( $articles, $results['ls'], $bs ?: 1, $page );
|
||||||
|
|
||||||
if ( $results['ls'] > 1 )
|
|
||||||
{
|
|
||||||
$tpl = new \Tpl;
|
|
||||||
$tpl -> ls = $results['ls'];
|
|
||||||
$tpl -> bs = $bs ? $bs : 1;
|
|
||||||
$tpl -> page = $page;
|
|
||||||
$out .= $tpl -> render( 'site/pager' );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function entry_articles_list( $page, $lang_id, $bs = 1 )
|
public static function entry_articles_list( $page, $lang_id, $bs = 1 )
|
||||||
{
|
{
|
||||||
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
$results = $repo->pageArticles( $page, $lang_id, (int)$bs );
|
||||||
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
|
|
||||||
$articles[] = \front\factory\Articles::article_details( $article, $lang_id );
|
$articles = [];
|
||||||
|
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article_id )
|
||||||
$tpl = new \Tpl;
|
$articles[] = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
||||||
$tpl -> page_id = $page['id'];
|
|
||||||
$tpl -> articles = $articles;
|
return \front\Views\Articles::entryArticlesList( $articles, $results['ls'], $bs ?: 1, $page );
|
||||||
$out .= $tpl -> render( 'articles/articles-entries' );
|
|
||||||
|
|
||||||
if ( $results['ls'] > 1 )
|
|
||||||
{
|
|
||||||
$tpl = new \Tpl;
|
|
||||||
$tpl -> ls = $results['ls'];
|
|
||||||
$tpl -> bs = $bs ? $bs : 1;
|
|
||||||
$tpl -> page = $page;
|
|
||||||
$out .= $tpl -> render( 'site/pager' );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function full_articles_list( $page, $lang_id, $bs = 1 )
|
public static function full_articles_list( $page, $lang_id, $bs = 1 )
|
||||||
{
|
{
|
||||||
$results = \front\factory\Articles::page_articles( $page, $lang_id, $bs );
|
$repo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
$results = $repo->pageArticles( $page, $lang_id, (int)$bs );
|
||||||
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article )
|
|
||||||
{
|
$articles = [];
|
||||||
$tpl = new \Tpl;
|
if ( is_array( $results['articles'] ) ) foreach ( $results['articles'] as $article_id )
|
||||||
$tpl -> article = \front\factory\Articles::article_details( $article, $lang_id );
|
$articles[] = $repo->articleDetailsFrontend( (int)$article_id, $lang_id );
|
||||||
$out .= $tpl -> render( 'articles/article-full' );
|
|
||||||
}
|
return \front\Views\Articles::fullArticlesList( $articles, $results['ls'], $bs ?: 1, $page );
|
||||||
|
|
||||||
if ( $results['ls'] > 1 )
|
|
||||||
{
|
|
||||||
$tpl = new \Tpl;
|
|
||||||
$tpl -> ls = $results['ls'];
|
|
||||||
$tpl -> bs = $bs ? $bs : 1;
|
|
||||||
$tpl -> page = $page;
|
|
||||||
$out .= $tpl -> render( 'site/pager' );
|
|
||||||
}
|
|
||||||
|
|
||||||
return $out;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class Site
|
|||||||
{
|
{
|
||||||
global $page, $settings, $settings, $lang, $lang_id;
|
global $page, $settings, $settings, $lang, $lang_id;
|
||||||
|
|
||||||
|
$articleRepo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
|
||||||
if ( (int) \S::get( 'layout_id' ) )
|
if ( (int) \S::get( 'layout_id' ) )
|
||||||
$layout = new \cms\Layout( (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] != '' ? $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] . ']';
|
$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],
|
$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 );
|
), $html );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +177,7 @@ class Site
|
|||||||
//
|
//
|
||||||
if ( \S::get( 'article' ) )
|
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'] )
|
if ( $article['language']['meta_title'] )
|
||||||
$page['language']['title'] = $article['language']['meta_title'];
|
$page['language']['title'] = $article['language']['meta_title'];
|
||||||
@@ -340,7 +342,7 @@ class Site
|
|||||||
/* atrybut noindex */
|
/* atrybut noindex */
|
||||||
if ( \S::get( 'article' ) )
|
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 );
|
$html = str_replace( '[META_INDEX]', '<meta name="robots" content="' . $noindex . '">', $html );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -390,29 +392,27 @@ class Site
|
|||||||
}
|
}
|
||||||
|
|
||||||
// prosta lista aktualności z wybranej podstrony
|
// prosta lista aktualności z wybranej podstrony
|
||||||
preg_match_all( self::news_list_pattern, $html, $news_list );
|
preg_match_all( self::news_list_pattern, $html, $news_list_matches );
|
||||||
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
|
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 = explode( ':', $news_list_tmp );
|
||||||
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
|
$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_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 );
|
$newsArticles = $articleRepo->newsListArticles( (int)$news_list_tmp[1], (int)$news_limit, $lang_id );
|
||||||
$view_news_list = \Article::newsList( $news_list );
|
$html = str_replace( $pattern, \front\Views\Articles::newsList( $newsArticles ), $html );
|
||||||
$html = str_replace( $pattern, $view_news_list, $html );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// prosta lista z najpopularniejszymi artykułami
|
// prosta lista z najpopularniejszymi artykułami
|
||||||
preg_match_all( self::top_news_pattern, $html, $news_list );
|
preg_match_all( self::top_news_pattern, $html, $top_news_matches );
|
||||||
if ( is_array( $news_list[0] ) ) foreach( $news_list[0] as $news_list_tmp )
|
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 = explode( ':', $news_list_tmp );
|
||||||
$news_list_tmp[2] != '' ? $news_limit = $news_list_tmp[2] : $news_limit = $settings['news_limit'];
|
$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_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 );
|
$topArticles = $articleRepo->topArticles( (int)$news_list_tmp[1], (int)$news_limit, $lang_id );
|
||||||
$view_news_list = \Article::newsList( $news_list );
|
$html = str_replace( $pattern, \front\Views\Articles::newsList( $topArticles ), $html );
|
||||||
$html = str_replace( $pattern, $view_news_list, $html );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
|
$html = str_replace( '[ALERT]', \front\view\Site::alert(), $html );
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ class Order implements \ArrayAccess
|
|||||||
|
|
||||||
$order_statuses = self::order_statuses();
|
$order_statuses = self::order_statuses();
|
||||||
|
|
||||||
$firm_name = \front\factory\Settings::get_single_settings_value( 'firm_name' );
|
$firm_name = ( new \Domain\Settings\SettingsRepository( $mdb ) )->getSingleValue( 'firm_name' );
|
||||||
|
|
||||||
switch( $this -> status ):
|
switch( $this -> status ):
|
||||||
case 0:
|
case 0:
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ if ( !$config['trustmate']['enabled'] )
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
|
|
||||||
$order_id = $mdb -> get( 'pp_shop_orders', '*', [ 'AND' => [ 'status' => 6, 'trustmate_send' => 0 ] ] );
|
$order_id = $mdb -> get( 'pp_shop_orders', '*', [ 'AND' => [ 'status' => 6, 'trustmate_send' => 0 ] ] );
|
||||||
if ( is_array( $order_id ) and $order_id['id'] )
|
if ( is_array( $order_id ) and $order_id['id'] )
|
||||||
|
|||||||
2
cron.php
2
cron.php
@@ -52,7 +52,7 @@ $mdb = new medoo( [
|
|||||||
'charset' => 'utf8'
|
'charset' => 'utf8'
|
||||||
] );
|
] );
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
$integrationsRepository = new \Domain\Integrations\IntegrationsRepository( $mdb );
|
$integrationsRepository = new \Domain\Integrations\IntegrationsRepository( $mdb );
|
||||||
$apilo_settings = $integrationsRepository -> getSettings( 'apilo' );
|
$apilo_settings = $integrationsRepository -> getSettings( 'apilo' );
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ $mdb = new medoo( [
|
|||||||
'charset' => 'utf8'
|
'charset' => 'utf8'
|
||||||
] );
|
] );
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
$lang_id = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->defaultLanguage();
|
$lang_id = ( new \Domain\Languages\LanguagesRepository( $mdb ) )->defaultLanguage();
|
||||||
|
|
||||||
( new \Domain\Product\ProductRepository( $mdb ) )->generateGoogleFeedXml();
|
( new \Domain\Product\ProductRepository( $mdb ) )->generateGoogleFeedXml();
|
||||||
@@ -4,6 +4,25 @@ Logi zmian z migracji na Domain-Driven Architecture. Najnowsze na gorze.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## ver. 0.280 (2026-02-16) - Articles frontend migration
|
||||||
|
|
||||||
|
- **Articles (frontend)** — pelna migracja na Domain + Views
|
||||||
|
- NOWE METODY w `ArticleRepository`: `articleDetailsFrontend()`, `articlesIds()`, `pageArticlesCount()`, `pageArticles()`, `news()`, `articleNoindex()`, `topArticles()`, `newsListArticles()`
|
||||||
|
- NOWY: `front\Views\Articles` — czysty VIEW + utility (renderowanie, generateTableOfContents, generateHeadersIds, getImage)
|
||||||
|
- UPDATE: `front\view\Site::show()` — przepiecie 5 sekcji na repo + Views (BOX aktualnosci, article meta, noindex, news list, top articles)
|
||||||
|
- UPDATE: `front\controls\Site::route()` — przepiecie single article + page_type switch (4 typy) na repo + Views
|
||||||
|
- UPDATE: 5 szablonow `templates/articles/*` — przepiecie na `\front\Views\Articles::`
|
||||||
|
- FASADA: `front\factory\Articles` — 10 metod delegujacych do repo + Views
|
||||||
|
- FASADA: `front\view\Articles` — 5 metod delegujacych do repo + Views
|
||||||
|
- USUNIETA: `class.Article` — encja + metody statyczne; logika przeniesiona do `ArticleRepository` + `front\Views\Articles`
|
||||||
|
- FIX: eliminacja `global $lang` z `articleNoindex()` — zamiana na jawny parametr `$langId`
|
||||||
|
- FIX: eliminacja zaleznosci od `\front\factory\Pages::page_sort()` w `news()` — inline query
|
||||||
|
- FIX: naprawione kolizje nazw zmiennych w `front\view\Site::show()` ($news_list → $news_list_matches, $top_news_matches)
|
||||||
|
- Testy: 450 OK, 1431 asercji (+13 nowych testow w ArticleRepositoryTest)
|
||||||
|
- UPDATE: `tests/bootstrap.php` — dodany stub `S::is_array_fix()`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## ver. 0.279 (2026-02-16) - Newsletter + Languages frontend migration, front\Controllers, front\Views
|
## ver. 0.279 (2026-02-16) - Newsletter + Languages frontend migration, front\Controllers, front\Views
|
||||||
|
|
||||||
- **Languages (view)** — migracja do nowego namespace
|
- **Languages (view)** — migracja do nowego namespace
|
||||||
|
|||||||
@@ -215,7 +215,38 @@ Legacy Cleanup
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Etap: Banners, Menu, Pages, Articles, Layouts Frontend Services
|
### Etap: Articles Frontend — ZREALIZOWANY
|
||||||
|
|
||||||
|
**Cel:** Migracja `front\factory\Articles`, `front\view\Articles` i statycznych metod `class.Article` do Domain + Views.
|
||||||
|
|
||||||
|
**DODANE METODY (do istniejącej klasy `ArticleRepository`):**
|
||||||
|
- `articleDetailsFrontend(int $articleId, string $langId): ?array` — z copy_from fallback + Redis cache
|
||||||
|
- `articlesIds(int $pageId, string $langId, int $limit, int $sortType, int $from): ?array` — złożone SQL z language fallback + sortowanie + LIMIT + Redis cache
|
||||||
|
- `pageArticlesCount(int $pageId, string $langId): int` — COUNT z Redis cache
|
||||||
|
- `pageArticles(array $page, string $langId, int $bs): array` — paginacja
|
||||||
|
- `news(int $pageId, int $limit, string $langId): ?array` — inline sort_type query (eliminacja zależności od `front\factory\Pages`)
|
||||||
|
- `articleNoindex(int $articleId, string $langId): bool` — jawny $langId zamiast `global $lang`
|
||||||
|
- `topArticles(int $pageId, int $limit, string $langId): ?array` — ORDER BY views DESC + Redis cache
|
||||||
|
- `newsListArticles(int $pageId, int $limit, string $langId): ?array` — ORDER BY date_add DESC + CacheHandler (Redis) zamiast legacy `\Cache`
|
||||||
|
|
||||||
|
**NOWE:**
|
||||||
|
- `front\Views\Articles` — czysty VIEW + utility:
|
||||||
|
- Renderowanie: `fullArticle()`, `miniatureArticlesList()`, `entryArticlesList()`, `fullArticlesList()`, `news()`, `newsList()`
|
||||||
|
- Utility: `generateTableOfContents()`, `processHeaders()`, `generateHeadersIds()`, `getImage()`
|
||||||
|
|
||||||
|
**ZMIANA:**
|
||||||
|
- `front\factory\Articles` → fasada (10 metod delegujących do repo + Views)
|
||||||
|
- `front\view\Articles` → fasada (5 metod delegujących do repo + Views)
|
||||||
|
- `class.Article` → USUNIĘTA (encja + metody statyczne przeniesione do `ArticleRepository` + `front\Views\Articles`)
|
||||||
|
- `front\view\Site::show()` → 5 sekcji przepiętych na repo + Views
|
||||||
|
- `front\controls\Site::route()` → single article + page_type switch przepięte na repo + Views
|
||||||
|
- 5 szablonów `templates/articles/*` → `\front\Views\Articles::`
|
||||||
|
- `tests/bootstrap.php` — dodany stub `S::is_array_fix()`
|
||||||
|
- Testy: 13 nowych w `ArticleRepositoryTest` (450 OK, 1431 asercji)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Etap: Banners, Menu, Pages, Layouts Frontend Services
|
||||||
|
|
||||||
**Cel:** Migracja pozostałych fabryk "liściowych".
|
**Cel:** Migracja pozostałych fabryk "liściowych".
|
||||||
|
|
||||||
@@ -223,12 +254,11 @@ Legacy Cleanup
|
|||||||
- `Domain/Banner/BannerFrontendService.php` — `mainBanner()`, `banners()` (filtrowanie po datach)
|
- `Domain/Banner/BannerFrontendService.php` — `mainBanner()`, `banners()` (filtrowanie po datach)
|
||||||
- `Domain/Menu/MenuFrontendService.php` — `menuDetails()`, `menuPages()` (rekurencja)
|
- `Domain/Menu/MenuFrontendService.php` — `menuDetails()`, `menuPages()` (rekurencja)
|
||||||
- `Domain/Pages/PagesFrontendService.php` — `pageDetails()`, `mainPageId()`, `langUrl()`, `pageSort()`
|
- `Domain/Pages/PagesFrontendService.php` — `pageDetails()`, `mainPageId()`, `langUrl()`, `pageSort()`
|
||||||
- `Domain/Article/ArticleFrontendService.php` — `articleDetails()`, `news()`, `pageArticles()`, `pageArticlesCount()`, `generateTableOfContents()`, `generateHeadersIds()`
|
|
||||||
- `Domain/Layouts/LayoutsFrontendService.php` — `activeLayout()`, `articleLayout()`, `productLayout()`, `categoryLayout()`, `defaultLayout()`, `categoryDefaultLayout()`
|
- `Domain/Layouts/LayoutsFrontendService.php` — `activeLayout()`, `articleLayout()`, `productLayout()`, `categoryLayout()`, `defaultLayout()`, `categoryDefaultLayout()`
|
||||||
- Testy: 5 plików testowych
|
- Testy: 4 pliki testowe
|
||||||
|
|
||||||
**ZMIANA:**
|
**ZMIANA:**
|
||||||
- `front/factory/Banners`, `Menu`, `Pages`, `Articles`, `Layouts` → fasady
|
- `front/factory/Banners`, `Menu`, `Pages`, `Layouts` → fasady
|
||||||
|
|
||||||
**BUG FIX:** `cms\Layout::__get()` — poprawka referencji do `$this->data`
|
**BUG FIX:** `cms\Layout::__get()` — poprawka referencji do `$this->data`
|
||||||
|
|
||||||
|
|||||||
@@ -101,7 +101,11 @@ shopPRO/
|
|||||||
│ │ └── factory/ # Fabryki/helpery
|
│ │ └── factory/ # Fabryki/helpery
|
||||||
│ ├── Domain/ # Repozytoria/logika domenowa
|
│ ├── Domain/ # Repozytoria/logika domenowa
|
||||||
│ ├── front/ # Klasy frontendu
|
│ ├── front/ # Klasy frontendu
|
||||||
│ │ └── factory/ # Fabryki/helpery
|
│ │ ├── Controllers/ # Nowe kontrolery DI (Newsletter)
|
||||||
|
│ │ ├── Views/ # Nowe widoki (Newsletter, Articles, Languages)
|
||||||
|
│ │ ├── controls/ # Kontrolery legacy (Site, ShopBasket, ...)
|
||||||
|
│ │ ├── view/ # Widoki legacy (Site, ...)
|
||||||
|
│ │ └── factory/ # Fabryki/helpery (fasady)
|
||||||
│ └── shop/ # Klasy sklepu
|
│ └── shop/ # Klasy sklepu
|
||||||
├── docs/ # Dokumentacja techniczna
|
├── docs/ # Dokumentacja techniczna
|
||||||
├── libraries/ # Biblioteki zewnętrzne
|
├── libraries/ # Biblioteki zewnętrzne
|
||||||
|
|||||||
@@ -36,7 +36,14 @@ Alternatywnie (Git Bash):
|
|||||||
Ostatnio zweryfikowano: 2026-02-16
|
Ostatnio zweryfikowano: 2026-02-16
|
||||||
|
|
||||||
```text
|
```text
|
||||||
OK (437 tests, 1398 assertions)
|
OK (450 tests, 1431 assertions)
|
||||||
|
```
|
||||||
|
|
||||||
|
Aktualizacja po migracji Articles frontend (2026-02-16, ver. 0.280):
|
||||||
|
```text
|
||||||
|
Pelny suite: OK (450 tests, 1431 assertions)
|
||||||
|
Nowe testy: ArticleRepositoryTest (+13: articleDetailsFrontend, copyFromFallback, articlesIds, pageArticlesCount, pageArticlesPagination, articleNoindex, news, topArticles, newsListArticles)
|
||||||
|
Zaktualizowane: tests/bootstrap.php (stub: S::is_array_fix)
|
||||||
```
|
```
|
||||||
|
|
||||||
Aktualizacja po migracji Newsletter + Languages frontend (2026-02-16, ver. 0.279):
|
Aktualizacja po migracji Newsletter + Languages frontend (2026-02-16, ver. 0.279):
|
||||||
|
|||||||
@@ -18,17 +18,17 @@ Aktualizacje znajdują się w folderze `updates/0.XX/` gdzie XX oznacza dziesią
|
|||||||
|
|
||||||
## Procedura tworzenia nowej aktualizacji
|
## Procedura tworzenia nowej aktualizacji
|
||||||
|
|
||||||
## Status biezacej aktualizacji (ver. 0.279)
|
## Status biezacej aktualizacji (ver. 0.280)
|
||||||
|
|
||||||
- Wersja udostepniona: `0.279` (data: 2026-02-16).
|
- Wersja udostepniona: `0.280` (data: 2026-02-16).
|
||||||
- Pliki publikacyjne:
|
- Pliki publikacyjne:
|
||||||
- `updates/0.20/ver_0.279.zip`
|
- `updates/0.20/ver_0.280.zip`
|
||||||
- `updates/0.20/ver_0.279_files.txt`
|
- `updates/0.20/ver_0.280_files.txt`
|
||||||
- Pliki metadanych aktualizacji:
|
- Pliki metadanych aktualizacji:
|
||||||
- `updates/changelog.php` (dodany wpis `ver. 0.279`)
|
- `updates/changelog.php` (dodany wpis `ver. 0.280`)
|
||||||
- `updates/versions.php` (`$current_ver = 279`)
|
- `updates/versions.php` (`$current_ver = 280`)
|
||||||
- Weryfikacja testow przed publikacja:
|
- Weryfikacja testow przed publikacja:
|
||||||
- `OK (437 tests, 1398 assertions)`
|
- `OK (450 tests, 1431 assertions)`
|
||||||
|
|
||||||
### 1. Określ numer wersji
|
### 1. Określ numer wersji
|
||||||
Sprawdź ostatnią wersję w `updates/` i zwiększ o 1.
|
Sprawdź ostatnią wersję w `updates/` i zwiększ o 1.
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ if ( !$lang = \S::get_session( 'lang-' . $lang_id ) )
|
|||||||
\S::set_session( 'lang-' . $lang_id, $lang );
|
\S::set_session( 'lang-' . $lang_id, $lang );
|
||||||
}
|
}
|
||||||
|
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $mdb ) )->allSettings();
|
||||||
$client = \S::get_session( 'client' );
|
$client = \S::get_session( 'client' );
|
||||||
|
|
||||||
if ( \S::get( 'action' ) == 'htaccess' )
|
if ( \S::get( 'action' ) == 'htaccess' )
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="article-entry">
|
<div class="article-entry">
|
||||||
<? $this -> article['language']['seo_link'] ? $url = $this -> article['language']['seo_link'] : $url = 'a-' . $this -> article['id'] . '-' . \S::seo( $this -> article['language']['title'] );?>
|
<? $this -> article['language']['seo_link'] ? $url = $this -> article['language']['seo_link'] : $url = 'a-' . $this -> article['id'] . '-' . \S::seo( $this -> article['language']['title'] );?>
|
||||||
<div class="blog-image">
|
<div class="blog-image">
|
||||||
<a href="/<?= $url;?>" title="<?= $this -> article['language']['title'];?>" <? if ( $this -> article['language']['noindex'] ):?>rel="nofollow"<? endif;?>> <img src="<?= \front\factory\Articles::get_image( $this -> article );?>" alt="<?= $this -> article['language']['title'];?>"></a>
|
<a href="/<?= $url;?>" title="<?= $this -> article['language']['title'];?>" <? if ( $this -> article['language']['noindex'] ):?>rel="nofollow"<? endif;?>> <img src="<?= \front\Views\Articles::getImage( $this -> article );?>" alt="<?= $this -> article['language']['title'];?>"></a>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="article-title">
|
<h3 class="article-title">
|
||||||
<a href="/<? if ( \S::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() ) echo \S::get_session( 'current-lang' ) . '/';?><?= $url;?>" title="<?= $this -> article['language']['title'];?>" <? if ( $this -> article['language']['noindex'] ):?>rel="nofollow"<? endif;?>><?= $this -> article['language']['title'];?></a>
|
<a href="/<? if ( \S::get_session( 'current-lang' ) != ( new \Domain\Languages\LanguagesRepository( $GLOBALS['mdb'] ) )->defaultLanguage() ) echo \S::get_session( 'current-lang' ) . '/';?><?= $url;?>" title="<?= $this -> article['language']['title'];?>" <? if ( $this -> article['language']['noindex'] ):?>rel="nofollow"<? endif;?>><?= $this -> article['language']['title'];?></a>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<? global $lang;?>
|
<? global $lang;?>
|
||||||
<?
|
<?
|
||||||
$text = $this -> article['language']['text'];
|
$text = $this -> article['language']['text'];
|
||||||
$text = \front\factory\Articles::generateHeadersIds( $text );
|
$text = \front\Views\Articles::generateHeadersIds( $text );
|
||||||
?>
|
?>
|
||||||
<div class="article">
|
<div class="article">
|
||||||
<?
|
<?
|
||||||
@@ -55,7 +55,7 @@ $text = \front\factory\Articles::generateHeadersIds( $text );
|
|||||||
<div class="title">
|
<div class="title">
|
||||||
<?= \S::lang( 'spis-tresci' );?>
|
<?= \S::lang( 'spis-tresci' );?>
|
||||||
</div>
|
</div>
|
||||||
<?= \front\factory\Articles::generateTableOfContents( $text );?>
|
<?= \front\Views\Articles::generateTableOfContents( $text );?>
|
||||||
</div>
|
</div>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
@@ -67,7 +67,11 @@ $text = \front\factory\Articles::generateHeadersIds( $text );
|
|||||||
{
|
{
|
||||||
$article_tmp = explode( ':', $article_tmp );
|
$article_tmp = explode( ':', $article_tmp );
|
||||||
if ( $article_tmp[1] != $this -> article['id'] )
|
if ( $article_tmp[1] != $this -> article['id'] )
|
||||||
$text = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', \front\view\Articles::article_full( $article_tmp[1], $lang_id ), $text );
|
{
|
||||||
|
$nestedArticleRepo = new \Domain\Article\ArticleRepository( $GLOBALS['mdb'] );
|
||||||
|
$nestedArticle = $nestedArticleRepo->articleDetailsFrontend( (int)$article_tmp[1], $lang_id );
|
||||||
|
$text = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', $nestedArticle ? \front\Views\Articles::fullArticle( $nestedArticle ) : '', $text );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
$text = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', '', $text );
|
$text = str_replace( '[ARTYKUL:' . $article_tmp[1] . ']', '', $text );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
if ( $this -> article['show_date_modify'] )
|
if ( $this -> article['show_date_modify'] )
|
||||||
echo '<div class="date-add">' . $lang['data-modyfikacji'] . ': ' . $this -> article['date_modify'] . '</div>';
|
echo '<div class="date-add">' . $lang['data-modyfikacji'] . ': ' . $this -> article['date_modify'] . '</div>';
|
||||||
|
|
||||||
if ( $img = \front\factory\Articles::get_image( $this -> article ) ):
|
if ( $img = \front\Views\Articles::getImage( $this -> article ) ):
|
||||||
?>
|
?>
|
||||||
<a href="./<?= $url;?>" title="<?= $this -> article['language']['title'];?>" <? if ( $this -> article['language']['noindex'] ):?>rel="nofollow"<? endif;?>>
|
<a href="./<?= $url;?>" title="<?= $this -> article['language']['title'];?>" <? if ( $this -> article['language']['noindex'] ):?>rel="nofollow"<? endif;?>>
|
||||||
<div style="background: url( '/libraries/thumb.php?img=<?= $img;?>&w=250&h=250' ) no-repeat center;"></div>
|
<div style="background: url( '/libraries/thumb.php?img=<?= $img;?>&w=250&h=250' ) no-repeat center;"></div>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<? global $lang;?>
|
<? global $lang;?>
|
||||||
<?
|
<?
|
||||||
$text = $this -> article['language']['text'];
|
$text = $this -> article['language']['text'];
|
||||||
$text = \front\factory\Articles::generateHeadersIds( $text );
|
$text = \front\Views\Articles::generateHeadersIds( $text );
|
||||||
?>
|
?>
|
||||||
<div class="article">
|
<div class="article">
|
||||||
<?
|
<?
|
||||||
@@ -32,7 +32,7 @@ $text = \front\factory\Articles::generateHeadersIds( $text );
|
|||||||
<div class="title">
|
<div class="title">
|
||||||
<?= \S::lang( 'spis-tresci' );?>
|
<?= \S::lang( 'spis-tresci' );?>
|
||||||
</div>
|
</div>
|
||||||
<?= \front\factory\Articles::generateTableOfContents( $text );?>
|
<?= \front\Views\Articles::generateTableOfContents( $text );?>
|
||||||
</div>
|
</div>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
<? endif;?>
|
<? endif;?>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<? $article['language']['seo_link'] ? $url = $article['language']['seo_link'] : $url = 'a-' . $article['id'] . '-' . \S::seo( $article['language']['title'] );?>
|
<? $article['language']['seo_link'] ? $url = $article['language']['seo_link'] : $url = 'a-' . $article['id'] . '-' . \S::seo( $article['language']['title'] );?>
|
||||||
<a href="/<?= $url;?>" title="<?= $article['language']['title'];?>" <? if ( $article['language']['noindex'] ):?>rel="nofollow"<? endif;?>>
|
<a href="/<?= $url;?>" title="<?= $article['language']['title'];?>" <? if ( $article['language']['noindex'] ):?>rel="nofollow"<? endif;?>>
|
||||||
<div class="blog-image">
|
<div class="blog-image">
|
||||||
<img src="<?= \front\factory\Articles::get_image( $article );?>" alt="<?= $article['language']['title'];?>">
|
<img src="<?= \front\Views\Articles::getImage( $article );?>" alt="<?= $article['language']['title'];?>">
|
||||||
<div class="date-add"><?= date( 'd.m.y', strtotime( $article['date_add'] ) );?></div>
|
<div class="date-add"><?= date( 'd.m.y', strtotime( $article['date_add'] ) );?></div>
|
||||||
</div>
|
</div>
|
||||||
<h3 class="article-title"><?= $article['language']['title'];?></h3>
|
<h3 class="article-title"><?= $article['language']['title'];?></h3>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?
|
<?
|
||||||
if ( is_array( $this -> pages ) ) {
|
if ( is_array( $this -> pages ) ) {
|
||||||
$settings = \front\factory\Settings::settings_details();
|
$settings = ( new \Domain\Settings\SettingsRepository( $GLOBALS['mdb'] ) )->allSettings();
|
||||||
|
|
||||||
echo '<ul class="level-' . $this -> level . ' clear" level="' . $this -> level . '">';
|
echo '<ul class="level-' . $this -> level . ' clear" level="' . $this -> level . '">';
|
||||||
|
|
||||||
|
|||||||
@@ -683,6 +683,292 @@ class ArticleRepositoryTest extends TestCase
|
|||||||
$this->assertMatchesRegularExpression('/LIMIT\s+100\s+OFFSET\s+0/i', $dataSql);
|
$this->assertMatchesRegularExpression('/LIMIT\s+100\s+OFFSET\s+0/i', $dataSql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// =========================================================================
|
||||||
|
// FRONTEND METHODS
|
||||||
|
// =========================================================================
|
||||||
|
|
||||||
|
public function testArticleDetailsFrontendReturnsArticleWithRelations(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->expects($this->once())
|
||||||
|
->method('get')
|
||||||
|
->with('pp_articles', '*', ['id' => 5])
|
||||||
|
->willReturn(['id' => 5, 'status' => 1, 'show_title' => 1]);
|
||||||
|
|
||||||
|
$mockDb->expects($this->exactly(4))
|
||||||
|
->method('select')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
[['lang_id' => 'pl', 'title' => 'Testowy', 'copy_from' => null]],
|
||||||
|
[['id' => 10, 'src' => '/img/a.jpg']],
|
||||||
|
[['id' => 20, 'src' => '/files/a.pdf']],
|
||||||
|
[1, 2]
|
||||||
|
);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$article = $repo->articleDetailsFrontend(5, 'pl');
|
||||||
|
|
||||||
|
$this->assertIsArray($article);
|
||||||
|
$this->assertEquals(5, $article['id']);
|
||||||
|
$this->assertArrayHasKey('language', $article);
|
||||||
|
$this->assertEquals('Testowy', $article['language']['title']);
|
||||||
|
$this->assertCount(1, $article['images']);
|
||||||
|
$this->assertCount(1, $article['files']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArticleDetailsFrontendReturnsNullForMissing(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
$mockDb->expects($this->once())
|
||||||
|
->method('get')
|
||||||
|
->willReturn(false);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$this->assertNull($repo->articleDetailsFrontend(999, 'pl'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArticleDetailsFrontendCopyFromFallback(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->method('get')
|
||||||
|
->willReturn(['id' => 7, 'status' => 1]);
|
||||||
|
|
||||||
|
$mockDb->expects($this->exactly(5))
|
||||||
|
->method('select')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
// First call: langs with copy_from
|
||||||
|
[['lang_id' => 'en', 'title' => 'English', 'copy_from' => 'pl']],
|
||||||
|
// Second call: copy_from fallback
|
||||||
|
[['lang_id' => 'pl', 'title' => 'Polski']],
|
||||||
|
// images
|
||||||
|
[],
|
||||||
|
// files
|
||||||
|
[],
|
||||||
|
// pages
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$article = $repo->articleDetailsFrontend(7, 'en');
|
||||||
|
|
||||||
|
$this->assertEquals('Polski', $article['language']['title']);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function createFetchAllMock(array $data): object
|
||||||
|
{
|
||||||
|
return new class($data) {
|
||||||
|
private $data;
|
||||||
|
public function __construct($data) { $this->data = $data; }
|
||||||
|
public function fetchAll($mode = null) { return $this->data; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArticlesIdsReturnsSortedIds(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->expects($this->once())
|
||||||
|
->method('query')
|
||||||
|
->willReturn($this->createFetchAllMock([
|
||||||
|
['id' => 3],
|
||||||
|
['id' => 7],
|
||||||
|
['id' => 1],
|
||||||
|
]));
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$result = $repo->articlesIds(1, 'pl', 10, 1, 0);
|
||||||
|
|
||||||
|
$this->assertEquals([3, 7, 1], $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArticlesIdsReturnsNullForEmpty(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->method('query')
|
||||||
|
->willReturn($this->createFetchAllMock([]));
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$this->assertNull($repo->articlesIds(1, 'pl', 10, 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPageArticlesCountReturnsInt(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->expects($this->once())
|
||||||
|
->method('query')
|
||||||
|
->willReturn($this->createFetchAllMock([[12]]));
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$this->assertSame(12, $repo->pageArticlesCount(5, 'pl'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPageArticlesCountReturnsZeroForEmpty(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->method('query')
|
||||||
|
->willReturn($this->createFetchAllMock([]));
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$this->assertSame(0, $repo->pageArticlesCount(5, 'pl'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testPageArticlesPagination(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
// pageArticlesCount query returns 25 articles
|
||||||
|
// articlesIds query returns 10 article IDs
|
||||||
|
$mockDb->method('query')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
$this->createFetchAllMock([[25]]),
|
||||||
|
$this->createFetchAllMock([
|
||||||
|
['id' => 11], ['id' => 12], ['id' => 13], ['id' => 14], ['id' => 15],
|
||||||
|
['id' => 16], ['id' => 17], ['id' => 18], ['id' => 19], ['id' => 20],
|
||||||
|
])
|
||||||
|
);
|
||||||
|
|
||||||
|
$page = ['id' => 3, 'articles_limit' => 10, 'sort_type' => 1];
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$result = $repo->pageArticles($page, 'pl', 2);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('articles', $result);
|
||||||
|
$this->assertArrayHasKey('ls', $result);
|
||||||
|
$this->assertSame(3, $result['ls']); // ceil(25/10) = 3
|
||||||
|
$this->assertCount(10, $result['articles']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArticleNoindexReturnsBool(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->expects($this->once())
|
||||||
|
->method('get')
|
||||||
|
->with('pp_articles_langs', 'noindex', [
|
||||||
|
'AND' => ['article_id' => 5, 'lang_id' => 'pl']
|
||||||
|
])
|
||||||
|
->willReturn(1);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$this->assertTrue($repo->articleNoindex(5, 'pl'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testArticleNoindexReturnsFalseForNonNoindex(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$mockDb->method('get')
|
||||||
|
->willReturn(null);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$this->assertFalse($repo->articleNoindex(5, 'pl'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNewsReturnsArticlesArray(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
// First get() for sort_type, then get() for article_details
|
||||||
|
$mockDb->method('get')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
1, // sort_type
|
||||||
|
['id' => 10, 'status' => 1] // article data
|
||||||
|
);
|
||||||
|
|
||||||
|
// articlesIds query returns [10]
|
||||||
|
$mockDb->method('query')
|
||||||
|
->willReturn($this->createFetchAllMock([['id' => 10]]));
|
||||||
|
|
||||||
|
// article details selects
|
||||||
|
$mockDb->method('select')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
[['lang_id' => 'pl', 'title' => 'News', 'copy_from' => null]],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$result = $repo->news(3, 6, 'pl');
|
||||||
|
|
||||||
|
$this->assertIsArray($result);
|
||||||
|
$this->assertCount(1, $result);
|
||||||
|
$this->assertEquals(10, $result[0]['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testTopArticlesOrderByViews(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$queryCalls = 0;
|
||||||
|
$mockDb->method('query')
|
||||||
|
->willReturnCallback(function ($sql) use (&$queryCalls) {
|
||||||
|
$queryCalls++;
|
||||||
|
if ($queryCalls === 1) {
|
||||||
|
$this->assertStringContainsString('views DESC', $sql);
|
||||||
|
return $this->createFetchAllMock([
|
||||||
|
['id' => 5, 'date_add' => '2025-01-01', 'views' => 100, 'title' => 'Popular'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->createFetchAllMock([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$mockDb->method('get')
|
||||||
|
->willReturn(['id' => 5, 'status' => 1]);
|
||||||
|
|
||||||
|
$mockDb->method('select')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
[['lang_id' => 'pl', 'title' => 'Popular', 'copy_from' => null]],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$result = $repo->topArticles(3, 6, 'pl');
|
||||||
|
|
||||||
|
$this->assertIsArray($result);
|
||||||
|
$this->assertCount(1, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testNewsListArticlesOrderByDateDesc(): void
|
||||||
|
{
|
||||||
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|
||||||
|
$queryCalls = 0;
|
||||||
|
$mockDb->method('query')
|
||||||
|
->willReturnCallback(function ($sql) use (&$queryCalls) {
|
||||||
|
$queryCalls++;
|
||||||
|
if ($queryCalls === 1) {
|
||||||
|
$this->assertStringContainsString('date_add DESC', $sql);
|
||||||
|
return $this->createFetchAllMock([
|
||||||
|
['id' => 8, 'date_add' => '2025-06-15', 'title' => 'Newest'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
return $this->createFetchAllMock([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$mockDb->method('get')
|
||||||
|
->willReturn(['id' => 8, 'status' => 1]);
|
||||||
|
|
||||||
|
$mockDb->method('select')
|
||||||
|
->willReturnOnConsecutiveCalls(
|
||||||
|
[['lang_id' => 'pl', 'title' => 'Newest', 'copy_from' => null]],
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
|
$repo = new ArticleRepository($mockDb);
|
||||||
|
$result = $repo->newsListArticles(3, 6, 'pl');
|
||||||
|
|
||||||
|
$this->assertIsArray($result);
|
||||||
|
$this->assertCount(1, $result);
|
||||||
|
}
|
||||||
|
|
||||||
public function testListForAdminUsesBoundParamsForTitleFilter(): void
|
public function testListForAdminUsesBoundParamsForTitleFilter(): void
|
||||||
{
|
{
|
||||||
$mockDb = $this->createMock(\medoo::class);
|
$mockDb = $this->createMock(\medoo::class);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ if (!class_exists('S')) {
|
|||||||
public static function send_email($to, $subject, $body) { return true; }
|
public static function send_email($to, $subject, $body) { return true; }
|
||||||
public static function remove_special_chars($str) { return str_ireplace(['\'', '"', ',', ';', '<', '>'], ' ', $str); }
|
public static function remove_special_chars($str) { return str_ireplace(['\'', '"', ',', ';', '<', '>'], ' ', $str); }
|
||||||
public static function normalize_decimal($val, $precision = 2) { return round((float)$val, $precision); }
|
public static function normalize_decimal($val, $precision = 2) { return round((float)$val, $precision); }
|
||||||
|
public static function is_array_fix($value) { return is_array($value) && count($value); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
BIN
updates/0.20/ver_0.280.zip
Normal file
BIN
updates/0.20/ver_0.280.zip
Normal file
Binary file not shown.
2
updates/0.20/ver_0.280_files.txt
Normal file
2
updates/0.20/ver_0.280_files.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
F: ../autoload/class.Article.php
|
||||||
|
F: ../autoload/front/factory/class.Settings.php
|
||||||
@@ -1,3 +1,14 @@
|
|||||||
|
<b>ver. 0.280 - 16.02.2026</b><br />
|
||||||
|
- UPDATE - migracja Articles frontend: factory + view + encja do Domain/Views (DI)
|
||||||
|
- NEW - `front\Views\Articles` — czysty VIEW + utility (renderowanie, generateTableOfContents, generateHeadersIds, getImage)
|
||||||
|
- UPDATE - `ArticleRepository` rozszerzony o 8 metod frontendowych (z Redis cache)
|
||||||
|
- UPDATE - `front\view\Site::show()` — 5 sekcji przepietych na repo + Views
|
||||||
|
- UPDATE - `front\controls\Site::route()` — single article + page_type switch przepiete na repo + Views
|
||||||
|
- UPDATE - 5 szablonow `templates/articles/*` przepietych na `\front\Views\Articles::`
|
||||||
|
- CLEANUP - usuniete: `class.Article` (encja + metody statyczne), `front\factory\Settings` (fasada)
|
||||||
|
- FIX - eliminacja `global $lang` z `articleNoindex()`, eliminacja zaleznosci od `front\factory\Pages::page_sort()`
|
||||||
|
- UPDATE - testy: `OK (450 tests, 1431 assertions)`
|
||||||
|
<hr>
|
||||||
<b>ver. 0.279 - 16.02.2026</b><br />
|
<b>ver. 0.279 - 16.02.2026</b><br />
|
||||||
- UPDATE - migracja Newsletter frontend: factory + view + controls do Domain/Controllers/Views (DI)
|
- UPDATE - migracja Newsletter frontend: factory + view + controls do Domain/Controllers/Views (DI)
|
||||||
- UPDATE - nowy namespace `front\Controllers` z `NewsletterController` (DI via factory closures)
|
- UPDATE - nowy namespace `front\Controllers` z `NewsletterController` (DI via factory closures)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?
|
<?
|
||||||
$current_ver = 279;
|
$current_ver = 280;
|
||||||
|
|
||||||
for ($i = 1; $i <= $current_ver; $i++)
|
for ($i = 1; $i <= $current_ver; $i++)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user